method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Override public void setFile( PDFileSpecification f ) { //do nothing. }
void function( PDFileSpecification f ) { }
/** * Set the file specification. * @param f The file specification. */
Set the file specification
setFile
{ "repo_name": "mdamt/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/PDMemoryStream.java", "license": "apache-2.0", "size": 7502 }
[ "org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification" ]
import org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification;
import org.apache.pdfbox.pdmodel.common.filespecification.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
181,773
@Override public SubscribeContextAvailabilityResponse subscribeContextAvailability( SubscribeContextAvailabilityRequest request) { return null; }
SubscribeContextAvailabilityResponse function( SubscribeContextAvailabilityRequest request) { return null; }
/** * This method is not implemented by the IoT Broker Core and returns null. */
This method is not implemented by the IoT Broker Core and returns null
subscribeContextAvailability
{ "repo_name": "loretrisolini/Aeron", "path": "eu.neclab.iotplatform.iotbroker.core/src/main/java/eu/neclab/iotplatform/iotbroker/core/IotBrokerCore.java", "license": "bsd-3-clause", "size": 43275 }
[ "eu.neclab.iotplatform.ngsi.api.datamodel.SubscribeContextAvailabilityRequest", "eu.neclab.iotplatform.ngsi.api.datamodel.SubscribeContextAvailabilityResponse" ]
import eu.neclab.iotplatform.ngsi.api.datamodel.SubscribeContextAvailabilityRequest; import eu.neclab.iotplatform.ngsi.api.datamodel.SubscribeContextAvailabilityResponse;
import eu.neclab.iotplatform.ngsi.api.datamodel.*;
[ "eu.neclab.iotplatform" ]
eu.neclab.iotplatform;
1,781,691
private void butLastActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butLastActionPerformed try { this.getDataFile().getResultSet().last(); this.updateView(); } catch (SQLException ex) { Logger.getLogger(FraProduct.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_butLastActionPerformed
void function(java.awt.event.ActionEvent evt) { try { this.getDataFile().getResultSet().last(); this.updateView(); } catch (SQLException ex) { Logger.getLogger(FraProduct.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Last record * @param evt Event */
Last record
butLastActionPerformed
{ "repo_name": "jfmendozam/BillApp", "path": "BillApp/src/billapp/view/FraProduct.java", "license": "apache-2.0", "size": 25170 }
[ "java.sql.SQLException", "java.util.logging.Level", "java.util.logging.Logger" ]
import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger;
import java.sql.*; import java.util.logging.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
2,145,877
private static boolean isLoadableField( ModelField field ) { return ( field.getOrigin().equals( ModelField.FIELD_ORIGIN.DECLARED ) ); } static class ClassMetadata { int modifiers; boolean memberClass; boolean localClass; boolean anonymousClass; boolean enumClass; public ClassMetadata( int modifiers, boolean memberClass, boolean localClass, boolean anonymousClass, boolean enumClass ) { this.modifiers = modifiers; this.memberClass = memberClass; this.localClass = localClass; this.anonymousClass = anonymousClass; this.enumClass = enumClass; }
static boolean function( ModelField field ) { return ( field.getOrigin().equals( ModelField.FIELD_ORIGIN.DECLARED ) ); } static class ClassMetadata { int modifiers; boolean memberClass; boolean localClass; boolean anonymousClass; boolean enumClass; public ClassMetadata( int modifiers, boolean memberClass, boolean localClass, boolean anonymousClass, boolean enumClass ) { this.modifiers = modifiers; this.memberClass = memberClass; this.localClass = localClass; this.anonymousClass = anonymousClass; this.enumClass = enumClass; }
/** * Indicates if this field should be loaded or not. * Some fields like a filed with name "this" shouldn't be loaded. */
Indicates if this field should be loaded or not. Some fields like a filed with name "this" shouldn't be loaded
isLoadableField
{ "repo_name": "scandihealth/kie-wb-common", "path": "kie-wb-common-services/kie-wb-common-data-modeller-core/src/main/java/org/kie/workbench/common/services/datamodeller/driver/impl/ProjectDataModelOracleUtils.java", "license": "apache-2.0", "size": 9267 }
[ "org.drools.workbench.models.datamodel.oracle.ModelField" ]
import org.drools.workbench.models.datamodel.oracle.ModelField;
import org.drools.workbench.models.datamodel.oracle.*;
[ "org.drools.workbench" ]
org.drools.workbench;
1,523,482
@Path("config-description/{providerId}") @GET @Produces(MediaType.APPLICATION_JSON) @NoCache public AuthenticatorConfigInfoRepresentation getAuthenticatorConfigDescription(@PathParam("providerId") String providerId) { auth.requireView(); ConfigurableAuthenticatorFactory factory = CredentialHelper.getConfigurableAuthenticatorFactory(session, providerId); if (factory == null) { throw new NotFoundException("Could not find authenticator provider"); } AuthenticatorConfigInfoRepresentation rep = new AuthenticatorConfigInfoRepresentation(); rep.setProviderId(providerId); rep.setName(factory.getDisplayType()); rep.setHelpText(factory.getHelpText()); rep.setProperties(new LinkedList<ConfigPropertyRepresentation>()); List<ProviderConfigProperty> configProperties = factory.getConfigProperties(); for (ProviderConfigProperty prop : configProperties) { ConfigPropertyRepresentation propRep = getConfigPropertyRep(prop); rep.getProperties().add(propRep); } return rep; }
@Path(STR) @Produces(MediaType.APPLICATION_JSON) AuthenticatorConfigInfoRepresentation function(@PathParam(STR) String providerId) { auth.requireView(); ConfigurableAuthenticatorFactory factory = CredentialHelper.getConfigurableAuthenticatorFactory(session, providerId); if (factory == null) { throw new NotFoundException(STR); } AuthenticatorConfigInfoRepresentation rep = new AuthenticatorConfigInfoRepresentation(); rep.setProviderId(providerId); rep.setName(factory.getDisplayType()); rep.setHelpText(factory.getHelpText()); rep.setProperties(new LinkedList<ConfigPropertyRepresentation>()); List<ProviderConfigProperty> configProperties = factory.getConfigProperties(); for (ProviderConfigProperty prop : configProperties) { ConfigPropertyRepresentation propRep = getConfigPropertyRep(prop); rep.getProperties().add(propRep); } return rep; }
/** * Get authenticator provider's configuration description */
Get authenticator provider's configuration description
getAuthenticatorConfigDescription
{ "repo_name": "wildfly-security-incubator/keycloak", "path": "services/src/main/java/org/keycloak/services/resources/admin/AuthenticationManagementResource.java", "license": "apache-2.0", "size": 42745 }
[ "java.util.LinkedList", "java.util.List", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType", "org.jboss.resteasy.spi.NotFoundException", "org.keycloak.authentication.ConfigurableAuthenticatorFactory", "org.keycloak.provider.ProviderConfigProperty", "org.keycloak.representations.idm.AuthenticatorConfigInfoRepresentation", "org.keycloak.representations.idm.ConfigPropertyRepresentation", "org.keycloak.utils.CredentialHelper" ]
import java.util.LinkedList; import java.util.List; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.jboss.resteasy.spi.NotFoundException; import org.keycloak.authentication.ConfigurableAuthenticatorFactory; import org.keycloak.provider.ProviderConfigProperty; import org.keycloak.representations.idm.AuthenticatorConfigInfoRepresentation; import org.keycloak.representations.idm.ConfigPropertyRepresentation; import org.keycloak.utils.CredentialHelper;
import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.jboss.resteasy.spi.*; import org.keycloak.authentication.*; import org.keycloak.provider.*; import org.keycloak.representations.idm.*; import org.keycloak.utils.*;
[ "java.util", "javax.ws", "org.jboss.resteasy", "org.keycloak.authentication", "org.keycloak.provider", "org.keycloak.representations", "org.keycloak.utils" ]
java.util; javax.ws; org.jboss.resteasy; org.keycloak.authentication; org.keycloak.provider; org.keycloak.representations; org.keycloak.utils;
1,234,326
EClass getDependentElement();
EClass getDependentElement();
/** * Returns the meta object for class '{@link br.ufpe.ines.decode.decode.artifacts.questionnaire.DependentElement <em>Dependent Element</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>Dependent Element</em>'. * @see br.ufpe.ines.decode.decode.artifacts.questionnaire.DependentElement * @generated */
Returns the meta object for class '<code>br.ufpe.ines.decode.decode.artifacts.questionnaire.DependentElement Dependent Element</code>'.
getDependentElement
{ "repo_name": "netuh/DecodePlatformPlugin", "path": "br.ufpe.ines.decode/bundles/br.ufpe.ines.decode.model/src/br/ufpe/ines/decode/decode/artifacts/questionnaire/QuestionnairePackage.java", "license": "gpl-3.0", "size": 38583 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,290,533
private static void setMtDopForCatalogOp( AnalysisResult analysisResult, TQueryOptions queryOptions) { // Set MT_DOP=4 for COMPUTE STATS on Parquet/ORC tables, unless the user has already // provided another value for MT_DOP. if (!queryOptions.isSetMt_dop() && analysisResult.isComputeStatsStmt() && analysisResult.getComputeStatsStmt().isColumnar()) { queryOptions.setMt_dop(4); } // If unset, set MT_DOP to 0 to simplify the rest of the code. if (!queryOptions.isSetMt_dop()) queryOptions.setMt_dop(0); }
static void function( AnalysisResult analysisResult, TQueryOptions queryOptions) { if (!queryOptions.isSetMt_dop() && analysisResult.isComputeStatsStmt() && analysisResult.getComputeStatsStmt().isColumnar()) { queryOptions.setMt_dop(4); } if (!queryOptions.isSetMt_dop()) queryOptions.setMt_dop(0); }
/** * Set MT_DOP based on the analysis result */
Set MT_DOP based on the analysis result
setMtDopForCatalogOp
{ "repo_name": "cloudera/Impala", "path": "fe/src/main/java/org/apache/impala/service/Frontend.java", "license": "apache-2.0", "size": 67467 }
[ "org.apache.impala.analysis.AnalysisContext", "org.apache.impala.thrift.TQueryOptions" ]
import org.apache.impala.analysis.AnalysisContext; import org.apache.impala.thrift.TQueryOptions;
import org.apache.impala.analysis.*; import org.apache.impala.thrift.*;
[ "org.apache.impala" ]
org.apache.impala;
886,143
EReference getMultExp_Left();
EReference getMultExp_Left();
/** * Returns the meta object for the containment reference '{@link uk.ac.kcl.inf.robotics.rigidBodies.MultExp#getLeft <em>Left</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Left</em>'. * @see uk.ac.kcl.inf.robotics.rigidBodies.MultExp#getLeft() * @see #getMultExp() * @generated */
Returns the meta object for the containment reference '<code>uk.ac.kcl.inf.robotics.rigidBodies.MultExp#getLeft Left</code>'.
getMultExp_Left
{ "repo_name": "szschaler/RigidBodies", "path": "uk.ac.kcl.inf.robotics.rigid_bodies/src-gen/uk/ac/kcl/inf/robotics/rigidBodies/RigidBodiesPackage.java", "license": "mit", "size": 163741 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
842,765
private static BundleEntryComponent careplan(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, CarePlan carePlan) { org.hl7.fhir.dstu3.model.CarePlan careplanResource = new org.hl7.fhir.dstu3.model.CarePlan(); careplanResource.setIntent(CarePlanIntent.ORDER); careplanResource.setSubject(new Reference(personEntry.getFullUrl())); careplanResource.setContext(new Reference(encounterEntry.getFullUrl())); Code code = carePlan.codes.get(0); careplanResource.addCategory(mapCodeToCodeableConcept(code, SNOMED_URI)); CarePlanActivityStatus activityStatus; GoalStatus goalStatus; Period period = new Period().setStart(new Date(carePlan.start)); careplanResource.setPeriod(period); if (carePlan.stop != 0L) { period.setEnd(new Date(carePlan.stop)); careplanResource.setStatus(CarePlanStatus.COMPLETED); activityStatus = CarePlanActivityStatus.COMPLETED; goalStatus = GoalStatus.ACHIEVED; } else { careplanResource.setStatus(CarePlanStatus.ACTIVE); activityStatus = CarePlanActivityStatus.INPROGRESS; goalStatus = GoalStatus.INPROGRESS; } if (!carePlan.activities.isEmpty()) { for (Code activity : carePlan.activities) { CarePlanActivityComponent activityComponent = new CarePlanActivityComponent(); CarePlanActivityDetailComponent activityDetailComponent = new CarePlanActivityDetailComponent(); activityDetailComponent.setStatus(activityStatus); activityDetailComponent.setCode(mapCodeToCodeableConcept(activity, SNOMED_URI)); activityComponent.setDetail(activityDetailComponent); careplanResource.addActivity(activityComponent); } } if (!carePlan.reasons.isEmpty()) { // Only one element in list Code reason = carePlan.reasons.get(0); for (BundleEntryComponent entry : bundle.getEntry()) { if (entry.getResource().fhirType().equals("Condition")) { Condition condition = (Condition) entry.getResource(); // Only one element in list Coding coding = condition.getCode().getCoding().get(0); if (reason.code.equals(coding.getCode())) { careplanResource.addAddresses().setReference(entry.getFullUrl()); } } } } for (JsonObject goal : carePlan.goals) { BundleEntryComponent goalEntry = caregoal(rand, bundle, goalStatus, goal); careplanResource.addGoal().setReference(goalEntry.getFullUrl()); } return newEntry(rand, bundle, careplanResource); }
static BundleEntryComponent function(RandomNumberGenerator rand, BundleEntryComponent personEntry, Bundle bundle, BundleEntryComponent encounterEntry, CarePlan carePlan) { org.hl7.fhir.dstu3.model.CarePlan careplanResource = new org.hl7.fhir.dstu3.model.CarePlan(); careplanResource.setIntent(CarePlanIntent.ORDER); careplanResource.setSubject(new Reference(personEntry.getFullUrl())); careplanResource.setContext(new Reference(encounterEntry.getFullUrl())); Code code = carePlan.codes.get(0); careplanResource.addCategory(mapCodeToCodeableConcept(code, SNOMED_URI)); CarePlanActivityStatus activityStatus; GoalStatus goalStatus; Period period = new Period().setStart(new Date(carePlan.start)); careplanResource.setPeriod(period); if (carePlan.stop != 0L) { period.setEnd(new Date(carePlan.stop)); careplanResource.setStatus(CarePlanStatus.COMPLETED); activityStatus = CarePlanActivityStatus.COMPLETED; goalStatus = GoalStatus.ACHIEVED; } else { careplanResource.setStatus(CarePlanStatus.ACTIVE); activityStatus = CarePlanActivityStatus.INPROGRESS; goalStatus = GoalStatus.INPROGRESS; } if (!carePlan.activities.isEmpty()) { for (Code activity : carePlan.activities) { CarePlanActivityComponent activityComponent = new CarePlanActivityComponent(); CarePlanActivityDetailComponent activityDetailComponent = new CarePlanActivityDetailComponent(); activityDetailComponent.setStatus(activityStatus); activityDetailComponent.setCode(mapCodeToCodeableConcept(activity, SNOMED_URI)); activityComponent.setDetail(activityDetailComponent); careplanResource.addActivity(activityComponent); } } if (!carePlan.reasons.isEmpty()) { Code reason = carePlan.reasons.get(0); for (BundleEntryComponent entry : bundle.getEntry()) { if (entry.getResource().fhirType().equals(STR)) { Condition condition = (Condition) entry.getResource(); Coding coding = condition.getCode().getCoding().get(0); if (reason.code.equals(coding.getCode())) { careplanResource.addAddresses().setReference(entry.getFullUrl()); } } } } for (JsonObject goal : carePlan.goals) { BundleEntryComponent goalEntry = caregoal(rand, bundle, goalStatus, goal); careplanResource.addGoal().setReference(goalEntry.getFullUrl()); } return newEntry(rand, bundle, careplanResource); }
/** * Map the given CarePlan to a FHIR CarePlan resource, and add it to the given Bundle. * * @param rand Source of randomness to use when generating ids etc * @param personEntry The Entry for the Person * @param bundle Bundle to add the CarePlan to * @param encounterEntry Current Encounter entry * @param carePlan The CarePlan to map to FHIR and add to the bundle * @return The added Entry */
Map the given CarePlan to a FHIR CarePlan resource, and add it to the given Bundle
careplan
{ "repo_name": "synthetichealth/synthea", "path": "src/main/java/org/mitre/synthea/export/FhirStu3.java", "license": "apache-2.0", "size": 114287 }
[ "com.google.gson.JsonObject", "java.util.Date", "org.hl7.fhir.dstu3.model.Bundle", "org.hl7.fhir.dstu3.model.CarePlan", "org.hl7.fhir.dstu3.model.Coding", "org.hl7.fhir.dstu3.model.Condition", "org.hl7.fhir.dstu3.model.Goal", "org.hl7.fhir.dstu3.model.Period", "org.hl7.fhir.dstu3.model.Reference", "org.mitre.synthea.helpers.RandomNumberGenerator", "org.mitre.synthea.world.concepts.HealthRecord" ]
import com.google.gson.JsonObject; import java.util.Date; import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.CarePlan; import org.hl7.fhir.dstu3.model.Coding; import org.hl7.fhir.dstu3.model.Condition; import org.hl7.fhir.dstu3.model.Goal; import org.hl7.fhir.dstu3.model.Period; import org.hl7.fhir.dstu3.model.Reference; import org.mitre.synthea.helpers.RandomNumberGenerator; import org.mitre.synthea.world.concepts.HealthRecord;
import com.google.gson.*; import java.util.*; import org.hl7.fhir.dstu3.model.*; import org.mitre.synthea.helpers.*; import org.mitre.synthea.world.concepts.*;
[ "com.google.gson", "java.util", "org.hl7.fhir", "org.mitre.synthea" ]
com.google.gson; java.util; org.hl7.fhir; org.mitre.synthea;
2,734,431
private void doSetup() throws Exception { super.setupAdmin(); Connection connection = context.createConnection(ADMIN1); Statement statement = context.createStatement(connection); statement.execute("DROP TABLE IF EXISTS t1"); statement.execute("CREATE TABLE t1 (c1 string)"); statement.execute("CREATE ROLE user_role"); statement.execute("GRANT SELECT ON TABLE t1 TO ROLE user_role"); statement.execute("DROP DATABASE IF EXISTS " + DB1 + " CASCADE"); statement.execute("CREATE DATABASE " + DB1); statement.execute("USE " + DB1); statement.execute("DROP TABLE IF EXISTS t2"); statement.execute("CREATE TABLE t2 (c1 string)"); statement.execute("GRANT ALL ON TABLE t2 TO ROLE user_role"); statement.execute("GRANT ROLE user_role TO GROUP " + USERGROUP1); statement.close(); connection.close(); connection = context.createConnection(USER1_1); statement = context.createStatement(connection); statement.execute("SELECT * FROM t1"); statement.execute("SELECT * FROM " + DB1 + ".t2"); statement.close(); connection.close(); }
void function() throws Exception { super.setupAdmin(); Connection connection = context.createConnection(ADMIN1); Statement statement = context.createStatement(connection); statement.execute(STR); statement.execute(STR); statement.execute(STR); statement.execute(STR); statement.execute(STR + DB1 + STR); statement.execute(STR + DB1); statement.execute(STR + DB1); statement.execute(STR); statement.execute(STR); statement.execute(STR); statement.execute(STR + USERGROUP1); statement.close(); connection.close(); connection = context.createConnection(USER1_1); statement = context.createStatement(connection); statement.execute(STR); statement.execute(STR + DB1 + ".t2"); statement.close(); connection.close(); }
/** * - Create db db1 * - Create role user_role * - Create tables (t1, db1.t2) * - Grant all on table t2 to user_role * @throws Exception */
- Create db db1 - Create role user_role - Create tables (t1, db1.t2) - Grant all on table t2 to user_role
doSetup
{ "repo_name": "intel-hadoop/incubator-sentry", "path": "sentry-tests/sentry-tests-hive/src/test/java/org/apache/sentry/tests/e2e/dbprovider/TestDatabaseProvider.java", "license": "apache-2.0", "size": 90665 }
[ "java.sql.Connection", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,856,780
public void setSeriesPaint(int series, Paint paint) { // super.setSeriesPaint(series, paint); if ((series >= 0) && (series < this.seriesNeedle.length)) { this.seriesNeedle[series].setFillPaint(paint); } }
void function(int series, Paint paint) { if ((series >= 0) && (series < this.seriesNeedle.length)) { this.seriesNeedle[series].setFillPaint(paint); } }
/** * Sets the series paint. * * @param series the series index. * @param paint the paint. * * @see #setSeriesOutlinePaint(int, Paint) */
Sets the series paint
setSeriesPaint
{ "repo_name": "opensim-org/opensim-gui", "path": "Gui/opensim/jfreechart/src/org/jfree/chart/plot/CompassPlot.java", "license": "apache-2.0", "size": 26592 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
682,856
@Deprecated Publisher<Long> downloadToStream(String filename, AsyncOutputStream destination, GridFSDownloadOptions options); /** * Downloads the contents of the stored file specified by {@code id} and writes the contents to the {@code destination}
Publisher<Long> downloadToStream(String filename, AsyncOutputStream destination, GridFSDownloadOptions options); /** * Downloads the contents of the stored file specified by {@code id} and writes the contents to the {@code destination}
/** * Downloads the contents of the stored file specified by {@code filename} and by the revision in {@code options} and writes the * contents to the {@code destination} Stream. * * @param filename the name of the file to be downloaded * @param destination the destination stream * @param options the download options * @return a Publisher with a single element, representing the amount of data written * @deprecated prefer {@link GridFSBucket#downloadToPublisher(String, GridFSDownloadOptions)} instead */
Downloads the contents of the stored file specified by filename and by the revision in options and writes the contents to the destination Stream
downloadToStream
{ "repo_name": "rozza/mongo-java-driver-reactivestreams", "path": "driver/src/main/com/mongodb/reactivestreams/client/gridfs/GridFSBucket.java", "license": "apache-2.0", "size": 47197 }
[ "com.mongodb.client.gridfs.model.GridFSDownloadOptions", "org.reactivestreams.Publisher" ]
import com.mongodb.client.gridfs.model.GridFSDownloadOptions; import org.reactivestreams.Publisher;
import com.mongodb.client.gridfs.model.*; import org.reactivestreams.*;
[ "com.mongodb.client", "org.reactivestreams" ]
com.mongodb.client; org.reactivestreams;
1,068,938
public void move(Group newGroup) throws SQLException { if (this.isIdentity()) throw new RuntimeException("Identity contacts may not be moved."); if (newGroup.isIdentitiesGroup()) throw new RuntimeException("A regular contact may not be moved in the Identities group."); Group parent = this.getGroup(); if (parent.equals(newGroup)) return; _db.setContactGroup(this.sqlId, newGroup.sqlId); if (_inLargeChange == 0) _fireChangeEvent(IMArchiveEvent.Type.MOVING_ITEMS, this); _groupContacts.get(parent).remove(this); _groupContacts.get(newGroup).add(this); _contactGroups.put(this, newGroup); if (_inLargeChange == 0) { _fireChangeEvent(IMArchiveEvent.Type.MOVED_ITEMS, this); _fireChangeEvent(IMArchiveEvent.Type.UPDATED_CONVERSATIONS, new ArrayList<Object>()); } }
void function(Group newGroup) throws SQLException { if (this.isIdentity()) throw new RuntimeException(STR); if (newGroup.isIdentitiesGroup()) throw new RuntimeException(STR); Group parent = this.getGroup(); if (parent.equals(newGroup)) return; _db.setContactGroup(this.sqlId, newGroup.sqlId); if (_inLargeChange == 0) _fireChangeEvent(IMArchiveEvent.Type.MOVING_ITEMS, this); _groupContacts.get(parent).remove(this); _groupContacts.get(newGroup).add(this); _contactGroups.put(this, newGroup); if (_inLargeChange == 0) { _fireChangeEvent(IMArchiveEvent.Type.MOVED_ITEMS, this); _fireChangeEvent(IMArchiveEvent.Type.UPDATED_CONVERSATIONS, new ArrayList<Object>()); } }
/** * Moves this contact to another group. * * @param newGroup The contact's new parent group */
Moves this contact to another group
move
{ "repo_name": "goc9000/UniArchive", "path": "src/uniarchive/models/archive/IMArchive.java", "license": "gpl-3.0", "size": 62960 }
[ "java.sql.SQLException", "java.util.ArrayList" ]
import java.sql.SQLException; import java.util.ArrayList;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
250,037
@BeforeClass public static void setUp() throws Exception { //Get driver info server.addEnvVar("DB_DRIVER", DatabaseContainerType.valueOf(testContainer).getDriverName()); //Setup datasource properties DatabaseContainerUtil.setupDataSourceProperties(server, testContainer); //Add application to server ShrinkHelper.defaultApp(server, APP_NAME, "web"); server.startServer(); }
static void function() throws Exception { server.addEnvVar(STR, DatabaseContainerType.valueOf(testContainer).getDriverName()); DatabaseContainerUtil.setupDataSourceProperties(server, testContainer); ShrinkHelper.defaultApp(server, APP_NAME, "web"); server.startServer(); }
/** * Before running any tests, start the server * * @throws Exception */
Before running any tests, start the server
setUp
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.concurrent.persistent_fat_locking/fat/src/com/ibm/ws/concurrent/persistent/fat/locking/PXLockTest.java", "license": "epl-1.0", "size": 6261 }
[ "com.ibm.websphere.simplicity.ShrinkHelper" ]
import com.ibm.websphere.simplicity.ShrinkHelper;
import com.ibm.websphere.simplicity.*;
[ "com.ibm.websphere" ]
com.ibm.websphere;
2,758,378
public void setIPlt() throws Exception { String newIp = "192.168.1.6"; String newMask = "255.255.255.0"; String inter = "lt-0/1/2"; String subport = "12"; testingMethod(inter, subport, newIp, newMask); // SET LO List<String> response = executeCommand("ip:setIP " + resourceFriendlyID + " lo0.1 192.168.1.1/24"); // // assert command output contains "[ERROR] Configuration for Loopback interface not allowed" Assert.assertTrue(response.get(1).contains("[ERROR] Configuration for Loopback interface not allowed")); }
void function() throws Exception { String newIp = STR; String newMask = STR; String inter = STR; String subport = "12"; testingMethod(inter, subport, newIp, newMask); List<String> response = executeCommand(STR + resourceFriendlyID + STR); Assert.assertTrue(response.get(1).contains(STR)); }
/** * Configure a IP in a lt interface * */
Configure a IP in a lt interface
setIPlt
{ "repo_name": "dana-i2cat/opennaas-routing-nfv", "path": "itests/router/src/test/java/org/opennaas/itests/router/shell/InterfacesIPKarafTest.java", "license": "lgpl-3.0", "size": 11861 }
[ "java.util.List", "org.junit.Assert" ]
import java.util.List; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
594,801
private ActivationMonitor getMonitor() throws RemoteException { synchronized (ActivationGroup.class) { if (monitor != null) { return monitor; } } throw new RemoteException("monitor not received"); }
ActivationMonitor function() throws RemoteException { synchronized (ActivationGroup.class) { if (monitor != null) { return monitor; } } throw new RemoteException(STR); }
/** * Returns the monitor for the activation group. */
Returns the monitor for the activation group
getMonitor
{ "repo_name": "haikuowuya/android_system_code", "path": "src/java/rmi/activation/ActivationGroup.java", "license": "apache-2.0", "size": 21242 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
1,473,815
@Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Reactor.class)) { case GeometryPackage.REACTOR__PIPES: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); }
void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Reactor.class)) { case GeometryPackage.REACTOR__PIPES: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); }
/** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>.
notifyChanged
{ "repo_name": "SmithRWORNL/january", "path": "org.eclipse.january.geometry.model.edit/src/org/eclipse/january/geometry/provider/ReactorItemProvider.java", "license": "epl-1.0", "size": 4884 }
[ "org.eclipse.emf.common.notify.Notification", "org.eclipse.emf.edit.provider.ViewerNotification", "org.eclipse.january.geometry.GeometryPackage", "org.eclipse.january.geometry.Reactor" ]
import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; import org.eclipse.january.geometry.GeometryPackage; import org.eclipse.january.geometry.Reactor;
import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; import org.eclipse.january.geometry.*;
[ "org.eclipse.emf", "org.eclipse.january" ]
org.eclipse.emf; org.eclipse.january;
2,513,728
private void processMenus(LinearLayout dayContainer, LinearLayout menuContainer, Day day) { NoteFragment notesFragment = NoteFragment.fromText(day.getNotes()); FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction(); // Add menus for(Menu menu : day.getMenus()) { MenuFragment menuFragment = MenuFragment.fromMenu(menu); int menuIndex = day.getMenus().indexOf(menu); fragmentTransaction.add(menuContainer.getId(), menuFragment, "menu-" + menuIndex); } // Add notes fragmentTransaction.add(dayContainer.getId(), notesFragment, "notes"); // Commit fragments to view. fragmentTransaction.commit(); }
void function(LinearLayout dayContainer, LinearLayout menuContainer, Day day) { NoteFragment notesFragment = NoteFragment.fromText(day.getNotes()); FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction(); for(Menu menu : day.getMenus()) { MenuFragment menuFragment = MenuFragment.fromMenu(menu); int menuIndex = day.getMenus().indexOf(menu); fragmentTransaction.add(menuContainer.getId(), menuFragment, "menu-" + menuIndex); } fragmentTransaction.add(dayContainer.getId(), notesFragment, "notes"); fragmentTransaction.commit(); }
/** * Adds all menus programmatically to the day fragment. * * @param dayContainer * @param menuContainer * @param day */
Adds all menus programmatically to the day fragment
processMenus
{ "repo_name": "crysxd/mensa-furtwangen", "path": "Mensa/app/src/main/java/de/rentoudu/mensa/fragment/DayFragment.java", "license": "gpl-3.0", "size": 2639 }
[ "android.support.v4.app.FragmentTransaction", "android.widget.LinearLayout", "de.rentoudu.mensa.model.Day", "de.rentoudu.mensa.model.Menu" ]
import android.support.v4.app.FragmentTransaction; import android.widget.LinearLayout; import de.rentoudu.mensa.model.Day; import de.rentoudu.mensa.model.Menu;
import android.support.v4.app.*; import android.widget.*; import de.rentoudu.mensa.model.*;
[ "android.support", "android.widget", "de.rentoudu.mensa" ]
android.support; android.widget; de.rentoudu.mensa;
179,041
public Type pop(int i){ for (int j=0; j<i; j++){ pop(); } return null; }
Type function(int i){ for (int j=0; j<i; j++){ pop(); } return null; }
/** * Pops i elements off the stack. ALWAYS RETURNS "null"!!! */
Pops i elements off the stack. ALWAYS RETURNS "null"!!
pop
{ "repo_name": "Maccimo/commons-bcel", "path": "src/main/java/org/apache/bcel/verifier/structurals/OperandStack.java", "license": "apache-2.0", "size": 9034 }
[ "org.apache.bcel.generic.Type" ]
import org.apache.bcel.generic.Type;
import org.apache.bcel.generic.*;
[ "org.apache.bcel" ]
org.apache.bcel;
1,938,004
protected String autogenerateId() throws JspException { return StringUtils.deleteAny(getName(), "[]"); }
String function() throws JspException { return StringUtils.deleteAny(getName(), "[]"); }
/** * Autogenerate the '{@code id}' attribute value for this tag. * <p>The default implementation simply delegates to {@link #getName()}, * deleting invalid characters (such as "[" or "]"). */
Autogenerate the 'id' attribute value for this tag. The default implementation simply delegates to <code>#getName()</code>, deleting invalid characters (such as "[" or "]")
autogenerateId
{ "repo_name": "QBNemo/spring-mvc-showcase", "path": "src/main/java/org/springframework/web/servlet/tags/form/AbstractDataBoundFormElementTag.java", "license": "apache-2.0", "size": 8049 }
[ "javax.servlet.jsp.JspException", "org.springframework.util.StringUtils" ]
import javax.servlet.jsp.JspException; import org.springframework.util.StringUtils;
import javax.servlet.jsp.*; import org.springframework.util.*;
[ "javax.servlet", "org.springframework.util" ]
javax.servlet; org.springframework.util;
2,214,243
static HttpResponse of(HttpStatus status, MediaType mediaType, String format, Object... args) { final DefaultHttpResponse res = new DefaultHttpResponse(); res.respond(status, mediaType, format, args); return res; }
static HttpResponse of(HttpStatus status, MediaType mediaType, String format, Object... args) { final DefaultHttpResponse res = new DefaultHttpResponse(); res.respond(status, mediaType, format, args); return res; }
/** * Creates a new HTTP response of the specified {@link HttpStatus} and closes the stream if the * {@link HttpStatusClass} is not {@linkplain HttpStatusClass#INFORMATIONAL informational} (1xx). * The content of the response is formatted by {@link String#format(Locale, String, Object...)} with * {@linkplain Locale#ENGLISH English locale}. * * @param mediaType the {@link MediaType} of the response content * @param format {@linkplain Formatter the format string} of the response content * @param args the arguments referenced by the format specifiers in the format string */
Creates a new HTTP response of the specified <code>HttpStatus</code> and closes the stream if the <code>HttpStatusClass</code> is not HttpStatusClass#INFORMATIONAL informational (1xx). The content of the response is formatted by <code>String#format(Locale, String, Object...)</code> with Locale#ENGLISH English locale
of
{ "repo_name": "jonefeewang/armeria", "path": "core/src/main/java/com/linecorp/armeria/common/http/HttpResponse.java", "license": "apache-2.0", "size": 8159 }
[ "com.linecorp.armeria.common.MediaType" ]
import com.linecorp.armeria.common.MediaType;
import com.linecorp.armeria.common.*;
[ "com.linecorp.armeria" ]
com.linecorp.armeria;
206,844
public interface ComponentMetadataHandler { void eachComponent(Action<? super ComponentMetadataDetails> rule);
interface ComponentMetadataHandler { void function(Action<? super ComponentMetadataDetails> rule);
/** * Adds a rule to modify the metadata of depended-on software components. * For example, this allows to set a component's status and status scheme * from within the build script, overriding any value specified in the * component descriptor. * * @param rule the rule to be added */
Adds a rule to modify the metadata of depended-on software components. For example, this allows to set a component's status and status scheme from within the build script, overriding any value specified in the component descriptor
eachComponent
{ "repo_name": "tkmnet/RCRS-ADF", "path": "gradle/gradle-2.1/src/core/org/gradle/api/artifacts/dsl/ComponentMetadataHandler.java", "license": "bsd-2-clause", "size": 2935 }
[ "org.gradle.api.Action", "org.gradle.api.artifacts.ComponentMetadataDetails" ]
import org.gradle.api.Action; import org.gradle.api.artifacts.ComponentMetadataDetails;
import org.gradle.api.*; import org.gradle.api.artifacts.*;
[ "org.gradle.api" ]
org.gradle.api;
1,354,106
public static int getLoginCount(UUID playerId) { return Nucleus.getProviders().getPlayerLookup().getLoginCount(playerId); }
static int function(UUID playerId) { return Nucleus.getProviders().getPlayerLookup().getLoginCount(playerId); }
/** * Get the number of times a player has successfully logged into the server. * * @param playerId The ID of the player. * * @return The number of times or 0 if a player with the specified ID * was not found. */
Get the number of times a player has successfully logged into the server
getLoginCount
{ "repo_name": "JCThePants/NucleusFramework", "path": "src/com/jcwhatever/nucleus/utils/player/PlayerUtils.java", "license": "mit", "size": 17812 }
[ "com.jcwhatever.nucleus.Nucleus" ]
import com.jcwhatever.nucleus.Nucleus;
import com.jcwhatever.nucleus.*;
[ "com.jcwhatever.nucleus" ]
com.jcwhatever.nucleus;
573,658
String generateInline( List<String> columnNames, List<String> columnTypes, List<String[]> valueList);
String generateInline( List<String> columnNames, List<String> columnTypes, List<String[]> valueList);
/** * Generates a SQL statement to represent an inline dataset. * * <p>For example, for Oracle, generates * * <pre> * SELECT 1 AS FOO, 'a' AS BAR FROM dual * UNION ALL * SELECT 2 AS FOO, 'b' AS BAR FROM dual * </pre> * * <p>For ANSI SQL, generates: * * <pre> * VALUES (1, 'a'), (2, 'b') * </pre> * * @param columnNames List of column names * @param columnTypes List of column types ("String" or "Numeric") * @param valueList List of rows values * @return SQL string */
Generates a SQL statement to represent an inline dataset. For example, for Oracle, generates <code> SELECT 1 AS FOO, 'a' AS BAR FROM dual UNION ALL SELECT 2 AS FOO, 'b' AS BAR FROM dual </code> For ANSI SQL, generates: <code> VALUES (1, 'a'), (2, 'b') </code>
generateInline
{ "repo_name": "preisanalytics/mondrian", "path": "src/main/mondrian/spi/Dialect.java", "license": "epl-1.0", "size": 31683 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,957,675
public Set<Long> getSubscribeChannelIds() { return subsAllowed; }
Set<Long> function() { return subsAllowed; }
/** * What channels are we trying to subscribe this system to? * @return list of channels to subscribe to */
What channels are we trying to subscribe this system to
getSubscribeChannelIds
{ "repo_name": "ogajduse/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/action/channel/ssm/ChannelActionDAO.java", "license": "gpl-2.0", "size": 3650 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
385,658
@Override public PlatformImage createPlatformImage(int w, int h) { throw new UnsupportedOperationException("Not supported yet."); }
PlatformImage function(int w, int h) { throw new UnsupportedOperationException(STR); }
/** * Creates the platform image. * * @param w the w * @param h the h * @return the platform image */
Creates the platform image
createPlatformImage
{ "repo_name": "OSEHRA/ISAAC", "path": "core/api/src/main/java/sh/isaac/api/util/HeadlessToolkit.java", "license": "apache-2.0", "size": 27972 }
[ "com.sun.javafx.tk.PlatformImage" ]
import com.sun.javafx.tk.PlatformImage;
import com.sun.javafx.tk.*;
[ "com.sun.javafx" ]
com.sun.javafx;
766,521
private void jxlKatasterblattActionPerformed(final java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jxlKatasterblattActionPerformed final List<CidsBean> reportBeans = new LinkedList<CidsBean>(); for (final CidsBeanWrapper beanWrapper : cidsBeanWrappers) { if (beanWrapper.isSelected()) { reportBeans.add(beanWrapper.cidsBean); } } MauernReportGenerator.generateKatasterBlatt(reportBeans, MauerAggregationRenderer.this, getConnectionContext()); } //GEN-LAST:event_jxlKatasterblattActionPerformed
void function(final java.awt.event.ActionEvent evt) { final List<CidsBean> reportBeans = new LinkedList<CidsBean>(); for (final CidsBeanWrapper beanWrapper : cidsBeanWrappers) { if (beanWrapper.isSelected()) { reportBeans.add(beanWrapper.cidsBean); } } MauernReportGenerator.generateKatasterBlatt(reportBeans, MauerAggregationRenderer.this, getConnectionContext()); }
/** * DOCUMENT ME! * * @param evt DOCUMENT ME! */
DOCUMENT ME
jxlKatasterblattActionPerformed
{ "repo_name": "cismet/cids-custom-wuppertal", "path": "src/main/java/de/cismet/cids/custom/objectrenderer/wunda_blau/MauerAggregationRenderer.java", "license": "lgpl-3.0", "size": 42538 }
[ "de.cismet.cids.custom.reports.wunda_blau.MauernReportGenerator", "de.cismet.cids.dynamics.CidsBean", "java.util.LinkedList", "java.util.List" ]
import de.cismet.cids.custom.reports.wunda_blau.MauernReportGenerator; import de.cismet.cids.dynamics.CidsBean; import java.util.LinkedList; import java.util.List;
import de.cismet.cids.custom.reports.wunda_blau.*; import de.cismet.cids.dynamics.*; import java.util.*;
[ "de.cismet.cids", "java.util" ]
de.cismet.cids; java.util;
900,566
private CharSequence getTokenContent() throws BadLocationException { return new DocumentCharacterIterator(fDocument, fPosition, fPreviousPos); }
CharSequence function() throws BadLocationException { return new DocumentCharacterIterator(fDocument, fPosition, fPreviousPos); }
/** * Returns the contents of the current token. * * @return the contents of the current token * @throws BadLocationException if the indices are out of bounds * @since 3.1 */
Returns the contents of the current token
getTokenContent
{ "repo_name": "dhuebner/che", "path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/ui/text/JavaIndenter.java", "license": "epl-1.0", "size": 66975 }
[ "org.eclipse.jface.text.BadLocationException" ]
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
2,128,849
// ZAP: Added sort option public void addParamPanel(String[] parentParams, String name, AbstractParamPanel panel, boolean sort) { if (parentParams != null) { DefaultMutableTreeNode parent = addParamNode(parentParams); DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(name); boolean added = false; if (sort) { for (int i = 0; i < parent.getChildCount(); i++) { if (name.compareToIgnoreCase(parent.getChildAt(i).toString()) < 0) { getTreeModel().insertNodeInto(newNode, parent, i); added = true; break; } } } if (!added) { getTreeModel().insertNodeInto(newNode, parent, parent.getChildCount()); } } else { // No need to create node. This is the root panel. } panel.setName(name); getPanelParam().add(panel, name); tablePanel.put(name, panel); }
void function(String[] parentParams, String name, AbstractParamPanel panel, boolean sort) { if (parentParams != null) { DefaultMutableTreeNode parent = addParamNode(parentParams); DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(name); boolean added = false; if (sort) { for (int i = 0; i < parent.getChildCount(); i++) { if (name.compareToIgnoreCase(parent.getChildAt(i).toString()) < 0) { getTreeModel().insertNodeInto(newNode, parent, i); added = true; break; } } } if (!added) { getTreeModel().insertNodeInto(newNode, parent, parent.getChildCount()); } } else { } panel.setName(name); getPanelParam().add(panel, name); tablePanel.put(name, panel); }
/** * If multiple name use the same panel * * @param parentParams * @param name * @param panel */
If multiple name use the same panel
addParamPanel
{ "repo_name": "thamizarasu/zaproxy", "path": "src/org/parosproxy/paros/view/AbstractParamContainerPanel.java", "license": "apache-2.0", "size": 23217 }
[ "javax.swing.tree.DefaultMutableTreeNode" ]
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
453,621
public static void e(String tag, String msg, Throwable throwable) { if (VenvyDebug.getInstance().isDebug()) { Log.e(venvyLogTag + ":" + tag, buildMessage(msg), throwable); } }
static void function(String tag, String msg, Throwable throwable) { if (VenvyDebug.getInstance().isDebug()) { Log.e(venvyLogTag + ":" + tag, buildMessage(msg), throwable); } }
/** * Send an ERROR log message and log the exception. * * @param msg The message you would like logged. * @param throwable An exception to log */
Send an ERROR log message and log the exception
e
{ "repo_name": "yanjiangbo06/libraryDemo", "path": "commonlibrary/src/main/java/cn/com/venvy/common/utils/VenvyLog.java", "license": "epl-1.0", "size": 6188 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
866,028
public void setFieldValue(String key, String value) { if (TextUtils.isEmpty(value)) { mFields.put(key, EMPTY_VALUE); } else { mFields.put(key, convertToQuotedString(value)); } }
void function(String key, String value) { if (TextUtils.isEmpty(value)) { mFields.put(key, EMPTY_VALUE); } else { mFields.put(key, convertToQuotedString(value)); } }
/** Set a value with an optional prefix at key * @param key into the hash * @param value to be set * @param prefix an optional value to be prefixed to actual value * @hide */
Set a value with an optional prefix at key
setFieldValue
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/base/wifi/java/android/net/wifi/WifiEnterpriseConfig.java", "license": "gpl-3.0", "size": 21856 }
[ "android.text.TextUtils" ]
import android.text.TextUtils;
import android.text.*;
[ "android.text" ]
android.text;
1,682,174
public static Version fromString(String version) { if (!Strings.hasLength(version)) { return Version.CURRENT; } String[] parts = version.split("\\."); if (parts.length < 3 || parts.length > 4) { throw new IllegalArgumentException("the version needs to contain major, minor and revision, and optionally the build"); } try { //we reverse the version id calculation based on some assumption as we can't reliably reverse the modulo int major = Integer.parseInt(parts[0]) * 1000000; int minor = Integer.parseInt(parts[1]) * 10000; int revision = Integer.parseInt(parts[2]) * 100; int build = 99; if (parts.length == 4) { String buildStr = parts[3]; if (buildStr.startsWith("Beta")) { build = Integer.parseInt(buildStr.substring(4)); } if (buildStr.startsWith("RC")) { build = Integer.parseInt(buildStr.substring(2)) + 50; } } return fromId(major + minor + revision + build); } catch(NumberFormatException e) { throw new IllegalArgumentException("unable to parse version " + version, e); } } public final int id; public final byte major; public final byte minor; public final byte revision; public final byte build; public final Boolean snapshot; public final org.apache.lucene.util.Version luceneVersion; Version(int id, @Nullable Boolean snapshot, org.apache.lucene.util.Version luceneVersion) { this.id = id; this.major = (byte) ((id / 1000000) % 100); this.minor = (byte) ((id / 10000) % 100); this.revision = (byte) ((id / 100) % 100); this.build = (byte) (id % 100); this.snapshot = snapshot; this.luceneVersion = luceneVersion; }
static Version function(String version) { if (!Strings.hasLength(version)) { return Version.CURRENT; } String[] parts = version.split("\\."); if (parts.length < 3 parts.length > 4) { throw new IllegalArgumentException(STR); } try { int major = Integer.parseInt(parts[0]) * 1000000; int minor = Integer.parseInt(parts[1]) * 10000; int revision = Integer.parseInt(parts[2]) * 100; int build = 99; if (parts.length == 4) { String buildStr = parts[3]; if (buildStr.startsWith("Beta")) { build = Integer.parseInt(buildStr.substring(4)); } if (buildStr.startsWith("RC")) { build = Integer.parseInt(buildStr.substring(2)) + 50; } } return fromId(major + minor + revision + build); } catch(NumberFormatException e) { throw new IllegalArgumentException(STR + version, e); } } public final int id; public final byte major; public final byte minor; public final byte revision; public final byte build; public final Boolean snapshot; public final org.apache.lucene.util.Version luceneVersion; Version(int id, @Nullable Boolean snapshot, org.apache.lucene.util.Version luceneVersion) { this.id = id; this.major = (byte) ((id / 1000000) % 100); this.minor = (byte) ((id / 10000) % 100); this.revision = (byte) ((id / 100) % 100); this.build = (byte) (id % 100); this.snapshot = snapshot; this.luceneVersion = luceneVersion; }
/** * Returns the version given its string representation, current version if the argument is null or empty */
Returns the version given its string representation, current version if the argument is null or empty
fromString
{ "repo_name": "salyh/elasticsearch", "path": "src/main/java/org/elasticsearch/Version.java", "license": "apache-2.0", "size": 22989 }
[ "org.elasticsearch.common.Nullable", "org.elasticsearch.common.Strings" ]
import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,209,987
protected int computeBatchSize(int numBatchedArgs) throws SQLException { synchronized (checkClosed().getConnectionMutex()) { long[] combinedValues = computeMaxParameterSetSizeAndBatchSize(numBatchedArgs); long maxSizeOfParameterSet = combinedValues[0]; long sizeOfEntireBatch = combinedValues[1]; int maxAllowedPacket = this.connection.getMaxAllowedPacket(); if (sizeOfEntireBatch < maxAllowedPacket - this.originalSql.length()) { return numBatchedArgs; } return (int)Math.max(1, (maxAllowedPacket - this.originalSql.length()) / maxSizeOfParameterSet); } }
int function(int numBatchedArgs) throws SQLException { synchronized (checkClosed().getConnectionMutex()) { long[] combinedValues = computeMaxParameterSetSizeAndBatchSize(numBatchedArgs); long maxSizeOfParameterSet = combinedValues[0]; long sizeOfEntireBatch = combinedValues[1]; int maxAllowedPacket = this.connection.getMaxAllowedPacket(); if (sizeOfEntireBatch < maxAllowedPacket - this.originalSql.length()) { return numBatchedArgs; } return (int)Math.max(1, (maxAllowedPacket - this.originalSql.length()) / maxSizeOfParameterSet); } }
/** * Computes the optimum number of batched parameter lists to send * without overflowing max_allowed_packet. * * @param numBatchedArgs * @return * @throws SQLException */
Computes the optimum number of batched parameter lists to send without overflowing max_allowed_packet
computeBatchSize
{ "repo_name": "suthat/signal", "path": "vendor/mysql-connector-java-5.1.26/src/com/mysql/jdbc/PreparedStatement.java", "license": "apache-2.0", "size": 168755 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
676,092
protected void checkRowsAffected(int rowsAffected) throws JdbcUpdateAffectedIncorrectNumberOfRowsException { if (this.maxRowsAffected > 0 && rowsAffected > this.maxRowsAffected) { throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(getSql(), this.maxRowsAffected, rowsAffected); } if (this.requiredRowsAffected > 0 && rowsAffected != this.requiredRowsAffected) { throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(getSql(), this.requiredRowsAffected, rowsAffected); } }
void function(int rowsAffected) throws JdbcUpdateAffectedIncorrectNumberOfRowsException { if (this.maxRowsAffected > 0 && rowsAffected > this.maxRowsAffected) { throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(getSql(), this.maxRowsAffected, rowsAffected); } if (this.requiredRowsAffected > 0 && rowsAffected != this.requiredRowsAffected) { throw new JdbcUpdateAffectedIncorrectNumberOfRowsException(getSql(), this.requiredRowsAffected, rowsAffected); } }
/** * Check the given number of affected rows against the * specified maximum number or required number. * @param rowsAffected the number of affected rows * @throws JdbcUpdateAffectedIncorrectNumberOfRowsException * if the actually affected rows are out of bounds * @see #setMaxRowsAffected * @see #setRequiredRowsAffected */
Check the given number of affected rows against the specified maximum number or required number
checkRowsAffected
{ "repo_name": "cbeams-archive/spring-framework-2.5.x", "path": "src/org/springframework/jdbc/object/SqlUpdate.java", "license": "apache-2.0", "size": 9786 }
[ "org.springframework.jdbc.JdbcUpdateAffectedIncorrectNumberOfRowsException" ]
import org.springframework.jdbc.JdbcUpdateAffectedIncorrectNumberOfRowsException;
import org.springframework.jdbc.*;
[ "org.springframework.jdbc" ]
org.springframework.jdbc;
1,728,196
public static InboundBindingEvent createAndesBinding(Exchange exchange, AMQQueue queue, AMQShortString routingKey) { //TODO: extend to other types of exchanges String exchangeName = ""; if (exchange.getType().equals(DirectExchange.TYPE)) { exchangeName = DirectExchange.TYPE.getDefaultExchangeName().toString(); } else if (exchange.getType().equals(TopicExchange.TYPE)) { exchangeName = TopicExchange.TYPE.getDefaultExchangeName().toString(); } String storageQueueName = AndesUtils.getStorageQueueForDestination(routingKey.toString(), exchangeName,queue.getName(),queue.isDurable()); boolean isQueueShared = isQueueShared(queue.isDurable(), exchangeName); String queueOwner = "null"; if(queue.getOwner() != null) { queueOwner = queue.getOwner().toString(); } QueueInfo queueInformation = new QueueInfo(storageQueueName, queue.isDurable(), isQueueShared, queueOwner, queue.isExclusive()); return new InboundBindingEvent(queueInformation,exchangeName,routingKey.toString()); }
static InboundBindingEvent function(Exchange exchange, AMQQueue queue, AMQShortString routingKey) { String exchangeName = STRnull"; if(queue.getOwner() != null) { queueOwner = queue.getOwner().toString(); } QueueInfo queueInformation = new QueueInfo(storageQueueName, queue.isDurable(), isQueueShared, queueOwner, queue.isExclusive()); return new InboundBindingEvent(queueInformation,exchangeName,routingKey.toString()); }
/** * create andes binding from qpid binding * * @param exchange qpid exchange binding points * @param queue qpid queue binding points * @param routingKey routing key * @return InboundBindingEvent binding event that wrap AndesBinding */
create andes binding from qpid binding
createAndesBinding
{ "repo_name": "hastef88/andes", "path": "modules/andes-core/broker/src/main/java/org/wso2/andes/amqp/AMQPUtils.java", "license": "apache-2.0", "size": 17581 }
[ "org.wso2.andes.framing.AMQShortString", "org.wso2.andes.kernel.disruptor.inbound.InboundBindingEvent", "org.wso2.andes.kernel.disruptor.inbound.QueueInfo", "org.wso2.andes.server.exchange.Exchange", "org.wso2.andes.server.queue.AMQQueue" ]
import org.wso2.andes.framing.AMQShortString; import org.wso2.andes.kernel.disruptor.inbound.InboundBindingEvent; import org.wso2.andes.kernel.disruptor.inbound.QueueInfo; import org.wso2.andes.server.exchange.Exchange; import org.wso2.andes.server.queue.AMQQueue;
import org.wso2.andes.framing.*; import org.wso2.andes.kernel.disruptor.inbound.*; import org.wso2.andes.server.exchange.*; import org.wso2.andes.server.queue.*;
[ "org.wso2.andes" ]
org.wso2.andes;
317,803
public WorkItemRelationType getRelationType(final String relation) { final UUID locationId = UUID.fromString("f5d33bc9-5b49-4a3c-a9bd-f3cd46dd2165"); //$NON-NLS-1$ final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.2"); //$NON-NLS-1$ final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put("relation", relation); //$NON-NLS-1$ final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValues, apiVersion, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, WorkItemRelationType.class); }
WorkItemRelationType function(final String relation) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, relation); final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValues, apiVersion, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, WorkItemRelationType.class); }
/** * [Preview API 3.1-preview.2] Gets the work item relation types. * * @param relation * * @return WorkItemRelationType */
[Preview API 3.1-preview.2] Gets the work item relation types
getRelationType
{ "repo_name": "Microsoft/vso-httpclient-java", "path": "Rest/alm-tfs-client/src/main/generated/com/microsoft/alm/teamfoundation/workitemtracking/webapi/WorkItemTrackingHttpClientBase.java", "license": "mit", "size": 169431 }
[ "com.microsoft.alm.client.HttpMethod", "com.microsoft.alm.client.VssMediaTypes", "com.microsoft.alm.client.VssRestRequest", "com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.WorkItemRelationType", "com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion", "java.util.HashMap", "java.util.Map", "java.util.UUID" ]
import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.WorkItemRelationType; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID;
import com.microsoft.alm.client.*; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*;
[ "com.microsoft.alm", "java.util" ]
com.microsoft.alm; java.util;
2,347,242
@Override public void enterConstantValue(@NotNull BindingExpressionParser.ConstantValueContext ctx) { }
@Override public void enterConstantValue(@NotNull BindingExpressionParser.ConstantValueContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
exitDefaults
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/databinding/parser/BindingExpressionBaseListener.java", "license": "gpl-3.0", "size": 14237 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
486,100
ApiProxyLocalImpl proxy = new ApiProxyLocalImpl(new File(".")) { }; proxy.setProperty( LocalDatastoreService.NO_STORAGE_PROPERTY, Boolean.TRUE.toString()); ApiProxy.setDelegate(proxy); ApiProxy.setEnvironmentForCurrentThread(environment); }
ApiProxyLocalImpl proxy = new ApiProxyLocalImpl(new File(".")) { }; proxy.setProperty( LocalDatastoreService.NO_STORAGE_PROPERTY, Boolean.TRUE.toString()); ApiProxy.setDelegate(proxy); ApiProxy.setEnvironmentForCurrentThread(environment); }
/** * Sets up a unit test with the options stored in this * object. This method should only be called once per * object. */
Sets up a unit test with the options stored in this object. This method should only be called once per object
setUp
{ "repo_name": "olibye/aeftools", "path": "src/java/com/appenginefan/toolkit/unittests/TestInitializer.java", "license": "apache-2.0", "size": 4273 }
[ "com.google.appengine.api.datastore.dev.LocalDatastoreService", "com.google.appengine.tools.development.ApiProxyLocalImpl", "com.google.apphosting.api.ApiProxy", "java.io.File" ]
import com.google.appengine.api.datastore.dev.LocalDatastoreService; import com.google.appengine.tools.development.ApiProxyLocalImpl; import com.google.apphosting.api.ApiProxy; import java.io.File;
import com.google.appengine.api.datastore.dev.*; import com.google.appengine.tools.development.*; import com.google.apphosting.api.*; import java.io.*;
[ "com.google.appengine", "com.google.apphosting", "java.io" ]
com.google.appengine; com.google.apphosting; java.io;
554,462
@Override public void prepareTrace() { // Create the tasks int jID = 0; for (int i = 0; i < numJobClasses; i++) { int numJobsInClass = (int) (1.0 * numJobs * fracsOfClasses[i] / sumFracs); while (numJobsInClass-- > 0) { // Find corresponding job String jobName = "JOB-" + jID; jID++; Job job = jobs.getOrAddJob(jobName); // #region: Create mappers int numMappers = ranGen.nextInt(jobClass[i].maxWidth - jobClass[i].minWidth + 1) + jobClass[i].minWidth; boolean[] rackChosen = new boolean[NUM_RACKS]; Arrays.fill(rackChosen, false); for (int mID = 0; mID < numMappers; mID++) { String taskName = "MAPPER-" + mID; int taskID = mID; // Create map task Task task = new MapTask(taskName, taskID, job, Constants.VALUE_IGNORED, Constants.VALUE_IGNORED, new Machine(selectMachine(rackChosen))); // Add task to corresponding job job.addTask(task); } // #endregion // #region: Create reducers int numReducers = ranGen.nextInt(jobClass[i].maxWidth - jobClass[i].minWidth + 1) + jobClass[i].minWidth; // Mark racks so that there is at most one reducer per rack rackChosen = new boolean[NUM_RACKS]; Arrays.fill(rackChosen, false); for (int rID = 0; rID < numReducers; rID++) { int numMB = ranGen.nextInt(jobClass[i].maxLength - jobClass[i].minLength + 1) + jobClass[i].minLength; double shuffleBytes = numMB * 1048576.0; // shuffleBytes for each mapper shuffleBytes *= numMappers; String taskName = "REDUCER-" + rID; int taskID = rID; // Create reduce task Task task = new ReduceTask(taskName, taskID, job, REDUCER_ARRIVAL_TIME, Constants.VALUE_IGNORED, new Machine(selectMachine(rackChosen)), shuffleBytes, Constants.VALUE_IGNORED); // Add task to corresponding job job.addTask(task); } // #endregion } } }
void function() { int jID = 0; for (int i = 0; i < numJobClasses; i++) { int numJobsInClass = (int) (1.0 * numJobs * fracsOfClasses[i] / sumFracs); while (numJobsInClass-- > 0) { String jobName = "JOB-" + jID; jID++; Job job = jobs.getOrAddJob(jobName); int numMappers = ranGen.nextInt(jobClass[i].maxWidth - jobClass[i].minWidth + 1) + jobClass[i].minWidth; boolean[] rackChosen = new boolean[NUM_RACKS]; Arrays.fill(rackChosen, false); for (int mID = 0; mID < numMappers; mID++) { String taskName = STR + mID; int taskID = mID; Task task = new MapTask(taskName, taskID, job, Constants.VALUE_IGNORED, Constants.VALUE_IGNORED, new Machine(selectMachine(rackChosen))); job.addTask(task); } int numReducers = ranGen.nextInt(jobClass[i].maxWidth - jobClass[i].minWidth + 1) + jobClass[i].minWidth; rackChosen = new boolean[NUM_RACKS]; Arrays.fill(rackChosen, false); for (int rID = 0; rID < numReducers; rID++) { int numMB = ranGen.nextInt(jobClass[i].maxLength - jobClass[i].minLength + 1) + jobClass[i].minLength; double shuffleBytes = numMB * 1048576.0; shuffleBytes *= numMappers; String taskName = STR + rID; int taskID = rID; Task task = new ReduceTask(taskName, taskID, job, REDUCER_ARRIVAL_TIME, Constants.VALUE_IGNORED, new Machine(selectMachine(rackChosen)), shuffleBytes, Constants.VALUE_IGNORED); job.addTask(task); } } } }
/** * Actually generates the random trace. */
Actually generates the random trace
prepareTrace
{ "repo_name": "kimihe/Swallow", "path": "swallow-sim/coflow/src/main/java/coflowsim/traceproducers/CustomTraceProducer.java", "license": "apache-2.0", "size": 5862 }
[ "java.util.Arrays" ]
import java.util.Arrays;
import java.util.*;
[ "java.util" ]
java.util;
1,395,560
void modifyDrink(String oldName, String newName) throws DrinkNotFoundException;
void modifyDrink(String oldName, String newName) throws DrinkNotFoundException;
/** * * Modifies the name of a drink * * @param oldName the old name of the drink * @param newName the new name of the drink * @throws DrinkNotFoundException */
Modifies the name of a drink
modifyDrink
{ "repo_name": "phoenixnap/springmvc-raml-plugin-sample", "path": "drinks-server/src/main/java/com/phoenixnap/oss/sample/server/services/DrinksServiceInterface.java", "license": "apache-2.0", "size": 2026 }
[ "com.phoenixnap.oss.sample.server.exceptions.DrinkNotFoundException" ]
import com.phoenixnap.oss.sample.server.exceptions.DrinkNotFoundException;
import com.phoenixnap.oss.sample.server.exceptions.*;
[ "com.phoenixnap.oss" ]
com.phoenixnap.oss;
1,910,765
public int create(User loggedInUser, String desiredLogin, String desiredPassword, String firstName, String lastName, String email) throws FaultException { // If we didn't get a value for pamAuth, default to no return create(loggedInUser, desiredLogin, desiredPassword, firstName, lastName, email, new Integer(0)); }
int function(User loggedInUser, String desiredLogin, String desiredPassword, String firstName, String lastName, String email) throws FaultException { return create(loggedInUser, desiredLogin, desiredPassword, firstName, lastName, email, new Integer(0)); }
/** * Creates a new user * @param loggedInUser The current user * @param desiredLogin The login for the new user * @param desiredPassword The password for the new user * @param firstName The first name of the new user * @param lastName The last name of the new user * @param email The email address for the new user * @return Returns 1 if successful (exception otherwise) * @throws FaultException A FaultException is thrown if the loggedInUser doesn't have * permissions to create new users in thier org. * * @xmlrpc.doc Create a new user. * @xmlrpc.param #param("string", "sessionKey") * @xmlrpc.param #param_desc("string", "desiredLogin", "Desired login name, will fail if * already in use.") * @xmlrpc.param #param("string", "desiredPassword") * @xmlrpc.param #param("string", "firstName") * @xmlrpc.param #param("string", "lastName") * @xmlrpc.param #param_desc("string", "email", "User's e-mail address.") * @xmlrpc.returntype #return_int_success() */
Creates a new user
create
{ "repo_name": "moio/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/user/UserHandler.java", "license": "gpl-2.0", "size": 51229 }
[ "com.redhat.rhn.FaultException", "com.redhat.rhn.domain.user.User" ]
import com.redhat.rhn.FaultException; import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.*; import com.redhat.rhn.domain.user.*;
[ "com.redhat.rhn" ]
com.redhat.rhn;
1,618,029
ServiceCall<Void> arrayStringSsvValidAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
ServiceCall<Void> arrayStringSsvValidAsync(List<String> arrayQuery, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException;
/** * Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format. * * @param arrayQuery an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link ServiceCall} object */
Get an array of string ['ArrayQuery1', 'begin!*'();:@ &amp;=+$,/?#[]end' , null, ''] using the ssv-array format
arrayStringSsvValidAsync
{ "repo_name": "yaqiyang/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/Queries.java", "license": "mit", "size": 45760 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback", "java.util.List" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import java.util.List;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
289,312
@Override public FileStatus[] listStatus(Path f) throws IOException { Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); if (key.length() > 0) { FileMetadata meta = store.retrieveMetadata(key); if (meta != null) { return new FileStatus[] { newFile(meta, absolutePath) }; } } URI pathUri = absolutePath.toUri(); Set<FileStatus> status = new TreeSet<FileStatus>(); String priorLastKey = null; do { PartialListing listing = store.list(key, S3_MAX_LISTING_LENGTH, priorLastKey); for (FileMetadata fileMetadata : listing.getFiles()) { Path subpath = keyToPath(fileMetadata.getKey()); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); if (relativePath.endsWith(FOLDER_SUFFIX)) { status.add(newDirectory(new Path(absolutePath, relativePath.substring(0, relativePath.indexOf(FOLDER_SUFFIX))))); } else { status.add(newFile(fileMetadata, subpath)); } } for (String commonPrefix : listing.getCommonPrefixes()) { Path subpath = keyToPath(commonPrefix); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); status.add(newDirectory(new Path(absolutePath, relativePath))); } priorLastKey = listing.getPriorLastKey(); } while (priorLastKey != null); if (status.isEmpty() && store.retrieveMetadata(key + FOLDER_SUFFIX) == null) { return null; } return status.toArray(new FileStatus[0]); }
FileStatus[] function(Path f) throws IOException { Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); if (key.length() > 0) { FileMetadata meta = store.retrieveMetadata(key); if (meta != null) { return new FileStatus[] { newFile(meta, absolutePath) }; } } URI pathUri = absolutePath.toUri(); Set<FileStatus> status = new TreeSet<FileStatus>(); String priorLastKey = null; do { PartialListing listing = store.list(key, S3_MAX_LISTING_LENGTH, priorLastKey); for (FileMetadata fileMetadata : listing.getFiles()) { Path subpath = keyToPath(fileMetadata.getKey()); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); if (relativePath.endsWith(FOLDER_SUFFIX)) { status.add(newDirectory(new Path(absolutePath, relativePath.substring(0, relativePath.indexOf(FOLDER_SUFFIX))))); } else { status.add(newFile(fileMetadata, subpath)); } } for (String commonPrefix : listing.getCommonPrefixes()) { Path subpath = keyToPath(commonPrefix); String relativePath = pathUri.relativize(subpath.toUri()).getPath(); status.add(newDirectory(new Path(absolutePath, relativePath))); } priorLastKey = listing.getPriorLastKey(); } while (priorLastKey != null); if (status.isEmpty() && store.retrieveMetadata(key + FOLDER_SUFFIX) == null) { return null; } return status.toArray(new FileStatus[0]); }
/** * <p> * If <code>f</code> is a file, this method will make a single call to S3. * If <code>f</code> is a directory, this method will make a maximum of * (<i>n</i> / 1000) + 2 calls to S3, where <i>n</i> is the total number of * files and directories contained directly in <code>f</code>. * </p> */
If <code>f</code> is a file, this method will make a single call to S3. If <code>f</code> is a directory, this method will make a maximum of (n / 1000) + 2 calls to S3, where n is the total number of files and directories contained directly in <code>f</code>.
listStatus
{ "repo_name": "sbyoun/i-mapreduce", "path": "src/core/org/apache/hadoop/fs/s3native/NativeS3FileSystem.java", "license": "apache-2.0", "size": 17546 }
[ "java.io.IOException", "java.util.Set", "java.util.TreeSet", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import java.util.Set; import java.util.TreeSet; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,878,210
@Bean public PersistenceExceptionTranslationPostProcessor exceptionTranslation() { return new PersistenceExceptionTranslationPostProcessor(); } // Private fields @Autowired private Environment env; @Autowired private DataSource dataSource; @Autowired private LocalContainerEntityManagerFactoryBean entityManagerFactory;
PersistenceExceptionTranslationPostProcessor function() { return new PersistenceExceptionTranslationPostProcessor(); } private Environment env; private DataSource dataSource; private LocalContainerEntityManagerFactoryBean entityManagerFactory;
/** * PersistenceExceptionTranslationPostProcessor is a bean post processor * which adds an advisor to any bean annotated with Repository so that any * platform-specific exceptions are caught and then rethrown as one * Spring's unchecked data access exceptions (i.e. a subclass of * DataAccessException). */
PersistenceExceptionTranslationPostProcessor is a bean post processor which adds an advisor to any bean annotated with Repository so that any platform-specific exceptions are caught and then rethrown as one Spring's unchecked data access exceptions (i.e. a subclass of DataAccessException)
exceptionTranslation
{ "repo_name": "ITGuy9401/RPGMakerVXtoMVConverterWEB", "path": "src/main/java/tk/vxmvconverter/app/configuration/JPAConfig.java", "license": "apache-2.0", "size": 3779 }
[ "javax.sql.DataSource", "org.springframework.core.env.Environment", "org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor", "org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" ]
import javax.sql.DataSource; import org.springframework.core.env.Environment; import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import javax.sql.*; import org.springframework.core.env.*; import org.springframework.dao.annotation.*; import org.springframework.orm.jpa.*;
[ "javax.sql", "org.springframework.core", "org.springframework.dao", "org.springframework.orm" ]
javax.sql; org.springframework.core; org.springframework.dao; org.springframework.orm;
1,223,894
public static void centerOnScreen(Component compo) { Dimension screenSize = compo.getToolkit().getScreenSize(); Dimension dlgSize = compo.getSize(); compo.setLocation(screenSize.width / 2 - dlgSize.width / 2, screenSize.height / 2 - dlgSize.height / 2); }
static void function(Component compo) { Dimension screenSize = compo.getToolkit().getScreenSize(); Dimension dlgSize = compo.getSize(); compo.setLocation(screenSize.width / 2 - dlgSize.width / 2, screenSize.height / 2 - dlgSize.height / 2); }
/** * Centers the component on the screen. */
Centers the component on the screen
centerOnScreen
{ "repo_name": "pgdurand/BeeDeeM", "path": "src/bzh/plealog/dbmirror/ui/UIUtils.java", "license": "agpl-3.0", "size": 9029 }
[ "java.awt.Component", "java.awt.Dimension" ]
import java.awt.Component; import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
791,812
public AnimatableValue createValue(AnimationTarget target, String pn, Value v) { return null; } } protected static class AnimatableRectValueFactory implements Factory { protected NumberListParser parser = new NumberListParser(); protected FloatArrayProducer producer = new FloatArrayProducer(); public AnimatableRectValueFactory() { parser.setNumberListHandler(producer); }
AnimatableValue function(AnimationTarget target, String pn, Value v) { return null; } } protected static class AnimatableRectValueFactory implements Factory { protected NumberListParser parser = new NumberListParser(); protected FloatArrayProducer producer = new FloatArrayProducer(); public AnimatableRectValueFactory() { parser.setNumberListHandler(producer); }
/** * Creates a new AnimatableValue from a CSS {@link Value}. Returns null * since number lists aren't used in CSS values. */
Creates a new AnimatableValue from a CSS <code>Value</code>. Returns null since number lists aren't used in CSS values
createValue
{ "repo_name": "apache/batik", "path": "batik-bridge/src/main/java/org/apache/batik/bridge/SVGAnimationEngine.java", "license": "apache-2.0", "size": 68186 }
[ "org.apache.batik.anim.dom.AnimationTarget", "org.apache.batik.anim.values.AnimatableValue", "org.apache.batik.css.engine.value.Value", "org.apache.batik.parser.FloatArrayProducer", "org.apache.batik.parser.NumberListParser" ]
import org.apache.batik.anim.dom.AnimationTarget; import org.apache.batik.anim.values.AnimatableValue; import org.apache.batik.css.engine.value.Value; import org.apache.batik.parser.FloatArrayProducer; import org.apache.batik.parser.NumberListParser;
import org.apache.batik.anim.dom.*; import org.apache.batik.anim.values.*; import org.apache.batik.css.engine.value.*; import org.apache.batik.parser.*;
[ "org.apache.batik" ]
org.apache.batik;
1,753,537
public Observable<ServiceResponse<DiagnosticAnalysisInner>> executeSiteAnalysisWithServiceResponseAsync(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, DateTime startTime, DateTime endTime, String timeGrain) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (siteName == null) { throw new IllegalArgumentException("Parameter siteName is required and cannot be null."); } if (diagnosticCategory == null) { throw new IllegalArgumentException("Parameter diagnosticCategory is required and cannot be null."); } if (analysisName == null) { throw new IllegalArgumentException("Parameter analysisName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<DiagnosticAnalysisInner>> function(String resourceGroupName, String siteName, String diagnosticCategory, String analysisName, DateTime startTime, DateTime endTime, String timeGrain) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (siteName == null) { throw new IllegalArgumentException(STR); } if (diagnosticCategory == null) { throw new IllegalArgumentException(STR); } if (analysisName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Execute Analysis. * Execute Analysis. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Site Name * @param diagnosticCategory Category Name * @param analysisName Analysis Resource Name * @param startTime Start Time * @param endTime End Time * @param timeGrain Time Grain * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the DiagnosticAnalysisInner object */
Execute Analysis. Execute Analysis
executeSiteAnalysisWithServiceResponseAsync
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java", "license": "mit", "size": 295384 }
[ "com.microsoft.rest.ServiceResponse", "org.joda.time.DateTime" ]
import com.microsoft.rest.ServiceResponse; import org.joda.time.DateTime;
import com.microsoft.rest.*; import org.joda.time.*;
[ "com.microsoft.rest", "org.joda.time" ]
com.microsoft.rest; org.joda.time;
1,904,765
public void getNativeDescriptors(final UUID serviceUuid, final UUID charUuid, final ForEach_Breakable<BluetoothGattDescriptor> forEach) { m_serviceMngr.getDescriptors(serviceUuid, charUuid, forEach); }
void function(final UUID serviceUuid, final UUID charUuid, final ForEach_Breakable<BluetoothGattDescriptor> forEach) { m_serviceMngr.getDescriptors(serviceUuid, charUuid, forEach); }
/** * Overload of {@link BleNode#getNativeDescriptors(UUID, UUID)} using a for each construct. */
Overload of <code>BleNode#getNativeDescriptors(UUID, UUID)</code> using a for each construct
getNativeDescriptors
{ "repo_name": "iDevicesInc/SweetBlue", "path": "library/src/main/java/com/idevicesinc/sweetblue/BleNode.java", "license": "gpl-3.0", "size": 37318 }
[ "android.bluetooth.BluetoothGattDescriptor" ]
import android.bluetooth.BluetoothGattDescriptor;
import android.bluetooth.*;
[ "android.bluetooth" ]
android.bluetooth;
1,896,870
public static boolean URLHasXSS ( String url ) { if ( url == null ) { return false; } return RegEX.contains( url, XSS_REGEXP_PATTERN ); }
static boolean function ( String url ) { if ( url == null ) { return false; } return RegEX.contains( url, XSS_REGEXP_PATTERN ); }
/** * Checks in the given url for possible XSS hacks and return true if any possible XSS fragment is found * * @param url * @return true if any possible XSS fragment is found * @deprecated Use instead individually URIHasXSS and ParamsHaveXSS */
Checks in the given url for possible XSS hacks and return true if any possible XSS fragment is found
URLHasXSS
{ "repo_name": "guhb/core", "path": "src/com/liferay/util/Xss.java", "license": "gpl-3.0", "size": 4713 }
[ "com.dotmarketing.util.RegEX" ]
import com.dotmarketing.util.RegEX;
import com.dotmarketing.util.*;
[ "com.dotmarketing.util" ]
com.dotmarketing.util;
130,899
public void drawBones (Player player) { this.setColor(1, 0, 0, 1); Iterator<Bone> it = player.boneIterator(); while (it.hasNext()) { Timeline.Key.Bone bone = it.next(); Timeline.Key key = player.getKeyFor(bone); if (!key.active) continue; ObjectInfo info = player.getObjectInfoFor(bone); Dimension size = info.size; drawBone(bone, size); } }
void function (Player player) { this.setColor(1, 0, 0, 1); Iterator<Bone> it = player.boneIterator(); while (it.hasNext()) { Timeline.Key.Bone bone = it.next(); Timeline.Key key = player.getKeyFor(bone); if (!key.active) continue; ObjectInfo info = player.getObjectInfoFor(bone); Dimension size = info.size; drawBone(bone, size); } }
/** * Draws the bones of the given player composed of lines. * @param player the player to draw */
Draws the bones of the given player composed of lines
drawBones
{ "repo_name": "piotr-j/VisEditor", "path": "plugins/vis-runtime-spriter/src/main/java/com/brashmonkey/spriter/Drawer.java", "license": "apache-2.0", "size": 9789 }
[ "com.brashmonkey.spriter.Entity", "com.brashmonkey.spriter.Timeline", "java.util.Iterator" ]
import com.brashmonkey.spriter.Entity; import com.brashmonkey.spriter.Timeline; import java.util.Iterator;
import com.brashmonkey.spriter.*; import java.util.*;
[ "com.brashmonkey.spriter", "java.util" ]
com.brashmonkey.spriter; java.util;
2,343,254
private void printType(SnmpObjectIdentity type, String indent) { os.println("OBJECT-IDENTITY"); os.print(" STATUS "); os.println(type.getStatus()); printDescription(type.getDescription()); if (type.getReference() != null) { os.println(); os.print(" REFERENCE "); os.print(getQuote(type.getReference())); } }
void function(SnmpObjectIdentity type, String indent) { os.println(STR); os.print(STR); os.println(type.getStatus()); printDescription(type.getDescription()); if (type.getReference() != null) { os.println(); os.print(STR); os.print(getQuote(type.getReference())); } }
/** * Prints an SNMP object identity. * * @param type the type to print * @param indent the indentation to use on new lines */
Prints an SNMP object identity
printType
{ "repo_name": "tmoskun/JSNMPWalker", "path": "lib/mibble-2.9.3/src/java/net/percederberg/mibble/MibWriter.java", "license": "gpl-3.0", "size": 37984 }
[ "net.percederberg.mibble.snmp.SnmpObjectIdentity" ]
import net.percederberg.mibble.snmp.SnmpObjectIdentity;
import net.percederberg.mibble.snmp.*;
[ "net.percederberg.mibble" ]
net.percederberg.mibble;
2,552,393
public static SimplePersonWithBuilderFinal.Builder builder() { return new SimplePersonWithBuilderFinal.Builder(); } private SimplePersonWithBuilderFinal(SimplePersonWithBuilderFinal.Builder builder) { JodaBeanUtils.notNull(builder.surname, "surname"); JodaBeanUtils.notNull(builder.addressList, "addressList"); JodaBeanUtils.notNull(builder.otherAddressMap, "otherAddressMap"); JodaBeanUtils.notNull(builder.addressesList, "addressesList"); this.forename = builder.forename; this.surname = builder.surname; this.numberOfCars = builder.numberOfCars; this.addressList.addAll(builder.addressList); this.otherAddressMap.putAll(builder.otherAddressMap); this.addressesList.addAll(builder.addressesList); this.mainAddress = builder.mainAddress; this.tags = builder.tags; }
static SimplePersonWithBuilderFinal.Builder function() { return new SimplePersonWithBuilderFinal.Builder(); } SimplePersonWithBuilderFinal(SimplePersonWithBuilderFinal.Builder function) { JodaBeanUtils.notNull(builder.surname, STR); JodaBeanUtils.notNull(builder.addressList, STR); JodaBeanUtils.notNull(builder.otherAddressMap, STR); JodaBeanUtils.notNull(builder.addressesList, STR); this.forename = builder.forename; this.surname = builder.surname; this.numberOfCars = builder.numberOfCars; this.addressList.addAll(builder.addressList); this.otherAddressMap.putAll(builder.otherAddressMap); this.addressesList.addAll(builder.addressesList); this.mainAddress = builder.mainAddress; this.tags = builder.tags; }
/** * Returns a builder used to create an instance of the bean. * @return the builder, not null */
Returns a builder used to create an instance of the bean
builder
{ "repo_name": "BIORIMP/biorimp", "path": "BIO-RIMP/test_data/code/joda/src/test/java/org/joda/beans/gen/SimplePersonWithBuilderFinal.java", "license": "gpl-2.0", "size": 32338 }
[ "org.joda.beans.JodaBeanUtils" ]
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
902,869
void enterOuterJoinIdentPair(@NotNull EsperEPL2GrammarParser.OuterJoinIdentPairContext ctx); void exitOuterJoinIdentPair(@NotNull EsperEPL2GrammarParser.OuterJoinIdentPairContext ctx);
void enterOuterJoinIdentPair(@NotNull EsperEPL2GrammarParser.OuterJoinIdentPairContext ctx); void exitOuterJoinIdentPair(@NotNull EsperEPL2GrammarParser.OuterJoinIdentPairContext ctx);
/** * Exit a parse tree produced by {@link EsperEPL2GrammarParser#outerJoinIdentPair}. * @param ctx the parse tree */
Exit a parse tree produced by <code>EsperEPL2GrammarParser#outerJoinIdentPair</code>
exitOuterJoinIdentPair
{ "repo_name": "georgenicoll/esper", "path": "esper/src/main/java/com/espertech/esper/epl/generated/EsperEPL2GrammarListener.java", "license": "gpl-2.0", "size": 114105 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,637,018
public void disableCamera(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { boolean camFunc = operation.isEnabled(); operation.setStatus(resources.getString(R.string.operation_value_completed)); resultBuilder.build(operation); devicePolicyManager.setCameraDisabled(cdmDeviceAdmin, !camFunc); if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, "Camera enabled: " + camFunc); } }
void function(org.wso2.emm.agent.beans.Operation operation) throws AndroidAgentException { boolean camFunc = operation.isEnabled(); operation.setStatus(resources.getString(R.string.operation_value_completed)); resultBuilder.build(operation); devicePolicyManager.setCameraDisabled(cdmDeviceAdmin, !camFunc); if (Constants.DEBUG_MODE_ENABLED) { Log.d(TAG, STR + camFunc); } }
/** * Disable/Enable device camera. * * @param operation - Operation object. */
Disable/Enable device camera
disableCamera
{ "repo_name": "charithag/product-emm", "path": "modules/mobile-agents/android/client/client/src/main/java/org/wso2/emm/agent/services/operation/OperationManager.java", "license": "apache-2.0", "size": 46390 }
[ "android.util.Log", "org.wso2.emm.agent.AndroidAgentException", "org.wso2.emm.agent.beans.Operation", "org.wso2.emm.agent.utils.Constants" ]
import android.util.Log; import org.wso2.emm.agent.AndroidAgentException; import org.wso2.emm.agent.beans.Operation; import org.wso2.emm.agent.utils.Constants;
import android.util.*; import org.wso2.emm.agent.*; import org.wso2.emm.agent.beans.*; import org.wso2.emm.agent.utils.*;
[ "android.util", "org.wso2.emm" ]
android.util; org.wso2.emm;
554,310
@Override public void add(HTableDescriptor htd) throws IOException { if (fsreadonly) { throw new NotImplementedException("Cannot add a table descriptor - in read only mode"); } TableName tableName = htd.getTableName(); if (TableName.META_TABLE_NAME.equals(tableName)) { throw new NotImplementedException(); } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tableName.getNameAsString())) { throw new NotImplementedException( "Cannot add a table descriptor for a reserved subdirectory name: " + htd.getNameAsString()); } updateTableDescriptor(htd); }
void function(HTableDescriptor htd) throws IOException { if (fsreadonly) { throw new NotImplementedException(STR); } TableName tableName = htd.getTableName(); if (TableName.META_TABLE_NAME.equals(tableName)) { throw new NotImplementedException(); } if (HConstants.HBASE_NON_USER_TABLE_DIRS.contains(tableName.getNameAsString())) { throw new NotImplementedException( STR + htd.getNameAsString()); } updateTableDescriptor(htd); }
/** * Adds (or updates) the table descriptor to the FileSystem * and updates the local cache with it. */
Adds (or updates) the table descriptor to the FileSystem and updates the local cache with it
add
{ "repo_name": "gustavoanatoly/hbase", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSTableDescriptors.java", "license": "apache-2.0", "size": 31179 }
[ "java.io.IOException", "org.apache.commons.lang.NotImplementedException", "org.apache.hadoop.hbase.HConstants", "org.apache.hadoop.hbase.HTableDescriptor", "org.apache.hadoop.hbase.TableName" ]
import java.io.IOException; import org.apache.commons.lang.NotImplementedException; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.TableName;
import java.io.*; import org.apache.commons.lang.*; import org.apache.hadoop.hbase.*;
[ "java.io", "org.apache.commons", "org.apache.hadoop" ]
java.io; org.apache.commons; org.apache.hadoop;
2,304,313
ByteSizeValue indexingBufferSize() { return indexingBuffer; }
ByteSizeValue indexingBufferSize() { return indexingBuffer; }
/** * returns the current budget for the total amount of indexing buffers of * active shards on this node */
returns the current budget for the total amount of indexing buffers of active shards on this node
indexingBufferSize
{ "repo_name": "wuranbo/elasticsearch", "path": "core/src/main/java/org/elasticsearch/indices/IndexingMemoryController.java", "license": "apache-2.0", "size": 18942 }
[ "org.elasticsearch.common.unit.ByteSizeValue" ]
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,913,527
public Object clone() { Tune ret = null; try { //long s = System.currentTimeMillis(); // Write the object out to a byte array FastByteArrayOutputStream fbos = new FastByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(fbos); out.writeObject(this); out.flush(); out.close(); // Retrieve an input stream from the byte array and read // a copy of the object back in. ObjectInputStream in = new ObjectInputStream(fbos.getInputStream()); ret = (Tune) in.readObject(); //long e = System.currentTimeMillis(); //System.out.println("Tune.clone: "+fbos.getSize()+" en "+((e-s)/1000.0)+"s"); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } return ret; } private class FastByteArrayInputStream extends InputStream { protected byte[] buf = null; protected int count = 0; protected int pos = 0; public FastByteArrayInputStream(byte[] buf, int count) { this.buf = buf; this.count = count; }
Object function() { Tune ret = null; try { FastByteArrayOutputStream fbos = new FastByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(fbos); out.writeObject(this); out.flush(); out.close(); ObjectInputStream in = new ObjectInputStream(fbos.getInputStream()); ret = (Tune) in.readObject(); } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException cnfe) { cnfe.printStackTrace(); } return ret; } private class FastByteArrayInputStream extends InputStream { protected byte[] buf = null; protected int count = 0; protected int pos = 0; public FastByteArrayInputStream(byte[] buf, int count) { this.buf = buf; this.count = count; }
/** * Returns a deep clone of the Tune object */
Returns a deep clone of the Tune object
clone
{ "repo_name": "Sciss/abc4j", "path": "abc/src/main/java/abc/notation/Tune.java", "license": "lgpl-3.0", "size": 32422 }
[ "java.io.IOException", "java.io.InputStream", "java.io.ObjectInputStream", "java.io.ObjectOutputStream" ]
import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,451,057
public Set<MediaType> getProducibleMediaTypes() { Set<MediaType> result = new LinkedHashSet<MediaType>(); for (ProduceMediaTypeExpression expression : this.expressions) { if (!expression.isNegated()) { result.add(expression.getMediaType()); } } return result; }
Set<MediaType> function() { Set<MediaType> result = new LinkedHashSet<MediaType>(); for (ProduceMediaTypeExpression expression : this.expressions) { if (!expression.isNegated()) { result.add(expression.getMediaType()); } } return result; }
/** * Return the contained producible media types excluding negated expressions. */
Return the contained producible media types excluding negated expressions
getProducibleMediaTypes
{ "repo_name": "deathspeeder/class-guard", "path": "spring-framework-3.2.x/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/condition/ProducesRequestCondition.java", "license": "gpl-2.0", "size": 11454 }
[ "java.util.LinkedHashSet", "java.util.Set", "org.springframework.http.MediaType" ]
import java.util.LinkedHashSet; import java.util.Set; import org.springframework.http.MediaType;
import java.util.*; import org.springframework.http.*;
[ "java.util", "org.springframework.http" ]
java.util; org.springframework.http;
281,595
public void printGeneration(int nofgeneration, AbstractIndividual<INeuralNet> bestNnind, AbstractIndividual<INeuralNet> bestCCRNnind, ParametricMutator<NeuralNetIndividual> parametricMutator, IEvaluator evaluator) { System.out.println(renderGeneration(nofgeneration, bestNnind, bestCCRNnind, parametricMutator, evaluator)); } ///////////////////////////////////////////////////////////////// // -------------------------------------------- Protected Methods /////////////////////////////////////////////////////////////////
void function(int nofgeneration, AbstractIndividual<INeuralNet> bestNnind, AbstractIndividual<INeuralNet> bestCCRNnind, ParametricMutator<NeuralNetIndividual> parametricMutator, IEvaluator evaluator) { System.out.println(renderGeneration(nofgeneration, bestNnind, bestCCRNnind, parametricMutator, evaluator)); }
/** * <p> * Outputs the information of a generation to System.out * * @param nofgeneration Number of generation of the algorithm * @param bestNnind Best NeuralNetIndividual of the algorithm * @param bestCCRNnind Best CCR NeuralNetIndividual of the algorithm (if it is a Classification problem) * @param parametricMutator ParametricMutator of the algorithm * @param evaluator NeuralNetEvaluator to use in individual evaluation * </p> */
Outputs the information of a generation to System.out
printGeneration
{ "repo_name": "TheMurderer/keel", "path": "src/keel/Algorithms/Neural_Networks/NNEP_Clas/listener/NeuralNetReporterClas.java", "license": "gpl-3.0", "size": 15970 }
[ "net.sf.jclec.IEvaluator", "net.sf.jclec.base.AbstractIndividual" ]
import net.sf.jclec.IEvaluator; import net.sf.jclec.base.AbstractIndividual;
import net.sf.jclec.*; import net.sf.jclec.base.*;
[ "net.sf.jclec" ]
net.sf.jclec;
597,649
@Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL(DROP_DETAIL_TABLE); onCreate(db); }
void function(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL(DROP_DETAIL_TABLE); onCreate(db); }
/** * Handles the on upgrade of the sql lite helper. * * @param db database * @param oldVersion of the old database * @param newVersion of the new databases */
Handles the on upgrade of the sql lite helper
onUpgrade
{ "repo_name": "VictorTellez/PointsOfInterest", "path": "app/src/main/java/com/apps/poi/models/helper/DBDetailHelper.java", "license": "cc0-1.0", "size": 5417 }
[ "android.database.sqlite.SQLiteDatabase" ]
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.*;
[ "android.database" ]
android.database;
2,792,828
private Type mapTokenToType(int index, String token) { Type type = columnTypePrototypes.get(index); if (type instanceof Real) { return Real.valueOf(Double.parseDouble(token)); } if (type instanceof StringType) { return new StringType(token); } //If none of the above, has to be a nominal attribute. HashMap<String, Integer> nominalMap = this.columnToNominalAttributesMap.get(index); return Int.valueOf(nominalMap.get(token)); }
Type function(int index, String token) { Type type = columnTypePrototypes.get(index); if (type instanceof Real) { return Real.valueOf(Double.parseDouble(token)); } if (type instanceof StringType) { return new StringType(token); } HashMap<String, Integer> nominalMap = this.columnToNominalAttributesMap.get(index); return Int.valueOf(nominalMap.get(token)); }
/** * Puts a token into a new object of the correct CIlib type. * @param index the index of the token in the row (its column). * @param token the token to be typed. * @return a new CIlib object of the correct type. */
Puts a token into a new object of the correct CIlib type
mapTokenToType
{ "repo_name": "filinep/cilib", "path": "library/src/main/java/net/sourceforge/cilib/io/ARFFFileReader.java", "license": "gpl-3.0", "size": 9797 }
[ "java.util.HashMap", "net.sourceforge.cilib.type.types.Int", "net.sourceforge.cilib.type.types.Real", "net.sourceforge.cilib.type.types.StringType", "net.sourceforge.cilib.type.types.Type" ]
import java.util.HashMap; import net.sourceforge.cilib.type.types.Int; import net.sourceforge.cilib.type.types.Real; import net.sourceforge.cilib.type.types.StringType; import net.sourceforge.cilib.type.types.Type;
import java.util.*; import net.sourceforge.cilib.type.types.*;
[ "java.util", "net.sourceforge.cilib" ]
java.util; net.sourceforge.cilib;
2,229,869
public void writeDoubles(double[] array) throws IOException { this.writeDoubles(array, 0, array.length); }
void function(double[] array) throws IOException { this.writeDoubles(array, 0, array.length); }
/** * Writes an array of <code>double</code> values to the underlying stream. * @param array The array of <code>double</code> values to write. * @throws IOException if writing to the underlying stream fails. */
Writes an array of <code>double</code> values to the underlying stream
writeDoubles
{ "repo_name": "bwkimmel/jmist", "path": "jmist-core/src/main/java/ca/eandb/jmist/util/matlab/MatlabOutputStream.java", "license": "mit", "size": 59813 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,253,805
private void extract(Document doc) { // get name NodeList nodes = doc.getElementsByTagName("champion"); this.champ.getSpells().setName(((Element) nodes.item(0)).getElementsByTagName("name").item(0).getTextContent()); // spells // // passive nodes = doc.getElementsByTagName("passive"); Element passive = (Element) nodes.item(0); this.champ.getSpells().setPassive(passive.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setPassiveDescr(passive.getElementsByTagName("description").item(0).getTextContent()); // // spell 1 nodes = doc.getElementsByTagName("spell1"); Element spell1 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell1(spell1.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastSpell1(spell1.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastSpell1(spell1.getAttribute("selfcast").equals("1")); this.champ.getSpells().setSpell1(spell1.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell1Descr(spell1.getElementsByTagName("description").item(0).getTextContent()); // // spell 2 nodes = doc.getElementsByTagName("spell2"); Element spell2 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell2(spell2.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastSpell2(spell2.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastSpell2(spell2.getAttribute("selfcast").equals("1")); this.champ.getSpells().setSpell2(spell2.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell2Descr(spell2.getElementsByTagName("description").item(0).getTextContent()); // // spell 3 nodes = doc.getElementsByTagName("spell3"); Element spell3 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell3(spell3.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastSpell3(spell3.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastSpell3(spell3.getAttribute("selfcast").equals("1")); this.champ.getSpells().setSpell3(spell3.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell3Descr(spell3.getElementsByTagName("description").item(0).getTextContent()); // // spell 4 nodes = doc.getElementsByTagName("spell4"); Element spell4 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell4(spell4.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastSpell4(spell4.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastSpell4(spell4.getAttribute("selfcast").equals("1")); this.champ.getSpells().setSpell4(spell4.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell4Descr(spell4.getElementsByTagName("description").item(0).getTextContent()); // // summoner spell 1 nodes = doc.getElementsByTagName("summonerSpell1"); Element summonerSpell1 = (Element) nodes.item(0); this.champ.getHotkeys().setSummonerSpell1(summonerSpell1.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastSummonerSpell1(summonerSpell1.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastSummonerSpell1(summonerSpell1.getAttribute("selfcast").equals("1")); this.champ.getSpells().setSummonerSpell1(summonerSpell1.getTextContent()); // // summoner spell 2 nodes = doc.getElementsByTagName("summonerSpell2"); Element summonerSpell2 = (Element) nodes.item(0); this.champ.getHotkeys().setSummonerSpell2(summonerSpell2.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastSummonerSpell2(summonerSpell2.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastSummonerSpell2(summonerSpell2.getAttribute("selfcast").equals("1")); this.champ.getSpells().setSummonerSpell2(summonerSpell2.getTextContent()); // items // // item1 nodes = doc.getElementsByTagName("item1"); Element item1 = (Element) nodes.item(0); this.champ.getHotkeys().setItem1(item1.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastItem1(item1.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastItem1(item1.getAttribute("selfcast").equals("1")); // // item2 nodes = doc.getElementsByTagName("item2"); Element item2 = (Element) nodes.item(0); this.champ.getHotkeys().setItem2(item2.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastItem2(item2.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastItem2(item2.getAttribute("selfcast").equals("1")); // // item3 nodes = doc.getElementsByTagName("item3"); Element item3 = (Element) nodes.item(0); this.champ.getHotkeys().setItem3(item3.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastItem3(item3.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastItem3(item3.getAttribute("selfcast").equals("1")); // // item4 nodes = doc.getElementsByTagName("item4"); Element item4 = (Element) nodes.item(0); this.champ.getHotkeys().setItem4(item4.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastItem4(item4.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastItem4(item4.getAttribute("selfcast").equals("1")); // // item5 nodes = doc.getElementsByTagName("item5"); Element item5 = (Element) nodes.item(0); this.champ.getHotkeys().setItem5(item5.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastItem5(item5.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastItem5(item5.getAttribute("selfcast").equals("1")); // // item6 nodes = doc.getElementsByTagName("item6"); Element item6 = (Element) nodes.item(0); this.champ.getHotkeys().setItem6(item6.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastItem6(item6.getAttribute("smartcast").equals("1")); this.champ.getHotkeys().setSelfcastItem6(item6.getAttribute("selfcast").equals("1")); // // trinket nodes = doc.getElementsByTagName("trinket"); Element trinket = (Element) nodes.item(0); this.champ.getHotkeys().setTrinket(trinket.getAttribute("hotkey")); this.champ.getHotkeys().setSmartcastTrinket(trinket.getAttribute("smartcast").equals("1")); // range indicator nodes = doc.getElementsByTagName("rangeindicator"); Element rangeIndicator = (Element) nodes.item(0); this.champ.getHotkeys().setShowRangeIndicator(rangeIndicator.getTextContent().equals("1")); }
void function(Document doc) { NodeList nodes = doc.getElementsByTagName(STR); this.champ.getSpells().setName(((Element) nodes.item(0)).getElementsByTagName("name").item(0).getTextContent()); nodes = doc.getElementsByTagName(STR); Element passive = (Element) nodes.item(0); this.champ.getSpells().setPassive(passive.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setPassiveDescr(passive.getElementsByTagName(STR).item(0).getTextContent()); nodes = doc.getElementsByTagName(STR); Element spell1 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell1(spell1.getAttribute(STR)); this.champ.getHotkeys().setSmartcastSpell1(spell1.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastSpell1(spell1.getAttribute(STR).equals("1")); this.champ.getSpells().setSpell1(spell1.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell1Descr(spell1.getElementsByTagName(STR).item(0).getTextContent()); nodes = doc.getElementsByTagName(STR); Element spell2 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell2(spell2.getAttribute(STR)); this.champ.getHotkeys().setSmartcastSpell2(spell2.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastSpell2(spell2.getAttribute(STR).equals("1")); this.champ.getSpells().setSpell2(spell2.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell2Descr(spell2.getElementsByTagName(STR).item(0).getTextContent()); nodes = doc.getElementsByTagName(STR); Element spell3 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell3(spell3.getAttribute(STR)); this.champ.getHotkeys().setSmartcastSpell3(spell3.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastSpell3(spell3.getAttribute(STR).equals("1")); this.champ.getSpells().setSpell3(spell3.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell3Descr(spell3.getElementsByTagName(STR).item(0).getTextContent()); nodes = doc.getElementsByTagName(STR); Element spell4 = (Element) nodes.item(0); this.champ.getHotkeys().setSpell4(spell4.getAttribute(STR)); this.champ.getHotkeys().setSmartcastSpell4(spell4.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastSpell4(spell4.getAttribute(STR).equals("1")); this.champ.getSpells().setSpell4(spell4.getElementsByTagName("name").item(0).getTextContent()); this.champ.getSpells().setSpell4Descr(spell4.getElementsByTagName(STR).item(0).getTextContent()); nodes = doc.getElementsByTagName(STR); Element summonerSpell1 = (Element) nodes.item(0); this.champ.getHotkeys().setSummonerSpell1(summonerSpell1.getAttribute(STR)); this.champ.getHotkeys().setSmartcastSummonerSpell1(summonerSpell1.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastSummonerSpell1(summonerSpell1.getAttribute(STR).equals("1")); this.champ.getSpells().setSummonerSpell1(summonerSpell1.getTextContent()); nodes = doc.getElementsByTagName(STR); Element summonerSpell2 = (Element) nodes.item(0); this.champ.getHotkeys().setSummonerSpell2(summonerSpell2.getAttribute(STR)); this.champ.getHotkeys().setSmartcastSummonerSpell2(summonerSpell2.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastSummonerSpell2(summonerSpell2.getAttribute(STR).equals("1")); this.champ.getSpells().setSummonerSpell2(summonerSpell2.getTextContent()); nodes = doc.getElementsByTagName("item1"); Element item1 = (Element) nodes.item(0); this.champ.getHotkeys().setItem1(item1.getAttribute(STR)); this.champ.getHotkeys().setSmartcastItem1(item1.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastItem1(item1.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName("item2"); Element item2 = (Element) nodes.item(0); this.champ.getHotkeys().setItem2(item2.getAttribute(STR)); this.champ.getHotkeys().setSmartcastItem2(item2.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastItem2(item2.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName("item3"); Element item3 = (Element) nodes.item(0); this.champ.getHotkeys().setItem3(item3.getAttribute(STR)); this.champ.getHotkeys().setSmartcastItem3(item3.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastItem3(item3.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName("item4"); Element item4 = (Element) nodes.item(0); this.champ.getHotkeys().setItem4(item4.getAttribute(STR)); this.champ.getHotkeys().setSmartcastItem4(item4.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastItem4(item4.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName("item5"); Element item5 = (Element) nodes.item(0); this.champ.getHotkeys().setItem5(item5.getAttribute(STR)); this.champ.getHotkeys().setSmartcastItem5(item5.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastItem5(item5.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName("item6"); Element item6 = (Element) nodes.item(0); this.champ.getHotkeys().setItem6(item6.getAttribute(STR)); this.champ.getHotkeys().setSmartcastItem6(item6.getAttribute(STR).equals("1")); this.champ.getHotkeys().setSelfcastItem6(item6.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName(STR); Element trinket = (Element) nodes.item(0); this.champ.getHotkeys().setTrinket(trinket.getAttribute(STR)); this.champ.getHotkeys().setSmartcastTrinket(trinket.getAttribute(STR).equals("1")); nodes = doc.getElementsByTagName(STR); Element rangeIndicator = (Element) nodes.item(0); this.champ.getHotkeys().setShowRangeIndicator(rangeIndicator.getTextContent().equals("1")); }
/** * extracs all neccessary information of the given document * * @param doc * given document */
extracs all neccessary information of the given document
extract
{ "repo_name": "cf86/LoLToolKit", "path": "src/main/java/model/parser/ChampionXMLParser.java", "license": "gpl-3.0", "size": 8970 }
[ "org.w3c.dom.Document", "org.w3c.dom.Element", "org.w3c.dom.NodeList" ]
import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,119,307
public void setRawObject(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) { }
void function(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) { }
/** * Sets the raw JSON object * * @param serializer the serializer * @param json the JSON object to set this object to */
Sets the raw JSON object
setRawObject
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/models/WindowsUniversalAppX.java", "license": "mit", "size": 3679 }
[ "com.google.gson.JsonObject", "com.microsoft.graph.serializer.ISerializer", "javax.annotation.Nonnull" ]
import com.google.gson.JsonObject; import com.microsoft.graph.serializer.ISerializer; import javax.annotation.Nonnull;
import com.google.gson.*; import com.microsoft.graph.serializer.*; import javax.annotation.*;
[ "com.google.gson", "com.microsoft.graph", "javax.annotation" ]
com.google.gson; com.microsoft.graph; javax.annotation;
480,086
public Observable<ServiceResponse<VirtualHubInner>> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (virtualHubName == null) { throw new IllegalArgumentException("Parameter virtualHubName is required and cannot be null."); } if (virtualHubParameters == null) { throw new IllegalArgumentException("Parameter virtualHubParameters is required and cannot be null."); }
Observable<ServiceResponse<VirtualHubInner>> function(String resourceGroupName, String virtualHubName, VirtualHubInner virtualHubParameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (virtualHubName == null) { throw new IllegalArgumentException(STR); } if (virtualHubParameters == null) { throw new IllegalArgumentException(STR); }
/** * Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. * * @param resourceGroupName The resource group name of the VirtualHub. * @param virtualHubName The name of the VirtualHub. * @param virtualHubParameters Parameters supplied to create or update VirtualHub. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the VirtualHubInner object */
Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub
beginCreateOrUpdateWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/network/v2019_06_01/implementation/VirtualHubsInner.java", "license": "mit", "size": 72294 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,369,952
protected SqlNode performUnconditionalRewrites(SqlNode node, boolean underFrom) { if (node == null) { return null; } SqlNode newOperand; // first transform operands and invoke generic call rewrite if (node instanceof SqlCall) { if (node instanceof SqlMerge) { validatingSqlMerge = true; } SqlCall call = (SqlCall) node; final SqlKind kind = call.getKind(); final List<SqlNode> operands = call.getOperandList(); for (int i = 0; i < operands.size(); i++) { SqlNode operand = operands.get(i); boolean childUnderFrom; if (kind == SqlKind.SELECT) { childUnderFrom = i == SqlSelect.FROM_OPERAND; } else if (kind == SqlKind.AS && (i == 0)) { // for an aliased expression, it is under FROM if // the AS expression is under FROM childUnderFrom = underFrom; } else { childUnderFrom = false; } newOperand = performUnconditionalRewrites(operand, childUnderFrom); if (newOperand != null && newOperand != operand) { call.setOperand(i, newOperand); } } if (call.getOperator() instanceof SqlUnresolvedFunction) { assert call instanceof SqlBasicCall; final SqlUnresolvedFunction function = (SqlUnresolvedFunction) call.getOperator(); // This function hasn't been resolved yet. Perform // a half-hearted resolution now in case it's a // builtin function requiring special casing. If it's // not, we'll handle it later during overload resolution. final List<SqlOperator> overloads = new ArrayList<>(); opTab.lookupOperatorOverloads( function.getNameAsId(), function.getFunctionType(), SqlSyntax.FUNCTION, overloads, catalogReader.nameMatcher()); if (overloads.size() == 1) { ((SqlBasicCall) call).setOperator(overloads.get(0)); } } if (config.callRewrite()) { node = call.getOperator().rewriteCall(this, call); } } else if (node instanceof SqlNodeList) { SqlNodeList list = (SqlNodeList) node; for (int i = 0, count = list.size(); i < count; i++) { SqlNode operand = list.get(i); newOperand = performUnconditionalRewrites(operand, false); if (newOperand != null) { list.getList().set(i, newOperand); } } } // now transform node itself final SqlKind kind = node.getKind(); switch (kind) { case VALUES: // CHECKSTYLE: IGNORE 1 if (underFrom || true) { // leave FROM (VALUES(...)) [ AS alias ] clauses alone, // otherwise they grow cancerously if this rewrite is invoked // over and over return node; } else { final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); return new SqlSelect( node.getParserPosition(), null, selectList, node, null, null, null, null, null, null, null, null); } case ORDER_BY: { SqlOrderBy orderBy = (SqlOrderBy) node; handleOffsetFetch(orderBy.offset, orderBy.fetch); if (orderBy.query instanceof SqlSelect) { SqlSelect select = (SqlSelect) orderBy.query; // Don't clobber existing ORDER BY. It may be needed for // an order-sensitive function like RANK. if (select.getOrderList() == null) { // push ORDER BY into existing select select.setOrderBy(orderBy.orderList); select.setOffset(orderBy.offset); select.setFetch(orderBy.fetch); return select; } } if (orderBy.query instanceof SqlWith && ((SqlWith) orderBy.query).body instanceof SqlSelect) { SqlWith with = (SqlWith) orderBy.query; SqlSelect select = (SqlSelect) with.body; // Don't clobber existing ORDER BY. It may be needed for // an order-sensitive function like RANK. if (select.getOrderList() == null) { // push ORDER BY into existing select select.setOrderBy(orderBy.orderList); select.setOffset(orderBy.offset); select.setFetch(orderBy.fetch); return with; } } final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); final SqlNodeList orderList; if (getInnerSelect(node) != null && isAggregate(getInnerSelect(node))) { orderList = SqlNode.clone(orderBy.orderList); // We assume that ORDER BY item does not have ASC etc. // We assume that ORDER BY item is present in SELECT list. for (int i = 0; i < orderList.size(); i++) { SqlNode sqlNode = orderList.get(i); SqlNodeList selectList2 = getInnerSelect(node).getSelectList(); for (Ord<SqlNode> sel : Ord.zip(selectList2)) { if (stripAs(sel.e).equalsDeep(sqlNode, Litmus.IGNORE)) { orderList.set( i, SqlLiteral.createExactNumeric( Integer.toString(sel.i + 1), SqlParserPos.ZERO)); } } } } else { orderList = orderBy.orderList; } return new SqlSelect( SqlParserPos.ZERO, null, selectList, orderBy.query, null, null, null, null, orderList, orderBy.offset, orderBy.fetch, null); } case EXPLICIT_TABLE: { // (TABLE t) is equivalent to (SELECT * FROM t) SqlCall call = (SqlCall) node; final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); return new SqlSelect( SqlParserPos.ZERO, null, selectList, call.operand(0), null, null, null, null, null, null, null, null); } case DELETE: { SqlDelete call = (SqlDelete) node; SqlSelect select = createSourceSelectForDelete(call); call.setSourceSelect(select); break; } case UPDATE: { SqlUpdate call = (SqlUpdate) node; SqlSelect select = createSourceSelectForUpdate(call); call.setSourceSelect(select); // See if we're supposed to rewrite UPDATE to MERGE // (unless this is the UPDATE clause of a MERGE, // in which case leave it alone). if (!validatingSqlMerge) { SqlNode selfJoinSrcExpr = getSelfJoinExprForUpdate(call.getTargetTable(), UPDATE_SRC_ALIAS); if (selfJoinSrcExpr != null) { node = rewriteUpdateToMerge(call, selfJoinSrcExpr); } } break; } case MERGE: { SqlMerge call = (SqlMerge) node; rewriteMerge(call); break; } } return node; }
SqlNode function(SqlNode node, boolean underFrom) { if (node == null) { return null; } SqlNode newOperand; if (node instanceof SqlCall) { if (node instanceof SqlMerge) { validatingSqlMerge = true; } SqlCall call = (SqlCall) node; final SqlKind kind = call.getKind(); final List<SqlNode> operands = call.getOperandList(); for (int i = 0; i < operands.size(); i++) { SqlNode operand = operands.get(i); boolean childUnderFrom; if (kind == SqlKind.SELECT) { childUnderFrom = i == SqlSelect.FROM_OPERAND; } else if (kind == SqlKind.AS && (i == 0)) { childUnderFrom = underFrom; } else { childUnderFrom = false; } newOperand = performUnconditionalRewrites(operand, childUnderFrom); if (newOperand != null && newOperand != operand) { call.setOperand(i, newOperand); } } if (call.getOperator() instanceof SqlUnresolvedFunction) { assert call instanceof SqlBasicCall; final SqlUnresolvedFunction function = (SqlUnresolvedFunction) call.getOperator(); final List<SqlOperator> overloads = new ArrayList<>(); opTab.lookupOperatorOverloads( function.getNameAsId(), function.getFunctionType(), SqlSyntax.FUNCTION, overloads, catalogReader.nameMatcher()); if (overloads.size() == 1) { ((SqlBasicCall) call).setOperator(overloads.get(0)); } } if (config.callRewrite()) { node = call.getOperator().rewriteCall(this, call); } } else if (node instanceof SqlNodeList) { SqlNodeList list = (SqlNodeList) node; for (int i = 0, count = list.size(); i < count; i++) { SqlNode operand = list.get(i); newOperand = performUnconditionalRewrites(operand, false); if (newOperand != null) { list.getList().set(i, newOperand); } } } final SqlKind kind = node.getKind(); switch (kind) { case VALUES: if (underFrom true) { return node; } else { final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); return new SqlSelect( node.getParserPosition(), null, selectList, node, null, null, null, null, null, null, null, null); } case ORDER_BY: { SqlOrderBy orderBy = (SqlOrderBy) node; handleOffsetFetch(orderBy.offset, orderBy.fetch); if (orderBy.query instanceof SqlSelect) { SqlSelect select = (SqlSelect) orderBy.query; if (select.getOrderList() == null) { select.setOrderBy(orderBy.orderList); select.setOffset(orderBy.offset); select.setFetch(orderBy.fetch); return select; } } if (orderBy.query instanceof SqlWith && ((SqlWith) orderBy.query).body instanceof SqlSelect) { SqlWith with = (SqlWith) orderBy.query; SqlSelect select = (SqlSelect) with.body; if (select.getOrderList() == null) { select.setOrderBy(orderBy.orderList); select.setOffset(orderBy.offset); select.setFetch(orderBy.fetch); return with; } } final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); final SqlNodeList orderList; if (getInnerSelect(node) != null && isAggregate(getInnerSelect(node))) { orderList = SqlNode.clone(orderBy.orderList); for (int i = 0; i < orderList.size(); i++) { SqlNode sqlNode = orderList.get(i); SqlNodeList selectList2 = getInnerSelect(node).getSelectList(); for (Ord<SqlNode> sel : Ord.zip(selectList2)) { if (stripAs(sel.e).equalsDeep(sqlNode, Litmus.IGNORE)) { orderList.set( i, SqlLiteral.createExactNumeric( Integer.toString(sel.i + 1), SqlParserPos.ZERO)); } } } } else { orderList = orderBy.orderList; } return new SqlSelect( SqlParserPos.ZERO, null, selectList, orderBy.query, null, null, null, null, orderList, orderBy.offset, orderBy.fetch, null); } case EXPLICIT_TABLE: { SqlCall call = (SqlCall) node; final SqlNodeList selectList = new SqlNodeList(SqlParserPos.ZERO); selectList.add(SqlIdentifier.star(SqlParserPos.ZERO)); return new SqlSelect( SqlParserPos.ZERO, null, selectList, call.operand(0), null, null, null, null, null, null, null, null); } case DELETE: { SqlDelete call = (SqlDelete) node; SqlSelect select = createSourceSelectForDelete(call); call.setSourceSelect(select); break; } case UPDATE: { SqlUpdate call = (SqlUpdate) node; SqlSelect select = createSourceSelectForUpdate(call); call.setSourceSelect(select); if (!validatingSqlMerge) { SqlNode selfJoinSrcExpr = getSelfJoinExprForUpdate(call.getTargetTable(), UPDATE_SRC_ALIAS); if (selfJoinSrcExpr != null) { node = rewriteUpdateToMerge(call, selfJoinSrcExpr); } } break; } case MERGE: { SqlMerge call = (SqlMerge) node; rewriteMerge(call); break; } } return node; }
/** * Performs expression rewrites which are always used unconditionally. These rewrites massage * the expression tree into a standard form so that the rest of the validation logic can be * simpler. * * @param node expression to be rewritten * @param underFrom whether node appears directly under a FROM clause * @return rewritten expression */
Performs expression rewrites which are always used unconditionally. These rewrites massage the expression tree into a standard form so that the rest of the validation logic can be simpler
performUnconditionalRewrites
{ "repo_name": "apache/flink", "path": "flink-table/flink-table-planner/src/main/java/org/apache/calcite/sql/validate/SqlValidatorImpl.java", "license": "apache-2.0", "size": 273260 }
[ "java.util.ArrayList", "java.util.List", "org.apache.calcite.linq4j.Ord", "org.apache.calcite.sql.SqlBasicCall", "org.apache.calcite.sql.SqlCall", "org.apache.calcite.sql.SqlDelete", "org.apache.calcite.sql.SqlIdentifier", "org.apache.calcite.sql.SqlKind", "org.apache.calcite.sql.SqlLiteral", "org.apache.calcite.sql.SqlMerge", "org.apache.calcite.sql.SqlNode", "org.apache.calcite.sql.SqlNodeList", "org.apache.calcite.sql.SqlOperator", "org.apache.calcite.sql.SqlOrderBy", "org.apache.calcite.sql.SqlSelect", "org.apache.calcite.sql.SqlSyntax", "org.apache.calcite.sql.SqlUnresolvedFunction", "org.apache.calcite.sql.SqlUpdate", "org.apache.calcite.sql.SqlWith", "org.apache.calcite.sql.parser.SqlParserPos", "org.apache.calcite.util.Litmus" ]
import java.util.ArrayList; import java.util.List; import org.apache.calcite.linq4j.Ord; import org.apache.calcite.sql.SqlBasicCall; import org.apache.calcite.sql.SqlCall; import org.apache.calcite.sql.SqlDelete; import org.apache.calcite.sql.SqlIdentifier; import org.apache.calcite.sql.SqlKind; import org.apache.calcite.sql.SqlLiteral; import org.apache.calcite.sql.SqlMerge; import org.apache.calcite.sql.SqlNode; import org.apache.calcite.sql.SqlNodeList; import org.apache.calcite.sql.SqlOperator; import org.apache.calcite.sql.SqlOrderBy; import org.apache.calcite.sql.SqlSelect; import org.apache.calcite.sql.SqlSyntax; import org.apache.calcite.sql.SqlUnresolvedFunction; import org.apache.calcite.sql.SqlUpdate; import org.apache.calcite.sql.SqlWith; import org.apache.calcite.sql.parser.SqlParserPos; import org.apache.calcite.util.Litmus;
import java.util.*; import org.apache.calcite.linq4j.*; import org.apache.calcite.sql.*; import org.apache.calcite.sql.parser.*; import org.apache.calcite.util.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
918,855
private static boolean hasJava8ParameterNames(Method m) { org.springframework.util.Assert.isTrue(m.getParameterTypes().length > 0, "method has no parameters"); if (EXECUTABLE_TYPE != null) { Method getParameters = ReflectionUtils.findMethod(EXECUTABLE_TYPE, "getParameters"); try { Object[] parameters = (Object[]) getParameters.invoke(m); Method isNamePresent = ReflectionUtils .findMethod(parameters[0].getClass(), "isNamePresent"); return Boolean.TRUE.equals(isNamePresent.invoke(parameters[0])); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { } } return false; }
static boolean function(Method m) { org.springframework.util.Assert.isTrue(m.getParameterTypes().length > 0, STR); if (EXECUTABLE_TYPE != null) { Method getParameters = ReflectionUtils.findMethod(EXECUTABLE_TYPE, STR); try { Object[] parameters = (Object[]) getParameters.invoke(m); Method isNamePresent = ReflectionUtils .findMethod(parameters[0].getClass(), STR); return Boolean.TRUE.equals(isNamePresent.invoke(parameters[0])); } catch (IllegalAccessException IllegalArgumentException InvocationTargetException ex) { } } return false; }
/** * For abstract (e.g. interface) methods, only Java 8 Parameter names (compiler arg * -parameters) can supply parameter names; bytecode-based strategies use local * variable declarations, of which there are none for abstract methods. * @param m * @return whether a parameter name was found * @throws IllegalArgumentException if method has no parameters */
For abstract (e.g. interface) methods, only Java 8 Parameter names (compiler arg -parameters) can supply parameter names; bytecode-based strategies use local variable declarations, of which there are none for abstract methods
hasJava8ParameterNames
{ "repo_name": "daniellavoie/spring-cloud-netflix", "path": "spring-cloud-netflix-core/src/test/java/org/springframework/cloud/netflix/feign/support/SpringMvcContractTests.java", "license": "apache-2.0", "size": 12501 }
[ "java.lang.reflect.InvocationTargetException", "java.lang.reflect.Method", "org.springframework.util.ReflectionUtils" ]
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.springframework.util.ReflectionUtils;
import java.lang.reflect.*; import org.springframework.util.*;
[ "java.lang", "org.springframework.util" ]
java.lang; org.springframework.util;
2,769,579
private FlowToken finishEndEnvironment() throws SnuggleParseException { String environmentName = advanceOverBracesAndEnvironmentName(); if (environmentName == null) { return createError(CoreErrorCode.TTEE01, startTokenIndex, position); } String lastOpenName = openEnvironmentStack.isEmpty() ? null : openEnvironmentStack.peek(); if (lastOpenName == null) { return createError(CoreErrorCode.TTEE05, startTokenIndex, position); } else if (!environmentName.equals(lastOpenName)) { return createError( CoreErrorCode.TTEE00, startTokenIndex, position, environmentName, lastOpenName); } else { openEnvironmentStack.pop(); } UserDefinedEnvironment userEnvironment = sessionContext.getUserEnvironmentMap().get(environmentName); FlowToken result = null; if (userEnvironment != null) { result = finishEndUserDefinedEnvironment(userEnvironment); } else { BuiltinEnvironment builtinEnvironment = sessionContext.getBuiltinEnvironmentByTeXName(environmentName); if (builtinEnvironment != null) { } else { result = createError(CoreErrorCode.TTEE02, startTokenIndex, position, environmentName); } } return result; }
FlowToken function() throws SnuggleParseException { String environmentName = advanceOverBracesAndEnvironmentName(); if (environmentName == null) { return createError(CoreErrorCode.TTEE01, startTokenIndex, position); } String lastOpenName = openEnvironmentStack.isEmpty() ? null : openEnvironmentStack.peek(); if (lastOpenName == null) { return createError(CoreErrorCode.TTEE05, startTokenIndex, position); } else if (!environmentName.equals(lastOpenName)) { return createError( CoreErrorCode.TTEE00, startTokenIndex, position, environmentName, lastOpenName); } else { openEnvironmentStack.pop(); } UserDefinedEnvironment userEnvironment = sessionContext.getUserEnvironmentMap().get(environmentName); FlowToken result = null; if (userEnvironment != null) { result = finishEndUserDefinedEnvironment(userEnvironment); } else { BuiltinEnvironment builtinEnvironment = sessionContext.getBuiltinEnvironmentByTeXName(environmentName); if (builtinEnvironment != null) { } else { result = createError(CoreErrorCode.TTEE02, startTokenIndex, position, environmentName); } } return result; }
/** * Handles <tt>\\end...</tt> * * <p>PRE-CONDITION: position will point to the character immediately after <tt>\\end</tt>. */
Handles \\end..
finishEndEnvironment
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-external/src/main/java/uk/ac/ed/ph/snuggletex/internal/LaTeXTokeniser.java", "license": "gpl-3.0", "size": 99213 }
[ "uk.ac.ed.ph.snuggletex.definitions.BuiltinEnvironment", "uk.ac.ed.ph.snuggletex.definitions.CoreErrorCode", "uk.ac.ed.ph.snuggletex.definitions.UserDefinedEnvironment", "uk.ac.ed.ph.snuggletex.tokens.FlowToken" ]
import uk.ac.ed.ph.snuggletex.definitions.BuiltinEnvironment; import uk.ac.ed.ph.snuggletex.definitions.CoreErrorCode; import uk.ac.ed.ph.snuggletex.definitions.UserDefinedEnvironment; import uk.ac.ed.ph.snuggletex.tokens.FlowToken;
import uk.ac.ed.ph.snuggletex.definitions.*; import uk.ac.ed.ph.snuggletex.tokens.*;
[ "uk.ac.ed" ]
uk.ac.ed;
1,551,980
private static String hitOrBeingHit(final Entity target, final boolean crit) { final StringBuilder mgs = new StringBuilder("game.actions.combat."); if (target instanceof Player) { mgs.append("been_"); } if (crit) { mgs.append("critically_"); } mgs.append("hit"); return mgs.toString(); }
static String function(final Entity target, final boolean crit) { final StringBuilder mgs = new StringBuilder(STR); if (target instanceof Player) { mgs.append("been_"); } if (crit) { mgs.append(STR); } mgs.append("hit"); return mgs.toString(); }
/** * Message depending on who performs the action (player or mob). * * @param target * @return */
Message depending on who performs the action (player or mob)
hitOrBeingHit
{ "repo_name": "marc-/got", "path": "src/main/java/org/github/got/commands/CombatCommands.java", "license": "apache-2.0", "size": 7817 }
[ "org.github.got.Entity", "org.github.got.entity.Player" ]
import org.github.got.Entity; import org.github.got.entity.Player;
import org.github.got.*; import org.github.got.entity.*;
[ "org.github.got" ]
org.github.got;
2,840,987
// ZAP: Added accessor to the panels protected Collection<AbstractParamPanel> getPanels() { return tablePanel.values(); }
Collection<AbstractParamPanel> function() { return tablePanel.values(); }
/** * Gets the panels shown on this dialog. * * @return the panels */
Gets the panels shown on this dialog
getPanels
{ "repo_name": "GillesMoris/OSS", "path": "src/org/parosproxy/paros/view/AbstractParamContainerPanel.java", "license": "apache-2.0", "size": 27680 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,664,108
void enterMultiplicativeExpression(@NotNull ECMAScriptParser.MultiplicativeExpressionContext ctx); void exitMultiplicativeExpression(@NotNull ECMAScriptParser.MultiplicativeExpressionContext ctx);
void enterMultiplicativeExpression(@NotNull ECMAScriptParser.MultiplicativeExpressionContext ctx); void exitMultiplicativeExpression(@NotNull ECMAScriptParser.MultiplicativeExpressionContext ctx);
/** * Exit a parse tree produced by {@link ECMAScriptParser#MultiplicativeExpression}. * @param ctx the parse tree */
Exit a parse tree produced by <code>ECMAScriptParser#MultiplicativeExpression</code>
exitMultiplicativeExpression
{ "repo_name": "IsThisThePayneResidence/intellidots", "path": "src/main/java/ua/edu/hneu/ast/parsers/ECMAScriptListener.java", "license": "gpl-3.0", "size": 39591 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
44,071
public synchronized void stopService() throws SMSLibException, TimeoutException, GatewayException, IOException, InterruptedException { setServiceStatus(ServiceStatus.STOPPING); if (getQueueManager() != null) getQueueManager().stop(); if (getWatchDog() != null) { getWatchDog().cancel(); setWatchDog(null); } for (AGateway gateway : getGateways()) gateway.stopGateway(); getNotifyQueueManager().cancel(); setServiceStatus(ServiceStatus.STOPPED); }
synchronized void function() throws SMSLibException, TimeoutException, GatewayException, IOException, InterruptedException { setServiceStatus(ServiceStatus.STOPPING); if (getQueueManager() != null) getQueueManager().stop(); if (getWatchDog() != null) { getWatchDog().cancel(); setWatchDog(null); } for (AGateway gateway : getGateways()) gateway.stopGateway(); getNotifyQueueManager().cancel(); setServiceStatus(ServiceStatus.STOPPED); }
/** * Stops all gateways - does not remove them from Service's internal list. * Once stopped, all SMSLib operations will fail. You need to start the * gateways again before proceeding. * * @throws SMSLibException * No Gateways are defined. * @throws TimeoutException * The gateway did not respond in a timely manner. * @throws GatewayException * A Gateway error occurred. * @throws IOException * An IO error occurred. * @throws InterruptedException * The call was interrupted. * @see #startService() */
Stops all gateways - does not remove them from Service's internal list. Once stopped, all SMSLib operations will fail. You need to start the gateways again before proceeding
stopService
{ "repo_name": "blademainer/sms", "path": "src/main/java/org/smslib/Service.java", "license": "apache-2.0", "size": 49260 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
949,932
@Override public void run() { encryptJobMetricsTracker.onJobProcessingStart(); ByteBuffer encryptedUserMetadata = null; ByteBuffer encryptedKey = null; ByteBuf encryptedBlobContent = null; Exception exception = null; try { if (blobContentToEncrypt != null) { encryptedBlobContent = cryptoService.encrypt(blobContentToEncrypt, perBlobKey); } if (userMetadataToEncrypt != null) { encryptedUserMetadata = cryptoService.encrypt(userMetadataToEncrypt, perBlobKey); } Object containerKey = kms.getKey(putBlobOptions == null ? null : putBlobOptions.getRestRequest(), accountId, containerId); encryptedKey = cryptoService.encryptKey(perBlobKey, containerKey); } catch (Exception e) { exception = e; if (encryptedBlobContent != null) { encryptedBlobContent.release(); encryptedBlobContent = null; } } finally { if (blobContentToEncrypt != null) { blobContentToEncrypt.release(); blobContentToEncrypt = null; } encryptJobMetricsTracker.onJobProcessingComplete(); callback.onCompletion( exception == null ? new EncryptJobResult(encryptedKey, encryptedUserMetadata, encryptedBlobContent) : null, exception); } } /** * Close the job with the given {@code gse}
void function() { encryptJobMetricsTracker.onJobProcessingStart(); ByteBuffer encryptedUserMetadata = null; ByteBuffer encryptedKey = null; ByteBuf encryptedBlobContent = null; Exception exception = null; try { if (blobContentToEncrypt != null) { encryptedBlobContent = cryptoService.encrypt(blobContentToEncrypt, perBlobKey); } if (userMetadataToEncrypt != null) { encryptedUserMetadata = cryptoService.encrypt(userMetadataToEncrypt, perBlobKey); } Object containerKey = kms.getKey(putBlobOptions == null ? null : putBlobOptions.getRestRequest(), accountId, containerId); encryptedKey = cryptoService.encryptKey(perBlobKey, containerKey); } catch (Exception e) { exception = e; if (encryptedBlobContent != null) { encryptedBlobContent.release(); encryptedBlobContent = null; } } finally { if (blobContentToEncrypt != null) { blobContentToEncrypt.release(); blobContentToEncrypt = null; } encryptJobMetricsTracker.onJobProcessingComplete(); callback.onCompletion( exception == null ? new EncryptJobResult(encryptedKey, encryptedUserMetadata, encryptedBlobContent) : null, exception); } } /** * Close the job with the given {@code gse}
/** * Steps to be performed on encryption * 1. Encrypt blob content using perBlobKey if not null * 2. Encrypt user-metadata using perBlobKey if not null * 2. Fetch ContainerKey from kms for the given blob * 3. Encrypt perBlobKey using containerKey * 4. Invoke callback with the encryptedKey and encryptedBlobContent */
Steps to be performed on encryption 1. Encrypt blob content using perBlobKey if not null 2. Encrypt user-metadata using perBlobKey if not null 2. Fetch ContainerKey from kms for the given blob 3. Encrypt perBlobKey using containerKey 4. Invoke callback with the encryptedKey and encryptedBlobContent
run
{ "repo_name": "cgtz/ambry", "path": "ambry-router/src/main/java/com/github/ambry/router/EncryptJob.java", "license": "apache-2.0", "size": 5580 }
[ "io.netty.buffer.ByteBuf", "java.nio.ByteBuffer" ]
import io.netty.buffer.ByteBuf; import java.nio.ByteBuffer;
import io.netty.buffer.*; import java.nio.*;
[ "io.netty.buffer", "java.nio" ]
io.netty.buffer; java.nio;
2,880,111
private static boolean hasResponseBody(int requestMethod, int responseCode) { return requestMethod != Request.Method.HEAD && !(HTTP_CONTINUE <= responseCode && responseCode < HttpURLConnection.HTTP_OK) && responseCode != HttpURLConnection.HTTP_NO_CONTENT && responseCode != HttpURLConnection.HTTP_NOT_MODIFIED; }
static boolean function(int requestMethod, int responseCode) { return requestMethod != Request.Method.HEAD && !(HTTP_CONTINUE <= responseCode && responseCode < HttpURLConnection.HTTP_OK) && responseCode != HttpURLConnection.HTTP_NO_CONTENT && responseCode != HttpURLConnection.HTTP_NOT_MODIFIED; }
/** * Checks if a response message contains a body. * @see <a href="https://tools.ietf.org/html/rfc7230#section-3.3">RFC 7230 section 3.3</a> * @param requestMethod request method * @param responseCode response status code * @return whether the response has a body */
Checks if a response message contains a body
hasResponseBody
{ "repo_name": "adarcy/CustomView", "path": "volley/src/main/java/com/android/volley/toolbox/HurlStack.java", "license": "apache-2.0", "size": 10265 }
[ "com.android.volley.Request", "java.net.HttpURLConnection" ]
import com.android.volley.Request; import java.net.HttpURLConnection;
import com.android.volley.*; import java.net.*;
[ "com.android.volley", "java.net" ]
com.android.volley; java.net;
1,938,675
public static Instance getInstance() { return instance; } protected Instance() { // Before we can configure it: Boolean debug = checkEnv("DEBUG"); boolean trace = debug != null && debug; tracer = new TraceHandler(true, trace, trace); // config dir: configDir = getConfigDir(); if (!new File(configDir).exists()) { new File(configDir).mkdirs(); } // Most of the rest is dependent upon this: createConfigs(configDir, false); // Proxy support Proxy.use(config.getString(Config.NETWORK_PROXY)); // update tracer: if (debug == null) { debug = config.getBoolean(Config.DEBUG_ERR, false); trace = config.getBoolean(Config.DEBUG_TRACE, false); } tracer = new TraceHandler(true, debug, trace); // default Library remoteDir = new File(configDir, "remote"); lib = createDefaultLibrary(remoteDir); // create cache and TMP File tmp = getFile(Config.CACHE_DIR, configDir, "tmp"); Image.setTemporaryFilesRoot(new File(tmp.getParent(), "tmp.images")); String ua = config.getString(Config.NETWORK_USER_AGENT, ""); try { int hours = config.getInteger(Config.CACHE_MAX_TIME_CHANGING, 0); int hoursLarge = config.getInteger(Config.CACHE_MAX_TIME_STABLE, 0); cache = new DataLoader(tmp, ua, hours, hoursLarge); } catch (IOException e) { tracer.error(new IOException( "Cannot create cache (will continue without cache)", e)); cache = new DataLoader(ua); } cache.setTraceHandler(tracer); // readerTmp / coverDir readerTmp = getFile(UiConfig.CACHE_DIR_LOCAL_READER, configDir, "tmp-reader"); coverDir = getFile(Config.DEFAULT_COVERS_DIR, configDir, "covers"); coverDir.mkdirs(); try { tempFiles = new TempFiles("fanfix"); } catch (IOException e) { tracer.error( new IOException("Cannot create temporary directory", e)); } }
static Instance function() { return instance; } protected Instance() { Boolean debug = checkEnv("DEBUG"); boolean trace = debug != null && debug; tracer = new TraceHandler(true, trace, trace); configDir = getConfigDir(); if (!new File(configDir).exists()) { new File(configDir).mkdirs(); } createConfigs(configDir, false); Proxy.use(config.getString(Config.NETWORK_PROXY)); if (debug == null) { debug = config.getBoolean(Config.DEBUG_ERR, false); trace = config.getBoolean(Config.DEBUG_TRACE, false); } tracer = new TraceHandler(true, debug, trace); remoteDir = new File(configDir, STR); lib = createDefaultLibrary(remoteDir); File tmp = getFile(Config.CACHE_DIR, configDir, "tmp"); Image.setTemporaryFilesRoot(new File(tmp.getParent(), STR)); String ua = config.getString(Config.NETWORK_USER_AGENT, STRCannot create cache (will continue without cache)STRtmp-readerSTRcoversSTRfanfixSTRCannot create temporary directory", e)); } }
/** * The (mostly unique) instance of this {@link Instance}. * * @return the (mostly unique) instance */
The (mostly unique) instance of this <code>Instance</code>
getInstance
{ "repo_name": "nikiroo/fanfix", "path": "src/be/nikiroo/fanfix/Instance.java", "license": "gpl-3.0", "size": 17731 }
[ "be.nikiroo.fanfix.bundles.Config", "be.nikiroo.utils.Image", "be.nikiroo.utils.Proxy", "be.nikiroo.utils.TraceHandler", "java.io.File" ]
import be.nikiroo.fanfix.bundles.Config; import be.nikiroo.utils.Image; import be.nikiroo.utils.Proxy; import be.nikiroo.utils.TraceHandler; import java.io.File;
import be.nikiroo.fanfix.bundles.*; import be.nikiroo.utils.*; import java.io.*;
[ "be.nikiroo.fanfix", "be.nikiroo.utils", "java.io" ]
be.nikiroo.fanfix; be.nikiroo.utils; java.io;
2,810,640
public List imports() { return this.imports; } /** * Return the index in the whole comments list {@link #getCommentList() }
List function() { return this.imports; } /** * Return the index in the whole comments list {@link #getCommentList() }
/** * Returns the live list of nodes for the import declarations of this * javaScript unit, in order of appearance. * * @return the live list of import declaration nodes * (elementType: <code>ImportDeclaration</code>) */
Returns the live list of nodes for the import declarations of this javaScript unit, in order of appearance
imports
{ "repo_name": "boniatillo-com/PhaserEditor", "path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/core/dom/JavaScriptUnit.java", "license": "epl-1.0", "size": 37724 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,989,174
public List<FieldNode> getGroups() { return this.groups; }
List<FieldNode> function() { return this.groups; }
/** * Gets the group list. * * @return the group list. */
Gets the group list
getGroups
{ "repo_name": "leonhad/paradoxdriver", "path": "src/main/java/com/googlecode/paradox/parser/nodes/SelectNode.java", "license": "lgpl-3.0", "size": 8156 }
[ "com.googlecode.paradox.planner.nodes.FieldNode", "java.util.List" ]
import com.googlecode.paradox.planner.nodes.FieldNode; import java.util.List;
import com.googlecode.paradox.planner.nodes.*; import java.util.*;
[ "com.googlecode.paradox", "java.util" ]
com.googlecode.paradox; java.util;
711,258
public void run() { try { Logger.getLogger(HandlerIdleManager.class.getName()).log(Level.WARNING, null, "Protocol "+protocol.getString("protocol")+" is not responding."); } catch (Exception ex) { Logger.getLogger(HandlerIdleManager.class.getName()).log(Level.SEVERE, null, ex); } }
void function() { try { Logger.getLogger(HandlerIdleManager.class.getName()).log(Level.WARNING, null, STR+protocol.getString(STR)+STR); } catch (Exception ex) { Logger.getLogger(HandlerIdleManager.class.getName()).log(Level.SEVERE, null, ex); } }
/** * Manages how the system will react when a protocol is not responding */
Manages how the system will react when a protocol is not responding
run
{ "repo_name": "MalcolmHaslam/RunMyProcess-SEC-ProtocolManager", "path": "src/main/java/com/runmyprocess/sec/HandlerIdleManager.java", "license": "apache-2.0", "size": 1654 }
[ "java.util.logging.Level", "java.util.logging.Logger" ]
import java.util.logging.Level; import java.util.logging.Logger;
import java.util.logging.*;
[ "java.util" ]
java.util;
2,822,646
@Override public void run(Dns dns, String... args) { String zoneName = args[0]; Iterator<ChangeRequest> iterator; if (args.length > 2) { Dns.SortingOrder sortOrder = Dns.SortingOrder.valueOf(args[2].toUpperCase()); iterator = dns.listChangeRequests(zoneName, Dns.ChangeRequestListOption.sortOrder(sortOrder)) .iterateAll() .iterator(); } else { iterator = dns.listChangeRequests(zoneName).iterateAll().iterator(); } if (iterator.hasNext()) { System.out.printf("Change requests for zone %s:%n", zoneName); while (iterator.hasNext()) { ChangeRequest change = iterator.next(); System.out.printf("%nID: %s%n", change.getGeneratedId()); System.out.printf("Status: %s%n", change.status()); System.out.printf( "Started: %s%n", FORMATTER.format(Instant.ofEpochMilli(change.getStartTimeMillis()))); System.out.printf("Deletions: %s%n", Joiner.on(", ").join(change.getDeletions())); System.out.printf("Additions: %s%n", Joiner.on(", ").join(change.getAdditions())); } } else { System.out.printf("Zone %s has no change requests.%n", zoneName); } }
void function(Dns dns, String... args) { String zoneName = args[0]; Iterator<ChangeRequest> iterator; if (args.length > 2) { Dns.SortingOrder sortOrder = Dns.SortingOrder.valueOf(args[2].toUpperCase()); iterator = dns.listChangeRequests(zoneName, Dns.ChangeRequestListOption.sortOrder(sortOrder)) .iterateAll() .iterator(); } else { iterator = dns.listChangeRequests(zoneName).iterateAll().iterator(); } if (iterator.hasNext()) { System.out.printf(STR, zoneName); while (iterator.hasNext()) { ChangeRequest change = iterator.next(); System.out.printf(STR, change.getGeneratedId()); System.out.printf(STR, change.status()); System.out.printf( STR, FORMATTER.format(Instant.ofEpochMilli(change.getStartTimeMillis()))); System.out.printf(STR, Joiner.on(STR).join(change.getDeletions())); System.out.printf(STR, Joiner.on(STR).join(change.getAdditions())); } } else { System.out.printf(STR, zoneName); } }
/** * Lists all the changes for a given zone. Optionally, an order ("descending" or "ascending") * can be specified using the last parameter. */
Lists all the changes for a given zone. Optionally, an order ("descending" or "ascending") can be specified using the last parameter
run
{ "repo_name": "vam-google/google-cloud-java", "path": "google-cloud-examples/src/main/java/com/google/cloud/examples/dns/DnsExample.java", "license": "apache-2.0", "size": 17471 }
[ "com.google.cloud.dns.ChangeRequest", "com.google.cloud.dns.Dns", "com.google.common.base.Joiner", "java.util.Iterator", "org.threeten.bp.Instant" ]
import com.google.cloud.dns.ChangeRequest; import com.google.cloud.dns.Dns; import com.google.common.base.Joiner; import java.util.Iterator; import org.threeten.bp.Instant;
import com.google.cloud.dns.*; import com.google.common.base.*; import java.util.*; import org.threeten.bp.*;
[ "com.google.cloud", "com.google.common", "java.util", "org.threeten.bp" ]
com.google.cloud; com.google.common; java.util; org.threeten.bp;
1,832,966
static MethodDeclaration addNumericPredictor(final NumericPredictor numericPredictor, final ClassOrInterfaceDeclaration tableTemplate, int predictorArity) { try { templateEvaluate = getFromFileName(KIE_PMML_EVALUATE_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_EVALUATE_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); MethodDeclaration methodTemplate; if (Objects.equals(1, numericPredictor.getExponent())) { methodTemplate = getNumericPredictorWithoutExponentTemplate(numericPredictor, evaluateTemplateClass); } else { methodTemplate = getNumericPredictorWithExponentTemplate(numericPredictor, evaluateTemplateClass); } return addMethod(methodTemplate, tableTemplate, "evaluateNumericPredictor" + predictorArity); } catch (Exception e) { throw new KiePMMLInternalException(String.format("Failed to add NumericPredictor %s", numericPredictor.getName()), e); } }
static MethodDeclaration addNumericPredictor(final NumericPredictor numericPredictor, final ClassOrInterfaceDeclaration tableTemplate, int predictorArity) { try { templateEvaluate = getFromFileName(KIE_PMML_EVALUATE_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_EVALUATE_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); MethodDeclaration methodTemplate; if (Objects.equals(1, numericPredictor.getExponent())) { methodTemplate = getNumericPredictorWithoutExponentTemplate(numericPredictor, evaluateTemplateClass); } else { methodTemplate = getNumericPredictorWithExponentTemplate(numericPredictor, evaluateTemplateClass); } return addMethod(methodTemplate, tableTemplate, STR + predictorArity); } catch (Exception e) { throw new KiePMMLInternalException(String.format(STR, numericPredictor.getName()), e); } }
/** * Add a <b>NumericPredictor</b> <code>MethodDeclaration</code> to the class * @param numericPredictor * @param tableTemplate * @param predictorArity * @return */
Add a NumericPredictor <code>MethodDeclaration</code> to the class
addNumericPredictor
{ "repo_name": "baldimir/drools", "path": "kie-pmml-trusty/kie-pmml-models/kie-pmml-models-regression/kie-pmml-models-regression-compiler/src/main/java/org/kie/pmml/models/regression/compiler/factories/KiePMMLRegressionTableRegressionFactory.java", "license": "apache-2.0", "size": 27367 }
[ "com.github.javaparser.ast.body.ClassOrInterfaceDeclaration", "com.github.javaparser.ast.body.MethodDeclaration", "java.util.Objects", "org.dmg.pmml.regression.NumericPredictor", "org.kie.pmml.commons.exceptions.KiePMMLInternalException", "org.kie.pmml.compiler.commons.utils.CommonCodegenUtils", "org.kie.pmml.compiler.commons.utils.JavaParserUtils" ]
import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.MethodDeclaration; import java.util.Objects; import org.dmg.pmml.regression.NumericPredictor; import org.kie.pmml.commons.exceptions.KiePMMLInternalException; import org.kie.pmml.compiler.commons.utils.CommonCodegenUtils; import org.kie.pmml.compiler.commons.utils.JavaParserUtils;
import com.github.javaparser.ast.body.*; import java.util.*; import org.dmg.pmml.regression.*; import org.kie.pmml.commons.exceptions.*; import org.kie.pmml.compiler.commons.utils.*;
[ "com.github.javaparser", "java.util", "org.dmg.pmml", "org.kie.pmml" ]
com.github.javaparser; java.util; org.dmg.pmml; org.kie.pmml;
450,265
private void avoid405Error(HttpServletRequest request) { ServletRequest servletRequest = (ServletRequest) request; while(servletRequest!= null && !(servletRequest instanceof HttpMethodRequestWrapper) && (servletRequest instanceof HttpServletRequestWrapper)) { servletRequest = ((HttpServletRequestWrapper)servletRequest).getRequest(); } if(servletRequest instanceof HttpMethodRequestWrapper) { ((HttpMethodRequestWrapper) servletRequest).setMethod("GET"); } org.springframework.web.filter.HiddenHttpMethodFilter a; }
void function(HttpServletRequest request) { ServletRequest servletRequest = (ServletRequest) request; while(servletRequest!= null && !(servletRequest instanceof HttpMethodRequestWrapper) && (servletRequest instanceof HttpServletRequestWrapper)) { servletRequest = ((HttpServletRequestWrapper)servletRequest).getRequest(); } if(servletRequest instanceof HttpMethodRequestWrapper) { ((HttpMethodRequestWrapper) servletRequest).setMethod("GET"); } org.springframework.web.filter.HiddenHttpMethodFilter a; }
/** * Try to avoid 405 - JSPs only permit GET POST or HEAD with exceptions on put/delete/patch * @param request */
Try to avoid 405 - JSPs only permit GET POST or HEAD with exceptions on put/delete/patch
avoid405Error
{ "repo_name": "EsupPortail/esup-dematec", "path": "src/main/java/fr/univrouen/poste/web/ExceptionController.java", "license": "apache-2.0", "size": 4931 }
[ "fr.univrouen.poste.web.HiddenHttpMethodFilter", "javax.servlet.ServletRequest", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletRequestWrapper" ]
import fr.univrouen.poste.web.HiddenHttpMethodFilter; import javax.servlet.ServletRequest; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper;
import fr.univrouen.poste.web.*; import javax.servlet.*; import javax.servlet.http.*;
[ "fr.univrouen.poste", "javax.servlet" ]
fr.univrouen.poste; javax.servlet;
1,778,792
private void updateXPoints(XYSeries series) { if (series == null) { throw new IllegalArgumentException("Null 'series' not permitted."); } HashSet seriesXPoints = new HashSet(); boolean savedState = this.propagateEvents; this.propagateEvents = false; for (int itemNo = 0; itemNo < series.getItemCount(); itemNo++) { Number xValue = series.getX(itemNo); seriesXPoints.add(xValue); if (!this.xPoints.contains(xValue)) { this.xPoints.add(xValue); int seriesCount = this.data.size(); for (int seriesNo = 0; seriesNo < seriesCount; seriesNo++) { XYSeries dataSeries = (XYSeries) this.data.get(seriesNo); if (!dataSeries.equals(series)) { dataSeries.add(xValue, null); } } } } Iterator iterator = this.xPoints.iterator(); while (iterator.hasNext()) { Number xPoint = (Number) iterator.next(); if (!seriesXPoints.contains(xPoint)) { series.add(xPoint, null); } } this.propagateEvents = savedState; }
void function(XYSeries series) { if (series == null) { throw new IllegalArgumentException(STR); } HashSet seriesXPoints = new HashSet(); boolean savedState = this.propagateEvents; this.propagateEvents = false; for (int itemNo = 0; itemNo < series.getItemCount(); itemNo++) { Number xValue = series.getX(itemNo); seriesXPoints.add(xValue); if (!this.xPoints.contains(xValue)) { this.xPoints.add(xValue); int seriesCount = this.data.size(); for (int seriesNo = 0; seriesNo < seriesCount; seriesNo++) { XYSeries dataSeries = (XYSeries) this.data.get(seriesNo); if (!dataSeries.equals(series)) { dataSeries.add(xValue, null); } } } } Iterator iterator = this.xPoints.iterator(); while (iterator.hasNext()) { Number xPoint = (Number) iterator.next(); if (!seriesXPoints.contains(xPoint)) { series.add(xPoint, null); } } this.propagateEvents = savedState; }
/** * Adds any unique x-values from 'series' to the dataset, and also adds any * x-values that are in the dataset but not in 'series' to the series. * * @param series the series (<code>null</code> not permitted). */
Adds any unique x-values from 'series' to the dataset, and also adds any x-values that are in the dataset but not in 'series' to the series
updateXPoints
{ "repo_name": "djun100/afreechart", "path": "src/org/afree/data/xy/DefaultTableXYDataset.java", "license": "lgpl-3.0", "size": 21840 }
[ "java.util.HashSet", "java.util.Iterator" ]
import java.util.HashSet; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,460,854
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>(2); // 6379 JedisShardInfo shard1 = new JedisShardInfo(redis1); shard1.setPassword("foobared"); shards.add(shard1); // 6380 JedisShardInfo shard2 = new JedisShardInfo(redis2); shard2.setPassword("foobared"); shards.add(shard2); @SuppressWarnings("resource") ShardedJedis shardedJedis = new ShardedJedis(shards); // establish the connection for two redis servers shardedJedis.set("a", "bar"); JedisShardInfo ak = shardedJedis.getShardInfo("a"); assertEquals(shard2, ak); shardedJedis.set("b", "bar1"); JedisShardInfo bk = shardedJedis.getShardInfo("b"); assertEquals(shard1, bk); // We set a name to the instance so it's easy to find it Iterator<Jedis> it = shardedJedis.getAllShards().iterator(); Jedis deadClient = it.next(); deadClient.clientSetname("DEAD"); ClientKillerUtil.killClient(deadClient, "DEAD"); assertTrue(deadClient.isConnected()); assertFalse(deadClient.getClient().getSocket().isClosed()); assertFalse(deadClient.isBroken()); // normal - not found shardedJedis.disconnect(); assertFalse(deadClient.isConnected()); assertTrue(deadClient.getClient().getSocket().isClosed()); assertTrue(deadClient.isBroken()); Jedis jedis2 = it.next(); assertFalse(jedis2.isConnected()); assertTrue(jedis2.getClient().getSocket().isClosed()); assertFalse(jedis2.isBroken()); }
List<JedisShardInfo> shards = new ArrayList<JedisShardInfo>(2); JedisShardInfo shard1 = new JedisShardInfo(redis1); shard1.setPassword(STR); shards.add(shard1); JedisShardInfo shard2 = new JedisShardInfo(redis2); shard2.setPassword(STR); shards.add(shard2); @SuppressWarnings(STR) ShardedJedis shardedJedis = new ShardedJedis(shards); shardedJedis.set("a", "bar"); JedisShardInfo ak = shardedJedis.getShardInfo("a"); assertEquals(shard2, ak); shardedJedis.set("b", "bar1"); JedisShardInfo bk = shardedJedis.getShardInfo("b"); assertEquals(shard1, bk); Iterator<Jedis> it = shardedJedis.getAllShards().iterator(); Jedis deadClient = it.next(); deadClient.clientSetname("DEAD"); ClientKillerUtil.killClient(deadClient, "DEAD"); assertTrue(deadClient.isConnected()); assertFalse(deadClient.getClient().getSocket().isClosed()); assertFalse(deadClient.isBroken()); shardedJedis.disconnect(); assertFalse(deadClient.isConnected()); assertTrue(deadClient.getClient().getSocket().isClosed()); assertTrue(deadClient.isBroken()); Jedis jedis2 = it.next(); assertFalse(jedis2.isConnected()); assertTrue(jedis2.getClient().getSocket().isClosed()); assertFalse(jedis2.isBroken()); }
/** * Test for "Issue - BinaryShardedJedis.disconnect() may occur memory leak". You can find more * detailed information at https://github.com/xetorthio/jedis/issues/808 * @throws InterruptedException */
Test for "Issue - BinaryShardedJedis.disconnect() may occur memory leak". You can find more detailed information at HREF
testAvoidLeaksUponDisconnect
{ "repo_name": "xetorthio/jedis", "path": "src/test/java/redis/clients/jedis/tests/ShardedJedisTest.java", "license": "mit", "size": 12759 }
[ "java.util.ArrayList", "java.util.Iterator", "java.util.List", "org.junit.Assert", "redis.clients.jedis.Jedis", "redis.clients.jedis.JedisShardInfo", "redis.clients.jedis.ShardedJedis", "redis.clients.jedis.tests.utils.ClientKillerUtil" ]
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.junit.Assert; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisShardInfo; import redis.clients.jedis.ShardedJedis; import redis.clients.jedis.tests.utils.ClientKillerUtil;
import java.util.*; import org.junit.*; import redis.clients.jedis.*; import redis.clients.jedis.tests.utils.*;
[ "java.util", "org.junit", "redis.clients.jedis" ]
java.util; org.junit; redis.clients.jedis;
432,445
public final void setIcon(int id, int drawableRes) { Window window = getWindow(id); if (window != null) { View icon = window.findViewById(R.id.window_icon); if (icon instanceof ImageView) { ((ImageView) icon).setImageResource(drawableRes); } } } /** * Internal touch handler for handling moving the window. * * @see {@link View#onTouchEvent(MotionEvent)}
final void function(int id, int drawableRes) { Window window = getWindow(id); if (window != null) { View icon = window.findViewById(R.id.window_icon); if (icon instanceof ImageView) { ((ImageView) icon).setImageResource(drawableRes); } } } /** * Internal touch handler for handling moving the window. * * @see {@link View#onTouchEvent(MotionEvent)}
/** * Change the icon of the window, if such a icon exists. A icon exists if * {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set, or if your own view * contains a TextView with id R.id.window_icon. * * @param id * The id of the window. * @param drawableRes * The new icon. */
Change the icon of the window, if such a icon exists. A icon exists if <code>StandOutFlags#FLAG_DECORATION_SYSTEM</code> is set, or if your own view contains a TextView with id R.id.window_icon
setIcon
{ "repo_name": "sherpya/StandOut", "path": "library/src/main/java/wei/mark/standout/StandOutWindow.java", "license": "mit", "size": 60098 }
[ "android.view.MotionEvent", "android.view.View", "android.widget.ImageView" ]
import android.view.MotionEvent; import android.view.View; import android.widget.ImageView;
import android.view.*; import android.widget.*;
[ "android.view", "android.widget" ]
android.view; android.widget;
52,980
void bindParameter(String parameterName, Binding binding);
void bindParameter(String parameterName, Binding binding);
/** * Used during construction of the page to identify the binding for a particular parameter. * */
Used during construction of the page to identify the binding for a particular parameter
bindParameter
{ "repo_name": "apache/tapestry-5", "path": "tapestry-core/src/main/java/org/apache/tapestry5/internal/InternalComponentResourcesCommon.java", "license": "apache-2.0", "size": 2254 }
[ "org.apache.tapestry5.Binding" ]
import org.apache.tapestry5.Binding;
import org.apache.tapestry5.*;
[ "org.apache.tapestry5" ]
org.apache.tapestry5;
669,681
private URI[] getDistributionPoints(final X509Certificate cert) { final List<DistributionPoint> points; try { points = new ExtensionReader(cert).readCRLDistributionPoints(); } catch (final RuntimeException e) { LOGGER.error("Error reading CRLDistributionPoints extension field on [{}]", CertUtils.toString(cert), e); return new URI[0]; } final List<URI> urls = new ArrayList<>(); if (points != null) { for (final DistributionPoint point : points) { final DistributionPointName pointName = point.getDistributionPoint(); if (pointName != null) { final ASN1Sequence nameSequence = ASN1Sequence.getInstance(pointName.getName()); for (int i = 0; i < nameSequence.size(); i++) { final GeneralName name = GeneralName.getInstance(nameSequence.getObjectAt(i)); LOGGER.debug("Found CRL distribution point [{}].", name); try { addURL(urls, DERIA5String.getInstance(name.getName()).getString()); } catch (final RuntimeException e) { LOGGER.warn("[{}] not supported. String or GeneralNameList expected.", pointName); } } } } } return urls.toArray(new URI[urls.size()]); } /** * Adds the url to the list. * Build URI by components to facilitate proper encoding of querystring. * e.g. http://example.com:8085/ca?action=crl&issuer=CN=CAS Test User CA * <p> * <p>If {@code uriString} is encoded, it will be decoded with {@code UTF-8}
URI[] function(final X509Certificate cert) { final List<DistributionPoint> points; try { points = new ExtensionReader(cert).readCRLDistributionPoints(); } catch (final RuntimeException e) { LOGGER.error(STR, CertUtils.toString(cert), e); return new URI[0]; } final List<URI> urls = new ArrayList<>(); if (points != null) { for (final DistributionPoint point : points) { final DistributionPointName pointName = point.getDistributionPoint(); if (pointName != null) { final ASN1Sequence nameSequence = ASN1Sequence.getInstance(pointName.getName()); for (int i = 0; i < nameSequence.size(); i++) { final GeneralName name = GeneralName.getInstance(nameSequence.getObjectAt(i)); LOGGER.debug(STR, name); try { addURL(urls, DERIA5String.getInstance(name.getName()).getString()); } catch (final RuntimeException e) { LOGGER.warn(STR, pointName); } } } } } return urls.toArray(new URI[urls.size()]); } /** * Adds the url to the list. * Build URI by components to facilitate proper encoding of querystring. * e.g. http: * <p> * <p>If {@code uriString} is encoded, it will be decoded with {@code UTF-8}
/** * Gets the distribution points. * * @param cert the cert * @return the url distribution points */
Gets the distribution points
getDistributionPoints
{ "repo_name": "gabedwrds/cas", "path": "support/cas-server-support-x509/src/main/java/org/apereo/cas/adaptors/x509/authentication/revocation/checker/CRLDistributionPointRevocationChecker.java", "license": "apache-2.0", "size": 10899 }
[ "java.security.cert.X509Certificate", "java.util.ArrayList", "java.util.List", "org.apereo.cas.adaptors.x509.util.CertUtils", "org.bouncycastle.asn1.ASN1Sequence", "org.bouncycastle.asn1.DERIA5String", "org.bouncycastle.asn1.x509.DistributionPoint", "org.bouncycastle.asn1.x509.DistributionPointName", "org.bouncycastle.asn1.x509.GeneralName", "org.cryptacular.x509.ExtensionReader" ]
import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.List; import org.apereo.cas.adaptors.x509.util.CertUtils; import org.bouncycastle.asn1.ASN1Sequence; import org.bouncycastle.asn1.DERIA5String; import org.bouncycastle.asn1.x509.DistributionPoint; import org.bouncycastle.asn1.x509.DistributionPointName; import org.bouncycastle.asn1.x509.GeneralName; import org.cryptacular.x509.ExtensionReader;
import java.security.cert.*; import java.util.*; import org.apereo.cas.adaptors.x509.util.*; import org.bouncycastle.asn1.*; import org.bouncycastle.asn1.x509.*; import org.cryptacular.x509.*;
[ "java.security", "java.util", "org.apereo.cas", "org.bouncycastle.asn1", "org.cryptacular.x509" ]
java.security; java.util; org.apereo.cas; org.bouncycastle.asn1; org.cryptacular.x509;
2,702,190
public static <T extends Annotation> Annotation getAnnotationMetaAnnotated( AnnotatedElement annotatedElementClass, Class<T> metaAnnotationToFind) { Annotation[] annotations = annotatedElementClass.getAnnotations(); for (Annotation annotation : annotations) { Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); for (Annotation metaAnnotation : metaAnnotations) { if (metaAnnotation.annotationType().equals(metaAnnotationToFind)) { return annotation; } } } return null; }
static <T extends Annotation> Annotation function( AnnotatedElement annotatedElementClass, Class<T> metaAnnotationToFind) { Annotation[] annotations = annotatedElementClass.getAnnotations(); for (Annotation annotation : annotations) { Annotation[] metaAnnotations = annotation.annotationType().getAnnotations(); for (Annotation metaAnnotation : metaAnnotations) { if (metaAnnotation.annotationType().equals(metaAnnotationToFind)) { return annotation; } } } return null; }
/** * Finds a annotation meta-annotated on the given annotated element. * * @param <T> the annotation type to retrieve * @param annotatedElementClass the annotated element * @param metaAnnotationToFind the meta annotation to find * @return the annotation meta annotated if exist, null otherwise */
Finds a annotation meta-annotated on the given annotated element
getAnnotationMetaAnnotated
{ "repo_name": "tbouvet/seed", "path": "core/src/main/java/org/seedstack/seed/core/utils/SeedReflectionUtils.java", "license": "mpl-2.0", "size": 21192 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.AnnotatedElement" ]
import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement;
import java.lang.annotation.*; import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,803,035
private static Boolean createKeystore(File file) { // Create the folder structure if it doesn't already exist if (file.exists()) { return true; } else { file.getParentFile().mkdirs(); } // Attempt to create the actual file, if possible if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { System.err.println("The desired keystore file could not be created."); e.printStackTrace(); } } return file.exists(); }
static Boolean function(File file) { if (file.exists()) { return true; } else { file.getParentFile().mkdirs(); } if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { System.err.println(STR); e.printStackTrace(); } } return file.exists(); }
/** * Creates a keystore at the specified path * * @param file * Keystore to be created * @return */
Creates a keystore at the specified path
createKeystore
{ "repo_name": "SmeeK153/SessionManager", "path": "src/main/java/keystore/Keystore.java", "license": "mit", "size": 10777 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,089,916
public CmsRelationType getType() { return m_type; }
CmsRelationType function() { return m_type; }
/** * Gets the relation type.<p> * * @return the relation type */
Gets the relation type
getType
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/importexport/CmsImportVersion10.java", "license": "lgpl-2.1", "size": 126030 }
[ "org.opencms.relations.CmsRelationType" ]
import org.opencms.relations.CmsRelationType;
import org.opencms.relations.*;
[ "org.opencms.relations" ]
org.opencms.relations;
334,379
@Override protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) { ClassNode[] exceptions = {ClassHelper.make(PropertyVetoException.class)}; MethodNode setter = new MethodNode( setterName, PropertyNodeUtils.adjustPropertyModifiersForMethod(propertyNode), ClassHelper.VOID_TYPE, params(param(propertyNode.getType(), "value")), exceptions, setterBlock); setter.setSynthetic(true); // add it to the class addGeneratedMethod(declaringClass, setter); }
void function(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) { ClassNode[] exceptions = {ClassHelper.make(PropertyVetoException.class)}; MethodNode setter = new MethodNode( setterName, PropertyNodeUtils.adjustPropertyModifiersForMethod(propertyNode), ClassHelper.VOID_TYPE, params(param(propertyNode.getType(), "value")), exceptions, setterBlock); setter.setSynthetic(true); addGeneratedMethod(declaringClass, setter); }
/** * Creates a setter method with the given body. * <p> * This differs from normal setters in that we need to add a declared * exception java.beans.PropertyVetoException * * @param declaringClass the class to which we will add the setter * @param propertyNode the field to back the setter * @param setterName the name of the setter * @param setterBlock the statement representing the setter block */
Creates a setter method with the given body. This differs from normal setters in that we need to add a declared exception java.beans.PropertyVetoException
createSetterMethod
{ "repo_name": "apache/groovy", "path": "src/main/java/groovy/beans/VetoableASTTransformation.java", "license": "apache-2.0", "size": 20556 }
[ "java.beans.PropertyVetoException", "org.apache.groovy.ast.tools.ClassNodeUtils", "org.codehaus.groovy.ast.ClassHelper", "org.codehaus.groovy.ast.ClassNode", "org.codehaus.groovy.ast.MethodNode", "org.codehaus.groovy.ast.PropertyNode", "org.codehaus.groovy.ast.stmt.Statement", "org.codehaus.groovy.ast.tools.GeneralUtils", "org.codehaus.groovy.ast.tools.PropertyNodeUtils" ]
import java.beans.PropertyVetoException; import org.apache.groovy.ast.tools.ClassNodeUtils; import org.codehaus.groovy.ast.ClassHelper; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.MethodNode; import org.codehaus.groovy.ast.PropertyNode; import org.codehaus.groovy.ast.stmt.Statement; import org.codehaus.groovy.ast.tools.GeneralUtils; import org.codehaus.groovy.ast.tools.PropertyNodeUtils;
import java.beans.*; import org.apache.groovy.ast.tools.*; import org.codehaus.groovy.ast.*; import org.codehaus.groovy.ast.stmt.*; import org.codehaus.groovy.ast.tools.*;
[ "java.beans", "org.apache.groovy", "org.codehaus.groovy" ]
java.beans; org.apache.groovy; org.codehaus.groovy;
548,507
protected void buildTotalChangeErrorMessage(String propertyName, KualiDecimal persistedSourceLineTotal, KualiDecimal currentSourceLineTotal) { String persistedTotal = (String) new CurrencyFormatter().format(persistedSourceLineTotal); String currentTotal = (String) new CurrencyFormatter().format(currentSourceLineTotal); GlobalVariables.getMessageMap().putError(propertyName, KFSKeyConstants.ERROR_DOCUMENT_SINGLE_ACCOUNTING_LINE_SECTION_TOTAL_CHANGED, new String[] { persistedTotal, currentTotal }); }
void function(String propertyName, KualiDecimal persistedSourceLineTotal, KualiDecimal currentSourceLineTotal) { String persistedTotal = (String) new CurrencyFormatter().format(persistedSourceLineTotal); String currentTotal = (String) new CurrencyFormatter().format(currentSourceLineTotal); GlobalVariables.getMessageMap().putError(propertyName, KFSKeyConstants.ERROR_DOCUMENT_SINGLE_ACCOUNTING_LINE_SECTION_TOTAL_CHANGED, new String[] { persistedTotal, currentTotal }); }
/** * This method builds out the error message for when totals have changed. * * @param propertyName * @param persistedSourceLineTotal * @param currentSourceLineTotal */
This method builds out the error message for when totals have changed
buildTotalChangeErrorMessage
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/sys/document/validation/impl/AccountingLineGroupTotalsUnchangedValidation.java", "license": "agpl-3.0", "size": 7026 }
[ "org.kuali.kfs.sys.KFSKeyConstants", "org.kuali.rice.core.api.util.type.KualiDecimal", "org.kuali.rice.core.web.format.CurrencyFormatter", "org.kuali.rice.krad.util.GlobalVariables" ]
import org.kuali.kfs.sys.KFSKeyConstants; import org.kuali.rice.core.api.util.type.KualiDecimal; import org.kuali.rice.core.web.format.CurrencyFormatter; import org.kuali.rice.krad.util.GlobalVariables;
import org.kuali.kfs.sys.*; import org.kuali.rice.core.api.util.type.*; import org.kuali.rice.core.web.format.*; import org.kuali.rice.krad.util.*;
[ "org.kuali.kfs", "org.kuali.rice" ]
org.kuali.kfs; org.kuali.rice;
1,689,028
public @Nonnull AffinityGroup create(@Nonnull AffinityGroupCreateOptions options) throws InternalException, CloudException;
@Nonnull AffinityGroup function(@Nonnull AffinityGroupCreateOptions options) throws InternalException, CloudException;
/** * Creates an affinity group in the cloud * @param options the options used when creating the affinity group * @return the provider ID of the affinity group * @throws InternalException an error occurred within the Dasein Cloud implementation creating the affinity group * @throws CloudException an error occurred within the service provider creating the affinity group */
Creates an affinity group in the cloud
create
{ "repo_name": "daniellemayne/dasein-cloud-core_old", "path": "src/main/java/org/dasein/cloud/compute/AffinityGroupSupport.java", "license": "apache-2.0", "size": 4090 }
[ "javax.annotation.Nonnull", "org.dasein.cloud.CloudException", "org.dasein.cloud.InternalException" ]
import javax.annotation.Nonnull; import org.dasein.cloud.CloudException; import org.dasein.cloud.InternalException;
import javax.annotation.*; import org.dasein.cloud.*;
[ "javax.annotation", "org.dasein.cloud" ]
javax.annotation; org.dasein.cloud;
2,555,799
@Override public Reader getReader() { return (writer == null) ? new CharArrayReader (cb, 0, nextChar) : null; }
Reader function() { return (writer == null) ? new CharArrayReader (cb, 0, nextChar) : null; }
/** * Return the value of this BodyJspWriter as a Reader. * Note: this is after evaluation!! There are no scriptlets, * etc in this stream. * * @return the value of this BodyJspWriter as a Reader */
Return the value of this BodyJspWriter as a Reader. Note: this is after evaluation!! There are no scriptlets, etc in this stream
getReader
{ "repo_name": "plumer/codana", "path": "tomcat_files/8.0.22/BodyContentImpl.java", "license": "mit", "size": 19847 }
[ "java.io.CharArrayReader", "java.io.Reader" ]
import java.io.CharArrayReader; import java.io.Reader;
import java.io.*;
[ "java.io" ]
java.io;
2,337,126
public void removeRowIdChangeListener(RowIdChangeListener listener) { if (queryDelegate instanceof QueryDelegate.RowIdChangeNotifier) { ((QueryDelegate.RowIdChangeNotifier) queryDelegate) .removeListener(listener); } } /** * @deprecated As of 7.0, replaced by * {@link #removeRowIdChangeListener(RowIdChangeListener)}
void function(RowIdChangeListener listener) { if (queryDelegate instanceof QueryDelegate.RowIdChangeNotifier) { ((QueryDelegate.RowIdChangeNotifier) queryDelegate) .removeListener(listener); } } /** * @deprecated As of 7.0, replaced by * {@link #removeRowIdChangeListener(RowIdChangeListener)}
/** * Removes a RowIdChangeListener from the QueryDelegate * * @param listener */
Removes a RowIdChangeListener from the QueryDelegate
removeRowIdChangeListener
{ "repo_name": "Legioth/vaadin", "path": "compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/SQLContainer.java", "license": "apache-2.0", "size": 63018 }
[ "com.vaadin.v7.data.util.sqlcontainer.query.QueryDelegate" ]
import com.vaadin.v7.data.util.sqlcontainer.query.QueryDelegate;
import com.vaadin.v7.data.util.sqlcontainer.query.*;
[ "com.vaadin.v7" ]
com.vaadin.v7;
901,206
protected void buildMetadataFilters(final SamlRegisteredService service, final AbstractMetadataResolver metadataProvider) throws Exception { final List<MetadataFilter> metadataFilterList = new ArrayList<>(); buildRequiredValidUntilFilterIfNeeded(service, metadataFilterList); buildSignatureValidationFilterIfNeeded(service, metadataFilterList); buildEntityRoleFilterIfNeeded(service, metadataFilterList); buildPredicateFilterIfNeeded(service, metadataFilterList); if (!metadataFilterList.isEmpty()) { final MetadataFilterChain metadataFilterChain = new MetadataFilterChain(); metadataFilterChain.setFilters(metadataFilterList); LOGGER.debug("Metadata filter chain initialized with [{}] filters", metadataFilterList.size()); metadataProvider.setMetadataFilter(metadataFilterChain); } }
void function(final SamlRegisteredService service, final AbstractMetadataResolver metadataProvider) throws Exception { final List<MetadataFilter> metadataFilterList = new ArrayList<>(); buildRequiredValidUntilFilterIfNeeded(service, metadataFilterList); buildSignatureValidationFilterIfNeeded(service, metadataFilterList); buildEntityRoleFilterIfNeeded(service, metadataFilterList); buildPredicateFilterIfNeeded(service, metadataFilterList); if (!metadataFilterList.isEmpty()) { final MetadataFilterChain metadataFilterChain = new MetadataFilterChain(); metadataFilterChain.setFilters(metadataFilterList); LOGGER.debug(STR, metadataFilterList.size()); metadataProvider.setMetadataFilter(metadataFilterChain); } }
/** * Build metadata filters. * * @param service the service * @param metadataProvider the metadata provider * @throws Exception the exception */
Build metadata filters
buildMetadataFilters
{ "repo_name": "creamer/cas", "path": "support/cas-server-support-saml-idp/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/ChainingMetadataResolverCacheLoader.java", "license": "apache-2.0", "size": 19397 }
[ "java.util.ArrayList", "java.util.List", "org.apereo.cas.support.saml.services.SamlRegisteredService", "org.opensaml.saml.metadata.resolver.filter.MetadataFilter", "org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain", "org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver" ]
import java.util.ArrayList; import java.util.List; import org.apereo.cas.support.saml.services.SamlRegisteredService; import org.opensaml.saml.metadata.resolver.filter.MetadataFilter; import org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain; import org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver;
import java.util.*; import org.apereo.cas.support.saml.services.*; import org.opensaml.saml.metadata.resolver.filter.*; import org.opensaml.saml.metadata.resolver.impl.*;
[ "java.util", "org.apereo.cas", "org.opensaml.saml" ]
java.util; org.apereo.cas; org.opensaml.saml;
2,578,838
public static ImmutableSortedSet<JavaLibrary> addBuildConfigDeps( BuildTarget originalBuildTarget, ProjectFilesystem projectFilesystem, PackageType packageType, EnumSet<ExopackageMode> exopackageModes, BuildConfigFields buildConfigValues, Optional<SourcePath> buildConfigValuesFile, BuildRuleResolver ruleResolver, Javac javac, JavacOptions javacOptions, AndroidPackageableCollection packageableCollection) throws NoSuchBuildTargetException { ImmutableSortedSet.Builder<JavaLibrary> result = ImmutableSortedSet.naturalOrder(); BuildConfigFields buildConfigConstants = BuildConfigFields.fromFields( ImmutableList.of( BuildConfigFields.Field.of( "boolean", BuildConfigs.DEBUG_CONSTANT, String.valueOf(packageType != AndroidBinary.PackageType.RELEASE)), BuildConfigFields.Field.of( "boolean", BuildConfigs.IS_EXO_CONSTANT, String.valueOf(!exopackageModes.isEmpty())), BuildConfigFields.Field.of( "int", BuildConfigs.EXOPACKAGE_FLAGS, String.valueOf(ExopackageMode.toBitmask(exopackageModes))))); for (Map.Entry<String, BuildConfigFields> entry : packageableCollection.getBuildConfigs().entrySet()) { // Merge the user-defined constants with the APK-specific overrides. BuildConfigFields totalBuildConfigValues = BuildConfigFields.empty() .putAll(entry.getValue()) .putAll(buildConfigValues) .putAll(buildConfigConstants); // Each enhanced dep needs a unique build target, so we parameterize the build target by the // Java package. String javaPackage = entry.getKey(); Flavor flavor = InternalFlavor.of("buildconfig_" + javaPackage.replace('.', '_')); BuildTarget buildTargetWithFlavors = originalBuildTarget.withAppendedFlavors(flavor); BuildRuleParams buildConfigParams = new BuildRuleParams( Suppliers.ofInstance(ImmutableSortedSet.of()), Suppliers.ofInstance(ImmutableSortedSet.of()), ImmutableSortedSet.of()); JavaLibrary buildConfigJavaLibrary = AndroidBuildConfigDescription.createBuildRule( buildTargetWithFlavors, projectFilesystem, buildConfigParams, javaPackage, totalBuildConfigValues, buildConfigValuesFile, true, javac, javacOptions, ruleResolver); ruleResolver.addToIndex(buildConfigJavaLibrary); Preconditions.checkNotNull( buildConfigJavaLibrary.getSourcePathToOutput(), "%s must have an output file.", buildConfigJavaLibrary); result.add(buildConfigJavaLibrary); } return result.build(); }
static ImmutableSortedSet<JavaLibrary> function( BuildTarget originalBuildTarget, ProjectFilesystem projectFilesystem, PackageType packageType, EnumSet<ExopackageMode> exopackageModes, BuildConfigFields buildConfigValues, Optional<SourcePath> buildConfigValuesFile, BuildRuleResolver ruleResolver, Javac javac, JavacOptions javacOptions, AndroidPackageableCollection packageableCollection) throws NoSuchBuildTargetException { ImmutableSortedSet.Builder<JavaLibrary> result = ImmutableSortedSet.naturalOrder(); BuildConfigFields buildConfigConstants = BuildConfigFields.fromFields( ImmutableList.of( BuildConfigFields.Field.of( STR, BuildConfigs.DEBUG_CONSTANT, String.valueOf(packageType != AndroidBinary.PackageType.RELEASE)), BuildConfigFields.Field.of( STR, BuildConfigs.IS_EXO_CONSTANT, String.valueOf(!exopackageModes.isEmpty())), BuildConfigFields.Field.of( "int", BuildConfigs.EXOPACKAGE_FLAGS, String.valueOf(ExopackageMode.toBitmask(exopackageModes))))); for (Map.Entry<String, BuildConfigFields> entry : packageableCollection.getBuildConfigs().entrySet()) { BuildConfigFields totalBuildConfigValues = BuildConfigFields.empty() .putAll(entry.getValue()) .putAll(buildConfigValues) .putAll(buildConfigConstants); String javaPackage = entry.getKey(); Flavor flavor = InternalFlavor.of(STR + javaPackage.replace('.', '_')); BuildTarget buildTargetWithFlavors = originalBuildTarget.withAppendedFlavors(flavor); BuildRuleParams buildConfigParams = new BuildRuleParams( Suppliers.ofInstance(ImmutableSortedSet.of()), Suppliers.ofInstance(ImmutableSortedSet.of()), ImmutableSortedSet.of()); JavaLibrary buildConfigJavaLibrary = AndroidBuildConfigDescription.createBuildRule( buildTargetWithFlavors, projectFilesystem, buildConfigParams, javaPackage, totalBuildConfigValues, buildConfigValuesFile, true, javac, javacOptions, ruleResolver); ruleResolver.addToIndex(buildConfigJavaLibrary); Preconditions.checkNotNull( buildConfigJavaLibrary.getSourcePathToOutput(), STR, buildConfigJavaLibrary); result.add(buildConfigJavaLibrary); } return result.build(); }
/** * If the user specified any android_build_config() rules, then we must add some build rules to * generate the production {@code BuildConfig.class} files and ensure that they are included in * the list of {@link AndroidPackageableCollection#getClasspathEntriesToDex}. */
If the user specified any android_build_config() rules, then we must add some build rules to generate the production BuildConfig.class files and ensure that they are included in the list of <code>AndroidPackageableCollection#getClasspathEntriesToDex</code>
addBuildConfigDeps
{ "repo_name": "dsyang/buck", "path": "src/com/facebook/buck/android/AndroidBinaryGraphEnhancer.java", "license": "apache-2.0", "size": 29289 }
[ "com.facebook.buck.android.AndroidBinary", "com.facebook.buck.io.ProjectFilesystem", "com.facebook.buck.jvm.java.JavaLibrary", "com.facebook.buck.jvm.java.Javac", "com.facebook.buck.jvm.java.JavacOptions", "com.facebook.buck.model.BuildTarget", "com.facebook.buck.model.Flavor", "com.facebook.buck.model.InternalFlavor", "com.facebook.buck.parser.NoSuchBuildTargetException", "com.facebook.buck.rules.BuildRuleParams", "com.facebook.buck.rules.BuildRuleResolver", "com.facebook.buck.rules.SourcePath", "com.facebook.buck.rules.coercer.BuildConfigFields", "com.google.common.base.Preconditions", "com.google.common.base.Suppliers", "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableSortedSet", "java.util.EnumSet", "java.util.Map", "java.util.Optional" ]
import com.facebook.buck.android.AndroidBinary; import com.facebook.buck.io.ProjectFilesystem; import com.facebook.buck.jvm.java.JavaLibrary; import com.facebook.buck.jvm.java.Javac; import com.facebook.buck.jvm.java.JavacOptions; import com.facebook.buck.model.BuildTarget; import com.facebook.buck.model.Flavor; import com.facebook.buck.model.InternalFlavor; import com.facebook.buck.parser.NoSuchBuildTargetException; import com.facebook.buck.rules.BuildRuleParams; import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.SourcePath; import com.facebook.buck.rules.coercer.BuildConfigFields; import com.google.common.base.Preconditions; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSortedSet; import java.util.EnumSet; import java.util.Map; import java.util.Optional;
import com.facebook.buck.android.*; import com.facebook.buck.io.*; import com.facebook.buck.jvm.java.*; import com.facebook.buck.model.*; import com.facebook.buck.parser.*; import com.facebook.buck.rules.*; import com.facebook.buck.rules.coercer.*; import com.google.common.base.*; import com.google.common.collect.*; import java.util.*;
[ "com.facebook.buck", "com.google.common", "java.util" ]
com.facebook.buck; com.google.common; java.util;
433,180
public ResourceResolver getResourceResolver() { if ( this.resourceResolver == null || (this.resourceResolverFactoryTracker != null && (resourceResolverFactoryChangeCount < this.resourceResolverFactoryTracker.getTrackingCount())) ) { if ( this.resourceResolver != null ) { this.resourceResolver.close(); this.resourceResolver = null; } if ( this.resourceResolverFactoryTracker == null ) { this.resourceResolverFactoryTracker = new ServiceTracker(this.bundleContext, ResourceResolverFactory.class.getName(), null); this.resourceResolverFactoryTracker.open(); } final ResourceResolverFactory factory = (ResourceResolverFactory) this.resourceResolverFactoryTracker.getService(); if ( factory != null ) { final Map<String, Object> authInfo = new HashMap<String, Object>(); authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, this.session); try { this.resourceResolver = factory.getResourceResolver(authInfo); this.resourceResolverFactoryChangeCount = this.resourceResolverFactoryTracker.getTrackingCount(); } catch (final LoginException le) { logger.error("Unable to get administrative resource resolver.", le); } } } if ( this.resourceResolver != null ) { this.resourceResolver.refresh(); } return this.resourceResolver; }
ResourceResolver function() { if ( this.resourceResolver == null (this.resourceResolverFactoryTracker != null && (resourceResolverFactoryChangeCount < this.resourceResolverFactoryTracker.getTrackingCount())) ) { if ( this.resourceResolver != null ) { this.resourceResolver.close(); this.resourceResolver = null; } if ( this.resourceResolverFactoryTracker == null ) { this.resourceResolverFactoryTracker = new ServiceTracker(this.bundleContext, ResourceResolverFactory.class.getName(), null); this.resourceResolverFactoryTracker.open(); } final ResourceResolverFactory factory = (ResourceResolverFactory) this.resourceResolverFactoryTracker.getService(); if ( factory != null ) { final Map<String, Object> authInfo = new HashMap<String, Object>(); authInfo.put(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, this.session); try { this.resourceResolver = factory.getResourceResolver(authInfo); this.resourceResolverFactoryChangeCount = this.resourceResolverFactoryTracker.getTrackingCount(); } catch (final LoginException le) { logger.error(STR, le); } } } if ( this.resourceResolver != null ) { this.resourceResolver.refresh(); } return this.resourceResolver; }
/** * Get a resource resolver. * We don't need any syncing as this is called from the process OSGi thread. * * @return the resolver */
Get a resource resolver. We don't need any syncing as this is called from the process OSGi thread
getResourceResolver
{ "repo_name": "Sivaramvt/sling", "path": "bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/ObservationListenerSupport.java", "license": "apache-2.0", "size": 4900 }
[ "java.util.HashMap", "java.util.Map", "org.apache.sling.api.resource.LoginException", "org.apache.sling.api.resource.ResourceResolver", "org.apache.sling.api.resource.ResourceResolverFactory", "org.apache.sling.jcr.resource.JcrResourceConstants", "org.osgi.util.tracker.ServiceTracker" ]
import java.util.HashMap; import java.util.Map; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.ResourceResolverFactory; import org.apache.sling.jcr.resource.JcrResourceConstants; import org.osgi.util.tracker.ServiceTracker;
import java.util.*; import org.apache.sling.api.resource.*; import org.apache.sling.jcr.resource.*; import org.osgi.util.tracker.*;
[ "java.util", "org.apache.sling", "org.osgi.util" ]
java.util; org.apache.sling; org.osgi.util;
690,604
public void testDrawWithNullInfo() { boolean success = false; try { float[][] data = createData(); ValueAxis domainAxis = new NumberAxis("X"); ValueAxis rangeAxis = new NumberAxis("Y"); FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis); JFreeChart chart = new JFreeChart(plot); chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
void function() { boolean success = false; try { float[][] data = createData(); ValueAxis domainAxis = new NumberAxis("X"); ValueAxis rangeAxis = new NumberAxis("Y"); FastScatterPlot plot = new FastScatterPlot(data, domainAxis, rangeAxis); JFreeChart chart = new JFreeChart(plot); chart.createBufferedImage(300, 200, null); success = true; } catch (NullPointerException e) { e.printStackTrace(); success = false; } assertTrue(success); }
/** * Draws the chart with a <code>null</code> info object to make sure that * no exceptions are thrown. */
Draws the chart with a <code>null</code> info object to make sure that no exceptions are thrown
testDrawWithNullInfo
{ "repo_name": "integrated/jfreechart", "path": "tests/org/jfree/chart/plot/junit/FastScatterPlotTests.java", "license": "lgpl-2.1", "size": 7307 }
[ "org.jfree.chart.JFreeChart", "org.jfree.chart.axis.NumberAxis", "org.jfree.chart.axis.ValueAxis", "org.jfree.chart.plot.FastScatterPlot" ]
import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.FastScatterPlot;
import org.jfree.chart.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*;
[ "org.jfree.chart" ]
org.jfree.chart;
776,410
public StopDatafeedResponse stopDatafeed(StopDatafeedRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::stopDatafeed, options, StopDatafeedResponse::fromXContent, Collections.emptySet()); }
StopDatafeedResponse function(StopDatafeedRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::stopDatafeed, options, StopDatafeedResponse::fromXContent, Collections.emptySet()); }
/** * Stops the given Machine Learning Datafeed * <p> * For additional info * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html"> * ML Stop Datafeed documentation</a> * * @param request The request to stop the datafeed * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @return action acknowledgement * @throws IOException when there is a serialization issue sending the request or receiving the response */
Stops the given Machine Learning Datafeed For additional info see ML Stop Datafeed documentation
stopDatafeed
{ "repo_name": "nknize/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/MachineLearningClient.java", "license": "apache-2.0", "size": 133260 }
[ "java.io.IOException", "java.util.Collections", "org.elasticsearch.client.ml.StopDatafeedRequest", "org.elasticsearch.client.ml.StopDatafeedResponse" ]
import java.io.IOException; import java.util.Collections; import org.elasticsearch.client.ml.StopDatafeedRequest; import org.elasticsearch.client.ml.StopDatafeedResponse;
import java.io.*; import java.util.*; import org.elasticsearch.client.ml.*;
[ "java.io", "java.util", "org.elasticsearch.client" ]
java.io; java.util; org.elasticsearch.client;
1,179,288
String addComment(Comment comment, String apiId) throws APICommentException, APIMgtResourceNotFoundException;
String addComment(Comment comment, String apiId) throws APICommentException, APIMgtResourceNotFoundException;
/** * Add comment for an API * * @param comment the comment text * @param apiId UUID of the API * @return String UUID of the created comment * @throws APICommentException if failed to add a comment * @throws APIMgtResourceNotFoundException if api not found */
Add comment for an API
addComment
{ "repo_name": "Minoli/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.core/src/main/java/org/wso2/carbon/apimgt/core/api/APIStore.java", "license": "apache-2.0", "size": 24087 }
[ "org.wso2.carbon.apimgt.core.exception.APICommentException", "org.wso2.carbon.apimgt.core.exception.APIMgtResourceNotFoundException", "org.wso2.carbon.apimgt.core.models.Comment" ]
import org.wso2.carbon.apimgt.core.exception.APICommentException; import org.wso2.carbon.apimgt.core.exception.APIMgtResourceNotFoundException; import org.wso2.carbon.apimgt.core.models.Comment;
import org.wso2.carbon.apimgt.core.exception.*; import org.wso2.carbon.apimgt.core.models.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,660,791