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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Override public void setup(OperatorContext context) { queryQueueManager.setup(context); }
void function(OperatorContext context) { queryQueueManager.setup(context); }
/** * This method should be called from the {@link com.datatorrent.api.Operator#setup} method so that the QueryManagerSynchronous can correctly initialize its internal state. * @param context The operator context. */
This method should be called from the <code>com.datatorrent.api.Operator#setup</code> method so that the
setup
{ "repo_name": "ananthc/apex-malhar", "path": "library/src/main/java/org/apache/apex/malhar/lib/appdata/query/QueryManagerSynchronous.java", "license": "apache-2.0", "size": 7742 }
[ "com.datatorrent.api.Context" ]
import com.datatorrent.api.Context;
import com.datatorrent.api.*;
[ "com.datatorrent.api" ]
com.datatorrent.api;
2,459,187
public int[] pixelCoords(final Vector3d p) { int[] coords = new int[2]; pixelCoords(p, coords); return coords; }
int[] function(final Vector3d p) { int[] coords = new int[2]; pixelCoords(p, coords); return coords; }
/** * from position on detector, work out pixel coordinates * * @param p * position vector * @return integer array of pixel coordinates */
from position on detector, work out pixel coordinates
pixelCoords
{ "repo_name": "willrogers/dawnsci", "path": "org.eclipse.dawnsci.analysis.api/src/org/eclipse/dawnsci/analysis/api/diffraction/DetectorProperties.java", "license": "epl-1.0", "size": 35253 }
[ "javax.vecmath.Vector3d" ]
import javax.vecmath.Vector3d;
import javax.vecmath.*;
[ "javax.vecmath" ]
javax.vecmath;
2,659,067
@EventHandler(value = "click", target = "@btnNext") private void onClick$btnNext() { history.next(); }
@EventHandler(value = "click", target = STR) private void onClick$btnNext() { history.next(); }
/** * Moves to the next topic in the view history. */
Moves to the next topic in the view history
onClick$btnNext
{ "repo_name": "carewebframework/carewebframework-core", "path": "org.carewebframework.help-parent/org.carewebframework.help.core/src/main/java/org/carewebframework/help/viewer/HelpViewer.java", "license": "apache-2.0", "size": 16114 }
[ "org.fujion.annotation.EventHandler" ]
import org.fujion.annotation.EventHandler;
import org.fujion.annotation.*;
[ "org.fujion.annotation" ]
org.fujion.annotation;
2,494,442
public Target2 getTarget() { return target; }
Target2 function() { return target; }
/** * Gets the associated target. */
Gets the associated target
getTarget
{ "repo_name": "shyTNT/BingAds-Java-SDK", "path": "src/main/java/com/microsoft/bingads/bulk/entities/BulkTarget.java", "license": "mit", "size": 22886 }
[ "com.microsoft.bingads.campaignmanagement.Target2" ]
import com.microsoft.bingads.campaignmanagement.Target2;
import com.microsoft.bingads.campaignmanagement.*;
[ "com.microsoft.bingads" ]
com.microsoft.bingads;
2,123,467
EDataType getDataTransmissionModeTypeObject();
EDataType getDataTransmissionModeTypeObject();
/** * Returns the meta object for data type '{@link net.opengis.wps20.DataTransmissionModeType <em>Data Transmission Mode Type Object</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for data type '<em>Data Transmission Mode Type Object</em>'. * @see net.opengis.wps20.DataTransmissionModeType * @model instanceClass="net.opengis.wps20.DataTransmissionModeType" * extendedMetaData="name='DataTransmissionModeType:Object' baseType='DataTransmissionModeType'" * @generated */
Returns the meta object for data type '<code>net.opengis.wps20.DataTransmissionModeType Data Transmission Mode Type Object</code>'.
getDataTransmissionModeTypeObject
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wps/src/net/opengis/wps20/Wps20Package.java", "license": "lgpl-2.1", "size": 228745 }
[ "org.eclipse.emf.ecore.EDataType" ]
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
173,298
@ServiceMethod(returns = ReturnType.SINGLE) CustomDomainInner delete( String resourceGroupName, String profileName, String endpointName, String customDomainName, Context context);
@ServiceMethod(returns = ReturnType.SINGLE) CustomDomainInner delete( String resourceGroupName, String profileName, String endpointName, String customDomainName, Context context);
/** * Deletes an existing custom domain within an endpoint. * * @param resourceGroupName Name of the Resource group within the Azure subscription. * @param profileName Name of the CDN profile which is unique within the resource group. * @param endpointName Name of the endpoint under the profile which is unique globally. * @param customDomainName Name of the custom domain within an endpoint. * @param context The context to associate with this operation. * @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 response. */
Deletes an existing custom domain within an endpoint
delete
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/fluent/CustomDomainsClient.java", "license": "mit", "size": 34863 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context", "com.azure.resourcemanager.cdn.fluent.models.CustomDomainInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.cdn.fluent.models.CustomDomainInner;
import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.cdn.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,011,894
private static Map<String, Annotation> buildAnnotationNames( Set<String> annotationWhitelist) { ImmutableMap.Builder<String, Annotation> annotationBuilder = ImmutableMap.builder(); annotationBuilder.putAll(Annotation.recognizedAnnotations); for (String unrecognizedAnnotation : annotationWhitelist) { if (!unrecognizedAnnotation.isEmpty() && !Annotation.recognizedAnnotations.containsKey( unrecognizedAnnotation)) { annotationBuilder.put( unrecognizedAnnotation, Annotation.NOT_IMPLEMENTED); } } return annotationBuilder.build(); }
static Map<String, Annotation> function( Set<String> annotationWhitelist) { ImmutableMap.Builder<String, Annotation> annotationBuilder = ImmutableMap.builder(); annotationBuilder.putAll(Annotation.recognizedAnnotations); for (String unrecognizedAnnotation : annotationWhitelist) { if (!unrecognizedAnnotation.isEmpty() && !Annotation.recognizedAnnotations.containsKey( unrecognizedAnnotation)) { annotationBuilder.put( unrecognizedAnnotation, Annotation.NOT_IMPLEMENTED); } } return annotationBuilder.build(); }
/** * Create the annotation names from the user-specified * annotation whitelist. */
Create the annotation names from the user-specified annotation whitelist
buildAnnotationNames
{ "repo_name": "superkonduktr/closure-compiler", "path": "src/com/google/javascript/jscomp/parsing/Config.java", "license": "apache-2.0", "size": 3295 }
[ "com.google.common.collect.ImmutableMap", "java.util.Map", "java.util.Set" ]
import com.google.common.collect.ImmutableMap; import java.util.Map; import java.util.Set;
import com.google.common.collect.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
2,168,449
public List<TransMeta> generateDimensionTransformations() throws KettleException { DatabaseMeta databaseMeta = findTargetDatabaseMeta(); List<TransMeta> transMetas = new ArrayList<TransMeta>(); List<LogicalTable> logicalTables = getUniqueLogicalTables(); for (LogicalTable logicalTable : logicalTables) { TableType tableType = ConceptUtil.getTableType(logicalTable); DimensionType dimensionType = ConceptUtil.getDimensionType(logicalTable); if (tableType == TableType.DIMENSION) { switch(dimensionType) { case SLOWLY_CHANGING_DIMENSION: case JUNK_DIMENSION: { TransMeta transMeta = generateDimensionTransformation(databaseMeta, logicalTable); transMetas.add(transMeta); } break; case DATE: // TODO: generate a standard date transformation { TransMeta transMeta = generateDateTransformation(databaseMeta, logicalTable); transMetas.add(transMeta); } break; case TIME: // TODO: generate a standard time transformation { TransMeta transMeta = generateTimeTransformation(databaseMeta, logicalTable); transMetas.add(transMeta); } break; default: break; } } } return transMetas; }
List<TransMeta> function() throws KettleException { DatabaseMeta databaseMeta = findTargetDatabaseMeta(); List<TransMeta> transMetas = new ArrayList<TransMeta>(); List<LogicalTable> logicalTables = getUniqueLogicalTables(); for (LogicalTable logicalTable : logicalTables) { TableType tableType = ConceptUtil.getTableType(logicalTable); DimensionType dimensionType = ConceptUtil.getDimensionType(logicalTable); if (tableType == TableType.DIMENSION) { switch(dimensionType) { case SLOWLY_CHANGING_DIMENSION: case JUNK_DIMENSION: { TransMeta transMeta = generateDimensionTransformation(databaseMeta, logicalTable); transMetas.add(transMeta); } break; case DATE: { TransMeta transMeta = generateDateTransformation(databaseMeta, logicalTable); transMetas.add(transMeta); } break; case TIME: { TransMeta transMeta = generateTimeTransformation(databaseMeta, logicalTable); transMetas.add(transMeta); } break; default: break; } } } return transMetas; }
/** * This method generates a list of transformations: one for each dimension. * * @return the list of generated transformations */
This method generates a list of transformations: one for each dimension
generateDimensionTransformations
{ "repo_name": "TatsianaKasiankova/pentaho-kettle", "path": "plugins/star-modeler/src/org/pentaho/di/starmodeler/generator/JobGenerator.java", "license": "apache-2.0", "size": 28134 }
[ "java.util.ArrayList", "java.util.List", "org.pentaho.di.core.database.DatabaseMeta", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.starmodeler.ConceptUtil", "org.pentaho.di.starmodeler.DimensionType", "org.pentaho.di.trans.TransMeta", "org.pentaho.metadata.model.LogicalTable", "org.pentaho.metadata.model.concept.types.TableType" ]
import java.util.ArrayList; import java.util.List; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.starmodeler.ConceptUtil; import org.pentaho.di.starmodeler.DimensionType; import org.pentaho.di.trans.TransMeta; import org.pentaho.metadata.model.LogicalTable; import org.pentaho.metadata.model.concept.types.TableType;
import java.util.*; import org.pentaho.di.core.database.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.starmodeler.*; import org.pentaho.di.trans.*; import org.pentaho.metadata.model.*; import org.pentaho.metadata.model.concept.types.*;
[ "java.util", "org.pentaho.di", "org.pentaho.metadata" ]
java.util; org.pentaho.di; org.pentaho.metadata;
269,884
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); }
void function(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_details); }
/** * Called when the activity is first created. */
Called when the activity is first created
onCreate
{ "repo_name": "groschovskiy/lerigos_music", "path": "Android/tv/src/main/java/com/lerigos/music/DetailsActivity.java", "license": "apache-2.0", "size": 1164 }
[ "android.os.Bundle" ]
import android.os.Bundle;
import android.os.*;
[ "android.os" ]
android.os;
42,475
private void checkBody(JSONObject payload) throws JSONException { // Checks that body is present if (!payload.has("body")) throw new JSONException("No body specified, 'body' field is required"); // Check subject and body size if (payload.getString("body").length() > Integer.parseInt(emailProxyMaxBodySize)) throw new IllegalArgumentException( "Body is too long, it should not exceed " + emailProxyMaxBodySize + " bytes"); }
void function(JSONObject payload) throws JSONException { if (!payload.has("body")) throw new JSONException(STR); if (payload.getString("body").length() > Integer.parseInt(emailProxyMaxBodySize)) throw new IllegalArgumentException( STR + emailProxyMaxBodySize + STR); }
/** * Checks 'body' of request against configuration * * @param payload JSONObject to search body in */
Checks 'body' of request against configuration
checkBody
{ "repo_name": "landryb/georchestra", "path": "console/src/main/java/org/georchestra/console/ws/emails/EmailController.java", "license": "gpl-3.0", "size": 23756 }
[ "org.json.JSONException", "org.json.JSONObject" ]
import org.json.JSONException; import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
338,439
protected final void usage(JCommander jc, ParameterException t) { System.out.println(Constants.BORDER); System.out.println(Constants.getGitBlitVersion()); System.out.println(Constants.BORDER); System.out.println(); if (t != null) { System.out.println(t.getMessage()); System.out.println(); } if (jc != null) { jc.usage(); System.out .println("\nExample:\n java -server -Xmx1024M -jar gitblit.jar --repositoriesFolder c:\\git --httpPort 80 --httpsPort 443"); } System.exit(0); }
final void function(JCommander jc, ParameterException t) { System.out.println(Constants.BORDER); System.out.println(Constants.getGitBlitVersion()); System.out.println(Constants.BORDER); System.out.println(); if (t != null) { System.out.println(t.getMessage()); System.out.println(); } if (jc != null) { jc.usage(); System.out .println(STR); } System.exit(0); }
/** * Display the command line usage of Gitblit GO. * * @param jc * @param t */
Display the command line usage of Gitblit GO
usage
{ "repo_name": "BullShark/IRCBlit", "path": "src/main/java/com/gitblit/GitBlitServer.java", "license": "apache-2.0", "size": 22734 }
[ "com.beust.jcommander.JCommander", "com.beust.jcommander.ParameterException" ]
import com.beust.jcommander.JCommander; import com.beust.jcommander.ParameterException;
import com.beust.jcommander.*;
[ "com.beust.jcommander" ]
com.beust.jcommander;
1,051,557
@FIXVersion(introduced = "5.0SP1") @TagNumRef(tagNum = TagNum.SecurityXMLSchema) public String getSecurityXMLSchema() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
@FIXVersion(introduced = STR) @TagNumRef(tagNum = TagNum.SecurityXMLSchema) String function() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); }
/** * Message field getter. * @return field value */
Message field getter
getSecurityXMLSchema
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/comp/SecurityXML.java", "license": "gpl-3.0", "size": 12632 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "net.hades.fix" ]
net.hades.fix;
1,615,953
@SuppressWarnings("deprecation") public void testConfigurableSitePublicGroup() throws Exception { AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // We'll be configuring a JMX managed bean (in this test method only). ChildApplicationContextFactory sysAdminSubsystem = (ChildApplicationContextFactory) applicationContext.getBean("sysAdmin"); final String sitePublicGroupPropName = "site.public.group"; final String originalSitePublicGroup = "GROUP_EVERYONE"; try { // Firstly we'll ensure that the site.public.group has the correct (pristine) value. String groupName = sysAdminSubsystem.getProperty(sitePublicGroupPropName); assertEquals(sitePublicGroupPropName + " was not the pristine value", originalSitePublicGroup, groupName); // Create a 'normal', unconfigured site. SiteInfo unconfiguredSite = siteService.createSite(TEST_SITE_PRESET, "unconfigured", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); assertTrue(containsConsumerPermission(originalSitePublicGroup, unconfiguredSite)); // Now set the managed bean's visibility group to something other than GROUP_EVERYONE. // This is the group that will have visibility of subsequently created sites. // // We'll intentionally set it to a group that DOES NOT EXIST YET. String newGroupName = this.getClass().getSimpleName() + System.currentTimeMillis(); String prefixedNewGroupName = PermissionService.GROUP_PREFIX + newGroupName; sysAdminSubsystem.stop(); sysAdminSubsystem.setProperty(sitePublicGroupPropName, prefixedNewGroupName); sysAdminSubsystem.start(); // Now create a site as before. It should fail as we're using a group that doesn't exist. boolean expectedExceptionThrown = false; try { siteService.createSite(TEST_SITE_PRESET, "thisShouldFail", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); } catch (SiteServiceException expected) { expectedExceptionThrown = true; } if (!expectedExceptionThrown) { fail("Expected exception on createSite with non-existent group was not thrown."); } // Now we'll create the group used above. authorityService.createAuthority(AuthorityType.GROUP, newGroupName); // And create the site as before. This time it should succeed. SiteInfo configuredSite = siteService.createSite(TEST_SITE_PRESET, "configured", TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); // And check the permissions on the site. assertTrue("The configured site should not have " + originalSitePublicGroup + " as SiteContributor", !containsConsumerPermission(originalSitePublicGroup, configuredSite)); assertTrue("The configured site should have (newGroupName) as SiteContributor", containsConsumerPermission(prefixedNewGroupName, configuredSite)); } finally { // Reset the JMX bean to its out-of-the-box values. sysAdminSubsystem.stop(); sysAdminSubsystem.setProperty(sitePublicGroupPropName, originalSitePublicGroup); sysAdminSubsystem.start(); } }
@SuppressWarnings(STR) void function() throws Exception { AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); ChildApplicationContextFactory sysAdminSubsystem = (ChildApplicationContextFactory) applicationContext.getBean(STR); final String sitePublicGroupPropName = STR; final String originalSitePublicGroup = STR; try { String groupName = sysAdminSubsystem.getProperty(sitePublicGroupPropName); assertEquals(sitePublicGroupPropName + STR, originalSitePublicGroup, groupName); SiteInfo unconfiguredSite = siteService.createSite(TEST_SITE_PRESET, STR, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); assertTrue(containsConsumerPermission(originalSitePublicGroup, unconfiguredSite)); String newGroupName = this.getClass().getSimpleName() + System.currentTimeMillis(); String prefixedNewGroupName = PermissionService.GROUP_PREFIX + newGroupName; sysAdminSubsystem.stop(); sysAdminSubsystem.setProperty(sitePublicGroupPropName, prefixedNewGroupName); sysAdminSubsystem.start(); boolean expectedExceptionThrown = false; try { siteService.createSite(TEST_SITE_PRESET, STR, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); } catch (SiteServiceException expected) { expectedExceptionThrown = true; } if (!expectedExceptionThrown) { fail(STR); } authorityService.createAuthority(AuthorityType.GROUP, newGroupName); SiteInfo configuredSite = siteService.createSite(TEST_SITE_PRESET, STR, TEST_TITLE, TEST_DESCRIPTION, SiteVisibility.PUBLIC); assertTrue(STR + originalSitePublicGroup + STR, !containsConsumerPermission(originalSitePublicGroup, configuredSite)); assertTrue(STR, containsConsumerPermission(prefixedNewGroupName, configuredSite)); } finally { sysAdminSubsystem.stop(); sysAdminSubsystem.setProperty(sitePublicGroupPropName, originalSitePublicGroup); sysAdminSubsystem.start(); } }
/** * This method tests https://issues.alfresco.com/jira/browse/ALF-3785 which allows 'public' sites * to be only visible to members of a configured group, by default EVERYONE. * * @author Neil McErlean * @since 3.4 */
This method tests HREF which allows 'public' sites to be only visible to members of a configured group, by default EVERYONE
testConfigurableSitePublicGroup
{ "repo_name": "daniel-he/community-edition", "path": "projects/repository/source/test-java/org/alfresco/repo/site/SiteServiceImplTest.java", "license": "lgpl-3.0", "size": 126824 }
[ "org.alfresco.repo.management.subsystems.ChildApplicationContextFactory", "org.alfresco.repo.security.authentication.AuthenticationUtil", "org.alfresco.service.cmr.security.AuthorityType", "org.alfresco.service.cmr.security.PermissionService", "org.alfresco.service.cmr.site.SiteInfo", "org.alfresco.service.cmr.site.SiteVisibility" ]
import org.alfresco.repo.management.subsystems.ChildApplicationContextFactory; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.security.AuthorityType; import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.cmr.site.SiteInfo; import org.alfresco.service.cmr.site.SiteVisibility;
import org.alfresco.repo.management.subsystems.*; import org.alfresco.repo.security.authentication.*; import org.alfresco.service.cmr.security.*; import org.alfresco.service.cmr.site.*;
[ "org.alfresco.repo", "org.alfresco.service" ]
org.alfresco.repo; org.alfresco.service;
26,152
public String toString () { return super.toString (Literals.EQ); }
String function () { return super.toString (Literals.EQ); }
/** * For debugging purpose. * * @return This expression as string * */
For debugging purpose
toString
{ "repo_name": "integrated/jakarta-slide-server", "path": "src/share/org/apache/slide/search/basic/expression/EQExpression.java", "license": "apache-2.0", "size": 2557 }
[ "org.apache.slide.search.basic.Literals" ]
import org.apache.slide.search.basic.Literals;
import org.apache.slide.search.basic.*;
[ "org.apache.slide" ]
org.apache.slide;
1,335,481
public void removeAgedItems(long latest, boolean notify) { if (this.data.isEmpty()) { return; // nothing to do } // find the serial index of the period specified by 'latest' long index = Long.MAX_VALUE; try { Method m = RegularTimePeriod.class.getDeclaredMethod( "createInstance", new Class[] {Class.class, Date.class, TimeZone.class}); RegularTimePeriod newest = (RegularTimePeriod) m.invoke( this.timePeriodClass, new Object[] {this.timePeriodClass, new Date(latest), TimeZone.getDefault()}); index = newest.getSerialIndex(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } // check if there are any values earlier than specified by the history // count... boolean removed = false; while (getItemCount() > 0 && (index - getTimePeriod(0).getSerialIndex()) > this.maximumItemAge) { this.data.remove(0); removed = true; } if (removed) { findBoundsByIteration(); if (notify) { fireSeriesChanged(); } } }
void function(long latest, boolean notify) { if (this.data.isEmpty()) { return; } long index = Long.MAX_VALUE; try { Method m = RegularTimePeriod.class.getDeclaredMethod( STR, new Class[] {Class.class, Date.class, TimeZone.class}); RegularTimePeriod newest = (RegularTimePeriod) m.invoke( this.timePeriodClass, new Object[] {this.timePeriodClass, new Date(latest), TimeZone.getDefault()}); index = newest.getSerialIndex(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } boolean removed = false; while (getItemCount() > 0 && (index - getTimePeriod(0).getSerialIndex()) > this.maximumItemAge) { this.data.remove(0); removed = true; } if (removed) { findBoundsByIteration(); if (notify) { fireSeriesChanged(); } } }
/** * Age items in the series. Ensure that the timespan from the supplied * time to the oldest record in the series does not exceed history count. * oldest items will be removed if required. * * @param latest the time to be compared against when aging data * (specified in milliseconds). * @param notify controls whether or not a {@link SeriesChangeEvent} is * sent to registered listeners IF any items are removed. */
Age items in the series. Ensure that the timespan from the supplied time to the oldest record in the series does not exceed history count. oldest items will be removed if required
removeAgedItems
{ "repo_name": "Mr-Steve/LTSpice_Library_Manager", "path": "libs/jfreechart-1.0.16/source/org/jfree/data/time/TimeSeries.java", "license": "gpl-2.0", "size": 48310 }
[ "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method", "java.util.Date", "java.util.TimeZone" ]
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Date; import java.util.TimeZone;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,478,976
public boolean deleteApiForTenant(String apiProviderName, String apiName, String version, String tenantDomain) throws AxisFault { RESTAPIAdminServiceProxy restClient = getRestapiAdminClient(tenantDomain); // Delete secure vault alias properties if exists deleteRegistryProperty(apiProviderName, apiName, version, tenantDomain); String qualifiedName = GatewayUtils.getQualifiedApiName(apiProviderName, apiName, version); return restClient.deleteApi(qualifiedName); }
boolean function(String apiProviderName, String apiName, String version, String tenantDomain) throws AxisFault { RESTAPIAdminServiceProxy restClient = getRestapiAdminClient(tenantDomain); deleteRegistryProperty(apiProviderName, apiName, version, tenantDomain); String qualifiedName = GatewayUtils.getQualifiedApiName(apiProviderName, apiName, version); return restClient.deleteApi(qualifiedName); }
/** * Delete the API from Gateway * * @param tenantDomain * @throws AxisFault */
Delete the API from Gateway
deleteApiForTenant
{ "repo_name": "harsha89/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java", "license": "apache-2.0", "size": 41004 }
[ "org.apache.axis2.AxisFault", "org.wso2.carbon.apimgt.gateway.utils.GatewayUtils", "org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy" ]
import org.apache.axis2.AxisFault; import org.wso2.carbon.apimgt.gateway.utils.GatewayUtils; import org.wso2.carbon.apimgt.gateway.utils.RESTAPIAdminServiceProxy;
import org.apache.axis2.*; import org.wso2.carbon.apimgt.gateway.utils.*;
[ "org.apache.axis2", "org.wso2.carbon" ]
org.apache.axis2; org.wso2.carbon;
2,783,410
public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_)); }
void function(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) { this.func_149797_b(p_149719_1_.getBlockMetadata(p_149719_2_, p_149719_3_, p_149719_4_)); }
/** * Updates the blocks bounds based on its current state. Args: world, x, y, z */
Updates the blocks bounds based on its current state. Args: world, x, y, z
setBlockBoundsBasedOnState
{ "repo_name": "kitsushadow/ForgeCraft", "path": "old_src/1.10.2/1-7-10Resources/src/main/java/com/kitsu/medievalcraft/block/wood/quartersplit/AcaciaSplitLog.java", "license": "lgpl-2.1", "size": 5708 }
[ "net.minecraft.world.IBlockAccess" ]
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.*;
[ "net.minecraft.world" ]
net.minecraft.world;
807,418
public void setProperties(Map<String,String> map) throws Exception { String matches = map.get(MATCH); if (matches != null) { for (String p : matches.split("\\s*,\\s*")) { matchers.add(new Glob(p)); } } }
void function(Map<String,String> map) throws Exception { String matches = map.get(MATCH); if (matches != null) { for (String p : matches.split(STR)) { matchers.add(new Glob(p)); } } }
/** * Set the properties for this plugin. Subclasses should call this method * before they handle their own properties. */
Set the properties for this plugin. Subclasses should call this method before they handle their own properties
setProperties
{ "repo_name": "joansmith/bnd", "path": "biz.aQute.bndlib/src/aQute/bnd/url/DefaultURLConnectionHandler.java", "license": "apache-2.0", "size": 3232 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,033,926
@Override protected Credential parseCredential(XMLStreamReader reader) throws XMLStreamException, ParserException, ValidateException { String userName = null; String password = null; String securityDomain = null; boolean elytronEnabled = false; String authenticationContext = null; while (reader.hasNext()) { switch (reader.nextTag()) { case END_ELEMENT: { if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.SECURITY || Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.RECOVER_CREDENTIAL) { return new CredentialImpl(userName, password, elytronEnabled? authenticationContext: securityDomain, elytronEnabled, null); } else { if (Credential.Tag.forName(reader.getLocalName()) == Credential.Tag.UNKNOWN) { throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); } } break; } case START_ELEMENT: { switch (Credential.Tag.forName(reader.getLocalName())) { case PASSWORD: { password = elementAsString(reader); if (propertyResolver != null && password != null) { String resolvedPassword = propertyResolver.resolve(password); if (resolvedPassword != null) password = resolvedPassword; } break; } case USER_NAME: { userName = elementAsString(reader); break; } case SECURITY_DOMAIN: { securityDomain = elementAsString(reader); break; } case ELYTRON_ENABLED: { Boolean value = elementAsBoolean(reader); elytronEnabled = value == null? true : value; break; } case AUTHENTICATION_CONTEXT: { authenticationContext = elementAsString(reader); break; } default: throw new ParserException(bundle.unexpectedElement(reader.getLocalName())); } break; } } } throw new ParserException(bundle.unexpectedEndOfDocument()); }
Credential function(XMLStreamReader reader) throws XMLStreamException, ParserException, ValidateException { String userName = null; String password = null; String securityDomain = null; boolean elytronEnabled = false; String authenticationContext = null; while (reader.hasNext()) { switch (reader.nextTag()) { case END_ELEMENT: { if (DataSource.Tag.forName(reader.getLocalName()) == DataSource.Tag.SECURITY Recovery.Tag.forName(reader.getLocalName()) == Recovery.Tag.RECOVER_CREDENTIAL) { return new CredentialImpl(userName, password, elytronEnabled? authenticationContext: securityDomain, elytronEnabled, null); } else { if (Credential.Tag.forName(reader.getLocalName()) == Credential.Tag.UNKNOWN) { throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName())); } } break; } case START_ELEMENT: { switch (Credential.Tag.forName(reader.getLocalName())) { case PASSWORD: { password = elementAsString(reader); if (propertyResolver != null && password != null) { String resolvedPassword = propertyResolver.resolve(password); if (resolvedPassword != null) password = resolvedPassword; } break; } case USER_NAME: { userName = elementAsString(reader); break; } case SECURITY_DOMAIN: { securityDomain = elementAsString(reader); break; } case ELYTRON_ENABLED: { Boolean value = elementAsBoolean(reader); elytronEnabled = value == null? true : value; break; } case AUTHENTICATION_CONTEXT: { authenticationContext = elementAsString(reader); break; } default: throw new ParserException(bundle.unexpectedElement(reader.getLocalName())); } break; } } } throw new ParserException(bundle.unexpectedEndOfDocument()); }
/** * parse credential tag * * @param reader reader * @return the parse Object * @throws XMLStreamException in case of error * @throws ParserException in case of error * @throws ValidateException in case of error */
parse credential tag
parseCredential
{ "repo_name": "xasx/wildfly", "path": "connector/src/main/java/org/jboss/as/connector/deployers/ds/DsXmlParser.java", "license": "lgpl-2.1", "size": 10050 }
[ "javax.xml.stream.XMLStreamException", "javax.xml.stream.XMLStreamReader", "org.jboss.as.connector.metadata.api.common.Credential", "org.jboss.as.connector.metadata.common.CredentialImpl", "org.jboss.jca.common.api.metadata.common.Recovery", "org.jboss.jca.common.api.metadata.ds.DataSource", "org.jboss.jca.common.api.validator.ValidateException", "org.jboss.jca.common.metadata.ParserException" ]
import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.jboss.as.connector.metadata.api.common.Credential; import org.jboss.as.connector.metadata.common.CredentialImpl; import org.jboss.jca.common.api.metadata.common.Recovery; import org.jboss.jca.common.api.metadata.ds.DataSource; import org.jboss.jca.common.api.validator.ValidateException; import org.jboss.jca.common.metadata.ParserException;
import javax.xml.stream.*; import org.jboss.as.connector.metadata.api.common.*; import org.jboss.as.connector.metadata.common.*; import org.jboss.jca.common.api.metadata.common.*; import org.jboss.jca.common.api.metadata.ds.*; import org.jboss.jca.common.api.validator.*; import org.jboss.jca.common.metadata.*;
[ "javax.xml", "org.jboss.as", "org.jboss.jca" ]
javax.xml; org.jboss.as; org.jboss.jca;
882,856
SiteVnetInfo.DefinitionStages.Blank defineVirtualNetworkConnection(String name);
SiteVnetInfo.DefinitionStages.Blank defineVirtualNetworkConnection(String name);
/** * Begins definition for a new VirtualNetworkConnection resource. * @param name resource name. * @return the first stage of the new VirtualNetworkConnection definition. */
Begins definition for a new VirtualNetworkConnection resource
defineVirtualNetworkConnection
{ "repo_name": "hovsepm/azure-sdk-for-java", "path": "appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/WebApps.java", "license": "mit", "size": 204730 }
[ "com.microsoft.azure.management.appservice.v2018_02_01.SiteVnetInfo" ]
import com.microsoft.azure.management.appservice.v2018_02_01.SiteVnetInfo;
import com.microsoft.azure.management.appservice.v2018_02_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,026,908
private static void setStringValue(final JsonParser jp, final ExtendedBasicDMPJPAObject object, final String currentFieldName) throws IOException { if (TransformationDeserializer.NAME_KEY.equals(currentFieldName)) { object.setName(jp.getText()); } else if (TransformationDeserializer.DESCRIPTION_KEY.equals(currentFieldName)) { object.setDescription(jp.getText()); } } /** * Set the function description of a transformation. Requires an object behind function_description. * * @param jp the current json parser * @param transformation the target {@code Transformation}
static void function(final JsonParser jp, final ExtendedBasicDMPJPAObject object, final String currentFieldName) throws IOException { if (TransformationDeserializer.NAME_KEY.equals(currentFieldName)) { object.setName(jp.getText()); } else if (TransformationDeserializer.DESCRIPTION_KEY.equals(currentFieldName)) { object.setDescription(jp.getText()); } } /** * Set the function description of a transformation. Requires an object behind function_description. * * @param jp the current json parser * @param transformation the target {@code Transformation}
/** * Set common string values (name, and description) for either a transformation or a component * * @param jp the current json parser * @param object either the transformation or the component * @param currentFieldName the json field name * @throws IOException */
Set common string values (name, and description) for either a transformation or a component
setStringValue
{ "repo_name": "dswarm/dswarm", "path": "persistence/src/main/java/org/dswarm/persistence/model/job/utils/TransformationDeserializer.java", "license": "apache-2.0", "size": 18701 }
[ "com.fasterxml.jackson.core.JsonParser", "java.io.IOException", "org.dswarm.persistence.model.ExtendedBasicDMPJPAObject", "org.dswarm.persistence.model.job.Transformation" ]
import com.fasterxml.jackson.core.JsonParser; import java.io.IOException; import org.dswarm.persistence.model.ExtendedBasicDMPJPAObject; import org.dswarm.persistence.model.job.Transformation;
import com.fasterxml.jackson.core.*; import java.io.*; import org.dswarm.persistence.model.*; import org.dswarm.persistence.model.job.*;
[ "com.fasterxml.jackson", "java.io", "org.dswarm.persistence" ]
com.fasterxml.jackson; java.io; org.dswarm.persistence;
1,725,552
public Result execStatementsFromFile( String filename, boolean sendSinglestatement ) throws KettleException { FileObject sqlFile = null; InputStream is = null; InputStreamReader bis = null; try { if ( Utils.isEmpty( filename ) ) { throw new KettleException( "Filename is missing!" ); } sqlFile = KettleVFS.getFileObject( filename ); if ( !sqlFile.exists() ) { throw new KettleException( "We can not find file [" + filename + "]!" ); } is = KettleVFS.getInputStream( sqlFile ); bis = new InputStreamReader( new BufferedInputStream( is, 500 ) ); StringBuilder lineStringBuilder = new StringBuilder( 256 ); lineStringBuilder.setLength( 0 ); BufferedReader buff = new BufferedReader( bis ); String sLine = null; StringBuilder sql = new StringBuilder( Const.CR ); while ( ( sLine = buff.readLine() ) != null ) { if ( Utils.isEmpty( sLine ) ) { sql.append( Const.CR ); } else { sql.append( Const.CR ).append( sLine ); } } if ( sendSinglestatement ) { return execStatement( sql.toString() ); } else { return execStatements( sql.toString() ); } } catch ( Exception e ) { throw new KettleException( e ); } finally { try { if ( sqlFile != null ) { sqlFile.close(); } if ( is != null ) { is.close(); } if ( bis != null ) { bis.close(); } } catch ( Exception e ) { // Ignore } } }
Result function( String filename, boolean sendSinglestatement ) throws KettleException { FileObject sqlFile = null; InputStream is = null; InputStreamReader bis = null; try { if ( Utils.isEmpty( filename ) ) { throw new KettleException( STR ); } sqlFile = KettleVFS.getFileObject( filename ); if ( !sqlFile.exists() ) { throw new KettleException( STR + filename + "]!" ); } is = KettleVFS.getInputStream( sqlFile ); bis = new InputStreamReader( new BufferedInputStream( is, 500 ) ); StringBuilder lineStringBuilder = new StringBuilder( 256 ); lineStringBuilder.setLength( 0 ); BufferedReader buff = new BufferedReader( bis ); String sLine = null; StringBuilder sql = new StringBuilder( Const.CR ); while ( ( sLine = buff.readLine() ) != null ) { if ( Utils.isEmpty( sLine ) ) { sql.append( Const.CR ); } else { sql.append( Const.CR ).append( sLine ); } } if ( sendSinglestatement ) { return execStatement( sql.toString() ); } else { return execStatements( sql.toString() ); } } catch ( Exception e ) { throw new KettleException( e ); } finally { try { if ( sqlFile != null ) { sqlFile.close(); } if ( is != null ) { is.close(); } if ( bis != null ) { bis.close(); } } catch ( Exception e ) { } } }
/** * Execute an SQL statement inside a file on the database connection (has to be open) * * @param sql The file that contains SQL to execute * @return a Result object indicating the number of lines read, deleted, inserted, updated, ... * @throws KettleDatabaseException in case anything goes wrong. * @sendSinglestatement send one statement */
Execute an SQL statement inside a file on the database connection (has to be open)
execStatementsFromFile
{ "repo_name": "pedrofvteixeira/pentaho-kettle", "path": "core/src/main/java/org/pentaho/di/core/database/Database.java", "license": "apache-2.0", "size": 180346 }
[ "java.io.BufferedInputStream", "java.io.BufferedReader", "java.io.InputStream", "java.io.InputStreamReader", "org.apache.commons.vfs2.FileObject", "org.pentaho.di.core.Const", "org.pentaho.di.core.Result", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.core.util.Utils", "org.pentaho.di.core.vfs.KettleVFS" ]
import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.Const; import org.pentaho.di.core.Result; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.util.Utils; import org.pentaho.di.core.vfs.KettleVFS;
import java.io.*; import org.apache.commons.vfs2.*; import org.pentaho.di.core.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.util.*; import org.pentaho.di.core.vfs.*;
[ "java.io", "org.apache.commons", "org.pentaho.di" ]
java.io; org.apache.commons; org.pentaho.di;
2,648,568
public void testJsonPlusBinary() throws Exception { // Create our test data, which has several binary streams in it final ByteArrayOutputStream baos = new ByteArrayOutputStream(512); baos.write("[{'freddy':'versus','json':'the-movie','my-binary䷴':`".getBytes(Charsets.UTF_8)); final byte[] stream1bytes = new byte[32]; new DataOutputStream(baos).writeLong(stream1bytes.length); for (int i = 0; i < stream1bytes.length; i++) { stream1bytes[i] = (byte) i; } baos.write(stream1bytes); baos.write("`},`".getBytes(Charsets.UTF_8)); final byte[] stream2bytes = new byte[7]; new DataOutputStream(baos).writeLong(stream2bytes.length); for (int i = 0; i < stream2bytes.length; i++) { stream2bytes[i] = (byte) (255 - i); } baos.write(stream2bytes); baos.write("`,{'䷓hello':'world'},`".getBytes(Charsets.UTF_8)); new DataOutputStream(baos).writeLong(0); baos.write("`,'meowДth']".getBytes(Charsets.UTF_8)); // Read this back using a JsonStreamReader. It's Freddy versus JSON. Or // is it JSON X -- Evil gets an upgrade? final InputStream in = new ByteArrayInputStream(baos.toByteArray()); final JsonStreamReader reader = new JsonStreamReader(in); assertEquals(JsonConstant.ARRAY_START, reader.next()); assertEquals(JsonConstant.OBJECT_START, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("freddy", reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("versus", reader.getValue()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("json", reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("the-movie", reader.getValue()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("my-binary䷴", reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.BINARY_STREAM, reader.next()); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32); IOUtil.copyStream(reader.getBinaryStream(), outputStream); assertTrue(Arrays.equals(stream1bytes, outputStream.toByteArray())); assertEquals(JsonConstant.OBJECT_END, reader.next()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.BINARY_STREAM, reader.next()); outputStream.reset(); IOUtil.copyStream(reader.getBinaryStream(), outputStream); assertTrue(Arrays.equals(stream2bytes, outputStream.toByteArray())); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.OBJECT_START, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("䷓hello", reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("world", reader.getValue()); assertEquals(JsonConstant.OBJECT_END, reader.next()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.BINARY_STREAM, reader.next()); outputStream.reset(); IOUtil.copyStream(reader.getBinaryStream(), outputStream); assertEquals(0, outputStream.toByteArray().length); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("meowДth", reader.getValue()); assertEquals(JsonConstant.ARRAY_END, reader.next()); assertEquals(JsonConstant.WHITESPACE, reader.next()); assertEquals(-1, in.read()); }
void function() throws Exception { final ByteArrayOutputStream baos = new ByteArrayOutputStream(512); baos.write(STR.getBytes(Charsets.UTF_8)); final byte[] stream1bytes = new byte[32]; new DataOutputStream(baos).writeLong(stream1bytes.length); for (int i = 0; i < stream1bytes.length; i++) { stream1bytes[i] = (byte) i; } baos.write(stream1bytes); baos.write("`},`".getBytes(Charsets.UTF_8)); final byte[] stream2bytes = new byte[7]; new DataOutputStream(baos).writeLong(stream2bytes.length); for (int i = 0; i < stream2bytes.length; i++) { stream2bytes[i] = (byte) (255 - i); } baos.write(stream2bytes); baos.write(STR.getBytes(Charsets.UTF_8)); new DataOutputStream(baos).writeLong(0); baos.write(STR.getBytes(Charsets.UTF_8)); final InputStream in = new ByteArrayInputStream(baos.toByteArray()); final JsonStreamReader reader = new JsonStreamReader(in); assertEquals(JsonConstant.ARRAY_START, reader.next()); assertEquals(JsonConstant.OBJECT_START, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals(STR, reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals(STR, reader.getValue()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("json", reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals(STR, reader.getValue()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals(STR, reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.BINARY_STREAM, reader.next()); final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32); IOUtil.copyStream(reader.getBinaryStream(), outputStream); assertTrue(Arrays.equals(stream1bytes, outputStream.toByteArray())); assertEquals(JsonConstant.OBJECT_END, reader.next()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.BINARY_STREAM, reader.next()); outputStream.reset(); IOUtil.copyStream(reader.getBinaryStream(), outputStream); assertTrue(Arrays.equals(stream2bytes, outputStream.toByteArray())); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.OBJECT_START, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals(STR, reader.getValue()); assertEquals(JsonConstant.OBJECT_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals("world", reader.getValue()); assertEquals(JsonConstant.OBJECT_END, reader.next()); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.BINARY_STREAM, reader.next()); outputStream.reset(); IOUtil.copyStream(reader.getBinaryStream(), outputStream); assertEquals(0, outputStream.toByteArray().length); assertEquals(JsonConstant.ENTRY_SEPARATOR, reader.next()); assertEquals(JsonConstant.STRING, reader.next()); assertEquals(STR, reader.getValue()); assertEquals(JsonConstant.ARRAY_END, reader.next()); assertEquals(JsonConstant.WHITESPACE, reader.next()); assertEquals(-1, in.read()); }
/** * Ensures that down-the-middle JSON+binary works properly */
Ensures that down-the-middle JSON+binary works properly
testJsonPlusBinary
{ "repo_name": "TribeMedia/aura", "path": "aura-util/src/test/java/org/auraframework/util/json/JsonStreamReaderTest.java", "license": "apache-2.0", "size": 53516 }
[ "com.google.common.base.Charsets", "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.io.DataOutputStream", "java.io.InputStream", "java.util.Arrays", "org.auraframework.util.IOUtil" ]
import com.google.common.base.Charsets; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.InputStream; import java.util.Arrays; import org.auraframework.util.IOUtil;
import com.google.common.base.*; import java.io.*; import java.util.*; import org.auraframework.util.*;
[ "com.google.common", "java.io", "java.util", "org.auraframework.util" ]
com.google.common; java.io; java.util; org.auraframework.util;
1,948,867
@POST @Path("/getLightweightMetaObjectsByQueryAndPattern") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getLightweightMetaObjectsByQueryAndPattern(@Context final HttpServletRequest hsr, @FormParam(PARAM_CLASS_ID) final String classIdBytes, @FormParam(PARAM_USER) final String userBytes, @FormParam(PARAM_QUERY) final String queryBytes, @FormParam(PARAM_REP_FIELDS) final String representationFieldsBytes, @FormParam(PARAM_REP_PATTERN) final String representationPatternBytes, @FormParam(PARAM_CONNECTIONCONTEXT) final String contextBytes) throws RemoteException { nameTheThread(hsr, "/getLightweightMetaObjectsByQueryAndPattern", "[bytes]", "classId=[bytes]", "..."); try { final int classId = Converter.deserialiseFromString(classIdBytes, int.class, isCompressionEnabled()); final User user = Converter.deserialiseFromString(userBytes, User.class, isCompressionEnabled()); final String query = Converter.deserialiseFromString(queryBytes, String.class, isCompressionEnabled()); final String[] representationFields = Converter.deserialiseFromString( representationFieldsBytes, String[].class, isCompressionEnabled()); final String representationPattern = Converter.deserialiseFromString( representationPatternBytes, String.class, isCompressionEnabled()); nameTheThread( hsr, "/getLightweightMetaObjectsByQueryAndPattern", user.toString(), "classId=" + classId, "..."); final ConnectionContext connectionContext = Converter.deserialiseFromString( contextBytes, ConnectionContext.class, isCompressionEnabled()); return createResponse(getCallserver().getLightweightMetaObjectsByQuery( classId, user, query, representationFields, representationPattern, ConnectionContextBackend.getInstance().addOriginToConnectionContext(hsr, connectionContext))); } catch (final Exception ex) { final String message = "could not get LightWeightMetaObjects"; // NOI18N throw createRemoteException(ex, message); } }
@Path(STR) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Produces(MediaType.APPLICATION_OCTET_STREAM) Response function(@Context final HttpServletRequest hsr, @FormParam(PARAM_CLASS_ID) final String classIdBytes, @FormParam(PARAM_USER) final String userBytes, @FormParam(PARAM_QUERY) final String queryBytes, @FormParam(PARAM_REP_FIELDS) final String representationFieldsBytes, @FormParam(PARAM_REP_PATTERN) final String representationPatternBytes, @FormParam(PARAM_CONNECTIONCONTEXT) final String contextBytes) throws RemoteException { nameTheThread(hsr, STR, STR, STR, "..."); try { final int classId = Converter.deserialiseFromString(classIdBytes, int.class, isCompressionEnabled()); final User user = Converter.deserialiseFromString(userBytes, User.class, isCompressionEnabled()); final String query = Converter.deserialiseFromString(queryBytes, String.class, isCompressionEnabled()); final String[] representationFields = Converter.deserialiseFromString( representationFieldsBytes, String[].class, isCompressionEnabled()); final String representationPattern = Converter.deserialiseFromString( representationPatternBytes, String.class, isCompressionEnabled()); nameTheThread( hsr, STR, user.toString(), STR + classId, "..."); final ConnectionContext connectionContext = Converter.deserialiseFromString( contextBytes, ConnectionContext.class, isCompressionEnabled()); return createResponse(getCallserver().getLightweightMetaObjectsByQuery( classId, user, query, representationFields, representationPattern, ConnectionContextBackend.getInstance().addOriginToConnectionContext(hsr, connectionContext))); } catch (final Exception ex) { final String message = STR; throw createRemoteException(ex, message); } }
/** * DOCUMENT ME! * * @param hsr DOCUMENT ME! * @param classIdBytes DOCUMENT ME! * @param userBytes user DOCUMENT ME! * @param queryBytes DOCUMENT ME! * @param representationFieldsBytes DOCUMENT ME! * @param representationPatternBytes DOCUMENT ME! * @param contextBytes DOCUMENT ME! * * @return DOCUMENT ME! * * @throws RemoteException WebApplicationException DOCUMENT ME! */
DOCUMENT ME
getLightweightMetaObjectsByQueryAndPattern
{ "repo_name": "cismet/cids-server", "path": "src/main/java/de/cismet/cids/server/ws/rest/RESTfulSerialInterface.java", "license": "lgpl-3.0", "size": 98607 }
[ "de.cismet.cids.server.connectioncontext.ConnectionContextBackend", "de.cismet.connectioncontext.ConnectionContext", "de.cismet.tools.Converter", "java.rmi.RemoteException", "javax.servlet.http.HttpServletRequest", "javax.ws.rs.Consumes", "javax.ws.rs.FormParam", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.core.Context", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import de.cismet.cids.server.connectioncontext.ConnectionContextBackend; import de.cismet.connectioncontext.ConnectionContext; import de.cismet.tools.Converter; import java.rmi.RemoteException; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.FormParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import de.cismet.cids.server.connectioncontext.*; import de.cismet.connectioncontext.*; import de.cismet.tools.*; import java.rmi.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "de.cismet.cids", "de.cismet.connectioncontext", "de.cismet.tools", "java.rmi", "javax.servlet", "javax.ws" ]
de.cismet.cids; de.cismet.connectioncontext; de.cismet.tools; java.rmi; javax.servlet; javax.ws;
2,296,798
List<Detail> findByBloodType(Integer bloodType);
List<Detail> findByBloodType(Integer bloodType);
/** * Method for search details in database by bloodType. * * @param bloodType Detail bloodType. * @return List of Detail objects with this bloodType. */
Method for search details in database by bloodType
findByBloodType
{ "repo_name": "solairerove/padlaboris", "path": "src/main/java/com/instinctools/padlaboris/domain/service/DetailService.java", "license": "mit", "size": 1590 }
[ "com.instinctools.padlaboris.domain.model.Detail", "java.util.List" ]
import com.instinctools.padlaboris.domain.model.Detail; import java.util.List;
import com.instinctools.padlaboris.domain.model.*; import java.util.*;
[ "com.instinctools.padlaboris", "java.util" ]
com.instinctools.padlaboris; java.util;
1,726,320
public void writeAtomic(T obj, BlobContainer blobContainer, String name) throws IOException { String blobName = blobName(name); String tempBlobName = tempBlobName(name); writeBlob(obj, blobContainer, tempBlobName); try { blobContainer.move(tempBlobName, blobName); } catch (IOException ex) { // Move failed - try cleaning up blobContainer.deleteBlob(tempBlobName); throw ex; } }
void function(T obj, BlobContainer blobContainer, String name) throws IOException { String blobName = blobName(name); String tempBlobName = tempBlobName(name); writeBlob(obj, blobContainer, tempBlobName); try { blobContainer.move(tempBlobName, blobName); } catch (IOException ex) { blobContainer.deleteBlob(tempBlobName); throw ex; } }
/** * Writes blob in atomic manner with resolving the blob name using {@link #blobName} and {@link #tempBlobName} methods. * <p> * The blob will be compressed and checksum will be written if required. * * Atomic move might be very inefficient on some repositories. It also cannot override existing files. * * @param obj object to be serialized * @param blobContainer blob container * @param name blob name */
Writes blob in atomic manner with resolving the blob name using <code>#blobName</code> and <code>#tempBlobName</code> methods. The blob will be compressed and checksum will be written if required. Atomic move might be very inefficient on some repositories. It also cannot override existing files
writeAtomic
{ "repo_name": "myelin/elasticsearch", "path": "core/src/main/java/org/elasticsearch/repositories/blobstore/ChecksumBlobStoreFormat.java", "license": "apache-2.0", "size": 9840 }
[ "java.io.IOException", "org.elasticsearch.common.blobstore.BlobContainer" ]
import java.io.IOException; import org.elasticsearch.common.blobstore.BlobContainer;
import java.io.*; import org.elasticsearch.common.blobstore.*;
[ "java.io", "org.elasticsearch.common" ]
java.io; org.elasticsearch.common;
2,904,188
public static List<FeatureGroup> getFeatureGroupsList( ) { return _dao.selectFeatureGroupsList( ); }
static List<FeatureGroup> function( ) { return _dao.selectFeatureGroupsList( ); }
/** * Loads the data of all the feature groups and returns them in form of a collection * * @return the collection which contains the data of all the feature groups */
Loads the data of all the feature groups and returns them in form of a collection
getFeatureGroupsList
{ "repo_name": "lutece-platform/lutece-core", "path": "src/java/fr/paris/lutece/portal/business/right/FeatureGroupHome.java", "license": "bsd-3-clause", "size": 7910 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,400,868
PagedIterable<ComputePolicy> listByAccount(String resourceGroupName, String accountName);
PagedIterable<ComputePolicy> listByAccount(String resourceGroupName, String accountName);
/** * Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account * supports, at most, 50 policies. * * @param resourceGroupName The name of the Azure resource group. * @param accountName The name of the Data Lake Analytics account. * @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 list of compute policies in the account. */
Lists the Data Lake Analytics compute policies within the specified Data Lake Analytics account. An account supports, at most, 50 policies
listByAccount
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/datalakeanalytics/azure-resourcemanager-datalakeanalytics/src/main/java/com/azure/resourcemanager/datalakeanalytics/models/ComputePolicies.java", "license": "mit", "size": 7789 }
[ "com.azure.core.http.rest.PagedIterable" ]
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.*;
[ "com.azure.core" ]
com.azure.core;
1,651,756
public final void setInputExtras(final int xmlResId) throws XmlPullParserException, IOException { getView().setInputExtras(xmlResId); }
final void function(final int xmlResId) throws XmlPullParserException, IOException { getView().setInputExtras(xmlResId); }
/** * Set the extra input data of the text, which is the {@link EditorInfo#extras * TextBoxAttribute.extras} Bundle that will be filled in when creating an input connection. The * given integer is the resource ID of an XML resource holding an android.R.styleable#InputExtras * &lt;input-extras&gt; XML tree. * * @see #getInputExtras(boolean) * @see EditorInfo#extras */
Set the extra input data of the text, which is the <code>EditorInfo#extras TextBoxAttribute.extras</code> Bundle that will be filled in when creating an input connection. The given integer is the resource ID of an XML resource holding an android.R.styleable#InputExtras &lt;input-extras&gt; XML tree
setInputExtras
{ "repo_name": "michael-rapp/AndroidMaterialValidation", "path": "library/src/main/java/de/mrapp/android/validation/EditText.java", "license": "apache-2.0", "size": 89149 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParserException" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParserException;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
2,803,959
public FeedbackResponseAttributes updateFeedbackResponse(FeedbackResponseAttributes.UpdateOptions updateOptions) throws EntityDoesNotExistException, InvalidParametersException, EntityAlreadyExistsException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, updateOptions); FeedbackResponse oldResponse = getFeedbackResponseEntity(updateOptions.getFeedbackResponseId()); if (oldResponse == null) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT); } FeedbackResponseAttributes newAttributes = makeAttributes(oldResponse); newAttributes.update(updateOptions); newAttributes.sanitizeForSaving(); if (!newAttributes.isValid()) { throw new InvalidParametersException(newAttributes.getInvalidityInfo()); } if (newAttributes.recipient.equals(oldResponse.getRecipientEmail()) && newAttributes.giver.equals(oldResponse.getGiverEmail())) { // update only if change boolean hasSameAttributes = this.<String>hasSameValue(oldResponse.getGiverSection(), newAttributes.getGiverSection()) && this.<String>hasSameValue(oldResponse.getRecipientSection(), newAttributes.getRecipientSection()) && this.<String>hasSameValue( oldResponse.getResponseMetaData(), newAttributes.getSerializedFeedbackResponseDetail()); if (hasSameAttributes) { log.info(String.format( OPTIMIZED_SAVING_POLICY_APPLIED, FeedbackResponse.class.getSimpleName(), updateOptions)); return newAttributes; } oldResponse.setGiverSection(newAttributes.giverSection); oldResponse.setRecipientSection(newAttributes.recipientSection); oldResponse.setAnswer(newAttributes.getSerializedFeedbackResponseDetail()); saveEntity(oldResponse); return makeAttributes(oldResponse); } else { // need to recreate the entity newAttributes = FeedbackResponseAttributes .builder(newAttributes.getFeedbackQuestionId(), newAttributes.getGiver(), newAttributes.getRecipient()) .withCourseId(newAttributes.getCourseId()) .withFeedbackSessionName(newAttributes.getFeedbackSessionName()) .withResponseDetails(newAttributes.getResponseDetails()) .withGiverSection(newAttributes.getGiverSection()) .withRecipientSection(newAttributes.getRecipientSection()) .build(); newAttributes = createEntity(newAttributes); deleteEntity(Key.create(FeedbackResponse.class, oldResponse.getId())); return newAttributes; } }
FeedbackResponseAttributes function(FeedbackResponseAttributes.UpdateOptions updateOptions) throws EntityDoesNotExistException, InvalidParametersException, EntityAlreadyExistsException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, updateOptions); FeedbackResponse oldResponse = getFeedbackResponseEntity(updateOptions.getFeedbackResponseId()); if (oldResponse == null) { throw new EntityDoesNotExistException(ERROR_UPDATE_NON_EXISTENT); } FeedbackResponseAttributes newAttributes = makeAttributes(oldResponse); newAttributes.update(updateOptions); newAttributes.sanitizeForSaving(); if (!newAttributes.isValid()) { throw new InvalidParametersException(newAttributes.getInvalidityInfo()); } if (newAttributes.recipient.equals(oldResponse.getRecipientEmail()) && newAttributes.giver.equals(oldResponse.getGiverEmail())) { boolean hasSameAttributes = this.<String>hasSameValue(oldResponse.getGiverSection(), newAttributes.getGiverSection()) && this.<String>hasSameValue(oldResponse.getRecipientSection(), newAttributes.getRecipientSection()) && this.<String>hasSameValue( oldResponse.getResponseMetaData(), newAttributes.getSerializedFeedbackResponseDetail()); if (hasSameAttributes) { log.info(String.format( OPTIMIZED_SAVING_POLICY_APPLIED, FeedbackResponse.class.getSimpleName(), updateOptions)); return newAttributes; } oldResponse.setGiverSection(newAttributes.giverSection); oldResponse.setRecipientSection(newAttributes.recipientSection); oldResponse.setAnswer(newAttributes.getSerializedFeedbackResponseDetail()); saveEntity(oldResponse); return makeAttributes(oldResponse); } else { newAttributes = FeedbackResponseAttributes .builder(newAttributes.getFeedbackQuestionId(), newAttributes.getGiver(), newAttributes.getRecipient()) .withCourseId(newAttributes.getCourseId()) .withFeedbackSessionName(newAttributes.getFeedbackSessionName()) .withResponseDetails(newAttributes.getResponseDetails()) .withGiverSection(newAttributes.getGiverSection()) .withRecipientSection(newAttributes.getRecipientSection()) .build(); newAttributes = createEntity(newAttributes); deleteEntity(Key.create(FeedbackResponse.class, oldResponse.getId())); return newAttributes; } }
/** * Updates a feedback response with {@link FeedbackResponseAttributes.UpdateOptions}. * * <p>If the giver/recipient field is changed, the response is updated by recreating the response * as question-giver-recipient is the primary key. * * @return updated feedback response * @throws InvalidParametersException if attributes to update are not valid * @throws EntityDoesNotExistException if the comment cannot be found * @throws EntityAlreadyExistsException if the response cannot be updated * by recreation because of an existent response */
Updates a feedback response with <code>FeedbackResponseAttributes.UpdateOptions</code>. If the giver/recipient field is changed, the response is updated by recreating the response as question-giver-recipient is the primary key
updateFeedbackResponse
{ "repo_name": "xpdavid/teammates", "path": "src/main/java/teammates/storage/api/FeedbackResponsesDb.java", "license": "gpl-2.0", "size": 17753 }
[ "com.googlecode.objectify.Key" ]
import com.googlecode.objectify.Key;
import com.googlecode.objectify.*;
[ "com.googlecode.objectify" ]
com.googlecode.objectify;
206,273
public Object preemptDisplay(Displayable d, boolean waitForDisplay) throws InterruptedException;
Object function(Displayable d, boolean waitForDisplay) throws InterruptedException;
/** * Preempt the current displayable with * the given displayable until donePreempting is called. * * @param d displayable to show the user * @param waitForDisplay if true this method will wait if the * screen is being preempted by another thread. * * @return an preempt token object to pass to donePreempting done if prempt * will happen, else null * * @exception SecurityException if the caller does not have permission * the internal MIDP permission. * @exception InterruptedException if another thread interrupts the * calling thread while this method is waiting to preempt the * display. */
Preempt the current displayable with the given displayable until donePreempting is called
preemptDisplay
{ "repo_name": "tommythorn/yari", "path": "shared/cacao-related/phoneme_feature/midp/src/highlevelui/lcdui/reference/classes/com/sun/midp/lcdui/DisplayEventHandler.java", "license": "gpl-2.0", "size": 3959 }
[ "javax.microedition.lcdui.Displayable" ]
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.*;
[ "javax.microedition" ]
javax.microedition;
304,355
public Response uploadImage(final String url, final String methodType, final Map<String, String> params, final Map<String, String> headerParams, final String fileName, final InputStream inputStream, final String fileParamName) throws Exception;
Response function(final String url, final String methodType, final Map<String, String> params, final Map<String, String> headerParams, final String fileName, final InputStream inputStream, final String fileParamName) throws Exception;
/** * Makes HTTP request to upload image and status. * * @param url * URL to make HTTP request. * @param methodType * Method type can be GET, POST or PUT * @param params * Parameters need to pass in request * @param headerParams * Parameters need to pass as Header Parameters * @param fileName * Image file name * @param inputStream * Input stream of image * @param fileParamName * Image Filename parameter. It requires in some provider. * @return Response object * @throws Exception */
Makes HTTP request to upload image and status
uploadImage
{ "repo_name": "gcolin/socialauth-4-glassfish", "path": "src/main/java/org/brickred/socialauth/oauthstrategy/OAuthStrategyBase.java", "license": "apache-2.0", "size": 5344 }
[ "java.io.InputStream", "java.util.Map", "org.brickred.socialauth.util.Response" ]
import java.io.InputStream; import java.util.Map; import org.brickred.socialauth.util.Response;
import java.io.*; import java.util.*; import org.brickred.socialauth.util.*;
[ "java.io", "java.util", "org.brickred.socialauth" ]
java.io; java.util; org.brickred.socialauth;
417,852
void gtk_places_sidebar_set_show_recent(GtkPlacesSidebar sidebar, boolean show_recent);
void gtk_places_sidebar_set_show_recent(GtkPlacesSidebar sidebar, boolean show_recent);
/** * Sets whether the sidebar should show an item for recent files. * The default value for this option is determined by the desktop environment, * but this function can be used to override it on a per-application basis. * * @param sidebar a places sidebar * @param show_recent whether to show an item for recent files */
Sets whether the sidebar should show an item for recent files. The default value for this option is determined by the desktop environment, but this function can be used to override it on a per-application basis
gtk_places_sidebar_set_show_recent
{ "repo_name": "Ccook/gtk-java-bindings", "path": "src/main/java/com/github/ccook/gtk/library/object/widget/container/bin/scrolledwindow/GtkPlacesSidebarLibrary.java", "license": "apache-2.0", "size": 11211 }
[ "com.github.ccook.gtk.model.object.widget.container.bin.scrolledwindow.GtkPlacesSidebar" ]
import com.github.ccook.gtk.model.object.widget.container.bin.scrolledwindow.GtkPlacesSidebar;
import com.github.ccook.gtk.model.object.widget.container.bin.scrolledwindow.*;
[ "com.github.ccook" ]
com.github.ccook;
1,958,646
VacationDaysLeft vacationDaysLeft = getVacationDaysLeft(account); // it's before April - the left remaining vacation days must be used if (DateUtil.isBeforeApril(nowService.now()) && account.getYear() == nowService.currentYear()) { return vacationDaysLeft.getVacationDays().add(vacationDaysLeft.getRemainingVacationDays()); } else { // it's after April - only the left not expiring remaining vacation days must be used return vacationDaysLeft.getVacationDays().add(vacationDaysLeft.getRemainingVacationDaysNotExpiring()); } }
VacationDaysLeft vacationDaysLeft = getVacationDaysLeft(account); if (DateUtil.isBeforeApril(nowService.now()) && account.getYear() == nowService.currentYear()) { return vacationDaysLeft.getVacationDays().add(vacationDaysLeft.getRemainingVacationDays()); } else { return vacationDaysLeft.getVacationDays().add(vacationDaysLeft.getRemainingVacationDaysNotExpiring()); } }
/** * Calculates the total number of days that are left to be used for applying for leave. * * <p>NOTE: The calculation depends on the current date. If it's before April, the left remaining vacation days are * relevant for calculation and if it's after April, only the not expiring remaining vacation days are relevant for * calculation.</p> * * @param account {@link org.synyx.urlaubsverwaltung.core.account.domain.Account} * * @return total number of left vacation days */
Calculates the total number of days that are left to be used for applying for leave. relevant for calculation and if it's after April, only the not expiring remaining vacation days are relevant for calculation
calculateTotalLeftVacationDays
{ "repo_name": "pongo710/urlaubsverwaltung", "path": "src/main/java/org/synyx/urlaubsverwaltung/core/account/service/VacationDaysService.java", "license": "apache-2.0", "size": 5937 }
[ "org.synyx.urlaubsverwaltung.core.account.domain.VacationDaysLeft", "org.synyx.urlaubsverwaltung.core.util.DateUtil" ]
import org.synyx.urlaubsverwaltung.core.account.domain.VacationDaysLeft; import org.synyx.urlaubsverwaltung.core.util.DateUtil;
import org.synyx.urlaubsverwaltung.core.account.domain.*; import org.synyx.urlaubsverwaltung.core.util.*;
[ "org.synyx.urlaubsverwaltung" ]
org.synyx.urlaubsverwaltung;
888,751
public static long dpToPixels(@NonNull final Context context, final long dp) { Condition.INSTANCE.ensureNotNull(context, "The context may not be null"); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); return Math.round(dp * (displayMetrics.densityDpi / PIXEL_DP_RATIO)); }
static long function(@NonNull final Context context, final long dp) { Condition.INSTANCE.ensureNotNull(context, STR); DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); return Math.round(dp * (displayMetrics.densityDpi / PIXEL_DP_RATIO)); }
/** * Converts an {@link Integer} value, which is measured in dp, into a value, which is measured * in pixels. * * @param context * The context, which should be used, as an instance of the class {@link Context}. The * context may not be null * @param dp * The dp value, which should be converted, as an {@link Integer} value * @return The calculated pixel value as an {@link Integer} value. The value might be rounded */
Converts an <code>Integer</code> value, which is measured in dp, into a value, which is measured in pixels
dpToPixels
{ "repo_name": "michael-rapp/AndroidUtil", "path": "library/src/main/java/de/mrapp/android/util/DisplayUtil.java", "license": "apache-2.0", "size": 14322 }
[ "android.content.Context", "android.util.DisplayMetrics", "androidx.annotation.NonNull", "de.mrapp.util.Condition" ]
import android.content.Context; import android.util.DisplayMetrics; import androidx.annotation.NonNull; import de.mrapp.util.Condition;
import android.content.*; import android.util.*; import androidx.annotation.*; import de.mrapp.util.*;
[ "android.content", "android.util", "androidx.annotation", "de.mrapp.util" ]
android.content; android.util; androidx.annotation; de.mrapp.util;
958,484
public TranslogRecoveryPerformer getTranslogRecoveryPerformer() { return translogRecoveryPerformer; }
TranslogRecoveryPerformer function() { return translogRecoveryPerformer; }
/** * Returns the {@link org.elasticsearch.index.shard.TranslogRecoveryPerformer} for this engine. This class is used * to apply transaction log operations to the engine. It encapsulates all the logic to transfer the translog entry into * an indexing operation. */
Returns the <code>org.elasticsearch.index.shard.TranslogRecoveryPerformer</code> for this engine. This class is used to apply transaction log operations to the engine. It encapsulates all the logic to transfer the translog entry into an indexing operation
getTranslogRecoveryPerformer
{ "repo_name": "Kakakakakku/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/engine/EngineConfig.java", "license": "apache-2.0", "size": 17719 }
[ "org.elasticsearch.index.shard.TranslogRecoveryPerformer" ]
import org.elasticsearch.index.shard.TranslogRecoveryPerformer;
import org.elasticsearch.index.shard.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
1,582,552
@Override public Map getInterfaceClassesMap(){ return getIBOLookup().getInterfaceClassesMap(); }
Map function(){ return getIBOLookup().getInterfaceClassesMap(); }
/** * Overrided from IBOLookup to hold the same map between IDOLookup and IBOLookup */
Overrided from IBOLookup to hold the same map between IDOLookup and IBOLookup
getInterfaceClassesMap
{ "repo_name": "idega/com.idega.core", "path": "src/java/com/idega/data/IDOLookup.java", "license": "gpl-3.0", "size": 9607 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
668,305
@ApiModelProperty(value = "End date of the report") public LocalDate getEndDate() { return endDate; }
@ApiModelProperty(value = STR) LocalDate function() { return endDate; }
/** * End date of the report * * @return endDate */
End date of the report
getEndDate
{ "repo_name": "XeroAPI/Xero-Java", "path": "src/main/java/com/xero/models/finance/CashflowResponse.java", "license": "mit", "size": 5939 }
[ "io.swagger.annotations.ApiModelProperty", "org.threeten.bp.LocalDate" ]
import io.swagger.annotations.ApiModelProperty; import org.threeten.bp.LocalDate;
import io.swagger.annotations.*; import org.threeten.bp.*;
[ "io.swagger.annotations", "org.threeten.bp" ]
io.swagger.annotations; org.threeten.bp;
2,542,993
@Override public void cloneFields( Cloner cloner, Object original ) { super.cloneFields(cloner, original); this.terrain = cloner.clone(terrain); }
void function( Cloner cloner, Object original ) { super.cloneFields(cloner, original); this.terrain = cloner.clone(terrain); }
/** * Called internally by com.jme3.util.clone.Cloner. Do not call directly. */
Called internally by com.jme3.util.clone.Cloner. Do not call directly
cloneFields
{ "repo_name": "zzuegg/jmonkeyengine", "path": "jme3-terrain/src/main/java/com/jme3/terrain/geomipmap/NormalRecalcControl.java", "license": "bsd-3-clause", "size": 3810 }
[ "com.jme3.util.clone.Cloner" ]
import com.jme3.util.clone.Cloner;
import com.jme3.util.clone.*;
[ "com.jme3.util" ]
com.jme3.util;
289,918
protected void openBitstream(String filename) throws JavaLayerException { try { bitstream = new Bitstream(new BufferedInputStream( new FileInputStream(filename))); } catch(java.io.IOException ex) { throw new JavaLayerException(ex.getMessage(), ex); } }
void function(String filename) throws JavaLayerException { try { bitstream = new Bitstream(new BufferedInputStream( new FileInputStream(filename))); } catch(java.io.IOException ex) { throw new JavaLayerException(ex.getMessage(), ex); } }
/** * Open a BitStream for the given file. * @param filename The file to be opened. * @throws IOException If the file cannot be opened. */
Open a BitStream for the given file
openBitstream
{ "repo_name": "peterhuerlimann/bluej-java-learning", "path": "Kapitel11/Musikplayer/MusicFilePlayer.java", "license": "gpl-3.0", "size": 11325 }
[ "java.io.BufferedInputStream", "java.io.FileInputStream", "javazoom.jl.decoder.Bitstream", "javazoom.jl.decoder.JavaLayerException" ]
import java.io.BufferedInputStream; import java.io.FileInputStream; import javazoom.jl.decoder.Bitstream; import javazoom.jl.decoder.JavaLayerException;
import java.io.*; import javazoom.jl.decoder.*;
[ "java.io", "javazoom.jl.decoder" ]
java.io; javazoom.jl.decoder;
1,846,897
public boolean train(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType) { boolean retVal = train_3(nativeObj, trainData.nativeObj, tflag, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, varType.nativeObj); return retVal; }
boolean function(Mat trainData, int tflag, Mat responses, Mat varIdx, Mat sampleIdx, Mat varType) { boolean retVal = train_3(nativeObj, trainData.nativeObj, tflag, responses.nativeObj, varIdx.nativeObj, sampleIdx.nativeObj, varType.nativeObj); return retVal; }
/** * Trains a boosted tree classifier. * * The train method follows the common template of "CvStatModel.train". The * responses must be categorical, which means that boosted trees cannot be built * for regression, and there should be two classes. * * @param trainData a trainData * @param tflag a tflag * @param responses a responses * @param varIdx a varIdx * @param sampleIdx a sampleIdx * @param varType a varType * * @see <a href="http://opencv.itseez.com/modules/ml/doc/boosting.html#cvboost-train">org.opencv.ml.CvBoost.train</a> */
Trains a boosted tree classifier. The train method follows the common template of "CvStatModel.train". The responses must be categorical, which means that boosted trees cannot be built for regression, and there should be two classes
train
{ "repo_name": "mattrubin/CameraAssist", "path": "external/opencv/src/org/opencv/ml/CvBoost.java", "license": "bsd-3-clause", "size": 21435 }
[ "org.opencv.core.Mat" ]
import org.opencv.core.Mat;
import org.opencv.core.*;
[ "org.opencv.core" ]
org.opencv.core;
2,641,806
public void testRemainderKnuth1() { byte aBytes[] = {-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1}; byte bBytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int aSign = 1; int bSign = 1; byte rBytes[] = {1, 2, 3, 4, 5, 6, 7, 7, 18, -89}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.remainder(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign", 1, result.signum()); }
void function() { byte aBytes[] = {-9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1}; byte bBytes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int aSign = 1; int bSign = 1; byte rBytes[] = {1, 2, 3, 4, 5, 6, 7, 7, 18, -89}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.remainder(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, 1, result.signum()); }
/** * Tests the step D6 from the Knuth algorithm */
Tests the step D6 from the Knuth algorithm
testRemainderKnuth1
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerDivideTest.java", "license": "apache-2.0", "size": 25307 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
545,211
public static final void main(String[] args) { String propertiesFilename = null; int initialPort = ORBConstants.DEFAULT_INITIAL_PORT; // Process arguments for (int i=0;i<args.length;i++) { // Look for the filename if (args[i].equals("-InitialServicesFile") && i < args.length -1) { propertiesFilename = args[i+1]; } // Was the initial port specified? If so, override // This property normally is applied for the client side // configuration of resolvers. Here we are using it to // define the server port that the with which the resolvers // communicate. if (args[i].equals("-ORBInitialPort") && i < args.length-1) { initialPort = java.lang.Integer.parseInt(args[i+1]); } } if (propertiesFilename == null) { System.out.println( CorbaResourceUtil.getText("bootstrap.usage", "BootstrapServer")); return; } // Create a file File file = new File(propertiesFilename); // Verify that if it exists, it is readable if (file.exists() == true && file.canRead() == false) { System.err.println(CorbaResourceUtil.getText( "bootstrap.filenotreadable", file.getAbsolutePath())); return; } // Success: start up System.out.println(CorbaResourceUtil.getText( "bootstrap.success", Integer.toString(initialPort), file.getAbsolutePath())); Properties props = new Properties() ; // Use the SERVER_PORT to create an Acceptor using the // old legacy code in ORBConfiguratorImpl. When (if?) // the legacy support is removed, this code will need // to create an Acceptor directly. props.put( ORBConstants.SERVER_PORT_PROPERTY, Integer.toString( initialPort ) ) ; ORB orb = (ORB) org.omg.CORBA.ORB.init(args,props); LocalResolver lres = orb.getLocalResolver() ; Resolver fres = ResolverDefault.makeFileResolver( orb, file ) ; Resolver cres = ResolverDefault.makeCompositeResolver( fres, lres ) ; LocalResolver sres = ResolverDefault.makeSplitLocalResolver( cres, lres ) ; orb.setLocalResolver( sres ) ; try { // This causes the acceptors to start listening. orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); } catch (org.omg.CORBA.ORBPackage.InvalidName e) { RuntimeException rte = new RuntimeException("This should not happen"); rte.initCause(e); throw rte; } orb.run() ; }
static final void function(String[] args) { String propertiesFilename = null; int initialPort = ORBConstants.DEFAULT_INITIAL_PORT; for (int i=0;i<args.length;i++) { if (args[i].equals(STR) && i < args.length -1) { propertiesFilename = args[i+1]; } if (args[i].equals(STR) && i < args.length-1) { initialPort = java.lang.Integer.parseInt(args[i+1]); } } if (propertiesFilename == null) { System.out.println( CorbaResourceUtil.getText(STR, STR)); return; } File file = new File(propertiesFilename); if (file.exists() == true && file.canRead() == false) { System.err.println(CorbaResourceUtil.getText( STR, file.getAbsolutePath())); return; } System.out.println(CorbaResourceUtil.getText( STR, Integer.toString(initialPort), file.getAbsolutePath())); Properties props = new Properties() ; props.put( ORBConstants.SERVER_PORT_PROPERTY, Integer.toString( initialPort ) ) ; ORB orb = (ORB) org.omg.CORBA.ORB.init(args,props); LocalResolver lres = orb.getLocalResolver() ; Resolver fres = ResolverDefault.makeFileResolver( orb, file ) ; Resolver cres = ResolverDefault.makeCompositeResolver( fres, lres ) ; LocalResolver sres = ResolverDefault.makeSplitLocalResolver( cres, lres ) ; orb.setLocalResolver( sres ) ; try { orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME); } catch (org.omg.CORBA.ORBPackage.InvalidName e) { RuntimeException rte = new RuntimeException(STR); rte.initCause(e); throw rte; } orb.run() ; }
/** * Main startup routine for the bootstrap server. * It first determines the port on which to listen, checks that the * specified file is available, and then creates the resolver * that will be used to service the requests in the * BootstrapServerRequestDispatcher. * @param args the command-line arguments to the main program. */
Main startup routine for the bootstrap server. It first determines the port on which to listen, checks that the specified file is available, and then creates the resolver that will be used to service the requests in the BootstrapServerRequestDispatcher
main
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/com/sun/corba/se/internal/CosNaming/BootstrapServer.java", "license": "apache-2.0", "size": 4094 }
[ "com.sun.corba.se.impl.orbutil.CorbaResourceUtil", "com.sun.corba.se.impl.orbutil.ORBConstants", "java.io.File", "java.util.Properties" ]
import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; import com.sun.corba.se.impl.orbutil.ORBConstants; import java.io.File; import java.util.Properties;
import com.sun.corba.se.impl.orbutil.*; import java.io.*; import java.util.*;
[ "com.sun.corba", "java.io", "java.util" ]
com.sun.corba; java.io; java.util;
1,655,707
ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch( ChangeMessageVisibilityBatchRequest request);
ChangeMessageVisibilityBatchResult changeMessageVisibilityBatch( ChangeMessageVisibilityBatchRequest request);
/** * Performs the <code>ChangeMessageVisibilityBatch</code> action. * * <p> * The following request parameters will be populated from the data of this * <code>Queue</code> resource, and any conflicting parameter value set in * the request will be overridden: * <ul> * <li> * <b><code>QueueUrl</code></b> * - mapped from the <code>Url</code> identifier. * </li> * </ul> * * <p> * * @return The response of the low-level client operation associated with * this resource action. * @see ChangeMessageVisibilityBatchRequest */
Performs the <code>ChangeMessageVisibilityBatch</code> action. The following request parameters will be populated from the data of this <code>Queue</code> resource, and any conflicting parameter value set in the request will be overridden: <code>QueueUrl</code> - mapped from the <code>Url</code> identifier.
changeMessageVisibilityBatch
{ "repo_name": "smartpcr/aws-sdk-java-resources", "path": "aws-resources-sqs/src/main/java/com/amazonaws/resources/sqs/Queue.java", "license": "apache-2.0", "size": 24210 }
[ "com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchRequest", "com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchResult" ]
import com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchRequest; import com.amazonaws.services.sqs.model.ChangeMessageVisibilityBatchResult;
import com.amazonaws.services.sqs.model.*;
[ "com.amazonaws.services" ]
com.amazonaws.services;
1,784,243
public final Property<ZonedDateTimeBean> settlementDate() { return metaBean().settlementDate().createProperty(this); }
final Property<ZonedDateTimeBean> function() { return metaBean().settlementDate().createProperty(this); }
/** * Gets the the {@code settlementDate} property. * @return the property, not null */
Gets the the settlementDate property
settlementDate
{ "repo_name": "McLeodMoores/starling", "path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/option/SwaptionSecurityBean.java", "license": "apache-2.0", "size": 18205 }
[ "com.opengamma.masterdb.security.hibernate.ZonedDateTimeBean", "org.joda.beans.Property" ]
import com.opengamma.masterdb.security.hibernate.ZonedDateTimeBean; import org.joda.beans.Property;
import com.opengamma.masterdb.security.hibernate.*; import org.joda.beans.*;
[ "com.opengamma.masterdb", "org.joda.beans" ]
com.opengamma.masterdb; org.joda.beans;
2,325,552
private static boolean doDynamicCloseTasks( ClientVmRecord vm, boolean disconnect, boolean stop ) { Vector tasks = TestConfig.getInstance().getDynamicCloseTasksClone(); TaskScheduler ts = new DynamicConcurrentTaskScheduler( "DynamicCloseTasks", tasks, null, vm, disconnect ); boolean passed = ts.executeTasks( tab().booleanAt( Prms.haltIfBadResult ), tab().longAt( Prms.maxResultWaitSec ) ); if (stop) { ts.stopClients(); } else { disconnectClient(vm); waitForClientToDisconnect(vm); } ts.printReport(); return passed; }
static boolean function( ClientVmRecord vm, boolean disconnect, boolean stop ) { Vector tasks = TestConfig.getInstance().getDynamicCloseTasksClone(); TaskScheduler ts = new DynamicConcurrentTaskScheduler( STR, tasks, null, vm, disconnect ); boolean passed = ts.executeTasks( tab().booleanAt( Prms.haltIfBadResult ), tab().longAt( Prms.maxResultWaitSec ) ); if (stop) { ts.stopClients(); } else { disconnectClient(vm); waitForClientToDisconnect(vm); } ts.printReport(); return passed; }
/** * Runs closetasks for dynamic stops. */
Runs closetasks for dynamic stops
doDynamicCloseTasks
{ "repo_name": "papicella/snappy-store", "path": "tests/core/src/main/java/hydra/ClientMgr.java", "license": "apache-2.0", "size": 54591 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
2,915,717
final int getAddress() { if (address == -1) { throw new InconsistencyException("instruction not reached"); } return address; }
final int getAddress() { if (address == -1) { throw new InconsistencyException(STR); } return address; }
/** * Returns the offset in bytes of the instruction from the beginning * of the method code (ie classfile). */
Returns the offset in bytes of the instruction from the beginning of the method code (ie classfile)
getAddress
{ "repo_name": "tud-stg-lang/caesar-compiler", "path": "src/org/caesarj/classfile/Instruction.java", "license": "gpl-2.0", "size": 6399 }
[ "org.caesarj.util.InconsistencyException" ]
import org.caesarj.util.InconsistencyException;
import org.caesarj.util.*;
[ "org.caesarj.util" ]
org.caesarj.util;
935,369
@Test public void testSaveScript() throws Exception { final String jobId = "1"; final String sourceText = "print 'test'"; final Set<String> solutions = new HashSet<String>(); solutions.add("http://vhirl-dev.csiro.au/scm/solutions/1"); final ANVGLUser user = new ANVGLUser(); context.checking(new Expectations() {{ oneOf(mockSbService).saveScript(jobId, sourceText, user); oneOf(mockScmEntryService).updateJobForSolution(jobId, solutions, user); }}); ModelAndView mav = controller.saveScript(jobId, sourceText, solutions, user); Assert.assertTrue((Boolean)mav.getModel().get("success")); }
void function() throws Exception { final String jobId = "1"; final String sourceText = STR; final Set<String> solutions = new HashSet<String>(); solutions.add(STRsuccess")); }
/** * Tests that the saving of script for a given job succeeds. * @throws Exception */
Tests that the saving of script for a given job succeeds
testSaveScript
{ "repo_name": "joshvote/ANVGL-Portal", "path": "src/test/java/org/auscope/portal/server/web/controllers/TestScriptBuilderController.java", "license": "gpl-3.0", "size": 5926 }
[ "java.util.HashSet", "java.util.Set" ]
import java.util.HashSet; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,404,428
static void appendColumnValue(StringBuffer sb, int type) { switch(type) { case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.INTEGER: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: sb.append("0"); break; case Types.CHAR: case Types.VARCHAR: sb.append("' '"); break; case Types.DATE: sb.append("CURRENT_DATE"); break; case Types.TIME: sb.append("CURRENT_TIME"); break; case Types.TIMESTAMP: sb.append("CURRENT_TIMESTAMP"); break; default: sb.append("null"); break; } }
static void appendColumnValue(StringBuffer sb, int type) { switch(type) { case Types.BIGINT: case Types.DECIMAL: case Types.DOUBLE: case Types.FLOAT: case Types.INTEGER: case Types.NUMERIC: case Types.REAL: case Types.SMALLINT: case Types.TINYINT: sb.append("0"); break; case Types.CHAR: case Types.VARCHAR: sb.append(STR); break; case Types.DATE: sb.append(STR); break; case Types.TIME: sb.append(STR); break; case Types.TIMESTAMP: sb.append(STR); break; default: sb.append("null"); break; } }
/** * Append a particular SQL datatype value to the given StringBuffer * * @param sb the StringBuffer to append the value * @param type the java.sql.Types value to append */
Append a particular SQL datatype value to the given StringBuffer
appendColumnValue
{ "repo_name": "splicemachine/spliceengine", "path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/lang/GrantRevokeTest.java", "license": "agpl-3.0", "size": 66677 }
[ "java.sql.Types" ]
import java.sql.Types;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,215,148
Set<Permission> getPermissions(ApplicationId appId);
Set<Permission> getPermissions(ApplicationId appId);
/** * Returns the permissions currently granted to the applications. * * @param appId application identifier * @return set of granted permissions */
Returns the permissions currently granted to the applications
getPermissions
{ "repo_name": "sdnwiselab/onos", "path": "core/api/src/main/java/org/onosproject/app/ApplicationService.java", "license": "apache-2.0", "size": 2298 }
[ "java.util.Set", "org.onosproject.core.ApplicationId", "org.onosproject.security.Permission" ]
import java.util.Set; import org.onosproject.core.ApplicationId; import org.onosproject.security.Permission;
import java.util.*; import org.onosproject.core.*; import org.onosproject.security.*;
[ "java.util", "org.onosproject.core", "org.onosproject.security" ]
java.util; org.onosproject.core; org.onosproject.security;
1,386,240
private TopicType topicTypeFactory(TopicTypeModel model) { // 1) store in DB createTopic(model, URI_PREFIX_TOPIC_TYPE); // store generic topic typeStorage.storeType(model); // store type-specific parts // // 2) instantiate TopicType topicType = new AttachedTopicType(model, this); typeCache.putTopicType(topicType); // return topicType; }
TopicType function(TopicTypeModel model) { createTopic(model, URI_PREFIX_TOPIC_TYPE); typeStorage.storeType(model); TopicType topicType = new AttachedTopicType(model, this); typeCache.putTopicType(topicType); }
/** * Factory method: creates a new topic type in the DB according to the given model * and returns a topic type instance. */
Factory method: creates a new topic type in the DB according to the given model and returns a topic type instance
topicTypeFactory
{ "repo_name": "ascherer/deepamehta", "path": "modules/dm4-core/src/main/java/de/deepamehta/core/impl/EmbeddedService.java", "license": "gpl-3.0", "size": 37105 }
[ "de.deepamehta.core.TopicType", "de.deepamehta.core.model.TopicTypeModel" ]
import de.deepamehta.core.TopicType; import de.deepamehta.core.model.TopicTypeModel;
import de.deepamehta.core.*; import de.deepamehta.core.model.*;
[ "de.deepamehta.core" ]
de.deepamehta.core;
2,817,858
public InetAddress getNetworkAddress() { return networkAddress; }
InetAddress function() { return networkAddress; }
/** * getter method * * * @return the Network Address part of the subnet */
getter method
getNetworkAddress
{ "repo_name": "lbchen/odl-mod", "path": "opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/Subnet.java", "license": "epl-1.0", "size": 7044 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
229,035
@Test() public void testEqualsIdentity() throws Exception { ASN1Element e = new ASN1Element((byte) 0x04); assertTrue(e.equals(e)); }
@Test() void function() throws Exception { ASN1Element e = new ASN1Element((byte) 0x04); assertTrue(e.equals(e)); }
/** * Tests the {@code equals} method with the same object. * * @throws Exception If an unexpected problem occurs. */
Tests the equals method with the same object
testEqualsIdentity
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/asn1/ASN1ElementTestCase.java", "license": "gpl-2.0", "size": 23932 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
2,545,503
private JPanel createShowAsTabPanel() { createShowAsTabButton(); // create a panel that holds the buttons BorderLayout innerLayout = new BorderLayout(); JPanel innerPanel = new JPanel(innerLayout); innerPanel.add(closeFrameButton, BorderLayout.WEST); innerPanel.add(showAsTabButton, BorderLayout.EAST); return innerPanel; }
JPanel function() { createShowAsTabButton(); BorderLayout innerLayout = new BorderLayout(); JPanel innerPanel = new JPanel(innerLayout); innerPanel.add(closeFrameButton, BorderLayout.WEST); innerPanel.add(showAsTabButton, BorderLayout.EAST); return innerPanel; }
/** * Creates a "show as tab" button and puts in a JPanel. * * @return contains the "show as tab" button. */
Creates a "show as tab" button and puts in a JPanel
createShowAsTabPanel
{ "repo_name": "KEOpenSource/CAExplorer", "path": "cellularAutomata/analysis/Analysis.java", "license": "apache-2.0", "size": 47476 }
[ "java.awt.BorderLayout", "javax.swing.JPanel" ]
import java.awt.BorderLayout; import javax.swing.JPanel;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,264,815
public void updateApplicationRegistration(String state, String keyType, int appId) throws APIManagementException { Connection conn = null; PreparedStatement ps = null; String sqlStmt = SQLConstants.UPDATE_APPLICATION_KEY_MAPPING_SQL; try { conn = APIMgtDBUtil.getConnection(); conn.setAutoCommit(false); ps = conn.prepareStatement(sqlStmt); ps.setString(1, state); ps.setInt(2, appId); ps.setString(3, keyType); ps.execute(); conn.commit(); } catch (SQLException e) { handleException("Error while updating registration entry.", e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, null); } }
void function(String state, String keyType, int appId) throws APIManagementException { Connection conn = null; PreparedStatement ps = null; String sqlStmt = SQLConstants.UPDATE_APPLICATION_KEY_MAPPING_SQL; try { conn = APIMgtDBUtil.getConnection(); conn.setAutoCommit(false); ps = conn.prepareStatement(sqlStmt); ps.setString(1, state); ps.setInt(2, appId); ps.setString(3, keyType); ps.execute(); conn.commit(); } catch (SQLException e) { handleException(STR, e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, null); } }
/** * Updates the state of the Application Registration. * * @param state State of the registration. * @param keyType PRODUCTION | SANDBOX * @param appId ID of the Application. * @throws APIManagementException if updating fails. */
Updates the state of the Application Registration
updateApplicationRegistration
{ "repo_name": "charithag/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 345861 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "org.wso2.carbon" ]
java.sql; org.wso2.carbon;
2,010,624
public static Point getPhysicalDisplaySize(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return getPhysicalDisplaySize(context, windowManager.getDefaultDisplay()); }
static Point function(Context context) { WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); return getPhysicalDisplaySize(context, windowManager.getDefaultDisplay()); }
/** * Gets the physical size of the default display, in pixels. * * @param context Any context. * @return The physical display size, in pixels. */
Gets the physical size of the default display, in pixels
getPhysicalDisplaySize
{ "repo_name": "michalliu/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/util/Util.java", "license": "apache-2.0", "size": 45263 }
[ "android.content.Context", "android.graphics.Point", "android.view.WindowManager" ]
import android.content.Context; import android.graphics.Point; import android.view.WindowManager;
import android.content.*; import android.graphics.*; import android.view.*;
[ "android.content", "android.graphics", "android.view" ]
android.content; android.graphics; android.view;
1,222,490
public List<CallAdapter.Factory> callAdapterFactories() { return adapterFactories; }
List<CallAdapter.Factory> function() { return adapterFactories; }
/** * Returns a list of the factories tried when creating a * {@linkplain #callAdapter(Type, Annotation[])} call adapter}. */
Returns a list of the factories tried when creating a #callAdapter(Type, Annotation[]) call adapter}
callAdapterFactories
{ "repo_name": "octaware/super-volley", "path": "super-volley-library/src/main/java/com/android/supervolley/SuperVolley.java", "license": "apache-2.0", "size": 31328 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,203,076
public M getModel(SectionInfo context) { return context.<M>getModelForId(id); }
M function(SectionInfo context) { return context.<M>getModelForId(id); }
/** * Return this {@code Section}'s model. * * @see SectionInfo#getModelForId(String) * @param info The current info * @return The model */
Return this Section's model
getModel
{ "repo_name": "equella/Equella", "path": "Platform/Plugins/com.tle.web.sections/src/com/tle/web/sections/generic/AbstractPrototypeSection.java", "license": "apache-2.0", "size": 3641 }
[ "com.tle.web.sections.SectionInfo" ]
import com.tle.web.sections.SectionInfo;
import com.tle.web.sections.*;
[ "com.tle.web" ]
com.tle.web;
221,620
public static Blog setCurrentBlogToLastActive() { List<Map<String, Object>> accounts = WordPress.wpDB.getVisibleBlogs(); int lastBlogId = WordPress.wpDB.getLastBlogId(); if (lastBlogId != -1) { for (Map<String, Object> account : accounts) { int id = Integer.valueOf(account.get("id").toString()); if (id == lastBlogId) { setCurrentBlog(id); return currentBlog; } } } // Previous active blog is hidden or deleted currentBlog = null; return null; }
static Blog function() { List<Map<String, Object>> accounts = WordPress.wpDB.getVisibleBlogs(); int lastBlogId = WordPress.wpDB.getLastBlogId(); if (lastBlogId != -1) { for (Map<String, Object> account : accounts) { int id = Integer.valueOf(account.get("id").toString()); if (id == lastBlogId) { setCurrentBlog(id); return currentBlog; } } } currentBlog = null; return null; }
/** * Set the last active blog as the current blog. * * @return the current blog */
Set the last active blog as the current blog
setCurrentBlogToLastActive
{ "repo_name": "wangkang0627/WordPress-Android", "path": "WordPress/src/main/java/org/wordpress/android/WordPress.java", "license": "gpl-2.0", "size": 30500 }
[ "java.util.List", "java.util.Map", "org.wordpress.android.models.Blog" ]
import java.util.List; import java.util.Map; import org.wordpress.android.models.Blog;
import java.util.*; import org.wordpress.android.models.*;
[ "java.util", "org.wordpress.android" ]
java.util; org.wordpress.android;
388,157
private void setupActionBar() { ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.menu_highscore); if (actionBar != null) { // Show the Up button in the action bar. actionBar.setDisplayHomeAsUpEnabled(true); } } /** * {@inheritDoc}
void function() { ActionBar actionBar = getSupportActionBar(); actionBar.setTitle(R.string.menu_highscore); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } } /** * {@inheritDoc}
/** * Set up the {@link android.app.ActionBar}, if the API is available. */
Set up the <code>android.app.ActionBar</code>, if the API is available
setupActionBar
{ "repo_name": "SecUSo/privacy-friendly-memo-game", "path": "app/src/main/java/org/secuso/privacyfriendlymemory/ui/navigation/HighscoreActivity.java", "license": "gpl-3.0", "size": 7577 }
[ "android.support.v7.app.ActionBar" ]
import android.support.v7.app.ActionBar;
import android.support.v7.app.*;
[ "android.support" ]
android.support;
2,380,951
@Override public Collection<Resource> components() { return UnmodifiableArrayList.wrap(components); }
Collection<Resource> function() { return UnmodifiableArrayList.wrap(components); }
/** * Returns the resources for each Landsat band of this group. */
Returns the resources for each Landsat band of this group
components
{ "repo_name": "apache/sis", "path": "storage/sis-earth-observation/src/main/java/org/apache/sis/storage/landsat/BandGroup.java", "license": "apache-2.0", "size": 4651 }
[ "java.util.Collection", "org.apache.sis.internal.util.UnmodifiableArrayList", "org.apache.sis.storage.Resource" ]
import java.util.Collection; import org.apache.sis.internal.util.UnmodifiableArrayList; import org.apache.sis.storage.Resource;
import java.util.*; import org.apache.sis.internal.util.*; import org.apache.sis.storage.*;
[ "java.util", "org.apache.sis" ]
java.util; org.apache.sis;
2,374,864
@Nonnull SearchResult filter(@Nonnull String entityName, @Nullable Filter filters, @Nullable SortCriterion sortCriterion, int from, int size);
SearchResult filter(@Nonnull String entityName, @Nullable Filter filters, @Nullable SortCriterion sortCriterion, int from, int size);
/** * Gets a list of documents after applying the input filters. * * @param entityName name of the entity * @param filters the request map with fields and values to be applied as filters to the search query * @param sortCriterion {@link SortCriterion} to be applied to search results * @param from index to start the search from * @param size number of search hits to return * @return a {@link com.linkedin.metadata.dao.SearchResult} that contains a list of filtered documents and related search result metadata */
Gets a list of documents after applying the input filters
filter
{ "repo_name": "linkedin/WhereHows", "path": "metadata-io/src/main/java/com/linkedin/metadata/search/EntitySearchService.java", "license": "apache-2.0", "size": 4878 }
[ "com.linkedin.metadata.query.filter.Filter", "com.linkedin.metadata.query.filter.SortCriterion", "javax.annotation.Nonnull", "javax.annotation.Nullable" ]
import com.linkedin.metadata.query.filter.Filter; import com.linkedin.metadata.query.filter.SortCriterion; import javax.annotation.Nonnull; import javax.annotation.Nullable;
import com.linkedin.metadata.query.filter.*; import javax.annotation.*;
[ "com.linkedin.metadata", "javax.annotation" ]
com.linkedin.metadata; javax.annotation;
1,382,019
public SearchSourceBuilder postFilter(byte[] postFilterBinary, int postFilterBinaryOffset, int postFilterBinaryLength) { return postFilter(new BytesArray(postFilterBinary, postFilterBinaryOffset, postFilterBinaryLength)); }
SearchSourceBuilder function(byte[] postFilterBinary, int postFilterBinaryOffset, int postFilterBinaryLength) { return postFilter(new BytesArray(postFilterBinary, postFilterBinaryOffset, postFilterBinaryLength)); }
/** * Sets a filter on the query executed that only applies to the search query * (and not aggs for example). */
Sets a filter on the query executed that only applies to the search query (and not aggs for example)
postFilter
{ "repo_name": "0359xiaodong/elasticsearch", "path": "src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java", "license": "apache-2.0", "size": 29314 }
[ "org.elasticsearch.common.bytes.BytesArray" ]
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,324,744
@Override public int doRead(ByteChunk chunk, Request req) throws IOException { if (lastActiveFilter == -1) return inputStreamInputBuffer.doRead(chunk, req); else return activeFilters[lastActiveFilter].doRead(chunk,req); } // ------------------------------------------------------ Protected Methods
int function(ByteChunk chunk, Request req) throws IOException { if (lastActiveFilter == -1) return inputStreamInputBuffer.doRead(chunk, req); else return activeFilters[lastActiveFilter].doRead(chunk,req); }
/** * Read some bytes. */
Read some bytes
doRead
{ "repo_name": "plumer/codana", "path": "tomcat_files/8.0.0/InternalAprInputBuffer.java", "license": "mit", "size": 19779 }
[ "java.io.IOException", "org.apache.coyote.Request", "org.apache.tomcat.util.buf.ByteChunk" ]
import java.io.IOException; import org.apache.coyote.Request; import org.apache.tomcat.util.buf.ByteChunk;
import java.io.*; import org.apache.coyote.*; import org.apache.tomcat.util.buf.*;
[ "java.io", "org.apache.coyote", "org.apache.tomcat" ]
java.io; org.apache.coyote; org.apache.tomcat;
1,580,326
void showStatus(@Nonnull String status);
void showStatus(@Nonnull String status);
/** * Displays the given status message. * * @param status the status to display. */
Displays the given status message
showStatus
{ "repo_name": "google/fest", "path": "third_party/fest-swing/src/main/java/org/fest/swing/applet/StatusDisplay.java", "license": "apache-2.0", "size": 963 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
1,420,463
public void testDescendingKeySet() { ConcurrentNavigableMap map = dmap5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(m1)); assertTrue(s.contains(m2)); assertTrue(s.contains(m3)); assertTrue(s.contains(m4)); assertTrue(s.contains(m5)); }
void function() { ConcurrentNavigableMap map = dmap5(); Set s = map.keySet(); assertEquals(5, s.size()); assertTrue(s.contains(m1)); assertTrue(s.contains(m2)); assertTrue(s.contains(m3)); assertTrue(s.contains(m4)); assertTrue(s.contains(m5)); }
/** * keySet returns a Set containing all the keys */
keySet returns a Set containing all the keys
testDescendingKeySet
{ "repo_name": "life-beam/j2objc", "path": "jre_emul/android/platform/libcore/jsr166-tests/src/test/java/jsr166/ConcurrentSkipListSubMapTest.java", "license": "apache-2.0", "size": 42529 }
[ "java.util.Set", "java.util.concurrent.ConcurrentNavigableMap" ]
import java.util.Set; import java.util.concurrent.ConcurrentNavigableMap;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
150,710
public static TextBlock createTextBlock(String text, Font font, Paint paint, float maxWidth, int maxLines, TextMeasurer measurer) { TextBlock result = new TextBlock(); BreakIterator iterator = BreakIterator.getLineInstance(); iterator.setText(text); int current = 0; int lines = 0; int length = text.length(); while (current < length && lines < maxLines) { int next = nextLineBreak(text, current, maxWidth, iterator, measurer); if (next == BreakIterator.DONE) { result.addLine(text.substring(current), font, paint); return result; } result.addLine(text.substring(current, next), font, paint); lines++; current = next; while (current < text.length()&& text.charAt(current) == '\n') { current++; } } if (current < length) { TextLine lastLine = result.getLastLine(); TextFragment lastFragment = lastLine.getLastTextFragment(); String oldStr = lastFragment.getText(); String newStr = "..."; if (oldStr.length() > 3) { newStr = oldStr.substring(0, oldStr.length() - 3) + "..."; } lastLine.removeFragment(lastFragment); TextFragment newFragment = new TextFragment(newStr, lastFragment.getFont(), lastFragment.getPaint()); lastLine.addFragment(newFragment); } return result; }
static TextBlock function(String text, Font font, Paint paint, float maxWidth, int maxLines, TextMeasurer measurer) { TextBlock result = new TextBlock(); BreakIterator iterator = BreakIterator.getLineInstance(); iterator.setText(text); int current = 0; int lines = 0; int length = text.length(); while (current < length && lines < maxLines) { int next = nextLineBreak(text, current, maxWidth, iterator, measurer); if (next == BreakIterator.DONE) { result.addLine(text.substring(current), font, paint); return result; } result.addLine(text.substring(current, next), font, paint); lines++; current = next; while (current < text.length()&& text.charAt(current) == '\n') { current++; } } if (current < length) { TextLine lastLine = result.getLastLine(); TextFragment lastFragment = lastLine.getLastTextFragment(); String oldStr = lastFragment.getText(); String newStr = "..."; if (oldStr.length() > 3) { newStr = oldStr.substring(0, oldStr.length() - 3) + "..."; } lastLine.removeFragment(lastFragment); TextFragment newFragment = new TextFragment(newStr, lastFragment.getFont(), lastFragment.getPaint()); lastLine.addFragment(newFragment); } return result; }
/** * Creates a new text block from the given string, breaking the * text into lines so that the <code>maxWidth</code> value is * respected. * * @param text the text. * @param font the font. * @param paint the paint. * @param maxWidth the maximum width for each line. * @param maxLines the maximum number of lines. * @param measurer the text measurer. * * @return A text block. */
Creates a new text block from the given string, breaking the text into lines so that the <code>maxWidth</code> value is respected
createTextBlock
{ "repo_name": "SpoonLabs/astor", "path": "examples/chart_11/source/org/jfree/chart/text/TextUtilities.java", "license": "gpl-2.0", "size": 29943 }
[ "java.awt.Font", "java.awt.Paint", "java.text.BreakIterator" ]
import java.awt.Font; import java.awt.Paint; import java.text.BreakIterator;
import java.awt.*; import java.text.*;
[ "java.awt", "java.text" ]
java.awt; java.text;
2,894,587
@Test public void testGetters() { final TcpServerArguments arguments = new TcpServerArguments(startTcp, allowOthers, useDaemonThread, port, useSsl, shutdownUrl, shutdownPassword, forceShutdown); assertEquals(startTcp, arguments.getStartTcp()); assertEquals(of(allowOthers), arguments.getAllowOthers()); assertEquals(of(useDaemonThread), arguments.getUseDaemonThread()); assertEquals(of(port), arguments.getPort()); assertEquals(of(useSsl), arguments.getUseSsl()); assertEquals(of(shutdownUrl), arguments.getShutdownUrl()); assertEquals(of(shutdownPassword), arguments.getShutdownPassword()); assertEquals(of(forceShutdown), arguments.getForceShutdown()); }
void function() { final TcpServerArguments arguments = new TcpServerArguments(startTcp, allowOthers, useDaemonThread, port, useSsl, shutdownUrl, shutdownPassword, forceShutdown); assertEquals(startTcp, arguments.getStartTcp()); assertEquals(of(allowOthers), arguments.getAllowOthers()); assertEquals(of(useDaemonThread), arguments.getUseDaemonThread()); assertEquals(of(port), arguments.getPort()); assertEquals(of(useSsl), arguments.getUseSsl()); assertEquals(of(shutdownUrl), arguments.getShutdownUrl()); assertEquals(of(shutdownPassword), arguments.getShutdownPassword()); assertEquals(of(forceShutdown), arguments.getForceShutdown()); }
/** * Tests the getter methods. */
Tests the getter methods
testGetters
{ "repo_name": "avojak/hydrogen", "path": "com.avojak.plugin.hydrogen.test/src/main/java/com/avojak/plugin/hydrogen/test/h2/model/arguments/TcpServerArgumentsTest.java", "license": "epl-1.0", "size": 8067 }
[ "com.avojak.plugin.hydrogen.core.h2.model.arguments.TcpServerArguments", "org.junit.Assert" ]
import com.avojak.plugin.hydrogen.core.h2.model.arguments.TcpServerArguments; import org.junit.Assert;
import com.avojak.plugin.hydrogen.core.h2.model.arguments.*; import org.junit.*;
[ "com.avojak.plugin", "org.junit" ]
com.avojak.plugin; org.junit;
2,878,573
private boolean addViewItem(int index, boolean first) { View view = getItemView(index); if (view != null) { if (first) { itemsLayout.addView(view, 0); } else { itemsLayout.addView(view); } return true; } return false; }
boolean function(int index, boolean first) { View view = getItemView(index); if (view != null) { if (first) { itemsLayout.addView(view, 0); } else { itemsLayout.addView(view); } return true; } return false; }
/** * Adds view for item to items layout * @param index the item index * @param first the flag indicates if view should be first * @return true if corresponding item exists and is added */
Adds view for item to items layout
addViewItem
{ "repo_name": "Dmanliang/CaiKePlan", "path": "app/src/main/java/com/example/caikeplan/logic/wheelview/WheelView.java", "license": "apache-2.0", "size": 23311 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,094,176
public static FQDN fromPerAligned(byte[] encodedBytes) { FQDN result = new FQDN(); result.decodePerAligned(new BitStreamReader(encodedBytes)); return result; }
static FQDN function(byte[] encodedBytes) { FQDN result = new FQDN(); result.decodePerAligned(new BitStreamReader(encodedBytes)); return result; }
/** * Creates a new FQDN from encoded stream. */
Creates a new FQDN from encoded stream
fromPerAligned
{ "repo_name": "google/supl-client", "path": "src/main/java/com/google/location/suplclient/asn1/supl2/ulp_components/FQDN.java", "license": "apache-2.0", "size": 2834 }
[ "com.google.location.suplclient.asn1.base.BitStreamReader" ]
import com.google.location.suplclient.asn1.base.BitStreamReader;
import com.google.location.suplclient.asn1.base.*;
[ "com.google.location" ]
com.google.location;
935,913
public void exit(KeyBase node) { exit((AnnotatedBase)node); }
void function(KeyBase node) { exit((AnnotatedBase)node); }
/** * Exit identity constraint element. * * @param node element being exited */
Exit identity constraint element
exit
{ "repo_name": "vkorbut/jibx", "path": "jibx/build/src/org/jibx/schema/SchemaVisitor.java", "license": "bsd-3-clause", "size": 28814 }
[ "org.jibx.schema.elements.AnnotatedBase", "org.jibx.schema.elements.KeyBase" ]
import org.jibx.schema.elements.AnnotatedBase; import org.jibx.schema.elements.KeyBase;
import org.jibx.schema.elements.*;
[ "org.jibx.schema" ]
org.jibx.schema;
2,826,026
public Map<String, Type> getKeywordParameters(Type onType) { if (!onType.isConstructor() && !onType.isAbstractData()) { return Collections.<String,Type>emptyMap(); } synchronized(fkeywordParameters) { synchronized (fImports) { Map<String, Type> result = new HashMap<>(); Map<String, Type> local = fkeywordParameters.get(onType); if (local != null) { result.putAll(local); } if (onType.isConstructor()) { local = fkeywordParameters.get(onType.getAbstractDataType()); if (local != null) { result.putAll(local); } } for (TypeStore s : fImports) { if (s.fkeywordParameters == null) { continue; } Map<String, Type> here = s.fkeywordParameters.get(onType); if (here != null) { result.putAll(here); } if (onType.isConstructor()) { here = s.fkeywordParameters.get(onType.getAbstractDataType()); if (here != null) { result.putAll(here); } } } return result; } } }
Map<String, Type> function(Type onType) { if (!onType.isConstructor() && !onType.isAbstractData()) { return Collections.<String,Type>emptyMap(); } synchronized(fkeywordParameters) { synchronized (fImports) { Map<String, Type> result = new HashMap<>(); Map<String, Type> local = fkeywordParameters.get(onType); if (local != null) { result.putAll(local); } if (onType.isConstructor()) { local = fkeywordParameters.get(onType.getAbstractDataType()); if (local != null) { result.putAll(local); } } for (TypeStore s : fImports) { if (s.fkeywordParameters == null) { continue; } Map<String, Type> here = s.fkeywordParameters.get(onType); if (here != null) { result.putAll(here); } if (onType.isConstructor()) { here = s.fkeywordParameters.get(onType.getAbstractDataType()); if (here != null) { result.putAll(here); } } } return result; } } }
/** * Locates all declared keyword parameters for a constructor. * * @param onType * @return a map of all keyword parameters declared for the onType constructor */
Locates all declared keyword parameters for a constructor
getKeywordParameters
{ "repo_name": "msteindorfer/oopsla15-artifact", "path": "pdb.values/src/org/eclipse/imp/pdb/facts/type/TypeStore.java", "license": "epl-1.0", "size": 26178 }
[ "java.util.Collections", "java.util.HashMap", "java.util.Map" ]
import java.util.Collections; import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,878,061
public void appendToSubject(String text) { Objects.requireNonNull(text); String subj = mailer.getSubject(); mailer.setSubject(subj == null ? text : subj + text); }
void function(String text) { Objects.requireNonNull(text); String subj = mailer.getSubject(); mailer.setSubject(subj == null ? text : subj + text); }
/** * Appends the specified text to the email subject line. * @param text text to append */
Appends the specified text to the email subject line
appendToSubject
{ "repo_name": "gforghetti/jenkins-tomcat-wildbook", "path": "src/main/java/org/ecocean/NotificationMailer.java", "license": "gpl-2.0", "size": 30134 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
2,087,989
protected void appendRecord(Record xml, OpenmrsObject entity, Item parent, String property, String classname, String data) throws Exception { // if (data != null && data.length() > 0) { // this will break if we don't allow data.length==0 - some string values // are required NOT NULL, but can be blank if (data != null) { Item item = xml.createItem(parent, property); item.setAttribute("type", classname); data = transformItemForSyncRecord(item, entity, property, data); xml.createText(item, data); } } /** * Called while saving a SyncRecord to allow for manipulating what is stored. The impl of this * method transforms the {@link PersonAttribute#getValue()} and {@link Obs#getVoidReason()}
void function(Record xml, OpenmrsObject entity, Item parent, String property, String classname, String data) throws Exception { if (data != null) { Item item = xml.createItem(parent, property); item.setAttribute("type", classname); data = transformItemForSyncRecord(item, entity, property, data); xml.createText(item, data); } } /** * Called while saving a SyncRecord to allow for manipulating what is stored. The impl of this * method transforms the {@link PersonAttribute#getValue()} and {@link Obs#getVoidReason()}
/** * Adds a property value to the existing serialization record as a string. * <p> * If data is null it will be skipped, no empty serialization items are written. In case of xml * serialization, the data will be serialized as: &lt;property * type='classname'&gt;data&lt;/property&gt; * * @param xml record node to append to * @param entity the object holding the given property * @param parent the pointer to the root parent node * @param property new item name (in case of xml serialization this will be child element name) * @param classname type of the property, will be recorded as attribute named 'type' on the * child item * @param data String content, in case of xml serialized as text node (i.e. not CDATA) * @throws Exception */
Adds a property value to the existing serialization record as a string. If data is null it will be skipped, no empty serialization items are written. In case of xml serialization, the data will be serialized as: &lt;property type='classname'&gt;data&lt;/property&gt
appendRecord
{ "repo_name": "viniciusboson/buendia", "path": "third_party/openmrs-module-sync/api/src/main/java/org/openmrs/module/sync/api/db/hibernate/HibernateSyncInterceptor.java", "license": "apache-2.0", "size": 62117 }
[ "org.openmrs.Obs", "org.openmrs.OpenmrsObject", "org.openmrs.PersonAttribute", "org.openmrs.module.sync.SyncRecord", "org.openmrs.module.sync.serialization.Item", "org.openmrs.module.sync.serialization.Record" ]
import org.openmrs.Obs; import org.openmrs.OpenmrsObject; import org.openmrs.PersonAttribute; import org.openmrs.module.sync.SyncRecord; import org.openmrs.module.sync.serialization.Item; import org.openmrs.module.sync.serialization.Record;
import org.openmrs.*; import org.openmrs.module.sync.*; import org.openmrs.module.sync.serialization.*;
[ "org.openmrs", "org.openmrs.module" ]
org.openmrs; org.openmrs.module;
1,174,844
public static boolean hasUniqueObject(Collection<?> collection) { if (isEmpty(collection)) { return false; } boolean hasCandidate = false; Object candidate = null; for (Object elem : collection) { if (!hasCandidate) { hasCandidate = true; candidate = elem; } else if (candidate != elem) { return false; } } return true; }
static boolean function(Collection<?> collection) { if (isEmpty(collection)) { return false; } boolean hasCandidate = false; Object candidate = null; for (Object elem : collection) { if (!hasCandidate) { hasCandidate = true; candidate = elem; } else if (candidate != elem) { return false; } } return true; }
/** * Determine whether the given Collection only contains a single unique object. * @param collection the Collection to check * @return {@code true} if the collection contains a single reference or * multiple references to the same instance, {@code false} else */
Determine whether the given Collection only contains a single unique object
hasUniqueObject
{ "repo_name": "Arabidopsis-Information-Portal/intermine", "path": "bio/sources/araport/araport-chado-db/main/src/org/intermine/bio/dataloader/util/CollectionUtils.java", "license": "lgpl-2.1", "size": 14108 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,168,896
List<Attribute> setWritableTrue(PerunSession sess, List<Attribute> attributes) throws InternalErrorException;
List<Attribute> setWritableTrue(PerunSession sess, List<Attribute> attributes) throws InternalErrorException;
/** * Set all Attributes in list to "writable = true". * * @param sess * @param attributes * @return list of attributes * @throws InternalErrorException */
Set all Attributes in list to "writable = true"
setWritableTrue
{ "repo_name": "jirmauritz/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/AttributesManagerBl.java", "license": "bsd-2-clause", "size": 193360 }
[ "cz.metacentrum.perun.core.api.Attribute", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "java.util.List" ]
import cz.metacentrum.perun.core.api.Attribute; 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,296,705
public static String timeMasterDataForTimeZnodeToString(byte[] data) { return new String(data, Charset.forName("UTF-8")); }
static String function(byte[] data) { return new String(data, Charset.forName("UTF-8")); }
/** * Method to encode data for TM's keep alive znode as String. * @param data byte array containing data to be encoded as String. * @return String representing data. */
Method to encode data for TM's keep alive znode as String
timeMasterDataForTimeZnodeToString
{ "repo_name": "jsoft88/DistributedProcessWatcher", "path": "src/org/jc/zk/util/Utils.java", "license": "mit", "size": 21392 }
[ "java.nio.charset.Charset" ]
import java.nio.charset.Charset;
import java.nio.charset.*;
[ "java.nio" ]
java.nio;
2,117,367
public void loadFromXML(File dataSource, String recordPath, DataSet<RecordType, SchemaElementType> dataset) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { // initialise the dataset initialiseDataset(dataset); // create objects for reading the XML file DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; builder = factory.newDocumentBuilder(); Document doc = builder.parse(dataSource); // prepare the XPath that selects the entries XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xpath = xPathFactory.newXPath(); XPathExpression expr = xpath.compile(recordPath); // execute the XPath to get all entries NodeList list = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); if (list.getLength() == 0) { logger.error("No elements matching the XPath (" + recordPath + ") found in the input file " + dataSource.getAbsolutePath()); } else { logger.info(String.format("Loading %d elements from %s", list.getLength(), dataSource.getName())); // create entries from all nodes matching the XPath for (int i = 0; i < list.getLength(); i++) { // create the entry, use file name as provenance information RecordType record = createModelFromElement( list.item(i), dataSource.getName()); if (record != null) { // add it to the data set dataset.add(record); } else { logger.info(String.format( "Could not generate entry for ", list.item(i) .getTextContent())); } } } }
void function(File dataSource, String recordPath, DataSet<RecordType, SchemaElementType> dataset) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { initialiseDataset(dataset); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; builder = factory.newDocumentBuilder(); Document doc = builder.parse(dataSource); XPathFactory xPathFactory = XPathFactory.newInstance(); XPath xpath = xPathFactory.newXPath(); XPathExpression expr = xpath.compile(recordPath); NodeList list = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); if (list.getLength() == 0) { logger.error(STR + recordPath + STR + dataSource.getAbsolutePath()); } else { logger.info(String.format(STR, list.getLength(), dataSource.getName())); for (int i = 0; i < list.getLength(); i++) { RecordType record = createModelFromElement( list.item(i), dataSource.getName()); if (record != null) { dataset.add(record); } else { logger.info(String.format( STR, list.item(i) .getTextContent())); } } } }
/** * Loads a data set from an XML file * * @param dataSource * the XML file containing the data * @param recordPath * the XPath to the XML nodes representing the entries * @param dataset * the dataset to fill * @throws ParserConfigurationException * @throws IOException * @throws SAXException * @throws XPathExpressionException */
Loads a data set from an XML file
loadFromXML
{ "repo_name": "olehmberg/winter", "path": "winter-framework/src/main/java/de/uni_mannheim/informatik/dws/winter/model/io/XMLMatchableReader.java", "license": "apache-2.0", "size": 8307 }
[ "de.uni_mannheim.informatik.dws.winter.model.DataSet", "java.io.File", "java.io.IOException", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException", "javax.xml.xpath.XPath", "javax.xml.xpath.XPathConstants", "javax.xml.xpath.XPathExpression", "javax.xml.xpath.XPathExpressionException", "javax.xml.xpath.XPathFactory", "org.w3c.dom.Document", "org.w3c.dom.NodeList", "org.xml.sax.SAXException" ]
import de.uni_mannheim.informatik.dws.winter.model.DataSet; import java.io.File; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException;
import de.uni_mannheim.informatik.dws.winter.model.*; import java.io.*; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "de.uni_mannheim.informatik", "java.io", "javax.xml", "org.w3c.dom", "org.xml.sax" ]
de.uni_mannheim.informatik; java.io; javax.xml; org.w3c.dom; org.xml.sax;
832,039
private void handleDSCAlarmEvent(DSCAlarmItemType dscAlarmItemType, DSCAlarmEvent dscAlarmEvent, APIMessage apiMessage) { logger.debug("handleDSCAlarmEvent(): Event received! Looking for item: {}", dscAlarmItemType); DSCAlarmBindingConfig config = null; APIMessage.APIMessageType apiMessageType = apiMessage.getAPIMessageType(); Item item = null; String itemName = ""; int partitionId = apiMessage.getPartition(); int zoneId = apiMessage.getZone(); if (dscAlarmItemType != null) { for (DSCAlarmBindingProvider prov : providers) { for (String iName : prov.getItemNames()) { config = prov.getDSCAlarmBindingConfig(iName); if (config != null) { switch (apiMessageType) { case PANEL_EVENT: if (dscAlarmItemType == config.getDSCAlarmItemType()) { itemName = iName; } break; case PARTITION_EVENT: if (partitionId == config.getPartitionId() && dscAlarmItemType == config.getDSCAlarmItemType()) { itemName = iName; } break; case ZONE_EVENT: if (zoneId == config.getZoneId() && dscAlarmItemType == config.getDSCAlarmItemType()) { itemName = iName; } break; case KEYPAD_EVENT: if (dscAlarmItemType == config.getDSCAlarmItemType()) { itemName = iName; } break; default: break; } } if (StringUtils.isNotEmpty(itemName)) { item = prov.getItem(itemName); dscAlarmItemUpdate.updateDeviceItem(item, config, eventPublisher, dscAlarmEvent, 0, ""); pollTimeStart = 0; return; } } } } }
void function(DSCAlarmItemType dscAlarmItemType, DSCAlarmEvent dscAlarmEvent, APIMessage apiMessage) { logger.debug(STR, dscAlarmItemType); DSCAlarmBindingConfig config = null; APIMessage.APIMessageType apiMessageType = apiMessage.getAPIMessageType(); Item item = null; String itemName = STR"); pollTimeStart = 0; return; } } } } }
/** * Handle incoming DSC Alarm events * * @param dscAlarmItemType * @param dscAlarmEvent * @param apiMessage */
Handle incoming DSC Alarm events
handleDSCAlarmEvent
{ "repo_name": "TheNetStriker/openhab", "path": "bundles/binding/org.openhab.binding.dscalarm/src/main/java/org/openhab/binding/dscalarm1/internal/DSCAlarmActiveBinding.java", "license": "epl-1.0", "size": 49190 }
[ "org.openhab.binding.dscalarm1.DSCAlarmBindingConfig", "org.openhab.binding.dscalarm1.internal.protocol.APIMessage", "org.openhab.core.items.Item" ]
import org.openhab.binding.dscalarm1.DSCAlarmBindingConfig; import org.openhab.binding.dscalarm1.internal.protocol.APIMessage; import org.openhab.core.items.Item;
import org.openhab.binding.dscalarm1.*; import org.openhab.binding.dscalarm1.internal.protocol.*; import org.openhab.core.items.*;
[ "org.openhab.binding", "org.openhab.core" ]
org.openhab.binding; org.openhab.core;
860,720
public TestResponse withStringBody(String body) { if (StringUtils.isNotBlank(body)) { this.body = BodyPublishers.ofString(body); } return this; }
TestResponse function(String body) { if (StringUtils.isNotBlank(body)) { this.body = BodyPublishers.ofString(body); } return this; }
/** * Sets a String body to the request * * @param body The request body to use * * @return TestResponse instance */
Sets a String body to the request
withStringBody
{ "repo_name": "svenkubiak/mangooio", "path": "mangooio-test/src/main/java/io/mangoo/test/http/TestResponse.java", "license": "apache-2.0", "size": 9917 }
[ "java.net.http.HttpRequest", "org.apache.commons.lang3.StringUtils" ]
import java.net.http.HttpRequest; import org.apache.commons.lang3.StringUtils;
import java.net.http.*; import org.apache.commons.lang3.*;
[ "java.net", "org.apache.commons" ]
java.net; org.apache.commons;
685,602
public Date getDateChanged() { return null; }
Date function() { return null; }
/** * Not currently used. Always returns null. * * @see org.openmrs.Auditable#getDateChanged() */
Not currently used. Always returns null
getDateChanged
{ "repo_name": "Bhamni/openmrs-core", "path": "api/src/main/java/org/openmrs/ConceptAnswer.java", "license": "mpl-2.0", "size": 5527 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
482,995
@TestTemplate public void testChunking() throws Exception { mockWebServer.enqueue(new MockResponse()); final int chunkSize = 1024 * 8; final int chunks = 50 * 4; CloudantClient client = CloudantClientHelper.newMockWebServerClientBuilder(mockWebServer) .build(); // POST some large random data String response = client.executeRequest(Http.POST(mockWebServer.url("/").url(), "text/plain") .setRequestBody(new RandomInputStreamGenerator(chunks * chunkSize))) .responseAsString(); assertTrue(response.isEmpty(), "There should be no response body on the mock response"); assertEquals(1, mockWebServer .getRequestCount(), "There should have been 1 request"); RecordedRequest request = MockWebServerResources.takeRequestWithTimeout(mockWebServer); assertNotNull(request, "The recorded request should not be null"); assertNull(request.getHeader("Content-Length"), "There should be no Content-Length header"); assertEquals("chunked", request.getHeader ("Transfer-Encoding"), "The Transfer-Encoding should be chunked"); // It would be nice to assert that we got the chunk sizes we were expecting, but sadly the // HttpURLConnection and ChunkedOutputStream only use the chunkSize as a suggestion and seem // to use the buffer size instead. The best assertion we can make is that we did receive // multiple chunks. assertTrue(request.getChunkSizes().size() > 1, "There should have been at least 2 chunks"); } private static final class RandomInputStreamGenerator implements HttpConnection .InputStreamGenerator { final byte[] content; RandomInputStreamGenerator(int sizeOfRandomContent) { // Construct a byte array of random data content = new byte[sizeOfRandomContent]; new java.util.Random().nextBytes(content); }
void function() throws Exception { mockWebServer.enqueue(new MockResponse()); final int chunkSize = 1024 * 8; final int chunks = 50 * 4; CloudantClient client = CloudantClientHelper.newMockWebServerClientBuilder(mockWebServer) .build(); String response = client.executeRequest(Http.POST(mockWebServer.url("/").url(), STR) .setRequestBody(new RandomInputStreamGenerator(chunks * chunkSize))) .responseAsString(); assertTrue(response.isEmpty(), STR); assertEquals(1, mockWebServer .getRequestCount(), STR); RecordedRequest request = MockWebServerResources.takeRequestWithTimeout(mockWebServer); assertNotNull(request, STR); assertNull(request.getHeader(STR), STR); assertEquals(STR, request.getHeader (STR), STR); assertTrue(request.getChunkSizes().size() > 1, STR); } private static final class RandomInputStreamGenerator implements HttpConnection .InputStreamGenerator { final byte[] content; RandomInputStreamGenerator(int sizeOfRandomContent) { content = new byte[sizeOfRandomContent]; new java.util.Random().nextBytes(content); }
/** * Test that chunking is used when input stream length is not known. * * @throws Exception */
Test that chunking is used when input stream length is not known
testChunking
{ "repo_name": "cloudant/java-cloudant", "path": "cloudant-client/src/test/java/com/cloudant/tests/HttpTest.java", "license": "apache-2.0", "size": 56294 }
[ "com.cloudant.client.api.CloudantClient", "com.cloudant.http.Http", "com.cloudant.http.HttpConnection", "com.cloudant.tests.util.MockWebServerResources", "org.junit.jupiter.api.Assertions" ]
import com.cloudant.client.api.CloudantClient; import com.cloudant.http.Http; import com.cloudant.http.HttpConnection; import com.cloudant.tests.util.MockWebServerResources; import org.junit.jupiter.api.Assertions;
import com.cloudant.client.api.*; import com.cloudant.http.*; import com.cloudant.tests.util.*; import org.junit.jupiter.api.*;
[ "com.cloudant.client", "com.cloudant.http", "com.cloudant.tests", "org.junit.jupiter" ]
com.cloudant.client; com.cloudant.http; com.cloudant.tests; org.junit.jupiter;
657,171
public Legend getLegend() { return mLegend; }
Legend function() { return mLegend; }
/** * Returns the Legend object of the chart. This method can be used to get an * instance of the legend in order to customize the automatically generated * Legend. * * @return */
Returns the Legend object of the chart. This method can be used to get an instance of the legend in order to customize the automatically generated Legend
getLegend
{ "repo_name": "Zhangbaowen13/greenhouse", "path": "MPChartLib/src/com/github/mikephil/charting/charts/Chart.java", "license": "apache-2.0", "size": 52532 }
[ "com.github.mikephil.charting.components.Legend" ]
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.*;
[ "com.github.mikephil" ]
com.github.mikephil;
590,981
public boolean processReplaceProtocolNotificationTemplateRules(ProtocolNotificationTemplate notificationTemplate, int idx) throws IOException { boolean valid = true; valid &= validFile(notificationTemplate.getTemplateFile(), "notificationTemplates[" + idx + "]"); return valid; }
boolean function(ProtocolNotificationTemplate notificationTemplate, int idx) throws IOException { boolean valid = true; valid &= validFile(notificationTemplate.getTemplateFile(), STR + idx + "]"); return valid; }
/** * * This method verifies the protocol notification template on replace. * * @param correspondenceType * @param newNotificationTemplate * @param index * @return true if the validation is successful, false otherwise * @throws IOException */
This method verifies the protocol notification template on replace
processReplaceProtocolNotificationTemplateRules
{ "repo_name": "vivantech/kc_fixes", "path": "src/main/java/org/kuali/kra/irb/actions/notification/ProtocolNotificationTemplateRule.java", "license": "apache-2.0", "size": 2932 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,718,801
protected View initialize(final View view) { return updater.initialize(view, children); }
View function(final View view) { return updater.initialize(view, children); }
/** * Initialize view * * @param view * @return view */
Initialize view
initialize
{ "repo_name": "soarcn/COCO-Accessory", "path": "adapter/src/main/java/com/cocosw/adapter/SingleTypeCursorAdapter.java", "license": "apache-2.0", "size": 4593 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,203,297
@VisibleForTesting public static void overrideAccountManagerHelperForTests( Context context, AccountManagerDelegate delegate) { synchronized (sLock) { sAccountManagerHelper = new AccountManagerHelper(context, delegate); } }
static void function( Context context, AccountManagerDelegate delegate) { synchronized (sLock) { sAccountManagerHelper = new AccountManagerHelper(context, delegate); } }
/** * Override AccountManagerHelper with a custom AccountManagerDelegate in tests. * Unlike initializeAccountManagerHelper, this will override the existing instance of * AccountManagerHelper if any. Only for use in Tests. * * @param context the applicationContext is retrieved from the context used as an argument. * @param delegate the custom AccountManagerDelegate to use. */
Override AccountManagerHelper with a custom AccountManagerDelegate in tests. Unlike initializeAccountManagerHelper, this will override the existing instance of AccountManagerHelper if any. Only for use in Tests
overrideAccountManagerHelperForTests
{ "repo_name": "Pluto-tv/chromium-crosswalk", "path": "sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java", "license": "bsd-3-clause", "size": 15088 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
1,536,659
public static InputStream cachedRead(ModuleData data) { if (data.isJavaClass()) return null; String pycname = data.getName() + "." + getCacheHash(data) + ".pyc"; long lastMod = data.getResolver().lastModified(data); for (File f : SimplePython.pycCaches) { File pyc = new File(f, pycname); if (pyc.exists()) { if (lastMod < pyc.lastModified()) { try { return new FileInputStream(pyc); } catch (FileNotFoundException e) { // Shouldn't happen e.printStackTrace(); } } } } return null; }
static InputStream function(ModuleData data) { if (data.isJavaClass()) return null; String pycname = data.getName() + "." + getCacheHash(data) + ".pyc"; long lastMod = data.getResolver().lastModified(data); for (File f : SimplePython.pycCaches) { File pyc = new File(f, pycname); if (pyc.exists()) { if (lastMod < pyc.lastModified()) { try { return new FileInputStream(pyc); } catch (FileNotFoundException e) { e.printStackTrace(); } } } } return null; }
/** * Provides default cache resolution. Used by ModuleResolver classes; Do not * use manually. */
Provides default cache resolution. Used by ModuleResolver classes; Do not use manually
cachedRead
{ "repo_name": "Enerccio/SimplePython", "path": "src/me/enerccio/sp/runtime/PythonRuntime.java", "license": "lgpl-3.0", "size": 53410 }
[ "java.io.File", "java.io.FileInputStream", "java.io.FileNotFoundException", "java.io.InputStream", "me.enerccio.sp.SimplePython", "me.enerccio.sp.types.ModuleObject" ]
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.InputStream; import me.enerccio.sp.SimplePython; import me.enerccio.sp.types.ModuleObject;
import java.io.*; import me.enerccio.sp.*; import me.enerccio.sp.types.*;
[ "java.io", "me.enerccio.sp" ]
java.io; me.enerccio.sp;
2,330,074
static byte[] writePlanBytes(VoltCompiler compiler, PlanFragment fragment, AbstractPlanNode planGraph) throws VoltCompilerException { String json = null; // get the plan bytes PlanNodeList node_list = new PlanNodeList(planGraph); json = node_list.toJSONString(); compiler.captureDiagnosticJsonFragment(json); // Place serialized version of PlanNodeTree into a PlanFragment byte[] jsonBytes = json.getBytes(Charsets.UTF_8); String bin64String = CompressionService.compressAndBase64Encode(jsonBytes); fragment.setPlannodetree(bin64String); return jsonBytes; }
static byte[] writePlanBytes(VoltCompiler compiler, PlanFragment fragment, AbstractPlanNode planGraph) throws VoltCompilerException { String json = null; PlanNodeList node_list = new PlanNodeList(planGraph); json = node_list.toJSONString(); compiler.captureDiagnosticJsonFragment(json); byte[] jsonBytes = json.getBytes(Charsets.UTF_8); String bin64String = CompressionService.compressAndBase64Encode(jsonBytes); fragment.setPlannodetree(bin64String); return jsonBytes; }
/** * Update the plan fragment and return the bytes of the plan */
Update the plan fragment and return the bytes of the plan
writePlanBytes
{ "repo_name": "deerwalk/voltdb", "path": "src/frontend/org/voltdb/compiler/StatementCompiler.java", "license": "agpl-3.0", "size": 23303 }
[ "com.google_voltpatches.common.base.Charsets", "org.voltdb.catalog.PlanFragment", "org.voltdb.compiler.VoltCompiler", "org.voltdb.plannodes.AbstractPlanNode", "org.voltdb.plannodes.PlanNodeList", "org.voltdb.utils.CompressionService" ]
import com.google_voltpatches.common.base.Charsets; import org.voltdb.catalog.PlanFragment; import org.voltdb.compiler.VoltCompiler; import org.voltdb.plannodes.AbstractPlanNode; import org.voltdb.plannodes.PlanNodeList; import org.voltdb.utils.CompressionService;
import com.google_voltpatches.common.base.*; import org.voltdb.catalog.*; import org.voltdb.compiler.*; import org.voltdb.plannodes.*; import org.voltdb.utils.*;
[ "com.google_voltpatches.common", "org.voltdb.catalog", "org.voltdb.compiler", "org.voltdb.plannodes", "org.voltdb.utils" ]
com.google_voltpatches.common; org.voltdb.catalog; org.voltdb.compiler; org.voltdb.plannodes; org.voltdb.utils;
44,328
public boolean contains ( DataCollection dc ) { boolean contains = false; String query = "select * from APP.DATA_COLLECTION where DC_CODE = ?"; try (Connection con = DatabaseManager.getMainDBConnection(); PreparedStatement stmt = con.prepareStatement(query);) { stmt.setString( 1, dc.getCode() ); try(ResultSet rs = stmt.executeQuery();) { contains = rs.next(); rs.close(); } stmt.close(); con.close(); } catch ( SQLException e ) { e.printStackTrace(); LOGGER.error("DB error", e); } return contains; }
boolean function ( DataCollection dc ) { boolean contains = false; String query = STR; try (Connection con = DatabaseManager.getMainDBConnection(); PreparedStatement stmt = con.prepareStatement(query);) { stmt.setString( 1, dc.getCode() ); try(ResultSet rs = stmt.executeQuery();) { contains = rs.next(); rs.close(); } stmt.close(); con.close(); } catch ( SQLException e ) { e.printStackTrace(); LOGGER.error(STR, e); } return contains; }
/** * Check if the data collection was already downloaded or not * @param * @return */
Check if the data collection was already downloaded or not
contains
{ "repo_name": "openefsa/CatalogueBrowser", "path": "src/data_collection/DCDAO.java", "license": "lgpl-3.0", "size": 4702 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
661,443
// HIEOS (REWROTE): public void delete(ServerRequestContext context, List orefs) throws RegistryException { //Return if nothing specified to delete if (orefs.isEmpty()) { return; } try { //List refs = bu.getObjectRefsFromRegistryObjectIds(orefs); Iterator iter = orefs.iterator(); while (iter.hasNext()) { ObjectRefType oref = (ObjectRefType) iter.next(); RegistryObjectType ro = getRegistryObjectForUpdate(context, oref); RegistryObjectDAO roDAO = (RegistryObjectDAO) getDAOForObject(ro, context); List<RegistryObjectType> deleteList = new ArrayList<RegistryObjectType>(); deleteList.add(ro); roDAO.delete(deleteList); } } catch (JAXRException e) { throw new RegistryException(e); } }
void function(ServerRequestContext context, List orefs) throws RegistryException { if (orefs.isEmpty()) { return; } try { Iterator iter = orefs.iterator(); while (iter.hasNext()) { ObjectRefType oref = (ObjectRefType) iter.next(); RegistryObjectType ro = getRegistryObjectForUpdate(context, oref); RegistryObjectDAO roDAO = (RegistryObjectDAO) getDAOForObject(ro, context); List<RegistryObjectType> deleteList = new ArrayList<RegistryObjectType>(); deleteList.add(ro); roDAO.delete(deleteList); } } catch (JAXRException e) { throw new RegistryException(e); } }
/** * Does a bulk delete of a heterogeneous Collection of RegistrObjects. If * any RegistryObject cannot be found, it will make no change to the * database and throw RegistryException * */
Does a bulk delete of a heterogeneous Collection of RegistrObjects. If any RegistryObject cannot be found, it will make no change to the database and throw RegistryException
delete
{ "repo_name": "kef/hieos", "path": "src/omar/src/org/freebxml/omar/server/persistence/rdb/SQLPersistenceManagerImpl.java", "license": "apache-2.0", "size": 42960 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "javax.xml.registry.JAXRException", "javax.xml.registry.RegistryException", "org.freebxml.omar.server.common.ServerRequestContext", "org.oasis.ebxml.registry.bindings.rim.ObjectRefType", "org.oasis.ebxml.registry.bindings.rim.RegistryObjectType" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.xml.registry.JAXRException; import javax.xml.registry.RegistryException; import org.freebxml.omar.server.common.ServerRequestContext; import org.oasis.ebxml.registry.bindings.rim.ObjectRefType; import org.oasis.ebxml.registry.bindings.rim.RegistryObjectType;
import java.util.*; import javax.xml.registry.*; import org.freebxml.omar.server.common.*; import org.oasis.ebxml.registry.bindings.rim.*;
[ "java.util", "javax.xml", "org.freebxml.omar", "org.oasis.ebxml" ]
java.util; javax.xml; org.freebxml.omar; org.oasis.ebxml;
816,753
public jsx3.gui.Image setSrc(String srcSrc) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + "setSrc", srcSrc); ScriptSessions.addScript(script); return this; }
jsx3.gui.Image function(String srcSrc) { ScriptBuffer script = new ScriptBuffer(); script.appendCall(getContextPath() + STR, srcSrc); ScriptSessions.addScript(script); return this; }
/** * Sets the URI of this image. The URI can be absolute or relative from the content base of the server that owns this object. * @param srcSrc * @return this object */
Sets the URI of this image. The URI can be absolute or relative from the content base of the server that
setSrc
{ "repo_name": "burris/dwr", "path": "ui/gi/generated/java/jsx3/gui/Image.java", "license": "apache-2.0", "size": 3641 }
[ "org.directwebremoting.ScriptBuffer", "org.directwebremoting.ScriptSessions" ]
import org.directwebremoting.ScriptBuffer; import org.directwebremoting.ScriptSessions;
import org.directwebremoting.*;
[ "org.directwebremoting" ]
org.directwebremoting;
1,579,703
@Override public void updateClob(int columnIndex, Reader x) throws SQLException { updateClob(columnIndex, x, -1); }
void function(int columnIndex, Reader x) throws SQLException { updateClob(columnIndex, x, -1); }
/** * Updates a column in the current or insert row. * * @param columnIndex (1,2,...) * @param x the value * @throws SQLException if the result set is closed or not updatable */
Updates a column in the current or insert row
updateClob
{ "repo_name": "wizardofos/Protozoo", "path": "extra/h2/src/main/java/org/h2/jdbc/JdbcResultSet.java", "license": "mit", "size": 120208 }
[ "java.io.Reader", "java.sql.SQLException" ]
import java.io.Reader; import java.sql.SQLException;
import java.io.*; import java.sql.*;
[ "java.io", "java.sql" ]
java.io; java.sql;
1,839,241
public List<Container> getContainers() throws Exception { List<Container> containers = new ArrayList<>(); for (Resource r : required.keySet()) { Container bundle = project.getBundle(r); containers.add(bundle); } return containers; }
List<Container> function() throws Exception { List<Container> containers = new ArrayList<>(); for (Resource r : required.keySet()) { Container bundle = project.getBundle(r); containers.add(bundle); } return containers; }
/** * Get a list of runbundles as containers */
Get a list of runbundles as containers
getContainers
{ "repo_name": "psoreide/bnd", "path": "biz.aQute.resolve/src/biz/aQute/resolve/RunResolution.java", "license": "apache-2.0", "size": 14377 }
[ "java.util.ArrayList", "java.util.List", "org.osgi.resource.Resource" ]
import java.util.ArrayList; import java.util.List; import org.osgi.resource.Resource;
import java.util.*; import org.osgi.resource.*;
[ "java.util", "org.osgi.resource" ]
java.util; org.osgi.resource;
2,564,834
@Override public Map<String, Number> status() { return null; }
Map<String, Number> function() { return null; }
/** * Returns the current status of this parameter server * updater * * @return */
Returns the current status of this parameter server updater
status
{ "repo_name": "deeplearning4j/nd4j", "path": "nd4j-parameter-server-parent/nd4j-parameter-server/src/main/java/org/nd4j/parameterserver/updater/SoftSyncParameterUpdater.java", "license": "apache-2.0", "size": 2525 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,826,177
private boolean applyBeforeEdgeWeightUpdateDirectedWeighted( DirectedWeightedEdge directedDoubleWeightedEdge, double weight) { applyEdgeWeightedUpdateDirectedWeighted(directedDoubleWeightedEdge, weight); return true; }
boolean function( DirectedWeightedEdge directedDoubleWeightedEdge, double weight) { applyEdgeWeightedUpdateDirectedWeighted(directedDoubleWeightedEdge, weight); return true; }
/** * Called before the edge weight update is applied to the graph. * * @param directedDoubleWeightedEdge * The {@link Edge} whose edge weight changes. * @param weight * The new weight of the Edge after the Update. * @return true, if successful; */
Called before the edge weight update is applied to the graph
applyBeforeEdgeWeightUpdateDirectedWeighted
{ "repo_name": "timgrube/DNA", "path": "src/dna/metrics/similarityMeasures/dice/DiceU.java", "license": "gpl-3.0", "size": 31464 }
[ "dna.graph.edges.DirectedWeightedEdge" ]
import dna.graph.edges.DirectedWeightedEdge;
import dna.graph.edges.*;
[ "dna.graph.edges" ]
dna.graph.edges;
326,705
private MapReduceOper startNew(FileSpec fSpec, MapReduceOper old) throws PlanException{ POLoad ld = getLoad(); ld.setLFile(fSpec); MapReduceOper ret = getMROp(); ret.mapPlan.add(ld); MRPlan.add(ret); MRPlan.connect(old, ret); return ret; }
MapReduceOper function(FileSpec fSpec, MapReduceOper old) throws PlanException{ POLoad ld = getLoad(); ld.setLFile(fSpec); MapReduceOper ret = getMROp(); ret.mapPlan.add(ld); MRPlan.add(ret); MRPlan.connect(old, ret); return ret; }
/** * Starts a new MRoper and connects it to the old * one by load-store. The assumption is that the * store is already inserted into the old MROper. * @param fSpec * @param old * @return * @throws IOException * @throws PlanException */
Starts a new MRoper and connects it to the old one by load-store. The assumption is that the store is already inserted into the old MROper
startNew
{ "repo_name": "miyakawataku/piggybank-ltsv", "path": "src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/MRCompiler.java", "license": "apache-2.0", "size": 124633 }
[ "org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POLoad", "org.apache.pig.impl.io.FileSpec", "org.apache.pig.impl.plan.PlanException" ]
import org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.POLoad; import org.apache.pig.impl.io.FileSpec; import org.apache.pig.impl.plan.PlanException;
import org.apache.pig.backend.hadoop.executionengine.*; import org.apache.pig.impl.io.*; import org.apache.pig.impl.plan.*;
[ "org.apache.pig" ]
org.apache.pig;
2,734,616
public void annotateEvaExFor(final InternalActionImpl internalAction, final ResourceDemandType type, final EvaluableExpression evaEx) { if (internalAction == null || evaEx == null) { throw new NullPointerException("No null arguments in annotateEvaExFor-method allowed!"); } // Other TYPES are not supported so far! if (!type.equals(ResourceDemandType.RESOURCE_TYPE_CPU_NS) && !type.equals(ResourceDemandType.RESOURCE_TYPE_HDD_NS)) { return; } boolean hasWrittenEvaEx = false; final LinkedList<ParametricResourceDemand> duplicateResourceDemandsToRemove = new LinkedList<ParametricResourceDemand>(); final EList<ParametricResourceDemand> parametricResourceDemands = internalAction.getResourceDemand_Action(); for (final ParametricResourceDemand parametricResourceDemand : parametricResourceDemands) { final ProcessingResourceType processingResourceType = parametricResourceDemand.getRequiredResource_ParametricResourceDemand(); if (type.equals(this.typeMappings.getBeagleType(processingResourceType))) { if (!hasWrittenEvaEx) { parametricResourceDemand.getSpecification_ParametericResourceDemand() .setSpecification(this.evaExToSpecification(evaEx)); hasWrittenEvaEx = true; } else { duplicateResourceDemandsToRemove.add(parametricResourceDemand); } } } // In case there are more than one ResourceDemands of the same Type are found, the // duplicates are deleted. if (!duplicateResourceDemandsToRemove.isEmpty()) { parametricResourceDemands.removeAll(duplicateResourceDemandsToRemove); } // In case there is no such ResourceDemandType at this InternalAction a new // ResourceDemand with this Type is added. if (!hasWrittenEvaEx) { final ParametricResourceDemand prdToAdd = SeffPerformanceFactory.eINSTANCE.createParametricResourceDemand(); final PCMRandomVariable randomVar = CoreFactory.eINSTANCE.createPCMRandomVariable(); randomVar.setSpecification(this.evaExToSpecification(evaEx)); prdToAdd.setSpecification_ParametericResourceDemand(randomVar); internalAction.getResourceDemand_Action().add(prdToAdd); prdToAdd.setRequiredResource_ParametricResourceDemand(this.typeMappings.getPcmType(type)); prdToAdd.setAction_ParametricResourceDemand(internalAction); } }
void function(final InternalActionImpl internalAction, final ResourceDemandType type, final EvaluableExpression evaEx) { if (internalAction == null evaEx == null) { throw new NullPointerException(STR); } if (!type.equals(ResourceDemandType.RESOURCE_TYPE_CPU_NS) && !type.equals(ResourceDemandType.RESOURCE_TYPE_HDD_NS)) { return; } boolean hasWrittenEvaEx = false; final LinkedList<ParametricResourceDemand> duplicateResourceDemandsToRemove = new LinkedList<ParametricResourceDemand>(); final EList<ParametricResourceDemand> parametricResourceDemands = internalAction.getResourceDemand_Action(); for (final ParametricResourceDemand parametricResourceDemand : parametricResourceDemands) { final ProcessingResourceType processingResourceType = parametricResourceDemand.getRequiredResource_ParametricResourceDemand(); if (type.equals(this.typeMappings.getBeagleType(processingResourceType))) { if (!hasWrittenEvaEx) { parametricResourceDemand.getSpecification_ParametericResourceDemand() .setSpecification(this.evaExToSpecification(evaEx)); hasWrittenEvaEx = true; } else { duplicateResourceDemandsToRemove.add(parametricResourceDemand); } } } if (!duplicateResourceDemandsToRemove.isEmpty()) { parametricResourceDemands.removeAll(duplicateResourceDemandsToRemove); } if (!hasWrittenEvaEx) { final ParametricResourceDemand prdToAdd = SeffPerformanceFactory.eINSTANCE.createParametricResourceDemand(); final PCMRandomVariable randomVar = CoreFactory.eINSTANCE.createPCMRandomVariable(); randomVar.setSpecification(this.evaExToSpecification(evaEx)); prdToAdd.setSpecification_ParametericResourceDemand(randomVar); internalAction.getResourceDemand_Action().add(prdToAdd); prdToAdd.setRequiredResource_ParametricResourceDemand(this.typeMappings.getPcmType(type)); prdToAdd.setAction_ParametricResourceDemand(internalAction); } }
/** * Annotating the EvaluableExpression onto the given PCM element. * * @param internalAction The PCM element * @param type The ResourceDemandType of the InternalAction ( * {@link ResourceDemandType#RESOURCE_TYPE_CPU_NS} and * {@link ResourceDemandType#RESOURCE_TYPE_HDD_NS} are accepted so far. If * the suitable Type is found more than one time, it is deleted every * further time. If the suitable Type is not yet in this InternalAction, it * is created newly and added. * @param evaEx The Expression to annotate */
Annotating the EvaluableExpression onto the given PCM element
annotateEvaExFor
{ "repo_name": "Beagle-PSE/Beagle", "path": "Core/src/main/java/de/uka/ipd/sdq/beagle/core/pcmconnection/PcmRepositoryWriterAnnotatorEvaEx.java", "license": "epl-1.0", "size": 6469 }
[ "de.uka.ipd.sdq.beagle.core.ResourceDemandType", "de.uka.ipd.sdq.beagle.core.evaluableexpressions.EvaluableExpression", "java.util.LinkedList", "org.eclipse.emf.common.util.EList", "org.palladiosimulator.pcm.core.CoreFactory", "org.palladiosimulator.pcm.core.PCMRandomVariable", "org.palladiosimulator.pcm.resourcetype.ProcessingResourceType", "org.palladiosimulator.pcm.seff.impl.InternalActionImpl", "org.palladiosimulator.pcm.seff.seff_performance.ParametricResourceDemand", "org.palladiosimulator.pcm.seff.seff_performance.SeffPerformanceFactory" ]
import de.uka.ipd.sdq.beagle.core.ResourceDemandType; import de.uka.ipd.sdq.beagle.core.evaluableexpressions.EvaluableExpression; import java.util.LinkedList; import org.eclipse.emf.common.util.EList; import org.palladiosimulator.pcm.core.CoreFactory; import org.palladiosimulator.pcm.core.PCMRandomVariable; import org.palladiosimulator.pcm.resourcetype.ProcessingResourceType; import org.palladiosimulator.pcm.seff.impl.InternalActionImpl; import org.palladiosimulator.pcm.seff.seff_performance.ParametricResourceDemand; import org.palladiosimulator.pcm.seff.seff_performance.SeffPerformanceFactory;
import de.uka.ipd.sdq.beagle.core.*; import de.uka.ipd.sdq.beagle.core.evaluableexpressions.*; import java.util.*; import org.eclipse.emf.common.util.*; import org.palladiosimulator.pcm.core.*; import org.palladiosimulator.pcm.resourcetype.*; import org.palladiosimulator.pcm.seff.impl.*; import org.palladiosimulator.pcm.seff.seff_performance.*;
[ "de.uka.ipd", "java.util", "org.eclipse.emf", "org.palladiosimulator.pcm" ]
de.uka.ipd; java.util; org.eclipse.emf; org.palladiosimulator.pcm;
2,162,546
public static User createUser(String alias, boolean isManager, boolean setOriginalAuth) { UserRole[] roles = isManager ? new UserRole[] { UserRole.ROLE_KENMEI_USER, UserRole.ROLE_KENMEI_CLIENT_MANAGER } : new UserRole[] { UserRole.ROLE_KENMEI_USER }; return createRandomUser(alias, false, null, setOriginalAuth, roles); }
static User function(String alias, boolean isManager, boolean setOriginalAuth) { UserRole[] roles = isManager ? new UserRole[] { UserRole.ROLE_KENMEI_USER, UserRole.ROLE_KENMEI_CLIENT_MANAGER } : new UserRole[] { UserRole.ROLE_KENMEI_USER }; return createRandomUser(alias, false, null, setOriginalAuth, roles); }
/** * Creates a new user with the given alias * * @param isManager * True, if this user should be a manager. * @param setOriginalAuth * true to keep the authentication * @return A new user. */
Creates a new user with the given alias
createUser
{ "repo_name": "Communote/communote-server", "path": "communote/tests/all-versions/integration/src/main/java/com/communote/server/test/util/TestUtils.java", "license": "apache-2.0", "size": 37663 }
[ "com.communote.server.model.user.User", "com.communote.server.model.user.UserRole" ]
import com.communote.server.model.user.User; import com.communote.server.model.user.UserRole;
import com.communote.server.model.user.*;
[ "com.communote.server" ]
com.communote.server;
2,048,845
private static TrustManager[] getInsecureTrustManager() { return new TrustManager[] { new X509TrustManager() { @Override public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { }
static TrustManager[] function() { return new TrustManager[] { new X509TrustManager() { public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { }
/** * This is generally not a good idea because it means * that the device will now trust all SSL * certificates leaving the device open to man * in the middle attacks. */
This is generally not a good idea because it means that the device will now trust all SSL certificates leaving the device open to man in the middle attacks
getInsecureTrustManager
{ "repo_name": "mrkcsc/android-mg-bootstrap", "path": "mg-bootstrap/lib/src/main/java/com/miguelgaeta/bootstrap/mg_ssl/MGSSLFactory.java", "license": "apache-2.0", "size": 4057 }
[ "java.security.cert.CertificateException", "java.security.cert.X509Certificate", "javax.net.ssl.TrustManager", "javax.net.ssl.X509TrustManager" ]
import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager;
import java.security.cert.*; import javax.net.ssl.*;
[ "java.security", "javax.net" ]
java.security; javax.net;
559,970
if (sIsBrowserInitialized) return true; Log.d(TAG, "Performing one-time browser initialization"); ChromecastConfigAndroid.initializeForBrowser(context); // Initializing the command line must occur before loading the library. if (!CommandLine.isInitialized()) { ContentApplication.initCommandLine(context); if (context instanceof Activity) { Intent launchingIntent = ((Activity) context).getIntent(); String[] commandLineParams = getCommandLineParamsFromIntent(launchingIntent); if (commandLineParams != null) { CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams); } } } CommandLine.getInstance().appendSwitchWithValue( ContentSwitches.FORCE_DEVICE_SCALE_FACTOR, "1"); waitForDebuggerIfNeeded(); DeviceUtils.addDeviceSpecificUserAgentSwitch(context); try { LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(context); Log.d(TAG, "Loading BrowserStartupController..."); BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER) .startBrowserProcessesSync(false); NetworkChangeNotifier.init(context); // Cast shell always expects to receive notifications to track network state. NetworkChangeNotifier.registerToReceiveNotificationsAlways(); sIsBrowserInitialized = true; return true; } catch (ProcessInitException e) { Log.e(TAG, "Unable to launch browser process.", e); return false; } }
if (sIsBrowserInitialized) return true; Log.d(TAG, STR); ChromecastConfigAndroid.initializeForBrowser(context); if (!CommandLine.isInitialized()) { ContentApplication.initCommandLine(context); if (context instanceof Activity) { Intent launchingIntent = ((Activity) context).getIntent(); String[] commandLineParams = getCommandLineParamsFromIntent(launchingIntent); if (commandLineParams != null) { CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams); } } } CommandLine.getInstance().appendSwitchWithValue( ContentSwitches.FORCE_DEVICE_SCALE_FACTOR, "1"); waitForDebuggerIfNeeded(); DeviceUtils.addDeviceSpecificUserAgentSwitch(context); try { LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(context); Log.d(TAG, STR); BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER) .startBrowserProcessesSync(false); NetworkChangeNotifier.init(context); NetworkChangeNotifier.registerToReceiveNotificationsAlways(); sIsBrowserInitialized = true; return true; } catch (ProcessInitException e) { Log.e(TAG, STR, e); return false; } }
/** * Starts the browser process synchronously, returning success or failure. If the browser has * already started, immediately returns true without performing any more initialization. * This may only be called on the UI thread. * * @return whether or not the process started successfully */
Starts the browser process synchronously, returning success or failure. If the browser has already started, immediately returns true without performing any more initialization. This may only be called on the UI thread
initializeBrowser
{ "repo_name": "Teamxrtc/webrtc-streaming-node", "path": "third_party/webrtc/src/chromium/src/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastBrowserHelper.java", "license": "mit", "size": 3856 }
[ "android.app.Activity", "android.content.Intent", "android.util.Log", "org.chromium.base.CommandLine", "org.chromium.base.library_loader.LibraryLoader", "org.chromium.base.library_loader.LibraryProcessType", "org.chromium.base.library_loader.ProcessInitException", "org.chromium.chromecast.base.ChromecastConfigAndroid", "org.chromium.content.app.ContentApplication", "org.chromium.content.browser.BrowserStartupController", "org.chromium.content.browser.DeviceUtils", "org.chromium.content.common.ContentSwitches", "org.chromium.net.NetworkChangeNotifier" ]
import android.app.Activity; import android.content.Intent; import android.util.Log; import org.chromium.base.CommandLine; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; import org.chromium.chromecast.base.ChromecastConfigAndroid; import org.chromium.content.app.ContentApplication; import org.chromium.content.browser.BrowserStartupController; import org.chromium.content.browser.DeviceUtils; import org.chromium.content.common.ContentSwitches; import org.chromium.net.NetworkChangeNotifier;
import android.app.*; import android.content.*; import android.util.*; import org.chromium.base.*; import org.chromium.base.library_loader.*; import org.chromium.chromecast.base.*; import org.chromium.content.app.*; import org.chromium.content.browser.*; import org.chromium.content.common.*; import org.chromium.net.*;
[ "android.app", "android.content", "android.util", "org.chromium.base", "org.chromium.chromecast", "org.chromium.content", "org.chromium.net" ]
android.app; android.content; android.util; org.chromium.base; org.chromium.chromecast; org.chromium.content; org.chromium.net;
2,032,204