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
public void setInterpolator(Interpolator interpolator) { scroller.setInterpolator(interpolator); }
void function(Interpolator interpolator) { scroller.setInterpolator(interpolator); }
/** * Set the the specified scrolling interpolator * * @param interpolator * the interpolator */
Set the the specified scrolling interpolator
setInterpolator
{ "repo_name": "ehrid/countriesYouVisited", "path": "src/com/countriesyouvisited/wheel/WheelView.java", "license": "mit", "size": 25376 }
[ "android.view.animation.Interpolator" ]
import android.view.animation.Interpolator;
import android.view.animation.*;
[ "android.view" ]
android.view;
2,047,466
@Override @Test @BMRules(rules = {@BMRule(name = "test logAll EVENT", targetClass = "org.jboss.logging.Logger", targetMethod = "logv", targetLocation = "ENTRY", action = "org.apache.activemq.artemis.tests.extras.byteman.LoggingActiveMQServerPluginTest.infoLog($2, $4, $0)")}) public void testLogAll() throws Exception { //initial plugin ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_ALL_EVENTS); activeMQServer.start(); try { sendAndReceive(true, true, "log ALL Message_1", 0); sendAndReceive(true, true, "log ALL Message_2", 0); Thread.sleep(500); for (String log : unexpectedLogs) { System.out.println(" others events logged >>>>" + log); } assertEquals("created connections", 2, createdConnectionLogs.size()); assertEquals("destroyed connections", 2, destroyedConnectionLogs.size()); //assertEquals("created sessions", 0, createdSessionLogs.size()); //assertEquals("closed sessions", 0, createdSessionLogs.size()); assertEquals("created consumer", 2, createdConsumerLogs.size()); assertEquals("closed consumer", 2, closedConsumerLogs.size()); assertEquals("delivered message", 2, deliveredLogs.size()); assertEquals("acked message", 2, ackedLogs.size()); assertEquals("sending message", 2, sentLogs.size()); assertEquals("routing message", 2, routedLogs.size()); assertEquals("queue created", 1, createdQueueLogs.size()); assertEquals("queue destroyed", 0, destroyedQueueLogs.size()); assertEquals("expired message", 0, messageExpiredLogs.size()); } finally { activeMQServer.stop(); //reset the logs lists clearLogLists(); } }
@BMRules(rules = {@BMRule(name = STR, targetClass = STR, targetMethod = "logv", targetLocation = "ENTRY", action = STR)}) void function() throws Exception { ActiveMQServer activeMQServer = createServerWithLoggingPlugin(LoggingActiveMQServerPlugin.LOG_ALL_EVENTS); activeMQServer.start(); try { sendAndReceive(true, true, STR, 0); sendAndReceive(true, true, STR, 0); Thread.sleep(500); for (String log : unexpectedLogs) { System.out.println(STR + log); } assertEquals(STR, 2, createdConnectionLogs.size()); assertEquals(STR, 2, destroyedConnectionLogs.size()); assertEquals(STR, 2, createdConsumerLogs.size()); assertEquals(STR, 2, closedConsumerLogs.size()); assertEquals(STR, 2, deliveredLogs.size()); assertEquals(STR, 2, ackedLogs.size()); assertEquals(STR, 2, sentLogs.size()); assertEquals(STR, 2, routedLogs.size()); assertEquals(STR, 1, createdQueueLogs.size()); assertEquals(STR, 0, destroyedQueueLogs.size()); assertEquals(STR, 0, messageExpiredLogs.size()); } finally { activeMQServer.stop(); clearLogLists(); } }
/** * Aim: test all events are logged when plugin configured with * LOG_ALL_EVENTS * * Overridden as behaviour slightly different for queue create/destroy with Openwire * * @throws Exception */
Aim: test all events are logged when plugin configured with LOG_ALL_EVENTS Overridden as behaviour slightly different for queue create/destroy with Openwire
testLogAll
{ "repo_name": "mnovak1/activemq-artemis", "path": "tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/LoggingActiveMQServerPluginOpenWireTest.java", "license": "apache-2.0", "size": 7466 }
[ "org.apache.activemq.artemis.core.server.ActiveMQServer", "org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin", "org.jboss.byteman.contrib.bmunit.BMRule", "org.jboss.byteman.contrib.bmunit.BMRules" ]
import org.apache.activemq.artemis.core.server.ActiveMQServer; import org.apache.activemq.artemis.core.server.plugin.impl.LoggingActiveMQServerPlugin; import org.jboss.byteman.contrib.bmunit.BMRule; import org.jboss.byteman.contrib.bmunit.BMRules;
import org.apache.activemq.artemis.core.server.*; import org.apache.activemq.artemis.core.server.plugin.impl.*; import org.jboss.byteman.contrib.bmunit.*;
[ "org.apache.activemq", "org.jboss.byteman" ]
org.apache.activemq; org.jboss.byteman;
1,777,767
public void remove(SnmpOidTable table) throws SnmpStatusException;
void function(SnmpOidTable table) throws SnmpStatusException;
/** * Removes an <CODE>SnmpOidTable</CODE> object from this <CODE>SnmpOidDatabase</CODE>. * @param table The table to be removed. */
Removes an <code>SnmpOidTable</code> object from this <code>SnmpOidDatabase</code>
remove
{ "repo_name": "wangsongpeng/jdk-src", "path": "src/main/java/com/sun/jmx/snmp/SnmpOidDatabase.java", "license": "apache-2.0", "size": 2876 }
[ "com.sun.jmx.snmp.SnmpOidTable", "com.sun.jmx.snmp.SnmpStatusException" ]
import com.sun.jmx.snmp.SnmpOidTable; import com.sun.jmx.snmp.SnmpStatusException;
import com.sun.jmx.snmp.*;
[ "com.sun.jmx" ]
com.sun.jmx;
2,407,931
public static final Modification getModificationItem( List<Modification> mods, AttributeType type ) { for ( Modification modification : mods ) { Attribute attribute = modification.getAttribute(); if ( attribute.getAttributeType() == type ) { return modification; } } return null; }
static final Modification function( List<Modification> mods, AttributeType type ) { for ( Modification modification : mods ) { Attribute attribute = modification.getAttribute(); if ( attribute.getAttributeType() == type ) { return modification; } } return null; }
/** * Utility method to extract a modification item from an array of modifications. * * @param mods the array of ModificationItems to extract the Attribute from. * @param type the attributeType spec of the Attribute to extract * @return the modification item on the attributeType specified */
Utility method to extract a modification item from an array of modifications
getModificationItem
{ "repo_name": "darranl/directory-server", "path": "core-api/src/main/java/org/apache/directory/server/core/api/entry/ServerEntryUtils.java", "license": "apache-2.0", "size": 30055 }
[ "java.util.List", "org.apache.directory.api.ldap.model.entry.Attribute", "org.apache.directory.api.ldap.model.entry.Modification", "org.apache.directory.api.ldap.model.schema.AttributeType" ]
import java.util.List; import org.apache.directory.api.ldap.model.entry.Attribute; import org.apache.directory.api.ldap.model.entry.Modification; import org.apache.directory.api.ldap.model.schema.AttributeType;
import java.util.*; import org.apache.directory.api.ldap.model.entry.*; import org.apache.directory.api.ldap.model.schema.*;
[ "java.util", "org.apache.directory" ]
java.util; org.apache.directory;
503,107
public static Type forMethodParameter(MethodParameter methodParameter) { return forTypeProvider(new MethodParameterTypeProvider(methodParameter)); }
static Type function(MethodParameter methodParameter) { return forTypeProvider(new MethodParameterTypeProvider(methodParameter)); }
/** * Return a {@link Serializable} variant of * {@link MethodParameter#getGenericParameterType()}. */
Return a <code>Serializable</code> variant of <code>MethodParameter#getGenericParameterType()</code>
forMethodParameter
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/spring-jdk9/src/spring.core/org/springframework/core/SerializableTypeWrapper.java", "license": "mit", "size": 12543 }
[ "java.lang.reflect.Type" ]
import java.lang.reflect.Type;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,052,122
public synchronized void stop() { if (watchThread != null) { try { running.set(false); watchThread.interrupt(); // Call after-stop hook afterStop(); } catch (IOException e) { logger.log(Level.FINE, "Could not close watcher", e); } } }
synchronized void function() { if (watchThread != null) { try { running.set(false); watchThread.interrupt(); afterStop(); } catch (IOException e) { logger.log(Level.FINE, STR, e); } } }
/** * Stops the watch thread by interrupting it and subsequently * calls the {@link #afterStop()} template method (to be implemented * by subclasses. */
Stops the watch thread by interrupting it and subsequently calls the <code>#afterStop()</code> template method (to be implemented by subclasses
stop
{ "repo_name": "syncany/syncany-plugin-dropbox", "path": "core/syncany-lib/src/main/java/org/syncany/operations/watch/RecursiveWatcher.java", "license": "gpl-3.0", "size": 6632 }
[ "java.io.IOException", "java.util.logging.Level" ]
import java.io.IOException; import java.util.logging.Level;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,445,369
public Node getUnderlyingNode() { return underlyingNode; }
Node function() { return underlyingNode; }
/** * Returns the underlying node representing this timeline. * * @return The underlying node representing this timeline */
Returns the underlying node representing this timeline
getUnderlyingNode
{ "repo_name": "neo4j-contrib/legacy-index", "path": "src/main/java/org/neo4j/index/timeline/Timeline.java", "license": "agpl-3.0", "size": 32314 }
[ "org.neo4j.graphdb.Node" ]
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.*;
[ "org.neo4j.graphdb" ]
org.neo4j.graphdb;
364,482
DataWatcher getWatcher();
DataWatcher getWatcher();
/** * Returns the data watcher. Only for internal purposes. * * @return packet */
Returns the data watcher. Only for internal purposes
getWatcher
{ "repo_name": "KWStudios/RageMode", "path": "src/main/java/org/kwstudios/play/ragemode/bossbar/type/Bossbar.java", "license": "mit", "size": 1651 }
[ "net.minecraft.server.v1_8_R3.DataWatcher" ]
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.*;
[ "net.minecraft.server" ]
net.minecraft.server;
2,886,976
private static boolean hasAnnotation(Method method, String className) { for (Annotation annotation : method.getDeclaredAnnotations()) { if (annotation.annotationType().getName().equals(className)) { return true; } } return false; }
static boolean function(Method method, String className) { for (Annotation annotation : method.getDeclaredAnnotations()) { if (annotation.annotationType().getName().equals(className)) { return true; } } return false; }
/** Looks for an annotation by class name. * Useful if you don't want to depend on the class * (e.g. "javax.annotation.Nonnull") at compile time. */
Looks for an annotation by class name. Useful if you don't want to depend on the class
hasAnnotation
{ "repo_name": "googleinterns/calcite", "path": "core/src/main/java/org/apache/calcite/util/ImmutableBeans.java", "license": "apache-2.0", "size": 15179 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.Method" ]
import java.lang.annotation.Annotation; import java.lang.reflect.Method;
import java.lang.annotation.*; import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
755,985
long usageStartTime = DateTimeHandling .calculateMillis("2012-12-01 00:00:00") - DateTimeHandling.hoursToMillis(100.5); BillingIntegrationTestBase.setDateFactoryInstance(usageStartTime); VOServiceDetails serviceDetails = serviceSetup .createPublishAndActivateMarketableService( basicSetup.getSupplierAdminKey(), "SCENARIO01_PERUNIT_HOUR", TestService.EXAMPLE, TestPriceModel.EXAMPLE_PERUNIT_HOUR_ROLES, technicalService, supplierMarketplace); setCutOffDay(basicSetup.getSupplierAdminKey(), 1); VORoleDefinition role = VOServiceFactory.getRole(serviceDetails, "ADMIN"); container.login(basicSetup.getCustomerAdminKey(), ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails subDetails = subscrSetup.subscribeToService( "SCENARIO01_PERUNIT_HOUR", serviceDetails, basicSetup.getSecondCustomerUser1(), role); long usageEndTime = DateTimeHandling .calculateMillis("2013-01-01 00:00:00") + DateTimeHandling.hoursToMillis(150.5); BillingIntegrationTestBase.setDateFactoryInstance(usageEndTime); subscrSetup.unsubscribeToService(subDetails.getSubscriptionId()); resetCutOffDay(basicSetup.getSupplierAdminKey()); BillingIntegrationTestBase.updateSubscriptionListForTests( "SCENARIO01_PERUNIT_HOUR", subDetails); }
long usageStartTime = DateTimeHandling .calculateMillis(STR) - DateTimeHandling.hoursToMillis(100.5); BillingIntegrationTestBase.setDateFactoryInstance(usageStartTime); VOServiceDetails serviceDetails = serviceSetup .createPublishAndActivateMarketableService( basicSetup.getSupplierAdminKey(), STR, TestService.EXAMPLE, TestPriceModel.EXAMPLE_PERUNIT_HOUR_ROLES, technicalService, supplierMarketplace); setCutOffDay(basicSetup.getSupplierAdminKey(), 1); VORoleDefinition role = VOServiceFactory.getRole(serviceDetails, "ADMIN"); container.login(basicSetup.getCustomerAdminKey(), ROLE_ORGANIZATION_ADMIN); VOSubscriptionDetails subDetails = subscrSetup.subscribeToService( STR, serviceDetails, basicSetup.getSecondCustomerUser1(), role); long usageEndTime = DateTimeHandling .calculateMillis(STR) + DateTimeHandling.hoursToMillis(150.5); BillingIntegrationTestBase.setDateFactoryInstance(usageEndTime); subscrSetup.unsubscribeToService(subDetails.getSubscriptionId()); resetCutOffDay(basicSetup.getSupplierAdminKey()); BillingIntegrationTestBase.updateSubscriptionListForTests( STR, subDetails); }
/** * Creates the subscription test data for long-lasting scenario based on the * calculation of billing period. Usage started before the billing period * and ended after the billing period (long-lasting usages). */
Creates the subscription test data for long-lasting scenario based on the calculation of billing period. Usage started before the billing period and ended after the billing period (long-lasting usages)
createSubUsageScenario01
{ "repo_name": "opetrovski/development", "path": "oscm-billing-unittests/javasrc-it/org/oscm/billingservice/business/calculation/revenue/setup/PeriodHourSetup.java", "license": "apache-2.0", "size": 22191 }
[ "org.oscm.billingservice.setup.BillingIntegrationTestBase", "org.oscm.billingservice.setup.VOPriceModelFactory", "org.oscm.billingservice.setup.VOServiceFactory", "org.oscm.internal.vo.VORoleDefinition", "org.oscm.internal.vo.VOServiceDetails", "org.oscm.internal.vo.VOSubscriptionDetails", "org.oscm.test.DateTimeHandling" ]
import org.oscm.billingservice.setup.BillingIntegrationTestBase; import org.oscm.billingservice.setup.VOPriceModelFactory; import org.oscm.billingservice.setup.VOServiceFactory; import org.oscm.internal.vo.VORoleDefinition; import org.oscm.internal.vo.VOServiceDetails; import org.oscm.internal.vo.VOSubscriptionDetails; import org.oscm.test.DateTimeHandling;
import org.oscm.billingservice.setup.*; import org.oscm.internal.vo.*; import org.oscm.test.*;
[ "org.oscm.billingservice", "org.oscm.internal", "org.oscm.test" ]
org.oscm.billingservice; org.oscm.internal; org.oscm.test;
1,348,940
public void openFolder( String foldername, boolean defaultFolder, boolean write ) throws KettleException { this.write = write; try { if ( getFolder() != null ) { // A folder is already opened // before make sure to close it closeFolder( true ); } if ( defaultFolder ) { if ( protocol == MailConnectionMeta.PROTOCOL_MBOX ) { this.folder = this.store.getDefaultFolder(); } else { // get the default folder this.folder = this.store.getDefaultFolder().getFolder( MailConnectionMeta.INBOX_FOLDER ); } if ( this.folder == null ) { throw new KettleException( BaseMessages.getString( PKG, "JobGetMailsFromPOP.InvalidDefaultFolder.Label" ) ); } if ( ( folder.getType() & Folder.HOLDS_MESSAGES ) == 0 ) { throw new KettleException( BaseMessages.getString( PKG, "MailConnection.DefaultFolderCanNotHoldMessage" ) ); } } else { // Open specified Folder (for IMAP/MBOX) if ( this.protocol == MailConnectionMeta.PROTOCOL_IMAP || this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) { this.folder = this.store.getFolder( foldername ); } if ( this.folder == null || !this.folder.exists() ) { throw new KettleException( BaseMessages.getString( PKG, "JobGetMailsFromPOP.InvalidFolder.Label" ) ); } } if ( this.write ) { if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, "MailConnection.OpeningFolderInWriteMode.Label", getFolderName() ) ); } this.folder.open( Folder.READ_WRITE ); } else { if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, "MailConnection.OpeningFolderInReadMode.Label", getFolderName() ) ); } this.folder.open( Folder.READ_ONLY ); } if ( log.isDetailed() ) { log.logDetailed( BaseMessages.getString( PKG, "JobGetMailsFromPOP.FolderOpened.Label", getFolderName() ) ); } if ( log.isDebug() ) { // display some infos on folder //CHECKSTYLE:LineLength:OFF log.logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.FolderOpened.Name", getFolderName() ) ); log.logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.FolderOpened.FullName", this.folder.getFullName() ) ); log.logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.FolderOpened.Url", this.folder.getURLName().toString() ) ); log.logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.FolderOpened.Subscribed", "" + this.folder.isSubscribed() ) ); } } catch ( Exception e ) { throw new KettleException( defaultFolder ? BaseMessages.getString( PKG, "JobGetMailsFromPOP.Error.OpeningDefaultFolder" ) : BaseMessages.getString( PKG, "JobGetMailsFromPOP.Error.OpeningFolder", foldername ), e ); } }
void function( String foldername, boolean defaultFolder, boolean write ) throws KettleException { this.write = write; try { if ( getFolder() != null ) { closeFolder( true ); } if ( defaultFolder ) { if ( protocol == MailConnectionMeta.PROTOCOL_MBOX ) { this.folder = this.store.getDefaultFolder(); } else { this.folder = this.store.getDefaultFolder().getFolder( MailConnectionMeta.INBOX_FOLDER ); } if ( this.folder == null ) { throw new KettleException( BaseMessages.getString( PKG, STR ) ); } if ( ( folder.getType() & Folder.HOLDS_MESSAGES ) == 0 ) { throw new KettleException( BaseMessages.getString( PKG, STR ) ); } } else { if ( this.protocol == MailConnectionMeta.PROTOCOL_IMAP this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) { this.folder = this.store.getFolder( foldername ); } if ( this.folder == null !this.folder.exists() ) { throw new KettleException( BaseMessages.getString( PKG, STR ) ); } } if ( this.write ) { if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, STR, getFolderName() ) ); } this.folder.open( Folder.READ_WRITE ); } else { if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, STR, getFolderName() ) ); } this.folder.open( Folder.READ_ONLY ); } if ( log.isDetailed() ) { log.logDetailed( BaseMessages.getString( PKG, STR, getFolderName() ) ); } if ( log.isDebug() ) { log.logDebug( BaseMessages.getString( PKG, STR, getFolderName() ) ); log.logDebug( BaseMessages.getString( PKG, STR, this.folder.getFullName() ) ); log.logDebug( BaseMessages.getString( PKG, STR, this.folder.getURLName().toString() ) ); log.logDebug( BaseMessages.getString( PKG, STR, STRJobGetMailsFromPOP.Error.OpeningDefaultFolderSTRJobGetMailsFromPOP.Error.OpeningFolder", foldername ), e ); } }
/** * Open the folder. * * @param foldername * the name of the folder to open * @param defaultFolder * true to open the default folder (INBOX) * @param write * open the folder in write mode * @throws KettleException * if something went wrong. */
Open the folder
openFolder
{ "repo_name": "rfellows/pentaho-kettle", "path": "engine/src/org/pentaho/di/job/entries/getpop/MailConnection.java", "license": "apache-2.0", "size": 40631 }
[ "javax.mail.Folder", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.i18n.BaseMessages" ]
import javax.mail.Folder; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.i18n.BaseMessages;
import javax.mail.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.i18n.*;
[ "javax.mail", "org.pentaho.di" ]
javax.mail; org.pentaho.di;
1,299,936
void handleError(@NotNull Throwable exception, String commandName) { if (getErrorCode(exception) == ErrorCodes.UNABLE_GET_PRIVATE_SSH_KEY) { dialogFactory.createMessageDialog(commandName, constant.messagesUnableGetSshKey(), null).show(); return; } String errorMessage = exception.getMessage(); if (errorMessage == null) { switch (commandName) { case BRANCH_CREATE_COMMAND_NAME: errorMessage = constant.branchCreateFailed(); break; case BRANCH_DELETE_COMMAND_NAME: errorMessage = constant.branchDeleteFailed(); break; case BRANCH_LIST_COMMAND_NAME: errorMessage = constant.branchesListFailed(); break; case BRANCH_RENAME_COMMAND_NAME: errorMessage = constant.branchRenameFailed(); break; case BRANCH_CHECKOUT_COMMAND_NAME: errorMessage = constant.branchCheckoutFailed(); break; } } GitOutputConsole console = gitOutputConsoleFactory.create(commandName); printGitMessage(errorMessage, console); consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(errorMessage, FAIL, FLOAT_MODE); }
void handleError(@NotNull Throwable exception, String commandName) { if (getErrorCode(exception) == ErrorCodes.UNABLE_GET_PRIVATE_SSH_KEY) { dialogFactory.createMessageDialog(commandName, constant.messagesUnableGetSshKey(), null).show(); return; } String errorMessage = exception.getMessage(); if (errorMessage == null) { switch (commandName) { case BRANCH_CREATE_COMMAND_NAME: errorMessage = constant.branchCreateFailed(); break; case BRANCH_DELETE_COMMAND_NAME: errorMessage = constant.branchDeleteFailed(); break; case BRANCH_LIST_COMMAND_NAME: errorMessage = constant.branchesListFailed(); break; case BRANCH_RENAME_COMMAND_NAME: errorMessage = constant.branchRenameFailed(); break; case BRANCH_CHECKOUT_COMMAND_NAME: errorMessage = constant.branchCheckoutFailed(); break; } } GitOutputConsole console = gitOutputConsoleFactory.create(commandName); printGitMessage(errorMessage, console); consolesPanelPresenter.addCommandOutput(appContext.getDevMachine().getId(), console); notificationManager.notify(errorMessage, FAIL, FLOAT_MODE); }
/** * Handler some action whether some exception happened. * * @param exception * exception what happened * @param commandName * name of the executed command */
Handler some action whether some exception happened
handleError
{ "repo_name": "Mirage20/che", "path": "plugins/plugin-git/che-plugin-git-ext-git/src/main/java/org/eclipse/che/ide/ext/git/client/branch/BranchPresenter.java", "license": "epl-1.0", "size": 13380 }
[ "javax.validation.constraints.NotNull", "org.eclipse.che.api.core.ErrorCodes", "org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole" ]
import javax.validation.constraints.NotNull; import org.eclipse.che.api.core.ErrorCodes; import org.eclipse.che.ide.ext.git.client.outputconsole.GitOutputConsole;
import javax.validation.constraints.*; import org.eclipse.che.api.core.*; import org.eclipse.che.ide.ext.git.client.outputconsole.*;
[ "javax.validation", "org.eclipse.che" ]
javax.validation; org.eclipse.che;
846,450
private boolean isWildCardSearch(JSONArray fields) { // Only do a wildcard search if we are passed ["*"] if (fields.length() == 1) { try { if ("*".equals(fields.getString(0))) { return true; } } catch (JSONException e) { return false; } } return false; }
boolean function(JSONArray fields) { if (fields.length() == 1) { try { if ("*".equals(fields.getString(0))) { return true; } } catch (JSONException e) { return false; } } return false; }
/** * If the user passes in the '*' wildcard character for search then they want all fields for each contact * * @param fields * @return true if wildcard search requested, false otherwise */
If the user passes in the '*' wildcard character for search then they want all fields for each contact
isWildCardSearch
{ "repo_name": "R4md4c/cordova-android-chromium", "path": "cordova/src/org/apache/cordova/ContactAccessorSdk5.java", "license": "bsd-2-clause", "size": 105539 }
[ "org.json.JSONArray", "org.json.JSONException" ]
import org.json.JSONArray; import org.json.JSONException;
import org.json.*;
[ "org.json" ]
org.json;
1,664,248
this.mainFrame = new JFrame("Settings");
this.mainFrame = new JFrame(STR);
/** * Initialize the contents of the frame. */
Initialize the contents of the frame
buildSettingsFrame
{ "repo_name": "SalsGithub/Java", "path": "Pathfinding/src/sal/frame/SettingsFrame.java", "license": "gpl-3.0", "size": 8272 }
[ "javax.swing.JFrame" ]
import javax.swing.JFrame;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
1,412,100
public DDBean []getChildBean(String xpath) { throw new UnsupportedOperationException(); }
public DDBean []getChildBean(String xpath) { throw new UnsupportedOperationException(); }
/** * Returns the array of standard beans for the XML content based * on the XPath. */
Returns the array of standard beans for the XML content based on the XPath
getChildBean
{ "repo_name": "christianchristensen/resin", "path": "modules/resin/src/com/caucho/j2ee/deploytool/DeployableObjectImpl.java", "license": "gpl-2.0", "size": 3110 }
[ "javax.enterprise.deploy.model.DDBean" ]
import javax.enterprise.deploy.model.DDBean;
import javax.enterprise.deploy.model.*;
[ "javax.enterprise" ]
javax.enterprise;
746,755
public void start() throws SCGIException { try { this.listenerThread = new Thread(new ThreadGroup("SCGI"), this, "SCGIListener"); // factory this.workerFactory = new ThreadFactory() { private int count = 0; private ThreadGroup group = new ThreadGroup("SCGI");
void function() throws SCGIException { try { this.listenerThread = new Thread(new ThreadGroup("SCGI"), this, STR); this.workerFactory = new ThreadFactory() { private int count = 0; private ThreadGroup group = new ThreadGroup("SCGI");
/** * Start the SCGI Listener * * This will create a bind a socket, create a thread and start listening for requests. * * @throws SCGIException * returns void */
Start the SCGI Listener This will create a bind a socket, create a thread and start listening for requests
start
{ "repo_name": "intrbiz/balsa-scgi", "path": "src/main/java/com/intrbiz/balsa/scgi/SCGIListener.java", "license": "bsd-2-clause", "size": 7691 }
[ "com.intrbiz.balsa.SCGIException", "java.util.concurrent.ThreadFactory" ]
import com.intrbiz.balsa.SCGIException; import java.util.concurrent.ThreadFactory;
import com.intrbiz.balsa.*; import java.util.concurrent.*;
[ "com.intrbiz.balsa", "java.util" ]
com.intrbiz.balsa; java.util;
2,241,264
public void clear(PropagationContext propagationContext);
void function(PropagationContext propagationContext);
/** * This will remove all entries, but not do cleanup, the FH is most likely needed else where * @param propagationContext */
This will remove all entries, but not do cleanup, the FH is most likely needed else where
clear
{ "repo_name": "wmedvede/drools", "path": "drools-core/src/main/java/org/drools/core/beliefsystem/BeliefSet.java", "license": "apache-2.0", "size": 1289 }
[ "org.drools.core.spi.PropagationContext" ]
import org.drools.core.spi.PropagationContext;
import org.drools.core.spi.*;
[ "org.drools.core" ]
org.drools.core;
1,776,793
@Test public void testNonceReUse() throws Exception { TestHttpClient client = new TestHttpClient(); HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL()); HttpResponse result = client.execute(get); assertEquals(StatusCodes.UNAUTHORIZED, result.getStatusLine().getStatusCode()); Header[] values = result.getHeaders(WWW_AUTHENTICATE.toString()); assertEquals(1, values.length); String value = values[0].getValue(); assertTrue(value.startsWith(DIGEST.toString())); Map<DigestWWWAuthenticateToken, String> parsedHeader = DigestWWWAuthenticateToken.parseHeader(value.substring(7)); assertEquals(REALM_NAME, parsedHeader.get(DigestWWWAuthenticateToken.REALM)); assertEquals(DigestAlgorithm.MD5.getToken(), parsedHeader.get(DigestWWWAuthenticateToken.ALGORITHM)); String nonce = parsedHeader.get(DigestWWWAuthenticateToken.NONCE); String response = createResponse("userOne", REALM_NAME, "passwordOne", "GET", "/", nonce); client = new TestHttpClient(); get = new HttpGet(DefaultServer.getDefaultServerURL()); StringBuilder sb = new StringBuilder(DIGEST.toString()); sb.append(" "); sb.append(DigestAuthorizationToken.USERNAME.getName()).append("=").append("\"userOne\"").append(","); sb.append(DigestAuthorizationToken.REALM.getName()).append("=\"").append(REALM_NAME).append("\","); sb.append(DigestAuthorizationToken.NONCE.getName()).append("=\"").append(nonce).append("\","); sb.append(DigestAuthorizationToken.DIGEST_URI.getName()).append("=\"/\","); sb.append(DigestAuthorizationToken.RESPONSE.getName()).append("=\"").append(response).append("\""); get.addHeader(AUTHORIZATION.toString(), sb.toString()); result = client.execute(get); assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); values = result.getHeaders("ProcessedBy"); assertEquals(1, values.length); assertEquals("ResponseHandler", values[0].getValue()); assertSingleNotificationType(EventType.AUTHENTICATED); client = new TestHttpClient(); get = new HttpGet(DefaultServer.getDefaultServerURL()); get.addHeader(AUTHORIZATION.toString(), sb.toString()); result = client.execute(get); assertEquals(StatusCodes.UNAUTHORIZED, result.getStatusLine().getStatusCode()); values = result.getHeaders(WWW_AUTHENTICATE.toString()); assertEquals(1, values.length); value = values[0].getValue(); assertTrue(value.startsWith(DIGEST.toString())); parsedHeader = DigestWWWAuthenticateToken.parseHeader(value.substring(7)); assertEquals(REALM_NAME, parsedHeader.get(DigestWWWAuthenticateToken.REALM)); assertEquals(DigestAlgorithm.MD5.getToken(), parsedHeader.get(DigestWWWAuthenticateToken.ALGORITHM)); assertEquals("true", parsedHeader.get(DigestWWWAuthenticateToken.STALE)); nonce = parsedHeader.get(DigestWWWAuthenticateToken.NONCE); response = createResponse("userOne", REALM_NAME, "passwordOne", "GET", "/", nonce); client = new TestHttpClient(); get = new HttpGet(DefaultServer.getDefaultServerURL()); sb = new StringBuilder(DIGEST.toString()); sb.append(" "); sb.append(DigestAuthorizationToken.USERNAME.getName()).append("=").append("\"userOne\"").append(","); sb.append(DigestAuthorizationToken.REALM.getName()).append("=\"").append(REALM_NAME).append("\","); sb.append(DigestAuthorizationToken.NONCE.getName()).append("=\"").append(nonce).append("\","); sb.append(DigestAuthorizationToken.DIGEST_URI.getName()).append("=\"/\","); sb.append(DigestAuthorizationToken.RESPONSE.getName()).append("=\"").append(response).append("\""); get.addHeader(AUTHORIZATION.toString(), sb.toString()); result = client.execute(get); assertEquals(StatusCodes.OK, result.getStatusLine().getStatusCode()); values = result.getHeaders("ProcessedBy"); assertEquals(1, values.length); assertEquals("ResponseHandler", values[0].getValue()); // The additional round trip for the bad nonce should not trigger a security notification. assertSingleNotificationType(EventType.AUTHENTICATED); } // Test choosing different algorithm. // Different URI - Test not matching the request as well. // Different Method
void function() throws Exception { TestHttpClient client = new TestHttpClient(); HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL()); HttpResponse result = client.execute(get); assertEquals(StatusCodes.UNAUTHORIZED, result.getStatusLine().getStatusCode()); Header[] values = result.getHeaders(WWW_AUTHENTICATE.toString()); assertEquals(1, values.length); String value = values[0].getValue(); assertTrue(value.startsWith(DIGEST.toString())); Map<DigestWWWAuthenticateToken, String> parsedHeader = DigestWWWAuthenticateToken.parseHeader(value.substring(7)); assertEquals(REALM_NAME, parsedHeader.get(DigestWWWAuthenticateToken.REALM)); assertEquals(DigestAlgorithm.MD5.getToken(), parsedHeader.get(DigestWWWAuthenticateToken.ALGORITHM)); String nonce = parsedHeader.get(DigestWWWAuthenticateToken.NONCE); String response = createResponse(STR, REALM_NAME, STR, "GETSTR/", nonce); client = new TestHttpClient(); get = new HttpGet(DefaultServer.getDefaultServerURL()); StringBuilder sb = new StringBuilder(DIGEST.toString()); sb.append(" STR=STR\"userOne\STR,STR=\STR\","); sb.append(DigestAuthorizationToken.NONCE.getName()).append("=\"STR\","); sb.append(DigestAuthorizationToken.DIGEST_URI.getName()).append("=\"/\","); sb.append(DigestAuthorizationToken.RESPONSE.getName()).append("=\"STR\STRProcessedBySTRResponseHandlerSTRtrue", parsedHeader.get(DigestWWWAuthenticateToken.STALE)); nonce = parsedHeader.get(DigestWWWAuthenticateToken.NONCE); response = createResponse(STR, REALM_NAME, STR, "GETSTR/STR STR=STR\"userOne\STR,STR=\STR\","); sb.append(DigestAuthorizationToken.NONCE.getName()).append("=\"STR\","); sb.append(DigestAuthorizationToken.DIGEST_URI.getName()).append("=\"/\","); sb.append(DigestAuthorizationToken.RESPONSE.getName()).append("=\"STR\STRProcessedBySTRResponseHandler", values[0].getValue()); assertSingleNotificationType(EventType.AUTHENTICATED); }
/** * Test that in RFC2069 mode nonce re-use is rejected. */
Test that in RFC2069 mode nonce re-use is rejected
testNonceReUse
{ "repo_name": "rhusar/undertow", "path": "core/src/test/java/io/undertow/server/security/DigestAuthentication2069TestCase.java", "license": "apache-2.0", "size": 20931 }
[ "io.undertow.security.api.SecurityNotification", "io.undertow.security.idm.DigestAlgorithm", "io.undertow.security.impl.DigestAuthorizationToken", "io.undertow.security.impl.DigestWWWAuthenticateToken", "io.undertow.testutils.DefaultServer", "io.undertow.testutils.TestHttpClient", "io.undertow.util.Headers", "io.undertow.util.StatusCodes", "java.util.Map", "org.apache.http.Header", "org.apache.http.HttpResponse", "org.apache.http.client.methods.HttpGet", "org.junit.Assert" ]
import io.undertow.security.api.SecurityNotification; import io.undertow.security.idm.DigestAlgorithm; import io.undertow.security.impl.DigestAuthorizationToken; import io.undertow.security.impl.DigestWWWAuthenticateToken; import io.undertow.testutils.DefaultServer; import io.undertow.testutils.TestHttpClient; import io.undertow.util.Headers; import io.undertow.util.StatusCodes; import java.util.Map; import org.apache.http.Header; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.junit.Assert;
import io.undertow.security.api.*; import io.undertow.security.idm.*; import io.undertow.security.impl.*; import io.undertow.testutils.*; import io.undertow.util.*; import java.util.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.junit.*;
[ "io.undertow.security", "io.undertow.testutils", "io.undertow.util", "java.util", "org.apache.http", "org.junit" ]
io.undertow.security; io.undertow.testutils; io.undertow.util; java.util; org.apache.http; org.junit;
1,178,229
public Iterable<String> optionsCopts() { if (!ruleContext.attributes().has("options", Type.LABEL)) { return ImmutableList.of(); } OptionsProvider optionsProvider = ruleContext.getPrerequisite("options", Mode.TARGET, OptionsProvider.class); if (optionsProvider == null) { return ImmutableList.of(); } return optionsProvider.getCopts(); } } // TODO(bazel-team): Delete and move into support-specific attributes classes once ObjcCommon is // gone. static final class ResourceAttributes { private final RuleContext ruleContext; ResourceAttributes(RuleContext ruleContext) { this.ruleContext = ruleContext; }
Iterable<String> function() { if (!ruleContext.attributes().has(STR, Type.LABEL)) { return ImmutableList.of(); } OptionsProvider optionsProvider = ruleContext.getPrerequisite(STR, Mode.TARGET, OptionsProvider.class); if (optionsProvider == null) { return ImmutableList.of(); } return optionsProvider.getCopts(); } } static final class ResourceAttributes { private final RuleContext ruleContext; ResourceAttributes(RuleContext ruleContext) { this.ruleContext = ruleContext; }
/** * Returns any {@code copts} defined on an {@code objc_options} rule that is a dependency of * this rule. */
Returns any copts defined on an objc_options rule that is a dependency of this rule
optionsCopts
{ "repo_name": "Krasnyanskiy/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/objc/ObjcCommon.java", "license": "apache-2.0", "size": 28029 }
[ "com.google.common.collect.ImmutableList", "com.google.devtools.build.lib.analysis.RuleConfiguredTarget", "com.google.devtools.build.lib.analysis.RuleContext", "com.google.devtools.build.lib.packages.Type" ]
import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.analysis.RuleConfiguredTarget; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.packages.Type;
import com.google.common.collect.*; import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.packages.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
1,089,677
public BaseViewHolder setMax(int viewId, int max) { ProgressBar view = getView(viewId); view.setMax(max); return this; }
BaseViewHolder function(int viewId, int max) { ProgressBar view = getView(viewId); view.setMax(max); return this; }
/** * Sets the range of a ProgressBar to 0...max. * * @param viewId The view id. * @param max The max value of a ProgressBar. * @return The BaseViewHolder for chaining. */
Sets the range of a ProgressBar to 0...max
setMax
{ "repo_name": "mcshengInworking/MFrame", "path": "library/src/main/java/com/mcs/mframe/ui/recyclerview/BaseViewHolder.java", "license": "apache-2.0", "size": 15077 }
[ "android.widget.ProgressBar" ]
import android.widget.ProgressBar;
import android.widget.*;
[ "android.widget" ]
android.widget;
2,446,786
@Override public void onStartFalling(EntityFallingBlockTFC fallingEntity) { Core.playSoundAtEntity(fallingEntity, TFC_Sounds.FALLININGDIRTSHORT, 0.2f, 1.0f); }
void function(EntityFallingBlockTFC fallingEntity) { Core.playSoundAtEntity(fallingEntity, TFC_Sounds.FALLININGDIRTSHORT, 0.2f, 1.0f); }
/******************************************************************************* * 1. Content *******************************************************************************/
1. Content
onStartFalling
{ "repo_name": "Deadrik/TFC2", "path": "src/Common/com/bioxx/tfc2/blocks/terrain/BlockSand.java", "license": "gpl-3.0", "size": 2126 }
[ "com.bioxx.tfc2.Core", "com.bioxx.tfc2.entity.EntityFallingBlockTFC" ]
import com.bioxx.tfc2.Core; import com.bioxx.tfc2.entity.EntityFallingBlockTFC;
import com.bioxx.tfc2.*; import com.bioxx.tfc2.entity.*;
[ "com.bioxx.tfc2" ]
com.bioxx.tfc2;
2,626,247
public Boolean isShort() { return OpenmrsUtil.nullSafeEquals(getConceptNameType(), ConceptNameType.SHORT); }
Boolean function() { return OpenmrsUtil.nullSafeEquals(getConceptNameType(), ConceptNameType.SHORT); }
/** * Convenience method for determining whether this is a short name. * * @return true if the name is marked as a short name, otherwise false */
Convenience method for determining whether this is a short name
isShort
{ "repo_name": "sintjuri/openmrs-core", "path": "api/src/main/java/org/openmrs/ConceptName.java", "license": "mpl-2.0", "size": 18424 }
[ "org.openmrs.api.ConceptNameType", "org.openmrs.util.OpenmrsUtil" ]
import org.openmrs.api.ConceptNameType; import org.openmrs.util.OpenmrsUtil;
import org.openmrs.api.*; import org.openmrs.util.*;
[ "org.openmrs.api", "org.openmrs.util" ]
org.openmrs.api; org.openmrs.util;
1,453,382
public List computeContextInformation(CompletionProposalInvocationContext context, IProgressMonitor monitor) { List contextInformation = Collections.EMPTY_LIST; if (isEnabled()) { IStatus status = null; try { // plugin must be active to get computer ICompletionProposalComputer computer = getComputer(true); if (computer != null) { PerformanceStats stats= startMeter(context, computer); List proposals= computer.computeContextInformation(context, monitor); stopMeter(stats, COMPUTE_CONTEXT_INFORMATION); if (proposals != null) { fLastError= computer.getErrorMessage(); contextInformation = proposals; } else { status = createAPIViolationStatus(COMPUTE_CONTEXT_INFORMATION); } } } catch (InvalidRegistryObjectException x) { status= createExceptionStatus(x); } catch (CoreException x) { status= createExceptionStatus(x); } catch (RuntimeException x) { status= createExceptionStatus(x); } finally { monitor.done(); } if(status != null) { Logger.log(status); } } return contextInformation; }
List function(CompletionProposalInvocationContext context, IProgressMonitor monitor) { List contextInformation = Collections.EMPTY_LIST; if (isEnabled()) { IStatus status = null; try { ICompletionProposalComputer computer = getComputer(true); if (computer != null) { PerformanceStats stats= startMeter(context, computer); List proposals= computer.computeContextInformation(context, monitor); stopMeter(stats, COMPUTE_CONTEXT_INFORMATION); if (proposals != null) { fLastError= computer.getErrorMessage(); contextInformation = proposals; } else { status = createAPIViolationStatus(COMPUTE_CONTEXT_INFORMATION); } } } catch (InvalidRegistryObjectException x) { status= createExceptionStatus(x); } catch (CoreException x) { status= createExceptionStatus(x); } catch (RuntimeException x) { status= createExceptionStatus(x); } finally { monitor.done(); } if(status != null) { Logger.log(status); } } return contextInformation; }
/** * <p>Safely computes context information objects through the described extension.</p> * * @param context the invocation context passed on to the extension * @param monitor the progress monitor passed on to the extension * @return the list of computed context information objects (element type: * {@link org.eclipse.jface.text.contentassist.IContextInformation}) */
Safely computes context information objects through the described extension
computeContextInformation
{ "repo_name": "ttimbul/eclipse.wst", "path": "bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/contentassist/CompletionProposalComputerDescriptor.java", "license": "epl-1.0", "size": 23492 }
[ "java.util.Collections", "java.util.List", "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.IProgressMonitor", "org.eclipse.core.runtime.IStatus", "org.eclipse.core.runtime.InvalidRegistryObjectException", "org.eclipse.core.runtime.PerformanceStats", "org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext", "org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer", "org.eclipse.wst.sse.ui.internal.Logger" ]
import java.util.Collections; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.InvalidRegistryObjectException; import org.eclipse.core.runtime.PerformanceStats; import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext; import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer; import org.eclipse.wst.sse.ui.internal.Logger;
import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.wst.sse.ui.contentassist.*; import org.eclipse.wst.sse.ui.internal.*;
[ "java.util", "org.eclipse.core", "org.eclipse.wst" ]
java.util; org.eclipse.core; org.eclipse.wst;
1,717,219
public void save(DBInterface dbi) throws SQLException { for(String key : values.keySet()) { StoredValue stv = values.get(key); if(stv.hasMode(StoredValue.REMOVED_MODE)) { new Query(dbi).from(tableName).where("key=?", key).drop(); } else if(stv.hasMode(StoredValue.EDITED_MODE)) { HashMap<String, Object> updater = new HashMap<String, Object>(); updater.put("value", stv.value); new Query(dbi).from(tableName).where("key=?", key).update(updater); } else if(stv.hasMode(StoredValue.NEW_MODE)) { HashMap<String, Object> inserter = new HashMap<String, Object>(); inserter.put("key", key); inserter.put("value", stv.value); new Query(dbi).from(tableName).insert(inserter); } } saved = true; }
void function(DBInterface dbi) throws SQLException { for(String key : values.keySet()) { StoredValue stv = values.get(key); if(stv.hasMode(StoredValue.REMOVED_MODE)) { new Query(dbi).from(tableName).where("key=?", key).drop(); } else if(stv.hasMode(StoredValue.EDITED_MODE)) { HashMap<String, Object> updater = new HashMap<String, Object>(); updater.put("value", stv.value); new Query(dbi).from(tableName).where("key=?", key).update(updater); } else if(stv.hasMode(StoredValue.NEW_MODE)) { HashMap<String, Object> inserter = new HashMap<String, Object>(); inserter.put("key", key); inserter.put("value", stv.value); new Query(dbi).from(tableName).insert(inserter); } } saved = true; }
/** * Output the HashMap to the database, in the table given in the constructor * * @param dbi DBInterface to use. * @throws SQLException */
Output the HashMap to the database, in the table given in the constructor
save
{ "repo_name": "JavaNut13/Active-JDBC", "path": "src/main/java/dbinterface/HashRecord.java", "license": "apache-2.0", "size": 5182 }
[ "java.sql.SQLException", "java.util.HashMap" ]
import java.sql.SQLException; import java.util.HashMap;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
426,416
@NonNull AlterDseTableRenameColumnEnd renameColumn(@NonNull CqlIdentifier from, @NonNull CqlIdentifier to);
AlterDseTableRenameColumnEnd renameColumn(@NonNull CqlIdentifier from, @NonNull CqlIdentifier to);
/** * Adds a column rename to ALTER TABLE specification. This may be repeated with successive calls * to rename columns. */
Adds a column rename to ALTER TABLE specification. This may be repeated with successive calls to rename columns
renameColumn
{ "repo_name": "datastax/java-driver", "path": "query-builder/src/main/java/com/datastax/dse/driver/api/querybuilder/schema/AlterDseTableRenameColumn.java", "license": "apache-2.0", "size": 1394 }
[ "com.datastax.oss.driver.api.core.CqlIdentifier", "edu.umd.cs.findbugs.annotations.NonNull" ]
import com.datastax.oss.driver.api.core.CqlIdentifier; import edu.umd.cs.findbugs.annotations.NonNull;
import com.datastax.oss.driver.api.core.*; import edu.umd.cs.findbugs.annotations.*;
[ "com.datastax.oss", "edu.umd.cs" ]
com.datastax.oss; edu.umd.cs;
2,017,570
public IndexOptions weights(@Nullable final Bson weights) { this.weights = weights; return this; }
IndexOptions function(@Nullable final Bson weights) { this.weights = weights; return this; }
/** * Sets the weighting object for use with a text index. * * <p>An document that represents field and weight pairs. The weight is an integer ranging from 1 to 99,999 and denotes the significance * of the field relative to the other indexed fields in terms of the score.</p> * * @param weights the weighting object * @return this * @mongodb.driver.manual tutorial/control-results-of-text-search Control Search Results with Weights */
Sets the weighting object for use with a text index. An document that represents field and weight pairs. The weight is an integer ranging from 1 to 99,999 and denotes the significance of the field relative to the other indexed fields in terms of the score
weights
{ "repo_name": "rozza/mongo-java-driver", "path": "driver-core/src/main/com/mongodb/client/model/IndexOptions.java", "license": "apache-2.0", "size": 16475 }
[ "com.mongodb.lang.Nullable", "org.bson.conversions.Bson" ]
import com.mongodb.lang.Nullable; import org.bson.conversions.Bson;
import com.mongodb.lang.*; import org.bson.conversions.*;
[ "com.mongodb.lang", "org.bson.conversions" ]
com.mongodb.lang; org.bson.conversions;
892,007
public ArangoDBBaseQuery getVertexEdges( ArangoDBSimpleGraph graph, ArangoDBSimpleVertex vertex, ArangoDBPropertyFilter propertyFilter, List<String> labelsFilter, Direction direction, Long limit, boolean count) throws ArangoDBException { return new ArangoDBBaseQuery(graph, this, QueryType.GRAPH_EDGES).setCount(count).setLimit(limit) .setStartVertex(vertex).setLabelsFilter(labelsFilter).setPropertyFilter(propertyFilter) .setDirection(direction); }
ArangoDBBaseQuery function( ArangoDBSimpleGraph graph, ArangoDBSimpleVertex vertex, ArangoDBPropertyFilter propertyFilter, List<String> labelsFilter, Direction direction, Long limit, boolean count) throws ArangoDBException { return new ArangoDBBaseQuery(graph, this, QueryType.GRAPH_EDGES).setCount(count).setLimit(limit) .setStartVertex(vertex).setLabelsFilter(labelsFilter).setPropertyFilter(propertyFilter) .setDirection(direction); }
/** * Create a query to get all edges of a vertex * * @param graph * the simple graph * @param vertex * the vertex * @param propertyFilter * a property filter * @param labelsFilter * a list of labels * @param direction * a direction * @param limit * the maximum number of results * @param count * query total number of results * * @return ArangoDBBaseQuery the query object * * @throws ArangoDBException * if creation failed */
Create a query to get all edges of a vertex
getVertexEdges
{ "repo_name": "Unni34/blueprints", "path": "src/main/java/com/arangodb/blueprints/client/ArangoDBSimpleGraphClient.java", "license": "apache-2.0", "size": 23089 }
[ "com.arangodb.blueprints.client.ArangoDBBaseQuery", "java.util.List" ]
import com.arangodb.blueprints.client.ArangoDBBaseQuery; import java.util.List;
import com.arangodb.blueprints.client.*; import java.util.*;
[ "com.arangodb.blueprints", "java.util" ]
com.arangodb.blueprints; java.util;
2,771,932
public void testSetBitZeroOutside1() { byte aBytes[] = {0}; int aSign = 0; int number = 95; byte rBytes[] = {0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger result = aNumber.setBit(number); 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[] = {0}; int aSign = 0; int number = 95; byte rBytes[] = {0, -128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger result = aNumber.setBit(number); 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()); }
/** * setBit(int n) outside zero. */
setBit(int n) outside zero
testSetBitZeroOutside1
{ "repo_name": "google/j2cl", "path": "jre/javatests/com/google/gwt/emultest/java/math/BigIntegerOperateBitsTest.java", "license": "apache-2.0", "size": 47597 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
936,684
public static PathNode buildPath(Object[] orig, Object[] rev) throws DifferentiationFailedException { if (orig == null) { throw new IllegalArgumentException("original sequence is null"); } if (rev == null) { throw new IllegalArgumentException("revised sequence is null"); } // these are local constants final int N = orig.length; final int M = rev.length; final int MAX = N + M + 1; final int size = 1 + 2 * MAX; final int middle = (size + 1) / 2; final PathNode diagonal[] = new PathNode[size]; diagonal[middle + 1] = new Snake(0, -1, null); for (int d = 0; d < MAX; d++) { for (int k = -d; k <= d; k += 2) { final int kmiddle = middle + k; final int kplus = kmiddle + 1; final int kminus = kmiddle - 1; PathNode prev = null; int i; if ((k == -d) || (k != d && diagonal[kminus].i < diagonal[kplus].i)) { i = diagonal[kplus].i; prev = diagonal[kplus]; } else { i = diagonal[kminus].i + 1; prev = diagonal[kminus]; } diagonal[kminus] = null; // no longer used int j = i - k; PathNode node = new DiffNode(i, j, prev); // orig and rev are zero-based // but the algorithm is one-based // that's why there's no +1 when indexing the sequences while (i < N && j < M && orig[i].equals(rev[j])) { i++; j++; } if (i > node.i) { node = new Snake(i, j, node); } diagonal[kmiddle] = node; if (i >= N && j >= M) { return diagonal[kmiddle]; } } diagonal[middle + d - 1] = null; } // According to Myers, this cannot happen throw new DifferentiationFailedException("could not find a diff path"); }
static PathNode function(Object[] orig, Object[] rev) throws DifferentiationFailedException { if (orig == null) { throw new IllegalArgumentException(STR); } if (rev == null) { throw new IllegalArgumentException(STR); } final int N = orig.length; final int M = rev.length; final int MAX = N + M + 1; final int size = 1 + 2 * MAX; final int middle = (size + 1) / 2; final PathNode diagonal[] = new PathNode[size]; diagonal[middle + 1] = new Snake(0, -1, null); for (int d = 0; d < MAX; d++) { for (int k = -d; k <= d; k += 2) { final int kmiddle = middle + k; final int kplus = kmiddle + 1; final int kminus = kmiddle - 1; PathNode prev = null; int i; if ((k == -d) (k != d && diagonal[kminus].i < diagonal[kplus].i)) { i = diagonal[kplus].i; prev = diagonal[kplus]; } else { i = diagonal[kminus].i + 1; prev = diagonal[kminus]; } diagonal[kminus] = null; int j = i - k; PathNode node = new DiffNode(i, j, prev); while (i < N && j < M && orig[i].equals(rev[j])) { i++; j++; } if (i > node.i) { node = new Snake(i, j, node); } diagonal[kmiddle] = node; if (i >= N && j >= M) { return diagonal[kmiddle]; } } diagonal[middle + d - 1] = null; } throw new DifferentiationFailedException(STR); }
/** * Computes the minimum diffpath that expresses de differences between the original and revised * sequences, according to Gene Myers differencing algorithm. * * @param orig * The original sequence. * @param rev * The revised sequence. * @return A minimum {@link PathNode Path} across the differences graph. * @throws DifferentiationFailedException * if a diff path could not be found. */
Computes the minimum diffpath that expresses de differences between the original and revised sequences, according to Gene Myers differencing algorithm
buildPath
{ "repo_name": "astubbs/wicket.get-portals2", "path": "wicket/src/main/java/org/apache/wicket/util/diff/myers/MyersDiff.java", "license": "apache-2.0", "size": 7360 }
[ "org.apache.wicket.util.diff.DifferentiationFailedException" ]
import org.apache.wicket.util.diff.DifferentiationFailedException;
import org.apache.wicket.util.diff.*;
[ "org.apache.wicket" ]
org.apache.wicket;
1,245,731
public int getPostCount(String username) throws ScriptException { throw new ScriptException(); }
int function(String username) throws ScriptException { throw new ScriptException(); }
/** * Returns an amount of how many posts {@code username} has made. * * @param username the username to get the count from. * @return the amount of how many posts the username have made, returns 0 if none * @throws ScriptException if the method is not supported by the script */
Returns an amount of how many posts username has made
getPostCount
{ "repo_name": "craftfire/Bifrost", "path": "src/main/java/com/craftfire/bifrost/classes/forum/ForumScript.java", "license": "lgpl-3.0", "size": 18872 }
[ "com.craftfire.bifrost.exceptions.ScriptException" ]
import com.craftfire.bifrost.exceptions.ScriptException;
import com.craftfire.bifrost.exceptions.*;
[ "com.craftfire.bifrost" ]
com.craftfire.bifrost;
1,395,259
public float getAngleForVertex(TwoDimensionalVector vertex) throws IncompatibleDimensionsException { Line[] sides = findSidesWithPoint(vertex); if (sides.length != 2) throw new IncompatibleDimensionsException(vertex.toString()+" is not a valid vertex!"); double slope1 = Double.isNaN(sides[0].get2DSlope()) ? Double.MAX_VALUE : sides[0].get2DSlope(); double slope2 = Double.isNaN(sides[1].get2DSlope()) ? Double.MAX_VALUE : sides[1].get2DSlope(); return (float) Math.atan(Math.abs((slope1-slope2)/(1+(slope1*slope2)))); }
float function(TwoDimensionalVector vertex) throws IncompatibleDimensionsException { Line[] sides = findSidesWithPoint(vertex); if (sides.length != 2) throw new IncompatibleDimensionsException(vertex.toString()+STR); double slope1 = Double.isNaN(sides[0].get2DSlope()) ? Double.MAX_VALUE : sides[0].get2DSlope(); double slope2 = Double.isNaN(sides[1].get2DSlope()) ? Double.MAX_VALUE : sides[1].get2DSlope(); return (float) Math.atan(Math.abs((slope1-slope2)/(1+(slope1*slope2)))); }
/** * Finds the (internal) angle of the given vertex * @param vertex The vertex * @return The angle * @throws IncompatibleDimensionsException */
Finds the (internal) angle of the given vertex
getAngleForVertex
{ "repo_name": "austinv11/CollectiveFramework", "path": "src/main/java/com/austinv11/collectiveframework/utils/math/geometry/Variable2DShape.java", "license": "gpl-2.0", "size": 9223 }
[ "com.austinv11.collectiveframework.utils.math.TwoDimensionalVector" ]
import com.austinv11.collectiveframework.utils.math.TwoDimensionalVector;
import com.austinv11.collectiveframework.utils.math.*;
[ "com.austinv11.collectiveframework" ]
com.austinv11.collectiveframework;
1,233,057
@Method(selector = "insertJSONDocument:collectionName:dataDict:completionBlock:") public native void insertJSONDocument(String dbName, String collectionName, NSDictionary<?, ?> dataDict, @Block App42ResponseBlock completionBlock);
@Method(selector = STR) native void function(String dbName, String collectionName, NSDictionary<?, ?> dataDict, @Block App42ResponseBlock completionBlock);
/** * Save the data supplied as Dictionary in the given database name and collection name. * * @param dbName * - Unique handler for storage name * @param collectionName * - Name of collection under which JSON doc has to be saved * @param dataDict * - Target data as Dictionary to be saved * * @return Storage object * * */
Save the data supplied as Dictionary in the given database name and collection name
insertJSONDocument
{ "repo_name": "mariamKh/robovm-ios-bindings", "path": "app42/src/org/robovm/bindings/app42/StorageService.java", "license": "apache-2.0", "size": 20843 }
[ "org.robovm.apple.foundation.NSDictionary", "org.robovm.objc.annotation.Block", "org.robovm.objc.annotation.Method" ]
import org.robovm.apple.foundation.NSDictionary; import org.robovm.objc.annotation.Block; import org.robovm.objc.annotation.Method;
import org.robovm.apple.foundation.*; import org.robovm.objc.annotation.*;
[ "org.robovm.apple", "org.robovm.objc" ]
org.robovm.apple; org.robovm.objc;
2,401,243
@Override public void setStoreLocation(String location, Job job) throws IOException { URI locationURI; try { locationURI = new URI(location); if (!"hbase".equals(locationURI.getScheme())) { throw new IOException(String.format("Location must use the hbase protocol, hbase://tableName[/columnList]. Supplied location=%s",location)); } config = job.getConfiguration(); config.set(HConstants.ZOOKEEPER_QUORUM, server); String tableName = locationURI.getAuthority(); // strip off the leading path token '/' String columns = null; if(!locationURI.getPath().isEmpty()) { columns = locationURI.getPath().substring(1); PhoenixConfigurationUtil.setUpsertColumnNames(config, columns); } PhoenixConfigurationUtil.setOutputTableName(config,tableName); PhoenixConfigurationUtil.setBatchSize(config,batchSize); String serializedSchema = getUDFProperties().getProperty(contextSignature + SCHEMA); if (serializedSchema != null) { schema = (ResourceSchema) ObjectSerializer.deserialize(serializedSchema); } } catch (URISyntaxException e) { throw new IOException(String.format("Location must use the hbase protocol, hbase://tableName[/columnList]. Supplied location=%s",location),e); } }
void function(String location, Job job) throws IOException { URI locationURI; try { locationURI = new URI(location); if (!"hbase".equals(locationURI.getScheme())) { throw new IOException(String.format(STRLocation must use the hbase protocol, hbase: } }
/** * Parse the HBase table name and configure job */
Parse the HBase table name and configure job
setStoreLocation
{ "repo_name": "cloudera-labs/phoenix", "path": "phoenix-pig/src/main/java/org/apache/phoenix/pig/PhoenixHBaseStorage.java", "license": "apache-2.0", "size": 8500 }
[ "java.io.IOException", "org.apache.hadoop.mapreduce.Job" ]
import java.io.IOException; import org.apache.hadoop.mapreduce.Job;
import java.io.*; import org.apache.hadoop.mapreduce.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
95,906
@Test public void testCommitOverheadAfterEmptyDelete() { File f = new File(TestTools.getDbFileName()); long len1 = f.length(); //open session PersistenceManager pm = TestTools.openPM(); DBStatistics dbs = ZooJdoHelper.getStatistics(pm); long pwc0 = dbs.getStoragePageWriteCount(); // 1. try Query.deletePersistentAll() pm.currentTransaction().begin(); deletePersistentAll(pm, TestClass.class); pm.currentTransaction().commit(); //2. try PersistenceManager.delete(Extent.iterator().next()) with batches pm.currentTransaction().begin(); deleteAllBatched(pm, TestClass.class); pm.currentTransaction().commit(); long pwc2 = dbs.getStoragePageWriteCount(); assertEquals(pwc0, pwc2); TestTools.closePM(); assertEquals(len1, f.length()); }
void function() { File f = new File(TestTools.getDbFileName()); long len1 = f.length(); PersistenceManager pm = TestTools.openPM(); DBStatistics dbs = ZooJdoHelper.getStatistics(pm); long pwc0 = dbs.getStoragePageWriteCount(); pm.currentTransaction().begin(); deletePersistentAll(pm, TestClass.class); pm.currentTransaction().commit(); pm.currentTransaction().begin(); deleteAllBatched(pm, TestClass.class); pm.currentTransaction().commit(); long pwc2 = dbs.getStoragePageWriteCount(); assertEquals(pwc0, pwc2); TestTools.closePM(); assertEquals(len1, f.length()); }
/** * We test how many pages get written if we do not actually * change anything before committing but perform empty deletion * attempts. */
We test how many pages get written if we do not actually change anything before committing but perform empty deletion attempts
testCommitOverheadAfterEmptyDelete
{ "repo_name": "tzaeschke/zoodb", "path": "tst/org/zoodb/test/jdo/Test_101_DbSpaceManagement.java", "license": "gpl-3.0", "size": 5413 }
[ "java.io.File", "javax.jdo.PersistenceManager", "org.junit.Assert", "org.zoodb.jdo.ZooJdoHelper", "org.zoodb.test.testutil.TestTools", "org.zoodb.tools.DBStatistics" ]
import java.io.File; import javax.jdo.PersistenceManager; import org.junit.Assert; import org.zoodb.jdo.ZooJdoHelper; import org.zoodb.test.testutil.TestTools; import org.zoodb.tools.DBStatistics;
import java.io.*; import javax.jdo.*; import org.junit.*; import org.zoodb.jdo.*; import org.zoodb.test.testutil.*; import org.zoodb.tools.*;
[ "java.io", "javax.jdo", "org.junit", "org.zoodb.jdo", "org.zoodb.test", "org.zoodb.tools" ]
java.io; javax.jdo; org.junit; org.zoodb.jdo; org.zoodb.test; org.zoodb.tools;
2,909,706
public void rollback() throws SQLException { checkClosed(); if (isInGlobalTx()) { throw SQLError .createSQLException( "Can't call rollback() on an XAConnection associated with a global transaction", SQLError.SQL_STATE_INVALID_TRANSACTION_TERMINATION, MysqlErrorNumbers.ER_XA_RMERR, this.exceptionInterceptor); } try { this.mc.rollback(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } }
void function() throws SQLException { checkClosed(); if (isInGlobalTx()) { throw SQLError .createSQLException( STR, SQLError.SQL_STATE_INVALID_TRANSACTION_TERMINATION, MysqlErrorNumbers.ER_XA_RMERR, this.exceptionInterceptor); } try { this.mc.rollback(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } }
/** * Passes call to method on physical connection instance. Notifies listeners * of any caught exceptions before re-throwing to client. * * @see java.sql.Connection#rollback() */
Passes call to method on physical connection instance. Notifies listeners of any caught exceptions before re-throwing to client
rollback
{ "repo_name": "vaisaghvt/gameAnalyzer", "path": "mysql-connector-java-5.1.22/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java", "license": "mit", "size": 72741 }
[ "com.mysql.jdbc.MysqlErrorNumbers", "com.mysql.jdbc.SQLError", "java.sql.SQLException" ]
import com.mysql.jdbc.MysqlErrorNumbers; import com.mysql.jdbc.SQLError; import java.sql.SQLException;
import com.mysql.jdbc.*; import java.sql.*;
[ "com.mysql.jdbc", "java.sql" ]
com.mysql.jdbc; java.sql;
1,301,244
public Element getEventHandlerIcon(SVGDocument doc);
Element function(SVGDocument doc);
/** * At start: xLeft=0, yTop=0 * * @param doc SVG document which defines the components including shapes, gradients etc. of the activity * @return Element(represents an element in a XML) which contains the EventHandler icon and arrow flows */
At start: xLeft=0, yTop=0
getEventHandlerIcon
{ "repo_name": "himasha/carbon-business-process", "path": "components/bpel/org.wso2.carbon.bpel.ui/src/main/java/org/wso2/carbon/bpel/ui/bpel2svg/ScopeInterface.java", "license": "apache-2.0", "size": 2190 }
[ "org.w3c.dom.Element", "org.w3c.dom.svg.SVGDocument" ]
import org.w3c.dom.Element; import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.*; import org.w3c.dom.svg.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,864,124
public void setDerivedObjectId(RMapIri iri) throws RMapException, RMapDefectiveArgumentException;
void function(RMapIri iri) throws RMapException, RMapDefectiveArgumentException;
/** * Sets the derived object's IRI. * * @param iri the new derived object IRI * @throws RMapException the RMap exception * @throws RMapDefectiveArgumentException the r map defective argument exception */
Sets the derived object's IRI
setDerivedObjectId
{ "repo_name": "rmap-project/rmap", "path": "core/src/main/java/info/rmapproject/core/model/event/RMapEventDerivation.java", "license": "apache-2.0", "size": 2549 }
[ "info.rmapproject.core.exception.RMapDefectiveArgumentException", "info.rmapproject.core.exception.RMapException", "info.rmapproject.core.model.RMapIri" ]
import info.rmapproject.core.exception.RMapDefectiveArgumentException; import info.rmapproject.core.exception.RMapException; import info.rmapproject.core.model.RMapIri;
import info.rmapproject.core.exception.*; import info.rmapproject.core.model.*;
[ "info.rmapproject.core" ]
info.rmapproject.core;
2,608,255
@Override public void chartChanged(ChartChangeEvent event) { this.refreshBuffer = true; Plot plot = this.chart.getPlot(); if (plot instanceof Zoomable) { Zoomable z = (Zoomable) plot; this.orientation = z.getOrientation(); } repaint(); }
void function(ChartChangeEvent event) { this.refreshBuffer = true; Plot plot = this.chart.getPlot(); if (plot instanceof Zoomable) { Zoomable z = (Zoomable) plot; this.orientation = z.getOrientation(); } repaint(); }
/** * Receives notification of changes to the chart, and redraws the chart. * * @param event details of the chart change event. */
Receives notification of changes to the chart, and redraws the chart
chartChanged
{ "repo_name": "hongliangpan/manydesigns.cn", "path": "trunk/portofino-chart/jfreechat.src/org/jfree/chart/ChartPanel.java", "license": "lgpl-3.0", "size": 119437 }
[ "org.jfree.chart.event.ChartChangeEvent", "org.jfree.chart.plot.Plot", "org.jfree.chart.plot.Zoomable" ]
import org.jfree.chart.event.ChartChangeEvent; import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.Zoomable;
import org.jfree.chart.event.*; import org.jfree.chart.plot.*;
[ "org.jfree.chart" ]
org.jfree.chart;
1,074,594
public boolean sendToIncoming(String session_id, Packet packet) { XMPPIOService<Object> serv = incoming.get(session_id); if (serv != null) { if (log.isLoggable(Level.FINEST)) { log.finest(serv + ", Sending to incoming connection: " + session_id + " packet: " + packet); } return writePacketToSocket(serv, packet); } else { if (log.isLoggable(Level.FINER)) { log.finer("Trying to send packet: " + packet + " to nonexisten connection with sessionId: " + session_id); } return false; } }
boolean function(String session_id, Packet packet) { XMPPIOService<Object> serv = incoming.get(session_id); if (serv != null) { if (log.isLoggable(Level.FINEST)) { log.finest(serv + STR + session_id + STR + packet); } return writePacketToSocket(serv, packet); } else { if (log.isLoggable(Level.FINER)) { log.finer(STR + packet + STR + session_id); } return false; } }
/** * Method description * * * @param session_id * @param packet * * */
Method description
sendToIncoming
{ "repo_name": "fanout/tigase-server", "path": "src/main/java/tigase/server/xmppserver/ServerConnectionManager.java", "license": "agpl-3.0", "size": 43237 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
1,178,901
private void sendUpdate(JSONObject obj, boolean keepCallback, PluginResult.Status status) { if (callbackContext != null) { PluginResult result = new PluginResult(status, obj); result.setKeepCallback(keepCallback); callbackContext.sendPluginResult(result); if (!keepCallback) { callbackContext = null; } } }
void function(JSONObject obj, boolean keepCallback, PluginResult.Status status) { if (callbackContext != null) { PluginResult result = new PluginResult(status, obj); result.setKeepCallback(keepCallback); callbackContext.sendPluginResult(result); if (!keepCallback) { callbackContext = null; } } }
/** * Create a new plugin result and send it back to JavaScript * * @param obj a JSONObject contain event payload information * @param status the status code to return to the JavaScript environment */
Create a new plugin result and send it back to JavaScript
sendUpdate
{ "repo_name": "JStumpp/cordova-plugin-themeablebrowser", "path": "src/android/ThemeableBrowser.java", "license": "apache-2.0", "size": 61559 }
[ "org.apache.cordova.PluginResult", "org.json.JSONObject" ]
import org.apache.cordova.PluginResult; import org.json.JSONObject;
import org.apache.cordova.*; import org.json.*;
[ "org.apache.cordova", "org.json" ]
org.apache.cordova; org.json;
318,142
FlowFileCodec negotiateCodec(Peer peer) throws IOException, ProtocolException;
FlowFileCodec negotiateCodec(Peer peer) throws IOException, ProtocolException;
/** * Negotiates the FlowFileCodec that is to be used for transferring * FlowFiles * * @param peer peer * @return the codec to use * @throws IOException ioe * @throws org.apache.nifi.remote.exception.ProtocolException pe */
Negotiates the FlowFileCodec that is to be used for transferring FlowFiles
negotiateCodec
{ "repo_name": "WilliamNouet/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/remote/protocol/ServerProtocol.java", "license": "apache-2.0", "size": 5027 }
[ "java.io.IOException", "org.apache.nifi.remote.Peer", "org.apache.nifi.remote.codec.FlowFileCodec", "org.apache.nifi.remote.exception.ProtocolException" ]
import java.io.IOException; import org.apache.nifi.remote.Peer; import org.apache.nifi.remote.codec.FlowFileCodec; import org.apache.nifi.remote.exception.ProtocolException;
import java.io.*; import org.apache.nifi.remote.*; import org.apache.nifi.remote.codec.*; import org.apache.nifi.remote.exception.*;
[ "java.io", "org.apache.nifi" ]
java.io; org.apache.nifi;
1,421,626
public CcCompilationHelper addFrameworkIncludeDirs(Iterable<PathFragment> frameworkIncludeDirs) { Iterables.addAll(this.frameworkIncludeDirs, frameworkIncludeDirs); return this; }
CcCompilationHelper function(Iterable<PathFragment> frameworkIncludeDirs) { Iterables.addAll(this.frameworkIncludeDirs, frameworkIncludeDirs); return this; }
/** * Adds the given directories to the framework include directories (they are passed with {@code * "-F"} to the compiler); these are also passed to dependent rules. */
Adds the given directories to the framework include directories (they are passed with "-F" to the compiler); these are also passed to dependent rules
addFrameworkIncludeDirs
{ "repo_name": "meteorcloudy/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationHelper.java", "license": "apache-2.0", "size": 94509 }
[ "com.google.common.collect.Iterables", "com.google.devtools.build.lib.vfs.PathFragment" ]
import com.google.common.collect.Iterables; import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.common.collect.*; import com.google.devtools.build.lib.vfs.*;
[ "com.google.common", "com.google.devtools" ]
com.google.common; com.google.devtools;
2,858,813
protected static Map<String, String> parseArguments(String[] args) { final Map<String, String> map = new HashMap<>(); for (String arg : args) { final int d = arg.indexOf("="); if (d > 0 && d < arg.length() && arg.startsWith("--")) { final String name = arg.substring(2, d); final String value = arg.substring(d + 1); map.put(name, value); } } return map; } public static class SlowFilter implements Filter {
static Map<String, String> function(String[] args) { final Map<String, String> map = new HashMap<>(); for (String arg : args) { final int d = arg.indexOf("="); if (d > 0 && d < arg.length() && arg.startsWith("--")) { final String name = arg.substring(2, d); final String value = arg.substring(d + 1); map.put(name, value); } } return map; } public static class SlowFilter implements Filter {
/** * Parse all command line arguments into a map. * * Arguments format "key=value" are put into map. * * @param args * @return map of arguments key value pairs. */
Parse all command line arguments into a map. Arguments format "key=value" are put into map
parseArguments
{ "repo_name": "Darsstar/framework", "path": "uitest/src/main/java/com/vaadin/launcher/DevelopmentServerLauncher.java", "license": "apache-2.0", "size": 17218 }
[ "java.util.HashMap", "java.util.Map", "javax.servlet.Filter" ]
import java.util.HashMap; import java.util.Map; import javax.servlet.Filter;
import java.util.*; import javax.servlet.*;
[ "java.util", "javax.servlet" ]
java.util; javax.servlet;
1,076,070
private double unknownElemFlow(ILCDFlow flow, ES1Exchange eExchange) { if (flow.description != null) { eExchange.name = TypeCheck.checkLength( LangString.getFirstValue(flow.description.getName(), "en"), 80); eExchange.localName = eExchange.name; eExchange.CASNumber = formatCAS(flow.description.casNumber); eExchange.formula = flow.description.sumFormula; // flow classification // TODO elementary flow category } // convert the ILCD flow property to the EcoSpold 01 unit String unit = null; DataSetReference ref = flow.getReferenceProperty(); if (ref != null) { unit = ILCDPropertyRec.unit(ref.getRefObjectId()); } if (unit == null) { logger.severe("Cannot load flow property for " + ref); return 0; } else { eExchange.unit = unit; } return 1; }
double function(ILCDFlow flow, ES1Exchange eExchange) { if (flow.description != null) { eExchange.name = TypeCheck.checkLength( LangString.getFirstValue(flow.description.getName(), "en"), 80); eExchange.localName = eExchange.name; eExchange.CASNumber = formatCAS(flow.description.casNumber); eExchange.formula = flow.description.sumFormula; } String unit = null; DataSetReference ref = flow.getReferenceProperty(); if (ref != null) { unit = ILCDPropertyRec.unit(ref.getRefObjectId()); } if (unit == null) { logger.severe(STR + ref); return 0; } else { eExchange.unit = unit; } return 1; }
/** * This function is called if the source elementary flow is not stored in * the database. The information of the source flow are transformed to the * given exchange. * */
This function is called if the source elementary flow is not stored in the database. The information of the source flow are transformed to the given exchange
unknownElemFlow
{ "repo_name": "GreenDelta/olca-converter", "path": "src/main/java/org/openlca/olcatdb/conversion/ILCDToES1Conversion.java", "license": "mpl-2.0", "size": 32113 }
[ "org.openlca.olcatdb.database.ILCDPropertyRec", "org.openlca.olcatdb.datatypes.DataSetReference", "org.openlca.olcatdb.datatypes.LangString", "org.openlca.olcatdb.datatypes.TypeCheck", "org.openlca.olcatdb.ecospold1.ES1Exchange", "org.openlca.olcatdb.ilcd.ILCDFlow" ]
import org.openlca.olcatdb.database.ILCDPropertyRec; import org.openlca.olcatdb.datatypes.DataSetReference; import org.openlca.olcatdb.datatypes.LangString; import org.openlca.olcatdb.datatypes.TypeCheck; import org.openlca.olcatdb.ecospold1.ES1Exchange; import org.openlca.olcatdb.ilcd.ILCDFlow;
import org.openlca.olcatdb.database.*; import org.openlca.olcatdb.datatypes.*; import org.openlca.olcatdb.ecospold1.*; import org.openlca.olcatdb.ilcd.*;
[ "org.openlca.olcatdb" ]
org.openlca.olcatdb;
133,276
private Set<Invokable> getExposedInvokables(TypeToken type) { Set<Invokable> invokables = Sets.newHashSet(); for (Constructor constructor : type.getRawType().getConstructors()) { if (0 != (constructor.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED))) { invokables.add(type.constructor(constructor)); } } for (Method method : type.getRawType().getMethods()) { if (0 != (method.getModifiers() & (Modifier.PUBLIC | Modifier.PROTECTED))) { invokables.add(type.method(method)); } } return invokables; }
Set<Invokable> function(TypeToken type) { Set<Invokable> invokables = Sets.newHashSet(); for (Constructor constructor : type.getRawType().getConstructors()) { if (0 != (constructor.getModifiers() & (Modifier.PUBLIC Modifier.PROTECTED))) { invokables.add(type.constructor(constructor)); } } for (Method method : type.getRawType().getMethods()) { if (0 != (method.getModifiers() & (Modifier.PUBLIC Modifier.PROTECTED))) { invokables.add(type.method(method)); } } return invokables; }
/** * Returns an {@link Invokable} for each public methods or constructors of a type. */
Returns an <code>Invokable</code> for each public methods or constructors of a type
getExposedInvokables
{ "repo_name": "Test-Betta-Inc/musical-umbrella", "path": "sdk/src/main/java/com/google/cloud/dataflow/sdk/util/ApiSurface.java", "license": "apache-2.0", "size": 18500 }
[ "com.google.common.collect.Sets", "com.google.common.reflect.Invokable", "com.google.common.reflect.TypeToken", "java.lang.reflect.Constructor", "java.lang.reflect.Method", "java.lang.reflect.Modifier", "java.util.Set" ]
import com.google.common.collect.Sets; import com.google.common.reflect.Invokable; import com.google.common.reflect.TypeToken; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Set;
import com.google.common.collect.*; import com.google.common.reflect.*; import java.lang.reflect.*; import java.util.*;
[ "com.google.common", "java.lang", "java.util" ]
com.google.common; java.lang; java.util;
2,615,811
public boolean isPreferencesVisible() { return M_as.unlock(CalendarService.AUTH_OPTIONS_CALENDAR, M_ca.calendarReference(getSiteId(), SiteService.MAIN_CONTAINER)); } private final static String ASSN_ENTITY_ID = "assignment"; private final static String ASSN_ENTITY_ACTION = "item"; private EntityBroker entityBroker; private final static String ASSN_ENTITY_PREFIX = EntityReference.SEPARATOR+ASSN_ENTITY_ID+EntityReference.SEPARATOR+ASSN_ENTITY_ACTION+EntityReference.SEPARATOR;
boolean function() { return M_as.unlock(CalendarService.AUTH_OPTIONS_CALENDAR, M_ca.calendarReference(getSiteId(), SiteService.MAIN_CONTAINER)); } private final static String ASSN_ENTITY_ID = STR; private final static String ASSN_ENTITY_ACTION = "item"; private EntityBroker entityBroker; private final static String ASSN_ENTITY_PREFIX = EntityReference.SEPARATOR+ASSN_ENTITY_ID+EntityReference.SEPARATOR+ASSN_ENTITY_ACTION+EntityReference.SEPARATOR;
/** * Tests if the options section should be displayed. */
Tests if the options section should be displayed
isPreferencesVisible
{ "repo_name": "payten/nyu-sakai-10.4", "path": "calendar/calendar-summary-tool/tool/src/java/org/sakaiproject/tool/summarycalendar/ui/CalendarBean.java", "license": "apache-2.0", "size": 34038 }
[ "org.sakaiproject.calendar.api.CalendarService", "org.sakaiproject.entitybroker.EntityBroker", "org.sakaiproject.entitybroker.EntityReference", "org.sakaiproject.site.api.SiteService" ]
import org.sakaiproject.calendar.api.CalendarService; import org.sakaiproject.entitybroker.EntityBroker; import org.sakaiproject.entitybroker.EntityReference; import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.calendar.api.*; import org.sakaiproject.entitybroker.*; import org.sakaiproject.site.api.*;
[ "org.sakaiproject.calendar", "org.sakaiproject.entitybroker", "org.sakaiproject.site" ]
org.sakaiproject.calendar; org.sakaiproject.entitybroker; org.sakaiproject.site;
986,941
@Override public ErrorPage findErrorPage(int errorCode) { return statusPages.get(Integer.valueOf(errorCode)); }
ErrorPage function(int errorCode) { return statusPages.get(Integer.valueOf(errorCode)); }
/** * Return the error page entry for the specified HTTP error code, * if any; otherwise return <code>null</code>. * * @param errorCode Error code to look up */
Return the error page entry for the specified HTTP error code, if any; otherwise return <code>null</code>
findErrorPage
{ "repo_name": "Nickname0806/Test_Q4", "path": "java/org/apache/catalina/core/StandardContext.java", "license": "apache-2.0", "size": 209298 }
[ "org.apache.tomcat.util.descriptor.web.ErrorPage" ]
import org.apache.tomcat.util.descriptor.web.ErrorPage;
import org.apache.tomcat.util.descriptor.web.*;
[ "org.apache.tomcat" ]
org.apache.tomcat;
736,237
protected static void closeStatement(Statement statement) { if (statement != null) { try { statement.close(); } catch (SQLException e) { // Nothing } } }
static void function(Statement statement) { if (statement != null) { try { statement.close(); } catch (SQLException e) { } } }
/** * Close the given statement if not null. * * @param statement - Statement. */
Close the given statement if not null
closeStatement
{ "repo_name": "felixhamel/ift287_tp4", "path": "src/main/java/ligueBaseball/entities/DatabaseEntity.java", "license": "mit", "size": 4610 }
[ "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,435,902
public void setCreateDate(Date createDate);
void function(Date createDate);
/** * Sets the create date of this user group role custom. * * @param createDate the create date of this user group role custom */
Sets the create date of this user group role custom
setCreateDate
{ "repo_name": "queza85/edison", "path": "edison-portal-framework/edison-custom-auth-manager-2016-portlet/docroot/WEB-INF/service/org/kisti/edison/customauthmanager/model/UserGroupRoleCustomModel.java", "license": "gpl-3.0", "size": 5840 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,933,218
public static Event getEventById(Long id) { return ofy().load().type(Event.class).id(id).now(); }
static Event function(Long id) { return ofy().load().type(Event.class).id(id).now(); }
/** * Get an event by id. * * @param id the event id * @return the event by its id */
Get an event by id
getEventById
{ "repo_name": "robt1019/Litter-Mapping-Tool-", "path": "backend_api/src/main/java/org/littermappingtool/backend/dao/PreparedQueries.java", "license": "gpl-2.0", "size": 7144 }
[ "com.googlecode.objectify.ObjectifyService", "org.littermappingtool.backend.Event" ]
import com.googlecode.objectify.ObjectifyService; import org.littermappingtool.backend.Event;
import com.googlecode.objectify.*; import org.littermappingtool.backend.*;
[ "com.googlecode.objectify", "org.littermappingtool.backend" ]
com.googlecode.objectify; org.littermappingtool.backend;
266,203
void applyForces(double seconds); void addForce(Vector2D force); Vector2D getVel(); void setVel(Vector2D vel); void applyDrag(double seconds); Rectangle getCollisionBox(); void move(int x, int y);
void applyForces(double seconds); void addForce(Vector2D force); Vector2D getVel(); void setVel(Vector2D vel); void applyDrag(double seconds); Rectangle getCollisionBox(); void move(int x, int y);
/** * Directly move the object by an amount. * @param x How much to move in the x direction. * @param y How much to move in the y direction. */
Directly move the object by an amount
move
{ "repo_name": "JoePelz/scroller", "path": "src/core/Dynamic.java", "license": "mit", "size": 1363 }
[ "java.awt.Rectangle" ]
import java.awt.Rectangle;
import java.awt.*;
[ "java.awt" ]
java.awt;
701,402
public boolean isTargeted(Character aa, int index, SequenceMatchingParameters sequenceMatchingParameters) { if (residueTargeted != null) { MatchingType matchingType = sequenceMatchingParameters.getSequenceMatchingType(); ArrayList<Character> aaList = residueTargeted.get(index); if (aaList != null && !aaList.isEmpty()) { for (int i = 0; i < aaList.size(); i++) { Character targetedAA = aaList.get(i); if (aa.equals(targetedAA)) { return true; } else if (matchingType == MatchingType.aminoAcid || matchingType == MatchingType.indistiguishableAminoAcids) { AminoAcid targetedAminoAcid = AminoAcid.getAminoAcid(targetedAA); for (Character tempAA : targetedAminoAcid.getSubAminoAcids()) { if (aa.equals(tempAA)) { return true; } } for (Character tempAA : targetedAminoAcid.getCombinations()) { if (aa.equals(tempAA)) { return true; } } if (matchingType == MatchingType.indistiguishableAminoAcids && (targetedAminoAcid == AminoAcid.I || targetedAminoAcid == AminoAcid.J || targetedAminoAcid == AminoAcid.L)) { if (aa == 'I' || aa == 'J' || aa == 'L') { return true; } } } } } else if (aaList != null) { return true; } } return false; }
boolean function(Character aa, int index, SequenceMatchingParameters sequenceMatchingParameters) { if (residueTargeted != null) { MatchingType matchingType = sequenceMatchingParameters.getSequenceMatchingType(); ArrayList<Character> aaList = residueTargeted.get(index); if (aaList != null && !aaList.isEmpty()) { for (int i = 0; i < aaList.size(); i++) { Character targetedAA = aaList.get(i); if (aa.equals(targetedAA)) { return true; } else if (matchingType == MatchingType.aminoAcid matchingType == MatchingType.indistiguishableAminoAcids) { AminoAcid targetedAminoAcid = AminoAcid.getAminoAcid(targetedAA); for (Character tempAA : targetedAminoAcid.getSubAminoAcids()) { if (aa.equals(tempAA)) { return true; } } for (Character tempAA : targetedAminoAcid.getCombinations()) { if (aa.equals(tempAA)) { return true; } } if (matchingType == MatchingType.indistiguishableAminoAcids && (targetedAminoAcid == AminoAcid.I targetedAminoAcid == AminoAcid.J targetedAminoAcid == AminoAcid.L)) { if (aa == 'I' aa == 'J' aa == 'L') { return true; } } } } } else if (aaList != null) { return true; } } return false; }
/** * Indicates whether the given amino acid at the given index of the pattern * is targeted without accounting for mutations. * * @param aa the amino acid as character * @param index the index in the pattern * @param sequenceMatchingParameters the sequence matching preferences * * @return true if the given amino acid at the given index of the pattern is * targeted */
Indicates whether the given amino acid at the given index of the pattern is targeted without accounting for mutations
isTargeted
{ "repo_name": "compomics/compomics-utilities", "path": "src/main/java/com/compomics/util/experiment/biology/aminoacids/sequence/AminoAcidPattern.java", "license": "apache-2.0", "size": 45666 }
[ "com.compomics.util.experiment.biology.aminoacids.AminoAcid", "com.compomics.util.parameters.identification.advanced.SequenceMatchingParameters", "java.util.ArrayList" ]
import com.compomics.util.experiment.biology.aminoacids.AminoAcid; import com.compomics.util.parameters.identification.advanced.SequenceMatchingParameters; import java.util.ArrayList;
import com.compomics.util.experiment.biology.aminoacids.*; import com.compomics.util.parameters.identification.advanced.*; import java.util.*;
[ "com.compomics.util", "java.util" ]
com.compomics.util; java.util;
2,793,293
public final View getAnchorView() { return mDropDownAnchorView; }
final View function() { return mDropDownAnchorView; }
/** * Returns the view that will be used to anchor this popup. * * @return The {@link CCPListPopupWindow} anchor view */
Returns the view that will be used to anchor this popup
getAnchorView
{ "repo_name": "LSPOoO/com.lspooo.example", "path": "plugin_common/src/main/java/com/lspooo/plugin/common/view/CCPListPopupWindow.java", "license": "mit", "size": 44273 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,201,822
if (numThreads >= Balancer.MAX_NUM_CONCURRENT_MOVES) { return false; } numThreads++; return true; }
if (numThreads >= Balancer.MAX_NUM_CONCURRENT_MOVES) { return false; } numThreads++; return true; }
/** Check if the block move can start. * * Return true if the thread quota is not exceeded and * the counter is incremented; False otherwise. */
Check if the block move can start. Return true if the thread quota is not exceeded and the counter is incremented; False otherwise
acquire
{ "repo_name": "rvadali/fb-raid-refactoring", "path": "src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataXceiverServer.java", "license": "apache-2.0", "size": 6635 }
[ "org.apache.hadoop.hdfs.server.balancer.Balancer" ]
import org.apache.hadoop.hdfs.server.balancer.Balancer;
import org.apache.hadoop.hdfs.server.balancer.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,536,670
public static ColorUIResource getControl() { if (theme != null) return theme.getControl(); return null; }
static ColorUIResource function() { if (theme != null) return theme.getControl(); return null; }
/** * Returns the control color from the installed theme. * * @return The control color. */
Returns the control color from the installed theme
getControl
{ "repo_name": "ivmai/JCGO", "path": "goclsp/clsp_fix/javax/swing/plaf/metal/MetalLookAndFeel.java", "license": "gpl-2.0", "size": 48610 }
[ "javax.swing.plaf.ColorUIResource" ]
import javax.swing.plaf.ColorUIResource;
import javax.swing.plaf.*;
[ "javax.swing" ]
javax.swing;
379,428
@Test public final void testSetParameterStringNull() { // Setup the resources for the test. int frameID = 0x10; XBee64BitAddress dest64Addr = new XBee64BitAddress("0013A2004032D9AB"); XBee16BitAddress dest16Addr = new XBee16BitAddress("FFFF"); int options = 23; String command = "NI"; RemoteATCommandPacket packet = new RemoteATCommandPacket(frameID, dest64Addr, dest16Addr, options, command, ""); // Call the method under test. packet.setParameter((String)null); // Verify the result. assertThat("Configured parameter must be 'null'", packet.getParameterAsString(), is(equalTo(null))); assertThat("Configured parameter must be 'null'", packet.getParameter(), is(equalTo(null))); }
final void function() { int frameID = 0x10; XBee64BitAddress dest64Addr = new XBee64BitAddress(STR); XBee16BitAddress dest16Addr = new XBee16BitAddress("FFFF"); int options = 23; String command = "NI"; RemoteATCommandPacket packet = new RemoteATCommandPacket(frameID, dest64Addr, dest16Addr, options, command, STRConfigured parameter must be 'null'STRConfigured parameter must be 'null'", packet.getParameter(), is(equalTo(null))); }
/** * Test method for {@link com.digi.xbee.api.packet.common.RemoteATCommandPacket#setParameter(String)}. * * <p>Test if a string parameter with {@code null} value is properly * configured.</p> */
Test method for <code>com.digi.xbee.api.packet.common.RemoteATCommandPacket#setParameter(String)</code>. Test if a string parameter with null value is properly configured
testSetParameterStringNull
{ "repo_name": "GUBotDev/XBeeJavaLibrary", "path": "library/src/test/java/com/digi/xbee/api/packet/common/RemoteATCommandPacketTest.java", "license": "mpl-2.0", "size": 52215 }
[ "com.digi.xbee.api.models.XBee16BitAddress", "com.digi.xbee.api.models.XBee64BitAddress", "org.hamcrest.core.Is" ]
import com.digi.xbee.api.models.XBee16BitAddress; import com.digi.xbee.api.models.XBee64BitAddress; import org.hamcrest.core.Is;
import com.digi.xbee.api.models.*; import org.hamcrest.core.*;
[ "com.digi.xbee", "org.hamcrest.core" ]
com.digi.xbee; org.hamcrest.core;
510,319
public List<FieldNode> genColLists(Operator<? extends OperatorDesc> curOp, Operator<? extends OperatorDesc> child) throws SemanticException { if (curOp.getChildOperators() == null) { return null; } if (child instanceof CommonJoinOperator) { int tag = child.getParentOperators().indexOf(curOp); return joinPrunedColLists.get(child).get((byte) tag); } else { return prunedColLists.get(child); } }
List<FieldNode> function(Operator<? extends OperatorDesc> curOp, Operator<? extends OperatorDesc> child) throws SemanticException { if (curOp.getChildOperators() == null) { return null; } if (child instanceof CommonJoinOperator) { int tag = child.getParentOperators().indexOf(curOp); return joinPrunedColLists.get(child).get((byte) tag); } else { return prunedColLists.get(child); } }
/** * Creates the list of internal column names (represented by field nodes, * these names are used in the RowResolver and are different from the * external column names) that are needed in the subtree. These columns * eventually have to be selected from the table scan. * * @param curOp The root of the operator subtree. * @param child The consumer. * @return a list of field nodes representing the internal column names. */
Creates the list of internal column names (represented by field nodes, these names are used in the RowResolver and are different from the external column names) that are needed in the subtree. These columns eventually have to be selected from the table scan
genColLists
{ "repo_name": "vineetgarg02/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/optimizer/ColumnPrunerProcCtx.java", "license": "apache-2.0", "size": 14313 }
[ "java.util.List", "org.apache.hadoop.hive.ql.exec.CommonJoinOperator", "org.apache.hadoop.hive.ql.exec.Operator", "org.apache.hadoop.hive.ql.parse.SemanticException", "org.apache.hadoop.hive.ql.plan.OperatorDesc" ]
import java.util.List; import org.apache.hadoop.hive.ql.exec.CommonJoinOperator; import org.apache.hadoop.hive.ql.exec.Operator; import org.apache.hadoop.hive.ql.parse.SemanticException; import org.apache.hadoop.hive.ql.plan.OperatorDesc;
import java.util.*; import org.apache.hadoop.hive.ql.exec.*; import org.apache.hadoop.hive.ql.parse.*; import org.apache.hadoop.hive.ql.plan.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,260,882
public void getEngine() { final TextToSpeech[] someTts = new TextToSpeech[1];
void function() { final TextToSpeech[] someTts = new TextToSpeech[1];
/** * Entry point for locating a TTS engine for a given locale. * <p/> * The end result of calling this method is that {@link #callback} gets notified. */
Entry point for locating a TTS engine for a given locale. The end result of calling this method is that <code>#callback</code> gets notified
getEngine
{ "repo_name": "walles/headsetharry", "path": "app/src/main/java/com/gmail/walles/johan/headsetharry/TtsUtils.java", "license": "gpl-3.0", "size": 11445 }
[ "android.speech.tts.TextToSpeech" ]
import android.speech.tts.TextToSpeech;
import android.speech.tts.*;
[ "android.speech" ]
android.speech;
1,390,042
public FiComRequest signData(final String apTransId, final byte [] digestToBeSigned, final String phoneNumber, final AdditionalServiceType noSpamService, final AdditionalServiceType eventIDService, final List<AdditionalServiceType> additionalServices, final FiComResponseHandler handler) throws IOException { FiComRequest req = this.createRequest(apTransId, new DTBS(digestToBeSigned, DTBS.ENCODING_BASE64, DTBS.MIME_SHA1), phoneNumber, noSpamService, eventIDService, additionalServices, SignatureProfiles.FICOM_DIGESTIVE, MSS_Formats.PKCS7); return this.call(req, handler); }
FiComRequest function(final String apTransId, final byte [] digestToBeSigned, final String phoneNumber, final AdditionalServiceType noSpamService, final AdditionalServiceType eventIDService, final List<AdditionalServiceType> additionalServices, final FiComResponseHandler handler) throws IOException { FiComRequest req = this.createRequest(apTransId, new DTBS(digestToBeSigned, DTBS.ENCODING_BASE64, DTBS.MIME_SHA1), phoneNumber, noSpamService, eventIDService, additionalServices, SignatureProfiles.FICOM_DIGESTIVE, MSS_Formats.PKCS7); return this.call(req, handler); }
/** * Convenience method for sending a data sign request * * @param apTransId AP Transaction ID * @param digestToBeSigned Data to be signed * @param phoneNumber MSISDN of the target user * @param noSpamService Service for sending nospam code * @param eventIDService Service containing the wanted EventId for the request * @param additionalServices List of FiCom additionalservices to add to the request * @param handler FiComResponseHandler for receiving asynch responses. * @return Sent request. * @throws IOException if handler is null or if an IOException was caught when sending the request. * @see ClientBase#call(fi.laverca.mss.MssRequest, ResponseHandler) */
Convenience method for sending a data sign request
signData
{ "repo_name": "laverca/laverca", "path": "src/core/fi/laverca/ficom/FiComClient.java", "license": "apache-2.0", "size": 17018 }
[ "fi.laverca.SignatureProfiles", "fi.laverca.jaxb.mss.AdditionalServiceType", "java.io.IOException", "java.util.List" ]
import fi.laverca.SignatureProfiles; import fi.laverca.jaxb.mss.AdditionalServiceType; import java.io.IOException; import java.util.List;
import fi.laverca.*; import fi.laverca.jaxb.mss.*; import java.io.*; import java.util.*;
[ "fi.laverca", "fi.laverca.jaxb", "java.io", "java.util" ]
fi.laverca; fi.laverca.jaxb; java.io; java.util;
805,044
private void registerMbean(Object obj, @Nullable String cacheName, boolean near) throws IgniteCheckedException { if (U.IGNITE_MBEANS_DISABLED) return; assert obj != null; MBeanServer srvr = ctx.config().getMBeanServer(); assert srvr != null; cacheName = U.maskName(cacheName); cacheName = near ? cacheName + "-near" : cacheName; final Object mbeanImpl = (obj instanceof IgniteMBeanAware) ? ((IgniteMBeanAware)obj).getMBean() : obj; for (Class<?> itf : mbeanImpl.getClass().getInterfaces()) { if (itf.getName().endsWith("MBean") || itf.getName().endsWith("MXBean")) { try { U.registerMBean(srvr, ctx.igniteInstanceName(), cacheName, obj.getClass().getName(), mbeanImpl, (Class<Object>)itf); } catch (Throwable e) { throw new IgniteCheckedException("Failed to register MBean for component: " + obj, e); } break; } } }
void function(Object obj, @Nullable String cacheName, boolean near) throws IgniteCheckedException { if (U.IGNITE_MBEANS_DISABLED) return; assert obj != null; MBeanServer srvr = ctx.config().getMBeanServer(); assert srvr != null; cacheName = U.maskName(cacheName); cacheName = near ? cacheName + "-near" : cacheName; final Object mbeanImpl = (obj instanceof IgniteMBeanAware) ? ((IgniteMBeanAware)obj).getMBean() : obj; for (Class<?> itf : mbeanImpl.getClass().getInterfaces()) { if (itf.getName().endsWith("MBean") itf.getName().endsWith(STR)) { try { U.registerMBean(srvr, ctx.igniteInstanceName(), cacheName, obj.getClass().getName(), mbeanImpl, (Class<Object>)itf); } catch (Throwable e) { throw new IgniteCheckedException(STR + obj, e); } break; } } }
/** * Registers MBean for cache components. * * @param obj Cache component. * @param cacheName Cache name. * @param near Near flag. * @throws IgniteCheckedException If registration failed. */
Registers MBean for cache components
registerMbean
{ "repo_name": "ilantukh/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java", "license": "apache-2.0", "size": 237840 }
[ "javax.management.MBeanServer", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.util.typedef.internal.U", "org.apache.ignite.mxbean.IgniteMBeanAware", "org.jetbrains.annotations.Nullable" ]
import javax.management.MBeanServer; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.mxbean.IgniteMBeanAware; import org.jetbrains.annotations.Nullable;
import javax.management.*; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.mxbean.*; import org.jetbrains.annotations.*;
[ "javax.management", "org.apache.ignite", "org.jetbrains.annotations" ]
javax.management; org.apache.ignite; org.jetbrains.annotations;
1,257,748
@Override public void stateChanged(ChangeEvent e) { updateFrameTitle(); updateMenu(); // did the content of panel change? -> change title of tab if (e.getSource() instanceof JComponent) { setTabTitle((JComponent) e.getSource()); } }
void function(ChangeEvent e) { updateFrameTitle(); updateMenu(); if (e.getSource() instanceof JComponent) { setTabTitle((JComponent) e.getSource()); } }
/** * Invoked when the target of the listener has changed its state. * * @param e the change event */
Invoked when the target of the listener has changed its state
stateChanged
{ "repo_name": "runqingz/umple", "path": "Umplificator/UmplifiedProjects/weka-umplified-0/src/main/java/weka/gui/arffviewer/ArffViewerMainPanel.java", "license": "mit", "size": 30550 }
[ "javax.swing.JComponent", "javax.swing.event.ChangeEvent" ]
import javax.swing.JComponent; import javax.swing.event.ChangeEvent;
import javax.swing.*; import javax.swing.event.*;
[ "javax.swing" ]
javax.swing;
32,315
@Override public void exitNew_expression(@NotNull FunctionParser.New_expressionContext ctx) { }
@Override public void exitNew_expression(@NotNull FunctionParser.New_expressionContext ctx) { }
/** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */
The default implementation does nothing
enterNew_expression
{ "repo_name": "octopus-platform/joern", "path": "projects/extensions/joern-fuzzyc/src/main/java/antlr/FunctionBaseListener.java", "license": "lgpl-3.0", "size": 42232 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
647,327
public static void parseXContentFields(XContentParser parser, Builder context) throws IOException { DocWriteResponse.parseInnerToXContent(parser, context); }
static void function(XContentParser parser, Builder context) throws IOException { DocWriteResponse.parseInnerToXContent(parser, context); }
/** * Parse the current token and update the parsing context appropriately. */
Parse the current token and update the parsing context appropriately
parseXContentFields
{ "repo_name": "gingerwizard/elasticsearch", "path": "server/src/main/java/org/elasticsearch/action/index/IndexResponse.java", "license": "apache-2.0", "size": 4406 }
[ "java.io.IOException", "org.elasticsearch.action.DocWriteResponse", "org.elasticsearch.common.xcontent.XContentParser" ]
import java.io.IOException; import org.elasticsearch.action.DocWriteResponse; import org.elasticsearch.common.xcontent.XContentParser;
import java.io.*; import org.elasticsearch.action.*; import org.elasticsearch.common.xcontent.*;
[ "java.io", "org.elasticsearch.action", "org.elasticsearch.common" ]
java.io; org.elasticsearch.action; org.elasticsearch.common;
139,362
protected synchronized void initJMS(boolean onInit) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialise JMS (onInit="+onInit+", initialized="+_initialized+")"); } if (_initialized) { return; } // Check if connection factory initialized if (_connectionFactory == null) { try { InitialContext context=new InitialContext(); _connectionFactory = (ConnectionFactory)context.lookup("java:/JmsXA"); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised connection factory="+_connectionFactory); } } catch (Exception e) { LOG.log((onInit ? Level.FINEST : Level.SEVERE), "Failed to initialize JMS connection factory", e); return; } } if (_connectionFactory != null && _connection == null) { try { if (_username != null) { _connection = _connectionFactory.createConnection(_username, _password); } else { _connection = _connectionFactory.createConnection(); } if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised connection="+_connection); } } catch (Exception e) { LOG.log(Level.SEVERE, "Failed to create connection", e); } } if (_connection != null && _session == null) { try { // TODO: Issue - must be non-transacted, to enable arquillian test // to work, but ideally needs to be transacted in production to // ensure transactional consistency _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised session="+_session); } if (_epnEventsDestination == null && _epnEventsDestinationName != null) { _epnEventsDestination = _session.createQueue(_epnEventsDestinationName); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised events destination("+_epnEventsDestinationName+")=" +_epnEventsDestination); } } if (_epnNotificationsDestination == null && _epnNotificationsDestinationName != null) { _epnNotificationsDestination = _session.createTopic(_epnNotificationsDestinationName); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised notifications destination("+_epnNotificationsDestinationName+")=" +_epnNotificationsDestination); } } } catch (Exception e) { LOG.log(Level.SEVERE, "Failed to create session or destinations", e); } } if (_epnEventsDestination == null) { try { InitialContext context=new InitialContext(); _epnEventsDestination = (Destination)context.lookup("java:/EPNEvents"); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised events destination="+_epnEventsDestination); } } catch (Exception e) { LOG.log((onInit ? Level.FINEST : Level.SEVERE), "Failed to initialize JMS events destination", e); return; } } if (_epnNotificationsDestination == null) { try { InitialContext context=new InitialContext(); _epnNotificationsDestination = (Destination)context.lookup("java:/EPNNotifications"); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised notifications destination="+_epnNotificationsDestination); } } catch (Exception e) { LOG.log((onInit ? Level.FINEST : Level.SEVERE), "Failed to initialize JMS notifications destination", e); return; } } if (_session != null && _epnEventsDestination != null && _epnNotificationsDestination != null) { try { _eventsProducer = _session.createProducer(_epnEventsDestination); _notificationsProducer = _session.createProducer(_epnNotificationsDestination); if (LOG.isLoggable(Level.FINEST)) { LOG.finest("Initialised producers, events="+_eventsProducer+" notifications="+_notificationsProducer); }
synchronized void function(boolean onInit) { if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+onInit+STR+_initialized+")"); } if (_initialized) { return; } if (_connectionFactory == null) { try { InitialContext context=new InitialContext(); _connectionFactory = (ConnectionFactory)context.lookup(STR); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_connectionFactory); } } catch (Exception e) { LOG.log((onInit ? Level.FINEST : Level.SEVERE), STR, e); return; } } if (_connectionFactory != null && _connection == null) { try { if (_username != null) { _connection = _connectionFactory.createConnection(_username, _password); } else { _connection = _connectionFactory.createConnection(); } if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_connection); } } catch (Exception e) { LOG.log(Level.SEVERE, STR, e); } } if (_connection != null && _session == null) { try { _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_session); } if (_epnEventsDestination == null && _epnEventsDestinationName != null) { _epnEventsDestination = _session.createQueue(_epnEventsDestinationName); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_epnEventsDestinationName+")=" +_epnEventsDestination); } } if (_epnNotificationsDestination == null && _epnNotificationsDestinationName != null) { _epnNotificationsDestination = _session.createTopic(_epnNotificationsDestinationName); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_epnNotificationsDestinationName+")=" +_epnNotificationsDestination); } } } catch (Exception e) { LOG.log(Level.SEVERE, STR, e); } } if (_epnEventsDestination == null) { try { InitialContext context=new InitialContext(); _epnEventsDestination = (Destination)context.lookup(STR); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_epnEventsDestination); } } catch (Exception e) { LOG.log((onInit ? Level.FINEST : Level.SEVERE), STR, e); return; } } if (_epnNotificationsDestination == null) { try { InitialContext context=new InitialContext(); _epnNotificationsDestination = (Destination)context.lookup(STR); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_epnNotificationsDestination); } } catch (Exception e) { LOG.log((onInit ? Level.FINEST : Level.SEVERE), STR, e); return; } } if (_session != null && _epnEventsDestination != null && _epnNotificationsDestination != null) { try { _eventsProducer = _session.createProducer(_epnEventsDestination); _notificationsProducer = _session.createProducer(_epnNotificationsDestination); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(STR+_eventsProducer+STR+_notificationsProducer); }
/** * This method initializes the JMS connection and destinations. * * @param onInit Whether being called on service initializatipn */
This method initializes the JMS connection and destinations
initJMS
{ "repo_name": "objectiser/rtgov", "path": "modules/event-processor-network/epn-jms/src/main/java/org/overlord/rtgov/epn/jms/JMSEPNManagerImpl.java", "license": "apache-2.0", "size": 30823 }
[ "java.util.logging.Level", "javax.jms.ConnectionFactory", "javax.jms.Destination", "javax.jms.Session", "javax.naming.InitialContext" ]
import java.util.logging.Level; import javax.jms.ConnectionFactory; import javax.jms.Destination; import javax.jms.Session; import javax.naming.InitialContext;
import java.util.logging.*; import javax.jms.*; import javax.naming.*;
[ "java.util", "javax.jms", "javax.naming" ]
java.util; javax.jms; javax.naming;
2,288,543
public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); if (this.networkManager == null) { this.drawCenteredString(this.fontRenderer, I18n.format("connect.connecting"), this.width / 2, this.height / 2 - 50, 16777215); } else { this.drawCenteredString(this.fontRenderer, I18n.format("connect.authorizing"), this.width / 2, this.height / 2 - 50, 16777215); } super.drawScreen(mouseX, mouseY, partialTicks); }
void function(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); if (this.networkManager == null) { this.drawCenteredString(this.fontRenderer, I18n.format(STR), this.width / 2, this.height / 2 - 50, 16777215); } else { this.drawCenteredString(this.fontRenderer, I18n.format(STR), this.width / 2, this.height / 2 - 50, 16777215); } super.drawScreen(mouseX, mouseY, partialTicks); }
/** * Draws the screen and all the components in it. */
Draws the screen and all the components in it
drawScreen
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/client/multiplayer/GuiConnecting.java", "license": "gpl-3.0", "size": 6796 }
[ "net.minecraft.client.resources.I18n" ]
import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.*;
[ "net.minecraft.client" ]
net.minecraft.client;
2,859,636
public String getSingleString(String key) { Properties labels = getLabels(); if (labels != null) { String value = labels.getProperty(key); if (value != null) { return value; } } return key; }
String function(String key) { Properties labels = getLabels(); if (labels != null) { String value = labels.getProperty(key); if (value != null) { return value; } } return key; }
/** * Gets a string. * * @param key * The name of the string * @return The localized string */
Gets a string
getSingleString
{ "repo_name": "JKatzwinkel/settlers-remake", "path": "jsettlers.graphics/src/jsettlers/graphics/localization/AbstractLabels.java", "license": "mit", "size": 5632 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,005,495
@Override public OAuth1CredentialsInfo storeSharedOAuth1Credentials(String remoteSystemId, String token, String secret) throws NoSuchSystemException { OAuth1CredentialsInfo credentials = buildSharedOAuth1CredentialsInfo(remoteSystemId, token, secret); return (OAuth1CredentialsInfo) remoteCredentialsService.createSharedCredentials( remoteSystemId, credentials); }
OAuth1CredentialsInfo function(String remoteSystemId, String token, String secret) throws NoSuchSystemException { OAuth1CredentialsInfo credentials = buildSharedOAuth1CredentialsInfo(remoteSystemId, token, secret); return (OAuth1CredentialsInfo) remoteCredentialsService.createSharedCredentials( remoteSystemId, credentials); }
/** * Add Shared OAuth1 Credentials to the OAuth1 Credential Store * * @param remoteSystemId String * @param token String * @param secret String * @return OAuth1CredentialsInfo */
Add Shared OAuth1 Credentials to the OAuth1 Credential Store
storeSharedOAuth1Credentials
{ "repo_name": "Tybion/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/oauth1/OAuth1CredentialsStoreServiceImpl.java", "license": "lgpl-3.0", "size": 9071 }
[ "org.alfresco.service.cmr.remotecredentials.OAuth1CredentialsInfo", "org.alfresco.service.cmr.remoteticket.NoSuchSystemException" ]
import org.alfresco.service.cmr.remotecredentials.OAuth1CredentialsInfo; import org.alfresco.service.cmr.remoteticket.NoSuchSystemException;
import org.alfresco.service.cmr.remotecredentials.*; import org.alfresco.service.cmr.remoteticket.*;
[ "org.alfresco.service" ]
org.alfresco.service;
1,227,369
public static byte[] generateSalt() throws GeneralSecurityException { return randomBytes(PBE_SALT_LENGTH_BITS); }
static byte[] function() throws GeneralSecurityException { return randomBytes(PBE_SALT_LENGTH_BITS); }
/** * Generates a random salt. * @return The random salt suitable for generateKeyFromPassword. */
Generates a random salt
generateSalt
{ "repo_name": "draekko/java-aes-crypto", "path": "aes-crypto/src/main/java/com/tozny/crypto/android/AesCbcWithIntegrity.java", "license": "mit", "size": 40531 }
[ "java.security.GeneralSecurityException" ]
import java.security.GeneralSecurityException;
import java.security.*;
[ "java.security" ]
java.security;
2,768,631
EOperation getTMember__IsConstructor();
EOperation getTMember__IsConstructor();
/** * Returns the meta object for the '{@link org.eclipse.n4js.ts.types.TMember#isConstructor() <em>Is Constructor</em>}' operation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the '<em>Is Constructor</em>' operation. * @see org.eclipse.n4js.ts.types.TMember#isConstructor() * @generated */
Returns the meta object for the '<code>org.eclipse.n4js.ts.types.TMember#isConstructor() Is Constructor</code>' operation.
getTMember__IsConstructor
{ "repo_name": "lbeurerkellner/n4js", "path": "plugins/org.eclipse.n4js.ts.model/emf-gen/org/eclipse/n4js/ts/types/TypesPackage.java", "license": "epl-1.0", "size": 538237 }
[ "org.eclipse.emf.ecore.EOperation" ]
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,864,365
protected void submit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException { }
void function(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException { }
/** * Derived class can override this to perform additional config submission * work. */
Derived class can override this to perform additional config submission work
submit
{ "repo_name": "olivergondza/jenkins", "path": "core/src/main/java/hudson/model/Job.java", "license": "mit", "size": 53642 }
[ "hudson.model.Descriptor", "java.io.IOException", "javax.servlet.ServletException", "org.kohsuke.stapler.StaplerRequest", "org.kohsuke.stapler.StaplerResponse" ]
import hudson.model.Descriptor; import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse;
import hudson.model.*; import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*;
[ "hudson.model", "java.io", "javax.servlet", "org.kohsuke.stapler" ]
hudson.model; java.io; javax.servlet; org.kohsuke.stapler;
301,022
public static void createCacheClient(Integer port1, String host) throws Exception { Properties props = new Properties(); props.setProperty("mcast-port", "0"); props.setProperty("locators", ""); new HAOverflowMemObjectSizerDUnitTest("temp").createCache(props); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.NORMAL); BridgeTestCase.configureConnectionPool(factory, host, port1.intValue(), -1, true, -1, 2, null, -1, -1, false); RegionAttributes attrs = factory.create(); Region region = cache.createRegion(regionName, attrs); assertNotNull(region); region.registerInterest("ALL_KEYS"); }
static void function(Integer port1, String host) throws Exception { Properties props = new Properties(); props.setProperty(STR, "0"); props.setProperty(STR, STRtempSTRALL_KEYS"); }
/** * create client cache * * @param port1 * @param port2 - end points ports */
create client cache
createCacheClient
{ "repo_name": "papicella/snappy-store", "path": "tests/core/src/main/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java", "license": "apache-2.0", "size": 10943 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
2,112,002
public Node[] toArray() { final List<Node> preorder = new ArrayList<>(); printAST(new StringBuilder(), preorder, null, "root", root, 0); return preorder.toArray(new Node[preorder.size()]); }
Node[] function() { final List<Node> preorder = new ArrayList<>(); printAST(new StringBuilder(), preorder, null, "root", root, 0); return preorder.toArray(new Node[preorder.size()]); }
/** * Return the visited nodes in an ordered list * @return the list of nodes in order */
Return the visited nodes in an ordered list
toArray
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/nashorn/src/jdk/nashorn/internal/ir/debug/ASTWriter.java", "license": "mit", "size": 9355 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,324,782
public void sendAskOrderUser(String orderId) { Order order = getOrder(orderId); String user = getOrganisationController().getUserDetail(order. getProcessUserId()).getDisplayedName(); String url = URLUtil.getURL(null, getComponentId()) + "OrderView?OrderId=" + orderId; LocalizationBundle message = ResourceLocator.getLocalizationBundle(MULTILANG_GALLERY_BUNDLE, DisplayI18NHelper.getDefaultLanguage()); String subject = message.getString("gallery.orderNotifAskSubject"); StringBuilder messageBody = new StringBuilder(); messageBody = messageBody.append(user).append(" ") .append(message.getString("gallery.orderNotifBodyAskOk")).append("\n"); NotificationMetaData notifMetaData = new NotificationMetaData(NotificationParameters.NORMAL, subject, messageBody.toString()); for (String language : DisplayI18NHelper.getLanguages()) { message = ResourceLocator.getLocalizationBundle(MULTILANG_GALLERY_BUNDLE, language); subject = message.getString("gallery.orderNotifAskSubject"); messageBody = new StringBuilder(); messageBody = messageBody.append(user).append(" ").append( message.getString("gallery.orderNotifBodyAskOk")).append("\n"); notifMetaData.addLanguage(language, subject, messageBody.toString()); Link link = new Link(url, message.getString("gallery.notifOrderLinkLabel")); notifMetaData.setLink(link, language); } notifMetaData.addUserRecipient(new UserRecipient(String.valueOf(order.getUserId()))); notifyUsers(notifMetaData); }
void function(String orderId) { Order order = getOrder(orderId); String user = getOrganisationController().getUserDetail(order. getProcessUserId()).getDisplayedName(); String url = URLUtil.getURL(null, getComponentId()) + STR + orderId; LocalizationBundle message = ResourceLocator.getLocalizationBundle(MULTILANG_GALLERY_BUNDLE, DisplayI18NHelper.getDefaultLanguage()); String subject = message.getString(STR); StringBuilder messageBody = new StringBuilder(); messageBody = messageBody.append(user).append(" ") .append(message.getString(STR)).append("\n"); NotificationMetaData notifMetaData = new NotificationMetaData(NotificationParameters.NORMAL, subject, messageBody.toString()); for (String language : DisplayI18NHelper.getLanguages()) { message = ResourceLocator.getLocalizationBundle(MULTILANG_GALLERY_BUNDLE, language); subject = message.getString(STR); messageBody = new StringBuilder(); messageBody = messageBody.append(user).append(" ").append( message.getString(STR)).append("\n"); notifMetaData.addLanguage(language, subject, messageBody.toString()); Link link = new Link(url, message.getString(STR)); notifMetaData.setLink(link, language); } notifMetaData.addUserRecipient(new UserRecipient(String.valueOf(order.getUserId()))); notifyUsers(notifMetaData); }
/** * Send notification to reader to alert him that his order has been processed * @param orderId the order identifier */
Send notification to reader to alert him that his order has been processed
sendAskOrderUser
{ "repo_name": "auroreallibe/Silverpeas-Components", "path": "gallery/gallery-war/src/main/java/org/silverpeas/components/gallery/control/GallerySessionController.java", "license": "agpl-3.0", "size": 49785 }
[ "org.silverpeas.components.gallery.model.Order", "org.silverpeas.core.notification.user.client.NotificationMetaData", "org.silverpeas.core.notification.user.client.NotificationParameters", "org.silverpeas.core.notification.user.client.UserRecipient", "org.silverpeas.core.ui.DisplayI18NHelper", "org.silverpeas.core.util.Link", "org.silverpeas.core.util.LocalizationBundle", "org.silverpeas.core.util.ResourceLocator", "org.silverpeas.core.util.URLUtil" ]
import org.silverpeas.components.gallery.model.Order; import org.silverpeas.core.notification.user.client.NotificationMetaData; import org.silverpeas.core.notification.user.client.NotificationParameters; import org.silverpeas.core.notification.user.client.UserRecipient; import org.silverpeas.core.ui.DisplayI18NHelper; import org.silverpeas.core.util.Link; import org.silverpeas.core.util.LocalizationBundle; import org.silverpeas.core.util.ResourceLocator; import org.silverpeas.core.util.URLUtil;
import org.silverpeas.components.gallery.model.*; import org.silverpeas.core.notification.user.client.*; import org.silverpeas.core.ui.*; import org.silverpeas.core.util.*;
[ "org.silverpeas.components", "org.silverpeas.core" ]
org.silverpeas.components; org.silverpeas.core;
535,143
@Override public int read(byte[] bytes) throws java.io.IOException { if (deferrredException != null) { // there was an exception caught when calling Attachment.getInputStream() // - throw it now throw deferrredException; } int amountRead = 0; int currentOffset = 0; int howMuch = 0; do { InputStream currentComponent = components.get(currentComponentIdx); // try to read enough bytes to fill the rest of the bytes array howMuch = bytes.length - currentOffset; if (howMuch <= 0) { break; } int read = currentComponent.read(bytes, currentOffset, howMuch); if (read <= 0) { currentComponentIdx++; continue; } amountRead += read; currentOffset += howMuch; } while (currentComponentIdx < components.size()); // signal EOF if we don't have any more int retnum = amountRead > 0 ? amountRead : -1; return retnum; } }; }
int function(byte[] bytes) throws java.io.IOException { if (deferrredException != null) { throw deferrredException; } int amountRead = 0; int currentOffset = 0; int howMuch = 0; do { InputStream currentComponent = components.get(currentComponentIdx); howMuch = bytes.length - currentOffset; if (howMuch <= 0) { break; } int read = currentComponent.read(bytes, currentOffset, howMuch); if (read <= 0) { currentComponentIdx++; continue; } amountRead += read; currentOffset += howMuch; } while (currentComponentIdx < components.size()); int retnum = amountRead > 0 ? amountRead : -1; return retnum; } }; }
/** * Read at most the next <code>bytes.length</code> bytes from the stream. * * @param bytes A buffer to read the next <i>n</i> bytes into, up to the * limit of the length of the buffer, or the number of bytes * available, whichever is lower. * @return The actual number of bytes read, or -1 to signal the end of the * stream has been reached. * @throws java.io.IOException if there was an error reading from one of the * internal input streams */
Read at most the next <code>bytes.length</code> bytes from the stream
read
{ "repo_name": "nuan-nuan/sync-android", "path": "cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/datastore/MultipartAttachmentWriter.java", "license": "apache-2.0", "size": 11688 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,592,098
public ActionForward performReportDump(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form; ActionForward forward = performOrgSelectionTree(OrgSelOpMode.REPORTS, mapping, form, request, response); return forward; }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { BudgetConstructionSelectionForm budgetConstructionSelectionForm = (BudgetConstructionSelectionForm) form; ActionForward forward = performOrgSelectionTree(OrgSelOpMode.REPORTS, mapping, form, request, response); return forward; }
/** * Passes control to the Organization Selection to run the organization reports subsystem * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */
Passes control to the Organization Selection to run the organization reports subsystem
performReportDump
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/bc/document/web/struts/BudgetConstructionSelectionAction.java", "license": "agpl-3.0", "size": 25224 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.kfs.module.bc.BCConstants" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.kfs.module.bc.BCConstants;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.kfs.module.bc.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.kfs" ]
javax.servlet; org.apache.struts; org.kuali.kfs;
1,638,433
protected IIOMetadataNode getNativeNodeForSimpleBox() { try { Method m = this.getClass().getMethod("getElementNames", (Class[])null); String[] elementNames = (String[])m.invoke(null, (Object[])null); IIOMetadataNode node = new IIOMetadataNode(Box.getName(getType())); setDefaultAttributes(node); for (int i = 0; i < elementNames.length; i++) { IIOMetadataNode child = new IIOMetadataNode(elementNames[i]); m = this.getClass().getMethod("get" + elementNames[i], (Class[])null); Object obj = m.invoke(this, (Object[])null); child.setUserObject(obj); child.setNodeValue(ImageUtil.convertObjectToString(obj)); node.appendChild(child); } return node; } catch (Exception e) { throw new IllegalArgumentException(I18N.getString("Box0")); } }
IIOMetadataNode function() { try { Method m = this.getClass().getMethod(STR, (Class[])null); String[] elementNames = (String[])m.invoke(null, (Object[])null); IIOMetadataNode node = new IIOMetadataNode(Box.getName(getType())); setDefaultAttributes(node); for (int i = 0; i < elementNames.length; i++) { IIOMetadataNode child = new IIOMetadataNode(elementNames[i]); m = this.getClass().getMethod("get" + elementNames[i], (Class[])null); Object obj = m.invoke(this, (Object[])null); child.setUserObject(obj); child.setNodeValue(ImageUtil.convertObjectToString(obj)); node.appendChild(child); } return node; } catch (Exception e) { throw new IllegalArgumentException(I18N.getString("Box0")); } }
/** Creates an <code>IIOMetadataNode</code> from this * box. The format of this node is defined in the XML dtd and xsd * for the JP2 image file. * * This method is designed for the types of boxes whose XML tree * only has 2 levels. */
Creates an <code>IIOMetadataNode</code> from this box. The format of this node is defined in the XML dtd and xsd for the JP2 image file. This method is designed for the types of boxes whose XML tree only has 2 levels
getNativeNodeForSimpleBox
{ "repo_name": "ximenesuk/bioformats", "path": "components/forks/jai/src/com/sun/media/imageioimpl/plugins/jpeg2000/Box.java", "license": "gpl-2.0", "size": 25167 }
[ "com.sun.media.imageioimpl.common.ImageUtil", "java.lang.reflect.Method", "javax.imageio.metadata.IIOMetadataNode" ]
import com.sun.media.imageioimpl.common.ImageUtil; import java.lang.reflect.Method; import javax.imageio.metadata.IIOMetadataNode;
import com.sun.media.imageioimpl.common.*; import java.lang.reflect.*; import javax.imageio.metadata.*;
[ "com.sun.media", "java.lang", "javax.imageio" ]
com.sun.media; java.lang; javax.imageio;
1,932,061
public static void addAccountAuthentication( Model model, Resource instanceResource, Node value ) { Base.add( model, instanceResource, ACCOUNTAUTHENTICATION, value ); }
static void function( Model model, Resource instanceResource, Node value ) { Base.add( model, instanceResource, ACCOUNTAUTHENTICATION, value ); }
/** * Adds a value to property {@code AccountAuthentication} as an RDF2Go {@linkplain Node}. * * @param model * an RDF2Go model * @param instanceResource * an RDF2Go resource * @param value * the value to be added * * [Generated from RDFReactor template rule #add1static] */
Adds a value to property AccountAuthentication as an RDF2Go Node
addAccountAuthentication
{ "repo_name": "m0ep/master-thesis", "path": "source/apis/rdf2go/rdf2go-sioc-services-auth/src/main/java/de/m0ep/sioc/services/auth/UserAccount.java", "license": "mit", "size": 21163 }
[ "org.ontoware.rdf2go.model.Model", "org.ontoware.rdf2go.model.node.Node", "org.ontoware.rdf2go.model.node.Resource", "org.ontoware.rdfreactor.runtime.Base" ]
import org.ontoware.rdf2go.model.Model; import org.ontoware.rdf2go.model.node.Node; import org.ontoware.rdf2go.model.node.Resource; import org.ontoware.rdfreactor.runtime.Base;
import org.ontoware.rdf2go.model.*; import org.ontoware.rdf2go.model.node.*; import org.ontoware.rdfreactor.runtime.*;
[ "org.ontoware.rdf2go", "org.ontoware.rdfreactor" ]
org.ontoware.rdf2go; org.ontoware.rdfreactor;
331,111
public static PathFragment createAlreadyNormalized(String normalizedPath) { return normalizedPath.isEmpty() ? EMPTY_FRAGMENT : makePathFragment(normalizedPath, OS.getDriveStrLength(normalizedPath)); } private PathFragment(String normalizedPath) { this.normalizedPath = Preconditions.checkNotNull(normalizedPath); }
static PathFragment function(String normalizedPath) { return normalizedPath.isEmpty() ? EMPTY_FRAGMENT : makePathFragment(normalizedPath, OS.getDriveStrLength(normalizedPath)); } private PathFragment(String normalizedPath) { this.normalizedPath = Preconditions.checkNotNull(normalizedPath); }
/** * Creates a new path fragment, where the caller promises that the path is normalized. * * <p>WARNING! Make sure the path fragment is in fact already normalized. The rest of the code * assumes this is the case. */
Creates a new path fragment, where the caller promises that the path is normalized. WARNING! Make sure the path fragment is in fact already normalized. The rest of the code assumes this is the case
createAlreadyNormalized
{ "repo_name": "bazelbuild/bazel", "path": "src/main/java/com/google/devtools/build/lib/vfs/PathFragment.java", "license": "apache-2.0", "size": 30297 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,921,112
public static PropertiesBasedTimeouts fromClassPath(String path, ClassLoader loader) { InputStream is = loader.getResourceAsStream(path); try { return new PropertiesBasedTimeouts(checkNotNull(is)); } finally { IOUtils.closeQuietly(is); } }
static PropertiesBasedTimeouts function(String path, ClassLoader loader) { InputStream is = loader.getResourceAsStream(path); try { return new PropertiesBasedTimeouts(checkNotNull(is)); } finally { IOUtils.closeQuietly(is); } }
/** * Load instance of <tt>PropertiesBasedTimeouts</tt> based on properties from a class path resource. * * @param path path of the resource * @param loader class loader to use * @return new instance of this class */
Load instance of PropertiesBasedTimeouts based on properties from a class path resource
fromClassPath
{ "repo_name": "adini121/atlassian", "path": "atlassian-pageobjects-elements/src/main/java/com/atlassian/pageobjects/elements/timeout/PropertiesBasedTimeouts.java", "license": "bsd-3-clause", "size": 5934 }
[ "java.io.InputStream", "org.apache.commons.io.IOUtils" ]
import java.io.InputStream; import org.apache.commons.io.IOUtils;
import java.io.*; import org.apache.commons.io.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
1,704,739
// 1) Get valid txn list. String txnString = driverContext.getConf().get(ValidTxnList.VALID_TXNS_KEY); if (txnString == null) { return true; // Not a transactional op, nothing more to do } // 2) Get locks that are relevant: // - Exclusive for INSERT OVERWRITE, when shared write is disabled (HiveConf.TXN_WRITE_X_LOCK=false). // - Excl-write for UPDATE/DELETE, when shared write is disabled, INSERT OVERWRITE - when enabled. Set<String> nonSharedLockedTables = getNonSharedLockedTables(); if (nonSharedLockedTables.isEmpty()) { return true; // Nothing to check } // 3) Get txn tables that are being written String txnWriteIdListString = driverContext.getConf().get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY); if (StringUtils.isEmpty(txnWriteIdListString)) { return true; // Nothing to check } GetOpenTxnsResponse openTxns = driverContext.getTxnManager().getOpenTxns(); ValidTxnList validTxnList = TxnCommonUtils.createValidReadTxnList(openTxns, 0); long txnId = driverContext.getTxnManager().getCurrentTxnId(); String currentTxnString; if (validTxnList.isTxnRangeValid(txnId + 1, openTxns.getTxn_high_water_mark()) != ValidTxnList.RangeResponse.NONE) { // If here, there was another txn opened & committed between current SNAPSHOT generation and locking. validTxnList.removeException(txnId); currentTxnString = validTxnList.toString(); } else { currentTxnString = TxnCommonUtils.createValidReadTxnList(openTxns, txnId).toString(); } if (currentTxnString.equals(txnString)) { return true; // Still valid, nothing more to do } return checkWriteIds(currentTxnString, nonSharedLockedTables, txnWriteIdListString); }
String txnString = driverContext.getConf().get(ValidTxnList.VALID_TXNS_KEY); if (txnString == null) { return true; } Set<String> nonSharedLockedTables = getNonSharedLockedTables(); if (nonSharedLockedTables.isEmpty()) { return true; } String txnWriteIdListString = driverContext.getConf().get(ValidTxnWriteIdList.VALID_TABLES_WRITEIDS_KEY); if (StringUtils.isEmpty(txnWriteIdListString)) { return true; } GetOpenTxnsResponse openTxns = driverContext.getTxnManager().getOpenTxns(); ValidTxnList validTxnList = TxnCommonUtils.createValidReadTxnList(openTxns, 0); long txnId = driverContext.getTxnManager().getCurrentTxnId(); String currentTxnString; if (validTxnList.isTxnRangeValid(txnId + 1, openTxns.getTxn_high_water_mark()) != ValidTxnList.RangeResponse.NONE) { validTxnList.removeException(txnId); currentTxnString = validTxnList.toString(); } else { currentTxnString = TxnCommonUtils.createValidReadTxnList(openTxns, txnId).toString(); } if (currentTxnString.equals(txnString)) { return true; } return checkWriteIds(currentTxnString, nonSharedLockedTables, txnWriteIdListString); }
/** * Checks whether txn list has been invalidated while planning the query. * This would happen if query requires exclusive/semi-shared lock, and there has been a committed transaction * on the table over which the lock is required. */
Checks whether txn list has been invalidated while planning the query. This would happen if query requires exclusive/semi-shared lock, and there has been a committed transaction on the table over which the lock is required
isValidTxnListState
{ "repo_name": "anishek/hive", "path": "ql/src/java/org/apache/hadoop/hive/ql/ValidTxnManager.java", "license": "apache-2.0", "size": 13507 }
[ "java.util.Set", "org.apache.hadoop.hive.common.ValidTxnList", "org.apache.hadoop.hive.common.ValidTxnWriteIdList", "org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse", "org.apache.hadoop.hive.metastore.txn.TxnCommonUtils", "org.apache.hadoop.hive.metastore.utils.StringUtils" ]
import java.util.Set; import org.apache.hadoop.hive.common.ValidTxnList; import org.apache.hadoop.hive.common.ValidTxnWriteIdList; import org.apache.hadoop.hive.metastore.api.GetOpenTxnsResponse; import org.apache.hadoop.hive.metastore.txn.TxnCommonUtils; import org.apache.hadoop.hive.metastore.utils.StringUtils;
import java.util.*; import org.apache.hadoop.hive.common.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.hive.metastore.txn.*; import org.apache.hadoop.hive.metastore.utils.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
2,566,748
public void emit(VName source, String edgeKind, VName target, String factName, byte[] factValue);
void function(VName source, String edgeKind, VName target, String factName, byte[] factValue);
/** * Emits a single fact to some data sink. {@link edgeKind} and {@link target} must both be either * {@code null} (for a node entry) or non-{@code null} (for an edge entry). */
Emits a single fact to some data sink. <code>edgeKind</code> and <code>target</code> must both be either null (for a node entry) or non-null (for an edge entry)
emit
{ "repo_name": "benjyw/kythe", "path": "kythe/java/com/google/devtools/kythe/analyzers/base/FactEmitter.java", "license": "apache-2.0", "size": 1742 }
[ "com.google.devtools.kythe.proto.Storage" ]
import com.google.devtools.kythe.proto.Storage;
import com.google.devtools.kythe.proto.*;
[ "com.google.devtools" ]
com.google.devtools;
2,001,870
public static <R, C, V> TreeBasedTable<R, C, V> create( Comparator<? super R> rowComparator, Comparator<? super C> columnComparator) { checkNotNull(rowComparator); checkNotNull(columnComparator); return new TreeBasedTable<>(rowComparator, columnComparator); }
static <R, C, V> TreeBasedTable<R, C, V> function( Comparator<? super R> rowComparator, Comparator<? super C> columnComparator) { checkNotNull(rowComparator); checkNotNull(columnComparator); return new TreeBasedTable<>(rowComparator, columnComparator); }
/** * Creates an empty {@code TreeBasedTable} that is ordered by the specified comparators. * * @param rowComparator the comparator that orders the row keys * @param columnComparator the comparator that orders the column keys */
Creates an empty TreeBasedTable that is ordered by the specified comparators
create
{ "repo_name": "typetools/guava", "path": "guava/src/com/google/common/collect/TreeBasedTable.java", "license": "apache-2.0", "size": 11625 }
[ "com.google.common.base.Preconditions", "java.util.Comparator" ]
import com.google.common.base.Preconditions; import java.util.Comparator;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
1,897,121
public Entity buildEntity(final Entity e, EntityWorld world, Object... args);
Entity function(final Entity e, EntityWorld world, Object... args);
/** * Creates an entity. * * @param e * The entity to be built * @param physicsWorld * An EntityWorld. * @param args * Arguments. * @return An {@link Entity} of this template. */
Creates an entity
buildEntity
{ "repo_name": "LostCodeStudios/JavaLib", "path": "JavaLib/src/com/lostcode/javalib/entities/templates/EntityTemplate.java", "license": "mit", "size": 630 }
[ "com.lostcode.javalib.entities.Entity", "com.lostcode.javalib.entities.EntityWorld" ]
import com.lostcode.javalib.entities.Entity; import com.lostcode.javalib.entities.EntityWorld;
import com.lostcode.javalib.entities.*;
[ "com.lostcode.javalib" ]
com.lostcode.javalib;
98,740
private void rDeterminePartitioningCandidates(String var, ArrayList<StatementBlock> asb, List<PartitionFormat> C) throws LanguageException { for(StatementBlock sb : asb ) // foreach statementblock in parforbody for( Statement s : sb._statements ) // foreach statement in statement block { if( s instanceof ForStatement ) //includes for and parfor { ForStatement fs = (ForStatement) s; //predicate List<DataIdentifier> datsFromRead = rGetDataIdentifiers(fs.getIterablePredicate().getFromExpr()); List<DataIdentifier> datsToRead = rGetDataIdentifiers(fs.getIterablePredicate().getToExpr()); List<DataIdentifier> datsIncrementRead = rGetDataIdentifiers(fs.getIterablePredicate().getIncrementExpr()); rDeterminePartitioningCandidates(var, datsFromRead, C); rDeterminePartitioningCandidates(var, datsToRead, C); rDeterminePartitioningCandidates(var, datsIncrementRead, C); //for / parfor body rDeterminePartitioningCandidates(var,((ForStatement)s).getBody(), C); } else if( s instanceof WhileStatement ) { WhileStatement ws = (WhileStatement) s; //predicate List<DataIdentifier> datsRead = rGetDataIdentifiers(ws.getConditionalPredicate().getPredicate()); rDeterminePartitioningCandidates(var, datsRead, C); //while body rDeterminePartitioningCandidates(var,((WhileStatement)s).getBody(), C); } else if( s instanceof IfStatement ) { IfStatement is = (IfStatement) s; //predicate List<DataIdentifier> datsRead = rGetDataIdentifiers(is.getConditionalPredicate().getPredicate()); rDeterminePartitioningCandidates(var, datsRead, C); //if and else branch rDeterminePartitioningCandidates(var,((IfStatement)s).getIfBody(), C); rDeterminePartitioningCandidates(var,((IfStatement)s).getElseBody(), C); } else if( s instanceof FunctionStatement ) { rDeterminePartitioningCandidates(var,((FunctionStatement)s).getBody(), C); } else { List<DataIdentifier> datsRead = getDataIdentifiers(s, false); rDeterminePartitioningCandidates(var, datsRead, C); } } }
void function(String var, ArrayList<StatementBlock> asb, List<PartitionFormat> C) throws LanguageException { for(StatementBlock sb : asb ) for( Statement s : sb._statements ) { if( s instanceof ForStatement ) { ForStatement fs = (ForStatement) s; List<DataIdentifier> datsFromRead = rGetDataIdentifiers(fs.getIterablePredicate().getFromExpr()); List<DataIdentifier> datsToRead = rGetDataIdentifiers(fs.getIterablePredicate().getToExpr()); List<DataIdentifier> datsIncrementRead = rGetDataIdentifiers(fs.getIterablePredicate().getIncrementExpr()); rDeterminePartitioningCandidates(var, datsFromRead, C); rDeterminePartitioningCandidates(var, datsToRead, C); rDeterminePartitioningCandidates(var, datsIncrementRead, C); rDeterminePartitioningCandidates(var,((ForStatement)s).getBody(), C); } else if( s instanceof WhileStatement ) { WhileStatement ws = (WhileStatement) s; List<DataIdentifier> datsRead = rGetDataIdentifiers(ws.getConditionalPredicate().getPredicate()); rDeterminePartitioningCandidates(var, datsRead, C); rDeterminePartitioningCandidates(var,((WhileStatement)s).getBody(), C); } else if( s instanceof IfStatement ) { IfStatement is = (IfStatement) s; List<DataIdentifier> datsRead = rGetDataIdentifiers(is.getConditionalPredicate().getPredicate()); rDeterminePartitioningCandidates(var, datsRead, C); rDeterminePartitioningCandidates(var,((IfStatement)s).getIfBody(), C); rDeterminePartitioningCandidates(var,((IfStatement)s).getElseBody(), C); } else if( s instanceof FunctionStatement ) { rDeterminePartitioningCandidates(var,((FunctionStatement)s).getBody(), C); } else { List<DataIdentifier> datsRead = getDataIdentifiers(s, false); rDeterminePartitioningCandidates(var, datsRead, C); } } }
/** * This method recursively determines partitioning candidates for input variables. * Candidates are defined as index reads of non-local variables. * * @param var variables * @param asb list of statement blocks * @param C list of partition formats * @throws LanguageException if LanguageException occurs */
This method recursively determines partitioning candidates for input variables. Candidates are defined as index reads of non-local variables
rDeterminePartitioningCandidates
{ "repo_name": "dusenberrymw/systemml", "path": "src/main/java/org/apache/sysml/parser/ParForStatementBlock.java", "license": "apache-2.0", "size": 70752 }
[ "java.util.ArrayList", "java.util.List", "org.apache.sysml.runtime.controlprogram.ParForProgramBlock" ]
import java.util.ArrayList; import java.util.List; import org.apache.sysml.runtime.controlprogram.ParForProgramBlock;
import java.util.*; import org.apache.sysml.runtime.controlprogram.*;
[ "java.util", "org.apache.sysml" ]
java.util; org.apache.sysml;
1,997,609
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String queueName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (queueName == null) { throw new IllegalArgumentException("Parameter queueName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); }
Observable<ServiceResponse<Void>> function(String resourceGroupName, String accountName, String queueName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (queueName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); }
/** * Deletes the queue with the specified queue name, under the specified account if it exists. * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param queueName A queue name must be unique within a storage account and must be between 3 and 63 characters.The name must comprise of lowercase alphanumeric and dash(-) characters only, it should begin and end with an alphanumeric character and it cannot have two consecutive dash(-) characters. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */
Deletes the queue with the specified queue name, under the specified account if it exists
deleteWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/storage/mgmt-v2019_06_01/src/main/java/com/microsoft/azure/management/storage/v2019_06_01/implementation/QueuesInner.java", "license": "mit", "size": 71861 }
[ "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.rest.ServiceResponse;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,138,231
public synchronized void log(@NonNull UserLogItem uli) { while(m_itemList.size() > 400) m_itemList.removeFirst(); m_itemList.addLast(uli); }
synchronized void function(@NonNull UserLogItem uli) { while(m_itemList.size() > 400) m_itemList.removeFirst(); m_itemList.addLast(uli); }
/** * Add a log item to the round-robin list of per user log entries. */
Add a log item to the round-robin list of per user log entries
log
{ "repo_name": "fjalvingh/domui", "path": "to.etc.domui/src/main/java/to/etc/domui/state/AppSession.java", "license": "lgpl-2.1", "size": 16734 }
[ "org.eclipse.jdt.annotation.NonNull" ]
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
1,195,977
public Properties getProperties();
Properties function();
/** * Returns a properties object for the associated extension implementation. * The properties file replaces any schema definitions for extension point * implementations. This is useful for environments which do not support * eclipse extension point and their schemas and it helps in getting the * attributes of the extensions. * * @return A Properties object for the associated extension point * implementation. */
Returns a properties object for the associated extension implementation. The properties file replaces any schema definitions for extension point implementations. This is useful for environments which do not support eclipse extension point and their schemas and it helps in getting the attributes of the extensions
getProperties
{ "repo_name": "OpenNTF/JavascriptAggregator", "path": "jaggr-core/src/main/java/com/ibm/jaggr/core/IPlatformExtensionServices.java", "license": "apache-2.0", "size": 1795 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
323,567
protected Class<? extends Enumerable> getType(JsonParser jp) throws IOException { Class<? extends Enumerable> type = javaType == null ? null : asEnumerableSubtype(javaType); if (type == null) { final Object typeId = Compatibility.getTypeId(jp); type = asEnumerableSubtype(typeId instanceof JavaType ? ((JavaType) typeId).getRawClass() : typeId); } return type == null || Enumerable.class.equals(type) ? UnknownEnumerable.class : type; }
Class<? extends Enumerable> function(JsonParser jp) throws IOException { Class<? extends Enumerable> type = javaType == null ? null : asEnumerableSubtype(javaType); if (type == null) { final Object typeId = Compatibility.getTypeId(jp); type = asEnumerableSubtype(typeId instanceof JavaType ? ((JavaType) typeId).getRawClass() : typeId); } return type == null Enumerable.class.equals(type) ? UnknownEnumerable.class : type; }
/** * Determines specific Enumerable subtype when known. * If no subtype can be determined, the {@link UnknownEnumerable} type is returned. * At least the received String value can be represtend by this type. * * @param jp Jackson parser to obtain the type from. * @return The actual Enumerable type being deserialized or {@code UnknownEnumerable}. * @throws IOException when reading the parser threw I/O exceptions. */
Determines specific Enumerable subtype when known. If no subtype can be determined, the <code>UnknownEnumerable</code> type is returned. At least the received String value can be represtend by this type
getType
{ "repo_name": "talsma-ict/enumerables", "path": "enumerables-jackson2/src/main/java/nl/talsmasoftware/enumerables/jackson2/EnumerableDeserializer.java", "license": "apache-2.0", "size": 6209 }
[ "com.fasterxml.jackson.core.JsonParser", "com.fasterxml.jackson.databind.JavaType", "java.io.IOException", "nl.talsmasoftware.enumerables.Enumerable" ]
import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.JavaType; import java.io.IOException; import nl.talsmasoftware.enumerables.Enumerable;
import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import java.io.*; import nl.talsmasoftware.enumerables.*;
[ "com.fasterxml.jackson", "java.io", "nl.talsmasoftware.enumerables" ]
com.fasterxml.jackson; java.io; nl.talsmasoftware.enumerables;
990,270
public static void execute(String zipFileName, String directory, String db, boolean quiet) throws SQLException { try { new Backup().process(zipFileName, directory, db, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
static void function(String zipFileName, String directory, String db, boolean quiet) throws SQLException { try { new Backup().process(zipFileName, directory, db, quiet); } catch (Exception e) { throw DbException.toSQLException(e); } }
/** * Backs up database files. * * @param zipFileName the name of the target backup file (including path) * @param directory the source directory name * @param db the source database name (null if there is only one database, and * and empty string to backup all files in this directory) * @param quiet don't print progress information */
Backs up database files
execute
{ "repo_name": "ferquies/2dam", "path": "AD/Tema 2/h2/src/main/org/h2/tools/Backup.java", "license": "gpl-3.0", "size": 6421 }
[ "java.sql.SQLException", "org.h2.message.DbException" ]
import java.sql.SQLException; import org.h2.message.DbException;
import java.sql.*; import org.h2.message.*;
[ "java.sql", "org.h2.message" ]
java.sql; org.h2.message;
1,618,108
private void createProjectDatastructs(IProject project) { //IResource resource = ((FileEditorInput)editor.getEditorInput()).getFile(); IResource[] files = TexlipseProperties.getAllProjectFiles(project); if (files != null) { IFile mainFile = TexlipseProperties.getProjectSourceFile(project); for (int i = 0; i < files.length; i++) { //IPath path = files[i].getFullPath(); String ext = files[i].getFileExtension(); // here are the file types we want to parse if ("tex".equals(ext) || "ltx".equals(ext) || "sty".equals(ext)) { try { String input = TexlipseProperties.getFileContents(files[i]); LatexRefExtractingParser lrep = new LatexRefExtractingParser(); lrep.parse(input); if (lrep.isFatalErrors()) { MarkerHandler marker = MarkerHandler.getInstance(); marker.addFatalError(editor, "The file " + files[i].getFullPath() + " contains fatal errors, parsing aborted."); continue; } List<ReferenceEntry> labels = lrep.getLabels(); if (labels.size() > 0) { labelContainer.addRefSource(files[i].getProjectRelativePath().toString(), labels); } List<TexCommandEntry> commands = lrep.getCommands(); if (commands.size() > 0) { commandContainer.addRefSource(files[i].getProjectRelativePath().toString(), commands); } //Only update Preamble, Bibstyle if main Document if (files[i].equals(mainFile)) { String[] bibs = lrep.getBibs(); boolean biblatexMode = lrep.isBiblatexMode(); String biblatexBackend = lrep.getBiblatexBackend(); this.updateBiblatex(project, biblatexMode, biblatexBackend, true); this.updateBibs(bibs, biblatexMode, files[i]); String preamble = lrep.getPreamble(); if (preamble != null) { TexlipseProperties.setSessionProperty(project, TexlipseProperties.PREAMBLE_PROPERTY, preamble); } String bibstyle = lrep.getBibstyle(); if (bibstyle != null) TexlipseProperties.setSessionProperty(project, TexlipseProperties.BIBSTYLE_PROPERTY, bibstyle); } } catch (IOException ioe) { TexlipsePlugin.log("Unable to open file " + files[i].getFullPath() + " for parsing", ioe); } } } // save time by doing this last labelContainer.organize(); commandContainer.organize(); } }
void function(IProject project) { IResource[] files = TexlipseProperties.getAllProjectFiles(project); if (files != null) { IFile mainFile = TexlipseProperties.getProjectSourceFile(project); for (int i = 0; i < files.length; i++) { String ext = files[i].getFileExtension(); if ("tex".equals(ext) "ltx".equals(ext) "sty".equals(ext)) { try { String input = TexlipseProperties.getFileContents(files[i]); LatexRefExtractingParser lrep = new LatexRefExtractingParser(); lrep.parse(input); if (lrep.isFatalErrors()) { MarkerHandler marker = MarkerHandler.getInstance(); marker.addFatalError(editor, STR + files[i].getFullPath() + STR); continue; } List<ReferenceEntry> labels = lrep.getLabels(); if (labels.size() > 0) { labelContainer.addRefSource(files[i].getProjectRelativePath().toString(), labels); } List<TexCommandEntry> commands = lrep.getCommands(); if (commands.size() > 0) { commandContainer.addRefSource(files[i].getProjectRelativePath().toString(), commands); } if (files[i].equals(mainFile)) { String[] bibs = lrep.getBibs(); boolean biblatexMode = lrep.isBiblatexMode(); String biblatexBackend = lrep.getBiblatexBackend(); this.updateBiblatex(project, biblatexMode, biblatexBackend, true); this.updateBibs(bibs, biblatexMode, files[i]); String preamble = lrep.getPreamble(); if (preamble != null) { TexlipseProperties.setSessionProperty(project, TexlipseProperties.PREAMBLE_PROPERTY, preamble); } String bibstyle = lrep.getBibstyle(); if (bibstyle != null) TexlipseProperties.setSessionProperty(project, TexlipseProperties.BIBSTYLE_PROPERTY, bibstyle); } } catch (IOException ioe) { TexlipsePlugin.log(STR + files[i].getFullPath() + STR, ioe); } } } labelContainer.organize(); commandContainer.organize(); } }
/** * Creates all the project data structures. These include the reference * completions (BibTeX and label), command completions, the preamble, * the BibTeX style. * * @param project The current project */
Creates all the project data structures. These include the reference completions (BibTeX and label), command completions, the preamble, the BibTeX style
createProjectDatastructs
{ "repo_name": "rondiplomatico/texlipse", "path": "source/net/sourceforge/texlipse/model/TexDocumentModel.java", "license": "epl-1.0", "size": 40300 }
[ "java.io.IOException", "java.util.List", "net.sourceforge.texlipse.TexlipsePlugin", "net.sourceforge.texlipse.properties.TexlipseProperties", "net.sourceforge.texlipse.texparser.LatexRefExtractingParser", "org.eclipse.core.resources.IFile", "org.eclipse.core.resources.IProject", "org.eclipse.core.resources.IResource" ]
import java.io.IOException; import java.util.List; import net.sourceforge.texlipse.TexlipsePlugin; import net.sourceforge.texlipse.properties.TexlipseProperties; import net.sourceforge.texlipse.texparser.LatexRefExtractingParser; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource;
import java.io.*; import java.util.*; import net.sourceforge.texlipse.*; import net.sourceforge.texlipse.properties.*; import net.sourceforge.texlipse.texparser.*; import org.eclipse.core.resources.*;
[ "java.io", "java.util", "net.sourceforge.texlipse", "org.eclipse.core" ]
java.io; java.util; net.sourceforge.texlipse; org.eclipse.core;
2,640,306
public void validateAuthorizedExts(final AttachmentOptionsForm form, final Errors errors) { String[] authorizedList = form.getAuthorizedExts().split(";"); List<String> displayed = new ArrayList<String>(); boolean valid = true; if (authorizedList != null) { for (String ext : authorizedList) { if (StringUtils.isNotEmpty(ext)) { if (!StringUtils.isAlphanumeric(ext)) { valid = false; } displayed.add(ext); } } } if (!valid) { form.setAuthorizedList(displayed); errors.rejectValue("authorizedExts", "ATTACHMENT_EXT_WRONG_CHAR", "Files Extensions must only contain alpha numeric characters"); } }
void function(final AttachmentOptionsForm form, final Errors errors) { String[] authorizedList = form.getAuthorizedExts().split(";"); List<String> displayed = new ArrayList<String>(); boolean valid = true; if (authorizedList != null) { for (String ext : authorizedList) { if (StringUtils.isNotEmpty(ext)) { if (!StringUtils.isAlphanumeric(ext)) { valid = false; } displayed.add(ext); } } } if (!valid) { form.setAuthorizedList(displayed); errors.rejectValue(STR, STR, STR); } }
/** * Validate the authorized extensions. * @param form * @param errors */
Validate the authorized extensions
validateAuthorizedExts
{ "repo_name": "GIP-RECIA/esup-news", "path": "src/org/cmis/portlets/news/web/validator/AttachmentOptionsValidator.java", "license": "gpl-3.0", "size": 4046 }
[ "java.util.ArrayList", "java.util.List", "org.apache.commons.lang.StringUtils", "org.cmis.portlets.news.web.AttachmentOptionsForm", "org.springframework.validation.Errors" ]
import java.util.ArrayList; import java.util.List; import org.apache.commons.lang.StringUtils; import org.cmis.portlets.news.web.AttachmentOptionsForm; import org.springframework.validation.Errors;
import java.util.*; import org.apache.commons.lang.*; import org.cmis.portlets.news.web.*; import org.springframework.validation.*;
[ "java.util", "org.apache.commons", "org.cmis.portlets", "org.springframework.validation" ]
java.util; org.apache.commons; org.cmis.portlets; org.springframework.validation;
1,181,227
Map<String, ValueStatistic<?>> getKnownStatistics(); /** * Reset the values for this tier. However, note that {@code mapping, allocatedMemory, occupiedMemory}
Map<String, ValueStatistic<?>> getKnownStatistics(); /** * Reset the values for this tier. However, note that {@code mapping, allocatedMemory, occupiedMemory}
/** * List of statistics tracked on this cache * * @return a map of statistics per name */
List of statistics tracked on this cache
getKnownStatistics
{ "repo_name": "cschanck/ehcache3", "path": "core/src/main/java/org/ehcache/core/statistics/TierStatistics.java", "license": "apache-2.0", "size": 2673 }
[ "java.util.Map", "org.terracotta.statistics.ValueStatistic" ]
import java.util.Map; import org.terracotta.statistics.ValueStatistic;
import java.util.*; import org.terracotta.statistics.*;
[ "java.util", "org.terracotta.statistics" ]
java.util; org.terracotta.statistics;
2,698,463
public static SABRInterestRateParameters createSABR2() { final InterpolatedDoublesSurface alphaSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.05, 0.06, 0.07, 0.04, 0.05, 0.06, 0.07, 0.03, 0.04, 0.05, 0.06, 0.07, 0.03, 0.04, 0.05, 0.06, 0.03, 0.04, 0.05, 0.06, 0.04, 0.05, 0.06}, INTERPOLATOR_2D); final InterpolatedDoublesSurface betaSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5}, INTERPOLATOR_2D); final InterpolatedDoublesSurface rhoSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {-0.25, -0.25, -0.25, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.10, 0.10, 0.10}, INTERPOLATOR_2D); final InterpolatedDoublesSurface nuSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.50, 0.50, 0.50, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35}, INTERPOLATOR_2D); return new SABRInterestRateParameters(alphaSurface, betaSurface, rhoSurface, nuSurface, DAY_COUNT, new SABRHaganVolatilityFunction()); }
static SABRInterestRateParameters function() { final InterpolatedDoublesSurface alphaSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.05, 0.06, 0.07, 0.04, 0.05, 0.06, 0.07, 0.03, 0.04, 0.05, 0.06, 0.07, 0.03, 0.04, 0.05, 0.06, 0.03, 0.04, 0.05, 0.06, 0.04, 0.05, 0.06}, INTERPOLATOR_2D); final InterpolatedDoublesSurface betaSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5}, INTERPOLATOR_2D); final InterpolatedDoublesSurface rhoSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {-0.25, -0.25, -0.25, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, -0.10, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.10, 0.10, 0.10}, INTERPOLATOR_2D); final InterpolatedDoublesSurface nuSurface = InterpolatedDoublesSurface.from(new double[] {0.25, 0.25, 0.25, 0.50, 0.50, 0.50, 0.50, 1.0, 1.0, 1.0, 1.0, 1.0, 5.0, 5.0, 5.0, 5.0, 10.0, 10.0, 10.0, 10.0, 20.0, 20.0, 20.0}, new double[] {1.0, 2.0, 5.0, 1.0, 2.0, 5.0, 10.0, 1.0, 2.0, 5.0, 10.0, 20, 2.0, 5.0, 10.0, 20.0, 2.0, 5.0, 10.0, 20.0, 5.0, 10.0, 20.0}, new double[] {0.50, 0.50, 0.50, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.40, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35, 0.35}, INTERPOLATOR_2D); return new SABRInterestRateParameters(alphaSurface, betaSurface, rhoSurface, nuSurface, DAY_COUNT, new SABRHaganVolatilityFunction()); }
/** * Create a set of SABR parameter surface (linearly interpolated and flat extrapolated) with a given SABR function. * The expirations and tenors are not on a full grid (short expiries with shorter tenors). * @return The SABR parameters parameters. */
Create a set of SABR parameter surface (linearly interpolated and flat extrapolated) with a given SABR function. The expirations and tenors are not on a full grid (short expiries with shorter tenors)
createSABR2
{ "repo_name": "DevStreet/FinanceAnalytics", "path": "projects/OG-Analytics/src/test/java/com/opengamma/analytics/financial/interestrate/TestsDataSetsSABR.java", "license": "apache-2.0", "size": 31233 }
[ "com.opengamma.analytics.financial.model.option.definition.SABRInterestRateParameters", "com.opengamma.analytics.financial.model.volatility.smile.function.SABRHaganVolatilityFunction", "com.opengamma.analytics.math.surface.InterpolatedDoublesSurface" ]
import com.opengamma.analytics.financial.model.option.definition.SABRInterestRateParameters; import com.opengamma.analytics.financial.model.volatility.smile.function.SABRHaganVolatilityFunction; import com.opengamma.analytics.math.surface.InterpolatedDoublesSurface;
import com.opengamma.analytics.financial.model.option.definition.*; import com.opengamma.analytics.financial.model.volatility.smile.function.*; import com.opengamma.analytics.math.surface.*;
[ "com.opengamma.analytics" ]
com.opengamma.analytics;
2,761,176
public final void testNewSpecificSameAsBeginInOldDef() throws MarshalException, ValidationException, IOException { String amiConfigXml = "<?xml version=\"1.0\"?>\n" + "<wmi-config retry=\"3\" timeout=\"800\"\n" + " password=\"password\">\n" + " <definition>\n" + " <range begin=\"192.168.0.6\" end=\"192.168.0.12\"/>\n" + " <specific>192.168.0.6</specific>\n" + " </definition>\n" + "\n" + "</wmi-config>\n" + ""; WmiPeerFactory factory = new WmiPeerFactory(new ByteArrayInputStream(amiConfigXml.getBytes("UTF-8"))); assertEquals(1, factory.getConfig().getDefinitionCount()); assertEquals(1, factory.getConfig().getDefinition(0).getSpecificCount()); assertEquals(1, factory.getConfig().getDefinition(0).getRangeCount()); WmiPeerFactory.optimize(); assertEquals(1, factory.getConfig().getDefinitionCount()); assertEquals(0, factory.getConfig().getDefinition(0).getSpecificCount()); assertEquals(1, factory.getConfig().getDefinition(0).getRangeCount()); assertEquals("192.168.0.6", factory.getConfig().getDefinition(0).getRange(0).getBegin()); assertEquals("192.168.0.12", factory.getConfig().getDefinition(0).getRange(0).getEnd()); }
final void function() throws MarshalException, ValidationException, IOException { String amiConfigXml = STR1.0\"?>\n" + STR3\STR800\"\n" + STRpassword\">\n" + STR + STR192.168.0.6\STR192.168.0.12\"/>\n" + STR + STR + "\n" + STR + STRUTF-8STR192.168.0.6STR192.168.0.12", factory.getConfig().getDefinition(0).getRange(0).getEnd()); }
/** * This tests the addition of a new specific definition that is the same address as the beginning of * a range in a current definition. * * @throws MarshalException * @throws ValidationException * @throws IOException */
This tests the addition of a new specific definition that is the same address as the beginning of a range in a current definition
testNewSpecificSameAsBeginInOldDef
{ "repo_name": "opennms-forge/poc-nms-core", "path": "opennms-config/src/test/java/org/opennms/netmgt/config/WmiPeerFactoryTest.java", "license": "gpl-2.0", "size": 21892 }
[ "java.io.IOException", "org.exolab.castor.xml.MarshalException", "org.exolab.castor.xml.ValidationException" ]
import java.io.IOException; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.ValidationException;
import java.io.*; import org.exolab.castor.xml.*;
[ "java.io", "org.exolab.castor" ]
java.io; org.exolab.castor;
1,198,029
public Path getPackageDirectory() { return packageDirectory; }
Path function() { return packageDirectory; }
/** * Returns the directory containing the package's BUILD file. */
Returns the directory containing the package's BUILD file
getPackageDirectory
{ "repo_name": "damienmg/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/Package.java", "license": "apache-2.0", "size": 54682 }
[ "com.google.devtools.build.lib.vfs.Path" ]
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.*;
[ "com.google.devtools" ]
com.google.devtools;
2,241,551
Stream<Json> getMessagesUntilEnd() {
Stream<Json> getMessagesUntilEnd() {
/** * Gets all messages from the server until a special "end" message * @return a stream of messages */
Gets all messages from the server until a special "end" message
getMessagesUntilEnd
{ "repo_name": "burukuru/grakn", "path": "grakn-graql-shell/src/main/java/ai/grakn/graql/JsonSession.java", "license": "gpl-3.0", "size": 5654 }
[ "java.util.stream.Stream" ]
import java.util.stream.Stream;
import java.util.stream.*;
[ "java.util" ]
java.util;
2,076,161
private CustomSpinnerView.SpinnerListener<BaseSpinner> getSpinnerListener() { return this; }
CustomSpinnerView.SpinnerListener<BaseSpinner> function() { return this; }
/** * Enable Spinner selection listener for CustomTextViews* */
Enable Spinner selection listener for CustomTextViews
getSpinnerListener
{ "repo_name": "riteshakya037/CustomFormViews", "path": "customfieldviews/src/main/java/com/ritesh/customfieldviews/validators/ValidityClassBase.java", "license": "mit", "size": 5192 }
[ "com.ritesh.customfieldviews.CustomSpinnerView", "com.ritesh.customfieldviews.models.BaseSpinner" ]
import com.ritesh.customfieldviews.CustomSpinnerView; import com.ritesh.customfieldviews.models.BaseSpinner;
import com.ritesh.customfieldviews.*; import com.ritesh.customfieldviews.models.*;
[ "com.ritesh.customfieldviews" ]
com.ritesh.customfieldviews;
1,622,537
public Object parseAttributeValue( String value ) throws Exception { if ( Const.isEmpty( value ) || value.length() < 3 ) { return null; } String valueString = value.substring( 2 ); char type = value.charAt( 0 ); switch ( type ) { case 'S': return valueString; case 'T': return new SimpleTimestampFormat( ValueMetaBase.DEFAULT_TIMESTAMP_FORMAT_MASK ).parse( valueString ); case 'D': return new SimpleDateFormat( ValueMetaBase.DEFAULT_DATE_FORMAT_MASK ).parse( valueString ); case 'N': return Double.valueOf( valueString ); case 'I': return Long.valueOf( valueString ); case 'B': return "true".equalsIgnoreCase( valueString ) || "y".equalsIgnoreCase( valueString ); default: throw new KettleException( "Unknown data type : " + type ); } }
Object function( String value ) throws Exception { if ( Const.isEmpty( value ) value.length() < 3 ) { return null; } String valueString = value.substring( 2 ); char type = value.charAt( 0 ); switch ( type ) { case 'S': return valueString; case 'T': return new SimpleTimestampFormat( ValueMetaBase.DEFAULT_TIMESTAMP_FORMAT_MASK ).parse( valueString ); case 'D': return new SimpleDateFormat( ValueMetaBase.DEFAULT_DATE_FORMAT_MASK ).parse( valueString ); case 'N': return Double.valueOf( valueString ); case 'I': return Long.valueOf( valueString ); case 'B': return "true".equalsIgnoreCase( valueString ) "y".equalsIgnoreCase( valueString ); default: throw new KettleException( STR + type ); } }
/** * supported types: * <p/> * <pre> * S : String (java.lang.String) * D : Date (java.util.Date) * N : Number (Double) * I : Integer (Long) * B : Boolean (Boolean) * * Examples * S:Pentaho Data Integration * D:2013/08/23 17:25:00 * N:1039348.9347 * I:12345678 * B:true * </pre> * * @param value * @return The native value * @throws Exception in case of conversion trouble */
supported types: <code> S : String (java.lang.String) D : Date (java.util.Date) N : Number (Double) I : Integer (Long) B : Boolean (Boolean) Examples </code>
parseAttributeValue
{ "repo_name": "sajeetharan/pentaho-kettle", "path": "engine/src/org/pentaho/di/repository/kdr/delegates/KettleDatabaseRepositoryMetaStoreDelegate.java", "license": "apache-2.0", "size": 22429 }
[ "java.text.SimpleDateFormat", "org.pentaho.di.core.Const", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.core.row.value.ValueMetaBase", "org.pentaho.di.core.row.value.timestamp.SimpleTimestampFormat" ]
import java.text.SimpleDateFormat; import org.pentaho.di.core.Const; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.core.row.value.ValueMetaBase; import org.pentaho.di.core.row.value.timestamp.SimpleTimestampFormat;
import java.text.*; import org.pentaho.di.core.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.value.*; import org.pentaho.di.core.row.value.timestamp.*;
[ "java.text", "org.pentaho.di" ]
java.text; org.pentaho.di;
366,244
private static Collection<Target> getTargets(Map<String, Target> targetMap) { return Collections.unmodifiableCollection(targetMap.values()); }
static Collection<Target> function(Map<String, Target> targetMap) { return Collections.unmodifiableCollection(targetMap.values()); }
/** * Common getTargets implementation, accessible by both {@link Package} and * {@link Package.Builder}. */
Common getTargets implementation, accessible by both <code>Package</code> and <code>Package.Builder</code>
getTargets
{ "repo_name": "kamalmarhubi/bazel", "path": "src/main/java/com/google/devtools/build/lib/packages/Package.java", "license": "apache-2.0", "size": 50763 }
[ "java.util.Collection", "java.util.Collections", "java.util.Map" ]
import java.util.Collection; import java.util.Collections; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,287,571
public void doCallSiteTargetSet() { if (!cache) { if (LOG_ENABLED) LOG.info("call site stays uncached"); } else { callSite.setTarget(handle); if (LOG_ENABLED) LOG.info("call site target set, preparing outside invocation"); } }
void function() { if (!cache) { if (LOG_ENABLED) LOG.info(STR); } else { callSite.setTarget(handle); if (LOG_ENABLED) LOG.info(STR); } }
/** * do the actual call site target set, if the call is supposed to be cached */
do the actual call site target set, if the call is supposed to be cached
doCallSiteTargetSet
{ "repo_name": "jwagenleitner/incubator-groovy", "path": "src/main/java/org/codehaus/groovy/vmplugin/v7/Selector.java", "license": "apache-2.0", "size": 50364 }
[ "org.codehaus.groovy.vmplugin.v7.IndyInterface" ]
import org.codehaus.groovy.vmplugin.v7.IndyInterface;
import org.codehaus.groovy.vmplugin.v7.*;
[ "org.codehaus.groovy" ]
org.codehaus.groovy;
1,574,928