method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public Timestamp getDateEntered() { return (Timestamp) get(2); }
Timestamp function() { return (Timestamp) get(2); }
/** * Getter for <code>sugarcrm_4_12.releases.date_entered</code>. */
Getter for <code>sugarcrm_4_12.releases.date_entered</code>
getDateEntered
{ "repo_name": "SmartMedicalServices/SpringJOOQ", "path": "src/main/java/com/sms/sis/db/tables/records/ReleasesRecord.java", "license": "gpl-3.0", "size": 9566 }
[ "java.sql.Timestamp" ]
import java.sql.Timestamp;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,975,895
private GeofencingRequest getGeofencingRequest() { GeofencingRequest.Builder builder = new GeofencingRequest.Builder(); // The INITIAL_TRIGGER_ENTER flag indicates that geofencing service should trigger a // GEOFENCE_TRANSITION_ENTER notification when the geofence is added and if the device // is already inside that geofence. builder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER); // Add the geofences to be monitored by geofencing service. builder.addGeofences(mGeofenceList); // Return a GeofencingRequest. return builder.build(); }
GeofencingRequest function() { GeofencingRequest.Builder builder = new GeofencingRequest.Builder(); builder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER); builder.addGeofences(mGeofenceList); return builder.build(); }
/** * Builds and returns a GeofencingRequest. Specifies the list of geofences to be monitored. * Also specifies how the geofence notifications are initially triggered. */
Builds and returns a GeofencingRequest. Specifies the list of geofences to be monitored. Also specifies how the geofence notifications are initially triggered
getGeofencingRequest
{ "repo_name": "grizzlysmit/android-play-location", "path": "Geofencing/app/src/main/java/com/google/android/gms/location/sample/geofencing/MainActivity.java", "license": "apache-2.0", "size": 13828 }
[ "com.google.android.gms.location.GeofencingRequest" ]
import com.google.android.gms.location.GeofencingRequest;
import com.google.android.gms.location.*;
[ "com.google.android" ]
com.google.android;
1,886,986
public static final synchronized InternalCache basicGetCache() { return cache; }
static final synchronized InternalCache function() { return cache; }
/** * Return current cache without creating one. */
Return current cache without creating one
basicGetCache
{ "repo_name": "PurelyApplied/geode", "path": "geode-dunit/src/main/java/org/apache/geode/test/dunit/cache/internal/JUnit4CacheTestCase.java", "license": "apache-2.0", "size": 18299 }
[ "org.apache.geode.internal.cache.InternalCache" ]
import org.apache.geode.internal.cache.InternalCache;
import org.apache.geode.internal.cache.*;
[ "org.apache.geode" ]
org.apache.geode;
248,754
protected List<Path> flushCache(final long logCacheFlushId, MemStoreSnapshot snapshot, MonitoredTask status) throws IOException { // If an exception happens flushing, we let it out without clearing // the memstore snapshot. The old snapshot will be returned when we say // 'snapshot', the next time flush comes around. // Retry after catching exception when flushing, otherwise server will abort // itself StoreFlusher flusher = storeEngine.getStoreFlusher(); IOException lastException = null; for (int i = 0; i < flushRetriesNumber; i++) { try { List<Path> pathNames = flusher.flushSnapshot(snapshot, logCacheFlushId, status); Path lastPathName = null; try { for (Path pathName : pathNames) { lastPathName = pathName; validateStoreFile(pathName); } return pathNames; } catch (Exception e) { LOG.warn("Failed validating store file " + lastPathName + ", retrying num=" + i, e); if (e instanceof IOException) { lastException = (IOException) e; } else { lastException = new IOException(e); } } } catch (IOException e) { LOG.warn("Failed flushing store file, retrying num=" + i, e); lastException = e; } if (lastException != null && i < (flushRetriesNumber - 1)) { try { Thread.sleep(pauseTime); } catch (InterruptedException e) { IOException iie = new InterruptedIOException(); iie.initCause(e); throw iie; } } } throw lastException; }
List<Path> function(final long logCacheFlushId, MemStoreSnapshot snapshot, MonitoredTask status) throws IOException { StoreFlusher flusher = storeEngine.getStoreFlusher(); IOException lastException = null; for (int i = 0; i < flushRetriesNumber; i++) { try { List<Path> pathNames = flusher.flushSnapshot(snapshot, logCacheFlushId, status); Path lastPathName = null; try { for (Path pathName : pathNames) { lastPathName = pathName; validateStoreFile(pathName); } return pathNames; } catch (Exception e) { LOG.warn(STR + lastPathName + STR + i, e); if (e instanceof IOException) { lastException = (IOException) e; } else { lastException = new IOException(e); } } } catch (IOException e) { LOG.warn(STR + i, e); lastException = e; } if (lastException != null && i < (flushRetriesNumber - 1)) { try { Thread.sleep(pauseTime); } catch (InterruptedException e) { IOException iie = new InterruptedIOException(); iie.initCause(e); throw iie; } } } throw lastException; }
/** * Write out current snapshot. Presumes {@link #snapshot()} has been called * previously. * @param logCacheFlushId flush sequence number * @param snapshot * @param status * @return The path name of the tmp file to which the store was flushed * @throws IOException */
Write out current snapshot. Presumes <code>#snapshot()</code> has been called previously
flushCache
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java", "license": "apache-2.0", "size": 89623 }
[ "java.io.IOException", "java.io.InterruptedIOException", "java.util.List", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.monitoring.MonitoredTask" ]
import java.io.IOException; import java.io.InterruptedIOException; import java.util.List; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.monitoring.MonitoredTask;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.monitoring.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
133,518
public static PomPackage init() { if (isInited) return (PomPackage)EPackage.Registry.INSTANCE.getEPackage(PomPackage.eNS_URI); // Obtain or create and register package Object registeredPomPackage = EPackage.Registry.INSTANCE.get(eNS_URI); PomPackageImpl thePomPackage = registeredPomPackage instanceof PomPackageImpl ? (PomPackageImpl)registeredPomPackage : new PomPackageImpl(); isInited = true; // Initialize simple dependencies XMLTypePackage.eINSTANCE.eClass(); // Create package meta-data objects thePomPackage.createPackageContents(); // Initialize created meta-data thePomPackage.initializePackageContents(); // Mark meta-data to indicate it can't be changed thePomPackage.freeze(); // Update the registry and return the package EPackage.Registry.INSTANCE.put(PomPackage.eNS_URI, thePomPackage); return thePomPackage; }
static PomPackage function() { if (isInited) return (PomPackage)EPackage.Registry.INSTANCE.getEPackage(PomPackage.eNS_URI); Object registeredPomPackage = EPackage.Registry.INSTANCE.get(eNS_URI); PomPackageImpl thePomPackage = registeredPomPackage instanceof PomPackageImpl ? (PomPackageImpl)registeredPomPackage : new PomPackageImpl(); isInited = true; XMLTypePackage.eINSTANCE.eClass(); thePomPackage.createPackageContents(); thePomPackage.initializePackageContents(); thePomPackage.freeze(); EPackage.Registry.INSTANCE.put(PomPackage.eNS_URI, thePomPackage); return thePomPackage; }
/** * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. * * <p>This method is used to initialize {@link PomPackage#eINSTANCE} when that field is accessed. * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI * @see #createPackageContents() * @see #initializePackageContents() * @generated */
Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>PomPackage#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
init
{ "repo_name": "Treehopper/EclipseAugments", "path": "pom-editor/eu.hohenegger.xsd.pom/src-gen/eu/hohenegger/xsd/pom/impl/PomPackageImpl.java", "license": "epl-1.0", "size": 250225 }
[ "eu.hohenegger.xsd.pom.PomPackage", "org.eclipse.emf.ecore.EPackage", "org.eclipse.emf.ecore.xml.type.XMLTypePackage" ]
import eu.hohenegger.xsd.pom.PomPackage; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
import eu.hohenegger.xsd.pom.*; import org.eclipse.emf.ecore.*; import org.eclipse.emf.ecore.xml.type.*;
[ "eu.hohenegger.xsd", "org.eclipse.emf" ]
eu.hohenegger.xsd; org.eclipse.emf;
706,040
public BufferedImage getEXIFThumbnail() throws ImageReadException, IOException { if (exif == null) { return null; } final List<? extends IImageMetadataItem> dirs = exif.getDirectories(); for (IImageMetadataItem d : dirs) { final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) d; // Debug.debug("dir", dir); BufferedImage image = dir.getThumbnail(); if (null != image) { return image; } final JpegImageData jpegImageData = dir.getJpegImageData(); if (jpegImageData != null) { // JPEG thumbnail as JPEG or other format; try to parse. //boolean imageSucceeded = false; //try { image = Imaging.getBufferedImage(jpegImageData.data); //imageSucceeded = true; if (image != null) { return image; } } } return null; }
BufferedImage function() throws ImageReadException, IOException { if (exif == null) { return null; } final List<? extends IImageMetadataItem> dirs = exif.getDirectories(); for (IImageMetadataItem d : dirs) { final TiffImageMetadata.Directory dir = (TiffImageMetadata.Directory) d; BufferedImage image = dir.getThumbnail(); if (null != image) { return image; } final JpegImageData jpegImageData = dir.getJpegImageData(); if (jpegImageData != null) { image = Imaging.getBufferedImage(jpegImageData.data); if (image != null) { return image; } } } return null; }
/** * Get the thumbnail image if available. * * @return the thumbnail image. May be <code>null</code> if no image could * be found. * @throws ImageReadException * @throws IOException */
Get the thumbnail image if available
getEXIFThumbnail
{ "repo_name": "windwardadmin/android-awt", "path": "src/main/java/org/apache/commons/imaging/formats/jpeg/JpegImageMetadata.java", "license": "apache-2.0", "size": 7751 }
[ "java.io.IOException", "java.util.List", "net.windward.android.awt.image.BufferedImage", "org.apache.commons.imaging.ImageReadException", "org.apache.commons.imaging.Imaging", "org.apache.commons.imaging.formats.tiff.JpegImageData", "org.apache.commons.imaging.formats.tiff.TiffImageMetadata" ]
import java.io.IOException; import java.util.List; import net.windward.android.awt.image.BufferedImage; import org.apache.commons.imaging.ImageReadException; import org.apache.commons.imaging.Imaging; import org.apache.commons.imaging.formats.tiff.JpegImageData; import org.apache.commons.imaging.formats.tiff.TiffImageMetadata;
import java.io.*; import java.util.*; import net.windward.android.awt.image.*; import org.apache.commons.imaging.*; import org.apache.commons.imaging.formats.tiff.*;
[ "java.io", "java.util", "net.windward.android", "org.apache.commons" ]
java.io; java.util; net.windward.android; org.apache.commons;
1,000,613
public static Documentation getDocumentation(GenericArtifact artifact) throws APIManagementException { Documentation documentation; try { DocumentationType type; String docType = artifact.getAttribute(APIConstants.DOC_TYPE); if (docType.equalsIgnoreCase(DocumentationType.HOWTO.getType())) { type = DocumentationType.HOWTO; } else if (docType.equalsIgnoreCase(DocumentationType.PUBLIC_FORUM.getType())) { type = DocumentationType.PUBLIC_FORUM; } else if (docType.equalsIgnoreCase(DocumentationType.SUPPORT_FORUM.getType())) { type = DocumentationType.SUPPORT_FORUM; } else if (docType.equalsIgnoreCase(DocumentationType.API_MESSAGE_FORMAT.getType())) { type = DocumentationType.API_MESSAGE_FORMAT; } else if (docType.equalsIgnoreCase(DocumentationType.SAMPLES.getType())) { type = DocumentationType.SAMPLES; } else { type = DocumentationType.OTHER; } documentation = new Documentation(type, artifact.getAttribute(APIConstants.DOC_NAME)); documentation.setId(artifact.getId()); documentation.setSummary(artifact.getAttribute(APIConstants.DOC_SUMMARY)); String visibilityAttr = artifact.getAttribute(APIConstants.DOC_VISIBILITY); Documentation.DocumentVisibility documentVisibility = Documentation.DocumentVisibility.API_LEVEL; if (visibilityAttr != null) { if (visibilityAttr.equals(Documentation.DocumentVisibility.API_LEVEL.name())) { documentVisibility = Documentation.DocumentVisibility.API_LEVEL; } else if (visibilityAttr.equals(Documentation.DocumentVisibility.PRIVATE.name())) { documentVisibility = Documentation.DocumentVisibility.PRIVATE; } else if (visibilityAttr.equals(Documentation.DocumentVisibility.OWNER_ONLY.name())) { documentVisibility = Documentation.DocumentVisibility.OWNER_ONLY; } } documentation.setVisibility(documentVisibility); Documentation.DocumentSourceType docSourceType = Documentation.DocumentSourceType.INLINE; String artifactAttribute = artifact.getAttribute(APIConstants.DOC_SOURCE_TYPE); if (Documentation.DocumentSourceType.URL.name().equals(artifactAttribute)) { docSourceType = Documentation.DocumentSourceType.URL; documentation.setSourceUrl(artifact.getAttribute(APIConstants.DOC_SOURCE_URL)); } else if (Documentation.DocumentSourceType.FILE.name().equals(artifactAttribute)) { docSourceType = Documentation.DocumentSourceType.FILE; documentation.setFilePath(prependWebContextRoot(artifact.getAttribute(APIConstants.DOC_FILE_PATH))); } else if (Documentation.DocumentSourceType.MARKDOWN.name().equals(artifactAttribute)) { docSourceType = Documentation.DocumentSourceType.MARKDOWN; } documentation.setSourceType(docSourceType); if (documentation.getType() == DocumentationType.OTHER) { documentation.setOtherTypeName(artifact.getAttribute(APIConstants.DOC_OTHER_TYPE_NAME)); } } catch (GovernanceException e) { throw new APIManagementException("Failed to get documentation from artifact", e); } return documentation; }
static Documentation function(GenericArtifact artifact) throws APIManagementException { Documentation documentation; try { DocumentationType type; String docType = artifact.getAttribute(APIConstants.DOC_TYPE); if (docType.equalsIgnoreCase(DocumentationType.HOWTO.getType())) { type = DocumentationType.HOWTO; } else if (docType.equalsIgnoreCase(DocumentationType.PUBLIC_FORUM.getType())) { type = DocumentationType.PUBLIC_FORUM; } else if (docType.equalsIgnoreCase(DocumentationType.SUPPORT_FORUM.getType())) { type = DocumentationType.SUPPORT_FORUM; } else if (docType.equalsIgnoreCase(DocumentationType.API_MESSAGE_FORMAT.getType())) { type = DocumentationType.API_MESSAGE_FORMAT; } else if (docType.equalsIgnoreCase(DocumentationType.SAMPLES.getType())) { type = DocumentationType.SAMPLES; } else { type = DocumentationType.OTHER; } documentation = new Documentation(type, artifact.getAttribute(APIConstants.DOC_NAME)); documentation.setId(artifact.getId()); documentation.setSummary(artifact.getAttribute(APIConstants.DOC_SUMMARY)); String visibilityAttr = artifact.getAttribute(APIConstants.DOC_VISIBILITY); Documentation.DocumentVisibility documentVisibility = Documentation.DocumentVisibility.API_LEVEL; if (visibilityAttr != null) { if (visibilityAttr.equals(Documentation.DocumentVisibility.API_LEVEL.name())) { documentVisibility = Documentation.DocumentVisibility.API_LEVEL; } else if (visibilityAttr.equals(Documentation.DocumentVisibility.PRIVATE.name())) { documentVisibility = Documentation.DocumentVisibility.PRIVATE; } else if (visibilityAttr.equals(Documentation.DocumentVisibility.OWNER_ONLY.name())) { documentVisibility = Documentation.DocumentVisibility.OWNER_ONLY; } } documentation.setVisibility(documentVisibility); Documentation.DocumentSourceType docSourceType = Documentation.DocumentSourceType.INLINE; String artifactAttribute = artifact.getAttribute(APIConstants.DOC_SOURCE_TYPE); if (Documentation.DocumentSourceType.URL.name().equals(artifactAttribute)) { docSourceType = Documentation.DocumentSourceType.URL; documentation.setSourceUrl(artifact.getAttribute(APIConstants.DOC_SOURCE_URL)); } else if (Documentation.DocumentSourceType.FILE.name().equals(artifactAttribute)) { docSourceType = Documentation.DocumentSourceType.FILE; documentation.setFilePath(prependWebContextRoot(artifact.getAttribute(APIConstants.DOC_FILE_PATH))); } else if (Documentation.DocumentSourceType.MARKDOWN.name().equals(artifactAttribute)) { docSourceType = Documentation.DocumentSourceType.MARKDOWN; } documentation.setSourceType(docSourceType); if (documentation.getType() == DocumentationType.OTHER) { documentation.setOtherTypeName(artifact.getAttribute(APIConstants.DOC_OTHER_TYPE_NAME)); } } catch (GovernanceException e) { throw new APIManagementException(STR, e); } return documentation; }
/** * Create the Documentation from artifact * * @param artifact Documentation artifact * @return Documentation * @throws APIManagementException if failed to create Documentation from artifact */
Create the Documentation from artifact
getDocumentation
{ "repo_name": "ruks/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.java", "license": "apache-2.0", "size": 564037 }
[ "java.net.URL", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.Documentation", "org.wso2.carbon.apimgt.api.model.DocumentationType", "org.wso2.carbon.apimgt.impl.APIConstants", "org.wso2.carbon.governance.api.exception.GovernanceException", "org.wso2.carbon.govern...
import java.net.URL; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Documentation; import org.wso2.carbon.apimgt.api.model.DocumentationType; import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.governance.api.exception.GovernanceException; import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
import java.net.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.*; import org.wso2.carbon.governance.api.exception.*; import org.wso2.carbon.governance.api.generic.dataobjects.*;
[ "java.net", "org.wso2.carbon" ]
java.net; org.wso2.carbon;
889,237
@Nonnull Set<String> getClusterNames();
Set<String> getClusterNames();
/** * Returns the set of cluster names on which this event has already * been processed. */
Returns the set of cluster names on which this event has already been processed
getClusterNames
{ "repo_name": "emre-aydin/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/wan/impl/InternalWanEvent.java", "license": "apache-2.0", "size": 1890 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,563,204
protected Element createJDOMElement(String name) { Element result = new Element(name); return result; }
Element function(String name) { Element result = new Element(name); return result; }
/** * Create a JDOM Element with the given name. * * @param name the element name * @return a JDOM Element instance */
Create a JDOM Element with the given name
createJDOMElement
{ "repo_name": "polagoab/deployconf", "path": "src/main/java/org/polago/deployconf/task/AbstractTask.java", "license": "mit", "size": 7491 }
[ "org.jdom2.Element" ]
import org.jdom2.Element;
import org.jdom2.*;
[ "org.jdom2" ]
org.jdom2;
1,843,798
public ThreadPool getThreadPool() { return threadPool; }
ThreadPool function() { return threadPool; }
/** * Returns the internal thread pool */
Returns the internal thread pool
getThreadPool
{ "repo_name": "gingerwizard/elasticsearch", "path": "server/src/main/java/org/elasticsearch/transport/TransportService.java", "license": "apache-2.0", "size": 57239 }
[ "org.elasticsearch.threadpool.ThreadPool" ]
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.threadpool.*;
[ "org.elasticsearch.threadpool" ]
org.elasticsearch.threadpool;
286,797
public boolean hasRoleForResource(CmsObject cms, String userName, CmsRole role, String resourceName) { CmsResource resource; try { resource = cms.readResource(resourceName); } catch (CmsException e) { // ignore return false; } CmsUser user; try { user = cms.readUser(userName); } catch (CmsException e) { // ignore return false; } return m_securityManager.hasRoleForResource(cms.getRequestContext(), user, role, resource); }
boolean function(CmsObject cms, String userName, CmsRole role, String resourceName) { CmsResource resource; try { resource = cms.readResource(resourceName); } catch (CmsException e) { return false; } CmsUser user; try { user = cms.readUser(userName); } catch (CmsException e) { return false; } return m_securityManager.hasRoleForResource(cms.getRequestContext(), user, role, resource); }
/** * Checks if the given context user has the given role for the given resource.<p> * * @param cms the opencms context * @param userName the name of the user to check the role for * @param role the role to check * @param resourceName the name of the resource to check * * @return <code>true</code> if the given context user has the given role for the given resource */
Checks if the given context user has the given role for the given resource
hasRoleForResource
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/security/CmsRoleManager.java", "license": "lgpl-2.1", "size": 18883 }
[ "org.opencms.file.CmsObject", "org.opencms.file.CmsResource", "org.opencms.file.CmsUser", "org.opencms.main.CmsException" ]
import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.file.CmsUser; import org.opencms.main.CmsException;
import org.opencms.file.*; import org.opencms.main.*;
[ "org.opencms.file", "org.opencms.main" ]
org.opencms.file; org.opencms.main;
741,543
MappingHelpers.<SingleRecordBulkEntity>convertToEntity(values, MAPPINGS, this); this.processMappingsFromRowValues(values); }
MappingHelpers.<SingleRecordBulkEntity>convertToEntity(values, MAPPINGS, this); this.processMappingsFromRowValues(values); }
/** * Reads common mappings and calls abstract method to read entity-specific mappings. This is done through abstract method to avoid having to do base.ReadFromRowValues in each child. * * @param values CSV row values */
Reads common mappings and calls abstract method to read entity-specific mappings. This is done through abstract method to avoid having to do base.ReadFromRowValues in each child
readFromRowValues
{ "repo_name": "bing-ads-sdk/BingAds-Java-SDK", "path": "src/main/java/com/microsoft/bingads/v12/internal/bulk/entities/SingleRecordBulkEntity.java", "license": "mit", "size": 8336 }
[ "com.microsoft.bingads.v12.internal.bulk.MappingHelpers" ]
import com.microsoft.bingads.v12.internal.bulk.MappingHelpers;
import com.microsoft.bingads.v12.internal.bulk.*;
[ "com.microsoft.bingads" ]
com.microsoft.bingads;
2,164,760
public boolean authenticate(String username, String password) { try (LDAPResource ldap = new LDAPResource()) { String cn = userCn(username); ldap.verifyCredentials(cn, password); createUserIfNeeded(ldap, cn); logger.info("Successful LDAP login: " + username); return true; } catch (LdapAuthenticationException e) { logger.info("LDAP auth attempt failed"); return false; } catch (LdapException | IOException e) { logger.warn("LDAP connection error", e); throw new AuthenticationException(LDAP_AUTH, "LDAP connection error", e); } }
boolean function(String username, String password) { try (LDAPResource ldap = new LDAPResource()) { String cn = userCn(username); ldap.verifyCredentials(cn, password); createUserIfNeeded(ldap, cn); logger.info(STR + username); return true; } catch (LdapAuthenticationException e) { logger.info(STR); return false; } catch (LdapException IOException e) { logger.warn(STR, e); throw new AuthenticationException(LDAP_AUTH, STR, e); } }
/** * Attempt to authenticate against LDAP directory. Accepts email addresses * as well as plain usernames; emails will have the '@mail.com' portion * stripped off before read. * * @param username * @param password * @return */
Attempt to authenticate against LDAP directory. Accepts email addresses as well as plain usernames; emails will have the '@mail.com' portion stripped off before read
authenticate
{ "repo_name": "GEBIT/mamute", "path": "src/main/java/org/mamute/auth/LDAPApi.java", "license": "apache-2.0", "size": 10735 }
[ "java.io.IOException", "org.apache.directory.api.ldap.model.exception.LdapAuthenticationException", "org.apache.directory.api.ldap.model.exception.LdapException" ]
import java.io.IOException; import org.apache.directory.api.ldap.model.exception.LdapAuthenticationException; import org.apache.directory.api.ldap.model.exception.LdapException;
import java.io.*; import org.apache.directory.api.ldap.model.exception.*;
[ "java.io", "org.apache.directory" ]
java.io; org.apache.directory;
1,291,216
public void testSyncFailureBehaviour() { // Create an action that is going to fail Action action = createFailingMoveAction(true); try { this.actionService.executeAction(action, this.nodeRef); // Fail if we get there since the exception should have been raised fail("An exception should have been raised."); } catch (RuntimeException exception) { // Good! The exception was raised correctly } // Test what happens when a element of a composite action fails (should raise and bubble up to parent bahviour) // Create the composite action Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME); action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE); Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME); action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, QName.createQName("{test}badDogAspect")); CompositeAction compAction = this.actionService.createCompositeAction(); compAction.setTitle("title"); compAction.setDescription("description"); compAction.addAction(action1); compAction.addAction(action2); try { // Execute the composite action this.actionService.executeAction(compAction, this.nodeRef); fail("An exception should have been raised here !!"); } catch (RuntimeException runtimeException) { // Good! The exception was raised } }
void function() { Action action = createFailingMoveAction(true); try { this.actionService.executeAction(action, this.nodeRef); fail(STR); } catch (RuntimeException exception) { } Action action1 = this.actionService.createAction(AddFeaturesActionExecuter.NAME); action1.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, ContentModel.ASPECT_LOCKABLE); Action action2 = this.actionService.createAction(AddFeaturesActionExecuter.NAME); action2.setParameterValue(AddFeaturesActionExecuter.PARAM_ASPECT_NAME, QName.createQName(STR)); CompositeAction compAction = this.actionService.createCompositeAction(); compAction.setTitle("title"); compAction.setDescription(STR); compAction.addAction(action1); compAction.addAction(action2); try { this.actionService.executeAction(compAction, this.nodeRef); fail(STR); } catch (RuntimeException runtimeException) { } }
/** * Test sync failure behaviour */
Test sync failure behaviour
testSyncFailureBehaviour
{ "repo_name": "loftuxab/alfresco-community-loftux", "path": "projects/repository/source/test-java/org/alfresco/repo/action/ActionServiceImplTest.java", "license": "lgpl-3.0", "size": 67550 }
[ "org.alfresco.model.ContentModel", "org.alfresco.repo.action.executer.AddFeaturesActionExecuter", "org.alfresco.service.cmr.action.Action", "org.alfresco.service.cmr.action.CompositeAction", "org.alfresco.service.namespace.QName" ]
import org.alfresco.model.ContentModel; import org.alfresco.repo.action.executer.AddFeaturesActionExecuter; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.CompositeAction; import org.alfresco.service.namespace.QName;
import org.alfresco.model.*; import org.alfresco.repo.action.executer.*; import org.alfresco.service.cmr.action.*; import org.alfresco.service.namespace.*;
[ "org.alfresco.model", "org.alfresco.repo", "org.alfresco.service" ]
org.alfresco.model; org.alfresco.repo; org.alfresco.service;
2,327,700
public final void setWeaponCategories( final List<WeaponCategory> categories) { this.elements.clear(); this.elements.addAll(categories); }
final void function( final List<WeaponCategory> categories) { this.elements.clear(); this.elements.addAll(categories); }
/** * Clears the list first. * * @param categories the collection of weapon categories to set. */
Clears the list first
setWeaponCategories
{ "repo_name": "asciiCerebrum/neocortexEngine", "path": "src/main/java/org/asciicerebrum/neocortexengine/domain/ruleentities/WeaponCategories.java", "license": "mit", "size": 1345 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,317,640
public static CelestialBody getParentPlanet(CelestialBody body) { if(body instanceof Planet) { return body; } else if(body instanceof Moon) { return ((Moon) body).getParentPlanet(); } else if (body instanceof Satellite) { return ((Satellite) body).getParentPlanet(); } else if (body instanceof Mothership) { CelestialBody parent = ((Mothership) body).getParent(); return getParentPlanet(parent); } return null; }
static CelestialBody function(CelestialBody body) { if(body instanceof Planet) { return body; } else if(body instanceof Moon) { return ((Moon) body).getParentPlanet(); } else if (body instanceof Satellite) { return ((Satellite) body).getParentPlanet(); } else if (body instanceof Mothership) { CelestialBody parent = ((Mothership) body).getParent(); return getParentPlanet(parent); } return null; }
/** * Returns the planet the given body is orbiting, whenever directly or not. * Returns null if body is a star or something * * @param body * @return */
Returns the planet the given body is orbiting, whenever directly or not. Returns null if body is a star or something
getParentPlanet
{ "repo_name": "katzenpapst/amunra", "path": "src/main/java/de/katzenpapst/amunra/helper/ShuttleTeleportHelper.java", "license": "mit", "size": 25402 }
[ "de.katzenpapst.amunra.mothership.Mothership" ]
import de.katzenpapst.amunra.mothership.Mothership;
import de.katzenpapst.amunra.mothership.*;
[ "de.katzenpapst.amunra" ]
de.katzenpapst.amunra;
844,944
EList<UnknownStatement> getRequireunknownstatements();
EList<UnknownStatement> getRequireunknownstatements();
/** * Returns the value of the '<em><b>Requireunknownstatements</b></em>' containment reference list. * The list contents are of type {@link yang.manager.yang.UnknownStatement}. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>Requireunknownstatements</em>' containment reference list isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>Requireunknownstatements</em>' containment reference list. * @see yang.manager.yang.YangPackage#getRequireInstanceStatement_Requireunknownstatements() * @model containment="true" * @generated */
Returns the value of the 'Requireunknownstatements' containment reference list. The list contents are of type <code>yang.manager.yang.UnknownStatement</code>. If the meaning of the 'Requireunknownstatements' containment reference list isn't clear, there really should be more of a description here...
getRequireunknownstatements
{ "repo_name": "att/yang-design-studio", "path": "yang.Manager/src-gen/yang/manager/yang/RequireInstanceStatement.java", "license": "epl-1.0", "size": 2268 }
[ "org.eclipse.emf.common.util.EList" ]
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
400,534
@Test public void xStream11Compatibility() { Bar b = (Bar) new XStream2().fromXML( "<hudson.util.XStream2Test-Bar><s>foo</s></hudson.util.XStream2Test-Bar>"); assertEquals("foo", b.s); } public static final class __Foo_Bar$Class { String under_1 = "1", under__2 = "2", _leadUnder1 = "L1", __leadUnder2 = "L2", $dollar = "D1", dollar$2 = "D2"; }
void function() { Bar b = (Bar) new XStream2().fromXML( STR); assertEquals("foo", b.s); } public static final class __Foo_Bar$Class { String under_1 = "1", under__2 = "2", _leadUnder1 = "L1", __leadUnder2 = "L2", $dollar = "D1", dollar$2 = "D2"; }
/** * Test ability to read old XML from Hudson 1.105 or older. */
Test ability to read old XML from Hudson 1.105 or older
xStream11Compatibility
{ "repo_name": "v1v/jenkins", "path": "core/src/test/java/hudson/util/XStream2Test.java", "license": "mit", "size": 22318 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,850,785
Collection<Instance> instances();
Collection<Instance> instances();
/** * Return a collection of running instances within the same GCE project * @return a collection of running instances within the same GCE project */
Return a collection of running instances within the same GCE project
instances
{ "repo_name": "jimczi/elasticsearch", "path": "plugins/discovery-gce/src/main/java/org/elasticsearch/cloud/gce/GceInstancesService.java", "license": "apache-2.0", "size": 3026 }
[ "com.google.api.services.compute.model.Instance", "java.util.Collection" ]
import com.google.api.services.compute.model.Instance; import java.util.Collection;
import com.google.api.services.compute.model.*; import java.util.*;
[ "com.google.api", "java.util" ]
com.google.api; java.util;
1,424,359
public double getRoomValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value) { return isRoomCriterion() ? getValue(assignment, value, null) : 0.0; }
double getRoomValue(Assignment<Exam, ExamPlacement> assignment, ExamPlacement value) { return function() ? getValue(assignment, value, null) : 0.0; }
/** * True if this criterion is based on room assignment. Used by {@link ExamPlacement#getRoomCost(Assignment)}. * @return true if this criterion is based on room assignment **/
True if this criterion is based on room assignment. Used by <code>ExamPlacement#getRoomCost(Assignment)</code>
isRoomCriterion
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/exam/criteria/ExamCriterion.java", "license": "lgpl-3.0", "size": 6922 }
[ "org.cpsolver.exam.model.Exam", "org.cpsolver.exam.model.ExamPlacement", "org.cpsolver.ifs.assignment.Assignment" ]
import org.cpsolver.exam.model.Exam; import org.cpsolver.exam.model.ExamPlacement; import org.cpsolver.ifs.assignment.Assignment;
import org.cpsolver.exam.model.*; import org.cpsolver.ifs.assignment.*;
[ "org.cpsolver.exam", "org.cpsolver.ifs" ]
org.cpsolver.exam; org.cpsolver.ifs;
523,222
public void onSessionQueued(Uri mediaUri);
void function(Uri mediaUri);
/** * Called when the session with the given Uri was queued and will be * processed. */
Called when the session with the given Uri was queued and will be processed
onSessionQueued
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "packages/apps/Camera2/src/com/android/camera/session/CaptureSessionManager.java", "license": "gpl-3.0", "size": 5220 }
[ "android.net.Uri" ]
import android.net.Uri;
import android.net.*;
[ "android.net" ]
android.net;
373,460
@Test @MediumTest @Feature({"Omaha", "Sync"}) @FlakyTest(message = "https://crbug.com/587138") public void testRunnableGetsRunWhenScreenIsOn() throws Exception { // Claim the screen is off. mReceiver.setPowerManagerHelperForTests(sScreenOff); // Pause & resume. Because the screen is off, nothing should happen. ApplicationTestUtils.fireHomeScreenIntent(InstrumentationRegistry.getTargetContext()); ApplicationTestUtils.launchChrome(InstrumentationRegistry.getTargetContext()); Assert.assertTrue("Isn't waiting for power broadcasts.", mReceiver.isRegistered()); Assert.assertEquals(0, mRunnable.postHelper.getCallCount()); Assert.assertEquals(0, mRunnable.runHelper.getCallCount()); Assert.assertEquals(0, mRunnable.cancelHelper.getCallCount()); // Pretend to turn the screen on. int postCount = mRunnable.postHelper.getCallCount(); int runCount = mRunnable.runHelper.getCallCount(); mReceiver.setPowerManagerHelperForTests(sScreenOn); Intent intent = new Intent(Intent.ACTION_SCREEN_ON); mReceiver.onReceive(InstrumentationRegistry.getTargetContext(), intent); // The runnable should run now that the screen is on. mRunnable.postHelper.waitForCallback(postCount, 1); mRunnable.runHelper.waitForCallback(runCount, 1); Assert.assertEquals(0, mRunnable.cancelHelper.getCallCount()); Assert.assertFalse("Still listening for power broadcasts.", mReceiver.isRegistered()); }
@Feature({"Omaha", "Sync"}) @FlakyTest(message = STRIsn't waiting for power broadcasts.STRStill listening for power broadcasts.", mReceiver.isRegistered()); }
/** * Check that the runnable gets run only while the screen is on. */
Check that the runnable gets run only while the screen is on
testRunnableGetsRunWhenScreenIsOn
{ "repo_name": "endlessm/chromium-browser", "path": "chrome/android/javatests/src/org/chromium/chrome/browser/PowerBroadcastReceiverTest.java", "license": "bsd-3-clause", "size": 7747 }
[ "org.chromium.base.test.util.Feature", "org.chromium.base.test.util.FlakyTest" ]
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.*;
[ "org.chromium.base" ]
org.chromium.base;
1,094,624
@Test public void test_setRate() { BigDecimal value = new BigDecimal(1); instance.setRate(value); assertSame("'setRate' should be correct.", value, TestsHelper.getField(instance, "rate")); }
void function() { BigDecimal value = new BigDecimal(1); instance.setRate(value); assertSame(STR, value, TestsHelper.getField(instance, "rate")); }
/** * <p> * Accuracy test for the method <code>setRate(BigDecimal rate)</code>.<br> * The value should be properly set. * </p> */
Accuracy test for the method <code>setRate(BigDecimal rate)</code>. The value should be properly set.
test_setRate
{ "repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application", "path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/entities/application/DeductionRateUnitTests.java", "license": "apache-2.0", "size": 9812 }
[ "gov.opm.scrd.TestsHelper", "java.math.BigDecimal", "org.junit.Assert" ]
import gov.opm.scrd.TestsHelper; import java.math.BigDecimal; import org.junit.Assert;
import gov.opm.scrd.*; import java.math.*; import org.junit.*;
[ "gov.opm.scrd", "java.math", "org.junit" ]
gov.opm.scrd; java.math; org.junit;
1,591,904
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"), @ApiResponse(code = 403, message = "The authenticated user does not have the required role " + "(TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " + "of the application does not match the Tenant ID of the authenticated user"), @ApiResponse(code = 404, message = "Application with the specified applicationToken does not exist"), @ApiResponse(code = 500, message = "An unexpected error occurred on the server side")}) @RequestMapping(value = "profileSchemas/{applicationToken}", method = RequestMethod.GET) @ResponseBody public List<EndpointProfileSchemaDto> getProfileSchemasByApplicationToken( @ApiParam(name = "applicationToken", value = "A unique auto-generated application identifier", required = true) @PathVariable String applicationToken) throws KaaAdminServiceException { return profileService.getProfileSchemasByApplicationToken(applicationToken); }
@ApiResponse(code = 401, message = STR), @ApiResponse(code = 403, message = STR + STR + STR), @ApiResponse(code = 404, message = STR), @ApiResponse(code = 500, message = STR)}) @RequestMapping(value = STR, method = RequestMethod.GET) List<EndpointProfileSchemaDto> function( @ApiParam(name = STR, value = STR, required = true) @PathVariable String applicationToken) throws KaaAdminServiceException { return profileService.getProfileSchemasByApplicationToken(applicationToken); }
/** * Gets the profile schemas by application token. * * @param applicationToken the application token * @return the list of endpoint profile schema dto objects * @throws KaaAdminServiceException the kaa admin service exception */
Gets the profile schemas by application token
getProfileSchemasByApplicationToken
{ "repo_name": "vtkhir/kaa", "path": "server/node/src/main/java/org/kaaproject/kaa/server/admin/controller/ProfileController.java", "license": "apache-2.0", "size": 21424 }
[ "io.swagger.annotations.ApiParam", "io.swagger.annotations.ApiResponse", "java.util.List", "org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto", "org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.we...
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import java.util.List; import org.kaaproject.kaa.common.dto.EndpointProfileSchemaDto; import org.kaaproject.kaa.server.admin.shared.services.KaaAdminServiceException; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import io.swagger.annotations.*; import java.util.*; import org.kaaproject.kaa.common.dto.*; import org.kaaproject.kaa.server.admin.shared.services.*; import org.springframework.web.bind.annotation.*;
[ "io.swagger.annotations", "java.util", "org.kaaproject.kaa", "org.springframework.web" ]
io.swagger.annotations; java.util; org.kaaproject.kaa; org.springframework.web;
1,515,559
private byte[] encodeString(String s){ try { return trimAndNormalize(s).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { return "###string-encode-error###".getBytes(); } }
byte[] function(String s){ try { return trimAndNormalize(s).getBytes("UTF-8"); } catch (UnsupportedEncodingException e) { return STR.getBytes(); } }
/** * convert text string into UTF-8 encoded byte array. * Also normalize line endings to LF (0x0a) and remove * all leading and trailing whitespace and line ends */
convert text string into UTF-8 encoded byte array. Also normalize line endings to LF (0x0a) and remove all leading and trailing whitespace and line ends
encodeString
{ "repo_name": "prive/prive2-android", "path": "TorChatAndroid/src/prof7bit/torchat/core/MessageBuffer.java", "license": "gpl-2.0", "size": 7683 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
2,283,517
private static Node getQualifiedMemberAccess(AbstractCompiler compiler, Node member, Node staticAccess, Node instanceAccess) { Node context = member.isStaticMember() ? staticAccess : instanceAccess; context = context.cloneTree(); if (member.isComputedProp()) { return IR.getelem(context, member.removeFirstChild()); } else { return NodeUtil.newPropertyAccess(compiler, context, member.getString()); } }
static Node function(AbstractCompiler compiler, Node member, Node staticAccess, Node instanceAccess) { Node context = member.isStaticMember() ? staticAccess : instanceAccess; context = context.cloneTree(); if (member.isComputedProp()) { return IR.getelem(context, member.removeFirstChild()); } else { return NodeUtil.newPropertyAccess(compiler, context, member.getString()); } }
/** * Constructs a Node that represents an access to the given class member, qualified by either the * static or the instance access context, depending on whether the member is static. * * <p><b>WARNING:</b> {@code member} may be modified/destroyed by this method, do not use it * afterwards. */
Constructs a Node that represents an access to the given class member, qualified by either the static or the instance access context, depending on whether the member is static. afterwards
getQualifiedMemberAccess
{ "repo_name": "tdelmas/closure-compiler", "path": "src/com/google/javascript/jscomp/Es6TypedToEs6Converter.java", "license": "apache-2.0", "size": 34627 }
[ "com.google.javascript.rhino.IR", "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.IR; import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
1,790,445
protected void onImpact(RayTraceResult result) { if (!this.worldObj.isRemote) { if (result.entityHit instanceof EntityLivingBase && result.entityHit != getThrower()) { result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), ModConfig.iceBulletDamage); } this.worldObj.setEntityState(this, (byte) 1); this.setDead(); } }
void function(RayTraceResult result) { if (!this.worldObj.isRemote) { if (result.entityHit instanceof EntityLivingBase && result.entityHit != getThrower()) { result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), ModConfig.iceBulletDamage); } this.worldObj.setEntityState(this, (byte) 1); this.setDead(); } }
/** * Called when this EntityThrowable hits a block or entity. */
Called when this EntityThrowable hits a block or entity
onImpact
{ "repo_name": "zkm00323/Example", "path": "src/main/java/ModSoul_of_Ashes/Throwable/Entity/EntityIcebullet.java", "license": "lgpl-2.1", "size": 16316 }
[ "net.minecraft.entity.EntityLivingBase", "net.minecraft.util.DamageSource", "net.minecraft.util.math.RayTraceResult" ]
import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.DamageSource; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.entity.*; import net.minecraft.util.*; import net.minecraft.util.math.*;
[ "net.minecraft.entity", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.util;
1,812,383
EReference getPhysicalDevice_TimeEntries();
EReference getPhysicalDevice_TimeEntries();
/** * Returns the meta object for the containment reference '{@link COSEM.PhysicalDevice#getTimeEntries <em>Time Entries</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Time Entries</em>'. * @see COSEM.PhysicalDevice#getTimeEntries() * @see #getPhysicalDevice() * @generated */
Returns the meta object for the containment reference '<code>COSEM.PhysicalDevice#getTimeEntries Time Entries</code>'.
getPhysicalDevice_TimeEntries
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/ModelJoin/src/main/java/COSEM/COSEMPackage.java", "license": "mit", "size": 60487 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,873,390
private void postRelax(int k) { for (int i = 0; i < nu2; ++i) if (transpose) postM[k].transApply(f[k], u[k]); else postM[k].apply(f[k], u[k]); } private static class Aggregator { private List<Set<Integer>> C; private int[] diagind; private List<Set<Integer>> N; public Aggregator(CompRowMatrix A, double eps) { diagind = findDiagonalIndices(A); N = findNodeNeighborhood(A, diagind, eps); boolean[] R = createInitialR(A); C = createInitialAggregates(N, R); C = enlargeAggregates(C, N, R); C = createFinalAggregates(C, N, R); }
void function(int k) { for (int i = 0; i < nu2; ++i) if (transpose) postM[k].transApply(f[k], u[k]); else postM[k].apply(f[k], u[k]); } private static class Aggregator { private List<Set<Integer>> C; private int[] diagind; private List<Set<Integer>> N; public Aggregator(CompRowMatrix A, double eps) { diagind = findDiagonalIndices(A); N = findNodeNeighborhood(A, diagind, eps); boolean[] R = createInitialR(A); C = createInitialAggregates(N, R); C = enlargeAggregates(C, N, R); C = createFinalAggregates(C, N, R); }
/** * Applies the relaxation scheme at the given level * * @param k * Multigrid level */
Applies the relaxation scheme at the given level
postRelax
{ "repo_name": "jpalves/matrix-toolkits-java", "path": "src/main/java/no/uib/cipr/matrix/sparse/AMG.java", "license": "lgpl-3.0", "size": 28593 }
[ "java.util.List", "java.util.Set" ]
import java.util.List; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
25,110
@Override protected void actionPerformed(GuiButton parButton) { super.actionPerformed(parButton); if (parButton.id == 502) { NetworkHandler.sendToServer(new MessageHelperGuiCustomizeMenuEngineDisplayBlockItemDefault()); } if (parButton.id == 503) { //NetworkHandler.sendToServer(new MessageGuiCustomizeMenuBalloonTier1Pg2()); } if (parButton.id == 504) { //NetworkHandler.sendToServer(new MessageGuiCustomizeMenuBalloonTier1Pg1()); } if (parButton.id == 505) { NetworkHandler.sendToServer(new MessageGuiCustomizeMenuEngineMain()); } if (parButton.id == 501) { Item previousItem = Item.getItemById(this.airship.engineDisplayItemstackVisual); int previousMeta = this.airship.engineDisplayItemstackMetaVisual; Item currentItem = Item.getItemById(this.itemstackInfo); int currentMeta = this.itemstackMetaInfo; if(currentItem == previousItem) { if(currentMeta != previousMeta) { NetworkHandler.sendToServer(new MessageHelperGuiCustomizeMenuEngineDisplayBlockItem()); } } else { NetworkHandler.sendToServer(new MessageHelperGuiCustomizeMenuEngineDisplayBlockItem()); } } this.buttonList.clear(); this.initGui(); this.updateScreen(); }
void function(GuiButton parButton) { super.actionPerformed(parButton); if (parButton.id == 502) { NetworkHandler.sendToServer(new MessageHelperGuiCustomizeMenuEngineDisplayBlockItemDefault()); } if (parButton.id == 503) { } if (parButton.id == 504) { } if (parButton.id == 505) { NetworkHandler.sendToServer(new MessageGuiCustomizeMenuEngineMain()); } if (parButton.id == 501) { Item previousItem = Item.getItemById(this.airship.engineDisplayItemstackVisual); int previousMeta = this.airship.engineDisplayItemstackMetaVisual; Item currentItem = Item.getItemById(this.itemstackInfo); int currentMeta = this.itemstackMetaInfo; if(currentItem == previousItem) { if(currentMeta != previousMeta) { NetworkHandler.sendToServer(new MessageHelperGuiCustomizeMenuEngineDisplayBlockItem()); } } else { NetworkHandler.sendToServer(new MessageHelperGuiCustomizeMenuEngineDisplayBlockItem()); } } this.buttonList.clear(); this.initGui(); this.updateScreen(); }
/** * Called by the controls from the buttonList when activated. (Mouse pressed for buttons) */
Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
actionPerformed
{ "repo_name": "Weisses/Ebonheart-Mods", "path": "ViesCraft/1.12.2 - 2655/src/main/java/com/viesis/viescraft/client/gui/airship/customize/engine/sub/GuiCustomizeMenuEngineDisplayBlockItemVC.java", "license": "mit", "size": 8289 }
[ "com.viesis.viescraft.network.NetworkHandler", "com.viesis.viescraft.network.server.airship.customize.engine.MessageGuiCustomizeMenuEngineMain", "com.viesis.viescraft.network.server.airship.customize.engine.sub.MessageHelperGuiCustomizeMenuEngineDisplayBlockItem", "com.viesis.viescraft.network.server.airship....
import com.viesis.viescraft.network.NetworkHandler; import com.viesis.viescraft.network.server.airship.customize.engine.MessageGuiCustomizeMenuEngineMain; import com.viesis.viescraft.network.server.airship.customize.engine.sub.MessageHelperGuiCustomizeMenuEngineDisplayBlockItem; import com.viesis.viescraft.network.server.airship.customize.engine.sub.MessageHelperGuiCustomizeMenuEngineDisplayBlockItemDefault; import net.minecraft.client.gui.GuiButton; import net.minecraft.item.Item;
import com.viesis.viescraft.network.*; import com.viesis.viescraft.network.server.airship.customize.engine.*; import com.viesis.viescraft.network.server.airship.customize.engine.sub.*; import net.minecraft.client.gui.*; import net.minecraft.item.*;
[ "com.viesis.viescraft", "net.minecraft.client", "net.minecraft.item" ]
com.viesis.viescraft; net.minecraft.client; net.minecraft.item;
125,047
final synchronized void mergeInit(MergePolicy.OneMerge merge) throws IOException { boolean success = false; try { _mergeInit(merge); success = true; } finally { if (!success) { mergeFinish(merge); } } }
final synchronized void mergeInit(MergePolicy.OneMerge merge) throws IOException { boolean success = false; try { _mergeInit(merge); success = true; } finally { if (!success) { mergeFinish(merge); } } }
/** Does initial setup for a merge, which is fast but holds * the synchronized lock on IndexWriter instance. */
Does initial setup for a merge, which is fast but holds
mergeInit
{ "repo_name": "Overruler/retired-apache-sources", "path": "lucene-2.9.4/src/java/org/apache/lucene/index/IndexWriter.java", "license": "apache-2.0", "size": 208157 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
958,814
private boolean isSameNode(Node m, Node n) { return (fUseIsSameNode) ? m.isSameNode(n) : m == n; }
boolean function(Node m, Node n) { return (fUseIsSameNode) ? m.isSameNode(n) : m == n; }
/** * Returns true if <code>m</code> is the same node <code>n</code>. */
Returns true if <code>m</code> is the same node <code>n</code>
isSameNode
{ "repo_name": "AaronZhangL/SplitCharater", "path": "xerces-2_11_0/src/org/apache/xerces/dom/TreeWalkerImpl.java", "license": "gpl-2.0", "size": 16838 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,436,769
EAttribute getMatrixQuestion_MaxPerRow();
EAttribute getMatrixQuestion_MaxPerRow();
/** * Returns the meta object for the attribute '{@link questionairemodel.MatrixQuestion#getMaxPerRow <em>Max Per Row</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the attribute '<em>Max Per Row</em>'. * @see questionairemodel.MatrixQuestion#getMaxPerRow() * @see #getMatrixQuestion() * @generated */
Returns the meta object for the attribute '<code>questionairemodel.MatrixQuestion#getMaxPerRow Max Per Row</code>'.
getMatrixQuestion_MaxPerRow
{ "repo_name": "rasmusgreve/questionaire", "path": "Questionaire/src/questionairemodel/QuestionairemodelPackage.java", "license": "mit", "size": 46108 }
[ "org.eclipse.emf.ecore.EAttribute" ]
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,360,541
void setOwnerId (@Nullable UUID ownerId);
void setOwnerId (@Nullable UUID ownerId);
/** * Set the id of the player that owns the store. * * @param ownerId The id of the player owner. */
Set the id of the player that owns the store
setOwnerId
{ "repo_name": "JCThePants/Storefront", "path": "src/com/jcwhatever/storefront/stores/IStore.java", "license": "mit", "size": 7998 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
733,085
public native void query(Query query, CloudChatsResponseHandler handler);
native void function(Query query, CloudChatsResponseHandler handler);
/** * Retrieve a list of chat messages with sorting and pagination. * <p> * Data is returned in the chats property of the parameter passed to the * callback. * * @param message * @param handler */
Retrieve a list of chat messages with sorting and pagination. Data is returned in the chats property of the parameter passed to the callback
query
{ "repo_name": "alpapad/ahome-titanium", "path": "ahome-titanium/src/com/ait/toolkit/titanium/mobile/client/cloud/chats/Chats.java", "license": "apache-2.0", "size": 4585 }
[ "com.ait.toolkit.titanium.mobile.client.cloud.core.Query" ]
import com.ait.toolkit.titanium.mobile.client.cloud.core.Query;
import com.ait.toolkit.titanium.mobile.client.cloud.core.*;
[ "com.ait.toolkit" ]
com.ait.toolkit;
1,978,686
public static CidsBean createPastedFlaecheBean(final CidsBean clipboardBean, final Collection<CidsBean> targetBeansCollection, final boolean crossreference) throws Exception { final CidsBean pasteBean = CidsBeanSupport.deepcloneCidsBean(clipboardBean); if (!crossreference) { final CidsBean flaecheInfo = (CidsBean)pasteBean.getProperty(VerdisConstants.PROP.FLAECHE.FLAECHENINFO); if (flaecheInfo != null) { flaecheInfo.setProperty("id", -1); flaecheInfo.getMetaObject().setID(-1); flaecheInfo.getMetaObject().forceStatus(MetaObject.NEW); final CidsBean geomBean = (CidsBean)flaecheInfo.getProperty( VerdisConstants.PROP.FLAECHENINFO.GEOMETRIE); if (geomBean != null) { geomBean.setProperty("id", -1); geomBean.getMetaObject().setID(-1); geomBean.getMetaObject().forceStatus(MetaObject.NEW); } } } pasteBean.setProperty(VerdisConstants.PROP.FLAECHE.BEMERKUNG, null); pasteBean.setProperty( VerdisConstants.PROP.FLAECHE.FLAECHENBEZEICHNUNG, getValidFlaechenname( (Integer)clipboardBean.getProperty( VerdisConstants.PROP.FLAECHE.FLAECHENINFO + "." + VerdisConstants.PROP.FLAECHENINFO.FLAECHENART + "." + VerdisConstants.PROP.FLAECHENART.ID), targetBeansCollection)); final Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, 1); final SimpleDateFormat vDat = new SimpleDateFormat("yy/MM"); pasteBean.setProperty(VerdisConstants.PROP.FLAECHE.DATUM_VERANLAGUNG, vDat.format(cal.getTime())); pasteBean.setProperty( VerdisConstants.PROP.FLAECHE.DATUM_AENDERUNG, new java.sql.Date(Calendar.getInstance().getTime().getTime())); final int id = RegenFlaechenTable.getNextNewBeanId(); pasteBean.setProperty(VerdisConstants.PROP.FLAECHE.ID, id); pasteBean.getMetaObject().setID(id); pasteBean.getMetaObject().forceStatus(MetaObject.NEW); return pasteBean; }
static CidsBean function(final CidsBean clipboardBean, final Collection<CidsBean> targetBeansCollection, final boolean crossreference) throws Exception { final CidsBean pasteBean = CidsBeanSupport.deepcloneCidsBean(clipboardBean); if (!crossreference) { final CidsBean flaecheInfo = (CidsBean)pasteBean.getProperty(VerdisConstants.PROP.FLAECHE.FLAECHENINFO); if (flaecheInfo != null) { flaecheInfo.setProperty("id", -1); flaecheInfo.getMetaObject().setID(-1); flaecheInfo.getMetaObject().forceStatus(MetaObject.NEW); final CidsBean geomBean = (CidsBean)flaecheInfo.getProperty( VerdisConstants.PROP.FLAECHENINFO.GEOMETRIE); if (geomBean != null) { geomBean.setProperty("id", -1); geomBean.getMetaObject().setID(-1); geomBean.getMetaObject().forceStatus(MetaObject.NEW); } } } pasteBean.setProperty(VerdisConstants.PROP.FLAECHE.BEMERKUNG, null); pasteBean.setProperty( VerdisConstants.PROP.FLAECHE.FLAECHENBEZEICHNUNG, getValidFlaechenname( (Integer)clipboardBean.getProperty( VerdisConstants.PROP.FLAECHE.FLAECHENINFO + "." + VerdisConstants.PROP.FLAECHENINFO.FLAECHENART + "." + VerdisConstants.PROP.FLAECHENART.ID), targetBeansCollection)); final Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, 1); final SimpleDateFormat vDat = new SimpleDateFormat("yy/MM"); pasteBean.setProperty(VerdisConstants.PROP.FLAECHE.DATUM_VERANLAGUNG, vDat.format(cal.getTime())); pasteBean.setProperty( VerdisConstants.PROP.FLAECHE.DATUM_AENDERUNG, new java.sql.Date(Calendar.getInstance().getTime().getTime())); final int id = RegenFlaechenTable.getNextNewBeanId(); pasteBean.setProperty(VerdisConstants.PROP.FLAECHE.ID, id); pasteBean.getMetaObject().setID(id); pasteBean.getMetaObject().forceStatus(MetaObject.NEW); return pasteBean; }
/** * DOCUMENT ME! * * @param clipboardBean DOCUMENT ME! * @param targetBeansCollection DOCUMENT ME! * @param crossreference DOCUMENT ME! * * @return DOCUMENT ME! * * @throws Exception DOCUMENT ME! */
DOCUMENT ME
createPastedFlaecheBean
{ "repo_name": "cismet/verdis", "path": "src/main/java/de/cismet/cids/custom/util/VerdisUtils.java", "license": "gpl-3.0", "size": 13489 }
[ "de.cismet.cids.dynamics.CidsBean", "de.cismet.verdis.commons.constants.VerdisConstants", "de.cismet.verdis.gui.regenflaechen.RegenFlaechenTable", "java.sql.Date", "java.text.SimpleDateFormat", "java.util.Calendar", "java.util.Collection" ]
import de.cismet.cids.dynamics.CidsBean; import de.cismet.verdis.commons.constants.VerdisConstants; import de.cismet.verdis.gui.regenflaechen.RegenFlaechenTable; import java.sql.Date; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Collection;
import de.cismet.cids.dynamics.*; import de.cismet.verdis.commons.constants.*; import de.cismet.verdis.gui.regenflaechen.*; import java.sql.*; import java.text.*; import java.util.*;
[ "de.cismet.cids", "de.cismet.verdis", "java.sql", "java.text", "java.util" ]
de.cismet.cids; de.cismet.verdis; java.sql; java.text; java.util;
2,653,113
private static boolean processFtypAtom(ParsableByteArray atomData) { atomData.setPosition(Atom.HEADER_SIZE); int majorBrand = atomData.readInt(); if (majorBrand == BRAND_QUICKTIME) { return true; } atomData.skipBytes(4); // minor_version while (atomData.bytesLeft() > 0) { if (atomData.readInt() == BRAND_QUICKTIME) { return true; } } return false; }
static boolean function(ParsableByteArray atomData) { atomData.setPosition(Atom.HEADER_SIZE); int majorBrand = atomData.readInt(); if (majorBrand == BRAND_QUICKTIME) { return true; } atomData.skipBytes(4); while (atomData.bytesLeft() > 0) { if (atomData.readInt() == BRAND_QUICKTIME) { return true; } } return false; }
/** * Process an ftyp atom to determine whether the media is QuickTime. * * @param atomData The ftyp atom data. * @return Whether the media is QuickTime. */
Process an ftyp atom to determine whether the media is QuickTime
processFtypAtom
{ "repo_name": "Blaez/ZiosGram", "path": "TMessagesProj/src/main/java/org/telegram/messenger/exoplayer2/extractor/mp4/Mp4Extractor.java", "license": "gpl-2.0", "size": 19250 }
[ "org.blaez.ziosgram.exoplayer2.util.ParsableByteArray" ]
import org.blaez.ziosgram.exoplayer2.util.ParsableByteArray;
import org.blaez.ziosgram.exoplayer2.util.*;
[ "org.blaez.ziosgram" ]
org.blaez.ziosgram;
355,467
public static <T> void writeArray(ObjectOutput out, T[] arr) throws IOException { int len = arr == null ? 0 : arr.length; out.writeInt(len); if (arr != null && arr.length > 0) for (T t : arr) out.writeObject(t); }
static <T> void function(ObjectOutput out, T[] arr) throws IOException { int len = arr == null ? 0 : arr.length; out.writeInt(len); if (arr != null && arr.length > 0) for (T t : arr) out.writeObject(t); }
/** * Writes array to output stream. * * @param out Output stream. * @param arr Array to write. * @param <T> Array type. * @throws IOException If failed. */
Writes array to output stream
writeArray
{ "repo_name": "NSAmelchev/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 388551 }
[ "java.io.IOException", "java.io.ObjectOutput" ]
import java.io.IOException; import java.io.ObjectOutput;
import java.io.*;
[ "java.io" ]
java.io;
1,549,592
// @Test public void testGetSeed() { Long result = instance.getSeed(); assertEquals(seed, result); }
void function() { Long result = instance.getSeed(); assertEquals(seed, result); }
/** * Test of getSeed method, of class BenchmarkRunner. */
Test of getSeed method, of class BenchmarkRunner
testGetSeed
{ "repo_name": "AKSW/DL-Learning-Benchmark", "path": "src/test/java/org/aksw/mlbenchmark/BenchmarkRunnerTest.java", "license": "apache-2.0", "size": 13535 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,972,211
protected UsedAxis getUsedAxis() { try { PdcBm pdc = getPdcBm(); UsedAxis usedAxis = pdc.getUsedAxis(getAxisId()); AxisHeader axisHeader = pdc.getAxisHeader(getAxisId()); usedAxis._setAxisHeader(axisHeader); usedAxis._setAxisName(axisHeader.getName()); return usedAxis; } catch (PdcException ex) { throw new PdcRuntimeException(getClass().getSimpleName() + ".getUsedAxis()", SilverpeasException.ERROR, ex.getMessage(), ex); } }
UsedAxis function() { try { PdcBm pdc = getPdcBm(); UsedAxis usedAxis = pdc.getUsedAxis(getAxisId()); AxisHeader axisHeader = pdc.getAxisHeader(getAxisId()); usedAxis._setAxisHeader(axisHeader); usedAxis._setAxisName(axisHeader.getName()); return usedAxis; } catch (PdcException ex) { throw new PdcRuntimeException(getClass().getSimpleName() + STR, SilverpeasException.ERROR, ex.getMessage(), ex); } }
/** * Gets the axis to which this value belongs to and that is used to classify contents on the PdC. * * @return a PdC axis configured to be used in the classification of contents. */
Gets the axis to which this value belongs to and that is used to classify contents on the PdC
getUsedAxis
{ "repo_name": "stephaneperry/Silverpeas-Core", "path": "ejb-core/pdc/src/main/java/com/silverpeas/pdc/model/PdcAxisValue.java", "license": "agpl-3.0", "size": 14676 }
[ "com.stratelia.silverpeas.pdc.control.PdcBm", "com.stratelia.silverpeas.pdc.model.AxisHeader", "com.stratelia.silverpeas.pdc.model.PdcException", "com.stratelia.silverpeas.pdc.model.PdcRuntimeException", "com.stratelia.silverpeas.pdc.model.UsedAxis", "com.stratelia.webactiv.util.exception.SilverpeasExcept...
import com.stratelia.silverpeas.pdc.control.PdcBm; import com.stratelia.silverpeas.pdc.model.AxisHeader; import com.stratelia.silverpeas.pdc.model.PdcException; import com.stratelia.silverpeas.pdc.model.PdcRuntimeException; import com.stratelia.silverpeas.pdc.model.UsedAxis; import com.stratelia.webactiv.util.exception.SilverpeasException;
import com.stratelia.silverpeas.pdc.control.*; import com.stratelia.silverpeas.pdc.model.*; import com.stratelia.webactiv.util.exception.*;
[ "com.stratelia.silverpeas", "com.stratelia.webactiv" ]
com.stratelia.silverpeas; com.stratelia.webactiv;
1,443,096
public static Factory getInstance(Class classToInstantiate, Class[] paramTypes, Object[] args) { if (classToInstantiate == null) { throw new IllegalArgumentException("Class to instantiate must not be null"); } if (((paramTypes == null) && (args != null)) || ((paramTypes != null) && (args == null)) || ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException("Parameter types must match the arguments"); } if (paramTypes == null || paramTypes.length == 0) { return new InstantiateFactory(classToInstantiate); } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); return new InstantiateFactory(classToInstantiate, paramTypes, args); } } public InstantiateFactory(Class classToInstantiate) { super(); iClassToInstantiate = classToInstantiate; iParamTypes = null; iArgs = null; findConstructor(); } public InstantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) { super(); iClassToInstantiate = classToInstantiate; iParamTypes = paramTypes; iArgs = args; findConstructor(); }
static Factory function(Class classToInstantiate, Class[] paramTypes, Object[] args) { if (classToInstantiate == null) { throw new IllegalArgumentException(STR); } if (((paramTypes == null) && (args != null)) ((paramTypes != null) && (args == null)) ((paramTypes != null) && (args != null) && (paramTypes.length != args.length))) { throw new IllegalArgumentException(STR); } if (paramTypes == null paramTypes.length == 0) { return new InstantiateFactory(classToInstantiate); } else { paramTypes = (Class[]) paramTypes.clone(); args = (Object[]) args.clone(); return new InstantiateFactory(classToInstantiate, paramTypes, args); } } public InstantiateFactory(Class classToInstantiate) { super(); iClassToInstantiate = classToInstantiate; iParamTypes = null; iArgs = null; findConstructor(); } public InstantiateFactory(Class classToInstantiate, Class[] paramTypes, Object[] args) { super(); iClassToInstantiate = classToInstantiate; iParamTypes = paramTypes; iArgs = args; findConstructor(); }
/** * Factory method that performs validation. * * @param classToInstantiate the class to instantiate, not null * @param paramTypes the constructor parameter types * @param args the constructor arguments * @return a new instantiate factory */
Factory method that performs validation
getInstance
{ "repo_name": "stefandmn/AREasy", "path": "src/java/org/areasy/common/data/workers/functors/InstantiateFactory.java", "license": "lgpl-3.0", "size": 4522 }
[ "org.areasy.common.data.type.Factory" ]
import org.areasy.common.data.type.Factory;
import org.areasy.common.data.type.*;
[ "org.areasy.common" ]
org.areasy.common;
2,110,705
private void voidAllergy(Allergy allergy) { allergy.setVoided(true); allergy.setVoidedBy(Context.getAuthenticatedUser()); allergy.setDateVoided(new Date()); allergy.setVoidReason("Voided by API"); dao.saveAllergy(allergy); }
void function(Allergy allergy) { allergy.setVoided(true); allergy.setVoidedBy(Context.getAuthenticatedUser()); allergy.setDateVoided(new Date()); allergy.setVoidReason(STR); dao.saveAllergy(allergy); }
/** * Voids a given allergy * * @param allergy the allergy to void */
Voids a given allergy
voidAllergy
{ "repo_name": "koskedk/openmrs-core", "path": "api/src/main/java/org/openmrs/api/impl/PatientServiceImpl.java", "license": "mpl-2.0", "size": 59493 }
[ "java.util.Date", "org.openmrs.Allergy", "org.openmrs.api.context.Context" ]
import java.util.Date; import org.openmrs.Allergy; import org.openmrs.api.context.Context;
import java.util.*; import org.openmrs.*; import org.openmrs.api.context.*;
[ "java.util", "org.openmrs", "org.openmrs.api" ]
java.util; org.openmrs; org.openmrs.api;
1,020,925
public void setTweetActionsEnabled(boolean enabled) { tweetActionsEnabled = enabled; if (tweetActionsEnabled) { tweetActionBarView.setVisibility(View.VISIBLE); } else { tweetActionBarView.setVisibility(View.GONE); } }
void function(boolean enabled) { tweetActionsEnabled = enabled; if (tweetActionsEnabled) { tweetActionBarView.setVisibility(View.VISIBLE); } else { tweetActionBarView.setVisibility(View.GONE); } }
/** * Enable or disable Tweet actions * @param enabled True to enable Tweet actions, false otherwise. */
Enable or disable Tweet actions
setTweetActionsEnabled
{ "repo_name": "rcastro78/twitter-kit-android", "path": "tweet-ui/src/main/java/com/twitter/sdk/android/tweetui/BaseTweetView.java", "license": "apache-2.0", "size": 32186 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
952,528
public static ims.ocrr.vo.RoleDisciplineSecurityLevelLiteVo insert(DomainObjectMap map, ims.ocrr.vo.RoleDisciplineSecurityLevelLiteVo valueObject, ims.ocrr.configuration.domain.objects.RoleDisciplineSecurityLevel domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_RoleDisciplineSecurityLevel(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); // If this is a recordedInError record, and the domainObject // value isIncludeRecord has not been set, then we return null and // not the value object if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; // If this is not a recordedInError record, and the domainObject // value isIncludeRecord has been set, then we return null and // not the value object if ((valueObject.getIsRIE() == null || valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; // Role if (domainObject.getRole() != null) { if(domainObject.getRole() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the id already. { HibernateProxy p = (HibernateProxy) domainObject.getRole(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setRole(new ims.core.configuration.vo.AppRoleRefVo(id, -1)); } else { valueObject.setRole(new ims.core.configuration.vo.AppRoleRefVo(domainObject.getRole().getId(), domainObject.getRole().getVersion())); } } // Service if (domainObject.getService() != null) { if(domainObject.getService() instanceof HibernateProxy) // If the proxy is set, there is no need to lazy load, the proxy knows the id already. { HibernateProxy p = (HibernateProxy) domainObject.getService(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setService(new ims.core.clinical.vo.ServiceRefVo(id, -1)); } else { valueObject.setService(new ims.core.clinical.vo.ServiceRefVo(domainObject.getService().getId(), domainObject.getService().getVersion())); } } // OrderingSecurityLevel valueObject.setOrderingSecurityLevel(ims.ocrr.vo.domain.SecurityLevelConfigVoAssembler.create(map, domainObject.getOrderingSecurityLevel()) ); // ViewingSecurityLevel valueObject.setViewingSecurityLevel(ims.ocrr.vo.domain.SecurityLevelConfigVoAssembler.create(map, domainObject.getViewingSecurityLevel()) ); return valueObject; }
static ims.ocrr.vo.RoleDisciplineSecurityLevelLiteVo function(DomainObjectMap map, ims.ocrr.vo.RoleDisciplineSecurityLevelLiteVo valueObject, ims.ocrr.configuration.domain.objects.RoleDisciplineSecurityLevel domainObject) { if (null == domainObject) { return valueObject; } if (null == map) { map = new DomainObjectMap(); } valueObject.setID_RoleDisciplineSecurityLevel(domainObject.getId()); valueObject.setIsRIE(domainObject.getIsRIE()); if (valueObject.getIsRIE() != null && valueObject.getIsRIE().booleanValue() == true && !domainObject.isIncludeRecord()) return null; if ((valueObject.getIsRIE() == null valueObject.getIsRIE().booleanValue() == false) && domainObject.isIncludeRecord()) return null; if (domainObject.getRole() != null) { if(domainObject.getRole() instanceof HibernateProxy) { HibernateProxy p = (HibernateProxy) domainObject.getRole(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setRole(new ims.core.configuration.vo.AppRoleRefVo(id, -1)); } else { valueObject.setRole(new ims.core.configuration.vo.AppRoleRefVo(domainObject.getRole().getId(), domainObject.getRole().getVersion())); } } if (domainObject.getService() != null) { if(domainObject.getService() instanceof HibernateProxy) { HibernateProxy p = (HibernateProxy) domainObject.getService(); int id = Integer.parseInt(p.getHibernateLazyInitializer().getIdentifier().toString()); valueObject.setService(new ims.core.clinical.vo.ServiceRefVo(id, -1)); } else { valueObject.setService(new ims.core.clinical.vo.ServiceRefVo(domainObject.getService().getId(), domainObject.getService().getVersion())); } } valueObject.setOrderingSecurityLevel(ims.ocrr.vo.domain.SecurityLevelConfigVoAssembler.create(map, domainObject.getOrderingSecurityLevel()) ); valueObject.setViewingSecurityLevel(ims.ocrr.vo.domain.SecurityLevelConfigVoAssembler.create(map, domainObject.getViewingSecurityLevel()) ); return valueObject; }
/** * Update the ValueObject with the Domain Object. * @param map DomainObjectMap of DomainObjects to already created ValueObjects. * @param valueObject to be updated * @param domainObject ims.ocrr.configuration.domain.objects.RoleDisciplineSecurityLevel */
Update the ValueObject with the Domain Object
insert
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/RoleDisciplineSecurityLevelLiteVoAssembler.java", "license": "agpl-3.0", "size": 21527 }
[ "org.hibernate.proxy.HibernateProxy" ]
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.*;
[ "org.hibernate.proxy" ]
org.hibernate.proxy;
2,491,124
@Override public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { xTile = par1NBTTagCompound.getShort("xTile"); yTile = par1NBTTagCompound.getShort("yTile"); zTile = par1NBTTagCompound.getShort("zTile"); inTile = par1NBTTagCompound.getByte("inTile") & 255; inData = par1NBTTagCompound.getByte("inData") & 255; inGround = par1NBTTagCompound.getByte("inGround") == 1; blocksBroken = par1NBTTagCompound.getInteger("blocksBroken"); isSilkTouch = par1NBTTagCompound.getBoolean("isSilkTouch"); NBTTagList tagList = par1NBTTagCompound.getTagList("Effects", Constants.NBT.TAG_COMPOUND); List<SpellEffect> spellEffectList = new LinkedList(); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); SpellEffect eff = SpellEffect.getEffectFromTag(tag); if (eff != null) { spellEffectList.add(eff); } } this.spellEffectList = spellEffectList; // this.effectList = new LinkedList(); // for (int i = 0; i < tagList.tagCount(); i++) // { // NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); // // this.effectList.add(tag.getString("Class")); // } //SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList); SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForEffectArray(spellEffectList); parad.applyAllSpellEffects(); parad.prepareProjectile(this); }
void function(NBTTagCompound par1NBTTagCompound) { xTile = par1NBTTagCompound.getShort("xTile"); yTile = par1NBTTagCompound.getShort("yTile"); zTile = par1NBTTagCompound.getShort("zTile"); inTile = par1NBTTagCompound.getByte(STR) & 255; inData = par1NBTTagCompound.getByte(STR) & 255; inGround = par1NBTTagCompound.getByte(STR) == 1; blocksBroken = par1NBTTagCompound.getInteger(STR); isSilkTouch = par1NBTTagCompound.getBoolean(STR); NBTTagList tagList = par1NBTTagCompound.getTagList(STR, Constants.NBT.TAG_COMPOUND); List<SpellEffect> spellEffectList = new LinkedList(); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); SpellEffect eff = SpellEffect.getEffectFromTag(tag); if (eff != null) { spellEffectList.add(eff); } } this.spellEffectList = spellEffectList; SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForEffectArray(spellEffectList); parad.applyAllSpellEffects(); parad.prepareProjectile(this); }
/** * (abstract) Protected helper method to read subclass entity data from NBT. */
(abstract) Protected helper method to read subclass entity data from NBT
readEntityFromNBT
{ "repo_name": "Katalliaan/Rubedo", "path": "src/main/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java", "license": "gpl-2.0", "size": 21098 }
[ "java.util.LinkedList", "java.util.List", "net.minecraft.nbt.NBTTagCompound", "net.minecraft.nbt.NBTTagList", "net.minecraftforge.common.util.Constants" ]
import java.util.LinkedList; import java.util.List; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraftforge.common.util.Constants;
import java.util.*; import net.minecraft.nbt.*; import net.minecraftforge.common.util.*;
[ "java.util", "net.minecraft.nbt", "net.minecraftforge.common" ]
java.util; net.minecraft.nbt; net.minecraftforge.common;
137,932
private Options createPrintOpts(Options commandOpts) { Options printOpts = new Options(); printOpts.addOption(commandOpts.getOption(HELP_CMD)); printOpts.addOption(commandOpts.getOption(CONTAINER_ID_OPTION)); printOpts.addOption(commandOpts.getOption(CLUSTER_ID_OPTION)); printOpts.addOption(commandOpts.getOption(NODE_ADDRESS_OPTION)); printOpts.addOption(commandOpts.getOption(APP_OWNER_OPTION)); printOpts.addOption(commandOpts.getOption(AM_CONTAINER_OPTION)); printOpts.addOption(commandOpts.getOption(PER_CONTAINER_LOG_FILES_OPTION)); printOpts.addOption(commandOpts.getOption(LIST_NODES_OPTION)); printOpts.addOption(commandOpts.getOption(SHOW_APPLICATION_LOG_INFO)); printOpts.addOption(commandOpts.getOption(SHOW_CONTAINER_LOG_INFO)); printOpts.addOption(commandOpts.getOption(OUT_OPTION)); printOpts.addOption(commandOpts.getOption(SIZE_OPTION)); printOpts.addOption(commandOpts.getOption( PER_CONTAINER_LOG_FILES_REGEX_OPTION)); printOpts.addOption(commandOpts.getOption(CLIENT_MAX_RETRY_OPTION)); printOpts.addOption(commandOpts.getOption(CLIENT_RETRY_INTERVAL_OPTION)); printOpts.addOption(commandOpts.getOption(SIZE_LIMIT_OPTION)); return printOpts; }
Options function(Options commandOpts) { Options printOpts = new Options(); printOpts.addOption(commandOpts.getOption(HELP_CMD)); printOpts.addOption(commandOpts.getOption(CONTAINER_ID_OPTION)); printOpts.addOption(commandOpts.getOption(CLUSTER_ID_OPTION)); printOpts.addOption(commandOpts.getOption(NODE_ADDRESS_OPTION)); printOpts.addOption(commandOpts.getOption(APP_OWNER_OPTION)); printOpts.addOption(commandOpts.getOption(AM_CONTAINER_OPTION)); printOpts.addOption(commandOpts.getOption(PER_CONTAINER_LOG_FILES_OPTION)); printOpts.addOption(commandOpts.getOption(LIST_NODES_OPTION)); printOpts.addOption(commandOpts.getOption(SHOW_APPLICATION_LOG_INFO)); printOpts.addOption(commandOpts.getOption(SHOW_CONTAINER_LOG_INFO)); printOpts.addOption(commandOpts.getOption(OUT_OPTION)); printOpts.addOption(commandOpts.getOption(SIZE_OPTION)); printOpts.addOption(commandOpts.getOption( PER_CONTAINER_LOG_FILES_REGEX_OPTION)); printOpts.addOption(commandOpts.getOption(CLIENT_MAX_RETRY_OPTION)); printOpts.addOption(commandOpts.getOption(CLIENT_RETRY_INTERVAL_OPTION)); printOpts.addOption(commandOpts.getOption(SIZE_LIMIT_OPTION)); return printOpts; }
/** * Create Print options for helper message. * @param commandOpts the options * @return the print options */
Create Print options for helper message
createPrintOpts
{ "repo_name": "JingchengDu/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/LogsCLI.java", "license": "apache-2.0", "size": 69160 }
[ "org.apache.commons.cli.Options" ]
import org.apache.commons.cli.Options;
import org.apache.commons.cli.*;
[ "org.apache.commons" ]
org.apache.commons;
1,001,525
public void dragEnter(DropTargetEvent event) { expandBeginTime = 0; expandItem = null; scrollBeginTime = 0; scrollItem = null; insertCell = null; selectedCell = null; }
void function(DropTargetEvent event) { expandBeginTime = 0; expandItem = null; scrollBeginTime = 0; scrollItem = null; insertCell = null; selectedCell = null; }
/** * This implementation of <code>dragEnter</code> provides a default drag under effect * for the feedback specified in <code>event.feedback</code>. * * For additional information see <code>DropTargetAdapter.dragEnter</code>. * * Subclasses that override this method should call <code>super.dragEnter(event)</code> * to get the default drag under effect implementation. * * @param event the information associated with the drag enter event * * @see DropTargetAdapter * @see DropTargetEvent */
This implementation of <code>dragEnter</code> provides a default drag under effect for the feedback specified in <code>event.feedback</code>. For additional information see <code>DropTargetAdapter.dragEnter</code>. Subclasses that override this method should call <code>super.dragEnter(event)</code> to get the default drag under effect implementation
dragEnter
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "thirdparty/plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDropTargetEffect.java", "license": "epl-1.0", "size": 9979 }
[ "org.eclipse.swt.dnd.DropTargetEvent" ]
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,681,253
public NbtBase<?> getTag() { return handle.getNbtModifier().read(0); }
NbtBase<?> function() { return handle.getNbtModifier().read(0); }
/** * Retrieve Tag. * @return The current Tag */
Retrieve Tag
getTag
{ "repo_name": "pekomiya/AirRide", "path": "src/main/java/com/comphenix/packetwrapper/WrapperPlayServerUpdateEntityNbt.java", "license": "lgpl-3.0", "size": 2733 }
[ "com.comphenix.protocol.wrappers.nbt.NbtBase" ]
import com.comphenix.protocol.wrappers.nbt.NbtBase;
import com.comphenix.protocol.wrappers.nbt.*;
[ "com.comphenix.protocol" ]
com.comphenix.protocol;
1,449,839
private byte[] convertEnvToNative(Map<String, String> env) throws IOException { Map<String, String> realEnv = new TreeMap<>(); realEnv.putAll(env == null ? System.getenv() : env); if (getSystemRoot(realEnv) == null) { // Some versions of MSVCRT.DLL require SystemRoot to be set. It's quite a common library to // link in, so we add this environment variable regardless of whether the caller requested // it or not. String systemRoot = getSystemRoot(System.getenv()); if (systemRoot != null) { realEnv.put("SystemRoot", systemRoot); } } if (realEnv.isEmpty()) { // Special case: CreateProcess() always expects the environment block to be terminated // with two zeros. return new byte[] { 0, 0, }; } StringBuilder result = new StringBuilder(); for (Map.Entry<String, String> entry : realEnv.entrySet()) { if (entry.getKey().contains("=")) { // lpEnvironment requires no '=' in environment variable name, but on Windows, // System.getenv() returns environment variables like '=C:' or '=ExitCode', so it can't // be an error, we have ignore them here. continue; } result.append(entry.getKey() + "=" + entry.getValue() + "\0"); } result.append("\0"); return result.toString().getBytes(Charsets.UTF_8); }
byte[] function(Map<String, String> env) throws IOException { Map<String, String> realEnv = new TreeMap<>(); realEnv.putAll(env == null ? System.getenv() : env); if (getSystemRoot(realEnv) == null) { String systemRoot = getSystemRoot(System.getenv()); if (systemRoot != null) { realEnv.put(STR, systemRoot); } } if (realEnv.isEmpty()) { return new byte[] { 0, 0, }; } StringBuilder result = new StringBuilder(); for (Map.Entry<String, String> entry : realEnv.entrySet()) { if (entry.getKey().contains("=")) { continue; } result.append(entry.getKey() + "=" + entry.getValue() + "\0"); } result.append("\0"); return result.toString().getBytes(Charsets.UTF_8); }
/** * Converts an environment map to the format expected in lpEnvironment by CreateProcess(). */
Converts an environment map to the format expected in lpEnvironment by CreateProcess()
convertEnvToNative
{ "repo_name": "mikelikespie/bazel", "path": "src/main/java/com/google/devtools/build/lib/windows/WindowsSubprocessFactory.java", "license": "apache-2.0", "size": 4375 }
[ "com.google.common.base.Charsets", "java.io.IOException", "java.util.Map", "java.util.TreeMap" ]
import com.google.common.base.Charsets; import java.io.IOException; import java.util.Map; import java.util.TreeMap;
import com.google.common.base.*; import java.io.*; import java.util.*;
[ "com.google.common", "java.io", "java.util" ]
com.google.common; java.io; java.util;
2,593,175
public String getRawValue(String templateExternalId, String recordExternalId, String fieldName) throws FormException { Connection con = null; try { con = getConnection(); return selectRecordFieldsRow(con, templateExternalId, recordExternalId, fieldName); } catch (SQLException e) { throw new FormException("GenericRecordSetManager.getRawValues", "form.EXP_INSERT_FAILED", "templateExternalId : " + templateExternalId + ", recordExternalId : " + recordExternalId, e); } finally { closeConnection(con); } }
String function(String templateExternalId, String recordExternalId, String fieldName) throws FormException { Connection con = null; try { con = getConnection(); return selectRecordFieldsRow(con, templateExternalId, recordExternalId, fieldName); } catch (SQLException e) { throw new FormException(STR, STR, STR + templateExternalId + STR + recordExternalId, e); } finally { closeConnection(con); } }
/** * Get value of a field record directly from database. * @param templateExternalId template external id * @param recordExternalId record external id * @param fieldName field name * @return the field record value * @throws FormException */
Get value of a field record directly from database
getRawValue
{ "repo_name": "auroreallibe/Silverpeas-Core", "path": "core-library/src/main/java/org/silverpeas/core/contribution/content/form/record/GenericRecordSetManager.java", "license": "agpl-3.0", "size": 41104 }
[ "java.sql.Connection", "java.sql.SQLException", "org.silverpeas.core.contribution.content.form.FormException" ]
import java.sql.Connection; import java.sql.SQLException; import org.silverpeas.core.contribution.content.form.FormException;
import java.sql.*; import org.silverpeas.core.contribution.content.form.*;
[ "java.sql", "org.silverpeas.core" ]
java.sql; org.silverpeas.core;
1,137,902
public static void cleanUpOldCache2(Context context) { try { File dir = context.getCacheDir(); File[] files = dir.listFiles(); if (files == null) return; Pattern oldCachePattern = Pattern.compile("^[0-9-]+$"); for (File f : files) { if ( (!f.isDirectory()) && (oldCachePattern.matcher(f.getName()).matches())) { f.delete(); } } } catch (Exception e) { android.util.Log.e(FileCache.class.getName(), "exception cleaning up legacy cache", e); } }
static void function(Context context) { try { File dir = context.getCacheDir(); File[] files = dir.listFiles(); if (files == null) return; Pattern oldCachePattern = Pattern.compile(STR); for (File f : files) { if ( (!f.isDirectory()) && (oldCachePattern.matcher(f.getName()).matches())) { f.delete(); } } } catch (Exception e) { android.util.Log.e(FileCache.class.getName(), STR, e); } }
/** * Looks for and cleans up any remains of the old caching system that used poor filenames. */
Looks for and cleans up any remains of the old caching system that used poor filenames
cleanUpOldCache2
{ "repo_name": "samuelclay/NewsBlur", "path": "clients/android/NewsBlur/src/com/newsblur/util/FileCache.java", "license": "mit", "size": 7517 }
[ "android.content.Context", "android.util.Log", "java.io.File", "java.util.regex.Pattern" ]
import android.content.Context; import android.util.Log; import java.io.File; import java.util.regex.Pattern;
import android.content.*; import android.util.*; import java.io.*; import java.util.regex.*;
[ "android.content", "android.util", "java.io", "java.util" ]
android.content; android.util; java.io; java.util;
117,790
@NonNull public AboutBuilder addAction(Bitmap icon, String label, Uri uri) { return addAction(icon, label, util.clickUri(uri)); }
AboutBuilder function(Bitmap icon, String label, Uri uri) { return addAction(icon, label, util.clickUri(uri)); }
/** * Adds an action button on the actions section. * * @param icon the action icon * @param label the action title * @param uri the action uri * @return the same {@link AboutBuilder} instance */
Adds an action button on the actions section
addAction
{ "repo_name": "carvaldo/MaterialAbout", "path": "library/src/main/java/com/vansuita/materialabout/builder/AboutBuilder.java", "license": "mit", "size": 61220 }
[ "android.graphics.Bitmap", "android.net.Uri" ]
import android.graphics.Bitmap; import android.net.Uri;
import android.graphics.*; import android.net.*;
[ "android.graphics", "android.net" ]
android.graphics; android.net;
1,679,251
Artifact create(PathFragment rootRelativePath, Root root); }
Artifact create(PathFragment rootRelativePath, Root root); }
/** * Create an artifact with the specified root-relative path under the specified root. */
Create an artifact with the specified root-relative path under the specified root
create
{ "repo_name": "anupcshan/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java", "license": "apache-2.0", "size": 39638 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.actions.Root", "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.Root; import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
564,845
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ContainerServiceInner> listByResourceGroup(String resourceGroupName);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ContainerServiceInner> listByResourceGroup(String resourceGroupName);
/** * Gets a list of container services in the specified subscription and resource group. The operation returns * properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of * masters and agents. * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of container services in the specified subscription and resource group. */
Gets a list of container services in the specified subscription and resource group. The operation returns properties of each container service including state, orchestrator, number of masters and agents, and FQDNs of masters and agents
listByResourceGroup
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/ContainerServicesClient.java", "license": "mit", "size": 24733 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.compute.fluent.models.ContainerServiceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.compute.fluent.models.ContainerServiceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.compute.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
328,739
PlasticProxyFactory getProxyFactory();
PlasticProxyFactory getProxyFactory();
/** * Returns a proxy factory that can be used to generate additional classes around enhanced classes, or create * subclasses of enhanced classes. * * @since 5.3 */
Returns a proxy factory that can be used to generate additional classes around enhanced classes, or create subclasses of enhanced classes
getProxyFactory
{ "repo_name": "agileowl/tapestry-5", "path": "tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentInstantiatorSource.java", "license": "apache-2.0", "size": 3230 }
[ "org.apache.tapestry5.ioc.services.PlasticProxyFactory" ]
import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
import org.apache.tapestry5.ioc.services.*;
[ "org.apache.tapestry5" ]
org.apache.tapestry5;
1,952,633
private PAInterface createObjectController(Class<?> controllerClass) throws Exception { // Instantiate the controller object, setting THIS component as its owner. Constructor<?> controllerClassConstructor = controllerClass .getConstructor(new Class[] { Component.class }); AbstractPAController controller = (AbstractPAController) controllerClassConstructor .newInstance(new Object[] { this }); // Obtains the interface type after having instantiated the object PAGCMInterfaceType controllerItfType = (PAGCMInterfaceType) controller.getFcItfType(); String controllerName = controller.getFcItfName(); // Generates the PAInterface and sets the instantiated object as its implementation PAInterface itfRef = MetaObjectInterfaceClassGenerator.instance().generateInterface(controllerName, this, controllerItfType, controllerItfType.isInternal(), false); itfRef.setFcItfImpl(controller); return itfRef; }
PAInterface function(Class<?> controllerClass) throws Exception { Constructor<?> controllerClassConstructor = controllerClass .getConstructor(new Class[] { Component.class }); AbstractPAController controller = (AbstractPAController) controllerClassConstructor .newInstance(new Object[] { this }); PAGCMInterfaceType controllerItfType = (PAGCMInterfaceType) controller.getFcItfType(); String controllerName = controller.getFcItfName(); PAInterface itfRef = MetaObjectInterfaceClassGenerator.instance().generateInterface(controllerName, this, controllerItfType, controllerItfType.isInternal(), false); itfRef.setFcItfImpl(controller); return itfRef; }
/** * Instantiates an object controller and generates its interface using only the Controller class * (which must implement {@link AbstractPAController}. * * The {@link PAGCMInterfaceType} is obtained from the object after instantiating it. * * @param controllerClass * @return interface generated for the controller */
Instantiates an object controller and generates its interface using only the Controller class (which must implement <code>AbstractPAController</code>. The <code>PAGCMInterfaceType</code> is obtained from the object after instantiating it
createObjectController
{ "repo_name": "nmpgaspar/PainlessProActive", "path": "src/Core/org/objectweb/proactive/core/component/identity/PAComponentImpl.java", "license": "agpl-3.0", "size": 50265 }
[ "java.lang.reflect.Constructor", "org.objectweb.fractal.api.Component", "org.objectweb.proactive.core.component.PAInterface", "org.objectweb.proactive.core.component.control.AbstractPAController", "org.objectweb.proactive.core.component.gen.MetaObjectInterfaceClassGenerator", "org.objectweb.proactive.core...
import java.lang.reflect.Constructor; import org.objectweb.fractal.api.Component; import org.objectweb.proactive.core.component.PAInterface; import org.objectweb.proactive.core.component.control.AbstractPAController; import org.objectweb.proactive.core.component.gen.MetaObjectInterfaceClassGenerator; import org.objectweb.proactive.core.component.type.PAGCMInterfaceType;
import java.lang.reflect.*; import org.objectweb.fractal.api.*; import org.objectweb.proactive.core.component.*; import org.objectweb.proactive.core.component.control.*; import org.objectweb.proactive.core.component.gen.*; import org.objectweb.proactive.core.component.type.*;
[ "java.lang", "org.objectweb.fractal", "org.objectweb.proactive" ]
java.lang; org.objectweb.fractal; org.objectweb.proactive;
1,844,498
List<Member> getAllowedMembers(PerunSession sess, Facility facility) throws InternalErrorException;
List<Member> getAllowedMembers(PerunSession sess, Facility facility) throws InternalErrorException;
/** * Return all members, which are "allowed" on facility. * * @param sess * @param facility * * @return list of allowed members * * @throws InternalErrorException */
Return all members, which are "allowed" on facility
getAllowedMembers
{ "repo_name": "licehammer/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/FacilitiesManagerImplApi.java", "license": "bsd-2-clause", "size": 24484 }
[ "cz.metacentrum.perun.core.api.Facility", "cz.metacentrum.perun.core.api.Member", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "java.util.List" ]
import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,269,996
public final boolean onDone(@Nullable R res) { return onDone(res, null); }
final boolean function(@Nullable R res) { return onDone(res, null); }
/** * Callback to notify that future is finished. * This method must delegate to {@link #onDone(Object, Throwable)} method. * * @param res Result. * @return {@code True} if result was set by this call. */
Callback to notify that future is finished. This method must delegate to <code>#onDone(Object, Throwable)</code> method
onDone
{ "repo_name": "apacheignite/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/future/GridFutureAdapter.java", "license": "apache-2.0", "size": 14258 }
[ "org.jetbrains.annotations.Nullable" ]
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
[ "org.jetbrains.annotations" ]
org.jetbrains.annotations;
2,804,364
JSONObject json = new JSONObject(); for (Field field : getClass().getDeclaredFields()) { json.put(field.getName(), getValueFromField(field)); } return json; } /** * Gets the value for the given {@link Field field}, if the {@link Field fields} * value is another instance of an {@link Evalable evalable} object, the * {@link #toEvalableString()} method will be called for that object. * * @param field The field that the value should be retried from. * @return The value of the given field, or {@link JSONObject#NULL null}
JSONObject json = new JSONObject(); for (Field field : getClass().getDeclaredFields()) { json.put(field.getName(), getValueFromField(field)); } return json; } /** * Gets the value for the given {@link Field field}, if the {@link Field fields} * value is another instance of an {@link Evalable evalable} object, the * {@link #toEvalableString()} method will be called for that object. * * @param field The field that the value should be retried from. * @return The value of the given field, or {@link JSONObject#NULL null}
/** * Creates a {@link JSONObject JSON object} out of all the declared fields of the class * instance, if one of the classes extends from the {@link Evalable Evalable class}, * the {@link #toEvalableString()} method will be called for that object and * added onto the main {@link JSONObject JSON object}. * * @return The {@link JSONObject JSON object} with all the names and values * of properties for the current class instance. */
Creates a <code>JSONObject JSON object</code> out of all the declared fields of the class instance, if one of the classes extends from the <code>Evalable Evalable class</code>, the <code>#toEvalableString()</code> method will be called for that object and added onto the main <code>JSONObject JSON object</code>
toEvalableString
{ "repo_name": "AvaIre/AvaIre", "path": "src/main/java/com/avairebot/contracts/debug/EvalAudioEventWrapper.java", "license": "mit", "size": 2950 }
[ "java.lang.reflect.Field", "org.json.JSONObject" ]
import java.lang.reflect.Field; import org.json.JSONObject;
import java.lang.reflect.*; import org.json.*;
[ "java.lang", "org.json" ]
java.lang; org.json;
1,969,283
private ComplexTypeElement buildComplexType(MappingDetail detail, SchemaHolder hold) { // create the type and compositor ComplexTypeElement type = new ComplexTypeElement(); MappingElementBase mapping = detail.getMapping(); MappingElementBase base = detail.getExtensionBase(); if (base == null) { if (detail.isGroup()) { // create type using references to group and/or attributeGroup SequenceElement seq = new SequenceElement(); if (detail.hasChild()) { GroupRefElement gref = new GroupRefElement(); setGroupRef(detail.getOtherName(), gref, hold); seq.getParticleList().add(gref); } type.setContentDefinition(seq); if (detail.hasAttribute()) { AttributeGroupRefElement gref = new AttributeGroupRefElement(); setGroupRef(detail.getOtherName(), gref, hold); type.getAttributeList().add(gref); } } else { // create type directly type.setContentDefinition(buildCompositor(mapping, 0, false, hold)); fillAttributes(mapping, 0, type.getAttributeList(), hold); } } else { // create type as extension of base type MappingDetail basedet = m_detailDirectory.getMappingDetail(base); if (isComplexContent(base) || isComplexContent(mapping)) { // complex extension with complex content ComplexExtensionElement ext = new ComplexExtensionElement(); setComplexExtensionBase(basedet.getTypeName(), ext, hold); CommonCompositorDefinition comp = buildCompositor(mapping, 1, false, hold); if (comp.getParticleList().size() > 0) { ext.setContentDefinition(comp); } fillAttributes(mapping, 0, ext.getAttributeList(), hold); ComplexContentElement cont = new ComplexContentElement(); cont.setDerivation(ext); type.setContentType(cont); } else { // simple extension with simple content SimpleExtensionElement ext = new SimpleExtensionElement(); setSimpleExtensionBase(basedet.getTypeName(), ext, hold); fillAttributes(mapping, 0, ext.getAttributeList(), hold); SimpleContentElement cont = new SimpleContentElement(); cont.setDerivation(ext); type.setContentType(cont); } } return type; }
ComplexTypeElement function(MappingDetail detail, SchemaHolder hold) { ComplexTypeElement type = new ComplexTypeElement(); MappingElementBase mapping = detail.getMapping(); MappingElementBase base = detail.getExtensionBase(); if (base == null) { if (detail.isGroup()) { SequenceElement seq = new SequenceElement(); if (detail.hasChild()) { GroupRefElement gref = new GroupRefElement(); setGroupRef(detail.getOtherName(), gref, hold); seq.getParticleList().add(gref); } type.setContentDefinition(seq); if (detail.hasAttribute()) { AttributeGroupRefElement gref = new AttributeGroupRefElement(); setGroupRef(detail.getOtherName(), gref, hold); type.getAttributeList().add(gref); } } else { type.setContentDefinition(buildCompositor(mapping, 0, false, hold)); fillAttributes(mapping, 0, type.getAttributeList(), hold); } } else { MappingDetail basedet = m_detailDirectory.getMappingDetail(base); if (isComplexContent(base) isComplexContent(mapping)) { ComplexExtensionElement ext = new ComplexExtensionElement(); setComplexExtensionBase(basedet.getTypeName(), ext, hold); CommonCompositorDefinition comp = buildCompositor(mapping, 1, false, hold); if (comp.getParticleList().size() > 0) { ext.setContentDefinition(comp); } fillAttributes(mapping, 0, ext.getAttributeList(), hold); ComplexContentElement cont = new ComplexContentElement(); cont.setDerivation(ext); type.setContentType(cont); } else { SimpleExtensionElement ext = new SimpleExtensionElement(); setSimpleExtensionBase(basedet.getTypeName(), ext, hold); fillAttributes(mapping, 0, ext.getAttributeList(), hold); SimpleContentElement cont = new SimpleContentElement(); cont.setDerivation(ext); type.setContentType(cont); } } return type; }
/** * Build the complex type definition for a mapping. * * @param detail mapping detail * @param hold target schema for definition * @return constructed complex type */
Build the complex type definition for a mapping
buildComplexType
{ "repo_name": "vkorbut/jibx", "path": "jibx/build/src/org/jibx/schema/generator/SchemaGen.java", "license": "bsd-3-clause", "size": 51820 }
[ "org.jibx.binding.model.MappingElementBase", "org.jibx.schema.SchemaHolder", "org.jibx.schema.elements.AttributeGroupRefElement", "org.jibx.schema.elements.CommonCompositorDefinition", "org.jibx.schema.elements.ComplexContentElement", "org.jibx.schema.elements.ComplexExtensionElement", "org.jibx.schema....
import org.jibx.binding.model.MappingElementBase; import org.jibx.schema.SchemaHolder; import org.jibx.schema.elements.AttributeGroupRefElement; import org.jibx.schema.elements.CommonCompositorDefinition; import org.jibx.schema.elements.ComplexContentElement; import org.jibx.schema.elements.ComplexExtensionElement; import org.jibx.schema.elements.ComplexTypeElement; import org.jibx.schema.elements.GroupRefElement; import org.jibx.schema.elements.SequenceElement; import org.jibx.schema.elements.SimpleContentElement; import org.jibx.schema.elements.SimpleExtensionElement;
import org.jibx.binding.model.*; import org.jibx.schema.*; import org.jibx.schema.elements.*;
[ "org.jibx.binding", "org.jibx.schema" ]
org.jibx.binding; org.jibx.schema;
497,466
public final ValueWithPos<String> formatCommonNationalWithPos( final ValueWithPos<PhoneNumberData> pphoneNumberData) { if (pphoneNumberData == null) { return null; } int cursor = pphoneNumberData.getPos(); final StringBuilder resultNumber = new StringBuilder(); if (isPhoneNumberNotEmpty(pphoneNumberData.getValue())) { PhoneCountryData phoneCountryData = null; for (final PhoneCountryCodeData country : CreatePhoneCountryConstantsClass.create() .countryCodeData()) { if (StringUtils.equals(country.getCountryCode(), pphoneNumberData.getValue().getCountryCode())) { phoneCountryData = country.getPhoneCountryData(); break; } } if (phoneCountryData == null) { return null; } if (cursor > 0) { cursor -= StringUtils.length(pphoneNumberData.getValue().getCountryCode()); cursor += StringUtils.length(phoneCountryData.getTrunkCode()); } resultNumber.append(phoneCountryData.getTrunkCode()); if (resultNumber.length() <= cursor) { cursor++; } resultNumber.append(' '); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getAreaCode())) { final ValueWithPos<String> areaCode = this.groupIntoParts( new ValueWithPos<>(pphoneNumberData.getValue().getAreaCode(), cursor), resultNumber.length(), 2); cursor = areaCode.getPos(); resultNumber.append(areaCode.getValue()); } if (resultNumber.length() <= cursor) { cursor += 3; } resultNumber.append(" / "); final ValueWithPos<String> lineNumber = this.groupIntoParts( new ValueWithPos<>(pphoneNumberData.getValue().getLineNumber(), cursor), resultNumber.length(), 2); cursor = lineNumber.getPos(); resultNumber.append(lineNumber.getValue()); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getExtension())) { if (resultNumber.length() <= cursor) { cursor += 3; } resultNumber.append(" - "); final ValueWithPos<String> extension = this.groupIntoParts( new ValueWithPos<>(pphoneNumberData.getValue().getExtension(), cursor), resultNumber.length(), 2); cursor = extension.getPos(); resultNumber.append(extension.getValue()); } } return new ValueWithPos<>(StringUtils.trimToNull(resultNumber.toString()), cursor); }
final ValueWithPos<String> function( final ValueWithPos<PhoneNumberData> pphoneNumberData) { if (pphoneNumberData == null) { return null; } int cursor = pphoneNumberData.getPos(); final StringBuilder resultNumber = new StringBuilder(); if (isPhoneNumberNotEmpty(pphoneNumberData.getValue())) { PhoneCountryData phoneCountryData = null; for (final PhoneCountryCodeData country : CreatePhoneCountryConstantsClass.create() .countryCodeData()) { if (StringUtils.equals(country.getCountryCode(), pphoneNumberData.getValue().getCountryCode())) { phoneCountryData = country.getPhoneCountryData(); break; } } if (phoneCountryData == null) { return null; } if (cursor > 0) { cursor -= StringUtils.length(pphoneNumberData.getValue().getCountryCode()); cursor += StringUtils.length(phoneCountryData.getTrunkCode()); } resultNumber.append(phoneCountryData.getTrunkCode()); if (resultNumber.length() <= cursor) { cursor++; } resultNumber.append(' '); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getAreaCode())) { final ValueWithPos<String> areaCode = this.groupIntoParts( new ValueWithPos<>(pphoneNumberData.getValue().getAreaCode(), cursor), resultNumber.length(), 2); cursor = areaCode.getPos(); resultNumber.append(areaCode.getValue()); } if (resultNumber.length() <= cursor) { cursor += 3; } resultNumber.append(STR); final ValueWithPos<String> lineNumber = this.groupIntoParts( new ValueWithPos<>(pphoneNumberData.getValue().getLineNumber(), cursor), resultNumber.length(), 2); cursor = lineNumber.getPos(); resultNumber.append(lineNumber.getValue()); if (StringUtils.isNotBlank(pphoneNumberData.getValue().getExtension())) { if (resultNumber.length() <= cursor) { cursor += 3; } resultNumber.append(STR); final ValueWithPos<String> extension = this.groupIntoParts( new ValueWithPos<>(pphoneNumberData.getValue().getExtension(), cursor), resultNumber.length(), 2); cursor = extension.getPos(); resultNumber.append(extension.getValue()); } } return new ValueWithPos<>(StringUtils.trimToNull(resultNumber.toString()), cursor); }
/** * format phone number in common national format with cursor position handling. * * @param pphoneNumberData phone number to format with cursor position * @return formated phone number as String with new cursor position */
format phone number in common national format with cursor position handling
formatCommonNationalWithPos
{ "repo_name": "ManfredTremmel/gwt-bean-validators", "path": "mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/util/PhoneNumberUtil.java", "license": "apache-2.0", "size": 76134 }
[ "de.knightsoftnet.validators.server.data.CreatePhoneCountryConstantsClass", "de.knightsoftnet.validators.shared.data.PhoneCountryCodeData", "de.knightsoftnet.validators.shared.data.PhoneCountryData", "de.knightsoftnet.validators.shared.data.PhoneNumberData", "de.knightsoftnet.validators.shared.data.ValueWit...
import de.knightsoftnet.validators.server.data.CreatePhoneCountryConstantsClass; import de.knightsoftnet.validators.shared.data.PhoneCountryCodeData; import de.knightsoftnet.validators.shared.data.PhoneCountryData; import de.knightsoftnet.validators.shared.data.PhoneNumberData; import de.knightsoftnet.validators.shared.data.ValueWithPos; import org.apache.commons.lang3.StringUtils;
import de.knightsoftnet.validators.server.data.*; import de.knightsoftnet.validators.shared.data.*; import org.apache.commons.lang3.*;
[ "de.knightsoftnet.validators", "org.apache.commons" ]
de.knightsoftnet.validators; org.apache.commons;
2,414,526
private Object[] buildEmptyRow() { Object[] rowData = RowDataUtil.allocateRowData( data.outputRowMeta.size() ); return rowData; }
Object[] function() { Object[] rowData = RowDataUtil.allocateRowData( data.outputRowMeta.size() ); return rowData; }
/** * Build an empty row based on the meta-data. * * @return */
Build an empty row based on the meta-data
buildEmptyRow
{ "repo_name": "nicoben/pentaho-kettle", "path": "plugins/salesforce/src/org/pentaho/di/trans/steps/salesforceinput/SalesforceInput.java", "license": "apache-2.0", "size": 15564 }
[ "org.pentaho.di.core.row.RowDataUtil" ]
import org.pentaho.di.core.row.RowDataUtil;
import org.pentaho.di.core.row.*;
[ "org.pentaho.di" ]
org.pentaho.di;
867,740
ChatStateManager manager = INSTANCES.get(connection); if (manager == null) { manager = new ChatStateManager(connection); } return manager; } private final OutgoingMessageInterceptor outgoingInterceptor = new OutgoingMessageInterceptor(); private final IncomingMessageInterceptor incomingInterceptor = new IncomingMessageInterceptor(); private final Map<Chat, ChatState> chatStates = new WeakHashMap<Chat, ChatState>(); private final ChatManager chatManager; private ChatStateManager(XMPPConnection connection) { super(connection); chatManager = ChatManager.getInstanceFor(connection); chatManager.addOutgoingMessageInterceptor(outgoingInterceptor, filter); chatManager.addChatListener(incomingInterceptor); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(NAMESPACE); INSTANCES.put(connection, this); }
ChatStateManager manager = INSTANCES.get(connection); if (manager == null) { manager = new ChatStateManager(connection); } return manager; } private final OutgoingMessageInterceptor outgoingInterceptor = new OutgoingMessageInterceptor(); private final IncomingMessageInterceptor incomingInterceptor = new IncomingMessageInterceptor(); private final Map<Chat, ChatState> chatStates = new WeakHashMap<Chat, ChatState>(); private final ChatManager chatManager; private ChatStateManager(XMPPConnection connection) { super(connection); chatManager = ChatManager.getInstanceFor(connection); chatManager.addOutgoingMessageInterceptor(outgoingInterceptor, filter); chatManager.addChatListener(incomingInterceptor); ServiceDiscoveryManager.getInstanceFor(connection).addFeature(NAMESPACE); INSTANCES.put(connection, this); }
/** * Returns the ChatStateManager related to the XMPPConnection and it will create one if it does * not yet exist. * * @param connection the connection to return the ChatStateManager * @return the ChatStateManager related the the connection. */
Returns the ChatStateManager related to the XMPPConnection and it will create one if it does not yet exist
getInstance
{ "repo_name": "vito-c/Smack", "path": "smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java", "license": "apache-2.0", "size": 6944 }
[ "java.util.Map", "java.util.WeakHashMap", "org.jivesoftware.smack.Chat", "org.jivesoftware.smack.ChatManager", "org.jivesoftware.smack.XMPPConnection", "org.jivesoftware.smackx.disco.ServiceDiscoveryManager" ]
import java.util.Map; import java.util.WeakHashMap; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.ChatManager; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
import java.util.*; import org.jivesoftware.smack.*; import org.jivesoftware.smackx.disco.*;
[ "java.util", "org.jivesoftware.smack", "org.jivesoftware.smackx" ]
java.util; org.jivesoftware.smack; org.jivesoftware.smackx;
372,739
@Override public String getParameterValue( String key ) throws UnknownParamException { return namedParams.getParameterValue( key ); }
String function( String key ) throws UnknownParamException { return namedParams.getParameterValue( key ); }
/** * Gets the value of the specified parameter. * * @param key * the name of the parameter * @return the parameter value * @throws UnknownParamException * if the parameter does not exist * @see org.pentaho.di.core.parameters.NamedParams#getParameterValue(java.lang.String) */
Gets the value of the specified parameter
getParameterValue
{ "repo_name": "mdamour1976/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/Trans.java", "license": "apache-2.0", "size": 199226 }
[ "org.pentaho.di.core.parameters.UnknownParamException" ]
import org.pentaho.di.core.parameters.UnknownParamException;
import org.pentaho.di.core.parameters.*;
[ "org.pentaho.di" ]
org.pentaho.di;
384,313
protected ActiveMQRASession allocateConnection(final int sessionType) throws JMSException { return allocateConnection(false, Session.AUTO_ACKNOWLEDGE, sessionType); }
ActiveMQRASession function(final int sessionType) throws JMSException { return allocateConnection(false, Session.AUTO_ACKNOWLEDGE, sessionType); }
/** * Allocation a connection * * @param sessionType The session type * @return The session * @throws JMSException Thrown if an error occurs */
Allocation a connection
allocateConnection
{ "repo_name": "wildfly/activemq-artemis", "path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java", "license": "apache-2.0", "size": 31257 }
[ "javax.jms.JMSException", "javax.jms.Session" ]
import javax.jms.JMSException; import javax.jms.Session;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,835,316
public void drawSeries(Canvas canvas, Paint paint, float[] points, SimpleSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex, int range) { XYSeriesRenderer renderer = (XYSeriesRenderer) seriesRenderer; paint.setColor(renderer.getColor()); if (renderer.isFillPoints()) { paint.setStyle(Style.FILL); } else { paint.setStyle(Style.STROKE); } int length = points.length; switch (renderer.getPointStyle()) { case X: for (int i = 0; i < length; i += 2) { drawX(canvas, paint, points[i], points[i + 1]); } break; case CIRCLE: for (int i = 0; i < length; i += 2) { drawCircle(canvas, paint, points[i], points[i + 1]); } break; case TRIANGLE: float[] path = new float[6]; for (int i = 0; i < length; i += 2) { drawTriangle(canvas, paint, path, points[i], points[i + 1]); } break; case SQUARE: for (int i = 0; i < length; i += 2) { drawSquare(canvas, paint, points[i], points[i + 1]); } break; case DIAMOND: path = new float[8]; for (int i = 0; i < length; i += 2) { drawDiamond(canvas, paint, path, points[i], points[i + 1]); } break; case POINT: canvas.drawPoints(points, paint); break; } }
void function(Canvas canvas, Paint paint, float[] points, SimpleSeriesRenderer seriesRenderer, float yAxisValue, int seriesIndex, int startIndex, int range) { XYSeriesRenderer renderer = (XYSeriesRenderer) seriesRenderer; paint.setColor(renderer.getColor()); if (renderer.isFillPoints()) { paint.setStyle(Style.FILL); } else { paint.setStyle(Style.STROKE); } int length = points.length; switch (renderer.getPointStyle()) { case X: for (int i = 0; i < length; i += 2) { drawX(canvas, paint, points[i], points[i + 1]); } break; case CIRCLE: for (int i = 0; i < length; i += 2) { drawCircle(canvas, paint, points[i], points[i + 1]); } break; case TRIANGLE: float[] path = new float[6]; for (int i = 0; i < length; i += 2) { drawTriangle(canvas, paint, path, points[i], points[i + 1]); } break; case SQUARE: for (int i = 0; i < length; i += 2) { drawSquare(canvas, paint, points[i], points[i + 1]); } break; case DIAMOND: path = new float[8]; for (int i = 0; i < length; i += 2) { drawDiamond(canvas, paint, path, points[i], points[i + 1]); } break; case POINT: canvas.drawPoints(points, paint); break; } }
/** * The graphical representation of a series. * * @param canvas the canvas to paint to * @param paint the paint to be used for drawing * @param points the array of points to be used for drawing the series * @param seriesRenderer the series renderer * @param yAxisValue the minimum value of the y axis * @param seriesIndex the index of the series currently being drawn * @param startIndex the start index of the rendering points */
The graphical representation of a series
drawSeries
{ "repo_name": "rAntonioh/Anki-Android", "path": "src/org/achartengine/chart/ScatterChart.java", "license": "gpl-3.0", "size": 8926 }
[ "android.graphics.Canvas", "android.graphics.Paint", "org.achartengine.renderer.SimpleSeriesRenderer", "org.achartengine.renderer.XYSeriesRenderer" ]
import android.graphics.Canvas; import android.graphics.Paint; import org.achartengine.renderer.SimpleSeriesRenderer; import org.achartengine.renderer.XYSeriesRenderer;
import android.graphics.*; import org.achartengine.renderer.*;
[ "android.graphics", "org.achartengine.renderer" ]
android.graphics; org.achartengine.renderer;
2,799,658
private JsonBuilder newLine() { if (bMultiLine) { aJson.append('\n'); aJson.append(sCurrentIndent); } return this; } //~ Inner Classes ---------------------------------------------------------- public static class ConvertJson implements InvertibleFunction<Object, String> { //~ Methods ------------------------------------------------------------ /*************************************** * {@inheritDoc}
JsonBuilder function() { if (bMultiLine) { aJson.append('\n'); aJson.append(sCurrentIndent); } return this; } public static class ConvertJson implements InvertibleFunction<Object, String> { /*************************************** * {@inheritDoc}
/*************************************** * Appends a line break to the current JSON string to start a new line. * * @return This instance for concatenation */
Appends a line break to the current JSON string to start a new line
newLine
{ "repo_name": "esoco/objectrelations", "path": "src/main/java/de/esoco/lib/json/JsonBuilder.java", "license": "apache-2.0", "size": 20325 }
[ "de.esoco.lib.expression.InvertibleFunction" ]
import de.esoco.lib.expression.InvertibleFunction;
import de.esoco.lib.expression.*;
[ "de.esoco.lib" ]
de.esoco.lib;
2,673,678
void closeFileIfOpen(FileReference fileRef);
void closeFileIfOpen(FileReference fileRef);
/** * Close the file if open. * * @param fileRef * @throws HyracksDataException */
Close the file if open
closeFileIfOpen
{ "repo_name": "apache/incubator-asterixdb", "path": "hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/buffercache/IBufferCache.java", "license": "apache-2.0", "size": 8882 }
[ "org.apache.hyracks.api.io.FileReference" ]
import org.apache.hyracks.api.io.FileReference;
import org.apache.hyracks.api.io.*;
[ "org.apache.hyracks" ]
org.apache.hyracks;
929,205
@Deprecated public void setBusinessObject(PersistableBusinessObject object);
void function(PersistableBusinessObject object);
/** * Sets an instance of a business object to be maintained. */
Sets an instance of a business object to be maintained
setBusinessObject
{ "repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua", "path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/maintenance/Maintainable.java", "license": "apache-2.0", "size": 8154 }
[ "org.kuali.rice.krad.bo.PersistableBusinessObject" ]
import org.kuali.rice.krad.bo.PersistableBusinessObject;
import org.kuali.rice.krad.bo.*;
[ "org.kuali.rice" ]
org.kuali.rice;
745,664
@Test (expected = FileAlreadyExistsException.class) public void testCreateFileOnRootWithFallbackWithFileAlreadyExist() throws Exception { Configuration conf = new Configuration(); Path fallbackTarget = new Path(targetTestRoot, "fallbackDir"); Path testFile = new Path(fallbackTarget, "test.file"); // pre-creating test file in fallback. fsTarget.create(testFile).close(); ConfigUtil.addLink(conf, "/user1/hive/", new Path(targetTestRoot.toString()).toUri()); ConfigUtil.addLinkFallback(conf, fallbackTarget.toUri()); AbstractFileSystem vfs = AbstractFileSystem.get(viewFsDefaultClusterUri, conf); Path vfsTestFile = new Path("/test.file"); assertTrue(fsTarget.exists(testFile)); vfs.create(vfsTestFile, EnumSet.of(CREATE), Options.CreateOpts.perms(FsPermission.getDefault())).close(); }
@Test (expected = FileAlreadyExistsException.class) void function() throws Exception { Configuration conf = new Configuration(); Path fallbackTarget = new Path(targetTestRoot, STR); Path testFile = new Path(fallbackTarget, STR); fsTarget.create(testFile).close(); ConfigUtil.addLink(conf, STR, new Path(targetTestRoot.toString()).toUri()); ConfigUtil.addLinkFallback(conf, fallbackTarget.toUri()); AbstractFileSystem vfs = AbstractFileSystem.get(viewFsDefaultClusterUri, conf); Path vfsTestFile = new Path(STR); assertTrue(fsTarget.exists(testFile)); vfs.create(vfsTestFile, EnumSet.of(CREATE), Options.CreateOpts.perms(FsPermission.getDefault())).close(); }
/** * Tests the create of a file on root where the path is matching to an * existing file on fallback's file on root. */
Tests the create of a file on root where the path is matching to an existing file on fallback's file on root
testCreateFileOnRootWithFallbackWithFileAlreadyExist
{ "repo_name": "apurtell/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsLinkFallback.java", "license": "apache-2.0", "size": 23281 }
[ "java.util.EnumSet", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.AbstractFileSystem", "org.apache.hadoop.fs.FileAlreadyExistsException", "org.apache.hadoop.fs.Options", "org.apache.hadoop.fs.Path", "org.apache.hadoop.fs.permission.FsPermission", "org.junit.Assert", "org.junit.Test"...
import java.util.EnumSet; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.AbstractFileSystem; import org.apache.hadoop.fs.FileAlreadyExistsException; import org.apache.hadoop.fs.Options; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.FsPermission; import org.junit.Assert; import org.junit.Test;
import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.junit.*;
[ "java.util", "org.apache.hadoop", "org.junit" ]
java.util; org.apache.hadoop; org.junit;
625,675
protected Expression getExpression(Map<ExpressionKey, Expression> cache, AnnotatedElementKey elementKey, String expression) { ExpressionKey expressionKey = createKey(elementKey, expression); Expression expr = cache.get(expressionKey); if (expr == null) { expr = getParser().parseExpression(expression); cache.put(expressionKey, expr); } return expr; }
Expression function(Map<ExpressionKey, Expression> cache, AnnotatedElementKey elementKey, String expression) { ExpressionKey expressionKey = createKey(elementKey, expression); Expression expr = cache.get(expressionKey); if (expr == null) { expr = getParser().parseExpression(expression); cache.put(expressionKey, expr); } return expr; }
/** * Return the {@link Expression} for the specified SpEL value * <p>Parse the expression if it hasn't been already. * @param cache the cache to use * @param elementKey the element on which the expression is defined * @param expression the expression to parse */
Return the <code>Expression</code> for the specified SpEL value Parse the expression if it hasn't been already
getExpression
{ "repo_name": "shivpun/spring-framework", "path": "spring-context/src/main/java/org/springframework/context/expression/CachedExpressionEvaluator.java", "license": "apache-2.0", "size": 4204 }
[ "java.util.Map", "org.springframework.expression.Expression" ]
import java.util.Map; import org.springframework.expression.Expression;
import java.util.*; import org.springframework.expression.*;
[ "java.util", "org.springframework.expression" ]
java.util; org.springframework.expression;
1,382,907
public void onNeighborBlockChange(World world, int x, int y, int z, Block face) { this.func_150090_e(world, x, y, z); }
void function(World world, int x, int y, int z, Block face) { this.func_150090_e(world, x, y, z); }
/** * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor Block */
Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor Block
onNeighborBlockChange
{ "repo_name": "Aarronmc/WallpaperCraft", "path": "1.7.10/src/main/java/com/Aarron/WallpaperCraft/blocks/carpet/CheckeredCarpetGray.java", "license": "mit", "size": 4422 }
[ "net.minecraft.block.Block", "net.minecraft.world.World" ]
import net.minecraft.block.Block; import net.minecraft.world.World;
import net.minecraft.block.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.world;
1,145,465
public void removeReadyUser(SessionKey userSessionKey) { this.readyUserSet.add(userSessionKey); }
void function(SessionKey userSessionKey) { this.readyUserSet.add(userSessionKey); }
/** * Remove a user from ready set * @param userSessionKey */
Remove a user from ready set
removeReadyUser
{ "repo_name": "wangqi/gameserver", "path": "server/src/main/java/com/xinqihd/sns/gameserver/battle/Room.java", "license": "apache-2.0", "size": 21766 }
[ "com.xinqihd.sns.gameserver.session.SessionKey" ]
import com.xinqihd.sns.gameserver.session.SessionKey;
import com.xinqihd.sns.gameserver.session.*;
[ "com.xinqihd.sns" ]
com.xinqihd.sns;
1,148,969
@Nullable public String getCountry() { return country; } /** * Return the filter used to restrict autocomplete results. * * Possible values: * <p><ul> * <li>{@link AutocompleteFilter#TYPE_FILTER_ADDRESS} * <li>{@link AutocompleteFilter#TYPE_FILTER_CITIES} * <li>{@link AutocompleteFilter#TYPE_FILTER_ESTABLISHMENT} * <li>{@link AutocompleteFilter#TYPE_FILTER_GEOCODE} * <li>{@link AutocompleteFilter#TYPE_FILTER_NONE} * <li>{@link AutocompleteFilter#TYPE_FILTER_REGIONS}
@Nullable String function() { return country; } /** * Return the filter used to restrict autocomplete results. * * Possible values: * <p><ul> * <li>{@link AutocompleteFilter#TYPE_FILTER_ADDRESS} * <li>{@link AutocompleteFilter#TYPE_FILTER_CITIES} * <li>{@link AutocompleteFilter#TYPE_FILTER_ESTABLISHMENT} * <li>{@link AutocompleteFilter#TYPE_FILTER_GEOCODE} * <li>{@link AutocompleteFilter#TYPE_FILTER_NONE} * <li>{@link AutocompleteFilter#TYPE_FILTER_REGIONS}
/** * Return the country that results should be limited to. Will be an ISO 3166-1 Alpha-2 country * code or null. * @return */
Return the country that results should be limited to. Will be an ISO 3166-1 Alpha-2 country code or null
getCountry
{ "repo_name": "mapzen/android", "path": "mapzen-places-api/src/main/java/com/mapzen/places/api/AutocompleteFilter.java", "license": "apache-2.0", "size": 4257 }
[ "android.support.annotation.Nullable" ]
import android.support.annotation.Nullable;
import android.support.annotation.*;
[ "android.support" ]
android.support;
1,146,456
public static String[] parseLine(String s) throws IOException { if (s == null) { throw new IllegalArgumentException("Null argument not allowed."); } // uh,jh: make sure that parseLine("").length == 0 if (s.length() == 0) { return EMPTY_STRING_ARRAY; } return (new CSVParser(new StringReader(s))).getLine(); }
static String[] function(String s) throws IOException { if (s == null) { throw new IllegalArgumentException(STR); } if (s.length() == 0) { return EMPTY_STRING_ARRAY; } return (new CSVParser(new StringReader(s))).getLine(); }
/** * Parses the first line only according to the default {@link CSVStrategy}. * * <p>Parsing empty string will be handled as valid records containing zero elements, so the * following property holds: parseLine("").length == 0. * * @param s CSV String to be parsed. * @return parsed String vector (which is never null) * @throws IOException in case of error */
Parses the first line only according to the default <code>CSVStrategy</code>. Parsing empty string will be handled as valid records containing zero elements, so the following property holds: parseLine("").length == 0
parseLine
{ "repo_name": "apache/solr", "path": "solr/core/src/java/org/apache/solr/internal/csv/CSVUtils.java", "license": "apache-2.0", "size": 4128 }
[ "java.io.IOException", "java.io.StringReader" ]
import java.io.IOException; import java.io.StringReader;
import java.io.*;
[ "java.io" ]
java.io;
1,285,622
@Override public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return true; }
boolean function(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return true; }
/** * Ascertain if the MessageBodyReader can produce an instance of a particular type. */
Ascertain if the MessageBodyReader can produce an instance of a particular type
isReadable
{ "repo_name": "learning-layers/Tethys", "path": "src/main/java/de/dbis/acis/cloud/Tethys/util/GsonMessageBodyHandler.java", "license": "apache-2.0", "size": 3854 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.Type", "javax.ws.rs.core.MediaType" ]
import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.ws.rs.core.MediaType;
import java.lang.annotation.*; import java.lang.reflect.*; import javax.ws.rs.core.*;
[ "java.lang", "javax.ws" ]
java.lang; javax.ws;
152,926
@RequestMapping(value = "/delete/{sacHeadId}") // GET or POST public String delete(final RedirectAttributes redirectAttributes, @PathVariable("sacHeadId") final Long sacHeadId) { log("Action 'delete'"); tbAcSecondaryheadMasterService.delete(sacHeadId); return redirectToList(); }
@RequestMapping(value = STR) String function(final RedirectAttributes redirectAttributes, @PathVariable(STR) final Long sacHeadId) { log(STR); tbAcSecondaryheadMasterService.delete(sacHeadId); return redirectToList(); }
/** * 'DELETE' action processing. <br> * This action is based on the 'Post/Redirect/Get (PRG)' pattern, so it ends by 'http redirect'<br> * @param redirectAttributes * @param sacHeadId primary key element * @return */
'DELETE' action processing. This action is based on the 'Post/Redirect/Get (PRG)' pattern, so it ends by 'http redirect'
delete
{ "repo_name": "abmindiarepomanager/ABMOpenMainet", "path": "Mainet1.1/MainetServiceParent/MainetServiceAccount/src/main/java/com/abm/mainet/account/ui/controller/SecondaryheadMasterController.java", "license": "gpl-3.0", "size": 60284 }
[ "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.servlet.mvc.support.RedirectAttributes" ]
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.mvc.support.*;
[ "org.springframework.web" ]
org.springframework.web;
943,303
private LoptJoinTree addFactorToTree( RelBuilder relBuilder, LoptMultiJoin multiJoin, LoptSemiJoinOptimizer semiJoinOpt, LoptJoinTree joinTree, int factorToAdd, BitSet factorsNeeded, List<RexNode> filtersToAdd, boolean selfJoin) { final RelMetadataQuery mq = semiJoinOpt.mq; // if the factor corresponds to the null generating factor in an outer // join that can be removed, then create a replacement join if (multiJoin.isRemovableOuterJoinFactor(factorToAdd)) { return createReplacementJoin( relBuilder, multiJoin, semiJoinOpt, joinTree, -1, factorToAdd, ImmutableIntList.of(), null, filtersToAdd); } // if the factor corresponds to a dimension table whose join we // can remove, create a replacement join if the corresponding fact // table is in the current join tree if (multiJoin.getJoinRemovalFactor(factorToAdd) != null) { return createReplacementSemiJoin( relBuilder, multiJoin, semiJoinOpt, joinTree, factorToAdd, filtersToAdd); } // if this is the first factor in the tree, create a join tree with // the single factor if (joinTree == null) { return new LoptJoinTree( semiJoinOpt.getChosenSemiJoin(factorToAdd), factorToAdd); } // Create a temporary copy of the filter list as we may need the // original list to pass into addToTop(). However, if no tree was // created by addToTop() because the factor being added is part of // a self-join, then pass the original filter list so the added // filters will still be removed from the list. final List<RexNode> tmpFilters = new ArrayList<>(filtersToAdd); LoptJoinTree topTree = addToTop( relBuilder, multiJoin, semiJoinOpt, joinTree, factorToAdd, filtersToAdd, selfJoin); LoptJoinTree pushDownTree = pushDownFactor( relBuilder, multiJoin, semiJoinOpt, joinTree, factorToAdd, factorsNeeded, (topTree == null) ? filtersToAdd : tmpFilters, selfJoin); // pick the lower cost option, and replace the join ordering with // the ordering associated with the best option LoptJoinTree bestTree; RelOptCost costPushDown = null; RelOptCost costTop = null; if (pushDownTree != null) { costPushDown = mq.getCumulativeCost(pushDownTree.getJoinTree()); } if (topTree != null) { costTop = mq.getCumulativeCost(topTree.getJoinTree()); } if (pushDownTree == null) { bestTree = topTree; } else if (topTree == null) { bestTree = pushDownTree; } else { if (costPushDown.isEqWithEpsilon(costTop)) { // if both plans cost the same (with an allowable round-off // margin of error), favor the one that passes // around the wider rows further up in the tree if (rowWidthCost(pushDownTree.getJoinTree()) < rowWidthCost(topTree.getJoinTree())) { bestTree = pushDownTree; } else { bestTree = topTree; } } else if (costPushDown.isLt(costTop)) { bestTree = pushDownTree; } else { bestTree = topTree; } } return bestTree; }
LoptJoinTree function( RelBuilder relBuilder, LoptMultiJoin multiJoin, LoptSemiJoinOptimizer semiJoinOpt, LoptJoinTree joinTree, int factorToAdd, BitSet factorsNeeded, List<RexNode> filtersToAdd, boolean selfJoin) { final RelMetadataQuery mq = semiJoinOpt.mq; if (multiJoin.isRemovableOuterJoinFactor(factorToAdd)) { return createReplacementJoin( relBuilder, multiJoin, semiJoinOpt, joinTree, -1, factorToAdd, ImmutableIntList.of(), null, filtersToAdd); } if (multiJoin.getJoinRemovalFactor(factorToAdd) != null) { return createReplacementSemiJoin( relBuilder, multiJoin, semiJoinOpt, joinTree, factorToAdd, filtersToAdd); } if (joinTree == null) { return new LoptJoinTree( semiJoinOpt.getChosenSemiJoin(factorToAdd), factorToAdd); } final List<RexNode> tmpFilters = new ArrayList<>(filtersToAdd); LoptJoinTree topTree = addToTop( relBuilder, multiJoin, semiJoinOpt, joinTree, factorToAdd, filtersToAdd, selfJoin); LoptJoinTree pushDownTree = pushDownFactor( relBuilder, multiJoin, semiJoinOpt, joinTree, factorToAdd, factorsNeeded, (topTree == null) ? filtersToAdd : tmpFilters, selfJoin); LoptJoinTree bestTree; RelOptCost costPushDown = null; RelOptCost costTop = null; if (pushDownTree != null) { costPushDown = mq.getCumulativeCost(pushDownTree.getJoinTree()); } if (topTree != null) { costTop = mq.getCumulativeCost(topTree.getJoinTree()); } if (pushDownTree == null) { bestTree = topTree; } else if (topTree == null) { bestTree = pushDownTree; } else { if (costPushDown.isEqWithEpsilon(costTop)) { if (rowWidthCost(pushDownTree.getJoinTree()) < rowWidthCost(topTree.getJoinTree())) { bestTree = pushDownTree; } else { bestTree = topTree; } } else if (costPushDown.isLt(costTop)) { bestTree = pushDownTree; } else { bestTree = topTree; } } return bestTree; }
/** * Adds a new factor into the current join tree. The factor is either pushed * down into one of the subtrees of the join recursively, or it is added to * the top of the current tree, whichever yields a better ordering. * * @param multiJoin join factors being optimized * @param semiJoinOpt optimal semijoins for each factor * @param joinTree current join tree * @param factorToAdd new factor to be added * @param factorsNeeded factors that must precede the factor to be added * @param filtersToAdd filters remaining to be added; filters added to the * new join tree are removed from the list * @param selfJoin true if the join being created is a self-join that's * removable * * @return optimal join tree with the new factor added if it is possible to * add the factor; otherwise, null is returned */
Adds a new factor into the current join tree. The factor is either pushed down into one of the subtrees of the join recursively, or it is added to the top of the current tree, whichever yields a better ordering
addFactorToTree
{ "repo_name": "wanglan/calcite", "path": "core/src/main/java/org/apache/calcite/rel/rules/LoptOptimizeJoinRule.java", "license": "apache-2.0", "size": 73624 }
[ "java.util.ArrayList", "java.util.BitSet", "java.util.List", "org.apache.calcite.plan.RelOptCost", "org.apache.calcite.rel.metadata.RelMetadataQuery", "org.apache.calcite.rex.RexNode", "org.apache.calcite.tools.RelBuilder", "org.apache.calcite.util.ImmutableIntList" ]
import java.util.ArrayList; import java.util.BitSet; import java.util.List; import org.apache.calcite.plan.RelOptCost; import org.apache.calcite.rel.metadata.RelMetadataQuery; import org.apache.calcite.rex.RexNode; import org.apache.calcite.tools.RelBuilder; import org.apache.calcite.util.ImmutableIntList;
import java.util.*; import org.apache.calcite.plan.*; import org.apache.calcite.rel.metadata.*; import org.apache.calcite.rex.*; import org.apache.calcite.tools.*; import org.apache.calcite.util.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
1,700,083
public ServiceFuture<List<VirtualMachineSizeInner>> listAvailableSizesAsync(String resourceGroupName, String availabilitySetName, final ServiceCallback<List<VirtualMachineSizeInner>> serviceCallback) { return ServiceFuture.fromResponse(listAvailableSizesWithServiceResponseAsync(resourceGroupName, availabilitySetName), serviceCallback); }
ServiceFuture<List<VirtualMachineSizeInner>> function(String resourceGroupName, String availabilitySetName, final ServiceCallback<List<VirtualMachineSizeInner>> serviceCallback) { return ServiceFuture.fromResponse(listAvailableSizesWithServiceResponseAsync(resourceGroupName, availabilitySetName), serviceCallback); }
/** * Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set. * * @param resourceGroupName The name of the resource group. * @param availabilitySetName The name of the availability set. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Lists all available virtual machine sizes that can be used to create a new virtual machine in an existing availability set
listAvailableSizesAsync
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/AvailabilitySetsInner.java", "license": "mit", "size": 30406 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture", "java.util.List" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
1,498,947
public boolean add(String key, Object value, Date expiry) { Boolean result = Boolean.FALSE; OperationFuture<Boolean> future = this.asynAdd(key, value, expiry); try { result = future.get(); } catch (Exception e) { LOG.error("fail to get the result ", e); } return result == null ? false : result; }
boolean function(String key, Object value, Date expiry) { Boolean result = Boolean.FALSE; OperationFuture<Boolean> future = this.asynAdd(key, value, expiry); try { result = future.get(); } catch (Exception e) { LOG.error(STR, e); } return result == null ? false : result; }
/** * Sync add data to the server . * * @param key key to store cache under * @param value value object to cache * @param expiry expiration * @return true/false indicating success */
Sync add data to the server
add
{ "repo_name": "wenzuojing/MemcachedClient4J", "path": "src/main/java/org/wzj/memcached/MemcachedClient.java", "license": "mit", "size": 16456 }
[ "java.util.Date", "org.wzj.memcached.future.OperationFuture" ]
import java.util.Date; import org.wzj.memcached.future.OperationFuture;
import java.util.*; import org.wzj.memcached.future.*;
[ "java.util", "org.wzj.memcached" ]
java.util; org.wzj.memcached;
2,187,102
protected void parse(SearchRequestBuilder search) { this.parseXtnF(search); this.parseElastic(search); this.parseUrlTypes(search); this.parseXtnBBox(search); this.parseXtnTime(search); this.parseXtnFilter(search); this.parseXtnId(search); }
void function(SearchRequestBuilder search) { this.parseXtnF(search); this.parseElastic(search); this.parseUrlTypes(search); this.parseXtnBBox(search); this.parseXtnTime(search); this.parseXtnFilter(search); this.parseXtnId(search); }
/** * Parse the request. * @param search the search */
Parse the request
parse
{ "repo_name": "usgin/geoportal-server-catalog", "path": "geoportal/src/main/java/com/esri/geoportal/lib/elastic/request/SearchRequest.java", "license": "apache-2.0", "size": 22423 }
[ "org.elasticsearch.action.search.SearchRequestBuilder" ]
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
1,965,712
IntegrationAccountSchema apply(Context context); }
IntegrationAccountSchema apply(Context context); }
/** * Executes the update request. * * @param context The context to associate with this operation. * @return the updated resource. */
Executes the update request
apply
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/logic/azure-resourcemanager-logic/src/main/java/com/azure/resourcemanager/logic/models/IntegrationAccountSchema.java", "license": "mit", "size": 15524 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,762,246
public byte[] toEntropy(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException { if (words.size() % 3 > 0) throw new MnemonicException.MnemonicLengthException("Word list size must be multiple of three words."); // Look up all the words in the list and construct the // concatenation of the original entropy and the checksum. // int concatLenBits = words.size() * 11; boolean[] concatBits = new boolean[concatLenBits]; int wordindex = 0; for (String word : words) { // Find the words index in the wordlist. int ndx = Collections.binarySearch(this.wordList, word); if (ndx < 0) throw new MnemonicException.MnemonicWordException(word); // Set the next 11 bits to the value of the index. for (int ii = 0; ii < 11; ++ii) concatBits[(wordindex * 11) + ii] = (ndx & (1 << (10 - ii))) != 0; ++wordindex; } int checksumLengthBits = concatLenBits / 33; int entropyLengthBits = concatLenBits - checksumLengthBits; // Extract original entropy as bytes. byte[] entropy = new byte[entropyLengthBits / 8]; for (int ii = 0; ii < entropy.length; ++ii) for (int jj = 0; jj < 8; ++jj) if (concatBits[(ii * 8) + jj]) entropy[ii] |= 1 << (7 - jj); // Take the digest of the entropy. byte[] hash = Sha256Hash.create(entropy).getBytes(); boolean[] hashBits = bytesToBits(hash); // Check all the checksum bits. for (int i = 0; i < checksumLengthBits; ++i) if (concatBits[entropyLengthBits + i] != hashBits[i]) throw new MnemonicException.MnemonicChecksumException(); return entropy; }
byte[] function(List<String> words) throws MnemonicException.MnemonicLengthException, MnemonicException.MnemonicWordException, MnemonicException.MnemonicChecksumException { if (words.size() % 3 > 0) throw new MnemonicException.MnemonicLengthException(STR); boolean[] concatBits = new boolean[concatLenBits]; int wordindex = 0; for (String word : words) { int ndx = Collections.binarySearch(this.wordList, word); if (ndx < 0) throw new MnemonicException.MnemonicWordException(word); for (int ii = 0; ii < 11; ++ii) concatBits[(wordindex * 11) + ii] = (ndx & (1 << (10 - ii))) != 0; ++wordindex; } int checksumLengthBits = concatLenBits / 33; int entropyLengthBits = concatLenBits - checksumLengthBits; byte[] entropy = new byte[entropyLengthBits / 8]; for (int ii = 0; ii < entropy.length; ++ii) for (int jj = 0; jj < 8; ++jj) if (concatBits[(ii * 8) + jj]) entropy[ii] = 1 << (7 - jj); byte[] hash = Sha256Hash.create(entropy).getBytes(); boolean[] hashBits = bytesToBits(hash); for (int i = 0; i < checksumLengthBits; ++i) if (concatBits[entropyLengthBits + i] != hashBits[i]) throw new MnemonicException.MnemonicChecksumException(); return entropy; }
/** * Convert mnemonic word list to original entropy value. */
Convert mnemonic word list to original entropy value
toEntropy
{ "repo_name": "pavel4n/wowdoge.org", "path": "core/src/main/java/com/google/dogecoin/crypto/MnemonicCode.java", "license": "apache-2.0", "size": 7913 }
[ "com.google.dogecoin.core.Sha256Hash", "java.util.Collections", "java.util.List" ]
import com.google.dogecoin.core.Sha256Hash; import java.util.Collections; import java.util.List;
import com.google.dogecoin.core.*; import java.util.*;
[ "com.google.dogecoin", "java.util" ]
com.google.dogecoin; java.util;
834,607
private String getTypeNameForDerivedFile( IFile f ) { IPath p = f.getFullPath(); IFolder folder = _gsfm.getFolder(); IPath generatedSourcePath = folder.getFullPath(); int count = p.matchingFirstSegments( generatedSourcePath ); p = p.removeFirstSegments( count ); String s = p.toPortableString(); int idx = s.lastIndexOf( '.' ); s = p.toPortableString().replace( '/', '.' ); return s.substring( 0, idx ); }
String function( IFile f ) { IPath p = f.getFullPath(); IFolder folder = _gsfm.getFolder(); IPath generatedSourcePath = folder.getFullPath(); int count = p.matchingFirstSegments( generatedSourcePath ); p = p.removeFirstSegments( count ); String s = p.toPortableString(); int idx = s.lastIndexOf( '.' ); s = p.toPortableString().replace( '/', '.' ); return s.substring( 0, idx ); }
/** * given file f, return the typename corresponding to the file. This assumes * that derived files use java naming rules (i.e., type "a.b.C" will be file * "a/b/C.java". */
given file f, return the typename corresponding to the file. This assumes that derived files use java naming rules (i.e., type "a.b.C" will be file "a/b/C.java"
getTypeNameForDerivedFile
{ "repo_name": "maxeler/eclipse", "path": "eclipse.jdt.core/org.eclipse.jdt.apt.core/src/org/eclipse/jdt/apt/core/internal/generatedfile/GeneratedFileManager.java", "license": "epl-1.0", "size": 62063 }
[ "org.eclipse.core.resources.IFile", "org.eclipse.core.resources.IFolder", "org.eclipse.core.runtime.IPath" ]
import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*;
[ "org.eclipse.core" ]
org.eclipse.core;
281,532
Point2D getMapLocation(Point2D point);
Point2D getMapLocation(Point2D point);
/** * Converts a point in screen coordinates into a map location. * * @param point * the point in screen coordinates * @return the map location */
Converts a point in screen coordinates into a map location
getMapLocation
{ "repo_name": "gurkenlabs/litiengine", "path": "core/src/main/java/de/gurkenlabs/litiengine/graphics/ICamera.java", "license": "mit", "size": 7839 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,656,356
public static void main(String argv[]) throws IOException, InterruptedException { StringUtils.startupShutdownMessage(JobTracker.class, argv, LOG); //输出启动和关闭的Log try { if (argv.length == 0) { JobTracker tracker = startTracker(new JobConf()); //创建JobTracker对象 tracker.offerService(); //启动各个服务 } else { if ("-dumpConfiguration".equals(argv[0]) && argv.length == 1) { dumpConfiguration(new PrintWriter(System.out)); } else { System.out .println("usage: JobTracker [-dumpConfiguration]"); System.exit(-1); } } } catch (Throwable e) { LOG.fatal(StringUtils.stringifyException(e)); System.exit(-1); } }
static void function(String argv[]) throws IOException, InterruptedException { StringUtils.startupShutdownMessage(JobTracker.class, argv, LOG); try { if (argv.length == 0) { JobTracker tracker = startTracker(new JobConf()); tracker.offerService(); } else { if (STR.equals(argv[0]) && argv.length == 1) { dumpConfiguration(new PrintWriter(System.out)); } else { System.out .println(STR); System.exit(-1); } } } catch (Throwable e) { LOG.fatal(StringUtils.stringifyException(e)); System.exit(-1); } }
/** * Start the JobTracker process. This is used only for debugging. As a rule, * JobTracker should be run as part of the DFS Namenode process. */
Start the JobTracker process. This is used only for debugging. As a rule, JobTracker should be run as part of the DFS Namenode process
main
{ "repo_name": "wzhuo918/StaticBalance_HadoopSource_noConf", "path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java", "license": "apache-2.0", "size": 192532 }
[ "java.io.IOException", "java.io.PrintWriter", "org.apache.hadoop.util.StringUtils" ]
import java.io.IOException; import java.io.PrintWriter; import org.apache.hadoop.util.StringUtils;
import java.io.*; import org.apache.hadoop.util.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
631,729
public Collection<TimerData> getTimers(TimeDomain domain) { Collection<TimerData> domainTimers = timers.get(domain); if (domainTimers == null) { return Collections.emptyList(); } return domainTimers; }
Collection<TimerData> function(TimeDomain domain) { Collection<TimerData> domainTimers = timers.get(domain); if (domainTimers == null) { return Collections.emptyList(); } return domainTimers; }
/** * Gets all of the timers that have fired within the provided {@link TimeDomain}. If no timers * fired within the provided domain, return an empty collection. * * <p>Timers within a {@link TimeDomain} are guaranteed to be in order of increasing timestamp. */
Gets all of the timers that have fired within the provided <code>TimeDomain</code>. If no timers fired within the provided domain, return an empty collection. Timers within a <code>TimeDomain</code> are guaranteed to be in order of increasing timestamp
getTimers
{ "repo_name": "shakamunyi/beam", "path": "runners/direct-java/src/main/java/org/apache/beam/runners/direct/InMemoryWatermarkManager.java", "license": "apache-2.0", "size": 55449 }
[ "java.util.Collection", "java.util.Collections", "org.apache.beam.sdk.util.TimeDomain", "org.apache.beam.sdk.util.TimerInternals" ]
import java.util.Collection; import java.util.Collections; import org.apache.beam.sdk.util.TimeDomain; import org.apache.beam.sdk.util.TimerInternals;
import java.util.*; import org.apache.beam.sdk.util.*;
[ "java.util", "org.apache.beam" ]
java.util; org.apache.beam;
2,605,329
private void writeAttribute(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); }
void function(java.lang.String prefix,java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (xmlWriter.getPrefix(namespace) == null) { xmlWriter.writeNamespace(prefix, namespace); xmlWriter.setPrefix(prefix, namespace); } xmlWriter.writeAttribute(namespace,attName,attValue); }
/** * Util method to write an attribute with the ns prefix */
Util method to write an attribute with the ns prefix
writeAttribute
{ "repo_name": "zzsoszz/axis2webservice", "path": "opensource_axis2.1.6.2/org/apache/axis2/databinding/types/soapencoding/AnyURI.java", "license": "apache-2.0", "size": 21294 }
[ "javax.xml.stream.XMLStreamWriter" ]
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.*;
[ "javax.xml" ]
javax.xml;
1,329,083
public Builder proxy(Proxy proxy) { this.proxy = proxy; return this; }
Builder function(Proxy proxy) { this.proxy = proxy; return this; }
/** * Sets the HTTP proxy that will be used by connections created by this client. This takes * precedence over {@link #proxySelector}, which is only honored when this proxy is null (which * it is by default). To disable proxy use completely, call {@code setProxy(Proxy.NO_PROXY)}. */
Sets the HTTP proxy that will be used by connections created by this client. This takes precedence over <code>#proxySelector</code>, which is only honored when this proxy is null (which it is by default). To disable proxy use completely, call setProxy(Proxy.NO_PROXY)
proxy
{ "repo_name": "lizhangqu/PriorityOkHttp", "path": "okhttp/src/main/java/okhttp3/OkHttpClient.java", "license": "apache-2.0", "size": 25945 }
[ "java.net.Proxy" ]
import java.net.Proxy;
import java.net.*;
[ "java.net" ]
java.net;
1,516,209
public static IStandardVariableExpressionEvaluator getVariableExpressionEvaluator(final IEngineConfiguration configuration) { final Object expressionEvaluator = configuration.getExecutionAttributes().get(STANDARD_VARIABLE_EXPRESSION_EVALUATOR_ATTRIBUTE_NAME); if (expressionEvaluator == null || (!(expressionEvaluator instanceof IStandardVariableExpressionEvaluator))) { throw new TemplateProcessingException( "No Standard Variable Expression Evaluator has been registered as an execution argument. " + "This is a requirement for using Standard Expressions, and might happen " + "if neither the Standard or the SpringStandard dialects have " + "been added to the Template Engine and none of the specified dialects registers an " + "attribute of type " + IStandardVariableExpressionEvaluator.class.getName() + " with name " + "\"" + STANDARD_VARIABLE_EXPRESSION_EVALUATOR_ATTRIBUTE_NAME + "\""); } return (IStandardVariableExpressionEvaluator) expressionEvaluator; }
static IStandardVariableExpressionEvaluator function(final IEngineConfiguration configuration) { final Object expressionEvaluator = configuration.getExecutionAttributes().get(STANDARD_VARIABLE_EXPRESSION_EVALUATOR_ATTRIBUTE_NAME); if (expressionEvaluator == null (!(expressionEvaluator instanceof IStandardVariableExpressionEvaluator))) { throw new TemplateProcessingException( STR + STR + STR + STR + STR + IStandardVariableExpressionEvaluator.class.getName() + STR + "\"STR\""); } return (IStandardVariableExpressionEvaluator) expressionEvaluator; }
/** * <p> * Obtain the variable expression evaluator (implementation of {@link IStandardVariableExpressionEvaluator}) * registered by the Standard Dialect that is being currently used. * </p> * <p> * Normally, there should be no need to obtain this object from the developers' code (only internally from * {@link IStandardExpression} implementations). * </p> * * @param configuration the configuration object for the current template execution environment. * @return the variable expression evaluator object. */
Obtain the variable expression evaluator (implementation of <code>IStandardVariableExpressionEvaluator</code>) registered by the Standard Dialect that is being currently used. Normally, there should be no need to obtain this object from the developers' code (only internally from <code>IStandardExpression</code> implementations).
getVariableExpressionEvaluator
{ "repo_name": "thymeleaf/thymeleaf", "path": "src/main/java/org/thymeleaf/standard/expression/StandardExpressions.java", "license": "apache-2.0", "size": 6788 }
[ "org.thymeleaf.IEngineConfiguration", "org.thymeleaf.exceptions.TemplateProcessingException" ]
import org.thymeleaf.IEngineConfiguration; import org.thymeleaf.exceptions.TemplateProcessingException;
import org.thymeleaf.*; import org.thymeleaf.exceptions.*;
[ "org.thymeleaf", "org.thymeleaf.exceptions" ]
org.thymeleaf; org.thymeleaf.exceptions;
241,709
@Override public T visitWindowDeterminer(@NotNull CQLParser.WindowDeterminerContext ctx) { return visitChildren(ctx); }
@Override public T visitWindowDeterminer(@NotNull CQLParser.WindowDeterminerContext ctx) { return visitChildren(ctx); }
/** * {@inheritDoc} * <p/> * The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}. */
The default implementation returns the result of calling <code>#visitChildren</code> on ctx
visitCreateInputStreamStatement
{ "repo_name": "jack6215/StreamCQL", "path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserBaseVisitor.java", "license": "apache-2.0", "size": 44928 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,486,197
@ServiceMethod(returns = ReturnType.SINGLE) PolicyDefinitionInner createOrUpdateAtManagementGroup( String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters);
@ServiceMethod(returns = ReturnType.SINGLE) PolicyDefinitionInner createOrUpdateAtManagementGroup( String policyDefinitionName, String managementGroupId, PolicyDefinitionInner parameters);
/** * Creates or updates a policy definition at management group level. * * @param policyDefinitionName The name of the policy definition to create. * @param managementGroupId The ID of the management group. * @param parameters The policy definition properties. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the policy definition. */
Creates or updates a policy definition at management group level
createOrUpdateAtManagementGroup
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/PolicyDefinitionsClient.java", "license": "mit", "size": 26040 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.resources.fluent.models.PolicyDefinitionInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.resources.fluent.models.PolicyDefinitionInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.resources.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,510,735
@GET @Path("{userId}/contacts") @Produces(MediaType.APPLICATION_JSON) public Response getUserContacts(@PathParam("userId") String userId, @QueryParam("application") String instanceId, @QueryParam("roles") String roles, @QueryParam("resource") String resource, @QueryParam("name") String name, @QueryParam("page") String page, @QueryParam("domain") String domain, @QueryParam("userStatesToExclude") Set<UserState> userStatesToExclude) { String domainId = (Domain.MIXED_DOMAIN_ID.equals(domain) ? null : domain); UserDetail theUser = getUserDetailMatching(userId); String[] roleNames = (isDefined(roles) ? roles.split(",") : null); String[] contactIds = getContactIds(theUser.getId()); ListSlice<UserDetail> contacts; if (contactIds.length > 0) { UserProfilesSearchCriteriaBuilder criteriaBuilder = UserProfilesSearchCriteriaBuilder .aSearchCriteria(). withComponentInstanceId(instanceId). withDomainId(domainId). withRoles(roleNames). withResourceId(resource). withUserIds(contactIds). withName(name). withPaginationPage(fromPage(page)); // Users to exclude by their state if (CollectionUtil.isNotEmpty(userStatesToExclude)) { criteriaBuilder.withUserStatesToExclude( userStatesToExclude.toArray(new UserState[userStatesToExclude.size()])); } contacts = getOrganisationController().searchUsers(criteriaBuilder.build()); } else { contacts = new ListSlice<UserDetail>(0, 0, 0); } URI usersUri = getUriInfo().getBaseUriBuilder().path(USERS_BASE_URI).build(); return Response.ok( asWebEntity(contacts, locatedAt(usersUri))). header(RESPONSE_HEADER_USERSIZE, contacts.getOriginalListSize()). header(RESPONSE_HEADER_ARRAYSIZE, contacts.getOriginalListSize()).build(); }
@Path(STR) @Produces(MediaType.APPLICATION_JSON) Response function(@PathParam(STR) String userId, @QueryParam(STR) String instanceId, @QueryParam("roles") String roles, @QueryParam(STR) String resource, @QueryParam("name") String name, @QueryParam("page") String page, @QueryParam(STR) String domain, @QueryParam(STR) Set<UserState> userStatesToExclude) { String domainId = (Domain.MIXED_DOMAIN_ID.equals(domain) ? null : domain); UserDetail theUser = getUserDetailMatching(userId); String[] roleNames = (isDefined(roles) ? roles.split(",") : null); String[] contactIds = getContactIds(theUser.getId()); ListSlice<UserDetail> contacts; if (contactIds.length > 0) { UserProfilesSearchCriteriaBuilder criteriaBuilder = UserProfilesSearchCriteriaBuilder .aSearchCriteria(). withComponentInstanceId(instanceId). withDomainId(domainId). withRoles(roleNames). withResourceId(resource). withUserIds(contactIds). withName(name). withPaginationPage(fromPage(page)); if (CollectionUtil.isNotEmpty(userStatesToExclude)) { criteriaBuilder.withUserStatesToExclude( userStatesToExclude.toArray(new UserState[userStatesToExclude.size()])); } contacts = getOrganisationController().searchUsers(criteriaBuilder.build()); } else { contacts = new ListSlice<UserDetail>(0, 0, 0); } URI usersUri = getUriInfo().getBaseUriBuilder().path(USERS_BASE_URI).build(); return Response.ok( asWebEntity(contacts, locatedAt(usersUri))). header(RESPONSE_HEADER_USERSIZE, contacts.getOriginalListSize()). header(RESPONSE_HEADER_ARRAYSIZE, contacts.getOriginalListSize()).build(); }
/** * Gets the profile on the user that is identified by the unique identifier refered by the URI. * The unique identifier in the URI accepts also the specific term <i>me</i> to refers the current * user of the session within which the request is received. * * @param userId the unique identifier of the user or <i>me</i> to refers the current user at the * origin of the request. * @param instanceId the unique identifier of the component instance the users should have access * to. * @param roles the name of the roles the users must play either for the component instance or for * a given resource of the component instance. * @param resource the unique identifier of the resource in the component instance the users to * get must have enough rights to access. This query filter is coupled with the <code>roles</code> * one. If it is not set, by default the resource refered is the whole component instance. As for * component instance identifier, a resource one is defined by its type followed by its * identifier. * @param name a pattern the name of the users has to satisfy. The wildcard * means anything * string of characters. * @param page the pagination parameters formatted as "page number;item count in the page". From * this parameter is computed the part of users to sent back: those between ((page number - 1) * * item count in the page) and ((page number - 1) * item count in the page + item count in the * page). * @param domain the unique identifier of the domain the users have to be related. * @param userStatesToExclude the user states that users taken into account must not be in. * @return the profile of the user in a JSON representation. */
Gets the profile on the user that is identified by the unique identifier refered by the URI. The unique identifier in the URI accepts also the specific term me to refers the current user of the session within which the request is received
getUserContacts
{ "repo_name": "ebonnet/Silverpeas-Core", "path": "core-web/src/main/java/org/silverpeas/core/webapi/profile/UserProfileResource.java", "license": "agpl-3.0", "size": 20692 }
[ "java.util.Set", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.QueryParam", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response", "org.silverpeas.core.admin.domain.model.Domain", "org.silverpeas.core.admin.user.constant.UserState", "org.silverpeas.core.admi...
import java.util.Set; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.silverpeas.core.admin.domain.model.Domain; import org.silverpeas.core.admin.user.constant.UserState; import org.silverpeas.core.admin.user.model.UserDetail; import org.silverpeas.core.util.CollectionUtil; import org.silverpeas.core.util.ListSlice;
import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.silverpeas.core.admin.domain.model.*; import org.silverpeas.core.admin.user.constant.*; import org.silverpeas.core.admin.user.model.*; import org.silverpeas.core.util.*;
[ "java.util", "javax.ws", "org.silverpeas.core" ]
java.util; javax.ws; org.silverpeas.core;
778,883
public void testSizeStatsAfterRecreationInAsynchMode() throws Exception { final int MAX_OPLOG_SIZE = 1000; diskProps.setMaxOplogSize(MAX_OPLOG_SIZE); diskProps.setPersistBackup(true); diskProps.setRolling(false); diskProps.setSynchronous(false); diskProps.setBytesThreshold(800); diskProps.setOverflow(false); diskProps.setDiskDirsAndSizes(new File[] { dirs[0],dirs[1] }, new int[] { 4000,4000 }); final byte[] val = new byte[25]; region = DiskRegionHelperFactory.getAsyncPersistOnlyRegion(cache, diskProps); DiskRegion dr = ((LocalRegion)region).getDiskRegion(); try { LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true; for(int i = 0; i < 42;++i) { region.put("key"+i, val); } // need to wait for writes to happen before getting size dr.flushForTesting(); long size1 =0; for(DirectoryHolder dh:dr.getDirectories()) { size1 += dh.getDirStatsDiskSpaceUsage(); } System.out.println("Size before close = "+ size1); region.close(); diskProps.setSynchronous(true); region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL); dr = ((LocalRegion)region).getDiskRegion(); long size2 =0; for(DirectoryHolder dh:dr.getDirectories()) { size2 += dh.getDirStatsDiskSpaceUsage(); } System.out.println("Size after recreation= "+ size2); assertEquals(size1, size2); region.close(); } finally { LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false; } }
void function() throws Exception { final int MAX_OPLOG_SIZE = 1000; diskProps.setMaxOplogSize(MAX_OPLOG_SIZE); diskProps.setPersistBackup(true); diskProps.setRolling(false); diskProps.setSynchronous(false); diskProps.setBytesThreshold(800); diskProps.setOverflow(false); diskProps.setDiskDirsAndSizes(new File[] { dirs[0],dirs[1] }, new int[] { 4000,4000 }); final byte[] val = new byte[25]; region = DiskRegionHelperFactory.getAsyncPersistOnlyRegion(cache, diskProps); DiskRegion dr = ((LocalRegion)region).getDiskRegion(); try { LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true; for(int i = 0; i < 42;++i) { region.put("key"+i, val); } dr.flushForTesting(); long size1 =0; for(DirectoryHolder dh:dr.getDirectories()) { size1 += dh.getDirStatsDiskSpaceUsage(); } System.out.println(STR+ size1); region.close(); diskProps.setSynchronous(true); region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL); dr = ((LocalRegion)region).getDiskRegion(); long size2 =0; for(DirectoryHolder dh:dr.getDirectories()) { size2 += dh.getDirStatsDiskSpaceUsage(); } System.out.println(STR+ size2); assertEquals(size1, size2); region.close(); } finally { LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false; } }
/** * Tests if without rolling the region size before close is same as after * recreation */
Tests if without rolling the region size before close is same as after recreation
testSizeStatsAfterRecreationInAsynchMode
{ "repo_name": "gemxd/gemfirexd-oss", "path": "tests/core/src/main/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java", "license": "apache-2.0", "size": 142001 }
[ "com.gemstone.gemfire.cache.Scope", "java.io.File" ]
import com.gemstone.gemfire.cache.Scope; import java.io.File;
import com.gemstone.gemfire.cache.*; import java.io.*;
[ "com.gemstone.gemfire", "java.io" ]
com.gemstone.gemfire; java.io;
1,356,647
public ComponentDefinition getDefinition(String name, ServletRequest request, ServletContext servletContext) throws NoSuchDefinitionException,DefinitionsFactoryException;
ComponentDefinition function(String name, ServletRequest request, ServletContext servletContext) throws NoSuchDefinitionException,DefinitionsFactoryException;
/** * Get a definition by its name. * @param name Name of requested definition. * @param request Current servelet request * @param servletContext current servlet context * @throws DefinitionsFactoryException An error occur while getting definition. * @throws NoSuchDefinitionException No definition found for specified name * Implementation can throw more accurate exception as a subclass of this exception */
Get a definition by its name
getDefinition
{ "repo_name": "codelibs/cl-struts", "path": "src/share/org/apache/struts/tiles/DefinitionsFactory.java", "license": "apache-2.0", "size": 3533 }
[ "javax.servlet.ServletContext", "javax.servlet.ServletRequest" ]
import javax.servlet.ServletContext; import javax.servlet.ServletRequest;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,774,365
@Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addIsMultiSelectionPropertyDescriptor(object); } return itemPropertyDescriptors; }
List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addIsMultiSelectionPropertyDescriptor(object); } return itemPropertyDescriptors; }
/** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the property descriptors for the adapted class.
getPropertyDescriptors
{ "repo_name": "ifml/ifml-editor", "path": "plugins/IFMLEditor.edit/src/IFML/Extensions/provider/SelectionFieldItemProvider.java", "license": "mit", "size": 5142 }
[ "java.util.List", "org.eclipse.emf.edit.provider.IItemPropertyDescriptor" ]
import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import java.util.*; import org.eclipse.emf.edit.provider.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
993,727
public Object getPropertyValueOrNull() { try { return getPropertyValue(); } catch (final RepositoryException e) { return null; } }
Object function() { try { return getPropertyValue(); } catch (final RepositoryException e) { return null; } }
/** * Get the current property value. * @return The current value or {@code null} if not possible. */
Get the current property value
getPropertyValueOrNull
{ "repo_name": "plutext/sling", "path": "bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/helper/JcrPropertyMapCacheEntry.java", "license": "apache-2.0", "size": 16093 }
[ "javax.jcr.RepositoryException" ]
import javax.jcr.RepositoryException;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
1,782,348
public String deleteApiKey(String username) throws Exception { try { WebContext ctx = WebContextFactory.get(); HttpSession session = ctx.getSession(); final InterMineAPI im = SessionMethods.getInterMineAPI(session); final ProfileManager pm = im.getProfileManager(); Profile p = pm.getProfile(username); p.setApiKey(null); return "deleted"; } catch (RuntimeException e) { processException(e); return null; } }
String function(String username) throws Exception { try { WebContext ctx = WebContextFactory.get(); HttpSession session = ctx.getSession(); final InterMineAPI im = SessionMethods.getInterMineAPI(session); final ProfileManager pm = im.getProfileManager(); Profile p = pm.getProfile(username); p.setApiKey(null); return STR; } catch (RuntimeException e) { processException(e); return null; } }
/** * Delete a user's API key, thus disabling webservice access. A message "deleted" * is returned to confirm success. * @param username The user whose key we should delete. * @return A confirmation string. * @throws Exception if somethign bad happens */
Delete a user's API key, thus disabling webservice access. A message "deleted" is returned to confirm success
deleteApiKey
{ "repo_name": "joshkh/intermine", "path": "intermine/web/main/src/org/intermine/dwr/AjaxServices.java", "license": "lgpl-2.1", "size": 62567 }
[ "javax.servlet.http.HttpSession", "org.directwebremoting.WebContext", "org.directwebremoting.WebContextFactory", "org.intermine.api.InterMineAPI", "org.intermine.api.profile.Profile", "org.intermine.api.profile.ProfileManager", "org.intermine.web.logic.session.SessionMethods" ]
import javax.servlet.http.HttpSession; import org.directwebremoting.WebContext; import org.directwebremoting.WebContextFactory; import org.intermine.api.InterMineAPI; import org.intermine.api.profile.Profile; import org.intermine.api.profile.ProfileManager; import org.intermine.web.logic.session.SessionMethods;
import javax.servlet.http.*; import org.directwebremoting.*; import org.intermine.api.*; import org.intermine.api.profile.*; import org.intermine.web.logic.session.*;
[ "javax.servlet", "org.directwebremoting", "org.intermine.api", "org.intermine.web" ]
javax.servlet; org.directwebremoting; org.intermine.api; org.intermine.web;
1,519,814
public static void serialize(OutputStream out, Iterator<Entry> entries) throws IOException { StreamResult streamResult = new StreamResult(out); SAXTransformerFactory tf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler hd; try { hd = tf.newTransformerHandler(); } catch (TransformerConfigurationException e1) { throw new AssertionError("The Tranformer configuration must be valid!"); } Transformer serializer = hd.getTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING, CHARSET); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); hd.setResult(streamResult); try { hd.startDocument(); hd.startElement("", "", DICTIONARY_ELEMENT, new AttributesImpl()); while (entries.hasNext()) { Entry entry = entries.next(); serializeEntry(hd, entry); } hd.endElement("", "", DICTIONARY_ELEMENT); hd.endDocument(); } catch (SAXException e) { throw new IOException("There was an error during serialization!"); } }
static void function(OutputStream out, Iterator<Entry> entries) throws IOException { StreamResult streamResult = new StreamResult(out); SAXTransformerFactory tf = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); TransformerHandler hd; try { hd = tf.newTransformerHandler(); } catch (TransformerConfigurationException e1) { throw new AssertionError(STR); } Transformer serializer = hd.getTransformer(); serializer.setOutputProperty(OutputKeys.ENCODING, CHARSET); serializer.setOutputProperty(OutputKeys.INDENT, "yes"); hd.setResult(streamResult); try { hd.startDocument(); hd.startElement(STR", DICTIONARY_ELEMENT, new AttributesImpl()); while (entries.hasNext()) { Entry entry = entries.next(); serializeEntry(hd, entry); } hd.endElement(STRSTRThere was an error during serialization!"); } }
/** * Serializes the given entries to the given {@link OutputStream}. * * After the serialization is finished the provided * {@link OutputStream} remains open. * * @param out * @param entries * * @throws IOException If an I/O error occurs */
Serializes the given entries to the given <code>OutputStream</code>. After the serialization is finished the provided <code>OutputStream</code> remains open
serialize
{ "repo_name": "mccraigmccraig/opennlp", "path": "src/main/java/opennlp/tools/dictionary/serializer/DictionarySerializer.java", "license": "apache-2.0", "size": 8275 }
[ "java.io.IOException", "java.io.OutputStream", "java.util.Iterator", "javax.xml.transform.OutputKeys", "javax.xml.transform.Transformer", "javax.xml.transform.TransformerConfigurationException", "javax.xml.transform.sax.SAXTransformerFactory", "javax.xml.transform.sax.TransformerHandler", "javax.xml...
import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; import org.xml.sax.helpers.AttributesImpl;
import java.io.*; import java.util.*; import javax.xml.transform.*; import javax.xml.transform.sax.*; import javax.xml.transform.stream.*; import org.xml.sax.helpers.*;
[ "java.io", "java.util", "javax.xml", "org.xml.sax" ]
java.io; java.util; javax.xml; org.xml.sax;
1,792,920
ImmutableList<SchemaOrgType> getMusicReleaseFormatList();
ImmutableList<SchemaOrgType> getMusicReleaseFormatList();
/** * Returns the value list of property musicReleaseFormat. Empty list is returned if the property * not set in current object. */
Returns the value list of property musicReleaseFormat. Empty list is returned if the property not set in current object
getMusicReleaseFormatList
{ "repo_name": "google/schemaorg-java", "path": "src/main/java/com/google/schemaorg/core/MusicRelease.java", "license": "apache-2.0", "size": 28526 }
[ "com.google.common.collect.ImmutableList", "com.google.schemaorg.SchemaOrgType" ]
import com.google.common.collect.ImmutableList; import com.google.schemaorg.SchemaOrgType;
import com.google.common.collect.*; import com.google.schemaorg.*;
[ "com.google.common", "com.google.schemaorg" ]
com.google.common; com.google.schemaorg;
1,335,029