method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private double getLengthTf(final String sbKu, final GerinneGeschlGemeindeReportDialog.Art art, final Integer from, final Integer till) { final List<SbPartObjGeschl> gemList = gemPartMap.get(sbKu); double length = 0; for (final SbPartObjGeschl tmp : gemList) { if (tmp.getArt().equals(art.name()) && valueBetween(tmp.getTf(), from, till)) { length += tmp.getLength(); } } return length; }
double function(final String sbKu, final GerinneGeschlGemeindeReportDialog.Art art, final Integer from, final Integer till) { final List<SbPartObjGeschl> gemList = gemPartMap.get(sbKu); double length = 0; for (final SbPartObjGeschl tmp : gemList) { if (tmp.getArt().equals(art.name()) && valueBetween(tmp.getTf(), from, till)) { length += tmp.getLength(); } } return length; }
/** * DOCUMENT ME! * * @param sbKu DOCUMENT ME! * @param art DOCUMENT ME! * @param from DOCUMENT ME! * @param till DOCUMENT ME! * * @return DOCUMENT ME! */
DOCUMENT ME
getLengthTf
{ "repo_name": "cismet/watergis-client", "path": "src/main/java/de/cismet/watergis/reports/GerinneGSbReport.java", "license": "lgpl-3.0", "size": 87145 }
[ "de.cismet.watergis.gui.dialog.GerinneGeschlGemeindeReportDialog", "de.cismet.watergis.reports.types.SbPartObjGeschl", "java.util.List" ]
import de.cismet.watergis.gui.dialog.GerinneGeschlGemeindeReportDialog; import de.cismet.watergis.reports.types.SbPartObjGeschl; import java.util.List;
import de.cismet.watergis.gui.dialog.*; import de.cismet.watergis.reports.types.*; import java.util.*;
[ "de.cismet.watergis", "java.util" ]
de.cismet.watergis; java.util;
2,254,503
private ServiceComponentHostRequest getRequest(Map<String, Object> properties) { ServiceComponentHostRequest serviceComponentHostRequest = new ServiceComponentHostRequest( (String) properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID)); serviceComponentHostRequest.setState((String) properties.get(HOST_COMPONENT_STATE_PROPERTY_ID)); serviceComponentHostRequest.setDesiredStackId((String) properties.get(HOST_COMPONENT_STACK_ID_PROPERTY_ID)); if (properties.get(HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID) != null) { serviceComponentHostRequest.setStaleConfig( properties.get(HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID).toString().toLowerCase()); } if (properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID) != null) { serviceComponentHostRequest.setAdminState( properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID).toString()); } Object o = properties.get(HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID); if (null != o) { serviceComponentHostRequest.setMaintenanceState (o.toString()); } return serviceComponentHostRequest; }
ServiceComponentHostRequest function(Map<String, Object> properties) { ServiceComponentHostRequest serviceComponentHostRequest = new ServiceComponentHostRequest( (String) properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID), (String) properties.get(HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID)); serviceComponentHostRequest.setState((String) properties.get(HOST_COMPONENT_STATE_PROPERTY_ID)); serviceComponentHostRequest.setDesiredStackId((String) properties.get(HOST_COMPONENT_STACK_ID_PROPERTY_ID)); if (properties.get(HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID) != null) { serviceComponentHostRequest.setStaleConfig( properties.get(HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID).toString().toLowerCase()); } if (properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID) != null) { serviceComponentHostRequest.setAdminState( properties.get(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID).toString()); } Object o = properties.get(HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID); if (null != o) { serviceComponentHostRequest.setMaintenanceState (o.toString()); } return serviceComponentHostRequest; }
/** * Get a component request object from a map of property values. * * @param properties the predicate * @return the component request object */
Get a component request object from a map of property values
getRequest
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java", "license": "apache-2.0", "size": 44721 }
[ "java.util.Map", "org.apache.ambari.server.controller.ServiceComponentHostRequest" ]
import java.util.Map; import org.apache.ambari.server.controller.ServiceComponentHostRequest;
import java.util.*; import org.apache.ambari.server.controller.*;
[ "java.util", "org.apache.ambari" ]
java.util; org.apache.ambari;
2,240,896
private void readMetadata() { Log.v(TAG_METADONNEES, "Lecture des metadonnees ..."); File f = new File(cheminPhoto); if (f.exists()) { // on recupere les metaDonnees exif ExifInterface ei; try { ei = new ExifInterface(cheminPhoto); Log.v(TAG_METADONNEES, TAG_USER_COMMENT + " -> " + ei.getAttribute(TAG_USER_COMMENT)); Log.v(TAG_METADONNEES, ExifInterface.TAG_GPS_LATITUDE + " -> " + ei.getAttribute(ExifInterface.TAG_GPS_LATITUDE)); Log.v(TAG_METADONNEES, ExifInterface.TAG_GPS_LONGITUDE + " -> " + ei.getAttribute(ExifInterface.TAG_GPS_LONGITUDE)); } catch (IOException e) { Log.e(TAG_METADONNEES, "Erreur lecture metadonnees : " + e.getMessage()); e.printStackTrace(); } } else { Log.w(TAG, "Le fichier " + cheminPhoto + " n'existe pas. Impossible de creer les metadonnees."); } }
void function() { Log.v(TAG_METADONNEES, STR); File f = new File(cheminPhoto); if (f.exists()) { ExifInterface ei; try { ei = new ExifInterface(cheminPhoto); Log.v(TAG_METADONNEES, TAG_USER_COMMENT + STR + ei.getAttribute(TAG_USER_COMMENT)); Log.v(TAG_METADONNEES, ExifInterface.TAG_GPS_LATITUDE + STR + ei.getAttribute(ExifInterface.TAG_GPS_LATITUDE)); Log.v(TAG_METADONNEES, ExifInterface.TAG_GPS_LONGITUDE + STR + ei.getAttribute(ExifInterface.TAG_GPS_LONGITUDE)); } catch (IOException e) { Log.e(TAG_METADONNEES, STR + e.getMessage()); e.printStackTrace(); } } else { Log.w(TAG, STR + cheminPhoto + STR); } }
/** * Lit les metadonnees de la photo qui viens d'etre cree (pour debugage) */
Lit les metadonnees de la photo qui viens d'etre cree (pour debugage)
readMetadata
{ "repo_name": "LeGrandManitou/LocaPic", "path": "src/fr/rt/acy/locapic/camera/CameraActivity.java", "license": "gpl-3.0", "size": 27731 }
[ "android.media.ExifInterface", "android.util.Log", "java.io.File", "java.io.IOException" ]
import android.media.ExifInterface; import android.util.Log; import java.io.File; import java.io.IOException;
import android.media.*; import android.util.*; import java.io.*;
[ "android.media", "android.util", "java.io" ]
android.media; android.util; java.io;
2,750,526
public static SubscriptionListDTO fromUserApplicationAPIUsageArrayToDTO(UserApplicationAPIUsage[] allApiUsage, Integer limit, Integer offset) { List<SubscribedAPI> subscribedAPIs = new ArrayList<>(); for (UserApplicationAPIUsage usage : allApiUsage) { Collections.addAll(subscribedAPIs, usage.getApiSubscriptions()); } return fromSubscriptionListToDTO(subscribedAPIs, limit, offset); }
static SubscriptionListDTO function(UserApplicationAPIUsage[] allApiUsage, Integer limit, Integer offset) { List<SubscribedAPI> subscribedAPIs = new ArrayList<>(); for (UserApplicationAPIUsage usage : allApiUsage) { Collections.addAll(subscribedAPIs, usage.getApiSubscriptions()); } return fromSubscriptionListToDTO(subscribedAPIs, limit, offset); }
/** * Converts a UserApplicationAPIUsage[] array to a corresponding SubscriptionListDTO * * @param allApiUsage array of UserApplicationAPIUsage * @param limit max number of objects returned * @param offset starting index * @return a dto containing all subscriptions */
Converts a UserApplicationAPIUsage[] array to a corresponding SubscriptionListDTO
fromUserApplicationAPIUsageArrayToDTO
{ "repo_name": "bhathiya/test", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/utils/mappings/SubscriptionMappingUtil.java", "license": "apache-2.0", "size": 7887 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.List", "org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage", "org.wso2.carbon.apimgt.api.model.SubscribedAPI", "org.wso2.carbon.apimgt.rest.api.publisher.dto.SubscriptionListDTO" ]
import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.wso2.carbon.apimgt.api.dto.UserApplicationAPIUsage; import org.wso2.carbon.apimgt.api.model.SubscribedAPI; import org.wso2.carbon.apimgt.rest.api.publisher.dto.SubscriptionListDTO;
import java.util.*; import org.wso2.carbon.apimgt.api.dto.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.rest.api.publisher.dto.*;
[ "java.util", "org.wso2.carbon" ]
java.util; org.wso2.carbon;
1,150,966
public Future<UpdateCenterJob> submit() { LOGGER.fine("Scheduling "+this+" to installerService"); jobs.add(this); return installerService.submit(this,this); } } public final class ConnectionCheckJob extends UpdateCenterJob { private final Vector<String> statuses= new Vector<String>(); public ConnectionCheckJob(UpdateSite site) { super(site); }
Future<UpdateCenterJob> function() { LOGGER.fine(STR+this+STR); jobs.add(this); return installerService.submit(this,this); } } public final class ConnectionCheckJob extends UpdateCenterJob { private final Vector<String> statuses= new Vector<String>(); public ConnectionCheckJob(UpdateSite site) { super(site); }
/** * Schedules this job for an execution * @return * {@link Future} to keeps track of the status of the execution. */
Schedules this job for an execution
submit
{ "repo_name": "vivek/hudson", "path": "core/src/main/java/hudson/model/UpdateCenter.java", "license": "mit", "size": 33444 }
[ "java.util.Vector", "java.util.concurrent.Future" ]
import java.util.Vector; import java.util.concurrent.Future;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,380,751
@Override public Temporal subtractFrom(Temporal temporal) { // special case for performance if (temporal instanceof LocalDate) { LocalDate date = (LocalDate) temporal; return plusDays(date.minusMonths(period.toTotalMonths()), -period.getDays()); } return period.subtractFrom(temporal); }
Temporal function(Temporal temporal) { if (temporal instanceof LocalDate) { LocalDate date = (LocalDate) temporal; return plusDays(date.minusMonths(period.toTotalMonths()), -period.getDays()); } return period.subtractFrom(temporal); }
/** * Subtracts this tenor from the specified date. * <p> * This method implements {@link TemporalAmount}. * It is not intended to be called directly. * Use {@link LocalDate#minus(TemporalAmount)} instead. * * @param temporal the temporal object to subtract from * @return the result with this tenor subtracted * @throws DateTimeException if unable to subtract * @throws ArithmeticException if numeric overflow occurs */
Subtracts this tenor from the specified date. This method implements <code>TemporalAmount</code>. It is not intended to be called directly. Use <code>LocalDate#minus(TemporalAmount)</code> instead
subtractFrom
{ "repo_name": "nssales/Strata", "path": "modules/basics/src/main/java/com/opengamma/strata/basics/date/Tenor.java", "license": "apache-2.0", "size": 13612 }
[ "com.opengamma.strata.basics.date.LocalDateUtils", "java.time.LocalDate", "java.time.temporal.Temporal" ]
import com.opengamma.strata.basics.date.LocalDateUtils; import java.time.LocalDate; import java.time.temporal.Temporal;
import com.opengamma.strata.basics.date.*; import java.time.*; import java.time.temporal.*;
[ "com.opengamma.strata", "java.time" ]
com.opengamma.strata; java.time;
1,983,771
public void setQty (BigDecimal Qty) { set_ValueNoCheck (COLUMNNAME_Qty, Qty); }
void function (BigDecimal Qty) { set_ValueNoCheck (COLUMNNAME_Qty, Qty); }
/** Set Quantity. @param Qty Quantity */
Set Quantity
setQty
{ "repo_name": "itzamnamx/AdempiereFS", "path": "base/src/org/compiere/model/X_S_ResourceAssignment.java", "license": "gpl-2.0", "size": 6672 }
[ "java.math.BigDecimal" ]
import java.math.BigDecimal;
import java.math.*;
[ "java.math" ]
java.math;
2,787,051
public T caseMOSSupportedOSAPI(MOSSupportedOSAPI object) { return null; }
T function(MOSSupportedOSAPI object) { return null; }
/** * Returns the result of interpreting the object as an instance of '<em>MOSSupportedOSAPI</em>'. * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>MOSSupportedOSAPI</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */
Returns the result of interpreting the object as an instance of 'MOSSupportedOSAPI'
caseMOSSupportedOSAPI
{ "repo_name": "parraman/micobs", "path": "common/es.uah.aut.srg.micobs.pdl/src/es/uah/aut/srg/micobs/pdl/util/pdlSwitch.java", "license": "epl-1.0", "size": 33881 }
[ "es.uah.aut.srg.micobs.pdl.MOSSupportedOSAPI" ]
import es.uah.aut.srg.micobs.pdl.MOSSupportedOSAPI;
import es.uah.aut.srg.micobs.pdl.*;
[ "es.uah.aut" ]
es.uah.aut;
1,594,767
public void setObservedDate(Date value) { try { entity.setObservedDate(value); } catch(Exception ex) { hasError = true; } }
void function(Date value) { try { entity.setObservedDate(value); } catch(Exception ex) { hasError = true; } }
/** * Setter for observedDate. * * @param value the value to set */
Setter for observedDate
setObservedDate
{ "repo_name": "OSEHRA/HealtheMe", "path": "src/main/java/com/krminc/phr/api/vitals/converter/HeartRateConverter.java", "license": "apache-2.0", "size": 8488 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,165,961
public boolean put(PutAction putAction) { HTableInterface table = pool.getTable(tableName); try { return put(putAction, table); } finally { if (table != null) { try { table.close(); } catch (IOException e) { throw new DatasetIOException("Error putting table back into pool", e); } } } }
boolean function(PutAction putAction) { HTableInterface table = pool.getTable(tableName); try { return put(putAction, table); } finally { if (table != null) { try { table.close(); } catch (IOException e) { throw new DatasetIOException(STR, e); } } } }
/** * Execute a Put on HBase. * * Any PutModifers registered with registerPutModifier will be invoked before * the Put is executed. * * @param putAction * The put to execute on HBase. * @return True if the put succeeded, False if the put failed due to update * conflict */
Execute a Put on HBase. Any PutModifers registered with registerPutModifier will be invoked before the Put is executed
put
{ "repo_name": "stevek-ngdata/kite", "path": "kite-data/kite-data-hbase/src/main/java/org/kitesdk/data/hbase/impl/HBaseClientTemplate.java", "license": "apache-2.0", "size": 22432 }
[ "java.io.IOException", "org.apache.hadoop.hbase.client.HTableInterface", "org.kitesdk.data.DatasetIOException" ]
import java.io.IOException; import org.apache.hadoop.hbase.client.HTableInterface; import org.kitesdk.data.DatasetIOException;
import java.io.*; import org.apache.hadoop.hbase.client.*; import org.kitesdk.data.*;
[ "java.io", "org.apache.hadoop", "org.kitesdk.data" ]
java.io; org.apache.hadoop; org.kitesdk.data;
2,435,865
@Message(id = 343, value = "Cannot invoke timeout method because method %s is not a timeout method") RuntimeException failToInvokeTimeout(Method method);
@Message(id = 343, value = STR) RuntimeException failToInvokeTimeout(Method method);
/** * Creates an exception indicating it cannot invoke timeout method * * @return an {@link RuntimeException} for the error. */
Creates an exception indicating it cannot invoke timeout method
failToInvokeTimeout
{ "repo_name": "golovnin/wildfly", "path": "ejb3/src/main/java/org/jboss/as/ejb3/logging/EjbLogger.java", "license": "lgpl-2.1", "size": 147179 }
[ "java.lang.reflect.Method", "org.jboss.logging.annotations.Message" ]
import java.lang.reflect.Method; import org.jboss.logging.annotations.Message;
import java.lang.reflect.*; import org.jboss.logging.annotations.*;
[ "java.lang", "org.jboss.logging" ]
java.lang; org.jboss.logging;
1,150,702
void handleVersionNotification(Matcher m, String resp) { if (m == null) { throw new IllegalArgumentException("m (matcher) cannot be null"); } if (m.groupCount() == 1) { final String version = m.group(1); setProperty(RioConstants.PROPERTY_SYSVERSION, version); } else { logger.warn("Invalid System Notification response: '{}'", resp); } }
void handleVersionNotification(Matcher m, String resp) { if (m == null) { throw new IllegalArgumentException(STR); } if (m.groupCount() == 1) { final String version = m.group(1); setProperty(RioConstants.PROPERTY_SYSVERSION, version); } else { logger.warn(STR, resp); } }
/** * Handles the version notification * * @param m a non-null matcher * @param resp a possibly null, possibly empty response */
Handles the version notification
handleVersionNotification
{ "repo_name": "georgeerhan/openhab2-addons", "path": "addons/binding/org.openhab.binding.russound/src/main/java/org/openhab/binding/russound/internal/rio/system/RioSystemProtocol.java", "license": "epl-1.0", "size": 8711 }
[ "java.util.regex.Matcher", "org.openhab.binding.russound.internal.rio.RioConstants" ]
import java.util.regex.Matcher; import org.openhab.binding.russound.internal.rio.RioConstants;
import java.util.regex.*; import org.openhab.binding.russound.internal.rio.*;
[ "java.util", "org.openhab.binding" ]
java.util; org.openhab.binding;
2,147,438
public static void configureClientForPromptNoneAuthorizationRequest(final CasClient casClient, final WebContext context) { final Set<String> prompts = getOidcPromptFromAuthorizationRequest(context); if (prompts.contains(OidcConstants.PROMPT_NONE)) { casClient.getConfiguration().setRenew(false); casClient.getConfiguration().setGateway(true); } }
static void function(final CasClient casClient, final WebContext context) { final Set<String> prompts = getOidcPromptFromAuthorizationRequest(context); if (prompts.contains(OidcConstants.PROMPT_NONE)) { casClient.getConfiguration().setRenew(false); casClient.getConfiguration().setGateway(true); } }
/** * Configure client for prompt none authorization request. * * @param casClient the cas client * @param context the context */
Configure client for prompt none authorization request
configureClientForPromptNoneAuthorizationRequest
{ "repo_name": "dodok1/cas", "path": "support/cas-server-support-oidc/src/main/java/org/apereo/cas/oidc/util/OidcAuthorizationRequestSupport.java", "license": "apache-2.0", "size": 8211 }
[ "java.util.Set", "org.apereo.cas.oidc.OidcConstants", "org.pac4j.cas.client.CasClient", "org.pac4j.core.context.WebContext" ]
import java.util.Set; import org.apereo.cas.oidc.OidcConstants; import org.pac4j.cas.client.CasClient; import org.pac4j.core.context.WebContext;
import java.util.*; import org.apereo.cas.oidc.*; import org.pac4j.cas.client.*; import org.pac4j.core.context.*;
[ "java.util", "org.apereo.cas", "org.pac4j.cas", "org.pac4j.core" ]
java.util; org.apereo.cas; org.pac4j.cas; org.pac4j.core;
2,608,794
@Deprecated public static void dragViewToTop(ActivityInstrumentationTestCase test, View v, int stepCount) { dragViewToTop((InstrumentationTestCase) test, v, stepCount); }
static void function(ActivityInstrumentationTestCase test, View v, int stepCount) { dragViewToTop((InstrumentationTestCase) test, v, stepCount); }
/** * Simulate touching the center of a view and dragging to the top of the screen. * * @param test The test case that is being run * @param v The view that should be dragged * @param stepCount How many move steps to include in the drag * * @deprecated {@link android.test.ActivityInstrumentationTestCase} is deprecated in favor of * {@link android.test.ActivityInstrumentationTestCase2}, which provides more options for * configuring the Activity under test */
Simulate touching the center of a view and dragging to the top of the screen
dragViewToTop
{ "repo_name": "Ant-Droid/android_frameworks_base_OLD", "path": "test-runner/src/android/test/TouchUtils.java", "license": "apache-2.0", "size": 32074 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,707,083
@Test public void externalFunctionThreeArguments() throws Exception { List<String> text = new ArrayList<>(); String json = TestUtils.getJsonString("inkfiles/runtime/external-function-3-arg.ink.json"); final Story story = new Story(json); story.bindExternalFunction("externalFunction", new ExternalFunction3<Integer, Integer, Integer, Integer>() {
void function() throws Exception { List<String> text = new ArrayList<>(); String json = TestUtils.getJsonString(STR); final Story story = new Story(json); story.bindExternalFunction(STR, new ExternalFunction3<Integer, Integer, Integer, Integer>() {
/** * Test external function three arguments call. */
Test external function three arguments call
externalFunctionThreeArguments
{ "repo_name": "bladecoder/blade-ink", "path": "src/test/java/com/bladecoder/ink/runtime/test/RuntimeSpecTest.java", "license": "mit", "size": 13237 }
[ "com.bladecoder.ink.runtime.Story", "java.util.ArrayList", "java.util.List" ]
import com.bladecoder.ink.runtime.Story; import java.util.ArrayList; import java.util.List;
import com.bladecoder.ink.runtime.*; import java.util.*;
[ "com.bladecoder.ink", "java.util" ]
com.bladecoder.ink; java.util;
1,186,251
private void testByteStreamInsert(Connection c) throws Exception { BufferedInputStream bIn = new BufferedInputStream(new FileInputStream( testBlobFile)); this.pstmt = c .prepareStatement("INSERT INTO BLOBTEST(blobdata) VALUES (?)"); this.pstmt.setBinaryStream(1, bIn, (int) testBlobFile.length()); this.pstmt.execute(); this.pstmt.clearParameters(); doRetrieval(); }
void function(Connection c) throws Exception { BufferedInputStream bIn = new BufferedInputStream(new FileInputStream( testBlobFile)); this.pstmt = c .prepareStatement(STR); this.pstmt.setBinaryStream(1, bIn, (int) testBlobFile.length()); this.pstmt.execute(); this.pstmt.clearParameters(); doRetrieval(); }
/** * Tests inserting blob data as a stream * * @throws Exception * if an error occurs */
Tests inserting blob data as a stream
testByteStreamInsert
{ "repo_name": "seadsystem/SchemaSpy", "path": "src/testsuite/simple/BlobTest.java", "license": "gpl-2.0", "size": 6881 }
[ "java.io.BufferedInputStream", "java.io.FileInputStream", "java.sql.Connection" ]
import java.io.BufferedInputStream; import java.io.FileInputStream; import java.sql.Connection;
import java.io.*; import java.sql.*;
[ "java.io", "java.sql" ]
java.io; java.sql;
123,062
public void setDb4oService(Db4oService s) { db4oService = s; }
void function(Db4oService s) { db4oService = s; }
/** * We use the Db4oService to persist the program data. * * @param s A Db4oService instance. */
We use the Db4oService to persist the program data
setDb4oService
{ "repo_name": "djb61230/jflicks", "path": "src/org/jflicks/tv/programdata/sd/SchedulesDirectProgramData.java", "license": "gpl-3.0", "size": 32300 }
[ "com.db4o.osgi.Db4oService" ]
import com.db4o.osgi.Db4oService;
import com.db4o.osgi.*;
[ "com.db4o.osgi" ]
com.db4o.osgi;
1,759,861
public List<T> execute(long p1, @Nullable Map<?, ?> context) throws DataAccessException { return execute(new Object[] {p1}, context); }
List<T> function(long p1, @Nullable Map<?, ?> context) throws DataAccessException { return execute(new Object[] {p1}, context); }
/** * Convenient method to execute with a single long parameter and context. * @param p1 single long parameter * @param context the contextual information for object creation */
Convenient method to execute with a single long parameter and context
execute
{ "repo_name": "spring-projects/spring-framework", "path": "spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java", "license": "apache-2.0", "size": 13613 }
[ "java.util.List", "java.util.Map", "org.springframework.dao.DataAccessException", "org.springframework.lang.Nullable" ]
import java.util.List; import java.util.Map; import org.springframework.dao.DataAccessException; import org.springframework.lang.Nullable;
import java.util.*; import org.springframework.dao.*; import org.springframework.lang.*;
[ "java.util", "org.springframework.dao", "org.springframework.lang" ]
java.util; org.springframework.dao; org.springframework.lang;
822,555
void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException; /** * Save the steps data into a Kettle repository * * @param rep * The Kettle repository to save to * @param id_transformation * The transformation ID * @param id_step * The step ID * @throws KettleException * When an unexpected error occurred (database, network, etc) * @deprecated use {@link #saveRep(Repository, IMetaStore, ObjectId, ObjectId)}
void loadXML( Node stepnode, List<DatabaseMeta> databases, IMetaStore metaStore ) throws KettleXMLException; /** * Save the steps data into a Kettle repository * * @param rep * The Kettle repository to save to * @param id_transformation * The transformation ID * @param id_step * The step ID * @throws KettleException * When an unexpected error occurred (database, network, etc) * @deprecated use {@link #saveRep(Repository, IMetaStore, ObjectId, ObjectId)}
/** * Load the values for this step from an XML Node * * @param stepnode * the Node to get the info from * @param databases * The available list of databases to reference to * @param metaStore * the metastore to optionally load external reference metadata from * @throws KettleXMLException * When an unexpected XML error occurred. (malformed etc.) */
Load the values for this step from an XML Node
loadXML
{ "repo_name": "emartin-pentaho/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/step/StepMetaInterface.java", "license": "apache-2.0", "size": 31504 }
[ "java.util.List", "org.pentaho.di.core.database.DatabaseMeta", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.core.exception.KettleXMLException", "org.pentaho.di.repository.ObjectId", "org.pentaho.di.repository.Repository", "org.pentaho.metastore.api.IMetaStore", "org.w3c.dom.Node" ]
import java.util.List; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.repository.ObjectId; import org.pentaho.di.repository.Repository; import org.pentaho.metastore.api.IMetaStore; import org.w3c.dom.Node;
import java.util.*; import org.pentaho.di.core.database.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.repository.*; import org.pentaho.metastore.api.*; import org.w3c.dom.*;
[ "java.util", "org.pentaho.di", "org.pentaho.metastore", "org.w3c.dom" ]
java.util; org.pentaho.di; org.pentaho.metastore; org.w3c.dom;
309,588
double getGaugeDouble(String name, BaseSource source);
double getGaugeDouble(String name, BaseSource source);
/** * Get the value of a gauge as a double. * * @param name name of the gauge. * @param source The BaseSource{@link BaseSource} that will provide the tags, * gauges, and counters. * @return double value of the gauge. */
Get the value of a gauge as a double
getGaugeDouble
{ "repo_name": "ultratendency/hbase", "path": "hbase-hadoop-compat/src/test/java/org/apache/hadoop/hbase/test/MetricsAssertHelper.java", "license": "apache-2.0", "size": 6630 }
[ "org.apache.hadoop.hbase.metrics.BaseSource" ]
import org.apache.hadoop.hbase.metrics.BaseSource;
import org.apache.hadoop.hbase.metrics.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
982,689
public final StyleableProperty<Paint> createStyleablePaintProperty( S styleable, String propertyName, String cssProperty, Function<S, StyleableProperty<Paint>> function) { return createStyleablePaintProperty(styleable, propertyName, cssProperty, function, Color.BLACK, false); }
final StyleableProperty<Paint> function( S styleable, String propertyName, String cssProperty, Function<S, StyleableProperty<Paint>> function) { return createStyleablePaintProperty(styleable, propertyName, cssProperty, function, Color.BLACK, false); }
/** * Create a StyleableProperty&lt;Paint&gt;. The initial value defautls to Color.BLACK and the inherit flag defaults to false. * @param styleable The <code>this</code> reference of the returned property. This is also the property bean. * @param propertyName The field name of the StyleableProperty&lt;Paint&gt; * @param cssProperty The CSS property name * @param function A function that returns the StyleableProperty&lt;Paint&gt; that was created by this method call. * @return a StyleableProperty created with initial value and false inherit flag */
Create a StyleableProperty&lt;Paint&gt;. The initial value defautls to Color.BLACK and the inherit flag defaults to false
createStyleablePaintProperty
{ "repo_name": "teamfx/openjfx-10-dev-rt", "path": "modules/javafx.graphics/src/main/java/javafx/css/StyleablePropertyFactory.java", "license": "gpl-2.0", "size": 113819 }
[ "java.util.function.Function" ]
import java.util.function.Function;
import java.util.function.*;
[ "java.util" ]
java.util;
2,398,592
public static IAST Less(final IExpr x, final int y) { return new B2.Less(x, ZZ(y)); }
static IAST function(final IExpr x, final int y) { return new B2.Less(x, ZZ(y)); }
/** * Yields {@link S#True} if <code>x</code> is known to be less than <code>y</code>. * * <p> * See: <a href= * "https://raw.githubusercontent.com/axkr/symja_android_library/master/symja_android_library/doc/functions/Less.md">Less</a> * * @param x * @param y * @return */
Yields <code>S#True</code> if <code>x</code> is known to be less than <code>y</code>. See: Less
Less
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java", "license": "gpl-3.0", "size": 283472 }
[ "org.matheclipse.core.interfaces.IExpr" ]
import org.matheclipse.core.interfaces.IExpr;
import org.matheclipse.core.interfaces.*;
[ "org.matheclipse.core" ]
org.matheclipse.core;
140,821
public static org.fcrepo.server.types.gen.MethodParmDef convertMethodParmDefToGenMethodParmDef( org.fcrepo.server.storage.types.MethodParmDef methodParmDef) { if (methodParmDef != null) { org.fcrepo.server.types.gen.MethodParmDef genMethodParmDef = new org.fcrepo.server.types.gen.MethodParmDef(); genMethodParmDef.setParmName(methodParmDef.parmName); genMethodParmDef.setParmLabel(methodParmDef.parmLabel); genMethodParmDef .setParmDefaultValue(methodParmDef.parmDefaultValue); genMethodParmDef .setParmDomainValues(methodParmDef.parmDomainValues); genMethodParmDef.setParmRequired(methodParmDef.parmRequired); genMethodParmDef.setParmType(methodParmDef.parmType); genMethodParmDef.setParmPassBy(methodParmDef.parmPassBy); return genMethodParmDef; } else { return null; } }
static org.fcrepo.server.types.gen.MethodParmDef function( org.fcrepo.server.storage.types.MethodParmDef methodParmDef) { if (methodParmDef != null) { org.fcrepo.server.types.gen.MethodParmDef genMethodParmDef = new org.fcrepo.server.types.gen.MethodParmDef(); genMethodParmDef.setParmName(methodParmDef.parmName); genMethodParmDef.setParmLabel(methodParmDef.parmLabel); genMethodParmDef .setParmDefaultValue(methodParmDef.parmDefaultValue); genMethodParmDef .setParmDomainValues(methodParmDef.parmDomainValues); genMethodParmDef.setParmRequired(methodParmDef.parmRequired); genMethodParmDef.setParmType(methodParmDef.parmType); genMethodParmDef.setParmPassBy(methodParmDef.parmPassBy); return genMethodParmDef; } else { return null; } }
/** * <p> * Converts an instance of org.fcrepo.server.storage.types.MethodParmDef into an * instance of org.fcrepo.server.types.gen.MethodParmDef. * </p> * * @param methodParmDef An instance of org.fcrepo.server.storage.types.MethodParmDef. * @return An instance of org.fcrepo.server.types.gen.MethodParmDef. */
Converts an instance of org.fcrepo.server.storage.types.MethodParmDef into an instance of org.fcrepo.server.types.gen.MethodParmDef.
convertMethodParmDefToGenMethodParmDef
{ "repo_name": "DBCDK/fcrepo-3.5-patched", "path": "fcrepo-server/src/main/java/org/fcrepo/server/utilities/TypeUtility.java", "license": "apache-2.0", "size": 58787 }
[ "org.fcrepo.server.storage.types.MethodParmDef" ]
import org.fcrepo.server.storage.types.MethodParmDef;
import org.fcrepo.server.storage.types.*;
[ "org.fcrepo.server" ]
org.fcrepo.server;
17,242
public Model getModel(int index) { return this.models.get(index); }
Model function(int index) { return this.models.get(index); }
/** * Getter method for embedded models * * @param index * the number of a model part of this boost model * @return binary or nominal decision model */
Getter method for embedded models
getModel
{ "repo_name": "boob-sbcm/3838438", "path": "src/main/java/com/rapidminer/operator/learner/meta/BaggingModel.java", "license": "agpl-3.0", "size": 7360 }
[ "com.rapidminer.operator.Model" ]
import com.rapidminer.operator.Model;
import com.rapidminer.operator.*;
[ "com.rapidminer.operator" ]
com.rapidminer.operator;
121,467
public final boolean updatePlayer() { if ((player == null) || !player.isOnline()) { player = L2World.getInstance().getPlayer(getObjectId()); } return (player != null); }
final boolean function() { if ((player == null) !player.isOnline()) { player = L2World.getInstance().getPlayer(getObjectId()); } return (player != null); }
/** * Updates the reference to {@link #player}, if it's null or appears off-line. * @return {@code true} if after the update the player isn't null, {@code false} otherwise. */
Updates the reference to <code>#player</code>, if it's null or appears off-line
updatePlayer
{ "repo_name": "rubenswagner/L2J-Global", "path": "java/com/l2jglobal/gameserver/model/olympiad/Participant.java", "license": "gpl-3.0", "size": 3646 }
[ "com.l2jglobal.gameserver.model.L2World" ]
import com.l2jglobal.gameserver.model.L2World;
import com.l2jglobal.gameserver.model.*;
[ "com.l2jglobal.gameserver" ]
com.l2jglobal.gameserver;
168,253
public void contextDestroyed(ServletContextEvent sce) { ServletContext sc = sce.getServletContext(); HWISessionManager hs = (HWISessionManager) sc.getAttribute("hs"); if (hs == null) { l4j.error("HWISessionManager was not found in context"); } else { l4j.error("HWISessionManager goOn set to false. Shutting down."); hs.setGoOn(false); } }
void function(ServletContextEvent sce) { ServletContext sc = sce.getServletContext(); HWISessionManager hs = (HWISessionManager) sc.getAttribute("hs"); if (hs == null) { l4j.error(STR); } else { l4j.error(STR); hs.setGoOn(false); } }
/** * When the Hive Web Interface is closing we locate the Runnable * HiveSessionManager and set it's internal goOn variable to false. This * should allow the application to gracefully shutdown. * * @param sce * An event fired by the servlet context on context shutdown */
When the Hive Web Interface is closing we locate the Runnable HiveSessionManager and set it's internal goOn variable to false. This should allow the application to gracefully shutdown
contextDestroyed
{ "repo_name": "BUPTAnderson/apache-hive-2.1.1-src", "path": "hwi/src/java/org/apache/hadoop/hive/hwi/HWIContextListener.java", "license": "apache-2.0", "size": 2658 }
[ "javax.servlet.ServletContext", "javax.servlet.ServletContextEvent" ]
import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
2,573,235
public ItemStack getCurrentEquippedItem() { return this.inventory.getCurrentItem(); }
ItemStack function() { return this.inventory.getCurrentItem(); }
/** * Returns the currently being used item by the player. */
Returns the currently being used item by the player
getCurrentEquippedItem
{ "repo_name": "dogjaw2233/tiu-s-mod", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/player/EntityPlayer.java", "license": "lgpl-2.1", "size": 90554 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,377,879
public QueryBuilder groupBy(final Optional<List<String>> groupBy) { checkNotNull(groupBy, "groupBy must not be null"); this.groupBy = pickOptional(this.groupBy, groupBy); return this; }
QueryBuilder function(final Optional<List<String>> groupBy) { checkNotNull(groupBy, STR); this.groupBy = pickOptional(this.groupBy, groupBy); return this; }
/** * Specify a group by to use. * * @deprecated Use {@link #aggregation(AggregationInstance)} with the appropriate * {@link GroupInstance} instead. */
Specify a group by to use
groupBy
{ "repo_name": "udoprog/heroic", "path": "heroic-component/src/main/java/com/spotify/heroic/QueryBuilder.java", "license": "apache-2.0", "size": 5859 }
[ "com.google.common.base.Preconditions", "com.spotify.heroic.common.Optionals", "java.util.List", "java.util.Optional" ]
import com.google.common.base.Preconditions; import com.spotify.heroic.common.Optionals; import java.util.List; import java.util.Optional;
import com.google.common.base.*; import com.spotify.heroic.common.*; import java.util.*;
[ "com.google.common", "com.spotify.heroic", "java.util" ]
com.google.common; com.spotify.heroic; java.util;
2,069,707
public void loadExistingFile() { final Visualizer visualizer = getVisualizer(); if (visualizer == null) { return; // No point reading the file if there's no visualiser } boolean parsedOK = false; String filename = getFilename(); File file = new File(filename); if (file.exists()) { BufferedReader dataReader = null; BufferedInputStream bufferedInputStream = null; try { dataReader = new BufferedReader(new FileReader(file)); // TODO Charset ? // Get the first line, and see if it is XML String line = dataReader.readLine(); dataReader.close(); dataReader = null; if (line == null) { log.warn(filename+" is empty"); } else { if (!line.startsWith("<?xml ")){// No, must be CSV //$NON-NLS-1$ CSVSaveService.processSamples(filename, visualizer, this); parsedOK = true; } else { // We are processing XML try { // Assume XStream bufferedInputStream = new BufferedInputStream(new FileInputStream(file)); SaveService.loadTestResults(bufferedInputStream, new ResultCollectorHelper(this, visualizer)); parsedOK = true; } catch (ConversionException e) { final String message = e.getShortMessage(); if (message.startsWith("sampleResult")) { // probably Avalon format log.info("Failed to load "+filename+" using XStream. Assuming Avalon format, as message was: "+message); OldSaveService.processSamples(filename, visualizer, this); parsedOK = true; } else { log.warn("Failed to load "+filename+" using XStream. Error was: "+e); } } catch (Exception e) { log.warn("Failed to load "+filename+" using XStream. Error was: "+e); } } } } catch (IOException | JMeterError | RuntimeException | OutOfMemoryError e) { // FIXME Why do we catch OOM ? log.warn("Problem reading JTL file: "+file); } catch (ConfigurationException | SAXException e) { // Avalon only log.warn("Problem reading Avalon JTL file: "+file,e); } finally { JOrphanUtils.closeQuietly(dataReader); JOrphanUtils.closeQuietly(bufferedInputStream); if (!parsedOK) { GuiPackage.showErrorMessage( "Error loading results file - see log file", "Result file loader"); } } } else { GuiPackage.showErrorMessage( "Error loading results file - could not open file", "Result file loader"); } }
void function() { final Visualizer visualizer = getVisualizer(); if (visualizer == null) { return; } boolean parsedOK = false; String filename = getFilename(); File file = new File(filename); if (file.exists()) { BufferedReader dataReader = null; BufferedInputStream bufferedInputStream = null; try { dataReader = new BufferedReader(new FileReader(file)); String line = dataReader.readLine(); dataReader.close(); dataReader = null; if (line == null) { log.warn(filename+STR); } else { if (!line.startsWith(STR)){ CSVSaveService.processSamples(filename, visualizer, this); parsedOK = true; } else { try { bufferedInputStream = new BufferedInputStream(new FileInputStream(file)); SaveService.loadTestResults(bufferedInputStream, new ResultCollectorHelper(this, visualizer)); parsedOK = true; } catch (ConversionException e) { final String message = e.getShortMessage(); if (message.startsWith(STR)) { log.info(STR+filename+STR+message); OldSaveService.processSamples(filename, visualizer, this); parsedOK = true; } else { log.warn(STR+filename+STR+e); } } catch (Exception e) { log.warn(STR+filename+STR+e); } } } } catch (IOException JMeterError RuntimeException OutOfMemoryError e) { log.warn(STR+file); } catch (ConfigurationException SAXException e) { log.warn(STR+file,e); } finally { JOrphanUtils.closeQuietly(dataReader); JOrphanUtils.closeQuietly(bufferedInputStream); if (!parsedOK) { GuiPackage.showErrorMessage( STR, STR); } } } else { GuiPackage.showErrorMessage( STR, STR); } }
/** * Loads an existing sample data (JTL) file. * This can be one of: * <ul> * <li>XStream format</li> * <li>Avalon format</li> * <li>CSV format</li> * </ul> * */
Loads an existing sample data (JTL) file. This can be one of: XStream format Avalon format CSV format
loadExistingFile
{ "repo_name": "ubikfsabbe/jmeter", "path": "src/core/org/apache/jmeter/reporters/ResultCollector.java", "license": "apache-2.0", "size": 24759 }
[ "com.thoughtworks.xstream.converters.ConversionException", "java.io.BufferedInputStream", "java.io.BufferedReader", "java.io.File", "java.io.FileInputStream", "java.io.FileReader", "java.io.IOException", "org.apache.avalon.framework.configuration.ConfigurationException", "org.apache.jmeter.gui.GuiPackage", "org.apache.jmeter.save.CSVSaveService", "org.apache.jmeter.save.OldSaveService", "org.apache.jmeter.save.SaveService", "org.apache.jmeter.visualizers.Visualizer", "org.apache.jorphan.util.JMeterError", "org.apache.jorphan.util.JOrphanUtils", "org.xml.sax.SAXException" ]
import com.thoughtworks.xstream.converters.ConversionException; import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.jmeter.gui.GuiPackage; import org.apache.jmeter.save.CSVSaveService; import org.apache.jmeter.save.OldSaveService; import org.apache.jmeter.save.SaveService; import org.apache.jmeter.visualizers.Visualizer; import org.apache.jorphan.util.JMeterError; import org.apache.jorphan.util.JOrphanUtils; import org.xml.sax.SAXException;
import com.thoughtworks.xstream.converters.*; import java.io.*; import org.apache.avalon.framework.configuration.*; import org.apache.jmeter.gui.*; import org.apache.jmeter.save.*; import org.apache.jmeter.visualizers.*; import org.apache.jorphan.util.*; import org.xml.sax.*;
[ "com.thoughtworks.xstream", "java.io", "org.apache.avalon", "org.apache.jmeter", "org.apache.jorphan", "org.xml.sax" ]
com.thoughtworks.xstream; java.io; org.apache.avalon; org.apache.jmeter; org.apache.jorphan; org.xml.sax;
1,768,119
private SnmpVarBindList makeSnmpGet(SnmpPeer agent, String varDesc) throws Exception { final SnmpVarBindList list = new SnmpVarBindList( "UnitTest varbind list"); // We want to read the "sysDescr" variable. list.addVarBind(varDesc); // Make the SNMP get request and wait for the result. SnmpRequest request = session.snmpGetRequest(agent, null, list); final boolean completed = request.waitForCompletion(10000); // Check for a timeout of the request. assertTrue(completed); // Check if the response contains an error. int errorStatus = request.getErrorStatus(); assertEquals(SnmpDefinitions.snmpRspNoError, errorStatus); // Now we can extract the content of the result. return request.getResponseVarBindList(); }
SnmpVarBindList function(SnmpPeer agent, String varDesc) throws Exception { final SnmpVarBindList list = new SnmpVarBindList( STR); list.addVarBind(varDesc); SnmpRequest request = session.snmpGetRequest(agent, null, list); final boolean completed = request.waitForCompletion(10000); assertTrue(completed); int errorStatus = request.getErrorStatus(); assertEquals(SnmpDefinitions.snmpRspNoError, errorStatus); return request.getResponseVarBindList(); }
/** * Make an SNMP get * * @param agent * The {@link SnmpPeer} from which the OID should be read. * @param varDesc * The textual representation of the OID. * * @return */
Make an SNMP get
makeSnmpGet
{ "repo_name": "gurkerl83/millipede-xtreemfs", "path": "java/servers/test/org/xtreemfs/test/common/monitoring/DIRMonitoringTest.java", "license": "bsd-3-clause", "size": 7281 }
[ "com.sun.management.snmp.SnmpDefinitions", "com.sun.management.snmp.SnmpVarBindList", "com.sun.management.snmp.manager.SnmpPeer", "com.sun.management.snmp.manager.SnmpRequest" ]
import com.sun.management.snmp.SnmpDefinitions; import com.sun.management.snmp.SnmpVarBindList; import com.sun.management.snmp.manager.SnmpPeer; import com.sun.management.snmp.manager.SnmpRequest;
import com.sun.management.snmp.*; import com.sun.management.snmp.manager.*;
[ "com.sun.management" ]
com.sun.management;
49,563
public void link(String username, String devicetype) throws IOException, ApiException { this.username = link(new CreateUserRequest(username, devicetype)); }
void function(String username, String devicetype) throws IOException, ApiException { this.username = link(new CreateUserRequest(username, devicetype)); }
/** * Link with bridge using the specified username and device type. * * @param username username for new user [10..40] * @param devicetype identifier of application [0..40] * @throws LinkButtonException thrown if the bridge button has not been pressed */
Link with bridge using the specified username and device type
link
{ "repo_name": "vkolotov/smarthome", "path": "extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/internal/HueBridge.java", "license": "epl-1.0", "size": 33272 }
[ "java.io.IOException", "org.eclipse.smarthome.binding.hue.internal.exceptions.ApiException" ]
import java.io.IOException; import org.eclipse.smarthome.binding.hue.internal.exceptions.ApiException;
import java.io.*; import org.eclipse.smarthome.binding.hue.internal.exceptions.*;
[ "java.io", "org.eclipse.smarthome" ]
java.io; org.eclipse.smarthome;
1,116,967
public void setTrashed(boolean trashed) { if (trashed) { this.getCategories().add(Labels.TRASHED); this.setExtension(new Deleted()); } else { this.getCategories().remove(Labels.TRASHED); this.removeExtension(Deleted.class); } }
void function(boolean trashed) { if (trashed) { this.getCategories().add(Labels.TRASHED); this.setExtension(new Deleted()); } else { this.getCategories().remove(Labels.TRASHED); this.removeExtension(Deleted.class); } }
/** * Sets the trashed status of this document for the user this feed request * has been authenticated under. * * @param trashed true if the document should be trashed */
Sets the trashed status of this document for the user this feed request has been authenticated under
setTrashed
{ "repo_name": "noushadali/red-piranha", "path": "src/com/google/gdata/data/docs/DocumentListEntry.java", "license": "gpl-2.0", "size": 16219 }
[ "com.google.gdata.data.extensions.Deleted", "com.google.gdata.data.extensions.Labels" ]
import com.google.gdata.data.extensions.Deleted; import com.google.gdata.data.extensions.Labels;
import com.google.gdata.data.extensions.*;
[ "com.google.gdata" ]
com.google.gdata;
653,403
public static void processDirectForward( String path, HttpServletRequest request, HttpServletResponse response) //throws IOException, ServletException { if (logger.isInfoEnabled()) logger.info("processDirectForward(): forward to path: " + path); try { if (path == null || path.equals("")) { logger.error( "Cannot get request dispatcher, the path is empty!"); response.sendError(HttpServletResponse.SC_BAD_REQUEST, "Cannot get request dispatcher, the path is empty!"); return; } if (!checkFileExisted(request, path)) { //not existed logger.error("Cannot find the file " + path); response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot find the file " + path); return; } //forward RequestDispatcher rd = request.getRequestDispatcher(path); if (rd == null) { logger.error("Cannot get request dispatcher for path " + path); response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Cannot get request dispatcher for path" + path); return; } rd.forward(request, response); } catch (Exception ex) {//ServletException & IOException String msg = "Exception occurs when forward to the path " + path; if(ex instanceof ServletException) { ex = ProcessHelper.transformServletException((ServletException)ex); } logger.error(msg, ex); processResponseSendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); } }
static void function( String path, HttpServletRequest request, HttpServletResponse response) { if (logger.isInfoEnabled()) logger.info(STR + path); try { if (path == null path.equals(STRCannot get request dispatcher, the path is empty!STRCannot get request dispatcher, the path is empty!STRCannot find the file STRCannot find the file STRCannot get request dispatcher for path STRCannot get request dispatcher for pathSTRException occurs when forward to the path " + path; if(ex instanceof ServletException) { ex = ProcessHelper.transformServletException((ServletException)ex); } logger.error(msg, ex); processResponseSendError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg); } }
/** * Forward to the specified path directly * * @param path the path that should be forwarded * @param request The servlet request we are processing * @param response The servlet response we are creating * * @exception IOException if an input/output error occurs * @exception ServletException if a servlet exception occurs */
Forward to the specified path directly
processDirectForward
{ "repo_name": "shaolinwu/uimaster", "path": "modules/uipage/src/main/java/org/shaolin/uimaster/page/flow/ProcessHelper.java", "license": "apache-2.0", "size": 29561 }
[ "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import javax.servlet.*; import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
121,901
@Test public void createInvalidEntryNoInvalidEntriesConsumer() { final Map<String, Object> optionsMap = new HashMap<>(); optionsMap.put("invalidOption", AN_OBJECT); ConfigurationOptions.create(optionsMap, null); }
void function() { final Map<String, Object> optionsMap = new HashMap<>(); optionsMap.put(STR, AN_OBJECT); ConfigurationOptions.create(optionsMap, null); }
/** * Asserts that {@link ConfigurationOptions#create(Map, Consumer)} does not throw an exception when the option map contains an * invalid entry and the <code>invalidEntriesConsumer</code> argument is <code>null</code>. */
Asserts that <code>ConfigurationOptions#create(Map, Consumer)</code> does not throw an exception when the option map contains an invalid entry and the <code>invalidEntriesConsumer</code> argument is <code>null</code>
createInvalidEntryNoInvalidEntriesConsumer
{ "repo_name": "reasm/reasm-m68k", "path": "src/test/java/org/reasm/m68k/ConfigurationOptionsTest.java", "license": "mit", "size": 17166 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,140,952
@Nullable public static int[] readIntArray(DataInput in) throws IOException { int len = in.readInt(); if (len == -1) return null; // Value "-1" indicates null. int[] res = new int[len]; for (int i = 0; i < len; i++) res[i] = in.readInt(); return res; } /** * Calculates hash code for the given byte buffers contents. Compatible with {@link Arrays#hashCode(byte[])}
@Nullable static int[] function(DataInput in) throws IOException { int len = in.readInt(); if (len == -1) return null; int[] res = new int[len]; for (int i = 0; i < len; i++) res[i] = in.readInt(); return res; } /** * Calculates hash code for the given byte buffers contents. Compatible with {@link Arrays#hashCode(byte[])}
/** * Reads int array from input stream accounting for <tt>null</tt> values. * * @param in Stream to read from. * @return Read byte array, possibly <tt>null</tt>. * @throws IOException If read failed. */
Reads int array from input stream accounting for null values
readIntArray
{ "repo_name": "mcherkasov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 316648 }
[ "java.io.DataInput", "java.io.IOException", "java.util.Arrays", "org.jetbrains.annotations.Nullable" ]
import java.io.DataInput; import java.io.IOException; import java.util.Arrays; import org.jetbrains.annotations.Nullable;
import java.io.*; import java.util.*; import org.jetbrains.annotations.*;
[ "java.io", "java.util", "org.jetbrains.annotations" ]
java.io; java.util; org.jetbrains.annotations;
2,321,749
public static GMM getMAP(Cluster cluster, FeatureSet features, GMM init, GMM ubm, ParameterEM emControl, ParameterMAP mapControl, ParameterVarianceControl varianceControl, ParameterTopGaussian topGaussian) throws DiarizationException, IOException { // return GMMFactory.getMAP(x, features, init, wld, alpha, m, c, w, // minIt, maxIt, minGain, flooring, ceilling, true); return GMMFactory.getMAP(cluster, features, init, ubm, emControl, mapControl, varianceControl, topGaussian, true); }
static GMM function(Cluster cluster, FeatureSet features, GMM init, GMM ubm, ParameterEM emControl, ParameterMAP mapControl, ParameterVarianceControl varianceControl, ParameterTopGaussian topGaussian) throws DiarizationException, IOException { return GMMFactory.getMAP(cluster, features, init, ubm, emControl, mapControl, varianceControl, topGaussian, true); }
/** * Gets the mAP. * * @param cluster the cluster * @param features the features * @param ubm the universal background model * @param init the initialization model * @param emControl the EM control parameter * @param varianceControl the variance control parameter * @param mapControl the map control * @param topGaussian the top gaussian * * @return the mAP * * @throws fr.lium.spkDiarization.lib.DiarizationException the diarization exception * @throws java.io.IOException Signals that an I/O exception has occurred. */
Gets the mAP
getMAP
{ "repo_name": "ArtemMy/CallRec", "path": "app/src/main/java/fr/lium/spkDiarization/libModel/GMMFactory.java", "license": "gpl-3.0", "size": 24285 }
[ "fr.lium.spkDiarization.lib.DiarizationException", "fr.lium.spkDiarization.libClusteringData.Cluster", "fr.lium.spkDiarization.libFeature.FeatureSet", "fr.lium.spkDiarization.parameter.ParameterEM", "fr.lium.spkDiarization.parameter.ParameterMAP", "fr.lium.spkDiarization.parameter.ParameterTopGaussian", "fr.lium.spkDiarization.parameter.ParameterVarianceControl", "java.io.IOException" ]
import fr.lium.spkDiarization.lib.DiarizationException; import fr.lium.spkDiarization.libClusteringData.Cluster; import fr.lium.spkDiarization.libFeature.FeatureSet; import fr.lium.spkDiarization.parameter.ParameterEM; import fr.lium.spkDiarization.parameter.ParameterMAP; import fr.lium.spkDiarization.parameter.ParameterTopGaussian; import fr.lium.spkDiarization.parameter.ParameterVarianceControl; import java.io.IOException;
import fr.lium.*; import java.io.*;
[ "fr.lium", "java.io" ]
fr.lium; java.io;
2,472,923
public List<ProjectTypeResolution> resolveSources(String path, boolean transientOnly) throws ServerException, NotFoundException { final List<ProjectTypeResolution> resolutions = new ArrayList<>(); for (ProjectType type : projectTypeRegistry.getProjectTypes(ProjectTypeRegistry.CHILD_TO_PARENT_COMPARATOR)) { if (transientOnly && type.isPersisted()) { continue; } final ProjectTypeResolution resolution = estimateProject(path, type.getId()); if (resolution.matched()) { resolutions.add(resolution); } } return resolutions; }
List<ProjectTypeResolution> function(String path, boolean transientOnly) throws ServerException, NotFoundException { final List<ProjectTypeResolution> resolutions = new ArrayList<>(); for (ProjectType type : projectTypeRegistry.getProjectTypes(ProjectTypeRegistry.CHILD_TO_PARENT_COMPARATOR)) { if (transientOnly && type.isPersisted()) { continue; } final ProjectTypeResolution resolution = estimateProject(path, type.getId()); if (resolution.matched()) { resolutions.add(resolution); } } return resolutions; }
/** * Estimates to which project types the folder can be converted to * * @param path to the folder * @param transientOnly whether it can be estimated to the transient types of Project only * @return list of resolutions * @throws ServerException * @throws NotFoundException */
Estimates to which project types the folder can be converted to
resolveSources
{ "repo_name": "Patricol/che", "path": "wsagent/che-core-api-project/src/main/java/org/eclipse/che/api/project/server/ProjectManager.java", "license": "epl-1.0", "size": 29057 }
[ "java.util.ArrayList", "java.util.List", "org.eclipse.che.api.core.NotFoundException", "org.eclipse.che.api.core.ServerException", "org.eclipse.che.api.core.model.project.type.ProjectType", "org.eclipse.che.api.project.server.type.ProjectTypeRegistry", "org.eclipse.che.api.project.server.type.ProjectTypeResolution" ]
import java.util.ArrayList; import java.util.List; import org.eclipse.che.api.core.NotFoundException; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.core.model.project.type.ProjectType; import org.eclipse.che.api.project.server.type.ProjectTypeRegistry; import org.eclipse.che.api.project.server.type.ProjectTypeResolution;
import java.util.*; import org.eclipse.che.api.core.*; import org.eclipse.che.api.core.model.project.type.*; import org.eclipse.che.api.project.server.type.*;
[ "java.util", "org.eclipse.che" ]
java.util; org.eclipse.che;
2,493,686
@SuppressWarnings("rawtypes") public List dynamicQuery(DynamicQuery dynamicQuery) throws SystemException { return benefit_rating_lkpPersistence.findWithDynamicQuery(dynamicQuery); }
@SuppressWarnings(STR) List function(DynamicQuery dynamicQuery) throws SystemException { return benefit_rating_lkpPersistence.findWithDynamicQuery(dynamicQuery); }
/** * Performs a dynamic query on the database and returns the matching rows. * * @param dynamicQuery the dynamic query * @return the matching rows * @throws SystemException if a system exception occurred */
Performs a dynamic query on the database and returns the matching rows
dynamicQuery
{ "repo_name": "iucn-whp/world-heritage-outlook", "path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/base/benefit_rating_lkpLocalServiceBaseImpl.java", "license": "gpl-2.0", "size": 175742 }
[ "com.liferay.portal.kernel.dao.orm.DynamicQuery", "com.liferay.portal.kernel.exception.SystemException", "java.util.List" ]
import com.liferay.portal.kernel.dao.orm.DynamicQuery; import com.liferay.portal.kernel.exception.SystemException; import java.util.List;
import com.liferay.portal.kernel.dao.orm.*; import com.liferay.portal.kernel.exception.*; import java.util.*;
[ "com.liferay.portal", "java.util" ]
com.liferay.portal; java.util;
1,159,833
options.window().setSize( new Dimension( 640, 480 ) ); }
options.window().setSize( new Dimension( 640, 480 ) ); }
/** * Override this method to change {@link WebDriver} options before the test is run. */
Override this method to change <code>WebDriver</code> options before the test is run
manage
{ "repo_name": "lukelast/jelenium", "path": "demo/src/main/java/net/ghue/jelenium/demo/CustomizeWebDriverOptions.java", "license": "lgpl-3.0", "size": 846 }
[ "org.openqa.selenium.Dimension" ]
import org.openqa.selenium.Dimension;
import org.openqa.selenium.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
2,097,157
public void testMaxEqual() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; int bSign = 1; byte rBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.max(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals("incorrect sign", 1, result.signum()); }
void function() { byte aBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; byte bBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; int aSign = 1; int bSign = 1; byte rBytes[] = {45, 91, 3, -15, 35, 26, 3, 91}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = new BigInteger(bSign, bBytes); BigInteger result = aNumber.max(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(STR, 1, result.signum()); }
/** * max(BigInteger val). * numbers are equal. */
max(BigInteger val). numbers are equal
testMaxEqual
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/java6/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerCompareTest.java", "license": "apache-2.0", "size": 19003 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
239,099
@NotNull List<RngNotAllowed> getNotAlloweds();
List<RngNotAllowed> getNotAlloweds();
/** * Returns the list of notAllowed children. * * @return the list of notAllowed children. */
Returns the list of notAllowed children
getNotAlloweds
{ "repo_name": "akosyakov/intellij-community", "path": "xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngOpenPatterns.java", "license": "apache-2.0", "size": 6267 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,998,301
private Connection getDatabaseConnection(String jndiName) throws NamingException, SQLException { Context initContext = new InitialContext(); DataSource ds = (DataSource)initContext.lookup(jndiName); Connection connection = ds.getConnection(); return connection; }
Connection function(String jndiName) throws NamingException, SQLException { Context initContext = new InitialContext(); DataSource ds = (DataSource)initContext.lookup(jndiName); Connection connection = ds.getConnection(); return connection; }
/** * Get database connection from a data source * using the JNDI Name * @param jndiName JNDI Name * @return Database Connection Object * @throws NamingException * @throws SQLException **/
Get database connection from a data source using the JNDI Name
getDatabaseConnection
{ "repo_name": "rayedchan/OIMUtilities", "path": "src/com/blogspot/oraclestack/scheduledtasks/ReconEventsGeneratorDatabaseSource.java", "license": "mit", "size": 20093 }
[ "java.sql.Connection", "java.sql.SQLException", "javax.naming.Context", "javax.naming.InitialContext", "javax.naming.NamingException", "javax.sql.DataSource" ]
import java.sql.Connection; import java.sql.SQLException; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource;
import java.sql.*; import javax.naming.*; import javax.sql.*;
[ "java.sql", "javax.naming", "javax.sql" ]
java.sql; javax.naming; javax.sql;
2,056,572
void addProcedures(Collection<String> procedure);
void addProcedures(Collection<String> procedure);
/** * Add the specified procedures. * * @param procedure * the procedures */
Add the specified procedures
addProcedures
{ "repo_name": "shane-axiom/SOS", "path": "core/api/src/main/java/org/n52/sos/cache/WritableContentCache.java", "license": "gpl-2.0", "size": 47509 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
302,804
public static List<String> getIds(List<Path> nodes) { return nodes.stream().map(Path::getValue).collect(toList()); }
static List<String> function(List<Path> nodes) { return nodes.stream().map(Path::getValue).collect(toList()); }
/** * Returns mapped identifiers of the provided list with {@link Path}. * * @param nodes the paths to map * @return list of {@link Path} identifiers */
Returns mapped identifiers of the provided list with <code>Path</code>
getIds
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/model-management/model-management-impl/src/main/java/com/sirma/sep/model/management/deploy/ModelDeploymentUtils.java", "license": "lgpl-3.0", "size": 681 }
[ "com.sirma.sep.model.management.Path", "java.util.List" ]
import com.sirma.sep.model.management.Path; import java.util.List;
import com.sirma.sep.model.management.*; import java.util.*;
[ "com.sirma.sep", "java.util" ]
com.sirma.sep; java.util;
257,244
void restoreState(Configuration configuration) { this.configFile = configuration.configFile; this.language = configuration.language; this.lang = configuration.lang; this.motherTongue = configuration.motherTongue; this.ngramDirectory = configuration.ngramDirectory; this.word2vecDirectory = configuration.word2vecDirectory; this.runServer = configuration.runServer; this.autoDetect = configuration.autoDetect; this.taggerShowsDisambigLog = configuration.taggerShowsDisambigLog; this.guiConfig = configuration.guiConfig; this.fontName = configuration.fontName; this.fontStyle = configuration.fontStyle; this.fontSize = configuration.fontSize; this.serverPort = configuration.serverPort; this.numParasToCheck = configuration.numParasToCheck; this.doResetCheck = configuration.doResetCheck; this.useTextLevelQueue = configuration.useTextLevelQueue; this.noBackgroundCheck = configuration.noBackgroundCheck; this.isMultiThreadLO = configuration.isMultiThreadLO; this.useDocLanguage = configuration.useDocLanguage; this.lookAndFeelName = configuration.lookAndFeelName; this.externalRuleDirectory = configuration.externalRuleDirectory; this.currentProfile = configuration.currentProfile; this.doRemoteCheck = configuration.doRemoteCheck; this.useOtherServer = configuration.useOtherServer; this.markSingleCharBold = configuration.markSingleCharBold; this.useLtDictionary = configuration.useLtDictionary; this.noSynonymsAsSuggestions = configuration.noSynonymsAsSuggestions; this.saveLoCache = configuration.saveLoCache; this.otherServerUrl = configuration.otherServerUrl; this.logLevel = configuration.logLevel; this.disabledRuleIds.clear(); this.disabledRuleIds.addAll(configuration.disabledRuleIds); this.enabledRuleIds.clear(); this.enabledRuleIds.addAll(configuration.enabledRuleIds); this.disabledCategoryNames.clear(); this.disabledCategoryNames.addAll(configuration.disabledCategoryNames); this.enabledCategoryNames.clear(); this.enabledCategoryNames.addAll(configuration.enabledCategoryNames); this.configForOtherLanguages.clear(); for (String key : configuration.configForOtherLanguages.keySet()) { this.configForOtherLanguages.put(key, configuration.configForOtherLanguages.get(key)); } this.underlineColors.clear(); for (Map.Entry<String, Color> entry : configuration.underlineColors.entrySet()) { this.underlineColors.put(entry.getKey(), entry.getValue()); } this.underlineRuleColors.clear(); for (Map.Entry<String, Color> entry : configuration.underlineRuleColors.entrySet()) { this.underlineRuleColors.put(entry.getKey(), entry.getValue()); } this.underlineTypes.clear(); for (Map.Entry<String, Short> entry : configuration.underlineTypes.entrySet()) { this.underlineTypes.put(entry.getKey(), entry.getValue()); } this.underlineRuleTypes.clear(); for (Map.Entry<String, Short> entry : configuration.underlineRuleTypes.entrySet()) { this.underlineRuleTypes.put(entry.getKey(), entry.getValue()); } this.configurableRuleValues.clear(); for (Map.Entry<String, Integer> entry : configuration.configurableRuleValues.entrySet()) { this.configurableRuleValues.put(entry.getKey(), entry.getValue()); } this.styleLikeCategories.clear(); this.styleLikeCategories.addAll(configuration.styleLikeCategories); this.specialTabCategories.clear(); for (Map.Entry<String, String> entry : configuration.specialTabCategories.entrySet()) { this.specialTabCategories.put(entry.getKey(), entry.getValue()); } this.definedProfiles.clear(); this.definedProfiles.addAll(configuration.definedProfiles); this.allProfileLangKeys.clear(); this.allProfileLangKeys.addAll(configuration.allProfileLangKeys); this.allProfileKeys.clear(); this.allProfileKeys.addAll(configuration.allProfileKeys); this.configForOtherProfiles.clear(); for (Entry<String, String> entry : configuration.configForOtherProfiles.entrySet()) { this.configForOtherProfiles.put(entry.getKey(), entry.getValue()); } }
void restoreState(Configuration configuration) { this.configFile = configuration.configFile; this.language = configuration.language; this.lang = configuration.lang; this.motherTongue = configuration.motherTongue; this.ngramDirectory = configuration.ngramDirectory; this.word2vecDirectory = configuration.word2vecDirectory; this.runServer = configuration.runServer; this.autoDetect = configuration.autoDetect; this.taggerShowsDisambigLog = configuration.taggerShowsDisambigLog; this.guiConfig = configuration.guiConfig; this.fontName = configuration.fontName; this.fontStyle = configuration.fontStyle; this.fontSize = configuration.fontSize; this.serverPort = configuration.serverPort; this.numParasToCheck = configuration.numParasToCheck; this.doResetCheck = configuration.doResetCheck; this.useTextLevelQueue = configuration.useTextLevelQueue; this.noBackgroundCheck = configuration.noBackgroundCheck; this.isMultiThreadLO = configuration.isMultiThreadLO; this.useDocLanguage = configuration.useDocLanguage; this.lookAndFeelName = configuration.lookAndFeelName; this.externalRuleDirectory = configuration.externalRuleDirectory; this.currentProfile = configuration.currentProfile; this.doRemoteCheck = configuration.doRemoteCheck; this.useOtherServer = configuration.useOtherServer; this.markSingleCharBold = configuration.markSingleCharBold; this.useLtDictionary = configuration.useLtDictionary; this.noSynonymsAsSuggestions = configuration.noSynonymsAsSuggestions; this.saveLoCache = configuration.saveLoCache; this.otherServerUrl = configuration.otherServerUrl; this.logLevel = configuration.logLevel; this.disabledRuleIds.clear(); this.disabledRuleIds.addAll(configuration.disabledRuleIds); this.enabledRuleIds.clear(); this.enabledRuleIds.addAll(configuration.enabledRuleIds); this.disabledCategoryNames.clear(); this.disabledCategoryNames.addAll(configuration.disabledCategoryNames); this.enabledCategoryNames.clear(); this.enabledCategoryNames.addAll(configuration.enabledCategoryNames); this.configForOtherLanguages.clear(); for (String key : configuration.configForOtherLanguages.keySet()) { this.configForOtherLanguages.put(key, configuration.configForOtherLanguages.get(key)); } this.underlineColors.clear(); for (Map.Entry<String, Color> entry : configuration.underlineColors.entrySet()) { this.underlineColors.put(entry.getKey(), entry.getValue()); } this.underlineRuleColors.clear(); for (Map.Entry<String, Color> entry : configuration.underlineRuleColors.entrySet()) { this.underlineRuleColors.put(entry.getKey(), entry.getValue()); } this.underlineTypes.clear(); for (Map.Entry<String, Short> entry : configuration.underlineTypes.entrySet()) { this.underlineTypes.put(entry.getKey(), entry.getValue()); } this.underlineRuleTypes.clear(); for (Map.Entry<String, Short> entry : configuration.underlineRuleTypes.entrySet()) { this.underlineRuleTypes.put(entry.getKey(), entry.getValue()); } this.configurableRuleValues.clear(); for (Map.Entry<String, Integer> entry : configuration.configurableRuleValues.entrySet()) { this.configurableRuleValues.put(entry.getKey(), entry.getValue()); } this.styleLikeCategories.clear(); this.styleLikeCategories.addAll(configuration.styleLikeCategories); this.specialTabCategories.clear(); for (Map.Entry<String, String> entry : configuration.specialTabCategories.entrySet()) { this.specialTabCategories.put(entry.getKey(), entry.getValue()); } this.definedProfiles.clear(); this.definedProfiles.addAll(configuration.definedProfiles); this.allProfileLangKeys.clear(); this.allProfileLangKeys.addAll(configuration.allProfileLangKeys); this.allProfileKeys.clear(); this.allProfileKeys.addAll(configuration.allProfileKeys); this.configForOtherProfiles.clear(); for (Entry<String, String> entry : configuration.configForOtherProfiles.entrySet()) { this.configForOtherProfiles.put(entry.getKey(), entry.getValue()); } }
/** * Restore the state of this object from configuration. * @param configuration the object from which we will read the state * @since 2.6 */
Restore the state of this object from configuration
restoreState
{ "repo_name": "jimregan/languagetool", "path": "languagetool-gui-commons/src/main/java/org/languagetool/gui/Configuration.java", "license": "lgpl-2.1", "size": 59787 }
[ "java.awt.Color", "java.util.Map" ]
import java.awt.Color; import java.util.Map;
import java.awt.*; import java.util.*;
[ "java.awt", "java.util" ]
java.awt; java.util;
670,838
public void cancelCopy(CopyOperationImpl op) throws SQLException { if (!hasLock(op)) { throw new PSQLException(GT.tr("Tried to cancel an inactive copy operation"), PSQLState.OBJECT_NOT_IN_STATE); } SQLException error = null; int errors = 0; try { if (op instanceof CopyIn) { synchronized (this) { LOGGER.log(Level.FINEST, "FE => CopyFail"); final byte[] msg = Utils.encodeUTF8("Copy cancel requested"); pgStream.sendChar('f'); // CopyFail pgStream.sendInteger4(5 + msg.length); pgStream.send(msg); pgStream.sendChar(0); pgStream.flush(); do { try { processCopyResults(op, true); // discard rest of input } catch (SQLException se) { // expected error response to failing copy errors++; if (error != null) { SQLException e = se; SQLException next; while ((next = e.getNextException()) != null) { e = next; } e.setNextException(error); } error = se; } } while (hasLock(op)); } } else if (op instanceof CopyOut) { sendQueryCancel(); } } catch (IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when canceling copy operation"), PSQLState.CONNECTION_FAILURE, ioe); } finally { // Need to ensure the lock isn't held anymore, or else // future operations, rather than failing due to the // broken connection, will simply hang waiting for this // lock. synchronized (this) { if (hasLock(op)) { unlock(op); } } } if (op instanceof CopyIn) { if (errors < 1) { throw new PSQLException(GT.tr("Missing expected error response to copy cancel request"), PSQLState.COMMUNICATION_ERROR); } else if (errors > 1) { throw new PSQLException( GT.tr("Got {0} error responses to single copy cancel request", String.valueOf(errors)), PSQLState.COMMUNICATION_ERROR, error); } } }
void function(CopyOperationImpl op) throws SQLException { if (!hasLock(op)) { throw new PSQLException(GT.tr(STR), PSQLState.OBJECT_NOT_IN_STATE); } SQLException error = null; int errors = 0; try { if (op instanceof CopyIn) { synchronized (this) { LOGGER.log(Level.FINEST, STR); final byte[] msg = Utils.encodeUTF8(STR); pgStream.sendChar('f'); pgStream.sendInteger4(5 + msg.length); pgStream.send(msg); pgStream.sendChar(0); pgStream.flush(); do { try { processCopyResults(op, true); } catch (SQLException se) { errors++; if (error != null) { SQLException e = se; SQLException next; while ((next = e.getNextException()) != null) { e = next; } e.setNextException(error); } error = se; } } while (hasLock(op)); } } else if (op instanceof CopyOut) { sendQueryCancel(); } } catch (IOException ioe) { throw new PSQLException(GT.tr(STR), PSQLState.CONNECTION_FAILURE, ioe); } finally { synchronized (this) { if (hasLock(op)) { unlock(op); } } } if (op instanceof CopyIn) { if (errors < 1) { throw new PSQLException(GT.tr(STR), PSQLState.COMMUNICATION_ERROR); } else if (errors > 1) { throw new PSQLException( GT.tr(STR, String.valueOf(errors)), PSQLState.COMMUNICATION_ERROR, error); } } }
/** * Finishes a copy operation and unlocks connection discarding any exchanged data. * * @param op the copy operation presumably currently holding lock on this connection * @throws SQLException on any additional failure */
Finishes a copy operation and unlocks connection discarding any exchanged data
cancelCopy
{ "repo_name": "lordnelson/pgjdbc", "path": "pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java", "license": "bsd-2-clause", "size": 98966 }
[ "java.io.IOException", "java.sql.SQLException", "java.util.logging.Level", "org.postgresql.copy.CopyIn", "org.postgresql.copy.CopyOut", "org.postgresql.core.Utils", "org.postgresql.util.GT", "org.postgresql.util.PSQLException", "org.postgresql.util.PSQLState" ]
import java.io.IOException; import java.sql.SQLException; import java.util.logging.Level; import org.postgresql.copy.CopyIn; import org.postgresql.copy.CopyOut; import org.postgresql.core.Utils; import org.postgresql.util.GT; import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLState;
import java.io.*; import java.sql.*; import java.util.logging.*; import org.postgresql.copy.*; import org.postgresql.core.*; import org.postgresql.util.*;
[ "java.io", "java.sql", "java.util", "org.postgresql.copy", "org.postgresql.core", "org.postgresql.util" ]
java.io; java.sql; java.util; org.postgresql.copy; org.postgresql.core; org.postgresql.util;
1,435,026
public void committed(final CommittedEvent pbEvent) { Session session = null; try { loadProperties(); // NamingException can be thrown Context initCtx = new InitialContext(); Context envCtx = (Context)initCtx.lookup("java:comp/env"); //$NON-NLS-1$ // NoClassDefFoundError can be thrown if configuration is not done. session = (Session)envCtx.lookup("mail/session"); //$NON-NLS-1$ MimeMessage message = new MimeMessage(session); { // MessagingException can be thrown message.setContent(null, "text/plain"); //$NON-NLS-1$ if (pbEvent instanceof CreatedEvent) { addMailContent(message, (CreatedEvent)pbEvent); } else if (pbEvent instanceof UpdatedEvent) { addMailContent(message, (UpdatedEvent)pbEvent); } else if (pbEvent instanceof DeletedEvent) { addMailContent(message, (DeletedEvent)pbEvent); } else { LOG.error("Incorrect CommittedEvent recieved."); //$NON-NLS-1$ } addRecepients(message, envCtx); message.saveChanges(); Transport.send(message); } } catch (NoClassDefFoundError ncdfExc) { // Log configuration error and re-throw the exception. LOG.error("JavaMail not configured, unable to find mail.jar and/or " //$NON-NLS-1$ + "activation.jar. For more details please read README.html", //$NON-NLS-1$ ncdfExc); throw ncdfExc; } catch (IOException ioExc) { LOG.error("Unable to load properties for mail notification; " //$NON-NLS-1$ + MAIL_NOT_SEND, ioExc); } catch (NamingException nExc) { LOG.error("Trying to access mail session via JNDI; " //$NON-NLS-1$ + MAIL_NOT_SEND, nExc); } catch (MessagingException mExc) { LOG.error("Trying to create and send mail; " //$NON-NLS-1$ + MAIL_NOT_SEND, mExc); } catch (Throwable t) { LOG.error("Throwable occured when trying to send mail; " //$NON-NLS-1$ + MAIL_NOT_SEND, t); } }
void function(final CommittedEvent pbEvent) { Session session = null; try { loadProperties(); Context initCtx = new InitialContext(); Context envCtx = (Context)initCtx.lookup(STR); session = (Session)envCtx.lookup(STR); MimeMessage message = new MimeMessage(session); { message.setContent(null, STR); if (pbEvent instanceof CreatedEvent) { addMailContent(message, (CreatedEvent)pbEvent); } else if (pbEvent instanceof UpdatedEvent) { addMailContent(message, (UpdatedEvent)pbEvent); } else if (pbEvent instanceof DeletedEvent) { addMailContent(message, (DeletedEvent)pbEvent); } else { LOG.error(STR); } addRecepients(message, envCtx); message.saveChanges(); Transport.send(message); } } catch (NoClassDefFoundError ncdfExc) { LOG.error(STR + STR, ncdfExc); throw ncdfExc; } catch (IOException ioExc) { LOG.error(STR + MAIL_NOT_SEND, ioExc); } catch (NamingException nExc) { LOG.error(STR + MAIL_NOT_SEND, nExc); } catch (MessagingException mExc) { LOG.error(STR + MAIL_NOT_SEND, mExc); } catch (Throwable t) { LOG.error(STR + MAIL_NOT_SEND, t); } }
/** * Process the CommittedEvent. In this case we send a email. * * If mail cannot be sent for a technical reason, this is logged, * but it does not stop the process. * * @param pbEvent * The CommittedEvent to process. */
Process the CommittedEvent. In this case we send a email. If mail cannot be sent for a technical reason, this is logged, but it does not stop the process
committed
{ "repo_name": "jandppw/ppwcode-recovered-from-google-code", "path": "_purgatory/java/struts/trunk/src/java/be/peopleware/struts_III/persistentBean/event/CommitMailNotification.java", "license": "apache-2.0", "size": 7451 }
[ "java.io.IOException", "javax.mail.MessagingException", "javax.mail.Session", "javax.mail.Transport", "javax.mail.internet.MimeMessage", "javax.naming.Context", "javax.naming.InitialContext", "javax.naming.NamingException" ]
import java.io.IOException; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.MimeMessage; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException;
import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.naming.*;
[ "java.io", "javax.mail", "javax.naming" ]
java.io; javax.mail; javax.naming;
358,988
public void removeIgnoredView(View v) { mViewAbove.removeIgnoredView(v); }
void function(View v) { mViewAbove.removeIgnoredView(v); }
/** * Remove a View ignored by the Touch Down event when mode is Fullscreen * * @param v a view not wanted to be ignored anymore */
Remove a View ignored by the Touch Down event when mode is Fullscreen
removeIgnoredView
{ "repo_name": "eduardoweiland/doode-android", "path": "libs/SlidingMenu/src/com/slidingmenu/lib/SlidingMenu.java", "license": "gpl-3.0", "size": 25339 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,859,282
public IconType<FilterType<T>> createIcon();
IconType<FilterType<T>> function();
/** * Creates a new <code>icon</code> element * @return the new created instance of <code>IconType<FilterType<T>></code> */
Creates a new <code>icon</code> element
createIcon
{ "repo_name": "forge/javaee-descriptors", "path": "api/src/main/java/org/jboss/shrinkwrap/descriptor/api/webcommon30/FilterType.java", "license": "epl-1.0", "size": 9288 }
[ "org.jboss.shrinkwrap.descriptor.api.javaee6.IconType" ]
import org.jboss.shrinkwrap.descriptor.api.javaee6.IconType;
import org.jboss.shrinkwrap.descriptor.api.javaee6.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
2,650,269
public static AggregationIterator create(final List<Span> spans, final long start_time, final long end_time, final Aggregator aggregator, final Interpolation method, final Aggregator downsampler, final long sample_interval_ms, final boolean rate, final RateOptions rate_options) { final int size = spans.size(); final SeekableView[] iterators = new SeekableView[size]; for (int i = 0; i < size; i++) { SeekableView it; if (downsampler == null) { it = spans.get(i).spanIterator(); } else { it = spans.get(i).downsampler(sample_interval_ms, downsampler); } if (rate) { it = new RateSpan(it, rate_options); } iterators[i] = it; } return new AggregationIterator(iterators, start_time, end_time, aggregator, method, rate); } private AggregationIterator(final SeekableView[] iterators, final long start_time, final long end_time, final Aggregator aggregator, final Interpolation method, final boolean rate) { LOG.debug("Aggregating {} iterators", iterators.length); this.iterators = iterators; this.start_time = start_time; this.end_time = end_time; this.aggregator = aggregator; this.method = method; this.rate = rate; final int size = iterators.length; timestamps = new long[size * 2]; values = new long[size * 2]; // Initialize every Iterator, fetch their first values that fall // within our time range. int num_empty_spans = 0; for (int i = 0; i < size; i++) { SeekableView it = iterators[i]; it.seek(start_time); final DataPoint dp; try { dp = it.next(); } catch (NoSuchElementException e) { // It should be rare but could happen after downsampling when // we throw away some data points at the beginning after aligning // start time by downsmpling interval and there are no data points // left for the current span. ++num_empty_spans; endReached(i); continue; } //LOG.debug("Creating iterator #" + i); if (dp.timestamp() >= start_time) { //LOG.debug("First DP in range for #" + i + ": " // + dp.timestamp() + " >= " + start_time); putDataPoint(size + i, dp); } else { if (LOG.isDebugEnabled()) { LOG.debug(String.format("No DP in range for #%d: %d < %d", i, dp.timestamp(), start_time)); } endReached(i); continue; } if (rate) { // The first rate against the time zero should be populated // for the backward compatibility that uses the previous rate // instead of interpolating for aggregation when a data point is // missing for the current timestamp. // TODO: Use the next rate that contains the current timestamp. if (it.hasNext()) { moveToNext(i); } else { endReached(i); } } } if (num_empty_spans > 0) { LOG.debug(String.format("%d out of %d spans are empty!", num_empty_spans, size)); } }
static AggregationIterator function(final List<Span> spans, final long start_time, final long end_time, final Aggregator aggregator, final Interpolation method, final Aggregator downsampler, final long sample_interval_ms, final boolean rate, final RateOptions rate_options) { final int size = spans.size(); final SeekableView[] iterators = new SeekableView[size]; for (int i = 0; i < size; i++) { SeekableView it; if (downsampler == null) { it = spans.get(i).spanIterator(); } else { it = spans.get(i).downsampler(sample_interval_ms, downsampler); } if (rate) { it = new RateSpan(it, rate_options); } iterators[i] = it; } return new AggregationIterator(iterators, start_time, end_time, aggregator, method, rate); } private AggregationIterator(final SeekableView[] iterators, final long start_time, final long end_time, final Aggregator aggregator, final Interpolation method, final boolean rate) { LOG.debug(STR, iterators.length); this.iterators = iterators; this.start_time = start_time; this.end_time = end_time; this.aggregator = aggregator; this.method = method; this.rate = rate; final int size = iterators.length; timestamps = new long[size * 2]; values = new long[size * 2]; int num_empty_spans = 0; for (int i = 0; i < size; i++) { SeekableView it = iterators[i]; it.seek(start_time); final DataPoint dp; try { dp = it.next(); } catch (NoSuchElementException e) { ++num_empty_spans; endReached(i); continue; } if (dp.timestamp() >= start_time) { putDataPoint(size + i, dp); } else { if (LOG.isDebugEnabled()) { LOG.debug(String.format(STR, i, dp.timestamp(), start_time)); } endReached(i); continue; } if (rate) { if (it.hasNext()) { moveToNext(i); } else { endReached(i); } } } if (num_empty_spans > 0) { LOG.debug(String.format(STR, num_empty_spans, size)); } }
/** * Creates a new iterator for a {@link SpanGroup}. * @param spans Spans in a group. * @param start_time Any data point strictly before this timestamp will be * ignored. * @param end_time Any data point strictly after this timestamp will be * ignored. * @param aggregator The aggregation function to use. * @param method Interpolation method to use when aggregating time series * @param downsampler Aggregation function to use to group data points * within an interval. * @param sample_interval_ms Number of milliseconds wanted between each data * point. * @param rate If {@code true}, the rate of the series will be used instead * of the actual values. * @param rate_options Specifies the optional additional rate calculation * options. * @return An {@link AggregationIterator} object. */
Creates a new iterator for a <code>SpanGroup</code>
create
{ "repo_name": "kuake/myOpenTsdb", "path": "src/core/AggregationIterator.java", "license": "gpl-3.0", "size": 26681 }
[ "java.util.List", "java.util.NoSuchElementException", "net.opentsdb.core.Aggregators" ]
import java.util.List; import java.util.NoSuchElementException; import net.opentsdb.core.Aggregators;
import java.util.*; import net.opentsdb.core.*;
[ "java.util", "net.opentsdb.core" ]
java.util; net.opentsdb.core;
1,867,623
protected Set<Classifier> rawAccumulateAllValuesOfelem(final Object[] parameters) { Set<Classifier> results = new HashSet<Classifier>(); rawAccumulateAllValues(POSITION_ELEM, parameters, results); return results; }
Set<Classifier> function(final Object[] parameters) { Set<Classifier> results = new HashSet<Classifier>(); rawAccumulateAllValues(POSITION_ELEM, parameters, results); return results; }
/** * Retrieve the set of values that occur in matches for elem. * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches * */
Retrieve the set of values that occur in matches for elem
rawAccumulateAllValuesOfelem
{ "repo_name": "ELTE-Soft/xUML-RT-Executor", "path": "plugins/hu.eltesoft.modelexecution.validation/src-gen/hu/eltesoft/modelexecution/validation/PowertypeExtentMatcher.java", "license": "epl-1.0", "size": 10218 }
[ "java.util.HashSet", "java.util.Set", "org.eclipse.uml2.uml.Classifier" ]
import java.util.HashSet; import java.util.Set; import org.eclipse.uml2.uml.Classifier;
import java.util.*; import org.eclipse.uml2.uml.*;
[ "java.util", "org.eclipse.uml2" ]
java.util; org.eclipse.uml2;
910,115
public ParamFilter gt(T number) { return addAttribute(Operator.GREATER_THAN, number); }
ParamFilter function(T number) { return addAttribute(Operator.GREATER_THAN, number); }
/** * The param must be greater than given number * * @param number The number * @return This */
The param must be greater than given number
gt
{ "repo_name": "Superioz/MooProject", "path": "api/src/main/java/de/superioz/moo/api/command/param/ParamFilter.java", "license": "gpl-2.0", "size": 4816 }
[ "de.superioz.moo.api.util.Operator" ]
import de.superioz.moo.api.util.Operator;
import de.superioz.moo.api.util.*;
[ "de.superioz.moo" ]
de.superioz.moo;
556,626
protected String getLabel(String typeName) { try { return GeneratorBehaviorEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); } catch(MissingResourceException mre) { GeneratorBehaviorEditorPlugin.INSTANCE.log(mre); } return typeName; }
String function(String typeName) { try { return GeneratorBehaviorEditPlugin.INSTANCE.getString("_UI_" + typeName + "_type"); } catch(MissingResourceException mre) { GeneratorBehaviorEditorPlugin.INSTANCE.log(mre); } return typeName; }
/** * Returns the label for the specified type name. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Returns the label for the specified type name.
getLabel
{ "repo_name": "atischenko/atgen", "path": "plugins/org.eclipse.atischenko.generatorbehavior.model.editor/src/org/eclipse/atischenko/generatorbehavior/presentation/GeneratorBehaviorModelWizard.java", "license": "epl-1.0", "size": 18282 }
[ "java.util.MissingResourceException", "org.eclipse.atischenko.generatorbehavior.provider.GeneratorBehaviorEditPlugin" ]
import java.util.MissingResourceException; import org.eclipse.atischenko.generatorbehavior.provider.GeneratorBehaviorEditPlugin;
import java.util.*; import org.eclipse.atischenko.generatorbehavior.provider.*;
[ "java.util", "org.eclipse.atischenko" ]
java.util; org.eclipse.atischenko;
11,719
public void addSelectionHandler(Handler h) { selectionChangeHandler = h; }
void function(Handler h) { selectionChangeHandler = h; }
/** * Add Handler for selection change events. * * @param h the Handler to add */
Add Handler for selection change events
addSelectionHandler
{ "repo_name": "cloudcoderdotorg/CloudCoder", "path": "CloudCoder/src/org/cloudcoder/app/client/view/TermAndCourseTreeView.java", "license": "agpl-3.0", "size": 10112 }
[ "com.google.gwt.view.client.SelectionChangeEvent" ]
import com.google.gwt.view.client.SelectionChangeEvent;
import com.google.gwt.view.client.*;
[ "com.google.gwt" ]
com.google.gwt;
1,771,061
public void closeElement() throws IOException { closeElement(true); }
void function() throws IOException { closeElement(true); }
/** * Write an element close tag, such as </el>, on a standalone line. * If indent=False is passed, indentation will not be added. * @throws IOException */
Write an element close tag, such as , on a standalone line. If indent=False is passed, indentation will not be added
closeElement
{ "repo_name": "taolee/XmlDataAnalysisToolsets", "path": "DataAnalysis_Wikipedia/spw/src/org/mediawiki/importer/XmlWriter.java", "license": "bsd-3-clause", "size": 4567 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
924,820
final List<RelDataTypeField> fieldList = rel.getRowType().getFieldList(); final List<TypeProtos.MajorType> columnTypes = Lists.newArrayList(); for (final RelDataTypeField field : fieldList) { final SqlTypeName sqlTypeName = field.getType().getSqlTypeName(); if (!TYPES.contains(sqlTypeName)) { return null; } else { final TypeProtos.MajorType.Builder builder = TypeProtos.MajorType.newBuilder() .setMode(field.getType().isNullable() ? TypeProtos.DataMode.OPTIONAL : TypeProtos.DataMode.REQUIRED) .setMinorType(TypeInferenceUtils.getDrillTypeFromCalciteType(sqlTypeName)); if (TypeInferenceUtils.isScalarStringType(sqlTypeName)) { builder.setPrecision(field.getType().getPrecision()); } columnTypes.add(builder.build()); } } final RelTraitSet traits = rel.getTraitSet().plus(DrillRel.DRILL_LOGICAL); final RelDataTypeReader reader = new RelDataTypeReader(rel.getRowType().getFieldNames(), columnTypes); return new DrillDirectScanRel(rel.getCluster(), traits, new DirectGroupScan(reader, ScanStats.ZERO_RECORD_TABLE), rel.getRowType()); }
final List<RelDataTypeField> fieldList = rel.getRowType().getFieldList(); final List<TypeProtos.MajorType> columnTypes = Lists.newArrayList(); for (final RelDataTypeField field : fieldList) { final SqlTypeName sqlTypeName = field.getType().getSqlTypeName(); if (!TYPES.contains(sqlTypeName)) { return null; } else { final TypeProtos.MajorType.Builder builder = TypeProtos.MajorType.newBuilder() .setMode(field.getType().isNullable() ? TypeProtos.DataMode.OPTIONAL : TypeProtos.DataMode.REQUIRED) .setMinorType(TypeInferenceUtils.getDrillTypeFromCalciteType(sqlTypeName)); if (TypeInferenceUtils.isScalarStringType(sqlTypeName)) { builder.setPrecision(field.getType().getPrecision()); } columnTypes.add(builder.build()); } } final RelTraitSet traits = rel.getTraitSet().plus(DrillRel.DRILL_LOGICAL); final RelDataTypeReader reader = new RelDataTypeReader(rel.getRowType().getFieldNames(), columnTypes); return new DrillDirectScanRel(rel.getCluster(), traits, new DirectGroupScan(reader, ScanStats.ZERO_RECORD_TABLE), rel.getRowType()); }
/** * If all field types of the given node are {@link #TYPES recognized types} and honored by execution, then this * method returns the tree: DrillDirectScanRel(field types). Otherwise, the method returns null. * * @param rel calcite logical rel tree * @return drill logical rel tree */
If all field types of the given node are <code>#TYPES recognized types</code> and honored by execution, then this method returns the tree: DrillDirectScanRel(field types). Otherwise, the method returns null
getDirectScanRelIfFullySchemaed
{ "repo_name": "bitblender/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/planner/sql/handlers/FindLimit0Visitor.java", "license": "apache-2.0", "size": 8482 }
[ "com.google.common.collect.Lists", "java.util.List", "org.apache.calcite.plan.RelTraitSet", "org.apache.calcite.rel.type.RelDataTypeField", "org.apache.calcite.sql.type.SqlTypeName", "org.apache.drill.common.types.TypeProtos", "org.apache.drill.exec.physical.base.ScanStats", "org.apache.drill.exec.planner.logical.DrillDirectScanRel", "org.apache.drill.exec.planner.logical.DrillRel", "org.apache.drill.exec.planner.sql.TypeInferenceUtils", "org.apache.drill.exec.store.direct.DirectGroupScan" ]
import com.google.common.collect.Lists; import java.util.List; import org.apache.calcite.plan.RelTraitSet; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.sql.type.SqlTypeName; import org.apache.drill.common.types.TypeProtos; import org.apache.drill.exec.physical.base.ScanStats; import org.apache.drill.exec.planner.logical.DrillDirectScanRel; import org.apache.drill.exec.planner.logical.DrillRel; import org.apache.drill.exec.planner.sql.TypeInferenceUtils; import org.apache.drill.exec.store.direct.DirectGroupScan;
import com.google.common.collect.*; import java.util.*; import org.apache.calcite.plan.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.sql.type.*; import org.apache.drill.common.types.*; import org.apache.drill.exec.physical.base.*; import org.apache.drill.exec.planner.logical.*; import org.apache.drill.exec.planner.sql.*; import org.apache.drill.exec.store.direct.*;
[ "com.google.common", "java.util", "org.apache.calcite", "org.apache.drill" ]
com.google.common; java.util; org.apache.calcite; org.apache.drill;
2,814,911
void close(Handle handle) throws IOException;
void close(Handle handle) throws IOException;
/** * Close the handle obtained from one of the {@code open} methods * * @param handle The {@code Handle} to close * @throws IOException If failed to execute */
Close the handle obtained from one of the open methods
close
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/ssh/apache_mina/apache-sshd-1.2.0/sshd-core/src/main/java/org/apache/sshd/client/subsystem/sftp/SftpClient.java", "license": "gpl-3.0", "size": 25801 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
55,675
protected boolean processGainLossDistribution(boolean isShortTerm) { boolean result = true; List<PooledFundValue> pooledFundValues = null; int maxNumberOfTranLines = kemService.getMaxNumberOfTransactionLinesPerDocument(); // process gain/loss if (isShortTerm) { // 1. collect all PooledFundValue entries with ST_PROC_ON_DT equal to current date pooledFundValues = pooledFundValueService.getPooledFundValueWhereSTProcessOnDateIsCurrentDate(); } else { // 1. collect all PooledFundValue entries with LT_PROC_ON_DT equal to current date pooledFundValues = pooledFundValueService.getPooledFundValueWhereLTProcessOnDateIsCurrentDate(); } for (PooledFundValue pooledFundValue : pooledFundValues) { // 3. get all tax lots with security ID equal to pooledSecurityId List<HoldingTaxLot> holdingTaxLots = holdingTaxLotService.getTaxLotsPerSecurityIDWithUnitsGreaterThanZero(pooledFundValue.getPooledSecurityID()); // group by registration code if (holdingTaxLots != null) { // a map from registration code to taxlots Map<String, List<HoldingTaxLot>> regCodeMap = groupTaxLotsByRegistrationCode(holdingTaxLots); // for each security and registration code generate a new HoldingAdjustmentDocument for (String registrationCode : regCodeMap.keySet()) { List<HoldingTaxLot> taxLots = regCodeMap.get(registrationCode); // 4. generate Holding Adjustment document HoldingAdjustmentDocument holdingAdjustmentDocument = generateHoldingAdjustmentDocument(isShortTerm, pooledFundValue.getPooledSecurityID()); if (holdingAdjustmentDocument != null) { // add security details addSecurityDetails(holdingAdjustmentDocument, pooledFundValue.getPooledSecurityID(), registrationCode); initializeReportLines(holdingAdjustmentDocument.getDocumentNumber(), pooledFundValue.getPooledSecurityID()); int counter = 0; // add transaction lines if (taxLots != null) { for (HoldingTaxLot holdingTaxLot : taxLots) { // check if we reached the maximum number of transaction lines if (counter == maxNumberOfTranLines) { counter = 0; // route document validateAndRouteHoldingAdjustmentDocument(holdingAdjustmentDocument, pooledFundValue, isShortTerm); // generate a new Holding Adjustment document holdingAdjustmentDocument = generateHoldingAdjustmentDocument(isShortTerm, pooledFundValue.getPooledSecurityID()); if (holdingAdjustmentDocument != null) { // add security details addSecurityDetails(holdingAdjustmentDocument, pooledFundValue.getPooledSecurityID(), registrationCode); initializeReportLines(holdingAdjustmentDocument.getDocumentNumber(), pooledFundValue.getPooledSecurityID()); } } if (holdingAdjustmentDocument != null) { if (addTransactionLine(isShortTerm, holdingAdjustmentDocument, holdingTaxLot, pooledFundValue)) counter++; } } } if (holdingAdjustmentDocument != null) { // route document validateAndRouteHoldingAdjustmentDocument(holdingAdjustmentDocument, pooledFundValue, isShortTerm); } } } } } return result; }
boolean function(boolean isShortTerm) { boolean result = true; List<PooledFundValue> pooledFundValues = null; int maxNumberOfTranLines = kemService.getMaxNumberOfTransactionLinesPerDocument(); if (isShortTerm) { pooledFundValues = pooledFundValueService.getPooledFundValueWhereSTProcessOnDateIsCurrentDate(); } else { pooledFundValues = pooledFundValueService.getPooledFundValueWhereLTProcessOnDateIsCurrentDate(); } for (PooledFundValue pooledFundValue : pooledFundValues) { List<HoldingTaxLot> holdingTaxLots = holdingTaxLotService.getTaxLotsPerSecurityIDWithUnitsGreaterThanZero(pooledFundValue.getPooledSecurityID()); if (holdingTaxLots != null) { Map<String, List<HoldingTaxLot>> regCodeMap = groupTaxLotsByRegistrationCode(holdingTaxLots); for (String registrationCode : regCodeMap.keySet()) { List<HoldingTaxLot> taxLots = regCodeMap.get(registrationCode); HoldingAdjustmentDocument holdingAdjustmentDocument = generateHoldingAdjustmentDocument(isShortTerm, pooledFundValue.getPooledSecurityID()); if (holdingAdjustmentDocument != null) { addSecurityDetails(holdingAdjustmentDocument, pooledFundValue.getPooledSecurityID(), registrationCode); initializeReportLines(holdingAdjustmentDocument.getDocumentNumber(), pooledFundValue.getPooledSecurityID()); int counter = 0; if (taxLots != null) { for (HoldingTaxLot holdingTaxLot : taxLots) { if (counter == maxNumberOfTranLines) { counter = 0; validateAndRouteHoldingAdjustmentDocument(holdingAdjustmentDocument, pooledFundValue, isShortTerm); holdingAdjustmentDocument = generateHoldingAdjustmentDocument(isShortTerm, pooledFundValue.getPooledSecurityID()); if (holdingAdjustmentDocument != null) { addSecurityDetails(holdingAdjustmentDocument, pooledFundValue.getPooledSecurityID(), registrationCode); initializeReportLines(holdingAdjustmentDocument.getDocumentNumber(), pooledFundValue.getPooledSecurityID()); } } if (holdingAdjustmentDocument != null) { if (addTransactionLine(isShortTerm, holdingAdjustmentDocument, holdingTaxLot, pooledFundValue)) counter++; } } } if (holdingAdjustmentDocument != null) { validateAndRouteHoldingAdjustmentDocument(holdingAdjustmentDocument, pooledFundValue, isShortTerm); } } } } } return result; }
/** * Processes Short/Long Term Gains and Losses. * * @return true if successful, false otherwise */
Processes Short/Long Term Gains and Losses
processGainLossDistribution
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/batch/service/impl/CreateGainLossDistributionTransactionsServiceImpl.java", "license": "apache-2.0", "size": 31831 }
[ "java.util.List", "java.util.Map", "org.kuali.kfs.module.endow.businessobject.HoldingTaxLot", "org.kuali.kfs.module.endow.businessobject.PooledFundValue", "org.kuali.kfs.module.endow.document.HoldingAdjustmentDocument" ]
import java.util.List; import java.util.Map; import org.kuali.kfs.module.endow.businessobject.HoldingTaxLot; import org.kuali.kfs.module.endow.businessobject.PooledFundValue; import org.kuali.kfs.module.endow.document.HoldingAdjustmentDocument;
import java.util.*; import org.kuali.kfs.module.endow.businessobject.*; import org.kuali.kfs.module.endow.document.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
2,428,103
boolean regionStillCreated(DiskRegionView dr) { lock(false); try { return getDiskRegionById(dr.getId()) != null; } finally { unlock(false); } }
boolean regionStillCreated(DiskRegionView dr) { lock(false); try { return getDiskRegionById(dr.getId()) != null; } finally { unlock(false); } }
/** * Return true if the given dr is still created in this IF. */
Return true if the given dr is still created in this IF
regionStillCreated
{ "repo_name": "jdeppe-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/DiskInitFile.java", "license": "apache-2.0", "size": 87168 }
[ "org.apache.geode.internal.cache.persistence.DiskRegionView" ]
import org.apache.geode.internal.cache.persistence.DiskRegionView;
import org.apache.geode.internal.cache.persistence.*;
[ "org.apache.geode" ]
org.apache.geode;
641,849
protected void cacheAttribute(Attribute attr) { attrBuff.put(attr.getName(), attr); }
void function(Attribute attr) { attrBuff.put(attr.getName(), attr); }
/** * Adds the specified {@link Attribute} to the attribute cache. * * @param attr * The attribute to cache. */
Adds the specified <code>Attribute</code> to the attribute cache
cacheAttribute
{ "repo_name": "plasma-framework/plasma", "path": "plasma-common/src/main/java/javanet/staxutils/BaseXMLEventWriter.java", "license": "apache-2.0", "size": 17805 }
[ "javax.xml.stream.events.Attribute" ]
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.*;
[ "javax.xml" ]
javax.xml;
1,536,867
private void contractProcessingStart(Attributes attr) throws SAXException { String name = "", data = null; for (int i = 0; i < attr.getLength(); i++) { String localName = attr.getLocalName(i); String value = attr.getValue(i); if (Captions.NAME_ATT.equals(localName)) { // get the name of the contract name = value; } else if (Captions.DATA_ATT.equals(localName)) { // see whether we have a defined dataUri data = value; } } dataStream = null; if (null != data && !data.equals("")) { // try resolving the dataUri try { dataStream = resolverDispatcher.resolve(data); } catch (Exception e) { String error = DispatcherException.ERROR_500 + "\n" + "component: ContractBean" + "\n" + "message: ContractBean \"" + name + "\" has thrown an exception " + "resolving the dataUri \"" + data + "\".\n\n" + "dispatcherErrorStack:\n" + e; getLogger().error(error); throw new SAXException(error); } } try { // get the contract contract = contractRep.resolve(name); // prepare empty properties map localParams = new HashMap<String, Object>(map); localParams.put("contract.name", name); } catch (Exception e) { String error = DispatcherException.ERROR_500 + "\n" + "component: ContractBean" + "\n" + "message: Could not setup contractBean \"" + name + "\".\n\n" + "dispatcherErrorStack:\n" + e; getLogger().error(error); throw new SAXException(error); } }
void function(Attributes attr) throws SAXException { String name = STRSTR\nSTRcomponent: ContractBeanSTR\nSTRmessage: ContractBean \STR\" has thrown an exception STRresolving the dataUri \"STR\".\n\nSTRdispatcherErrorStack:\n" + e; getLogger().error(error); throw new SAXException(error); } } try { contract = contractRep.resolve(name); localParams = new HashMap<String, Object>(map); localParams.put(STR, name); } catch (Exception e) { String error = DispatcherException.ERROR_500 + "\nSTRcomponent: ContractBeanSTR\nSTRmessage: Could not setup contractBean \STR\".\n\nSTRdispatcherErrorStack:\n" + e; getLogger().error(error); throw new SAXException(error); } }
/** * Start the processing of the contract this includes to resolve the data * stream and the actual contract. * * @param attr * @throws SAXException */
Start the processing of the contract this includes to resolve the data stream and the actual contract
contractProcessingStart
{ "repo_name": "apache/forrest", "path": "whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java", "license": "apache-2.0", "size": 37726 }
[ "java.util.HashMap", "org.apache.forrest.dispatcher.exception.DispatcherException", "org.xml.sax.Attributes", "org.xml.sax.SAXException" ]
import java.util.HashMap; import org.apache.forrest.dispatcher.exception.DispatcherException; import org.xml.sax.Attributes; import org.xml.sax.SAXException;
import java.util.*; import org.apache.forrest.dispatcher.exception.*; import org.xml.sax.*;
[ "java.util", "org.apache.forrest", "org.xml.sax" ]
java.util; org.apache.forrest; org.xml.sax;
274,298
private static void deleteSubscription(CalendarEntry calendar) throws IOException, ServiceException { System.out.println("Deleting the subscription to the Doodles calendar"); calendar.delete(); }
static void function(CalendarEntry calendar) throws IOException, ServiceException { System.out.println(STR); calendar.delete(); }
/** * Deletes the given calendar entry. * * @param calendar The calendar entry to delete * @throws IOException If there is a problem communicating with the server. * @throws ServiceException If the service is unable to handle the request. */
Deletes the given calendar entry
deleteSubscription
{ "repo_name": "elhoim/gdata-client-java", "path": "java/sample/calendar/CalendarFeedDemo.java", "license": "apache-2.0", "size": 11567 }
[ "com.google.gdata.data.calendar.CalendarEntry", "com.google.gdata.util.ServiceException", "java.io.IOException" ]
import com.google.gdata.data.calendar.CalendarEntry; import com.google.gdata.util.ServiceException; import java.io.IOException;
import com.google.gdata.data.calendar.*; import com.google.gdata.util.*; import java.io.*;
[ "com.google.gdata", "java.io" ]
com.google.gdata; java.io;
1,098,416
public static String toJSON(List<OArchitectOClass> classes) { Args.notNull(classes, "classes"); JSONArray array = new JSONArray(classes); return array.toString(); }
static String function(List<OArchitectOClass> classes) { Args.notNull(classes, STR); JSONArray array = new JSONArray(classes); return array.toString(); }
/** * Convert list of {@link OArchitectOClass} to JSON array string * @param classes list of {@link OArchitectOClass} to convert to JSON * @return JSON string which contains JSON array with classes * @throws IllegalArgumentException if classes is null */
Convert list of <code>OArchitectOClass</code> to JSON array string
toJSON
{ "repo_name": "OrienteerBAP/Orienteer", "path": "orienteer-architect/src/main/java/org/orienteer/architect/util/JsonUtil.java", "license": "apache-2.0", "size": 5764 }
[ "com.github.openjson.JSONArray", "java.util.List", "org.apache.wicket.util.lang.Args", "org.orienteer.architect.model.OArchitectOClass" ]
import com.github.openjson.JSONArray; import java.util.List; import org.apache.wicket.util.lang.Args; import org.orienteer.architect.model.OArchitectOClass;
import com.github.openjson.*; import java.util.*; import org.apache.wicket.util.lang.*; import org.orienteer.architect.model.*;
[ "com.github.openjson", "java.util", "org.apache.wicket", "org.orienteer.architect" ]
com.github.openjson; java.util; org.apache.wicket; org.orienteer.architect;
788,105
private Node parse(String string) { return parseWarning(string); } private static class ParserResult { private final String code; private final Node node; private ParserResult(String code, Node node) { this.code = code; this.node = node; } }
Node function(String string) { return parseWarning(string); } private static class ParserResult { private final String code; private final Node node; private ParserResult(String code, Node node) { this.code = code; this.node = node; } }
/** * Verify that the given code has no parse warnings or errors. * @return The parse tree. */
Verify that the given code has no parse warnings or errors
parse
{ "repo_name": "lgeorgieff/closure-compiler", "path": "test/com/google/javascript/jscomp/parsing/NewParserTest.java", "license": "apache-2.0", "size": 94353 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
394,084
private void collapseAssign(NodeTraversal t, Node assign, Node expr, Node exprParent) { Node leftValue = assign.getFirstChild(); Node rightValue = leftValue.getNext(); if (isCollapsibleValue(leftValue, true) && collapseAssignEqualTo(expr, exprParent, leftValue)) { t.getCompiler().reportCodeChange(); } else if (isCollapsibleValue(rightValue, false) && collapseAssignEqualTo(expr, exprParent, rightValue)) { t.getCompiler().reportCodeChange(); } else if (rightValue.getType() == Token.ASSIGN) { // Recursively deal with nested assigns. collapseAssign(t, rightValue, expr, exprParent); } }
void function(NodeTraversal t, Node assign, Node expr, Node exprParent) { Node leftValue = assign.getFirstChild(); Node rightValue = leftValue.getNext(); if (isCollapsibleValue(leftValue, true) && collapseAssignEqualTo(expr, exprParent, leftValue)) { t.getCompiler().reportCodeChange(); } else if (isCollapsibleValue(rightValue, false) && collapseAssignEqualTo(expr, exprParent, rightValue)) { t.getCompiler().reportCodeChange(); } else if (rightValue.getType() == Token.ASSIGN) { collapseAssign(t, rightValue, expr, exprParent); } }
/** * Try to collapse the given assign into subsequent expressions. */
Try to collapse the given assign into subsequent expressions
collapseAssign
{ "repo_name": "ehsan/js-symbolic-executor", "path": "closure-compiler/src/com/google/javascript/jscomp/CollapseVariableDeclarations.java", "license": "apache-2.0", "size": 12466 }
[ "com.google.javascript.rhino.Node", "com.google.javascript.rhino.Token" ]
import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,796,730
public TrustManager[] getX509TrustManagers() { return x509TrustManagers; }
TrustManager[] function() { return x509TrustManagers; }
/** * Method description * * * */
Method description
getX509TrustManagers
{ "repo_name": "amikey/tigase-server", "path": "src/main/java/tigase/net/IOService.java", "license": "agpl-3.0", "size": 37437 }
[ "javax.net.ssl.TrustManager" ]
import javax.net.ssl.TrustManager;
import javax.net.ssl.*;
[ "javax.net" ]
javax.net;
2,564,590
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<CheckNameAvailabilityResponseInner>> checkNameAvailabilityWithResponseAsync( CheckNameAvailabilityRequest body) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (body == null) { return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); } else { body.validate(); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .checkNameAvailability( this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<CheckNameAvailabilityResponseInner>> function( CheckNameAvailabilityRequest body) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (body == null) { return Mono.error(new IllegalArgumentException(STR)); } else { body.validate(); } final String accept = STR; return FluxUtil .withContext( context -> service .checkNameAvailability( this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * Checks the name availability of the resource with requested resource name. * * @param body NameAvailabilityRequest object. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the check availability result along with {@link Response} on successful completion of {@link Mono}. */
Checks the name availability of the resource with requested resource name
checkNameAvailabilityWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/oep/azure-resourcemanager-oep/src/main/java/com/azure/resourcemanager/oep/implementation/LocationsClientImpl.java", "license": "mit", "size": 9383 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner", "com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.oep.fluent.models.CheckNameAvailabilityResponseInner; import com.azure.resourcemanager.oep.models.CheckNameAvailabilityRequest;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.oep.fluent.models.*; import com.azure.resourcemanager.oep.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
763,509
public LegendItemCollection getFixedLegendItems() { return this.fixedLegendItems; }
LegendItemCollection function() { return this.fixedLegendItems; }
/** * Returns the fixed legend items, if any. * * @return The legend items (possibly <code>null</code>). * * @see #setFixedLegendItems(LegendItemCollection) */
Returns the fixed legend items, if any
getFixedLegendItems
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/plot/CategoryPlot.java", "license": "mit", "size": 135372 }
[ "org.jfree.chart.LegendItemCollection" ]
import org.jfree.chart.LegendItemCollection;
import org.jfree.chart.*;
[ "org.jfree.chart" ]
org.jfree.chart;
1,342,536
private String processJobs(Collection<JSONObject> synchronousEntries) { Set<String> groupTags = new HashSet<String>(); synchronousJobArgs = new JSONArray(); for (JSONObject entry : synchronousEntries) { String groupTag = getGroupTag(entry); if (groupTags.contains(groupTag)) { continue; } groupTags.add(groupTag); JSONValue jobId = entry.get("job").isObject().get("id"); JSONObject groupArgs = new JSONObject(); groupArgs.put("job__id", jobId); groupArgs.put("execution_subdir", entry.get("execution_subdir")); synchronousJobArgs.set(synchronousJobArgs.size(), groupArgs); } List<String> groupTagList = new ArrayList<String>(groupTags); Collections.sort(groupTagList); return Utils.joinStrings(", ", groupTagList); }
String function(Collection<JSONObject> synchronousEntries) { Set<String> groupTags = new HashSet<String>(); synchronousJobArgs = new JSONArray(); for (JSONObject entry : synchronousEntries) { String groupTag = getGroupTag(entry); if (groupTags.contains(groupTag)) { continue; } groupTags.add(groupTag); JSONValue jobId = entry.get("job").isObject().get("id"); JSONObject groupArgs = new JSONObject(); groupArgs.put(STR, jobId); groupArgs.put(STR, entry.get(STR)); synchronousJobArgs.set(synchronousJobArgs.size(), groupArgs); } List<String> groupTagList = new ArrayList<String>(groupTags); Collections.sort(groupTagList); return Utils.joinStrings(STR, groupTagList); }
/** * Compute a list of job IDs and a comma-separated list of job tags, returning the latter. */
Compute a list of job IDs and a comma-separated list of job tags, returning the latter
processJobs
{ "repo_name": "nacc/autotest", "path": "frontend/client/src/autotest/afe/AbortSynchronousDialog.java", "license": "gpl-2.0", "size": 4171 }
[ "com.google.gwt.json.client.JSONArray", "com.google.gwt.json.client.JSONObject", "com.google.gwt.json.client.JSONValue", "java.util.ArrayList", "java.util.Collection", "java.util.Collections", "java.util.HashSet", "java.util.List", "java.util.Set" ]
import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONObject; import com.google.gwt.json.client.JSONValue; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set;
import com.google.gwt.json.client.*; import java.util.*;
[ "com.google.gwt", "java.util" ]
com.google.gwt; java.util;
2,547,474
public ImmutableMap<String, String> getLabelsToKeys() { if (labelsToKeys == null) { labelsToKeys = jpaTm() .transact( () -> jpaTm() .createQueryComposer(ClaimsEntry.class) .where("revisionId", EQ, revisionId) .stream() .collect( toImmutableMap( ClaimsEntry::getDomainLabel, ClaimsEntry::getClaimKey))); } return labelsToKeys; }
ImmutableMap<String, String> function() { if (labelsToKeys == null) { labelsToKeys = jpaTm() .transact( () -> jpaTm() .createQueryComposer(ClaimsEntry.class) .where(STR, EQ, revisionId) .stream() .collect( toImmutableMap( ClaimsEntry::getDomainLabel, ClaimsEntry::getClaimKey))); } return labelsToKeys; }
/** * Returns an {@link Map} mapping domain label to its lookup key. * * <p>Note that this involves a database fetch of a potentially large number of elements and * should be avoided unless necessary. */
Returns an <code>Map</code> mapping domain label to its lookup key. Note that this involves a database fetch of a potentially large number of elements and should be avoided unless necessary
getLabelsToKeys
{ "repo_name": "google/nomulus", "path": "core/src/main/java/google/registry/model/tmch/ClaimsList.java", "license": "apache-2.0", "size": 7612 }
[ "com.google.common.collect.ImmutableMap" ]
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
437,807
private void sendSpeaking(WebSocket websocket) { ObjectNode speakingPacket = JsonNodeFactory.instance.objectNode(); int speakingFlags = 0; for (SpeakingFlag flag : connection.getSpeakingFlags()) { speakingFlags |= flag.asInt(); } speakingPacket .put("op", VoiceGatewayOpcode.SPEAKING.getCode()) .putObject("d") .put("speaking", speakingFlags) .put("delay", 0) .put("ssrc", ssrc); logger.debug("Sending speaking packet for {} (packet: {})", connection, speakingPacket); WebSocketFrame speakingFrame = WebSocketFrame.createTextFrame(speakingPacket.toString()); websocket.sendFrame(speakingFrame); }
void function(WebSocket websocket) { ObjectNode speakingPacket = JsonNodeFactory.instance.objectNode(); int speakingFlags = 0; for (SpeakingFlag flag : connection.getSpeakingFlags()) { speakingFlags = flag.asInt(); } speakingPacket .put("op", VoiceGatewayOpcode.SPEAKING.getCode()) .putObject("d") .put(STR, speakingFlags) .put("delay", 0) .put("ssrc", ssrc); logger.debug(STR, connection, speakingPacket); WebSocketFrame speakingFrame = WebSocketFrame.createTextFrame(speakingPacket.toString()); websocket.sendFrame(speakingFrame); }
/** * Sends the speaking packet. * * @param websocket The websocket the packet should be sent to. */
Sends the speaking packet
sendSpeaking
{ "repo_name": "BtoBastian/Javacord", "path": "javacord-core/src/main/java/org/javacord/core/util/gateway/AudioWebSocketAdapter.java", "license": "lgpl-3.0", "size": 15925 }
[ "com.fasterxml.jackson.databind.node.JsonNodeFactory", "com.fasterxml.jackson.databind.node.ObjectNode", "com.neovisionaries.ws.client.WebSocket", "com.neovisionaries.ws.client.WebSocketFrame", "org.javacord.api.audio.SpeakingFlag" ]
import com.fasterxml.jackson.databind.node.JsonNodeFactory; import com.fasterxml.jackson.databind.node.ObjectNode; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketFrame; import org.javacord.api.audio.SpeakingFlag;
import com.fasterxml.jackson.databind.node.*; import com.neovisionaries.ws.client.*; import org.javacord.api.audio.*;
[ "com.fasterxml.jackson", "com.neovisionaries.ws", "org.javacord.api" ]
com.fasterxml.jackson; com.neovisionaries.ws; org.javacord.api;
1,808,412
@XmlElement(name = "storage_pool") public RelatedResourceRep getStoragePool() { return storagePool; }
@XmlElement(name = STR) RelatedResourceRep function() { return storagePool; }
/** * URI representing the storage pool supporting the unmanaged file * system. * */
URI representing the storage pool supporting the unmanaged file system
getStoragePool
{ "repo_name": "emcvipr/controller-client-java", "path": "models/src/main/java/com/emc/storageos/model/file/UnManagedFileSystemRestRep.java", "license": "apache-2.0", "size": 4225 }
[ "com.emc.storageos.model.RelatedResourceRep", "javax.xml.bind.annotation.XmlElement" ]
import com.emc.storageos.model.RelatedResourceRep; import javax.xml.bind.annotation.XmlElement;
import com.emc.storageos.model.*; import javax.xml.bind.annotation.*;
[ "com.emc.storageos", "javax.xml" ]
com.emc.storageos; javax.xml;
1,077,718
public List<String> getNewItems(Timestamp since, Timestamp to) throws SyncSourceException { try { return li.getNewEntries(since, to); } catch (LDAPAccessException e) { throw new SyncSourceException(e); } }
List<String> function(Timestamp since, Timestamp to) throws SyncSourceException { try { return li.getNewEntries(since, to); } catch (LDAPAccessException e) { throw new SyncSourceException(e); } }
/** * Get items that were created since 'since' * @throws SyncSourceException */
Get items that were created since 'since'
getNewItems
{ "repo_name": "ioggstream/funambol-ldap", "path": "src/main/java/com/funambol/LDAP/manager/impl/LDAPState.java", "license": "gpl-2.0", "size": 9306 }
[ "com.funambol.LDAP", "com.funambol.framework.engine.source.SyncSourceException", "java.sql.Timestamp", "java.util.List" ]
import com.funambol.LDAP; import com.funambol.framework.engine.source.SyncSourceException; import java.sql.Timestamp; import java.util.List;
import com.funambol.*; import com.funambol.framework.engine.source.*; import java.sql.*; import java.util.*;
[ "com.funambol", "com.funambol.framework", "java.sql", "java.util" ]
com.funambol; com.funambol.framework; java.sql; java.util;
326,605
public JSONObject sendHTTPSDelete(URL url) { JSONObject output = null; HttpsURLConnection con; try { con = (HttpsURLConnection) url.openConnection(); try { con.setRequestMethod("DELETE"); con.setDoOutput(true); try { BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); try { output = new JSONObject(response.toString()); } catch (JSONException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } catch (ProtocolException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } return output; }
JSONObject function(URL url) { JSONObject output = null; HttpsURLConnection con; try { con = (HttpsURLConnection) url.openConnection(); try { con.setRequestMethod(STR); con.setDoOutput(true); try { BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); try { output = new JSONObject(response.toString()); } catch (JSONException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } catch (ProtocolException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } return output; }
/** * Send https delete. * * @param url * the url * @return the JSON object */
Send https delete
sendHTTPSDelete
{ "repo_name": "quentinlesceller/OBC4J", "path": "src/main/java/tools/URLTools.java", "license": "apache-2.0", "size": 7978 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.InputStreamReader", "java.net.ProtocolException", "javax.net.ssl.HttpsURLConnection" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.ProtocolException; import javax.net.ssl.HttpsURLConnection;
import java.io.*; import java.net.*; import javax.net.ssl.*;
[ "java.io", "java.net", "javax.net" ]
java.io; java.net; javax.net;
1,689,355
public List<Action> getVersionedAction(final String id, final String version) { LOGGER.debug("Get list of actions of preparation #{} at version {}.", id, version); final PersistentPreparation preparation = preparationRepository.get(id, PersistentPreparation.class); if (preparation != null) { return getVersionedAction(preparation, version); } else { throw new TDPException(PREPARATION_DOES_NOT_EXIST, build().put(ID, id)); } }
List<Action> function(final String id, final String version) { LOGGER.debug(STR, id, version); final PersistentPreparation preparation = preparationRepository.get(id, PersistentPreparation.class); if (preparation != null) { return getVersionedAction(preparation, version); } else { throw new TDPException(PREPARATION_DOES_NOT_EXIST, build().put(ID, id)); } }
/** * Get all the actions of a preparation at given version. * * @param id the wanted preparation id. * @param version the wanted preparation version. * @return the list of actions. */
Get all the actions of a preparation at given version
getVersionedAction
{ "repo_name": "Talend/data-prep", "path": "dataprep-preparation/src/main/java/org/talend/dataprep/preparation/service/PreparationService.java", "license": "apache-2.0", "size": 70176 }
[ "java.util.List", "org.talend.daikon.exception.ExceptionContext", "org.talend.dataprep.api.preparation.Action", "org.talend.dataprep.exception.TDPException", "org.talend.dataprep.preparation.store.PersistentPreparation" ]
import java.util.List; import org.talend.daikon.exception.ExceptionContext; import org.talend.dataprep.api.preparation.Action; import org.talend.dataprep.exception.TDPException; import org.talend.dataprep.preparation.store.PersistentPreparation;
import java.util.*; import org.talend.daikon.exception.*; import org.talend.dataprep.api.preparation.*; import org.talend.dataprep.exception.*; import org.talend.dataprep.preparation.store.*;
[ "java.util", "org.talend.daikon", "org.talend.dataprep" ]
java.util; org.talend.daikon; org.talend.dataprep;
2,889,695
EClass getTNotificationInterface();
EClass getTNotificationInterface();
/** * Returns the meta object for class '{@link org.wso2.developerstudio.eclipse.humantask.model.ht.TNotificationInterface <em>TNotification Interface</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for class '<em>TNotification Interface</em>'. * @see org.wso2.developerstudio.eclipse.humantask.model.ht.TNotificationInterface * @generated */
Returns the meta object for class '<code>org.wso2.developerstudio.eclipse.humantask.model.ht.TNotificationInterface TNotification Interface</code>'.
getTNotificationInterface
{ "repo_name": "chanakaudaya/developer-studio", "path": "humantask/org.wso2.tools.humantask.model/src/org/wso2/carbonstudio/eclipse/humantask/model/ht/HTPackage.java", "license": "apache-2.0", "size": 247810 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,563,458
void integrate(SecondOrderDifferentialEquations equations, double t0, double[] y0, double[] yDot0, double t, double[] y, double[] yDot) throws MathUserException, IntegratorException;
void integrate(SecondOrderDifferentialEquations equations, double t0, double[] y0, double[] yDot0, double t, double[] y, double[] yDot) throws MathUserException, IntegratorException;
/** Integrate the differential equations up to the given time * @param equations differential equations to integrate * @param t0 initial time * @param y0 initial value of the state vector at t0 * @param yDot0 initial value of the first derivative of the state * vector at t0 * @param t target time for the integration * (can be set to a value smaller thant <code>t0</code> for backward integration) * @param y placeholder where to put the state vector at each * successful step (and hence at the end of integration), can be the * same object as y0 * @param yDot placeholder where to put the first derivative of * the state vector at time t, can be the same object as yDot0 * @throws IntegratorException if the integrator cannot perform integration * @throws MathUserException this exception is propagated to the caller if the * underlying user function triggers one */
Integrate the differential equations up to the given time
integrate
{ "repo_name": "SpoonLabs/astor", "path": "examples/math_57/src/main/java/org/apache/commons/math/ode/SecondOrderIntegrator.java", "license": "gpl-2.0", "size": 2532 }
[ "org.apache.commons.math.exception.MathUserException" ]
import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.*;
[ "org.apache.commons" ]
org.apache.commons;
2,084,691
public static boolean isValid( FileResource fileResource ) { if ( fileResource == null || fileResource.getContentType() == null || fileResource.getName() == null ) { return false; } if ( CONTENT_TYPES.contains( fileResource.getContentType().toLowerCase() ) ) { return false; } if ( FILE_EXTENSIONS.contains( FilenameUtils.getExtension( fileResource.getName().toLowerCase() ) ) ) { return false; } return true; }
static boolean function( FileResource fileResource ) { if ( fileResource == null fileResource.getContentType() == null fileResource.getName() == null ) { return false; } if ( CONTENT_TYPES.contains( fileResource.getContentType().toLowerCase() ) ) { return false; } if ( FILE_EXTENSIONS.contains( FilenameUtils.getExtension( fileResource.getName().toLowerCase() ) ) ) { return false; } return true; }
/** * Indicates whether the given file resource has a valid file extension and * content type according to the blacklist. * * @param fileResource the {@link FileResource}. * @return true if valid, false if invalid. */
Indicates whether the given file resource has a valid file extension and content type according to the blacklist
isValid
{ "repo_name": "hispindia/dhis2-Core", "path": "dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/fileresource/FileResourceBlocklist.java", "license": "bsd-3-clause", "size": 3625 }
[ "org.apache.commons.io.FilenameUtils" ]
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.*;
[ "org.apache.commons" ]
org.apache.commons;
2,513,046
public void setTextTypeface(Typeface tf);
void function(Typeface tf);
/** * Set's the Sets the typeface and style in which the text should be * displayed. Please see * {@link android.widget.TextView#setTypeface(Typeface) * TextView#setTypeface(Typeface)}. */
Set's the Sets the typeface and style in which the text should be displayed. Please see <code>android.widget.TextView#setTypeface(Typeface) TextView#setTypeface(Typeface)</code>
setTextTypeface
{ "repo_name": "tarksgit/Favorite-Android-Client", "path": "Favorite/src/com/tarks/favorite/pulltorefresh/library/ILoadingLayout.java", "license": "apache-2.0", "size": 1682 }
[ "android.graphics.Typeface" ]
import android.graphics.Typeface;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,853,418
void onTimeout(Timer timer);
void onTimeout(Timer timer);
/** * On timeout. * * @param timer the timer */
On timeout
onTimeout
{ "repo_name": "dimipapadeas/openwis", "path": "openwis-dataservice/openwis-dataservice-common/openwis-dataservice-common-timer/src/main/java/org/openwis/dataservice/common/timer/SubscriptionTimerService.java", "license": "gpl-3.0", "size": 660 }
[ "javax.ejb.Timer" ]
import javax.ejb.Timer;
import javax.ejb.*;
[ "javax.ejb" ]
javax.ejb;
2,610,991
public Connection getConnection(){ return con; }
Connection function(){ return con; }
/** * Returns the connection. * * @return {@code Connection} the connection object */
Returns the connection
getConnection
{ "repo_name": "TibiSecurity/progkorny", "path": "src/main/java/model/Database.java", "license": "apache-2.0", "size": 2155 }
[ "java.sql.Connection" ]
import java.sql.Connection;
import java.sql.*;
[ "java.sql" ]
java.sql;
450,058
@Override public void init(Properties config) throws ServletException { try { String principal = config.getProperty(PRINCIPAL); if (principal == null || principal.trim().length() == 0) { throw new ServletException("Principal not defined in configuration"); } keytab = config.getProperty(KEYTAB, keytab); if (keytab == null || keytab.trim().length() == 0) { throw new ServletException("Keytab not defined in configuration"); } if (!new File(keytab).exists()) { throw new ServletException("Keytab does not exist: " + keytab); } // use all SPNEGO principals in the keytab if a principal isn't // specifically configured final String[] spnegoPrincipals; if (principal.equals("*")) { spnegoPrincipals = KerberosUtil.getPrincipalNames( keytab, Pattern.compile("HTTP/.*")); if (spnegoPrincipals.length == 0) { throw new ServletException("Principals do not exist in the keytab"); } } else { spnegoPrincipals = new String[]{principal}; } String nameRules = config.getProperty(NAME_RULES, null); if (nameRules != null) { KerberosName.setRules(nameRules); } for (String spnegoPrincipal : spnegoPrincipals) { LOG.info("Login using keytab {}, for principal {}", keytab, spnegoPrincipal); final KerberosConfiguration kerberosConfiguration = new KerberosConfiguration(keytab, spnegoPrincipal); final LoginContext loginContext = new LoginContext("", serverSubject, null, kerberosConfiguration); try { loginContext.login(); } catch (LoginException le) { LOG.warn("Failed to login as [{}]", spnegoPrincipal, le); throw new AuthenticationException(le); } loginContexts.add(loginContext); } try { gssManager = Subject.doAs(serverSubject, new PrivilegedExceptionAction<GSSManager>() {
void function(Properties config) throws ServletException { try { String principal = config.getProperty(PRINCIPAL); if (principal == null principal.trim().length() == 0) { throw new ServletException(STR); } keytab = config.getProperty(KEYTAB, keytab); if (keytab == null keytab.trim().length() == 0) { throw new ServletException(STR); } if (!new File(keytab).exists()) { throw new ServletException(STR + keytab); } final String[] spnegoPrincipals; if (principal.equals("*")) { spnegoPrincipals = KerberosUtil.getPrincipalNames( keytab, Pattern.compile(STR)); if (spnegoPrincipals.length == 0) { throw new ServletException(STR); } } else { spnegoPrincipals = new String[]{principal}; } String nameRules = config.getProperty(NAME_RULES, null); if (nameRules != null) { KerberosName.setRules(nameRules); } for (String spnegoPrincipal : spnegoPrincipals) { LOG.info(STR, keytab, spnegoPrincipal); final KerberosConfiguration kerberosConfiguration = new KerberosConfiguration(keytab, spnegoPrincipal); final LoginContext loginContext = new LoginContext(STRFailed to login as [{}]", spnegoPrincipal, le); throw new AuthenticationException(le); } loginContexts.add(loginContext); } try { gssManager = Subject.doAs(serverSubject, new PrivilegedExceptionAction<GSSManager>() {
/** * Initializes the authentication handler instance. * <p/> * It creates a Kerberos context using the principal and keytab specified in the configuration. * <p/> * This method is invoked by the {@link AuthenticationFilter#init} method. * * @param config configuration properties to initialize the handler. * * @throws ServletException thrown if the handler could not be initialized. */
Initializes the authentication handler instance. It creates a Kerberos context using the principal and keytab specified in the configuration. This method is invoked by the <code>AuthenticationFilter#init</code> method
init
{ "repo_name": "Reidddddd/mo-hadoop2.6.0", "path": "hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/server/KerberosAuthenticationHandler.java", "license": "apache-2.0", "size": 15066 }
[ "java.io.File", "java.security.PrivilegedExceptionAction", "java.util.Properties", "java.util.regex.Pattern", "javax.security.auth.Subject", "javax.security.auth.login.LoginContext", "javax.servlet.ServletException", "org.apache.hadoop.security.authentication.client.AuthenticationException", "org.apache.hadoop.security.authentication.util.KerberosName", "org.apache.hadoop.security.authentication.util.KerberosUtil", "org.ietf.jgss.GSSManager" ]
import java.io.File; import java.security.PrivilegedExceptionAction; import java.util.Properties; import java.util.regex.Pattern; import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; import javax.servlet.ServletException; import org.apache.hadoop.security.authentication.client.AuthenticationException; import org.apache.hadoop.security.authentication.util.KerberosName; import org.apache.hadoop.security.authentication.util.KerberosUtil; import org.ietf.jgss.GSSManager;
import java.io.*; import java.security.*; import java.util.*; import java.util.regex.*; import javax.security.auth.*; import javax.security.auth.login.*; import javax.servlet.*; import org.apache.hadoop.security.authentication.client.*; import org.apache.hadoop.security.authentication.util.*; import org.ietf.jgss.*;
[ "java.io", "java.security", "java.util", "javax.security", "javax.servlet", "org.apache.hadoop", "org.ietf.jgss" ]
java.io; java.security; java.util; javax.security; javax.servlet; org.apache.hadoop; org.ietf.jgss;
2,429,250
public void setBound(int index) { if (index < -1) { throw new IllegalArgumentException("Bound cannot be " + index); } if (index < bound) { // truncation. Need to clear out data. int row = getMatrixRow(index); int from = getMatrixColumn(index) + 1; if (data[row] != null && from < data[row].length) { Arrays.fill(data[row], from, data[row].length, 0); } for (int r = row + 1; r < data.length; r++) { data[r] = null; } } bound = index; }
void function(int index) { if (index < -1) { throw new IllegalArgumentException(STR + index); } if (index < bound) { int row = getMatrixRow(index); int from = getMatrixColumn(index) + 1; if (data[row] != null && from < data[row].length) { Arrays.fill(data[row], from, data[row].length, 0); } for (int r = row + 1; r < data.length; r++) { data[r] = null; } } bound = index; }
/** * Expand the boundary to include the specified index, or, if the current * bound is larger, truncate the array to include nothing more than the * specified index. * * @param index * the index to include in the new bounds. -1 is allowed and it * means the IntArray will be empty. */
Expand the boundary to include the specified index, or, if the current bound is larger, truncate the array to include nothing more than the specified index
setBound
{ "repo_name": "rolfl/PrimUtils", "path": "src/main/java/net/tuis/primutils/IntArray.java", "license": "apache-2.0", "size": 13177 }
[ "java.util.Arrays", "net.tuis.primutils.ArrayOps" ]
import java.util.Arrays; import net.tuis.primutils.ArrayOps;
import java.util.*; import net.tuis.primutils.*;
[ "java.util", "net.tuis.primutils" ]
java.util; net.tuis.primutils;
1,620,881
String asEndpointUriXml(String scheme, Map<String, String> properties, boolean encode) throws URISyntaxException;
String asEndpointUriXml(String scheme, Map<String, String> properties, boolean encode) throws URISyntaxException;
/** * Creates an endpoint uri in XML style (eg escape & as &ampl;) from the information from the properties * * @param scheme the endpoint schema * @param properties the properties as key value pairs * @param encode whether to URL encode the returned uri or not * @return the constructed endpoint uri * @throws java.net.URISyntaxException is thrown if there is encoding error */
Creates an endpoint uri in XML style (eg escape & as &ampl;) from the information from the properties
asEndpointUriXml
{ "repo_name": "RohanHart/camel", "path": "platforms/catalog/src/main/java/org/apache/camel/catalog/CamelCatalog.java", "license": "apache-2.0", "size": 19764 }
[ "java.net.URISyntaxException", "java.util.Map" ]
import java.net.URISyntaxException; import java.util.Map;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
906,907
private void searchActioned() { RenderTime timer = new RenderTime(drone.getDefaultWaitTime()); while (true) { try { timer.start(); if (hasResults()) { break; } if (isMessageScreenDisplayed()) { String msg = drone.find(By.cssSelector("tbody.yui-dt-message")).getText(); if ("No sites found".equalsIgnoreCase(msg.trim())) { break; } } } finally { timer.end(); } } }
void function() { RenderTime timer = new RenderTime(drone.getDefaultWaitTime()); while (true) { try { timer.start(); if (hasResults()) { break; } if (isMessageScreenDisplayed()) { String msg = drone.find(By.cssSelector(STR)).getText(); if (STR.equalsIgnoreCase(msg.trim())) { break; } } } finally { timer.end(); } } }
/** * Checks if search has been actioned by * checking the results is populated or empty * result message is displayed. */
Checks if search has been actioned by checking the results is populated or empty result message is displayed
searchActioned
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/share-po/src/main/java/org/alfresco/po/share/site/SiteFinderPage.java", "license": "lgpl-3.0", "size": 15774 }
[ "org.alfresco.webdrone.RenderTime", "org.openqa.selenium.By" ]
import org.alfresco.webdrone.RenderTime; import org.openqa.selenium.By;
import org.alfresco.webdrone.*; import org.openqa.selenium.*;
[ "org.alfresco.webdrone", "org.openqa.selenium" ]
org.alfresco.webdrone; org.openqa.selenium;
956,067
public void testCloseConsumerBeforeCommit() throws Exception { TextMessage[] outbound = new TextMessage[]{session.createTextMessage("First Message"), session.createTextMessage("Second Message")}; // lets consume any outstanding messages from prev test runs beginTx(); while (consumer.receiveNoWait() != null) { } commitTx(); // sends the messages beginTx(); producer.send(outbound[0]); producer.send(outbound[1]); commitTx(); LOG.info("Sent 0: " + outbound[0]); LOG.info("Sent 1: " + outbound[1]); beginTx(); TextMessage message = (TextMessage) consumer.receive(1000); assertEquals(outbound[0].getText(), message.getText()); // Close the consumer before the commit. This should not cause the // received message // to rollback. consumer.close(); commitTx(); // Create a new consumer consumer = resourceProvider.createConsumer(session, destination); LOG.info("Created consumer: " + consumer); beginTx(); message = (TextMessage) consumer.receive(1000); assertEquals(outbound[1].getText(), message.getText()); commitTx(); }
void function() throws Exception { TextMessage[] outbound = new TextMessage[]{session.createTextMessage(STR), session.createTextMessage(STR)}; beginTx(); while (consumer.receiveNoWait() != null) { } commitTx(); beginTx(); producer.send(outbound[0]); producer.send(outbound[1]); commitTx(); LOG.info(STR + outbound[0]); LOG.info(STR + outbound[1]); beginTx(); TextMessage message = (TextMessage) consumer.receive(1000); assertEquals(outbound[0].getText(), message.getText()); consumer.close(); commitTx(); consumer = resourceProvider.createConsumer(session, destination); LOG.info(STR + consumer); beginTx(); message = (TextMessage) consumer.receive(1000); assertEquals(outbound[1].getText(), message.getText()); commitTx(); }
/** * Tests if the messages can still be received if the consumer is closed * (session is not closed). * * @throws Exception see http://jira.codehaus.org/browse/AMQ-143 */
Tests if the messages can still be received if the consumer is closed (session is not closed)
testCloseConsumerBeforeCommit
{ "repo_name": "cshannon/activemq-artemis", "path": "tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTransactionTestSupport.java", "license": "apache-2.0", "size": 22260 }
[ "javax.jms.TextMessage" ]
import javax.jms.TextMessage;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,179,709
public void setSimilarAlbums(List<Album> similarAlbums){ this.similarAlbums = similarAlbums; }
void function(List<Album> similarAlbums){ this.similarAlbums = similarAlbums; }
/** * Set similar albums for this album. * * @param similarAlbums A {@link List} of {@link Album} objects. */
Set similar albums for this album
setSimilarAlbums
{ "repo_name": "levsa/jotify", "path": "src/de/felixbruns/jotify/media/Album.java", "license": "bsd-2-clause", "size": 6615 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,846,584
EReference getAttribute2Attribute_Modifiers();
EReference getAttribute2Attribute_Modifiers();
/** * Returns the meta object for the containment reference list '{@link org.eclectic.frontend.mappings.Attribute2Attribute#getModifiers <em>Modifiers</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Modifiers</em>'. * @see org.eclectic.frontend.mappings.Attribute2Attribute#getModifiers() * @see #getAttribute2Attribute() * @generated */
Returns the meta object for the containment reference list '<code>org.eclectic.frontend.mappings.Attribute2Attribute#getModifiers Modifiers</code>'.
getAttribute2Attribute_Modifiers
{ "repo_name": "jesusc/eclectic", "path": "plugins/org.eclectic.frontend.asm/src-gen/org/eclectic/frontend/mappings/MappingsPackage.java", "license": "gpl-3.0", "size": 129327 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
228,054
@ReactMethod public void connect(String address) { BluetoothDevice device = this.mPeripherals.get(address); WritableMap params = Arguments.createMap(); if (mBluetoothGattCallbackHandler != null && mBluetoothGattCallbackHandler.getmBluetoothGatt() != null) { mBluetoothGattCallbackHandler.getmBluetoothGatt().close(); mBluetoothGattCallbackHandler = null; } if (device != null) { mBluetoothGattCallbackHandler = new BluetoothGattCallbackHandler(this.getReactApplicationContext()); device.connectGatt(this.getReactApplicationContext(), true, mBluetoothGattCallbackHandler); } else { params.putString("error", "Device not found"); sendEvent(this.getReactApplicationContext(), "ble.connect", params); } }
void function(String address) { BluetoothDevice device = this.mPeripherals.get(address); WritableMap params = Arguments.createMap(); if (mBluetoothGattCallbackHandler != null && mBluetoothGattCallbackHandler.getmBluetoothGatt() != null) { mBluetoothGattCallbackHandler.getmBluetoothGatt().close(); mBluetoothGattCallbackHandler = null; } if (device != null) { mBluetoothGattCallbackHandler = new BluetoothGattCallbackHandler(this.getReactApplicationContext()); device.connectGatt(this.getReactApplicationContext(), true, mBluetoothGattCallbackHandler); } else { params.putString("error", STR); sendEvent(this.getReactApplicationContext(), STR, params); } }
/** * Connect to device * @param address of the device */
Connect to device
connect
{ "repo_name": "Shakarang/react-native-ble", "path": "android/src/main/java/com/maximejunger/react/RNBLEModule.java", "license": "mit", "size": 16430 }
[ "android.bluetooth.BluetoothDevice", "com.facebook.react.bridge.Arguments", "com.facebook.react.bridge.WritableMap" ]
import android.bluetooth.BluetoothDevice; import com.facebook.react.bridge.Arguments; import com.facebook.react.bridge.WritableMap;
import android.bluetooth.*; import com.facebook.react.bridge.*;
[ "android.bluetooth", "com.facebook.react" ]
android.bluetooth; com.facebook.react;
1,495,017
private Job createJob(File hadoopTmpDir) throws IOException { Job job = Job.getInstance(new Configuration(hConf)); Configuration jobConf = job.getConfiguration(); if (MapReduceTaskContextProvider.isLocal(jobConf)) { // Set the MR framework local directories inside the given tmp directory. // Setting "hadoop.tmp.dir" here has no effect due to Explore Service need to set "hadoop.tmp.dir" // as system property for Hive to work in local mode. The variable substitution of hadoop conf // gives system property the highest precedence. jobConf.set("mapreduce.cluster.local.dir", new File(hadoopTmpDir, "local").getAbsolutePath()); jobConf.set("mapreduce.jobtracker.system.dir", new File(hadoopTmpDir, "system").getAbsolutePath()); jobConf.set("mapreduce.jobtracker.staging.root.dir", new File(hadoopTmpDir, "staging").getAbsolutePath()); jobConf.set("mapreduce.cluster.temp.dir", new File(hadoopTmpDir, "temp").getAbsolutePath()); } if (UserGroupInformation.isSecurityEnabled()) { // If runs in secure cluster, this program runner is running in a yarn container, hence not able // to get authenticated with the history. jobConf.unset("mapreduce.jobhistory.address"); jobConf.setBoolean(Job.JOB_AM_ACCESS_DISABLED, false); Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials(); LOG.info("Running in secure mode; adding all user credentials: {}", credentials.getAllTokens()); job.getCredentials().addAll(credentials); } return job; }
Job function(File hadoopTmpDir) throws IOException { Job job = Job.getInstance(new Configuration(hConf)); Configuration jobConf = job.getConfiguration(); if (MapReduceTaskContextProvider.isLocal(jobConf)) { jobConf.set(STR, new File(hadoopTmpDir, "local").getAbsolutePath()); jobConf.set(STR, new File(hadoopTmpDir, STR).getAbsolutePath()); jobConf.set(STR, new File(hadoopTmpDir, STR).getAbsolutePath()); jobConf.set(STR, new File(hadoopTmpDir, "temp").getAbsolutePath()); } if (UserGroupInformation.isSecurityEnabled()) { jobConf.unset(STR); jobConf.setBoolean(Job.JOB_AM_ACCESS_DISABLED, false); Credentials credentials = UserGroupInformation.getCurrentUser().getCredentials(); LOG.info(STR, credentials.getAllTokens()); job.getCredentials().addAll(credentials); } return job; }
/** * Creates a MapReduce {@link Job} instance. * * @param hadoopTmpDir directory for the "hadoop.tmp.dir" configuration */
Creates a MapReduce <code>Job</code> instance
createJob
{ "repo_name": "caskdata/cdap", "path": "cdap-app-fabric/src/main/java/co/cask/cdap/internal/app/runtime/batch/MapReduceRuntimeService.java", "license": "apache-2.0", "size": 55733 }
[ "java.io.File", "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.mapreduce.Job", "org.apache.hadoop.security.Credentials", "org.apache.hadoop.security.UserGroupInformation" ]
import java.io.File; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.security.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,053,832
public boolean isAccessibilityFocused() { if (Build.VERSION.SDK_INT >= 16) { return mInfo.isAccessibilityFocused(); } else { return false; } }
boolean function() { if (Build.VERSION.SDK_INT >= 16) { return mInfo.isAccessibilityFocused(); } else { return false; } }
/** * Gets whether this node is accessibility focused. * * @return True if the node is accessibility focused. */
Gets whether this node is accessibility focused
isAccessibilityFocused
{ "repo_name": "AndroidX/androidx", "path": "core/core/src/main/java/androidx/core/view/accessibility/AccessibilityNodeInfoCompat.java", "license": "apache-2.0", "size": 160272 }
[ "android.os.Build" ]
import android.os.Build;
import android.os.*;
[ "android.os" ]
android.os;
10,940
public RowMetaInterface getStepFields( StepMeta[] stepMeta ) throws KettleStepException { RowMetaInterface fields = new RowMeta(); for ( int i = 0; i < stepMeta.length; i++ ) { RowMetaInterface flds = getStepFields( stepMeta[i] ); if ( flds != null ) { fields.mergeRowMeta( flds ); } } return fields; }
RowMetaInterface function( StepMeta[] stepMeta ) throws KettleStepException { RowMetaInterface fields = new RowMeta(); for ( int i = 0; i < stepMeta.length; i++ ) { RowMetaInterface flds = getStepFields( stepMeta[i] ); if ( flds != null ) { fields.mergeRowMeta( flds ); } } return fields; }
/** * Gets the fields for each of the specified steps and merges them into a single set * * @param stepMeta * the step meta * @return an interface to the step fields * @throws KettleStepException * the kettle step exception */
Gets the fields for each of the specified steps and merges them into a single set
getStepFields
{ "repo_name": "eayoungs/pentaho-kettle", "path": "engine/src/org/pentaho/di/trans/TransMeta.java", "license": "apache-2.0", "size": 221441 }
[ "org.pentaho.di.core.exception.KettleStepException", "org.pentaho.di.core.row.RowMeta", "org.pentaho.di.core.row.RowMetaInterface", "org.pentaho.di.trans.step.StepMeta" ]
import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMeta; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; import org.pentaho.di.trans.step.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,316,548
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { populateAutoComplete(); } } }
void function(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == REQUEST_READ_CONTACTS) { if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { populateAutoComplete(); } } }
/** * Callback received when a permissions request has been completed. */
Callback received when a permissions request has been completed
onRequestPermissionsResult
{ "repo_name": "Erlomt/Produktivitaetserhoehung-durch-Verhaltensanalyse", "path": "Android/app/src/main/java/at/passini/pedva/LoginActivity.java", "license": "gpl-2.0", "size": 14007 }
[ "android.content.pm.PackageManager", "android.support.annotation.NonNull" ]
import android.content.pm.PackageManager; import android.support.annotation.NonNull;
import android.content.pm.*; import android.support.annotation.*;
[ "android.content", "android.support" ]
android.content; android.support;
1,717,253
OAuth2AccessToken createAccessToken(OAuth2Authentication authentication) throws AuthenticationException;
OAuth2AccessToken createAccessToken(OAuth2Authentication authentication) throws AuthenticationException;
/** * Create an access token associated with the specified credentials. * @param authentication The credentials associated with the access token. * @return The access token. * @throws AuthenticationException If the credentials are inadequate. */
Create an access token associated with the specified credentials
createAccessToken
{ "repo_name": "jgrandja/spring-security-oauth", "path": "spring-security-oauth2/src/main/java/org/springframework/security/oauth2/provider/token/AuthorizationServerTokenServices.java", "license": "apache-2.0", "size": 2328 }
[ "org.springframework.security.core.AuthenticationException", "org.springframework.security.oauth2.common.OAuth2AccessToken", "org.springframework.security.oauth2.provider.OAuth2Authentication" ]
import org.springframework.security.core.AuthenticationException; import org.springframework.security.oauth2.common.OAuth2AccessToken; import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.core.*; import org.springframework.security.oauth2.common.*; import org.springframework.security.oauth2.provider.*;
[ "org.springframework.security" ]
org.springframework.security;
1,776,933
public String freeDiskSpace() throws IOException { long before = cache.showFreeSpace(); cache.freeDiskSpace(false); // cleans the cache and wait until clean // process is done. (not in background) return getDeleteResult(before); }
String function() throws IOException { long before = cache.showFreeSpace(); cache.freeDiskSpace(false); return getDeleteResult(before); }
/** * Cleans the cache if necessary. * * @throws IOException * */
Cleans the cache if necessary
freeDiskSpace
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4jboss-all/trunk/dcm4jboss-wado/src/java/org/dcm4chex/wado/mbean/AbstractCacheService.java", "license": "apache-2.0", "size": 9139 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
993,577
@Override public @Nonnull JPopupMenuFixture showPopupMenu() { return table.showPopupMenuAt(cell()); }
@Nonnull JPopupMenuFixture function() { return table.showPopupMenuAt(cell()); }
/** * Shows a pop-up menu using this fixture's table cell as the invoker of the pop-up menu. * * @return a fixture that manages the displayed pop-up menu. * @throws ComponentLookupException if a pop-up menu cannot be found. */
Shows a pop-up menu using this fixture's table cell as the invoker of the pop-up menu
showPopupMenu
{ "repo_name": "google/fest", "path": "third_party/fest-swing/src/main/java/org/fest/swing/fixture/JTableCellFixture.java", "license": "apache-2.0", "size": 16121 }
[ "javax.annotation.Nonnull" ]
import javax.annotation.Nonnull;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
588,209
private boolean isRetryableError(Code rc) { return retryableErrors.contains(rc); }
boolean function(Code rc) { return retryableErrors.contains(rc); }
/** * Returns true if the given error is temporary and may be retried. * * @param rc result code * @return true if error may be retried, false otherwise */
Returns true if the given error is temporary and may be retried
isRetryableError
{ "repo_name": "edmunds/zookeeper-common", "path": "src/main/java/com/edmunds/zookeeper/connection/ZooKeeperNodeInitializer.java", "license": "apache-2.0", "size": 4855 }
[ "org.apache.zookeeper.KeeperException" ]
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.*;
[ "org.apache.zookeeper" ]
org.apache.zookeeper;
2,181,015
public static List<Record> findByCache(String cacheName, Object key, String sql, Object... paras) { return dbPro.findByCache(cacheName, key, sql, paras); }
static List<Record> function(String cacheName, Object key, String sql, Object... paras) { return dbPro.findByCache(cacheName, key, sql, paras); }
/** * Find Record by cache. * @see #find(String, Object...) * @param cacheName the cache name * @param key the key used to get date from cache * @return the list of Record */
Find Record by cache
findByCache
{ "repo_name": "shootboss/goja", "path": "goja-jfinal/src/main/java/com/jfinal/plugin/activerecord/Db.java", "license": "mit", "size": 15284 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,586,066
public static SamlMetadataUIInfo locateMetadataUserInterfaceForEntityId(final MetadataResolverAdapter metadataAdapter, final String entityId, final RegisteredService registeredService, final HttpServletRequest requestContext) { val entityDescriptor = metadataAdapter.getEntityDescriptorForEntityId(entityId); return locateMetadataUserInterfaceForEntityId(entityDescriptor, entityId, registeredService, requestContext); }
static SamlMetadataUIInfo function(final MetadataResolverAdapter metadataAdapter, final String entityId, final RegisteredService registeredService, final HttpServletRequest requestContext) { val entityDescriptor = metadataAdapter.getEntityDescriptorForEntityId(entityId); return locateMetadataUserInterfaceForEntityId(entityDescriptor, entityId, registeredService, requestContext); }
/** * Locate MDUI for entity id simple metadata ui info. * * @param metadataAdapter the metadata adapter * @param entityId the entity id * @param registeredService the registered service * @param requestContext the request context * @return the simple metadata ui info */
Locate MDUI for entity id simple metadata ui info
locateMetadataUserInterfaceForEntityId
{ "repo_name": "robertoschwald/cas", "path": "support/cas-server-support-saml-mdui-core/src/main/java/org/apereo/cas/support/saml/mdui/MetadataUIUtils.java", "license": "apache-2.0", "size": 4730 }
[ "javax.servlet.http.HttpServletRequest", "org.apereo.cas.services.RegisteredService" ]
import javax.servlet.http.HttpServletRequest; import org.apereo.cas.services.RegisteredService;
import javax.servlet.http.*; import org.apereo.cas.services.*;
[ "javax.servlet", "org.apereo.cas" ]
javax.servlet; org.apereo.cas;
9,126
public ShortBuffer createShortBuffer() { return createByteBuffer().asShortBuffer(); } private static final int BYTES_PER_PIXEL = Short.SIZE / 8;
ShortBuffer function() { return createByteBuffer().asShortBuffer(); } private static final int BYTES_PER_PIXEL = Short.SIZE / 8;
/** * Creates a buffer suitable for storing a ShortMap * @return The buffer created */
Creates a buffer suitable for storing a ShortMap
createShortBuffer
{ "repo_name": "Wessi/OpenNI", "path": "Wrappers/OpenNI.java/src/org/openni/ShortMap.java", "license": "apache-2.0", "size": 3021 }
[ "java.nio.ShortBuffer" ]
import java.nio.ShortBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
2,464,717