repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
spring-cloud/spring-cloud-config
spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategyFactory.java
VaultKvAccessStrategyFactory.forVersion
public static VaultKvAccessStrategy forVersion(RestOperations rest, String baseUrl, int version) { switch (version) { case 1: return new V1VaultKvAccessStrategy(baseUrl, rest); case 2: return new V2VaultKvAccessStrategy(baseUrl, rest); default: throw new IllegalArgumentException( "No support for given Vault k/v backend version " + version); } }
java
public static VaultKvAccessStrategy forVersion(RestOperations rest, String baseUrl, int version) { switch (version) { case 1: return new V1VaultKvAccessStrategy(baseUrl, rest); case 2: return new V2VaultKvAccessStrategy(baseUrl, rest); default: throw new IllegalArgumentException( "No support for given Vault k/v backend version " + version); } }
[ "public", "static", "VaultKvAccessStrategy", "forVersion", "(", "RestOperations", "rest", ",", "String", "baseUrl", ",", "int", "version", ")", "{", "switch", "(", "version", ")", "{", "case", "1", ":", "return", "new", "V1VaultKvAccessStrategy", "(", "baseUrl",...
Create a new {@link VaultKvAccessStrategy} given {@link RestOperations}, {@code baseUrl}, and {@code version}. @param rest must not be {@literal null}. @param baseUrl the Vault base URL. @param version version of the Vault key-value backend. @return the access strategy.
[ "Create", "a", "new", "{" ]
train
https://github.com/spring-cloud/spring-cloud-config/blob/6b99631f78bac4e1b521d2cc126c8b2da45d1f1f/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/environment/VaultKvAccessStrategyFactory.java#L44-L56
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java
HttpFileUploadManager.uploadFile
public URL uploadFile(File file) throws InterruptedException, XMPPException.XMPPErrorException, SmackException, IOException { return uploadFile(file, null); }
java
public URL uploadFile(File file) throws InterruptedException, XMPPException.XMPPErrorException, SmackException, IOException { return uploadFile(file, null); }
[ "public", "URL", "uploadFile", "(", "File", "file", ")", "throws", "InterruptedException", ",", "XMPPException", ".", "XMPPErrorException", ",", "SmackException", ",", "IOException", "{", "return", "uploadFile", "(", "file", ",", "null", ")", ";", "}" ]
Request slot and uploaded file to HTTP file upload service. You don't need to request slot and upload file separately, this method will do both. Note that this is a synchronous call -- Smack must wait for the server response. @param file file to be uploaded @return public URL for sharing uploaded file @throws InterruptedException @throws XMPPException.XMPPErrorException @throws SmackException @throws IOException in case of HTTP upload errors
[ "Request", "slot", "and", "uploaded", "file", "to", "HTTP", "file", "upload", "service", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/HttpFileUploadManager.java#L236-L239
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java
HttpFields.addDateField
public void addDateField(String name, long date) { if (_dateBuffer==null) { _dateBuffer=new StringBuffer(32); _calendar=new HttpCal(); } _dateBuffer.setLength(0); _calendar.setTimeInMillis(date); formatDate(_dateBuffer, _calendar, false); add(name, _dateBuffer.toString()); }
java
public void addDateField(String name, long date) { if (_dateBuffer==null) { _dateBuffer=new StringBuffer(32); _calendar=new HttpCal(); } _dateBuffer.setLength(0); _calendar.setTimeInMillis(date); formatDate(_dateBuffer, _calendar, false); add(name, _dateBuffer.toString()); }
[ "public", "void", "addDateField", "(", "String", "name", ",", "long", "date", ")", "{", "if", "(", "_dateBuffer", "==", "null", ")", "{", "_dateBuffer", "=", "new", "StringBuffer", "(", "32", ")", ";", "_calendar", "=", "new", "HttpCal", "(", ")", ";",...
Adds the value of a date field. @param name the field name @param date the field date value
[ "Adds", "the", "value", "of", "a", "date", "field", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/http/HttpFields.java#L1063-L1074
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.createGroup
public CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent) throws CmsIllegalArgumentException, CmsException { // check the group name OpenCms.getValidationHandler().checkGroupName(CmsOrganizationalUnit.getSimpleName(name)); // trim the name name = name.trim(); // check the OU readOrganizationalUnit(dbc, CmsOrganizationalUnit.getParentFqn(name)); // get the id of the parent group if necessary if (CmsStringUtil.isNotEmpty(parent)) { CmsGroup parentGroup = readGroup(dbc, parent); if (!parentGroup.isRole() && !CmsOrganizationalUnit.getParentFqn(parent).equals(CmsOrganizationalUnit.getParentFqn(name))) { throw new CmsDataAccessException( Messages.get().container( Messages.ERR_PARENT_GROUP_MUST_BE_IN_SAME_OU_3, CmsOrganizationalUnit.getSimpleName(name), CmsOrganizationalUnit.getParentFqn(name), parent)); } } // create the group CmsGroup group = getUserDriver(dbc).createGroup(dbc, id, name, description, flags, parent); // if the group is in fact a role, initialize it if (group.isVirtual()) { // get all users that have the given role String groupname = CmsRole.valueOf(group).getGroupName(); Iterator<CmsUser> it = getUsersOfGroup(dbc, groupname, true, false, true).iterator(); while (it.hasNext()) { CmsUser user = it.next(); // put them in the new group addUserToGroup(dbc, user.getName(), group.getName(), true); } } // put it into the cache m_monitor.cacheGroup(group); if (!dbc.getProjectId().isNullUUID()) { // group modified event is not needed return group; } // fire group modified event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_GROUP_NAME, group.getName()); eventData.put(I_CmsEventListener.KEY_GROUP_ID, group.getId().toString()); eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_GROUP_MODIFIED_ACTION_CREATE); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_GROUP_MODIFIED, eventData)); // return it return group; }
java
public CmsGroup createGroup(CmsDbContext dbc, CmsUUID id, String name, String description, int flags, String parent) throws CmsIllegalArgumentException, CmsException { // check the group name OpenCms.getValidationHandler().checkGroupName(CmsOrganizationalUnit.getSimpleName(name)); // trim the name name = name.trim(); // check the OU readOrganizationalUnit(dbc, CmsOrganizationalUnit.getParentFqn(name)); // get the id of the parent group if necessary if (CmsStringUtil.isNotEmpty(parent)) { CmsGroup parentGroup = readGroup(dbc, parent); if (!parentGroup.isRole() && !CmsOrganizationalUnit.getParentFqn(parent).equals(CmsOrganizationalUnit.getParentFqn(name))) { throw new CmsDataAccessException( Messages.get().container( Messages.ERR_PARENT_GROUP_MUST_BE_IN_SAME_OU_3, CmsOrganizationalUnit.getSimpleName(name), CmsOrganizationalUnit.getParentFqn(name), parent)); } } // create the group CmsGroup group = getUserDriver(dbc).createGroup(dbc, id, name, description, flags, parent); // if the group is in fact a role, initialize it if (group.isVirtual()) { // get all users that have the given role String groupname = CmsRole.valueOf(group).getGroupName(); Iterator<CmsUser> it = getUsersOfGroup(dbc, groupname, true, false, true).iterator(); while (it.hasNext()) { CmsUser user = it.next(); // put them in the new group addUserToGroup(dbc, user.getName(), group.getName(), true); } } // put it into the cache m_monitor.cacheGroup(group); if (!dbc.getProjectId().isNullUUID()) { // group modified event is not needed return group; } // fire group modified event Map<String, Object> eventData = new HashMap<String, Object>(); eventData.put(I_CmsEventListener.KEY_GROUP_NAME, group.getName()); eventData.put(I_CmsEventListener.KEY_GROUP_ID, group.getId().toString()); eventData.put(I_CmsEventListener.KEY_USER_ACTION, I_CmsEventListener.VALUE_GROUP_MODIFIED_ACTION_CREATE); OpenCms.fireCmsEvent(new CmsEvent(I_CmsEventListener.EVENT_GROUP_MODIFIED, eventData)); // return it return group; }
[ "public", "CmsGroup", "createGroup", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "id", ",", "String", "name", ",", "String", "description", ",", "int", "flags", ",", "String", "parent", ")", "throws", "CmsIllegalArgumentException", ",", "CmsException", "{", "// ...
Add a new group to the Cms.<p> Only the admin can do this. Only users, which are in the group "administrators" are granted.<p> @param dbc the current database context @param id the id of the new group @param name the name of the new group @param description the description for the new group @param flags the flags for the new group @param parent the name of the parent group (or <code>null</code>) @return new created group @throws CmsException if the creation of the group failed @throws CmsIllegalArgumentException if the length of the given name was below 1
[ "Add", "a", "new", "group", "to", "the", "Cms", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L1315-L1371
lastaflute/lastaflute
src/main/java/org/lastaflute/web/hook/GodHandPrologue.java
GodHandPrologue.createSqlStringFilter
protected SqlStringFilter createSqlStringFilter(ActionRuntime runtime) { final Method actionMethod = runtime.getExecuteMethod(); return newRomanticTraceableSqlStringFilter(actionMethod, () -> { return buildSqlMarkingAdditionalInfo(); // lazy because it may be auto-login later }); }
java
protected SqlStringFilter createSqlStringFilter(ActionRuntime runtime) { final Method actionMethod = runtime.getExecuteMethod(); return newRomanticTraceableSqlStringFilter(actionMethod, () -> { return buildSqlMarkingAdditionalInfo(); // lazy because it may be auto-login later }); }
[ "protected", "SqlStringFilter", "createSqlStringFilter", "(", "ActionRuntime", "runtime", ")", "{", "final", "Method", "actionMethod", "=", "runtime", ".", "getExecuteMethod", "(", ")", ";", "return", "newRomanticTraceableSqlStringFilter", "(", "actionMethod", ",", "(",...
Create the filter of SQL string for DBFlute. @param runtime The runtime meta of action execute. (NotNull) @return The filter of SQL string. (NullAllowed: if null, no filter)
[ "Create", "the", "filter", "of", "SQL", "string", "for", "DBFlute", "." ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/hook/GodHandPrologue.java#L169-L174
aws/aws-sdk-java
aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/ProvisioningArtifactSummary.java
ProvisioningArtifactSummary.withProvisioningArtifactMetadata
public ProvisioningArtifactSummary withProvisioningArtifactMetadata(java.util.Map<String, String> provisioningArtifactMetadata) { setProvisioningArtifactMetadata(provisioningArtifactMetadata); return this; }
java
public ProvisioningArtifactSummary withProvisioningArtifactMetadata(java.util.Map<String, String> provisioningArtifactMetadata) { setProvisioningArtifactMetadata(provisioningArtifactMetadata); return this; }
[ "public", "ProvisioningArtifactSummary", "withProvisioningArtifactMetadata", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "provisioningArtifactMetadata", ")", "{", "setProvisioningArtifactMetadata", "(", "provisioningArtifactMetadata", ")", ";", ...
<p> The metadata for the provisioning artifact. This is used with AWS Marketplace products. </p> @param provisioningArtifactMetadata The metadata for the provisioning artifact. This is used with AWS Marketplace products. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "metadata", "for", "the", "provisioning", "artifact", ".", "This", "is", "used", "with", "AWS", "Marketplace", "products", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-servicecatalog/src/main/java/com/amazonaws/services/servicecatalog/model/ProvisioningArtifactSummary.java#L257-L260
alkacon/opencms-core
src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditToolbarHandler.java
CmsDirectEditToolbarHandler.insertContextMenu
public void insertContextMenu(List<CmsContextMenuEntryBean> menuBeans, CmsUUID structureId) { List<I_CmsContextMenuEntry> menuEntries = transformEntries(menuBeans, structureId); m_contextButton.showMenu(menuEntries); }
java
public void insertContextMenu(List<CmsContextMenuEntryBean> menuBeans, CmsUUID structureId) { List<I_CmsContextMenuEntry> menuEntries = transformEntries(menuBeans, structureId); m_contextButton.showMenu(menuEntries); }
[ "public", "void", "insertContextMenu", "(", "List", "<", "CmsContextMenuEntryBean", ">", "menuBeans", ",", "CmsUUID", "structureId", ")", "{", "List", "<", "I_CmsContextMenuEntry", ">", "menuEntries", "=", "transformEntries", "(", "menuBeans", ",", "structureId", ")...
Inserts the context menu.<p> @param menuBeans the menu beans from the server @param structureId the structure id of the resource at which the workplace should be opened
[ "Inserts", "the", "context", "menu", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/editprovider/client/CmsDirectEditToolbarHandler.java#L167-L171
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java
ServiceExtensionLoader.createFromLoadExtension
private <T extends Assignable> T createFromLoadExtension(Class<T> extensionClass, Archive<?> archive) { ExtensionWrapper extensionWrapper = loadExtensionMapping(extensionClass); if (extensionWrapper == null) { throw new RuntimeException("Failed to load ExtensionMapping"); } Class<T> extensionImplClass = loadExtension(extensionWrapper); if (!extensionClass.isAssignableFrom(extensionImplClass)) { throw new RuntimeException("Found extension impl class " + extensionImplClass.getName() + " not assignable to extension interface " + extensionClass.getName()); } return createExtension(extensionImplClass, archive); }
java
private <T extends Assignable> T createFromLoadExtension(Class<T> extensionClass, Archive<?> archive) { ExtensionWrapper extensionWrapper = loadExtensionMapping(extensionClass); if (extensionWrapper == null) { throw new RuntimeException("Failed to load ExtensionMapping"); } Class<T> extensionImplClass = loadExtension(extensionWrapper); if (!extensionClass.isAssignableFrom(extensionImplClass)) { throw new RuntimeException("Found extension impl class " + extensionImplClass.getName() + " not assignable to extension interface " + extensionClass.getName()); } return createExtension(extensionImplClass, archive); }
[ "private", "<", "T", "extends", "Assignable", ">", "T", "createFromLoadExtension", "(", "Class", "<", "T", ">", "extensionClass", ",", "Archive", "<", "?", ">", "archive", ")", "{", "ExtensionWrapper", "extensionWrapper", "=", "loadExtensionMapping", "(", "exten...
Creates a new instance of a <code>extensionClass</code> implementation. The implementation class is found in a provider-configuration file in META-INF/services/ @param <T> @param extensionClass @param archive @return an instance of the <code>extensionClass</code>' implementation.
[ "Creates", "a", "new", "instance", "of", "a", "<code", ">", "extensionClass<", "/", "code", ">", "implementation", ".", "The", "implementation", "class", "is", "found", "in", "a", "provider", "-", "configuration", "file", "in", "META", "-", "INF", "/", "se...
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/ServiceExtensionLoader.java#L211-L224
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/SafeTraceLevelIndexFactory.java
SafeTraceLevelIndexFactory.addFiltersAndValuesToIndex
private static void addFiltersAndValuesToIndex(BufferedReader br, PackageIndex<Integer> packageIndex) throws IOException { String line; while ((line = br.readLine()) != null) { if (line.isEmpty() || line.startsWith("#")) { continue; } int pos = line.indexOf('='); if (pos > 0) { String filter = line.substring(0, pos).trim(); String value = line.substring(pos + 1).trim(); packageIndex.add(filter, getMinLevelIndex(value)); } } }
java
private static void addFiltersAndValuesToIndex(BufferedReader br, PackageIndex<Integer> packageIndex) throws IOException { String line; while ((line = br.readLine()) != null) { if (line.isEmpty() || line.startsWith("#")) { continue; } int pos = line.indexOf('='); if (pos > 0) { String filter = line.substring(0, pos).trim(); String value = line.substring(pos + 1).trim(); packageIndex.add(filter, getMinLevelIndex(value)); } } }
[ "private", "static", "void", "addFiltersAndValuesToIndex", "(", "BufferedReader", "br", ",", "PackageIndex", "<", "Integer", ">", "packageIndex", ")", "throws", "IOException", "{", "String", "line", ";", "while", "(", "(", "line", "=", "br", ".", "readLine", "...
/* Add the filters and values to the index. The values are inserted as Integers for easy comparison in TraceComponent and to avoid having to recompute each time the spec is checked.
[ "/", "*", "Add", "the", "filters", "and", "values", "to", "the", "index", ".", "The", "values", "are", "inserted", "as", "Integers", "for", "easy", "comparison", "in", "TraceComponent", "and", "to", "avoid", "having", "to", "recompute", "each", "time", "th...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ws/logging/internal/SafeTraceLevelIndexFactory.java#L72-L85
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.cdn_webstorage_serviceName_storage_GET
public ArrayList<String> cdn_webstorage_serviceName_storage_GET(String serviceName, OvhOrderStorageEnum storage) throws IOException { String qPath = "/order/cdn/webstorage/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); query(sb, "storage", storage); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> cdn_webstorage_serviceName_storage_GET(String serviceName, OvhOrderStorageEnum storage) throws IOException { String qPath = "/order/cdn/webstorage/{serviceName}/storage"; StringBuilder sb = path(qPath, serviceName); query(sb, "storage", storage); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "cdn_webstorage_serviceName_storage_GET", "(", "String", "serviceName", ",", "OvhOrderStorageEnum", "storage", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/cdn/webstorage/{serviceName}/storage\"", ";", "Stri...
Get allowed durations for 'storage' option REST: GET /order/cdn/webstorage/{serviceName}/storage @param storage [required] Storage option that will be ordered @param serviceName [required] The internal name of your CDN Static offer
[ "Get", "allowed", "durations", "for", "storage", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5466-L5472
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.xbarStd
public static double xbarStd(double std, int sampleN) { return Math.sqrt(xbarVariance(std*std, sampleN, Integer.MAX_VALUE)); }
java
public static double xbarStd(double std, int sampleN) { return Math.sqrt(xbarVariance(std*std, sampleN, Integer.MAX_VALUE)); }
[ "public", "static", "double", "xbarStd", "(", "double", "std", ",", "int", "sampleN", ")", "{", "return", "Math", ".", "sqrt", "(", "xbarVariance", "(", "std", "*", "std", ",", "sampleN", ",", "Integer", ".", "MAX_VALUE", ")", ")", ";", "}" ]
Calculates Standard Deviation for Xbar for infinite population size @param std @param sampleN @return
[ "Calculates", "Standard", "Deviation", "for", "Xbar", "for", "infinite", "population", "size" ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L178-L180
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLClause.java
AbstractSQLClause.startContext
protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) { SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection, entity); listeners.start(context); return context; }
java
protected SQLListenerContextImpl startContext(Connection connection, QueryMetadata metadata, RelationalPath<?> entity) { SQLListenerContextImpl context = new SQLListenerContextImpl(metadata, connection, entity); listeners.start(context); return context; }
[ "protected", "SQLListenerContextImpl", "startContext", "(", "Connection", "connection", ",", "QueryMetadata", "metadata", ",", "RelationalPath", "<", "?", ">", "entity", ")", "{", "SQLListenerContextImpl", "context", "=", "new", "SQLListenerContextImpl", "(", "metadata"...
Called to create and start a new SQL Listener context @param connection the database connection @param metadata the meta data for that context @param entity the entity for that context @return the newly started context
[ "Called", "to", "create", "and", "start", "a", "new", "SQL", "Listener", "context" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLClause.java#L98-L102
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java
VelocityRenderer.noTemplatePaintHtml
@Deprecated protected void noTemplatePaintHtml(final WComponent component, final Writer writer) { try { writer.write("<!-- Start " + url + " not found -->\n"); new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer); writer.write("<!-- End " + url + " (template not found) -->\n"); } catch (IOException e) { LOG.error("Failed to paint component", e); } }
java
@Deprecated protected void noTemplatePaintHtml(final WComponent component, final Writer writer) { try { writer.write("<!-- Start " + url + " not found -->\n"); new VelocityRenderer(NO_TEMPLATE_LAYOUT).paintXml(component, writer); writer.write("<!-- End " + url + " (template not found) -->\n"); } catch (IOException e) { LOG.error("Failed to paint component", e); } }
[ "@", "Deprecated", "protected", "void", "noTemplatePaintHtml", "(", "final", "WComponent", "component", ",", "final", "Writer", "writer", ")", "{", "try", "{", "writer", ".", "write", "(", "\"<!-- Start \"", "+", "url", "+", "\" not found -->\\n\"", ")", ";", ...
Paints the component in HTML using the NoTemplateLayout. @param component the component to paint. @param writer the writer to send the HTML output to. @deprecated Unused. Will be removed in the next major release.
[ "Paints", "the", "component", "in", "HTML", "using", "the", "NoTemplateLayout", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/VelocityRenderer.java#L319-L328
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java
BackupLongTermRetentionVaultsInner.listByServerAsync
public Observable<List<BackupLongTermRetentionVaultInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<BackupLongTermRetentionVaultInner>>, List<BackupLongTermRetentionVaultInner>>() { @Override public List<BackupLongTermRetentionVaultInner> call(ServiceResponse<List<BackupLongTermRetentionVaultInner>> response) { return response.body(); } }); }
java
public Observable<List<BackupLongTermRetentionVaultInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<BackupLongTermRetentionVaultInner>>, List<BackupLongTermRetentionVaultInner>>() { @Override public List<BackupLongTermRetentionVaultInner> call(ServiceResponse<List<BackupLongTermRetentionVaultInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "BackupLongTermRetentionVaultInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serve...
Gets server backup long term retention vaults in a server. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;BackupLongTermRetentionVaultInner&gt; object
[ "Gets", "server", "backup", "long", "term", "retention", "vaults", "in", "a", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/BackupLongTermRetentionVaultsInner.java#L374-L381
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java
TxConfidenceTable.seen
public TransactionConfidence seen(Sha256Hash hash, PeerAddress byPeer) { TransactionConfidence confidence; boolean fresh = false; lock.lock(); try { cleanTable(); confidence = getOrCreate(hash); fresh = confidence.markBroadcastBy(byPeer); } finally { lock.unlock(); } if (fresh) confidence.queueListeners(TransactionConfidence.Listener.ChangeReason.SEEN_PEERS); return confidence; }
java
public TransactionConfidence seen(Sha256Hash hash, PeerAddress byPeer) { TransactionConfidence confidence; boolean fresh = false; lock.lock(); try { cleanTable(); confidence = getOrCreate(hash); fresh = confidence.markBroadcastBy(byPeer); } finally { lock.unlock(); } if (fresh) confidence.queueListeners(TransactionConfidence.Listener.ChangeReason.SEEN_PEERS); return confidence; }
[ "public", "TransactionConfidence", "seen", "(", "Sha256Hash", "hash", ",", "PeerAddress", "byPeer", ")", "{", "TransactionConfidence", "confidence", ";", "boolean", "fresh", "=", "false", ";", "lock", ".", "lock", "(", ")", ";", "try", "{", "cleanTable", "(", ...
Called by peers when they see a transaction advertised in an "inv" message. It passes the data on to the relevant {@link TransactionConfidence} object, creating it if needed. @return the number of peers that have now announced this hash (including the caller)
[ "Called", "by", "peers", "when", "they", "see", "a", "transaction", "advertised", "in", "an", "inv", "message", ".", "It", "passes", "the", "data", "on", "to", "the", "relevant", "{", "@link", "TransactionConfidence", "}", "object", "creating", "it", "if", ...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/TxConfidenceTable.java#L144-L158
xebia/Xebium
src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java
SeleniumDriverFixture.startBrowserOnUrl
public void startBrowserOnUrl(final String browser, final String browserUrl) { setBrowser(browser); startDriverOnUrl(defaultWebDriverInstance(), browserUrl); }
java
public void startBrowserOnUrl(final String browser, final String browserUrl) { setBrowser(browser); startDriverOnUrl(defaultWebDriverInstance(), browserUrl); }
[ "public", "void", "startBrowserOnUrl", "(", "final", "String", "browser", ",", "final", "String", "browserUrl", ")", "{", "setBrowser", "(", "browser", ")", ";", "startDriverOnUrl", "(", "defaultWebDriverInstance", "(", ")", ",", "browserUrl", ")", ";", "}" ]
<p><code> | start browser | <i>firefox</i> | on url | <i>http://localhost</i> | </code></p> @param browser @param browserUrl
[ "<p", ">", "<code", ">", "|", "start", "browser", "|", "<i", ">", "firefox<", "/", "i", ">", "|", "on", "url", "|", "<i", ">", "http", ":", "//", "localhost<", "/", "i", ">", "|", "<", "/", "code", ">", "<", "/", "p", ">" ]
train
https://github.com/xebia/Xebium/blob/594f6d9e65622acdbd03dba0700b17645981da1f/src/main/java/com/xebia/incubator/xebium/SeleniumDriverFixture.java#L182-L185
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.createGraphicsShapes
public java.awt.Graphics2D createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality) { return new PdfGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality); }
java
public java.awt.Graphics2D createGraphicsShapes(float width, float height, boolean convertImagesToJPEG, float quality) { return new PdfGraphics2D(this, width, height, null, true, convertImagesToJPEG, quality); }
[ "public", "java", ".", "awt", ".", "Graphics2D", "createGraphicsShapes", "(", "float", "width", ",", "float", "height", ",", "boolean", "convertImagesToJPEG", ",", "float", "quality", ")", "{", "return", "new", "PdfGraphics2D", "(", "this", ",", "width", ",", ...
Gets a <CODE>Graphics2D</CODE> to print on. The graphics are translated to PDF commands. @param width @param height @param convertImagesToJPEG @param quality @return A Graphics2D object
[ "Gets", "a", "<CODE", ">", "Graphics2D<", "/", "CODE", ">", "to", "print", "on", ".", "The", "graphics", "are", "translated", "to", "PDF", "commands", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L2860-L2862
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createManagedUser
public ManagedUser createManagedUser(final String username, final String passwordHash) { return createManagedUser(username, null, null, passwordHash, false, false, false); }
java
public ManagedUser createManagedUser(final String username, final String passwordHash) { return createManagedUser(username, null, null, passwordHash, false, false, false); }
[ "public", "ManagedUser", "createManagedUser", "(", "final", "String", "username", ",", "final", "String", "passwordHash", ")", "{", "return", "createManagedUser", "(", "username", ",", "null", ",", "null", ",", "passwordHash", ",", "false", ",", "false", ",", ...
Creates a new ManagedUser object. @param username The username for the user @param passwordHash The hashed password. @return a ManagedUser @see alpine.auth.PasswordService @since 1.0.0
[ "Creates", "a", "new", "ManagedUser", "object", "." ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L233-L235
fabric8io/fabric8-forge
addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java
CamelCatalogHelper.isModelSupportOutput
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String output = propertyMap.get("output"); if (output != null) { return "true".equals(output); } } } return false; }
java
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String output = propertyMap.get("output"); if (output != null) { return "true".equals(output); } } } return false; }
[ "public", "static", "boolean", "isModelSupportOutput", "(", "CamelCatalog", "camelCatalog", ",", "String", "modelName", ")", "{", "// use the camel catalog", "String", "json", "=", "camelCatalog", ".", "modelJSonSchema", "(", "modelName", ")", ";", "if", "(", "json"...
Whether the EIP supports outputs @param modelName the model name @return <tt>true</tt> if output supported, <tt>false</tt> otherwise
[ "Whether", "the", "EIP", "supports", "outputs" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java#L429-L446
threerings/nenya
core/src/main/java/com/threerings/util/KeyTranslatorImpl.java
KeyTranslatorImpl.addPressCommand
public void addPressCommand (int keyCode, String command, int rate, long repeatDelay) { KeyRecord krec = getKeyRecord(keyCode); krec.pressCommand = command; krec.repeatRate = rate; krec.repeatDelay = repeatDelay; }
java
public void addPressCommand (int keyCode, String command, int rate, long repeatDelay) { KeyRecord krec = getKeyRecord(keyCode); krec.pressCommand = command; krec.repeatRate = rate; krec.repeatDelay = repeatDelay; }
[ "public", "void", "addPressCommand", "(", "int", "keyCode", ",", "String", "command", ",", "int", "rate", ",", "long", "repeatDelay", ")", "{", "KeyRecord", "krec", "=", "getKeyRecord", "(", "keyCode", ")", ";", "krec", ".", "pressCommand", "=", "command", ...
Adds a mapping from a key press to an action command string that will auto-repeat at the specified repeat rate after the specified auto-repeat delay has expired. Overwrites any existing mapping for the specified key code that may have already been registered. @param rate the number of times each second that the key press should be repeated while the key is down; passing <code>0</code> will result in no repeating. @param repeatDelay the delay in milliseconds before auto-repeating key press events will be generated for the key.
[ "Adds", "a", "mapping", "from", "a", "key", "press", "to", "an", "action", "command", "string", "that", "will", "auto", "-", "repeat", "at", "the", "specified", "repeat", "rate", "after", "the", "specified", "auto", "-", "repeat", "delay", "has", "expired"...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/util/KeyTranslatorImpl.java#L70-L76
grails/grails-core
grails-core/src/main/groovy/org/grails/plugins/BasePluginFilter.java
BasePluginFilter.filterPluginList
public List<GrailsPlugin> filterPluginList(List<GrailsPlugin> original) { originalPlugins = Collections.unmodifiableList(original); addedNames = new HashSet<String>(); buildNameMap(); buildExplicitlyNamedList(); buildDerivedPluginList(); List<GrailsPlugin> pluginList = new ArrayList<GrailsPlugin>(); pluginList.addAll(explicitlyNamedPlugins); pluginList.addAll(derivedPlugins); return getPluginList(originalPlugins, pluginList); }
java
public List<GrailsPlugin> filterPluginList(List<GrailsPlugin> original) { originalPlugins = Collections.unmodifiableList(original); addedNames = new HashSet<String>(); buildNameMap(); buildExplicitlyNamedList(); buildDerivedPluginList(); List<GrailsPlugin> pluginList = new ArrayList<GrailsPlugin>(); pluginList.addAll(explicitlyNamedPlugins); pluginList.addAll(derivedPlugins); return getPluginList(originalPlugins, pluginList); }
[ "public", "List", "<", "GrailsPlugin", ">", "filterPluginList", "(", "List", "<", "GrailsPlugin", ">", "original", ")", "{", "originalPlugins", "=", "Collections", ".", "unmodifiableList", "(", "original", ")", ";", "addedNames", "=", "new", "HashSet", "<", "S...
Template method shared by subclasses of <code>BasePluginFilter</code>.
[ "Template", "method", "shared", "by", "subclasses", "of", "<code", ">", "BasePluginFilter<", "/", "code", ">", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/plugins/BasePluginFilter.java#L93-L107
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java
StringGroovyMethods.padRight
public static String padRight(CharSequence self, Number numberOfChars, CharSequence padding) { String s = self.toString(); int numChars = numberOfChars.intValue(); if (numChars <= s.length()) { return s; } else { return s + getPadding(padding.toString(), numChars - s.length()); } }
java
public static String padRight(CharSequence self, Number numberOfChars, CharSequence padding) { String s = self.toString(); int numChars = numberOfChars.intValue(); if (numChars <= s.length()) { return s; } else { return s + getPadding(padding.toString(), numChars - s.length()); } }
[ "public", "static", "String", "padRight", "(", "CharSequence", "self", ",", "Number", "numberOfChars", ",", "CharSequence", "padding", ")", "{", "String", "s", "=", "self", ".", "toString", "(", ")", ";", "int", "numChars", "=", "numberOfChars", ".", "intVal...
Pad a CharSequence to a minimum length specified by <tt>numberOfChars</tt>, adding the supplied padding CharSequence as many times as needed to the right. If the CharSequence is already the same size or bigger than the target <tt>numberOfChars</tt>, then the toString() of the original CharSequence is returned. An example: <pre> ['A', 'BB', 'CCC', 'DDDD'].each{ println it.padRight(5, '#') + it.size() } </pre> will produce output like: <pre> A####1 BB###2 CCC##3 DDDD#4 </pre> @param self a CharSequence object @param numberOfChars the total minimum number of characters of the resulting CharSequence @param padding the characters used for padding @return the CharSequence padded to the right as a String @since 1.8.2
[ "Pad", "a", "CharSequence", "to", "a", "minimum", "length", "specified", "by", "<tt", ">", "numberOfChars<", "/", "tt", ">", "adding", "the", "supplied", "padding", "CharSequence", "as", "many", "times", "as", "needed", "to", "the", "right", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java#L2289-L2297
bluelinelabs/Conductor
conductor/src/main/java/com/bluelinelabs/conductor/changehandler/TransitionChangeHandler.java
TransitionChangeHandler.prepareForTransition
public void prepareForTransition(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, @NonNull Transition transition, boolean isPush, @NonNull OnTransitionPreparedListener onTransitionPreparedListener) { onTransitionPreparedListener.onPrepared(); }
java
public void prepareForTransition(@NonNull ViewGroup container, @Nullable View from, @Nullable View to, @NonNull Transition transition, boolean isPush, @NonNull OnTransitionPreparedListener onTransitionPreparedListener) { onTransitionPreparedListener.onPrepared(); }
[ "public", "void", "prepareForTransition", "(", "@", "NonNull", "ViewGroup", "container", ",", "@", "Nullable", "View", "from", ",", "@", "Nullable", "View", "to", ",", "@", "NonNull", "Transition", "transition", ",", "boolean", "isPush", ",", "@", "NonNull", ...
Called before a transition occurs. This can be used to reorder views, set their transition names, etc. The transition will begin when {@code onTransitionPreparedListener} is called. @param container The container these Views are hosted in @param from The previous View in the container or {@code null} if there was no Controller before this transition @param to The next View that should be put in the container or {@code null} if no Controller is being transitioned to @param transition The transition that is being prepared for @param isPush True if this is a push transaction, false if it's a pop
[ "Called", "before", "a", "transition", "occurs", ".", "This", "can", "be", "used", "to", "reorder", "views", "set", "their", "transition", "names", "etc", ".", "The", "transition", "will", "begin", "when", "{", "@code", "onTransitionPreparedListener", "}", "is...
train
https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/conductor/src/main/java/com/bluelinelabs/conductor/changehandler/TransitionChangeHandler.java#L120-L122
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java
SecStrucCalc.trackHBondEnergy
private void trackHBondEnergy(int i, int j, double energy) { if (groups[i].getPDBName().equals("PRO")) { logger.debug("Ignore: PRO {}",groups[i].getResidueNumber()); return; } SecStrucState stateOne = getSecStrucState(i); SecStrucState stateTwo = getSecStrucState(j); double acc1e = stateOne.getAccept1().getEnergy(); double acc2e = stateOne.getAccept2().getEnergy(); double don1e = stateTwo.getDonor1().getEnergy(); double don2e = stateTwo.getDonor2().getEnergy(); //Acceptor: N-H-->O if (energy < acc1e) { logger.debug("{} < {}",energy,acc1e); stateOne.setAccept2(stateOne.getAccept1()); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(j); stateOne.setAccept1(bond); } else if ( energy < acc2e ) { logger.debug("{} < {}",energy,acc2e); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(j); stateOne.setAccept2(bond); } //The other side of the bond: donor O-->N-H if (energy < don1e) { logger.debug("{} < {}",energy,don1e); stateTwo.setDonor2(stateTwo.getDonor1()); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(i); stateTwo.setDonor1(bond); } else if ( energy < don2e ) { logger.debug("{} < {}",energy,don2e); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(i); stateTwo.setDonor2(bond); } }
java
private void trackHBondEnergy(int i, int j, double energy) { if (groups[i].getPDBName().equals("PRO")) { logger.debug("Ignore: PRO {}",groups[i].getResidueNumber()); return; } SecStrucState stateOne = getSecStrucState(i); SecStrucState stateTwo = getSecStrucState(j); double acc1e = stateOne.getAccept1().getEnergy(); double acc2e = stateOne.getAccept2().getEnergy(); double don1e = stateTwo.getDonor1().getEnergy(); double don2e = stateTwo.getDonor2().getEnergy(); //Acceptor: N-H-->O if (energy < acc1e) { logger.debug("{} < {}",energy,acc1e); stateOne.setAccept2(stateOne.getAccept1()); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(j); stateOne.setAccept1(bond); } else if ( energy < acc2e ) { logger.debug("{} < {}",energy,acc2e); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(j); stateOne.setAccept2(bond); } //The other side of the bond: donor O-->N-H if (energy < don1e) { logger.debug("{} < {}",energy,don1e); stateTwo.setDonor2(stateTwo.getDonor1()); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(i); stateTwo.setDonor1(bond); } else if ( energy < don2e ) { logger.debug("{} < {}",energy,don2e); HBond bond = new HBond(); bond.setEnergy(energy); bond.setPartner(i); stateTwo.setDonor2(bond); } }
[ "private", "void", "trackHBondEnergy", "(", "int", "i", ",", "int", "j", ",", "double", "energy", ")", "{", "if", "(", "groups", "[", "i", "]", ".", "getPDBName", "(", ")", ".", "equals", "(", "\"PRO\"", ")", ")", "{", "logger", ".", "debug", "(", ...
Store Hbonds in the Groups. DSSP allows two HBonds per aminoacids to allow bifurcated bonds.
[ "Store", "Hbonds", "in", "the", "Groups", ".", "DSSP", "allows", "two", "HBonds", "per", "aminoacids", "to", "allow", "bifurcated", "bonds", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/secstruc/SecStrucCalc.java#L877-L935
jOOQ/jOOR
jOOR-java-6/src/main/java/org/joor/Reflect.java
Reflect.as
@SuppressWarnings("unchecked") public <P> P as(final Class<P> proxyType) { final boolean isMap = (object instanceof Map); final InvocationHandler handler = new InvocationHandler() { @Override @SuppressWarnings("null") public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); // Actual method name matches always come first try { return on(type, object).call(name, args).get(); } // [#14] Emulate POJO behaviour on wrapped map objects catch (ReflectException e) { if (isMap) { Map<String, Object> map = (Map<String, Object>) object; int length = (args == null ? 0 : args.length); if (length == 0 && name.startsWith("get")) { return map.get(property(name.substring(3))); } else if (length == 0 && name.startsWith("is")) { return map.get(property(name.substring(2))); } else if (length == 1 && name.startsWith("set")) { map.put(property(name.substring(3)), args[0]); return null; } } throw e; } } }; return (P) Proxy.newProxyInstance(proxyType.getClassLoader(), new Class[] { proxyType }, handler); }
java
@SuppressWarnings("unchecked") public <P> P as(final Class<P> proxyType) { final boolean isMap = (object instanceof Map); final InvocationHandler handler = new InvocationHandler() { @Override @SuppressWarnings("null") public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String name = method.getName(); // Actual method name matches always come first try { return on(type, object).call(name, args).get(); } // [#14] Emulate POJO behaviour on wrapped map objects catch (ReflectException e) { if (isMap) { Map<String, Object> map = (Map<String, Object>) object; int length = (args == null ? 0 : args.length); if (length == 0 && name.startsWith("get")) { return map.get(property(name.substring(3))); } else if (length == 0 && name.startsWith("is")) { return map.get(property(name.substring(2))); } else if (length == 1 && name.startsWith("set")) { map.put(property(name.substring(3)), args[0]); return null; } } throw e; } } }; return (P) Proxy.newProxyInstance(proxyType.getClassLoader(), new Class[] { proxyType }, handler); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "P", ">", "P", "as", "(", "final", "Class", "<", "P", ">", "proxyType", ")", "{", "final", "boolean", "isMap", "=", "(", "object", "instanceof", "Map", ")", ";", "final", "InvocationHandl...
Create a proxy for the wrapped object allowing to typesafely invoke methods on it using a custom interface @param proxyType The interface type that is implemented by the proxy @return A proxy for the wrapped object
[ "Create", "a", "proxy", "for", "the", "wrapped", "object", "allowing", "to", "typesafely", "invoke", "methods", "on", "it", "using", "a", "custom", "interface" ]
train
https://github.com/jOOQ/jOOR/blob/40b42be12ecc9939560ff86921bbc57c99a21b85/jOOR-java-6/src/main/java/org/joor/Reflect.java#L721-L783
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/Validate.java
Validate.validIndex
public static <T extends CharSequence> T validIndex(final T chars, final int index) { return INSTANCE.validIndex(chars, index); }
java
public static <T extends CharSequence> T validIndex(final T chars, final int index) { return INSTANCE.validIndex(chars, index); }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validIndex", "(", "final", "T", "chars", ",", "final", "int", "index", ")", "{", "return", "INSTANCE", ".", "validIndex", "(", "chars", ",", "index", ")", ";", "}" ]
<p>Validates that the index is within the bounds of the argument character sequence; otherwise throwing an exception.</p> <pre>Validate.validIndex(myStr, 2);</pre> <p>If the character sequence is {@code null}, then the message of the exception is &quot;The validated object is null&quot;.</p><p>If the index is invalid, then the message of the exception is &quot;The validated character sequence index is invalid: &quot; followed by the index.</p> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param index the index to check @return the validated character sequence (never {@code null} for method chaining) @throws NullPointerValidationException if the character sequence is {@code null} @throws IndexOutOfBoundsException if the index is invalid @see #validIndex(CharSequence, int, String, Object...)
[ "<p", ">", "Validates", "that", "the", "index", "is", "within", "the", "bounds", "of", "the", "argument", "character", "sequence", ";", "otherwise", "throwing", "an", "exception", ".", "<", "/", "p", ">", "<pre", ">", "Validate", ".", "validIndex", "(", ...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L1312-L1314
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.scoreExamples
public INDArray scoreExamples(DataSet data, boolean addRegularizationTerms) { if (numInputArrays != 1 || numOutputArrays != 1) throw new UnsupportedOperationException("Cannot score ComputationGraph network with " + " DataSet: network does not have 1 input and 1 output arrays"); return scoreExamples(ComputationGraphUtil.toMultiDataSet(data), addRegularizationTerms); }
java
public INDArray scoreExamples(DataSet data, boolean addRegularizationTerms) { if (numInputArrays != 1 || numOutputArrays != 1) throw new UnsupportedOperationException("Cannot score ComputationGraph network with " + " DataSet: network does not have 1 input and 1 output arrays"); return scoreExamples(ComputationGraphUtil.toMultiDataSet(data), addRegularizationTerms); }
[ "public", "INDArray", "scoreExamples", "(", "DataSet", "data", ",", "boolean", "addRegularizationTerms", ")", "{", "if", "(", "numInputArrays", "!=", "1", "||", "numOutputArrays", "!=", "1", ")", "throw", "new", "UnsupportedOperationException", "(", "\"Cannot score ...
Calculate the score for each example in a DataSet individually. Unlike {@link #score(DataSet)} and {@link #score(DataSet, boolean)} this method does not average/sum over examples. This method allows for examples to be scored individually (at test time only), which may be useful for example for autoencoder architectures and the like.<br> Each row of the output (assuming addRegularizationTerms == true) is equivalent to calling score(DataSet) with a single example. @param data The data to score @param addRegularizationTerms If true: add l1/l2 regularization terms (if any) to the score. If false: don't add regularization terms @return An INDArray (column vector) of size input.numRows(); the ith entry is the score (loss value) of the ith example
[ "Calculate", "the", "score", "for", "each", "example", "in", "a", "DataSet", "individually", ".", "Unlike", "{", "@link", "#score", "(", "DataSet", ")", "}", "and", "{", "@link", "#score", "(", "DataSet", "boolean", ")", "}", "this", "method", "does", "n...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3037-L3042
googleads/googleads-java-lib
extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ApiRetryStrategyManager.java
ApiRetryStrategyManager.getRetryStrategy
public static @Nullable ApiRetryStrategy getRetryStrategy(String name, boolean isUtility) { ApiRateLimitBucket bucket = getRateLimitBucket(name, isUtility); return bucket == null ? null : bucketToStrategy.get(bucket); }
java
public static @Nullable ApiRetryStrategy getRetryStrategy(String name, boolean isUtility) { ApiRateLimitBucket bucket = getRateLimitBucket(name, isUtility); return bucket == null ? null : bucketToStrategy.get(bucket); }
[ "public", "static", "@", "Nullable", "ApiRetryStrategy", "getRetryStrategy", "(", "String", "name", ",", "boolean", "isUtility", ")", "{", "ApiRateLimitBucket", "bucket", "=", "getRateLimitBucket", "(", "name", ",", "isUtility", ")", ";", "return", "bucket", "==",...
Get the {@link ApiRetryStrategy} for the specified AdWords API service / utility name. @param name the specified AdWords API service / utility name @param isUtility whether this is for some AdWords API utility, i.e., from calling {@link com.google.api.ads.adwords.lib.factory.AdWordsServicesInterface#getUtility(com.google.api.ads.adwords.lib.client.AdWordsSession, Class)}. @return the corresponding {@link ApiRetryStrategy} object, or null if it's not supported by this rate limiter extension
[ "Get", "the", "{", "@link", "ApiRetryStrategy", "}", "for", "the", "specified", "AdWords", "API", "service", "/", "utility", "name", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/extensions/adwords_rate_limiter/src/main/java/com/google/api/ads/adwords/extension/ratelimiter/ApiRetryStrategyManager.java#L65-L68
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.slice
public static void slice(File srcImageFile, File descDir, int destWidth, int destHeight) { slice(read(srcImageFile), descDir, destWidth, destHeight); }
java
public static void slice(File srcImageFile, File descDir, int destWidth, int destHeight) { slice(read(srcImageFile), descDir, destWidth, destHeight); }
[ "public", "static", "void", "slice", "(", "File", "srcImageFile", ",", "File", "descDir", ",", "int", "destWidth", ",", "int", "destHeight", ")", "{", "slice", "(", "read", "(", "srcImageFile", ")", ",", "descDir", ",", "destWidth", ",", "destHeight", ")",...
图像切片(指定切片的宽度和高度) @param srcImageFile 源图像 @param descDir 切片目标文件夹 @param destWidth 目标切片宽度。默认200 @param destHeight 目标切片高度。默认150
[ "图像切片(指定切片的宽度和高度)" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L370-L372
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/JobConfigurationUtils.java
JobConfigurationUtils.combineSysAndJobProperties
public static Properties combineSysAndJobProperties(Properties sysProps, Properties jobProps) { Properties combinedJobProps = new Properties(); combinedJobProps.putAll(sysProps); combinedJobProps.putAll(jobProps); return combinedJobProps; }
java
public static Properties combineSysAndJobProperties(Properties sysProps, Properties jobProps) { Properties combinedJobProps = new Properties(); combinedJobProps.putAll(sysProps); combinedJobProps.putAll(jobProps); return combinedJobProps; }
[ "public", "static", "Properties", "combineSysAndJobProperties", "(", "Properties", "sysProps", ",", "Properties", "jobProps", ")", "{", "Properties", "combinedJobProps", "=", "new", "Properties", "(", ")", ";", "combinedJobProps", ".", "putAll", "(", "sysProps", ")"...
Get a new {@link Properties} instance by combining a given system configuration {@link Properties} object (first) and a job configuration {@link Properties} object (second). @param sysProps the given system configuration {@link Properties} object @param jobProps the given job configuration {@link Properties} object @return a new {@link Properties} instance
[ "Get", "a", "new", "{", "@link", "Properties", "}", "instance", "by", "combining", "a", "given", "system", "configuration", "{", "@link", "Properties", "}", "object", "(", "first", ")", "and", "a", "job", "configuration", "{", "@link", "Properties", "}", "...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/JobConfigurationUtils.java#L52-L57
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/oracles/wordnet/InMemoryWordNetBinaryArray.java
InMemoryWordNetBinaryArray.createWordNetCaches
public static void createWordNetCaches(String componentKey, Properties properties) throws SMatchException { properties = getComponentProperties(makeComponentPrefix(componentKey, InMemoryWordNetBinaryArray.class.getSimpleName()), properties); if (properties.containsKey(JWNL_PROPERTIES_PATH_KEY)) { // initialize JWNL (this must be done before JWNL library can be used) try { final String configPath = properties.getProperty(JWNL_PROPERTIES_PATH_KEY); log.info("Initializing JWNL from " + configPath); JWNL.initialize(new FileInputStream(configPath)); } catch (JWNLException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new SMatchException(errMessage, e); } catch (FileNotFoundException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new SMatchException(errMessage, e); } } else { final String errMessage = "Cannot find configuration key " + JWNL_PROPERTIES_PATH_KEY; log.error(errMessage); throw new SMatchException(errMessage); } log.info("Creating WordNet caches..."); writeNominalizations(properties); writeSynonymsAdj(properties); writeOppAdverbs(properties); writeOppAdjectives(properties); writeOppNouns(properties); writeNounMG(properties); writeVerbMG(properties); log.info("Done"); }
java
public static void createWordNetCaches(String componentKey, Properties properties) throws SMatchException { properties = getComponentProperties(makeComponentPrefix(componentKey, InMemoryWordNetBinaryArray.class.getSimpleName()), properties); if (properties.containsKey(JWNL_PROPERTIES_PATH_KEY)) { // initialize JWNL (this must be done before JWNL library can be used) try { final String configPath = properties.getProperty(JWNL_PROPERTIES_PATH_KEY); log.info("Initializing JWNL from " + configPath); JWNL.initialize(new FileInputStream(configPath)); } catch (JWNLException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new SMatchException(errMessage, e); } catch (FileNotFoundException e) { final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage(); log.error(errMessage, e); throw new SMatchException(errMessage, e); } } else { final String errMessage = "Cannot find configuration key " + JWNL_PROPERTIES_PATH_KEY; log.error(errMessage); throw new SMatchException(errMessage); } log.info("Creating WordNet caches..."); writeNominalizations(properties); writeSynonymsAdj(properties); writeOppAdverbs(properties); writeOppAdjectives(properties); writeOppNouns(properties); writeNounMG(properties); writeVerbMG(properties); log.info("Done"); }
[ "public", "static", "void", "createWordNetCaches", "(", "String", "componentKey", ",", "Properties", "properties", ")", "throws", "SMatchException", "{", "properties", "=", "getComponentProperties", "(", "makeComponentPrefix", "(", "componentKey", ",", "InMemoryWordNetBin...
Create caches of WordNet to speed up matching. @param componentKey a key to the component in the configuration @param properties configuration @throws SMatchException SMatchException
[ "Create", "caches", "of", "WordNet", "to", "speed", "up", "matching", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/oracles/wordnet/InMemoryWordNetBinaryArray.java#L261-L293
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/AccessToken.java
AccessToken.createFromNativeLinkingIntent
public static AccessToken createFromNativeLinkingIntent(Intent intent) { Validate.notNull(intent, "intent"); if (intent.getExtras() == null) { return null; } return createFromBundle(null, intent.getExtras(), AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date()); }
java
public static AccessToken createFromNativeLinkingIntent(Intent intent) { Validate.notNull(intent, "intent"); if (intent.getExtras() == null) { return null; } return createFromBundle(null, intent.getExtras(), AccessTokenSource.FACEBOOK_APPLICATION_WEB, new Date()); }
[ "public", "static", "AccessToken", "createFromNativeLinkingIntent", "(", "Intent", "intent", ")", "{", "Validate", ".", "notNull", "(", "intent", ",", "\"intent\"", ")", ";", "if", "(", "intent", ".", "getExtras", "(", ")", "==", "null", ")", "{", "return", ...
Creates a new AccessToken using the information contained in an Intent populated by the Facebook application in order to launch a native link. For more information on native linking, please see https://developers.facebook.com/docs/mobile/android/deep_linking/. @param intent the Intent that was used to start an Activity; must not be null @return a new AccessToken, or null if the Intent did not contain enough data to create one
[ "Creates", "a", "new", "AccessToken", "using", "the", "information", "contained", "in", "an", "Intent", "populated", "by", "the", "Facebook", "application", "in", "order", "to", "launch", "a", "native", "link", ".", "For", "more", "information", "on", "native"...
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AccessToken.java#L177-L185
micrometer-metrics/micrometer
micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java
ExecutorServiceMetrics.monitor
public static ExecutorService monitor(MeterRegistry registry, ExecutorService executor, String executorServiceName, Iterable<Tag> tags) { new ExecutorServiceMetrics(executor, executorServiceName, tags).bindTo(registry); return new TimedExecutorService(registry, executor, executorServiceName, tags); }
java
public static ExecutorService monitor(MeterRegistry registry, ExecutorService executor, String executorServiceName, Iterable<Tag> tags) { new ExecutorServiceMetrics(executor, executorServiceName, tags).bindTo(registry); return new TimedExecutorService(registry, executor, executorServiceName, tags); }
[ "public", "static", "ExecutorService", "monitor", "(", "MeterRegistry", "registry", ",", "ExecutorService", "executor", ",", "String", "executorServiceName", ",", "Iterable", "<", "Tag", ">", "tags", ")", "{", "new", "ExecutorServiceMetrics", "(", "executor", ",", ...
Record metrics on the use of an {@link ExecutorService}. @param registry The registry to bind metrics to. @param executor The executor to instrument. @param executorServiceName Will be used to tag metrics with "name". @param tags Tags to apply to all recorded metrics. @return The instrumented executor, proxied.
[ "Record", "metrics", "on", "the", "use", "of", "an", "{", "@link", "ExecutorService", "}", "." ]
train
https://github.com/micrometer-metrics/micrometer/blob/127fa3265325cc894f368312ed8890b76a055d88/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/ExecutorServiceMetrics.java#L91-L94
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.findTerms
public <P extends ParaObject> List<P> findTerms(String type, Map<String, ?> terms, boolean matchAll, Pager... pager) { if (terms == null) { return Collections.emptyList(); } MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.putSingle("matchall", Boolean.toString(matchAll)); LinkedList<String> list = new LinkedList<>(); for (Map.Entry<String, ? extends Object> term : terms.entrySet()) { String key = term.getKey(); Object value = term.getValue(); if (value != null) { list.add(key.concat(Config.SEPARATOR).concat(value.toString())); } } if (!terms.isEmpty()) { params.put("terms", list); } params.putSingle(Config._TYPE, type); params.putAll(pagerToParams(pager)); return getItems(find("terms", params), pager); }
java
public <P extends ParaObject> List<P> findTerms(String type, Map<String, ?> terms, boolean matchAll, Pager... pager) { if (terms == null) { return Collections.emptyList(); } MultivaluedMap<String, String> params = new MultivaluedHashMap<>(); params.putSingle("matchall", Boolean.toString(matchAll)); LinkedList<String> list = new LinkedList<>(); for (Map.Entry<String, ? extends Object> term : terms.entrySet()) { String key = term.getKey(); Object value = term.getValue(); if (value != null) { list.add(key.concat(Config.SEPARATOR).concat(value.toString())); } } if (!terms.isEmpty()) { params.put("terms", list); } params.putSingle(Config._TYPE, type); params.putAll(pagerToParams(pager)); return getItems(find("terms", params), pager); }
[ "public", "<", "P", "extends", "ParaObject", ">", "List", "<", "P", ">", "findTerms", "(", "String", "type", ",", "Map", "<", "String", ",", "?", ">", "terms", ",", "boolean", "matchAll", ",", "Pager", "...", "pager", ")", "{", "if", "(", "terms", ...
Searches for objects that have properties matching some given values. A terms query. @param <P> type of the object @param type the type of object to search for. See {@link com.erudika.para.core.ParaObject#getType()} @param terms a map of fields (property names) to terms (property values) @param matchAll match all terms. If true - AND search, if false - OR search @param pager a {@link com.erudika.para.utils.Pager} @return a list of objects found
[ "Searches", "for", "objects", "that", "have", "properties", "matching", "some", "given", "values", ".", "A", "terms", "query", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L828-L849
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseAccessLog
private void parseAccessLog(Map<Object, Object> props) { String id = (String) props.get(HttpConfigConstants.PROPNAME_ACCESSLOG_ID); if (id != null) { AtomicReference<AccessLog> aLog = HttpEndpointImpl.getAccessLogger(id); if (aLog != null) { this.accessLogger = aLog; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: using logging service", accessLogger); } } }
java
private void parseAccessLog(Map<Object, Object> props) { String id = (String) props.get(HttpConfigConstants.PROPNAME_ACCESSLOG_ID); if (id != null) { AtomicReference<AccessLog> aLog = HttpEndpointImpl.getAccessLogger(id); if (aLog != null) { this.accessLogger = aLog; } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: using logging service", accessLogger); } } }
[ "private", "void", "parseAccessLog", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "String", "id", "=", "(", "String", ")", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_ACCESSLOG_ID", ")", ";", "if", "(", "id", "!="...
Parse the NCSA access log information from the property map. @param props
[ "Parse", "the", "NCSA", "access", "log", "information", "from", "the", "property", "map", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L918-L931
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/compiler/BuilderResultUtils.java
BuilderResultUtils.getProblemMessage
public static String getProblemMessage(Object object, String summary, String separator) { if (object instanceof CompilationProblem[]) { return fillSummary( (CompilationProblem[]) object, summary, separator ); } return summary; }
java
public static String getProblemMessage(Object object, String summary, String separator) { if (object instanceof CompilationProblem[]) { return fillSummary( (CompilationProblem[]) object, summary, separator ); } return summary; }
[ "public", "static", "String", "getProblemMessage", "(", "Object", "object", ",", "String", "summary", ",", "String", "separator", ")", "{", "if", "(", "object", "instanceof", "CompilationProblem", "[", "]", ")", "{", "return", "fillSummary", "(", "(", "Compila...
Appends compilation problems to summary message if object is an array of {@link CompilationProblem} with custom separator @param object object with compilation results @param summary summary message @param separator custom messages separator @return summary message with changes
[ "Appends", "compilation", "problems", "to", "summary", "message", "if", "object", "is", "an", "array", "of", "{", "@link", "CompilationProblem", "}", "with", "custom", "separator" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/compiler/BuilderResultUtils.java#L36-L41
eurekaclinical/javautil
src/main/java/org/arp/javautil/stat/UpdatingCovarCalc.java
UpdatingCovarCalc.addPoint
public void addPoint(double x, double y) { numItems++; double xMinusMeanX = x - meanx; double yMinusMeanY = y - meany; sumsq += xMinusMeanX * yMinusMeanY * (numItems - 1) / numItems; meanx += xMinusMeanX / numItems; meany += yMinusMeanY / numItems; }
java
public void addPoint(double x, double y) { numItems++; double xMinusMeanX = x - meanx; double yMinusMeanY = y - meany; sumsq += xMinusMeanX * yMinusMeanY * (numItems - 1) / numItems; meanx += xMinusMeanX / numItems; meany += yMinusMeanY / numItems; }
[ "public", "void", "addPoint", "(", "double", "x", ",", "double", "y", ")", "{", "numItems", "++", ";", "double", "xMinusMeanX", "=", "x", "-", "meanx", ";", "double", "yMinusMeanY", "=", "y", "-", "meany", ";", "sumsq", "+=", "xMinusMeanX", "*", "yMinu...
Update the covariance with another point. @param x x value @param y y value
[ "Update", "the", "covariance", "with", "another", "point", "." ]
train
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/stat/UpdatingCovarCalc.java#L59-L66
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.beginMarkedContentSequence
public void beginMarkedContentSequence(PdfName tag, PdfDictionary property, boolean inline) { if (property == null) { content.append(tag.getBytes()).append(" BMC").append_i(separator); return; } content.append(tag.getBytes()).append(' '); if (inline) try { property.toPdf(writer, content); } catch (Exception e) { throw new ExceptionConverter(e); } else { PdfObject[] objs; if (writer.propertyExists(property)) objs = writer.addSimpleProperty(property, null); else objs = writer.addSimpleProperty(property, writer.getPdfIndirectReference()); PdfName name = (PdfName)objs[0]; PageResources prs = getPageResources(); name = prs.addProperty(name, (PdfIndirectReference)objs[1]); content.append(name.getBytes()); } content.append(" BDC").append_i(separator); ++mcDepth; }
java
public void beginMarkedContentSequence(PdfName tag, PdfDictionary property, boolean inline) { if (property == null) { content.append(tag.getBytes()).append(" BMC").append_i(separator); return; } content.append(tag.getBytes()).append(' '); if (inline) try { property.toPdf(writer, content); } catch (Exception e) { throw new ExceptionConverter(e); } else { PdfObject[] objs; if (writer.propertyExists(property)) objs = writer.addSimpleProperty(property, null); else objs = writer.addSimpleProperty(property, writer.getPdfIndirectReference()); PdfName name = (PdfName)objs[0]; PageResources prs = getPageResources(); name = prs.addProperty(name, (PdfIndirectReference)objs[1]); content.append(name.getBytes()); } content.append(" BDC").append_i(separator); ++mcDepth; }
[ "public", "void", "beginMarkedContentSequence", "(", "PdfName", "tag", ",", "PdfDictionary", "property", ",", "boolean", "inline", ")", "{", "if", "(", "property", "==", "null", ")", "{", "content", ".", "append", "(", "tag", ".", "getBytes", "(", ")", ")"...
Begins a marked content sequence. If property is <CODE>null</CODE> the mark will be of the type <CODE>BMC</CODE> otherwise it will be <CODE>BDC</CODE>. @param tag the tag @param property the property @param inline <CODE>true</CODE> to include the property in the content or <CODE>false</CODE> to include the property in the resource dictionary with the possibility of reusing
[ "Begins", "a", "marked", "content", "sequence", ".", "If", "property", "is", "<CODE", ">", "null<", "/", "CODE", ">", "the", "mark", "will", "be", "of", "the", "type", "<CODE", ">", "BMC<", "/", "CODE", ">", "otherwise", "it", "will", "be", "<CODE", ...
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L3089-L3115
3redronin/mu-server
src/main/java/io/muserver/MuServerBuilder.java
MuServerBuilder.withGzip
public MuServerBuilder withGzip(long minimumGzipSize, Set<String> mimeTypesToGzip) { this.gzipEnabled = true; this.mimeTypesToGzip = mimeTypesToGzip; this.minimumGzipSize = minimumGzipSize; return this; }
java
public MuServerBuilder withGzip(long minimumGzipSize, Set<String> mimeTypesToGzip) { this.gzipEnabled = true; this.mimeTypesToGzip = mimeTypesToGzip; this.minimumGzipSize = minimumGzipSize; return this; }
[ "public", "MuServerBuilder", "withGzip", "(", "long", "minimumGzipSize", ",", "Set", "<", "String", ">", "mimeTypesToGzip", ")", "{", "this", ".", "gzipEnabled", "=", "true", ";", "this", ".", "mimeTypesToGzip", "=", "mimeTypesToGzip", ";", "this", ".", "minim...
Enables gzip for files of at least the specified size that match the given mime-types. By default, gzip is enabled for text-based mime types over 1400 bytes. It is recommended to keep the defaults and only use this method if you have very specific requirements around GZIP. @param minimumGzipSize The size in bytes before gzip is used. The default is 1400. @param mimeTypesToGzip The mime-types that should be gzipped. In general, only text files should be gzipped. @return The current Mu-Server Builder
[ "Enables", "gzip", "for", "files", "of", "at", "least", "the", "specified", "size", "that", "match", "the", "given", "mime", "-", "types", ".", "By", "default", "gzip", "is", "enabled", "for", "text", "-", "based", "mime", "types", "over", "1400", "bytes...
train
https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/MuServerBuilder.java#L121-L126
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDao.java
BaseDao.putToCache
protected void putToCache(String cacheName, String key, Object value, long ttlSeconds) { if (cacheItemsExpireAfterWrite) { putToCache(cacheName, key, value, ttlSeconds, 0); } else { putToCache(cacheName, key, value, 0, ttlSeconds); } }
java
protected void putToCache(String cacheName, String key, Object value, long ttlSeconds) { if (cacheItemsExpireAfterWrite) { putToCache(cacheName, key, value, ttlSeconds, 0); } else { putToCache(cacheName, key, value, 0, ttlSeconds); } }
[ "protected", "void", "putToCache", "(", "String", "cacheName", ",", "String", "key", ",", "Object", "value", ",", "long", "ttlSeconds", ")", "{", "if", "(", "cacheItemsExpireAfterWrite", ")", "{", "putToCache", "(", "cacheName", ",", "key", ",", "value", ","...
Puts an entry to cache, with specific TTL. @param cacheName @param key @param value @param ttlSeconds
[ "Puts", "an", "entry", "to", "cache", "with", "specific", "TTL", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseDao.java#L174-L180
dita-ot/dita-ot
src/main/java/org/dita/dost/util/Job.java
Job.setInputMap
public void setInputMap(final URI map) { assert !map.isAbsolute(); setProperty(INPUT_DITAMAP_URI, map.toString()); // Deprecated since 2.2 setProperty(INPUT_DITAMAP, toFile(map).getPath()); }
java
public void setInputMap(final URI map) { assert !map.isAbsolute(); setProperty(INPUT_DITAMAP_URI, map.toString()); // Deprecated since 2.2 setProperty(INPUT_DITAMAP, toFile(map).getPath()); }
[ "public", "void", "setInputMap", "(", "final", "URI", "map", ")", "{", "assert", "!", "map", ".", "isAbsolute", "(", ")", ";", "setProperty", "(", "INPUT_DITAMAP_URI", ",", "map", ".", "toString", "(", ")", ")", ";", "// Deprecated since 2.2", "setProperty",...
set input file @param map input file path relative to input directory
[ "set", "input", "file" ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/Job.java#L466-L471
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java
TrainsImpl.getStatusAsync
public Observable<List<ModelTrainingInfo>> getStatusAsync(UUID appId, String versionId) { return getStatusWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<ModelTrainingInfo>>, List<ModelTrainingInfo>>() { @Override public List<ModelTrainingInfo> call(ServiceResponse<List<ModelTrainingInfo>> response) { return response.body(); } }); }
java
public Observable<List<ModelTrainingInfo>> getStatusAsync(UUID appId, String versionId) { return getStatusWithServiceResponseAsync(appId, versionId).map(new Func1<ServiceResponse<List<ModelTrainingInfo>>, List<ModelTrainingInfo>>() { @Override public List<ModelTrainingInfo> call(ServiceResponse<List<ModelTrainingInfo>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ModelTrainingInfo", ">", ">", "getStatusAsync", "(", "UUID", "appId", ",", "String", "versionId", ")", "{", "return", "getStatusWithServiceResponseAsync", "(", "appId", ",", "versionId", ")", ".", "map", "(", "new", "...
Gets the training status of all models (intents and entities) for the specified LUIS app. You must call the train API to train the LUIS app before you call this API to get training status. "appID" specifies the LUIS app ID. "versionId" specifies the version number of the LUIS app. For example, "0.1". @param appId The application ID. @param versionId The version ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ModelTrainingInfo&gt; object
[ "Gets", "the", "training", "status", "of", "all", "models", "(", "intents", "and", "entities", ")", "for", "the", "specified", "LUIS", "app", ".", "You", "must", "call", "the", "train", "API", "to", "train", "the", "LUIS", "app", "before", "you", "call",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/TrainsImpl.java#L189-L196
google/closure-compiler
src/com/google/javascript/jscomp/PolymerPassStaticUtils.java
PolymerPassStaticUtils.quoteListenerAndHostAttributeKeys
static void quoteListenerAndHostAttributeKeys(Node objLit, AbstractCompiler compiler) { checkState(objLit.isObjectLit()); for (Node keyNode : objLit.children()) { if (keyNode.isComputedProp()) { continue; } if (!keyNode.getString().equals("listeners") && !keyNode.getString().equals("hostAttributes")) { continue; } for (Node keyToQuote : keyNode.getFirstChild().children()) { if (!keyToQuote.isQuotedString()) { keyToQuote.setQuotedString(); compiler.reportChangeToEnclosingScope(keyToQuote); } } } }
java
static void quoteListenerAndHostAttributeKeys(Node objLit, AbstractCompiler compiler) { checkState(objLit.isObjectLit()); for (Node keyNode : objLit.children()) { if (keyNode.isComputedProp()) { continue; } if (!keyNode.getString().equals("listeners") && !keyNode.getString().equals("hostAttributes")) { continue; } for (Node keyToQuote : keyNode.getFirstChild().children()) { if (!keyToQuote.isQuotedString()) { keyToQuote.setQuotedString(); compiler.reportChangeToEnclosingScope(keyToQuote); } } } }
[ "static", "void", "quoteListenerAndHostAttributeKeys", "(", "Node", "objLit", ",", "AbstractCompiler", "compiler", ")", "{", "checkState", "(", "objLit", ".", "isObjectLit", "(", ")", ")", ";", "for", "(", "Node", "keyNode", ":", "objLit", ".", "children", "("...
Makes sure that the keys for listeners and hostAttributes blocks are quoted to avoid renaming.
[ "Makes", "sure", "that", "the", "keys", "for", "listeners", "and", "hostAttributes", "blocks", "are", "quoted", "to", "avoid", "renaming", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerPassStaticUtils.java#L109-L126
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java
ReferenceDataUrl.getBehaviorUrl
public static MozuUrl getBehaviorUrl(Integer behaviorId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/behaviors/{behaviorId}?responseFields={responseFields}"); formatter.formatUrl("behaviorId", behaviorId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl getBehaviorUrl(Integer behaviorId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/behaviors/{behaviorId}?responseFields={responseFields}"); formatter.formatUrl("behaviorId", behaviorId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "getBehaviorUrl", "(", "Integer", "behaviorId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/reference/behaviors/{behaviorId}?responseFields={responseFields}\"", ")", "...
Get Resource Url for GetBehavior @param behaviorId Unique identifier of the behavior. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetBehavior" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java#L48-L54
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameters.java
RPCParameters.put
public void put(int index, RPCParameter param) { expand(index); if (index < params.size()) { params.set(index, param); } else { params.add(param); } }
java
public void put(int index, RPCParameter param) { expand(index); if (index < params.size()) { params.set(index, param); } else { params.add(param); } }
[ "public", "void", "put", "(", "int", "index", ",", "RPCParameter", "param", ")", "{", "expand", "(", "index", ")", ";", "if", "(", "index", "<", "params", ".", "size", "(", ")", ")", "{", "params", ".", "set", "(", "index", ",", "param", ")", ";"...
Adds a parameter at the specified index. @param index Index for parameter. @param param Parameter to add.
[ "Adds", "a", "parameter", "at", "the", "specified", "index", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/RPCParameters.java#L124-L132
openbase/jul
storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java
AbstractRegistry.replaceInternalMap
public void replaceInternalMap(final Map<KEY, ENTRY> map, boolean finishTransaction) throws CouldNotPerformException { if (map == null) { throw new NotAvailableException("map"); } lock(); try { try { sandbox.replaceInternalMap(map); entryMap.clear(); entryMap.putAll(map); if (finishTransaction && !(this instanceof RemoteRegistry)) { logger.warn("Replace internal map of [" + this + "]"); finishTransaction(); } } finally { syncSandbox(); } } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Internal map replaced by invalid data!", ex), logger, LogLevel.ERROR); } finally { unlock(); } if (this instanceof RemoteRegistry) { dependingRegistryObservable.notifyObservers(entryMap); } notifyObservers(); }
java
public void replaceInternalMap(final Map<KEY, ENTRY> map, boolean finishTransaction) throws CouldNotPerformException { if (map == null) { throw new NotAvailableException("map"); } lock(); try { try { sandbox.replaceInternalMap(map); entryMap.clear(); entryMap.putAll(map); if (finishTransaction && !(this instanceof RemoteRegistry)) { logger.warn("Replace internal map of [" + this + "]"); finishTransaction(); } } finally { syncSandbox(); } } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Internal map replaced by invalid data!", ex), logger, LogLevel.ERROR); } finally { unlock(); } if (this instanceof RemoteRegistry) { dependingRegistryObservable.notifyObservers(entryMap); } notifyObservers(); }
[ "public", "void", "replaceInternalMap", "(", "final", "Map", "<", "KEY", ",", "ENTRY", ">", "map", ",", "boolean", "finishTransaction", ")", "throws", "CouldNotPerformException", "{", "if", "(", "map", "==", "null", ")", "{", "throw", "new", "NotAvailableExcep...
Replaces the internal registry map by the given one. <p> Use with care! @param map @param finishTransaction is true the registry transaction will be verified. @throws org.openbase.jul.exception.CouldNotPerformException
[ "Replaces", "the", "internal", "registry", "map", "by", "the", "given", "one", ".", "<p", ">", "Use", "with", "care!" ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java#L578-L604
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.addAsync
public Observable<Void> addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions) { return addWithServiceResponseAsync(pool, poolAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolAddHeaders> response) { return response.body(); } }); }
java
public Observable<Void> addAsync(PoolAddParameter pool, PoolAddOptions poolAddOptions) { return addWithServiceResponseAsync(pool, poolAddOptions).map(new Func1<ServiceResponseWithHeaders<Void, PoolAddHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, PoolAddHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addAsync", "(", "PoolAddParameter", "pool", ",", "PoolAddOptions", "poolAddOptions", ")", "{", "return", "addWithServiceResponseAsync", "(", "pool", ",", "poolAddOptions", ")", ".", "map", "(", "new", "Func1", "<", "Ser...
Adds a pool to the specified account. When naming pools, avoid including sensitive information such as user names or secret project names. This information may appear in telemetry logs accessible to Microsoft Support engineers. @param pool The pool to be added. @param poolAddOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Adds", "a", "pool", "to", "the", "specified", "account", ".", "When", "naming", "pools", "avoid", "including", "sensitive", "information", "such", "as", "user", "names", "or", "secret", "project", "names", ".", "This", "information", "may", "appear", "in", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L780-L787
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java
ProfeatProperties.getComposition
public static double getComposition(ProteinSequence sequence, ATTRIBUTE attribute, GROUPING group) throws Exception{ return new ProfeatPropertiesImpl().getComposition(sequence, attribute, group); }
java
public static double getComposition(ProteinSequence sequence, ATTRIBUTE attribute, GROUPING group) throws Exception{ return new ProfeatPropertiesImpl().getComposition(sequence, attribute, group); }
[ "public", "static", "double", "getComposition", "(", "ProteinSequence", "sequence", ",", "ATTRIBUTE", "attribute", ",", "GROUPING", "group", ")", "throws", "Exception", "{", "return", "new", "ProfeatPropertiesImpl", "(", ")", ".", "getComposition", "(", "sequence", ...
An adaptor method which returns the composition of the specific grouping for the given attribute. @param sequence a protein sequence consisting of non-ambiguous characters only @param attribute one of the seven attributes (Hydrophobicity, Volume, Polarity, Polarizability, Charge, SecondaryStructure or SolventAccessibility) @param group the grouping to be computed @return returns the composition of the specific grouping for the given attribute @throws Exception throws Exception if attribute or group are unknown
[ "An", "adaptor", "method", "which", "returns", "the", "composition", "of", "the", "specific", "grouping", "for", "the", "given", "attribute", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java#L56-L58
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBUtils.java
CouchDBUtils.getDesignDocument
private static CouchDBDesignDocument getDesignDocument(HttpClient httpClient, HttpHost httpHost, Gson gson, String tableName, String schemaName) { HttpResponse response = null; try { String id = CouchDBConstants.DESIGN + tableName; URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + schemaName.toLowerCase() + CouchDBConstants.URL_SEPARATOR + id, null, null); HttpGet get = new HttpGet(uri); get.addHeader("Accept", "application/json"); response = httpClient.execute(httpHost, get, CouchDBUtils.getContext(httpHost)); InputStream content = response.getEntity().getContent(); Reader reader = new InputStreamReader(content); JsonObject jsonObject = gson.fromJson(reader, JsonObject.class); return gson.fromJson(jsonObject, CouchDBDesignDocument.class); } catch (Exception e) { log.error("Error while fetching design document object, Caused by: .", e); throw new KunderaException(e); } finally { CouchDBUtils.closeContent(response); } }
java
private static CouchDBDesignDocument getDesignDocument(HttpClient httpClient, HttpHost httpHost, Gson gson, String tableName, String schemaName) { HttpResponse response = null; try { String id = CouchDBConstants.DESIGN + tableName; URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + schemaName.toLowerCase() + CouchDBConstants.URL_SEPARATOR + id, null, null); HttpGet get = new HttpGet(uri); get.addHeader("Accept", "application/json"); response = httpClient.execute(httpHost, get, CouchDBUtils.getContext(httpHost)); InputStream content = response.getEntity().getContent(); Reader reader = new InputStreamReader(content); JsonObject jsonObject = gson.fromJson(reader, JsonObject.class); return gson.fromJson(jsonObject, CouchDBDesignDocument.class); } catch (Exception e) { log.error("Error while fetching design document object, Caused by: .", e); throw new KunderaException(e); } finally { CouchDBUtils.closeContent(response); } }
[ "private", "static", "CouchDBDesignDocument", "getDesignDocument", "(", "HttpClient", "httpClient", ",", "HttpHost", "httpHost", ",", "Gson", "gson", ",", "String", "tableName", ",", "String", "schemaName", ")", "{", "HttpResponse", "response", "=", "null", ";", "...
Gets the design document. @param httpClient the http client @param httpHost the http host @param gson the gson @param tableName the table name @param schemaName the schema name @return the design document
[ "Gets", "the", "design", "document", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBUtils.java#L258-L287
SahaginOrg/sahagin-java
src/main/java/org/sahagin/runlib/runresultsgen/RunResultsGenerateHookSetter.java
RunResultsGenerateHookSetter.isLineLastStament
private boolean isLineLastStament(TestMethod method, int codeLineIndex) { CodeLine codeLine = method.getCodeBody().get(codeLineIndex); if (codeLineIndex == method.getCodeBody().size() - 1) { return true; } CodeLine nextCodeLine = method.getCodeBody().get(codeLineIndex + 1); assert codeLine.getEndLine() <= nextCodeLine.getStartLine(); if (codeLine.getEndLine() == nextCodeLine.getStartLine()) { // if next statement exists in the same line, // this statement is not the last statement for the line return false; } return true; }
java
private boolean isLineLastStament(TestMethod method, int codeLineIndex) { CodeLine codeLine = method.getCodeBody().get(codeLineIndex); if (codeLineIndex == method.getCodeBody().size() - 1) { return true; } CodeLine nextCodeLine = method.getCodeBody().get(codeLineIndex + 1); assert codeLine.getEndLine() <= nextCodeLine.getStartLine(); if (codeLine.getEndLine() == nextCodeLine.getStartLine()) { // if next statement exists in the same line, // this statement is not the last statement for the line return false; } return true; }
[ "private", "boolean", "isLineLastStament", "(", "TestMethod", "method", ",", "int", "codeLineIndex", ")", "{", "CodeLine", "codeLine", "=", "method", ".", "getCodeBody", "(", ")", ".", "get", "(", "codeLineIndex", ")", ";", "if", "(", "codeLineIndex", "==", ...
This may return false since multiple statement can be found in a line.
[ "This", "may", "return", "false", "since", "multiple", "statement", "can", "be", "found", "in", "a", "line", "." ]
train
https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/runlib/runresultsgen/RunResultsGenerateHookSetter.java#L110-L124
alkacon/opencms-core
src/org/opencms/db/CmsDbUtil.java
CmsDbUtil.fillParameters
public static void fillParameters(PreparedStatement stmt, List<Object> params) throws SQLException { int i = 1; for (Object param : params) { if (param instanceof String) { stmt.setString(i, (String)param); } else if (param instanceof Integer) { stmt.setInt(i, ((Integer)param).intValue()); } else if (param instanceof Long) { stmt.setLong(i, ((Long)param).longValue()); } else { throw new IllegalArgumentException(); } i += 1; } }
java
public static void fillParameters(PreparedStatement stmt, List<Object> params) throws SQLException { int i = 1; for (Object param : params) { if (param instanceof String) { stmt.setString(i, (String)param); } else if (param instanceof Integer) { stmt.setInt(i, ((Integer)param).intValue()); } else if (param instanceof Long) { stmt.setLong(i, ((Long)param).longValue()); } else { throw new IllegalArgumentException(); } i += 1; } }
[ "public", "static", "void", "fillParameters", "(", "PreparedStatement", "stmt", ",", "List", "<", "Object", ">", "params", ")", "throws", "SQLException", "{", "int", "i", "=", "1", ";", "for", "(", "Object", "param", ":", "params", ")", "{", "if", "(", ...
Fills a given prepared statement with parameters from a list of objects.<p> @param stmt the prepared statement @param params the parameter objects @throws SQLException if something goes wrong
[ "Fills", "a", "given", "prepared", "statement", "with", "parameters", "from", "a", "list", "of", "objects", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDbUtil.java#L58-L73
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java
GlobalConfiguration.getFloatInternal
private float getFloatInternal(String key, float defaultValue) { float retVal = defaultValue; try { synchronized (this.confData) { if (this.confData.containsKey(key)) { retVal = Float.parseFloat(this.confData.get(key)); } } } catch (NumberFormatException e) { if (LOG.isDebugEnabled()) { LOG.debug(StringUtils.stringifyException(e)); } } return retVal; }
java
private float getFloatInternal(String key, float defaultValue) { float retVal = defaultValue; try { synchronized (this.confData) { if (this.confData.containsKey(key)) { retVal = Float.parseFloat(this.confData.get(key)); } } } catch (NumberFormatException e) { if (LOG.isDebugEnabled()) { LOG.debug(StringUtils.stringifyException(e)); } } return retVal; }
[ "private", "float", "getFloatInternal", "(", "String", "key", ",", "float", "defaultValue", ")", "{", "float", "retVal", "=", "defaultValue", ";", "try", "{", "synchronized", "(", "this", ".", "confData", ")", "{", "if", "(", "this", ".", "confData", ".", ...
Returns the value associated with the given key as an integer. @param key the key pointing to the associated value @param defaultValue the default value which is returned in case there is no value associated with the given key @return the (default) value associated with the given key
[ "Returns", "the", "value", "associated", "with", "the", "given", "key", "as", "an", "integer", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/configuration/GlobalConfiguration.java#L235-L254
structurizr/java
structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java
StructurizrDocumentationTemplate.addComponentsSection
@Nonnull public Section addComponentsSection(@Nullable Container container, File... files) throws IOException { return addSection(container, "Components", files); }
java
@Nonnull public Section addComponentsSection(@Nullable Container container, File... files) throws IOException { return addSection(container, "Components", files); }
[ "@", "Nonnull", "public", "Section", "addComponentsSection", "(", "@", "Nullable", "Container", "container", ",", "File", "...", "files", ")", "throws", "IOException", "{", "return", "addSection", "(", "container", ",", "\"Components\"", ",", "files", ")", ";", ...
Adds a "Components" section relating to a {@link Container} from one or more files. @param container the {@link Container} the documentation content relates to @param files one or more File objects that point to the documentation content @return a documentation {@link Section} @throws IOException if there is an error reading the files
[ "Adds", "a", "Components", "section", "relating", "to", "a", "{", "@link", "Container", "}", "from", "one", "or", "more", "files", "." ]
train
https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/documentation/StructurizrDocumentationTemplate.java#L239-L242
apereo/cas
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/BaseRegisteredServiceUsernameAttributeProvider.java
BaseRegisteredServiceUsernameAttributeProvider.encryptResolvedUsername
protected String encryptResolvedUsername(final Principal principal, final Service service, final RegisteredService registeredService, final String username) { val applicationContext = ApplicationContextProvider.getApplicationContext(); val cipher = applicationContext.getBean("registeredServiceCipherExecutor", RegisteredServiceCipherExecutor.class); return cipher.encode(username, Optional.of(registeredService)); }
java
protected String encryptResolvedUsername(final Principal principal, final Service service, final RegisteredService registeredService, final String username) { val applicationContext = ApplicationContextProvider.getApplicationContext(); val cipher = applicationContext.getBean("registeredServiceCipherExecutor", RegisteredServiceCipherExecutor.class); return cipher.encode(username, Optional.of(registeredService)); }
[ "protected", "String", "encryptResolvedUsername", "(", "final", "Principal", "principal", ",", "final", "Service", "service", ",", "final", "RegisteredService", "registeredService", ",", "final", "String", "username", ")", "{", "val", "applicationContext", "=", "Appli...
Encrypt resolved username. @param principal the principal @param service the service @param registeredService the registered service @param username the username @return the encrypted username or null
[ "Encrypt", "resolved", "username", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/BaseRegisteredServiceUsernameAttributeProvider.java#L68-L72
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnparameter.java
vpnparameter.get
public static vpnparameter get(nitro_service service, options option) throws Exception{ vpnparameter obj = new vpnparameter(); vpnparameter[] response = (vpnparameter[])obj.get_resources(service,option); return response[0]; }
java
public static vpnparameter get(nitro_service service, options option) throws Exception{ vpnparameter obj = new vpnparameter(); vpnparameter[] response = (vpnparameter[])obj.get_resources(service,option); return response[0]; }
[ "public", "static", "vpnparameter", "get", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "vpnparameter", "obj", "=", "new", "vpnparameter", "(", ")", ";", "vpnparameter", "[", "]", "response", "=", "(", "vpnparamet...
Use this API to fetch all the vpnparameter resources that are configured on netscaler.
[ "Use", "this", "API", "to", "fetch", "all", "the", "vpnparameter", "resources", "that", "are", "configured", "on", "netscaler", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/vpn/vpnparameter.java#L1494-L1498
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.longSum
public static <Key, Value> Aggregation<Key, Long, Long> longSum() { return new AggregationAdapter(new LongSumAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, Long, Long> longSum() { return new AggregationAdapter(new LongSumAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "Long", ",", "Long", ">", "longSum", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "LongSumAggregation", "<", "Key", ",", "Value", ">", "(", ")", ")"...
Returns an aggregation to calculate the long sum of all supplied values.<br/> This aggregation is similar to: <pre>SELECT SUM(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the sum over all supplied values
[ "Returns", "an", "aggregation", "to", "calculate", "the", "long", "sum", "of", "all", "supplied", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", "<pre", ">", "SELECT", "SUM", "(", "value", ")", "FROM", "x<", "/", "pr...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L162-L164
jglobus/JGlobus
gss/src/main/java/org/globus/gsi/gssapi/JaasGssUtil.java
JaasGssUtil.createSubject
public static Subject createSubject(GSSName name, GSSCredential cred) throws GSSException { if (cred == null && name == null) { return null; } Subject subject = new Subject(); if (cred != null) { subject.getPrivateCredentials().add(cred); if (name == null) { GlobusPrincipal nm = toGlobusPrincipal(cred.getName()); subject.getPrincipals().add(nm); } } if (name != null) { GlobusPrincipal nm = toGlobusPrincipal(name); subject.getPrincipals().add(nm); } return subject; }
java
public static Subject createSubject(GSSName name, GSSCredential cred) throws GSSException { if (cred == null && name == null) { return null; } Subject subject = new Subject(); if (cred != null) { subject.getPrivateCredentials().add(cred); if (name == null) { GlobusPrincipal nm = toGlobusPrincipal(cred.getName()); subject.getPrincipals().add(nm); } } if (name != null) { GlobusPrincipal nm = toGlobusPrincipal(name); subject.getPrincipals().add(nm); } return subject; }
[ "public", "static", "Subject", "createSubject", "(", "GSSName", "name", ",", "GSSCredential", "cred", ")", "throws", "GSSException", "{", "if", "(", "cred", "==", "null", "&&", "name", "==", "null", ")", "{", "return", "null", ";", "}", "Subject", "subject...
Creates a new <code>Subject</code> object from specified <code>GSSCredential</code> and <code>GSSName</code>. If the GSSCredential is specified it is added to the private credential set of the Subject object. Also, if the GSSCredential.getName() is of type <code> org.globus.gsi.gssapi.GlobusGSSName</code> and the GSSName parameter was not specified a <code>org.globus.gsi.jaas.GlobusPrincipal</code> is added to the principals set of the Subject object. If the GSSName parameter was specified of type <code>org.globus.gsi.gssapi.GlobusGSSName</code> a <code>org.globus.gsi.jaas.GlobusPrincipal</code> is added to the principals set of the Subject object.
[ "Creates", "a", "new", "<code", ">", "Subject<", "/", "code", ">", "object", "from", "specified", "<code", ">", "GSSCredential<", "/", "code", ">", "and", "<code", ">", "GSSName<", "/", "code", ">", ".", "If", "the", "GSSCredential", "is", "specified", "...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/gss/src/main/java/org/globus/gsi/gssapi/JaasGssUtil.java#L63-L82
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java
DoublesSketch.getUpdatableStorageBytes
public static int getUpdatableStorageBytes(final int k, final long n) { if (n == 0) { return 8; } final int metaPre = DoublesSketch.MAX_PRELONGS + 2; //plus min, max final int totLevels = Util.computeNumLevelsNeeded(k, n); if (n <= k) { final int ceil = Math.max(ceilingPowerOf2((int)n), DoublesSketch.MIN_K * 2); return (metaPre + ceil) << 3; } return (metaPre + ((2 + totLevels) * k)) << 3; }
java
public static int getUpdatableStorageBytes(final int k, final long n) { if (n == 0) { return 8; } final int metaPre = DoublesSketch.MAX_PRELONGS + 2; //plus min, max final int totLevels = Util.computeNumLevelsNeeded(k, n); if (n <= k) { final int ceil = Math.max(ceilingPowerOf2((int)n), DoublesSketch.MIN_K * 2); return (metaPre + ceil) << 3; } return (metaPre + ((2 + totLevels) * k)) << 3; }
[ "public", "static", "int", "getUpdatableStorageBytes", "(", "final", "int", "k", ",", "final", "long", "n", ")", "{", "if", "(", "n", "==", "0", ")", "{", "return", "8", ";", "}", "final", "int", "metaPre", "=", "DoublesSketch", ".", "MAX_PRELONGS", "+...
Returns the number of bytes a sketch would require to store in updatable form. This uses roughly 2X the storage of the compact form given the values of <i>k</i> and <i>n</i>. @param k the size configuration parameter for the sketch @param n the number of items input into the sketch @return the number of bytes this sketch would require to store in updatable form.
[ "Returns", "the", "number", "of", "bytes", "a", "sketch", "would", "require", "to", "store", "in", "updatable", "form", ".", "This", "uses", "roughly", "2X", "the", "storage", "of", "the", "compact", "form", "given", "the", "values", "of", "<i", ">", "k<...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L664-L673
apereo/cas
support/cas-server-support-google-analytics/src/main/java/org/apereo/cas/web/flow/CasGoogleAnalyticsWebflowConfigurer.java
CasGoogleAnalyticsWebflowConfigurer.putGoogleAnalyticsTrackingIdIntoFlowScope
private static void putGoogleAnalyticsTrackingIdIntoFlowScope(final RequestContext context, final String value) { if (StringUtils.isBlank(value)) { context.getFlowScope().remove(ATTRIBUTE_FLOWSCOPE_GOOGLE_ANALYTICS_TRACKING_ID); } else { context.getFlowScope().put(ATTRIBUTE_FLOWSCOPE_GOOGLE_ANALYTICS_TRACKING_ID, value); } }
java
private static void putGoogleAnalyticsTrackingIdIntoFlowScope(final RequestContext context, final String value) { if (StringUtils.isBlank(value)) { context.getFlowScope().remove(ATTRIBUTE_FLOWSCOPE_GOOGLE_ANALYTICS_TRACKING_ID); } else { context.getFlowScope().put(ATTRIBUTE_FLOWSCOPE_GOOGLE_ANALYTICS_TRACKING_ID, value); } }
[ "private", "static", "void", "putGoogleAnalyticsTrackingIdIntoFlowScope", "(", "final", "RequestContext", "context", ",", "final", "String", "value", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "value", ")", ")", "{", "context", ".", "getFlowScope", ...
Put tracking id into flow scope. @param context the context @param value the value
[ "Put", "tracking", "id", "into", "flow", "scope", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-google-analytics/src/main/java/org/apereo/cas/web/flow/CasGoogleAnalyticsWebflowConfigurer.java#L107-L113
apache/reef
lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/FileSet.java
FileSet.createSymbolicLinkTo
void createSymbolicLinkTo(final File destinationFolder) throws IOException { for (final File f : this.theFiles) { final File destinationFile = new File(destinationFolder, f.getName()); Files.createSymbolicLink(destinationFile.toPath(), f.toPath()); } }
java
void createSymbolicLinkTo(final File destinationFolder) throws IOException { for (final File f : this.theFiles) { final File destinationFile = new File(destinationFolder, f.getName()); Files.createSymbolicLink(destinationFile.toPath(), f.toPath()); } }
[ "void", "createSymbolicLinkTo", "(", "final", "File", "destinationFolder", ")", "throws", "IOException", "{", "for", "(", "final", "File", "f", ":", "this", ".", "theFiles", ")", "{", "final", "File", "destinationFile", "=", "new", "File", "(", "destinationFol...
Creates symbolic links for the current FileSet into the given destinationFolder. @param destinationFolder the folder where the symbolic links will be created. @throws IOException
[ "Creates", "symbolic", "links", "for", "the", "current", "FileSet", "into", "the", "given", "destinationFolder", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/FileSet.java#L92-L97
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java
PgCallableStatement.checkIndex
protected void checkIndex(int parameterIndex, int type, String getName) throws SQLException { checkIndex(parameterIndex); if (type != this.testReturn[parameterIndex - 1]) { throw new PSQLException( GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.", "java.sql.Types=" + testReturn[parameterIndex - 1], getName, "java.sql.Types=" + type), PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH); } }
java
protected void checkIndex(int parameterIndex, int type, String getName) throws SQLException { checkIndex(parameterIndex); if (type != this.testReturn[parameterIndex - 1]) { throw new PSQLException( GT.tr("Parameter of type {0} was registered, but call to get{1} (sqltype={2}) was made.", "java.sql.Types=" + testReturn[parameterIndex - 1], getName, "java.sql.Types=" + type), PSQLState.MOST_SPECIFIC_TYPE_DOES_NOT_MATCH); } }
[ "protected", "void", "checkIndex", "(", "int", "parameterIndex", ",", "int", "type", ",", "String", "getName", ")", "throws", "SQLException", "{", "checkIndex", "(", "parameterIndex", ")", ";", "if", "(", "type", "!=", "this", ".", "testReturn", "[", "parame...
Helper function for the getXXX calls to check isFunction and index == 1. @param parameterIndex parameter index (1-based) @param type type @param getName getter name @throws SQLException if given index is not valid
[ "Helper", "function", "for", "the", "getXXX", "calls", "to", "check", "isFunction", "and", "index", "==", "1", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/PgCallableStatement.java#L382-L391
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.warnv
public void warnv(String format, Object param1, Object param2, Object param3) { if (isEnabled(Level.WARN)) { doLog(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, null); } }
java
public void warnv(String format, Object param1, Object param2, Object param3) { if (isEnabled(Level.WARN)) { doLog(Level.WARN, FQCN, format, new Object[] { param1, param2, param3 }, null); } }
[ "public", "void", "warnv", "(", "String", "format", ",", "Object", "param1", ",", "Object", "param2", ",", "Object", "param3", ")", "{", "if", "(", "isEnabled", "(", "Level", ".", "WARN", ")", ")", "{", "doLog", "(", "Level", ".", "WARN", ",", "FQCN"...
Issue a log message with a level of WARN using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param param1 the first parameter @param param2 the second parameter @param param3 the third parameter
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "WARN", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1330-L1334
michel-kraemer/citeproc-java
citeproc-java/src/main/java/de/undercouch/citeproc/helper/CSLUtils.java
CSLUtils.readURLToString
public static String readURLToString(URL u, String encoding) throws IOException { for (int i = 0; i < 30; ++i) { URLConnection conn = u.openConnection(); // handle HTTP URLs if (conn instanceof HttpURLConnection) { HttpURLConnection hconn = (HttpURLConnection)conn; // set timeouts hconn.setConnectTimeout(15000); hconn.setReadTimeout(15000); // handle redirects switch (hconn.getResponseCode()) { case HttpURLConnection.HTTP_MOVED_PERM: case HttpURLConnection.HTTP_MOVED_TEMP: String location = hconn.getHeaderField("Location"); u = new URL(u, location); continue; } } return readStreamToString(conn.getInputStream(), encoding); } throw new IOException("Too many HTTP redirects"); }
java
public static String readURLToString(URL u, String encoding) throws IOException { for (int i = 0; i < 30; ++i) { URLConnection conn = u.openConnection(); // handle HTTP URLs if (conn instanceof HttpURLConnection) { HttpURLConnection hconn = (HttpURLConnection)conn; // set timeouts hconn.setConnectTimeout(15000); hconn.setReadTimeout(15000); // handle redirects switch (hconn.getResponseCode()) { case HttpURLConnection.HTTP_MOVED_PERM: case HttpURLConnection.HTTP_MOVED_TEMP: String location = hconn.getHeaderField("Location"); u = new URL(u, location); continue; } } return readStreamToString(conn.getInputStream(), encoding); } throw new IOException("Too many HTTP redirects"); }
[ "public", "static", "String", "readURLToString", "(", "URL", "u", ",", "String", "encoding", ")", "throws", "IOException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "30", ";", "++", "i", ")", "{", "URLConnection", "conn", "=", "u", ".", ...
Reads a string from a URL @param u the URL @param encoding the character encoding @return the string @throws IOException if the URL contents could not be read
[ "Reads", "a", "string", "from", "a", "URL" ]
train
https://github.com/michel-kraemer/citeproc-java/blob/1d5bf0e7bbb2bdc47309530babf0ecaba838bf10/citeproc-java/src/main/java/de/undercouch/citeproc/helper/CSLUtils.java#L38-L64
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java
PtoPInputHandler.reportResolvedGap
@Override public void reportResolvedGap(String sourceMEUuid, long filledGap) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "reportResolvedGap", new Object[] { sourceMEUuid, new Long(filledGap) }); if (_isLink) { //The gap starting at sequence id {0} in the message stream from bus {1} on link {2} has been resolved on message engine {3}. SibTr.info(tc, "RESOLVED_GAP_IN_LINK_TRANSMITTER_CWSIP0791", new Object[] { (new Long(filledGap)).toString(), ((LinkHandler) _destination).getBusName(), _destination.getName(), _messageProcessor.getMessagingEngineName() }); } else { //The gap starting at sequence id {0} in the message stream for destination {1} from messaging engine {2} has been resolved on message engine {3}. SibTr.info(tc, "RESOLVED_GAP_IN_DESTINATION_TRANSMITTER_CWSIP0793", new Object[] { (new Long(filledGap)).toString(), _destination.getName(), SIMPUtils.getMENameFromUuid(sourceMEUuid), _messageProcessor.getMessagingEngineName() }); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reportResolvedGap"); }
java
@Override public void reportResolvedGap(String sourceMEUuid, long filledGap) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "reportResolvedGap", new Object[] { sourceMEUuid, new Long(filledGap) }); if (_isLink) { //The gap starting at sequence id {0} in the message stream from bus {1} on link {2} has been resolved on message engine {3}. SibTr.info(tc, "RESOLVED_GAP_IN_LINK_TRANSMITTER_CWSIP0791", new Object[] { (new Long(filledGap)).toString(), ((LinkHandler) _destination).getBusName(), _destination.getName(), _messageProcessor.getMessagingEngineName() }); } else { //The gap starting at sequence id {0} in the message stream for destination {1} from messaging engine {2} has been resolved on message engine {3}. SibTr.info(tc, "RESOLVED_GAP_IN_DESTINATION_TRANSMITTER_CWSIP0793", new Object[] { (new Long(filledGap)).toString(), _destination.getName(), SIMPUtils.getMENameFromUuid(sourceMEUuid), _messageProcessor.getMessagingEngineName() }); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "reportResolvedGap"); }
[ "@", "Override", "public", "void", "reportResolvedGap", "(", "String", "sourceMEUuid", ",", "long", "filledGap", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "ent...
Issue an all clear on a previously reported gap in a GD stream (510343) @param sourceMEUuid @param filledGap
[ "Issue", "an", "all", "clear", "on", "a", "previously", "reported", "gap", "in", "a", "GD", "stream", "(", "510343", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java#L3538-L3565
primefaces/primefaces
src/main/java/org/primefaces/expression/SearchExpressionFacade.java
SearchExpressionFacade.resolveClientIds
public static String resolveClientIds(FacesContext context, UIComponent source, String expressions) { return resolveClientIds(context, source, expressions, SearchExpressionHint.NONE); }
java
public static String resolveClientIds(FacesContext context, UIComponent source, String expressions) { return resolveClientIds(context, source, expressions, SearchExpressionHint.NONE); }
[ "public", "static", "String", "resolveClientIds", "(", "FacesContext", "context", ",", "UIComponent", "source", ",", "String", "expressions", ")", "{", "return", "resolveClientIds", "(", "context", ",", "source", ",", "expressions", ",", "SearchExpressionHint", ".",...
Resolves a list of {@link UIComponent} clientIds and/or passtrough expressions for the given expression or expressions. @param context The {@link FacesContext}. @param source The source component. E.g. a button. @param expressions The search expressions. @return A {@link List} with resolved clientIds and/or passtrough expression (like PFS, widgetVar).
[ "Resolves", "a", "list", "of", "{", "@link", "UIComponent", "}", "clientIds", "and", "/", "or", "passtrough", "expressions", "for", "the", "given", "expression", "or", "expressions", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/expression/SearchExpressionFacade.java#L152-L155
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java
CommerceOrderItemPersistenceImpl.removeByC_S
@Override public void removeByC_S(long commerceOrderId, boolean subscription) { for (CommerceOrderItem commerceOrderItem : findByC_S(commerceOrderId, subscription, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceOrderItem); } }
java
@Override public void removeByC_S(long commerceOrderId, boolean subscription) { for (CommerceOrderItem commerceOrderItem : findByC_S(commerceOrderId, subscription, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceOrderItem); } }
[ "@", "Override", "public", "void", "removeByC_S", "(", "long", "commerceOrderId", ",", "boolean", "subscription", ")", "{", "for", "(", "CommerceOrderItem", "commerceOrderItem", ":", "findByC_S", "(", "commerceOrderId", ",", "subscription", ",", "QueryUtil", ".", ...
Removes all the commerce order items where commerceOrderId = &#63; and subscription = &#63; from the database. @param commerceOrderId the commerce order ID @param subscription the subscription
[ "Removes", "all", "the", "commerce", "order", "items", "where", "commerceOrderId", "=", "&#63", ";", "and", "subscription", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderItemPersistenceImpl.java#L2682-L2688
sababado/CircularView
library/src/main/java/com/sababado/circularview/CircularViewObject.java
CircularViewObject.updateDrawableState
public void updateDrawableState(int state, boolean flag) { final int oldState = mCombinedState; // Update the combined state flag if (flag) mCombinedState |= state; else mCombinedState &= ~state; // Set the combined state if (oldState != mCombinedState) { setState(VIEW_STATE_SETS[mCombinedState]); } }
java
public void updateDrawableState(int state, boolean flag) { final int oldState = mCombinedState; // Update the combined state flag if (flag) mCombinedState |= state; else mCombinedState &= ~state; // Set the combined state if (oldState != mCombinedState) { setState(VIEW_STATE_SETS[mCombinedState]); } }
[ "public", "void", "updateDrawableState", "(", "int", "state", ",", "boolean", "flag", ")", "{", "final", "int", "oldState", "=", "mCombinedState", ";", "// Update the combined state flag", "if", "(", "flag", ")", "mCombinedState", "|=", "state", ";", "else", "mC...
Either remove or add a state to the combined state. @param state State to add or remove. @param flag True to add, false to remove.
[ "Either", "remove", "or", "add", "a", "state", "to", "the", "combined", "state", "." ]
train
https://github.com/sababado/CircularView/blob/c9ab818d063bcc0796183616f8a82166a9b80aac/library/src/main/java/com/sababado/circularview/CircularViewObject.java#L230-L240
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/application/ResourceHandlerWrapper.java
ResourceHandlerWrapper.createResource
@Override public Resource createResource(String resourceName, String libraryName) { return getWrapped().createResource(resourceName, libraryName); }
java
@Override public Resource createResource(String resourceName, String libraryName) { return getWrapped().createResource(resourceName, libraryName); }
[ "@", "Override", "public", "Resource", "createResource", "(", "String", "resourceName", ",", "String", "libraryName", ")", "{", "return", "getWrapped", "(", ")", ".", "createResource", "(", "resourceName", ",", "libraryName", ")", ";", "}" ]
<p class="changed_added_2_0">The default behavior of this method is to call {@link ResourceHandler#createResource(String, String)} on the wrapped {@link ResourceHandler} object.</p>
[ "<p", "class", "=", "changed_added_2_0", ">", "The", "default", "behavior", "of", "this", "method", "is", "to", "call", "{" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/application/ResourceHandlerWrapper.java#L109-L114
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.writeMeta
public void writeMeta(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.logger.log(Level.FINER, "Writing odselement: metaElement to zip file"); this.metaElement.write(xmlUtil, writer); }
java
public void writeMeta(final XMLUtil xmlUtil, final ZipUTF8Writer writer) throws IOException { this.logger.log(Level.FINER, "Writing odselement: metaElement to zip file"); this.metaElement.write(xmlUtil, writer); }
[ "public", "void", "writeMeta", "(", "final", "XMLUtil", "xmlUtil", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "this", ".", "logger", ".", "log", "(", "Level", ".", "FINER", ",", "\"Writing odselement: metaElement to zip file\"", ")...
Write the meta element to a writer. @param xmlUtil the xml util @param writer the writer @throws IOException if write fails
[ "Write", "the", "meta", "element", "to", "a", "writer", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L399-L402
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/segmentation/fh04/SegmentFelzenszwalbHuttenlocher04.java
SegmentFelzenszwalbHuttenlocher04.initialize
protected void initialize(T input , GrayS32 output ) { this.graph = output; final int N = input.width*input.height; regionSize.resize(N); threshold.resize(N); for( int i = 0; i < N; i++ ) { regionSize.data[i] = 1; threshold.data[i] = K; graph.data[i] = i; // assign a unique label to each pixel since they are all their own region initially } edges.reset(); edgesNotMatched.reset(); }
java
protected void initialize(T input , GrayS32 output ) { this.graph = output; final int N = input.width*input.height; regionSize.resize(N); threshold.resize(N); for( int i = 0; i < N; i++ ) { regionSize.data[i] = 1; threshold.data[i] = K; graph.data[i] = i; // assign a unique label to each pixel since they are all their own region initially } edges.reset(); edgesNotMatched.reset(); }
[ "protected", "void", "initialize", "(", "T", "input", ",", "GrayS32", "output", ")", "{", "this", ".", "graph", "=", "output", ";", "final", "int", "N", "=", "input", ".", "width", "*", "input", ".", "height", ";", "regionSize", ".", "resize", "(", "...
Predeclares all memory required and sets data structures to their initial values
[ "Predeclares", "all", "memory", "required", "and", "sets", "data", "structures", "to", "their", "initial", "values" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/segmentation/fh04/SegmentFelzenszwalbHuttenlocher04.java#L170-L184
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/DevicesManagementApi.java
DevicesManagementApi.getStatusesAsync
public com.squareup.okhttp.Call getStatusesAsync(String tid, Integer count, Integer offset, String status, String dids, final ApiCallback<TaskStatusesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getStatusesValidateBeforeCall(tid, count, offset, status, dids, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<TaskStatusesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
java
public com.squareup.okhttp.Call getStatusesAsync(String tid, Integer count, Integer offset, String status, String dids, final ApiCallback<TaskStatusesEnvelope> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = getStatusesValidateBeforeCall(tid, count, offset, status, dids, progressListener, progressRequestListener); Type localVarReturnType = new TypeToken<TaskStatusesEnvelope>(){}.getType(); apiClient.executeAsync(call, localVarReturnType, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "getStatusesAsync", "(", "String", "tid", ",", "Integer", "count", ",", "Integer", "offset", ",", "String", "status", ",", "String", "dids", ",", "final", "ApiCallback", "<", "TaskStatusesEnvelope",...
Returns the details and status of a task id and the individual statuses of each device id in the list. (asynchronously) Returns the details and status of a task id and the individual statuses of each device id in the list. @param tid Task ID. (required) @param count Max results count. (optional) @param offset Result starting offset. (optional) @param status Status filter. Comma-separated statuses. (optional) @param dids Devices filter. Comma-separated device IDs. (optional) @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
[ "Returns", "the", "details", "and", "status", "of", "a", "task", "id", "and", "the", "individual", "statuses", "of", "each", "device", "id", "in", "the", "list", ".", "(", "asynchronously", ")", "Returns", "the", "details", "and", "status", "of", "a", "t...
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/DevicesManagementApi.java#L927-L952
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java
TrackerMeanShiftComaniciu2003.distanceHistogram
protected double distanceHistogram(float histogramA[], float histogramB[]) { double sumP = 0; for( int i = 0; i < histogramA.length; i++ ) { float q = histogramA[i]; float p = histogramB[i]; sumP += Math.abs(q-p); } return sumP; }
java
protected double distanceHistogram(float histogramA[], float histogramB[]) { double sumP = 0; for( int i = 0; i < histogramA.length; i++ ) { float q = histogramA[i]; float p = histogramB[i]; sumP += Math.abs(q-p); } return sumP; }
[ "protected", "double", "distanceHistogram", "(", "float", "histogramA", "[", "]", ",", "float", "histogramB", "[", "]", ")", "{", "double", "sumP", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "histogramA", ".", "length", ";", "i",...
Computes the difference between two histograms using SAD. This is a change from the paper, which uses Bhattacharyya. Bhattacharyya could give poor performance even with perfect data since two errors can cancel each other out. For example, part of the histogram is too small and another part is too large.
[ "Computes", "the", "difference", "between", "two", "histograms", "using", "SAD", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/meanshift/TrackerMeanShiftComaniciu2003.java#L325-L333
LearnLib/learnlib
commons/acex/src/main/java/de/learnlib/acex/analyzers/AcexAnalysisAlgorithms.java
AcexAnalysisAlgorithms.exponentialSearchBwd
public static <E> int exponentialSearchBwd(AbstractCounterexample<E> acex, int low, int high) { assert !acex.testEffects(low, high); int ofs = 1; E effHigh = acex.effect(high); int highIter = high; int lowIter = low; while (highIter - ofs > lowIter) { int next = highIter - ofs; E eff = acex.effect(next); if (!acex.checkEffects(eff, effHigh)) { lowIter = next; break; } highIter = next; ofs *= 2; } return binarySearchRight(acex, lowIter, highIter); }
java
public static <E> int exponentialSearchBwd(AbstractCounterexample<E> acex, int low, int high) { assert !acex.testEffects(low, high); int ofs = 1; E effHigh = acex.effect(high); int highIter = high; int lowIter = low; while (highIter - ofs > lowIter) { int next = highIter - ofs; E eff = acex.effect(next); if (!acex.checkEffects(eff, effHigh)) { lowIter = next; break; } highIter = next; ofs *= 2; } return binarySearchRight(acex, lowIter, highIter); }
[ "public", "static", "<", "E", ">", "int", "exponentialSearchBwd", "(", "AbstractCounterexample", "<", "E", ">", "acex", ",", "int", "low", ",", "int", "high", ")", "{", "assert", "!", "acex", ".", "testEffects", "(", "low", ",", "high", ")", ";", "int"...
Search for a suffix index using an exponential search. @param acex the abstract counterexample @param low the lower bound of the search range @param high the upper bound of the search range @return an index <code>i</code> such that <code>acex.testEffect(i) != acex.testEffect(i+1)</code>
[ "Search", "for", "a", "suffix", "index", "using", "an", "exponential", "search", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/acex/src/main/java/de/learnlib/acex/analyzers/AcexAnalysisAlgorithms.java#L90-L111
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Popups.java
Popups.centerOn
public static <T extends PopupPanel> T centerOn (T popup, int ypos) { boolean wasHidden = !popup.isShowing(); boolean wasVisible = popup.isVisible(); if (wasVisible) { popup.setVisible(false); } if (wasHidden) { popup.show(); } int left = (Window.getClientWidth() - popup.getOffsetWidth()) >> 1; int top = ypos - popup.getOffsetHeight()/2; // bound the popup into the visible browser area if possible if (popup.getOffsetHeight() < Window.getClientHeight()) { top = Math.min(Math.max(0, top), Window.getClientHeight() - popup.getOffsetHeight()); } popup.setPopupPosition(left, top); if (wasHidden) { popup.hide(); } if (wasVisible) { popup.setVisible(true); } return popup; }
java
public static <T extends PopupPanel> T centerOn (T popup, int ypos) { boolean wasHidden = !popup.isShowing(); boolean wasVisible = popup.isVisible(); if (wasVisible) { popup.setVisible(false); } if (wasHidden) { popup.show(); } int left = (Window.getClientWidth() - popup.getOffsetWidth()) >> 1; int top = ypos - popup.getOffsetHeight()/2; // bound the popup into the visible browser area if possible if (popup.getOffsetHeight() < Window.getClientHeight()) { top = Math.min(Math.max(0, top), Window.getClientHeight() - popup.getOffsetHeight()); } popup.setPopupPosition(left, top); if (wasHidden) { popup.hide(); } if (wasVisible) { popup.setVisible(true); } return popup; }
[ "public", "static", "<", "T", "extends", "PopupPanel", ">", "T", "centerOn", "(", "T", "popup", ",", "int", "ypos", ")", "{", "boolean", "wasHidden", "=", "!", "popup", ".", "isShowing", "(", ")", ";", "boolean", "wasVisible", "=", "popup", ".", "isVis...
Centers the supplied vertically on the supplied trigger widget. The popup's showing state will be preserved. @return the supplied popup.
[ "Centers", "the", "supplied", "vertically", "on", "the", "supplied", "trigger", "widget", ".", "The", "popup", "s", "showing", "state", "will", "be", "preserved", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Popups.java#L240-L264
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.location_pccZone_hypervisor_shortName_GET
public OvhOs location_pccZone_hypervisor_shortName_GET(String pccZone, String shortName) throws IOException { String qPath = "/dedicatedCloud/location/{pccZone}/hypervisor/{shortName}"; StringBuilder sb = path(qPath, pccZone, shortName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOs.class); }
java
public OvhOs location_pccZone_hypervisor_shortName_GET(String pccZone, String shortName) throws IOException { String qPath = "/dedicatedCloud/location/{pccZone}/hypervisor/{shortName}"; StringBuilder sb = path(qPath, pccZone, shortName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOs.class); }
[ "public", "OvhOs", "location_pccZone_hypervisor_shortName_GET", "(", "String", "pccZone", ",", "String", "shortName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/location/{pccZone}/hypervisor/{shortName}\"", ";", "StringBuilder", "sb", "=", ...
Get this object properties REST: GET /dedicatedCloud/location/{pccZone}/hypervisor/{shortName} @param pccZone [required] Name of pccZone @param shortName [required] Short name of hypervisor
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L3081-L3086
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java
SharesInner.beginRefreshAsync
public Observable<Void> beginRefreshAsync(String deviceName, String name, String resourceGroupName) { return beginRefreshWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginRefreshAsync(String deviceName, String name, String resourceGroupName) { return beginRefreshWithServiceResponseAsync(deviceName, name, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginRefreshAsync", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ")", "{", "return", "beginRefreshWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroupName",...
Refreshes the share metadata with the data from the cloud. @param deviceName The device name. @param name The share name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Refreshes", "the", "share", "metadata", "with", "the", "data", "from", "the", "cloud", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/SharesInner.java#L786-L793
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java
PropertiesUtil.loadClose
static Properties loadClose(final InputStream in, final Object source) { final Properties props = new Properties(); if (null != in) { try { props.load(in); } catch (final IOException e) { LowLevelLogUtil.logException("Unable to read " + source, e); } finally { try { in.close(); } catch (final IOException e) { LowLevelLogUtil.logException("Unable to close " + source, e); } } } return props; }
java
static Properties loadClose(final InputStream in, final Object source) { final Properties props = new Properties(); if (null != in) { try { props.load(in); } catch (final IOException e) { LowLevelLogUtil.logException("Unable to read " + source, e); } finally { try { in.close(); } catch (final IOException e) { LowLevelLogUtil.logException("Unable to close " + source, e); } } } return props; }
[ "static", "Properties", "loadClose", "(", "final", "InputStream", "in", ",", "final", "Object", "source", ")", "{", "final", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "if", "(", "null", "!=", "in", ")", "{", "try", "{", "props", "...
Loads and closes the given property input stream. If an error occurs, log to the status logger. @param in a property input stream. @param source a source object describing the source, like a resource string or a URL. @return a new Properties object
[ "Loads", "and", "closes", "the", "given", "property", "input", "stream", ".", "If", "an", "error", "occurs", "log", "to", "the", "status", "logger", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/PropertiesUtil.java#L77-L93
spring-projects/spring-hateoas
src/main/java/org/springframework/hateoas/server/mvc/RepresentationModelAssemblerSupport.java
RepresentationModelAssemblerSupport.createModelWithId
protected D createModelWithId(Object id, T entity) { return createModelWithId(id, entity, new Object[0]); }
java
protected D createModelWithId(Object id, T entity) { return createModelWithId(id, entity, new Object[0]); }
[ "protected", "D", "createModelWithId", "(", "Object", "id", ",", "T", "entity", ")", "{", "return", "createModelWithId", "(", "id", ",", "entity", ",", "new", "Object", "[", "0", "]", ")", ";", "}" ]
Creates a new resource with a self link to the given id. @param entity must not be {@literal null}. @param id must not be {@literal null}. @return
[ "Creates", "a", "new", "resource", "with", "a", "self", "link", "to", "the", "given", "id", "." ]
train
https://github.com/spring-projects/spring-hateoas/blob/70ebff9309f086cd8d6a97daf67e0dc215c87d9c/src/main/java/org/springframework/hateoas/server/mvc/RepresentationModelAssemblerSupport.java#L78-L80
sebastiangraf/jSCSI
bundles/commons/src/main/java/org/jscsi/parser/AbstractMessageParser.java
AbstractMessageParser.serializeBasicHeaderSegment
final void serializeBasicHeaderSegment (final ByteBuffer dst, final int offset) throws InternetSCSIException { dst.position(offset); dst.putInt(offset, dst.getInt() | serializeBytes1to3()); dst.position(offset + BasicHeaderSegment.BYTES_8_11); dst.putInt(serializeBytes8to11()); dst.putInt(serializeBytes12to15()); dst.position(offset + BasicHeaderSegment.BYTES_20_23); dst.putInt(serializeBytes20to23()); dst.putInt(serializeBytes24to27()); dst.putInt(serializeBytes28to31()); dst.putInt(serializeBytes32to35()); dst.putInt(serializeBytes36to39()); dst.putInt(serializeBytes40to43()); dst.putInt(serializeBytes44to47()); }
java
final void serializeBasicHeaderSegment (final ByteBuffer dst, final int offset) throws InternetSCSIException { dst.position(offset); dst.putInt(offset, dst.getInt() | serializeBytes1to3()); dst.position(offset + BasicHeaderSegment.BYTES_8_11); dst.putInt(serializeBytes8to11()); dst.putInt(serializeBytes12to15()); dst.position(offset + BasicHeaderSegment.BYTES_20_23); dst.putInt(serializeBytes20to23()); dst.putInt(serializeBytes24to27()); dst.putInt(serializeBytes28to31()); dst.putInt(serializeBytes32to35()); dst.putInt(serializeBytes36to39()); dst.putInt(serializeBytes40to43()); dst.putInt(serializeBytes44to47()); }
[ "final", "void", "serializeBasicHeaderSegment", "(", "final", "ByteBuffer", "dst", ",", "final", "int", "offset", ")", "throws", "InternetSCSIException", "{", "dst", ".", "position", "(", "offset", ")", ";", "dst", ".", "putInt", "(", "offset", ",", "dst", "...
This method serializes the whole BHS to its byte representation. @param dst The destination <code>ByteBuffer</code> to write to. @param offset The start offset in <code>dst</code>. @throws InternetSCSIException If any violation of the iSCSI-Standard emerge.
[ "This", "method", "serializes", "the", "whole", "BHS", "to", "its", "byte", "representation", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/AbstractMessageParser.java#L112-L129
janus-project/guava.janusproject.io
guava/src/com/google/common/util/concurrent/MoreExecutors.java
MoreExecutors.shutdownAndAwaitTermination
@Beta public static boolean shutdownAndAwaitTermination( ExecutorService service, long timeout, TimeUnit unit) { checkNotNull(unit); // Disable new tasks from being submitted service.shutdown(); try { long halfTimeoutNanos = TimeUnit.NANOSECONDS.convert(timeout, unit) / 2; // Wait for half the duration of the timeout for existing tasks to terminate if (!service.awaitTermination(halfTimeoutNanos, TimeUnit.NANOSECONDS)) { // Cancel currently executing tasks service.shutdownNow(); // Wait the other half of the timeout for tasks to respond to being cancelled service.awaitTermination(halfTimeoutNanos, TimeUnit.NANOSECONDS); } } catch (InterruptedException ie) { // Preserve interrupt status Thread.currentThread().interrupt(); // (Re-)Cancel if current thread also interrupted service.shutdownNow(); } return service.isTerminated(); }
java
@Beta public static boolean shutdownAndAwaitTermination( ExecutorService service, long timeout, TimeUnit unit) { checkNotNull(unit); // Disable new tasks from being submitted service.shutdown(); try { long halfTimeoutNanos = TimeUnit.NANOSECONDS.convert(timeout, unit) / 2; // Wait for half the duration of the timeout for existing tasks to terminate if (!service.awaitTermination(halfTimeoutNanos, TimeUnit.NANOSECONDS)) { // Cancel currently executing tasks service.shutdownNow(); // Wait the other half of the timeout for tasks to respond to being cancelled service.awaitTermination(halfTimeoutNanos, TimeUnit.NANOSECONDS); } } catch (InterruptedException ie) { // Preserve interrupt status Thread.currentThread().interrupt(); // (Re-)Cancel if current thread also interrupted service.shutdownNow(); } return service.isTerminated(); }
[ "@", "Beta", "public", "static", "boolean", "shutdownAndAwaitTermination", "(", "ExecutorService", "service", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "{", "checkNotNull", "(", "unit", ")", ";", "// Disable new tasks from being submitted", "service", ".",...
Shuts down the given executor gradually, first disabling new submissions and later cancelling existing tasks. <p>The method takes the following steps: <ol> <li>calls {@link ExecutorService#shutdown()}, disabling acceptance of new submitted tasks. <li>waits for half of the specified timeout. <li>if the timeout expires, it calls {@link ExecutorService#shutdownNow()}, cancelling pending tasks and interrupting running tasks. <li>waits for the other half of the specified timeout. </ol> <p>If, at any step of the process, the given executor is terminated or the calling thread is interrupted, the method calls {@link ExecutorService#shutdownNow()}, cancelling pending tasks and interrupting running tasks. @param service the {@code ExecutorService} to shut down @param timeout the maximum time to wait for the {@code ExecutorService} to terminate @param unit the time unit of the timeout argument @return {@code true} if the pool was terminated successfully, {@code false} if the {@code ExecutorService} could not terminate <b>or</b> the thread running this method is interrupted while waiting for the {@code ExecutorService} to terminate @since 17.0
[ "Shuts", "down", "the", "given", "executor", "gradually", "first", "disabling", "new", "submissions", "and", "later", "cancelling", "existing", "tasks", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/util/concurrent/MoreExecutors.java#L939-L961
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/http/IdleConnectionReaper.java
IdleConnectionReaper.registerConnectionManager
public static boolean registerConnectionManager(HttpClientConnectionManager connectionManager, long maxIdleInMs) { if (instance == null) { synchronized (IdleConnectionReaper.class) { if (instance == null) { instance = new IdleConnectionReaper(); instance.start(); } } } return connectionManagers.put(connectionManager, maxIdleInMs) == null; }
java
public static boolean registerConnectionManager(HttpClientConnectionManager connectionManager, long maxIdleInMs) { if (instance == null) { synchronized (IdleConnectionReaper.class) { if (instance == null) { instance = new IdleConnectionReaper(); instance.start(); } } } return connectionManagers.put(connectionManager, maxIdleInMs) == null; }
[ "public", "static", "boolean", "registerConnectionManager", "(", "HttpClientConnectionManager", "connectionManager", ",", "long", "maxIdleInMs", ")", "{", "if", "(", "instance", "==", "null", ")", "{", "synchronized", "(", "IdleConnectionReaper", ".", "class", ")", ...
Registers the given connection manager with this reaper; @param connectionManager Connection manager to register @param maxIdleInMs Max idle connection timeout in milliseconds for this connection manager. @return true if the connection manager has been successfully registered; false otherwise.
[ "Registers", "the", "given", "connection", "manager", "with", "this", "reaper", ";" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/http/IdleConnectionReaper.java#L105-L115
Alluxio/alluxio
shell/src/main/java/alluxio/cli/fs/command/CpCommand.java
CpCommand.copyFile
private void copyFile(AlluxioURI srcPath, AlluxioURI dstPath) throws AlluxioException, IOException { try (Closer closer = Closer.create()) { FileInStream is = closer.register(mFileSystem.openFile(srcPath)); FileOutStream os = closer.register(mFileSystem.createFile(dstPath)); try { IOUtils.copy(is, os); } catch (Exception e) { os.cancel(); throw e; } System.out.println(String.format(COPY_SUCCEED_MESSAGE, srcPath, dstPath)); } preserveAttributes(srcPath, dstPath); }
java
private void copyFile(AlluxioURI srcPath, AlluxioURI dstPath) throws AlluxioException, IOException { try (Closer closer = Closer.create()) { FileInStream is = closer.register(mFileSystem.openFile(srcPath)); FileOutStream os = closer.register(mFileSystem.createFile(dstPath)); try { IOUtils.copy(is, os); } catch (Exception e) { os.cancel(); throw e; } System.out.println(String.format(COPY_SUCCEED_MESSAGE, srcPath, dstPath)); } preserveAttributes(srcPath, dstPath); }
[ "private", "void", "copyFile", "(", "AlluxioURI", "srcPath", ",", "AlluxioURI", "dstPath", ")", "throws", "AlluxioException", ",", "IOException", "{", "try", "(", "Closer", "closer", "=", "Closer", ".", "create", "(", ")", ")", "{", "FileInStream", "is", "="...
Copies a file in the Alluxio filesystem. @param srcPath the source {@link AlluxioURI} (has to be a file) @param dstPath the destination path in the Alluxio filesystem
[ "Copies", "a", "file", "in", "the", "Alluxio", "filesystem", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/fs/command/CpCommand.java#L535-L549
httl/httl
httl/src/main/java/httl/util/ConcurrentLinkedHashMap.java
ConcurrentLinkedHashMap.moveTasksFromBuffer
int moveTasksFromBuffer(Task[] tasks, int bufferIndex) { // While a buffer is being drained it may be concurrently appended to. // The // number of tasks removed are tracked so that the length can be // decremented // by the delta rather than set to zero. Queue<Task> buffer = buffers[bufferIndex]; int removedFromBuffer = 0; Task task; int maxIndex = -1; while ((task = buffer.poll()) != null) { removedFromBuffer++; // The index into the output array is determined by calculating the // offset // since the last drain int index = task.getOrder() - drainedOrder; if (index < 0) { // The task was missed by the last drain and can be run // immediately task.run(); } else if (index >= tasks.length) { // Due to concurrent additions, the order exceeds the capacity // of the // output array. It is added to the end as overflow and the // remaining // tasks in the buffer will be handled by the next drain. maxIndex = tasks.length - 1; addTaskToChain(tasks, task, maxIndex); break; } else { // Add the task to the array so that it is run in sequence maxIndex = Math.max(index, maxIndex); addTaskToChain(tasks, task, index); } } bufferLengths.addAndGet(bufferIndex, -removedFromBuffer); return maxIndex; }
java
int moveTasksFromBuffer(Task[] tasks, int bufferIndex) { // While a buffer is being drained it may be concurrently appended to. // The // number of tasks removed are tracked so that the length can be // decremented // by the delta rather than set to zero. Queue<Task> buffer = buffers[bufferIndex]; int removedFromBuffer = 0; Task task; int maxIndex = -1; while ((task = buffer.poll()) != null) { removedFromBuffer++; // The index into the output array is determined by calculating the // offset // since the last drain int index = task.getOrder() - drainedOrder; if (index < 0) { // The task was missed by the last drain and can be run // immediately task.run(); } else if (index >= tasks.length) { // Due to concurrent additions, the order exceeds the capacity // of the // output array. It is added to the end as overflow and the // remaining // tasks in the buffer will be handled by the next drain. maxIndex = tasks.length - 1; addTaskToChain(tasks, task, maxIndex); break; } else { // Add the task to the array so that it is run in sequence maxIndex = Math.max(index, maxIndex); addTaskToChain(tasks, task, index); } } bufferLengths.addAndGet(bufferIndex, -removedFromBuffer); return maxIndex; }
[ "int", "moveTasksFromBuffer", "(", "Task", "[", "]", "tasks", ",", "int", "bufferIndex", ")", "{", "// While a buffer is being drained it may be concurrently appended to.", "// The", "// number of tasks removed are tracked so that the length can be", "// decremented", "// by the delt...
Moves the tasks from the specified buffer into the output array. @param tasks the ordered array of the pending operations @param bufferIndex the buffer to drain into the tasks array @return the highest index location of a task that was added to the array
[ "Moves", "the", "tasks", "from", "the", "specified", "buffer", "into", "the", "output", "array", "." ]
train
https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/util/ConcurrentLinkedHashMap.java#L463-L502
EdwardRaff/JSAT
JSAT/src/jsat/text/ClassificationHashedTextDataLoader.java
ClassificationHashedTextDataLoader.addOriginalDocument
protected int addOriginalDocument(String text, int label) { if(label >= labelInfo.getNumOfCategories()) throw new RuntimeException("Invalid label given"); int index = super.addOriginalDocument(text); synchronized(classLabels) { while(classLabels.size() < index) classLabels.add(-1); if(classLabels.size() == index)//we are where we expect classLabels.add(label); else//another thread beat us to the addition classLabels.set(index, label); } return index; }
java
protected int addOriginalDocument(String text, int label) { if(label >= labelInfo.getNumOfCategories()) throw new RuntimeException("Invalid label given"); int index = super.addOriginalDocument(text); synchronized(classLabels) { while(classLabels.size() < index) classLabels.add(-1); if(classLabels.size() == index)//we are where we expect classLabels.add(label); else//another thread beat us to the addition classLabels.set(index, label); } return index; }
[ "protected", "int", "addOriginalDocument", "(", "String", "text", ",", "int", "label", ")", "{", "if", "(", "label", ">=", "labelInfo", ".", "getNumOfCategories", "(", ")", ")", "throw", "new", "RuntimeException", "(", "\"Invalid label given\"", ")", ";", "int...
To be called by the {@link #initialLoad() } method. It will take in the text and add a new document vector to the data set. Once all text documents have been loaded, this method should never be called again. <br> This method is thread safe. @param text the text of the document to add @param label the classification label for this document @return the index of the created document for the given text. Starts from zero and counts up.
[ "To", "be", "called", "by", "the", "{", "@link", "#initialLoad", "()", "}", "method", ".", "It", "will", "take", "in", "the", "text", "and", "add", "a", "new", "document", "vector", "to", "the", "data", "set", ".", "Once", "all", "text", "documents", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/text/ClassificationHashedTextDataLoader.java#L101-L116
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java
MetadataCache.getCacheFormatEntry
private String getCacheFormatEntry() throws IOException { ZipEntry zipEntry = zipFile.getEntry(CACHE_FORMAT_ENTRY); InputStream is = zipFile.getInputStream(zipEntry); try { Scanner s = new Scanner(is, "UTF-8").useDelimiter("\\A"); String tag = null; if (s.hasNext()) tag = s.next(); return tag; } finally { is.close(); } }
java
private String getCacheFormatEntry() throws IOException { ZipEntry zipEntry = zipFile.getEntry(CACHE_FORMAT_ENTRY); InputStream is = zipFile.getInputStream(zipEntry); try { Scanner s = new Scanner(is, "UTF-8").useDelimiter("\\A"); String tag = null; if (s.hasNext()) tag = s.next(); return tag; } finally { is.close(); } }
[ "private", "String", "getCacheFormatEntry", "(", ")", "throws", "IOException", "{", "ZipEntry", "zipEntry", "=", "zipFile", ".", "getEntry", "(", "CACHE_FORMAT_ENTRY", ")", ";", "InputStream", "is", "=", "zipFile", ".", "getInputStream", "(", "zipEntry", ")", ";...
Find and read the cache format entry in a metadata cache file. @return the content of the format entry, or {@code null} if none was found @throws IOException if there is a problem reading the file
[ "Find", "and", "read", "the", "cache", "format", "entry", "in", "a", "metadata", "cache", "file", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/MetadataCache.java#L454-L465
JDBDT/jdbdt
src/main/java/org/jdbdt/DB.java
DB.logQuery
void logQuery(CallInfo callInfo, DataSet data) { if (isEnabled(Option.LOG_QUERIES)) { log.write(callInfo, data); } }
java
void logQuery(CallInfo callInfo, DataSet data) { if (isEnabled(Option.LOG_QUERIES)) { log.write(callInfo, data); } }
[ "void", "logQuery", "(", "CallInfo", "callInfo", ",", "DataSet", "data", ")", "{", "if", "(", "isEnabled", "(", "Option", ".", "LOG_QUERIES", ")", ")", "{", "log", ".", "write", "(", "callInfo", ",", "data", ")", ";", "}", "}" ]
Log query result. @param callInfo Call info. @param data Data set.
[ "Log", "query", "result", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DB.java#L468-L472
FlyingHe/UtilsMaven
src/main/java/com/github/flyinghe/tools/JDBCUtils.java
JDBCUtils.release
public static void release(Statement statement, Connection connection) { if (statement != null) { try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connection != null) { JDBCUtils.release(connection); } }
java
public static void release(Statement statement, Connection connection) { if (statement != null) { try { statement.close(); } catch (SQLException e) { e.printStackTrace(); } } if (connection != null) { JDBCUtils.release(connection); } }
[ "public", "static", "void", "release", "(", "Statement", "statement", ",", "Connection", "connection", ")", "{", "if", "(", "statement", "!=", "null", ")", "{", "try", "{", "statement", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "e",...
关闭与数据库的连接资源,包括‘Statement’‘Connection’ 的实例对象所占用的资源,注意顺序不能颠倒 @param statement 执行SQL语句的Statement对象 @param connection 连接数据库的连接对象
[ "关闭与数据库的连接资源,包括‘Statement’‘Connection’", "的实例对象所占用的资源,注意顺序不能颠倒" ]
train
https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/JDBCUtils.java#L234-L247
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java
Transform1D.setTranslation
@Inline(value = "setTranslation($1, null, $2)") public void setTranslation(List<? extends S> path, Tuple2D<?> position) { setTranslation(path, null, position); }
java
@Inline(value = "setTranslation($1, null, $2)") public void setTranslation(List<? extends S> path, Tuple2D<?> position) { setTranslation(path, null, position); }
[ "@", "Inline", "(", "value", "=", "\"setTranslation($1, null, $2)\"", ")", "public", "void", "setTranslation", "(", "List", "<", "?", "extends", "S", ">", "path", ",", "Tuple2D", "<", "?", ">", "position", ")", "{", "setTranslation", "(", "path", ",", "nul...
Set the position. <p>If the given <var>path</var> contains only one segment, the transformation will follow the segment's direction. @param path the path to follow. @param position where <code>x</code> is the curviline coordinate and <code>y</code> is the shift coordinate.
[ "Set", "the", "position", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java#L341-L344
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listClosedListsAsync
public Observable<List<ClosedListEntityExtractor>> listClosedListsAsync(UUID appId, String versionId, ListClosedListsOptionalParameter listClosedListsOptionalParameter) { return listClosedListsWithServiceResponseAsync(appId, versionId, listClosedListsOptionalParameter).map(new Func1<ServiceResponse<List<ClosedListEntityExtractor>>, List<ClosedListEntityExtractor>>() { @Override public List<ClosedListEntityExtractor> call(ServiceResponse<List<ClosedListEntityExtractor>> response) { return response.body(); } }); }
java
public Observable<List<ClosedListEntityExtractor>> listClosedListsAsync(UUID appId, String versionId, ListClosedListsOptionalParameter listClosedListsOptionalParameter) { return listClosedListsWithServiceResponseAsync(appId, versionId, listClosedListsOptionalParameter).map(new Func1<ServiceResponse<List<ClosedListEntityExtractor>>, List<ClosedListEntityExtractor>>() { @Override public List<ClosedListEntityExtractor> call(ServiceResponse<List<ClosedListEntityExtractor>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ClosedListEntityExtractor", ">", ">", "listClosedListsAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListClosedListsOptionalParameter", "listClosedListsOptionalParameter", ")", "{", "return", "listClosedListsWithSe...
Gets information about the closedlist models. @param appId The application ID. @param versionId The version ID. @param listClosedListsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ClosedListEntityExtractor&gt; object
[ "Gets", "information", "about", "the", "closedlist", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1848-L1855
OpenLiberty/open-liberty
dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLog.java
FileLog.getPrintStream
private synchronized PrintStream getPrintStream(long numNewChars, String header) { switch (currentStatus) { case INIT: return createStream(header); case ACTIVE: if (maxFileSizeBytes > 0) { long bytesWritten = currentCountingStream.count(); // Replace the stream if the size is or will likely be // exceeded. We're estimating one byte per char, which is // only accurate for single-byte character sets. That's // fine: if a multi-byte character set is being used and // we underestimate the number of bytes that will be // written, we'll roll the log next time if (bytesWritten + numNewChars > maxFileSizeBytes) { return createStream(header); } } break; } return currentPrintStream; }
java
private synchronized PrintStream getPrintStream(long numNewChars, String header) { switch (currentStatus) { case INIT: return createStream(header); case ACTIVE: if (maxFileSizeBytes > 0) { long bytesWritten = currentCountingStream.count(); // Replace the stream if the size is or will likely be // exceeded. We're estimating one byte per char, which is // only accurate for single-byte character sets. That's // fine: if a multi-byte character set is being used and // we underestimate the number of bytes that will be // written, we'll roll the log next time if (bytesWritten + numNewChars > maxFileSizeBytes) { return createStream(header); } } break; } return currentPrintStream; }
[ "private", "synchronized", "PrintStream", "getPrintStream", "(", "long", "numNewChars", ",", "String", "header", ")", "{", "switch", "(", "currentStatus", ")", "{", "case", "INIT", ":", "return", "createStream", "(", "header", ")", ";", "case", "ACTIVE", ":", ...
Obtain the current printstream: called from synchronized methods @param requiredLength @return
[ "Obtain", "the", "current", "printstream", ":", "called", "from", "synchronized", "methods" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.file/src/com/ibm/ws/security/audit/logutils/FileLog.java#L240-L263
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java
AttributeDefinition.correctValue
protected final ModelNode correctValue(final ModelNode newValue, final ModelNode oldValue) { if (valueCorrector != null) { return valueCorrector.correct(newValue, oldValue); } return newValue; }
java
protected final ModelNode correctValue(final ModelNode newValue, final ModelNode oldValue) { if (valueCorrector != null) { return valueCorrector.correct(newValue, oldValue); } return newValue; }
[ "protected", "final", "ModelNode", "correctValue", "(", "final", "ModelNode", "newValue", ",", "final", "ModelNode", "oldValue", ")", "{", "if", "(", "valueCorrector", "!=", "null", ")", "{", "return", "valueCorrector", ".", "correct", "(", "newValue", ",", "o...
Corrects the value if the {@link ParameterCorrector value corrector} is not {@code null}. If the {@link ParameterCorrector value corrector} is {@code null}, the {@code newValue} parameter is returned. @param newValue the new value. @param oldValue the old value. @return the corrected value or the {@code newValue} if the {@link ParameterCorrector value corrector} is {@code null}.
[ "Corrects", "the", "value", "if", "the", "{", "@link", "ParameterCorrector", "value", "corrector", "}", "is", "not", "{", "@code", "null", "}", ".", "If", "the", "{", "@link", "ParameterCorrector", "value", "corrector", "}", "is", "{", "@code", "null", "}"...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L1162-L1167
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyInfo.java
PropertyInfo.setPropertyValue
public void setPropertyValue(Object instance, Object value, boolean forceDirect) { try { if (!forceDirect && instance instanceof IPropertyAccessor) { ((IPropertyAccessor) instance).setPropertyValue(this, value); return; } Method method = null; try { method = PropertyUtil.findSetter(setter, instance, value == null ? null : value.getClass()); } catch (Exception e) { if (value != null) { PropertySerializer<?> serializer = getPropertyType().getSerializer(); value = value instanceof String ? serializer.deserialize((String) value) : serializer.serialize(value); method = PropertyUtil.findSetter(setter, instance, value.getClass()); } else { throw e; } } if (method != null) { method.invoke(instance, value); } } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
java
public void setPropertyValue(Object instance, Object value, boolean forceDirect) { try { if (!forceDirect && instance instanceof IPropertyAccessor) { ((IPropertyAccessor) instance).setPropertyValue(this, value); return; } Method method = null; try { method = PropertyUtil.findSetter(setter, instance, value == null ? null : value.getClass()); } catch (Exception e) { if (value != null) { PropertySerializer<?> serializer = getPropertyType().getSerializer(); value = value instanceof String ? serializer.deserialize((String) value) : serializer.serialize(value); method = PropertyUtil.findSetter(setter, instance, value.getClass()); } else { throw e; } } if (method != null) { method.invoke(instance, value); } } catch (Exception e) { throw MiscUtil.toUnchecked(e); } }
[ "public", "void", "setPropertyValue", "(", "Object", "instance", ",", "Object", "value", ",", "boolean", "forceDirect", ")", "{", "try", "{", "if", "(", "!", "forceDirect", "&&", "instance", "instanceof", "IPropertyAccessor", ")", "{", "(", "(", "IPropertyAcce...
Sets the property value for a specified object instance. @param instance The object instance. @param value The value to assign. @param forceDirect If true, a forces a direct write to the instance even if it implements IPropertyAccessor
[ "Sets", "the", "property", "value", "for", "a", "specified", "object", "instance", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyInfo.java#L223-L250
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractSuperTypeSelectionDialog.java
AbstractSuperTypeSelectionDialog.createSearchScope
public static IJavaSearchScope createSearchScope(IJavaProject project, Class<?> type, boolean onlySubTypes) { try { final IType superType = project.findType(type.getName()); return SearchEngine.createStrictHierarchyScope( project, superType, // only sub types onlySubTypes, // include the type true, null); } catch (JavaModelException e) { SARLEclipsePlugin.getDefault().log(e); } return SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); }
java
public static IJavaSearchScope createSearchScope(IJavaProject project, Class<?> type, boolean onlySubTypes) { try { final IType superType = project.findType(type.getName()); return SearchEngine.createStrictHierarchyScope( project, superType, // only sub types onlySubTypes, // include the type true, null); } catch (JavaModelException e) { SARLEclipsePlugin.getDefault().log(e); } return SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); }
[ "public", "static", "IJavaSearchScope", "createSearchScope", "(", "IJavaProject", "project", ",", "Class", "<", "?", ">", "type", ",", "boolean", "onlySubTypes", ")", "{", "try", "{", "final", "IType", "superType", "=", "project", ".", "findType", "(", "type",...
Creates a searching scope including only one project. @param project the scope of the search. @param type the expected super type. @param onlySubTypes indicates if only the subtypes of the given types are allowed. If <code>false</code>, the super type is allowed too. @return the search scope.
[ "Creates", "a", "searching", "scope", "including", "only", "one", "project", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractSuperTypeSelectionDialog.java#L99-L114
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/TriangleListing.java
TriangleListing.runInternal
@Override public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input) throws Exception { // u, v, bitmask where u < v DataSet<Tuple3<K, K, ByteValue>> filteredByID = input .getEdges() .map(new OrderByID<>()) .setParallelism(parallelism) .name("Order by ID") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by ID"); // u, v, (deg(u), deg(v)) DataSet<Edge<K, Tuple3<EV, Degrees, Degrees>>> pairDegrees = input .run(new EdgeDegreesPair<K, VV, EV>() .setParallelism(parallelism)); // u, v, bitmask where deg(u) < deg(v) or (deg(u) == deg(v) and u < v) DataSet<Tuple3<K, K, ByteValue>> filteredByDegree = pairDegrees .map(new OrderByDegree<>()) .setParallelism(parallelism) .name("Order by degree") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by degree"); // u, v, w, bitmask where (u, v) and (u, w) are edges in graph DataSet<Tuple4<K, K, K, ByteValue>> triplets = filteredByDegree .groupBy(0) .sortGroup(1, Order.ASCENDING) .reduceGroup(new GenerateTriplets<>()) .name("Generate triplets"); // u, v, w, bitmask where (u, v), (u, w), and (v, w) are edges in graph DataSet<Result<K>> triangles = triplets .join(filteredByID, JoinOperatorBase.JoinHint.REPARTITION_HASH_SECOND) .where(1, 2) .equalTo(0, 1) .with(new ProjectTriangles<>()) .name("Triangle listing"); if (permuteResults) { triangles = triangles .flatMap(new PermuteResult<>()) .name("Permute triangle vertices"); } else if (sortTriangleVertices.get()) { triangles = triangles .map(new SortTriangleVertices<>()) .name("Sort triangle vertices"); } return triangles; }
java
@Override public DataSet<Result<K>> runInternal(Graph<K, VV, EV> input) throws Exception { // u, v, bitmask where u < v DataSet<Tuple3<K, K, ByteValue>> filteredByID = input .getEdges() .map(new OrderByID<>()) .setParallelism(parallelism) .name("Order by ID") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by ID"); // u, v, (deg(u), deg(v)) DataSet<Edge<K, Tuple3<EV, Degrees, Degrees>>> pairDegrees = input .run(new EdgeDegreesPair<K, VV, EV>() .setParallelism(parallelism)); // u, v, bitmask where deg(u) < deg(v) or (deg(u) == deg(v) and u < v) DataSet<Tuple3<K, K, ByteValue>> filteredByDegree = pairDegrees .map(new OrderByDegree<>()) .setParallelism(parallelism) .name("Order by degree") .groupBy(0, 1) .reduceGroup(new ReduceBitmask<>()) .setParallelism(parallelism) .name("Flatten by degree"); // u, v, w, bitmask where (u, v) and (u, w) are edges in graph DataSet<Tuple4<K, K, K, ByteValue>> triplets = filteredByDegree .groupBy(0) .sortGroup(1, Order.ASCENDING) .reduceGroup(new GenerateTriplets<>()) .name("Generate triplets"); // u, v, w, bitmask where (u, v), (u, w), and (v, w) are edges in graph DataSet<Result<K>> triangles = triplets .join(filteredByID, JoinOperatorBase.JoinHint.REPARTITION_HASH_SECOND) .where(1, 2) .equalTo(0, 1) .with(new ProjectTriangles<>()) .name("Triangle listing"); if (permuteResults) { triangles = triangles .flatMap(new PermuteResult<>()) .name("Permute triangle vertices"); } else if (sortTriangleVertices.get()) { triangles = triangles .map(new SortTriangleVertices<>()) .name("Sort triangle vertices"); } return triangles; }
[ "@", "Override", "public", "DataSet", "<", "Result", "<", "K", ">", ">", "runInternal", "(", "Graph", "<", "K", ",", "VV", ",", "EV", ">", "input", ")", "throws", "Exception", "{", "// u, v, bitmask where u < v", "DataSet", "<", "Tuple3", "<", "K", ",", ...
/* Implementation notes: The requirement that "K extends CopyableValue<K>" can be removed when Flink has a self-join and GenerateTriplets is implemented as such. ProjectTriangles should eventually be replaced by ".projectFirst("*")" when projections use code generation.
[ "/", "*", "Implementation", "notes", ":" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/TriangleListing.java#L81-L136
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/LocalDocumentStore.java
LocalDocumentStore.performOnEachDocument
public DocumentOperationResults performOnEachDocument( BiFunction<String, EditableDocument, Boolean> operation ) { DocumentOperationResults results = new DocumentOperationResults(); database.keys().forEach(key -> runInTransaction(() -> { // We operate upon each document within a transaction ... try { EditableDocument doc = edit(key, false); if (doc != null) { if (operation.apply(key, doc)) { results.recordModified(); } else { results.recordUnmodified(); } } } catch (Throwable t) { results.recordFailure(); } return null; }, 1, key)); return results; }
java
public DocumentOperationResults performOnEachDocument( BiFunction<String, EditableDocument, Boolean> operation ) { DocumentOperationResults results = new DocumentOperationResults(); database.keys().forEach(key -> runInTransaction(() -> { // We operate upon each document within a transaction ... try { EditableDocument doc = edit(key, false); if (doc != null) { if (operation.apply(key, doc)) { results.recordModified(); } else { results.recordUnmodified(); } } } catch (Throwable t) { results.recordFailure(); } return null; }, 1, key)); return results; }
[ "public", "DocumentOperationResults", "performOnEachDocument", "(", "BiFunction", "<", "String", ",", "EditableDocument", ",", "Boolean", ">", "operation", ")", "{", "DocumentOperationResults", "results", "=", "new", "DocumentOperationResults", "(", ")", ";", "database"...
Perform the supplied operation on each stored document that is accessible within this process. Each document will be operated upon in a separate transaction, which will be committed if the operation is successful or rolledback if the operation cannot be complete successfully. <p> Generally, this method executes the operation upon all documents. If there is an error processing a single document, that document is skipped and the execution will continue with the next document(s). However, if there is an exception with the transactions or another system failure, this method will terminate with an exception. @param operation the operation to be performed @return the summary of the number of documents that were affected
[ "Perform", "the", "supplied", "operation", "on", "each", "stored", "document", "that", "is", "accessible", "within", "this", "process", ".", "Each", "document", "will", "be", "operated", "upon", "in", "a", "separate", "transaction", "which", "will", "be", "com...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/LocalDocumentStore.java#L249-L269
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TFIDF.java
TFIDF.prepare
public StringWrapper prepare(String s) { lastVector = new UnitVector(s, tokenizer.tokenize(s)); return lastVector; }
java
public StringWrapper prepare(String s) { lastVector = new UnitVector(s, tokenizer.tokenize(s)); return lastVector; }
[ "public", "StringWrapper", "prepare", "(", "String", "s", ")", "{", "lastVector", "=", "new", "UnitVector", "(", "s", ",", "tokenizer", ".", "tokenize", "(", "s", ")", ")", ";", "return", "lastVector", ";", "}" ]
Preprocess a string by finding tokens and giving them TFIDF weights
[ "Preprocess", "a", "string", "by", "finding", "tokens", "and", "giving", "them", "TFIDF", "weights" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TFIDF.java#L39-L42
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java
HttpComponentsClientHttpRequestFactory.createHttpUriRequest
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) { switch (httpMethod) { case GET: return new HttpGetHC4(uri); case DELETE: return new HttpDeleteHC4(uri); case HEAD: return new HttpHeadHC4(uri); case OPTIONS: return new HttpOptionsHC4(uri); case POST: return new HttpPostHC4(uri); case PUT: return new HttpPutHC4(uri); case TRACE: return new HttpTraceHC4(uri); case PATCH: return new HttpPatch(uri); default: throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod); } }
java
protected HttpUriRequest createHttpUriRequest(HttpMethod httpMethod, URI uri) { switch (httpMethod) { case GET: return new HttpGetHC4(uri); case DELETE: return new HttpDeleteHC4(uri); case HEAD: return new HttpHeadHC4(uri); case OPTIONS: return new HttpOptionsHC4(uri); case POST: return new HttpPostHC4(uri); case PUT: return new HttpPutHC4(uri); case TRACE: return new HttpTraceHC4(uri); case PATCH: return new HttpPatch(uri); default: throw new IllegalArgumentException("Invalid HTTP method: " + httpMethod); } }
[ "protected", "HttpUriRequest", "createHttpUriRequest", "(", "HttpMethod", "httpMethod", ",", "URI", "uri", ")", "{", "switch", "(", "httpMethod", ")", "{", "case", "GET", ":", "return", "new", "HttpGetHC4", "(", "uri", ")", ";", "case", "DELETE", ":", "retur...
Create a Commons HttpMethodBase object for the given HTTP method and URI specification. @param httpMethod the HTTP method @param uri the URI @return the Commons HttpMethodBase object
[ "Create", "a", "Commons", "HttpMethodBase", "object", "for", "the", "given", "HTTP", "method", "and", "URI", "specification", "." ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java#L226-L247
TrueNight/Utils
android-utils/src/main/java/xyz/truenight/utils/PermissionRequest.java
PermissionRequest.getPermission
public static void getPermission(@NonNull Activity context, @NonNull String[] permissions, @NonNull Response response) { if (Build.VERSION.SDK_INT < 23) { response.permissionGranted(); } else { HashSet<String> permissionSet = new HashSet<>(); for (String permission : permissions) if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { permissionSet.add(permission); } if (permissionSet.size() > 0) { int id = 42167; while (map.containsKey(id)) id = random.nextInt(Short.MAX_VALUE * 2); map.put(id, new ResponseWrapper(response, permissions)); context.requestPermissions(permissionSet.toArray(new String[permissionSet.size()]), id); } else { response.permissionGranted(); } } }
java
public static void getPermission(@NonNull Activity context, @NonNull String[] permissions, @NonNull Response response) { if (Build.VERSION.SDK_INT < 23) { response.permissionGranted(); } else { HashSet<String> permissionSet = new HashSet<>(); for (String permission : permissions) if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) { permissionSet.add(permission); } if (permissionSet.size() > 0) { int id = 42167; while (map.containsKey(id)) id = random.nextInt(Short.MAX_VALUE * 2); map.put(id, new ResponseWrapper(response, permissions)); context.requestPermissions(permissionSet.toArray(new String[permissionSet.size()]), id); } else { response.permissionGranted(); } } }
[ "public", "static", "void", "getPermission", "(", "@", "NonNull", "Activity", "context", ",", "@", "NonNull", "String", "[", "]", "permissions", ",", "@", "NonNull", "Response", "response", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", "<",...
Request Android Permissions. @param context The Context of the Activity or the Fragment. @param permissions The Permissions you are need. @param response Result callback.
[ "Request", "Android", "Permissions", "." ]
train
https://github.com/TrueNight/Utils/blob/78a11faa16258b09f08826797370310ab650530c/android-utils/src/main/java/xyz/truenight/utils/PermissionRequest.java#L137-L161
baratine/baratine
kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java
UpgradeScanner10.openRead
private ReadStream openRead(long address, int size) { InStore inStore = _store.openRead(address, size); InStoreStream is = new InStoreStream(inStore, address, address + size); return new ReadStream(new VfsStream(is)); }
java
private ReadStream openRead(long address, int size) { InStore inStore = _store.openRead(address, size); InStoreStream is = new InStoreStream(inStore, address, address + size); return new ReadStream(new VfsStream(is)); }
[ "private", "ReadStream", "openRead", "(", "long", "address", ",", "int", "size", ")", "{", "InStore", "inStore", "=", "_store", ".", "openRead", "(", "address", ",", "size", ")", ";", "InStoreStream", "is", "=", "new", "InStoreStream", "(", "inStore", ",",...
Open a read stream to a segment. @param address file address for the segment @param size length of the segment @return opened ReadStream
[ "Open", "a", "read", "stream", "to", "a", "segment", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/kraken/src/main/java/com/caucho/v5/kelp/upgrade/UpgradeScanner10.java#L740-L747
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/interfaces/SubnetMatchInterfaceCriteria.java
SubnetMatchInterfaceCriteria.isAcceptable
@Override protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException { return verifyAddressByMask(address.getAddress()) ? address : null; }
java
@Override protected InetAddress isAcceptable(NetworkInterface networkInterface, InetAddress address) throws SocketException { return verifyAddressByMask(address.getAddress()) ? address : null; }
[ "@", "Override", "protected", "InetAddress", "isAcceptable", "(", "NetworkInterface", "networkInterface", ",", "InetAddress", "address", ")", "throws", "SocketException", "{", "return", "verifyAddressByMask", "(", "address", ".", "getAddress", "(", ")", ")", "?", "a...
{@inheritDoc} @return <code>address</code> if the <code>address</code> is on the correct subnet.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/interfaces/SubnetMatchInterfaceCriteria.java#L70-L73