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
@Test public void testSlaves() throws Exception { SlaveServer slave = createSlaveServer( "" ); repository.save( slave, VERSION_COMMENT_V1, null ); assertNotNull( slave.getObjectId() ); ObjectRevision version = slave.getObjectRevision(); assertNotNull( version ); assertTrue( hasVersionWithComment( slave, VERSION_COMMENT_V1 ) ); // setting repository directory on slave is not supported; use null parent directory assertTrue( repository.exists( EXP_SLAVE_NAME, null, RepositoryObjectType.SLAVE_SERVER ) ); SlaveServer fetchedSlave = repository.loadSlaveServer( slave.getObjectId(), null ); assertEquals( EXP_SLAVE_NAME, fetchedSlave.getName() ); assertEquals( EXP_SLAVE_HOSTNAME, fetchedSlave.getHostname() ); assertEquals( EXP_SLAVE_PORT, fetchedSlave.getPort() ); assertEquals( EXP_SLAVE_USERNAME, fetchedSlave.getUsername() ); assertEquals( EXP_SLAVE_PASSWORD, fetchedSlave.getPassword() ); assertEquals( EXP_SLAVE_PROXY_HOSTNAME, fetchedSlave.getProxyHostname() ); assertEquals( EXP_SLAVE_PROXY_PORT, fetchedSlave.getProxyPort() ); assertEquals( EXP_SLAVE_NON_PROXY_HOSTS, fetchedSlave.getNonProxyHosts() ); assertEquals( EXP_SLAVE_MASTER, fetchedSlave.isMaster() ); slave.setHostname( EXP_SLAVE_HOSTNAME_V2 ); repository.save( slave, VERSION_COMMENT_V2, null ); assertEquals( VERSION_COMMENT_V2, slave.getObjectRevision().getComment() ); fetchedSlave = repository.loadSlaveServer( slave.getObjectId(), null ); assertEquals( EXP_SLAVE_HOSTNAME_V2, fetchedSlave.getHostname() ); fetchedSlave = repository.loadSlaveServer( slave.getObjectId(), VERSION_LABEL_V1 ); assertEquals( EXP_SLAVE_HOSTNAME, fetchedSlave.getHostname() ); assertEquals( slave.getObjectId(), repository.getSlaveID( EXP_SLAVE_NAME ) ); assertEquals( 1, repository.getSlaveIDs( false ).length ); assertEquals( 1, repository.getSlaveIDs( true ).length ); assertEquals( slave.getObjectId(), repository.getSlaveIDs( false )[0] ); assertEquals( 1, repository.getSlaveNames( false ).length ); assertEquals( 1, repository.getSlaveNames( true ).length ); assertEquals( EXP_SLAVE_NAME, repository.getSlaveNames( false )[0] ); assertEquals( 1, repository.getSlaveServers().size() ); assertEquals( EXP_SLAVE_NAME, repository.getSlaveServers().get( 0 ).getName() ); repository.deleteSlave( slave.getObjectId() ); assertFalse( repository.exists( EXP_SLAVE_NAME, null, RepositoryObjectType.SLAVE_SERVER ) ); assertEquals( 0, repository.getSlaveIDs( false ).length ); // shared object deletion is permanent by default assertEquals( 0, repository.getSlaveIDs( true ).length ); assertEquals( 0, repository.getSlaveNames( false ).length ); // shared object deletion is permanent by default assertEquals( 0, repository.getSlaveNames( true ).length ); assertEquals( 0, repository.getSlaveServers().size() ); }
void function() throws Exception { SlaveServer slave = createSlaveServer( "" ); repository.save( slave, VERSION_COMMENT_V1, null ); assertNotNull( slave.getObjectId() ); ObjectRevision version = slave.getObjectRevision(); assertNotNull( version ); assertTrue( hasVersionWithComment( slave, VERSION_COMMENT_V1 ) ); assertTrue( repository.exists( EXP_SLAVE_NAME, null, RepositoryObjectType.SLAVE_SERVER ) ); SlaveServer fetchedSlave = repository.loadSlaveServer( slave.getObjectId(), null ); assertEquals( EXP_SLAVE_NAME, fetchedSlave.getName() ); assertEquals( EXP_SLAVE_HOSTNAME, fetchedSlave.getHostname() ); assertEquals( EXP_SLAVE_PORT, fetchedSlave.getPort() ); assertEquals( EXP_SLAVE_USERNAME, fetchedSlave.getUsername() ); assertEquals( EXP_SLAVE_PASSWORD, fetchedSlave.getPassword() ); assertEquals( EXP_SLAVE_PROXY_HOSTNAME, fetchedSlave.getProxyHostname() ); assertEquals( EXP_SLAVE_PROXY_PORT, fetchedSlave.getProxyPort() ); assertEquals( EXP_SLAVE_NON_PROXY_HOSTS, fetchedSlave.getNonProxyHosts() ); assertEquals( EXP_SLAVE_MASTER, fetchedSlave.isMaster() ); slave.setHostname( EXP_SLAVE_HOSTNAME_V2 ); repository.save( slave, VERSION_COMMENT_V2, null ); assertEquals( VERSION_COMMENT_V2, slave.getObjectRevision().getComment() ); fetchedSlave = repository.loadSlaveServer( slave.getObjectId(), null ); assertEquals( EXP_SLAVE_HOSTNAME_V2, fetchedSlave.getHostname() ); fetchedSlave = repository.loadSlaveServer( slave.getObjectId(), VERSION_LABEL_V1 ); assertEquals( EXP_SLAVE_HOSTNAME, fetchedSlave.getHostname() ); assertEquals( slave.getObjectId(), repository.getSlaveID( EXP_SLAVE_NAME ) ); assertEquals( 1, repository.getSlaveIDs( false ).length ); assertEquals( 1, repository.getSlaveIDs( true ).length ); assertEquals( slave.getObjectId(), repository.getSlaveIDs( false )[0] ); assertEquals( 1, repository.getSlaveNames( false ).length ); assertEquals( 1, repository.getSlaveNames( true ).length ); assertEquals( EXP_SLAVE_NAME, repository.getSlaveNames( false )[0] ); assertEquals( 1, repository.getSlaveServers().size() ); assertEquals( EXP_SLAVE_NAME, repository.getSlaveServers().get( 0 ).getName() ); repository.deleteSlave( slave.getObjectId() ); assertFalse( repository.exists( EXP_SLAVE_NAME, null, RepositoryObjectType.SLAVE_SERVER ) ); assertEquals( 0, repository.getSlaveIDs( false ).length ); assertEquals( 0, repository.getSlaveIDs( true ).length ); assertEquals( 0, repository.getSlaveNames( false ).length ); assertEquals( 0, repository.getSlaveNames( true ).length ); assertEquals( 0, repository.getSlaveServers().size() ); }
/** * save(slave) loadSlaveServer() exists() deleteSlave() getSlaveID() getSlaveIDs() getSlaveNames() getSlaveServers() */
save(slave) loadSlaveServer() exists() deleteSlave() getSlaveID() getSlaveIDs() getSlaveNames() getSlaveServers()
testSlaves
{ "repo_name": "wseyler/pentaho-kettle", "path": "plugins/pur/core/src/test/java/org/pentaho/di/repository/RepositoryTestBase.java", "license": "apache-2.0", "size": 85327 }
[ "org.junit.Assert", "org.pentaho.di.cluster.SlaveServer" ]
import org.junit.Assert; import org.pentaho.di.cluster.SlaveServer;
import org.junit.*; import org.pentaho.di.cluster.*;
[ "org.junit", "org.pentaho.di" ]
org.junit; org.pentaho.di;
1,114,599
public ColorModeCallback getColorModeCallback() { return colorModeCallback; }
ColorModeCallback function() { return colorModeCallback; }
/** * Returns the color mode callback, if set, otherwise <code>null</code>. * * @return the color mode callback, if set, otherwise <code>null</code>. */
Returns the color mode callback, if set, otherwise <code>null</code>
getColorModeCallback
{ "repo_name": "pepstock-org/Charba", "path": "src/org/pepstock/charba/client/sankey/SankeyDataset.java", "license": "apache-2.0", "size": 34482 }
[ "org.pepstock.charba.client.sankey.callbacks.ColorModeCallback" ]
import org.pepstock.charba.client.sankey.callbacks.ColorModeCallback;
import org.pepstock.charba.client.sankey.callbacks.*;
[ "org.pepstock.charba" ]
org.pepstock.charba;
1,529,756
public void test4() { Pattern pat = Pattern.compile("(\\sLog\\b)"); String s = "abcd Log ="; Matcher m = pat.matcher(s); assertTrue(m.find()); String r = m.replaceAll(" Logger"); assertEquals("abcd Logger =", r); String s2 = "Logabcd "; m = pat.matcher(s2); assertFalse(m.find()); String s3 = "abcdLogabcd "; m = pat.matcher(s3); assertFalse(m.find()); String s4 = "abcdLog"; m = pat.matcher(s4); assertFalse(m.find()); String s5 = "Log myLog"; m = pat.matcher(s5); assertFalse(m.find()); Pattern pat2 = Pattern.compile("^Log\\b"); Matcher m2 = pat2.matcher(s5); assertTrue(m2.find()); r = m2.replaceAll("Logger"); assertEquals("Logger myLog", r); }
void function() { Pattern pat = Pattern.compile(STR); String s = STR; Matcher m = pat.matcher(s); assertTrue(m.find()); String r = m.replaceAll(STR); assertEquals(STR, r); String s2 = STR; m = pat.matcher(s2); assertFalse(m.find()); String s3 = STR; m = pat.matcher(s3); assertFalse(m.find()); String s4 = STR; m = pat.matcher(s4); assertFalse(m.find()); String s5 = STR; m = pat.matcher(s5); assertFalse(m.find()); Pattern pat2 = Pattern.compile(STR); Matcher m2 = pat2.matcher(s5); assertTrue(m2.find()); r = m2.replaceAll(STR); assertEquals(STR, r); }
/** * In this test we try to replace keyword Log without influence on String * containg Log We see that we have to use two differents Patterns */
In this test we try to replace keyword Log without influence on String containg Log We see that we have to use two differents Patterns
test4
{ "repo_name": "geekboxzone/mmallow_external_slf4j", "path": "slf4j-migrator/src/test/java/org/slf4j/migrator/AternativeApproach.java", "license": "mit", "size": 5322 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,119,742
public boolean isProxy() { return this.challengeState != null && this.challengeState == ChallengeState.PROXY; }
boolean function() { return this.challengeState != null && this.challengeState == ChallengeState.PROXY; }
/** * Returns <code>true</code> if authenticating against a proxy, <code>false</code> * otherwise. */
Returns <code>true</code> if authenticating against a proxy, <code>false</code> otherwise
isProxy
{ "repo_name": "mcomella/FirefoxAccounts-android", "path": "thirdparty/src/main/java/ch/boye/httpclientandroidlib/impl/auth/AuthSchemeBase.java", "license": "mpl-2.0", "size": 6116 }
[ "ch.boye.httpclientandroidlib.auth.ChallengeState" ]
import ch.boye.httpclientandroidlib.auth.ChallengeState;
import ch.boye.httpclientandroidlib.auth.*;
[ "ch.boye.httpclientandroidlib" ]
ch.boye.httpclientandroidlib;
495,279
public Map<WebService, Map<String, String>> getServicesWithInputContainedInModel( edu.isi.karma.rep.model.Model semanticModel, Integer serviceLimit) { List<Source> serviceList = getSourcesDetailedInfo(serviceLimit); Map<WebService, Map<String, String>> servicesAndMappings = new HashMap<>(); Model jenaModel = semanticModel.getJenaModel(); for (Source service : serviceList) { if (!(service instanceof WebService)) continue; edu.isi.karma.rep.model.Model m = ((WebService)service).getInputModel(); if (m == null) continue; Map<String, Map<String, String>> serviceIdsAndMappings = m.findInJenaModel(jenaModel, null); if (serviceIdsAndMappings == null) continue; Iterator<String> itr = serviceIdsAndMappings.keySet().iterator(); if (itr.hasNext()) { String key = itr.next(); servicesAndMappings.put((WebService)service, serviceIdsAndMappings.get(key)); } } return servicesAndMappings; }
Map<WebService, Map<String, String>> function( edu.isi.karma.rep.model.Model semanticModel, Integer serviceLimit) { List<Source> serviceList = getSourcesDetailedInfo(serviceLimit); Map<WebService, Map<String, String>> servicesAndMappings = new HashMap<>(); Model jenaModel = semanticModel.getJenaModel(); for (Source service : serviceList) { if (!(service instanceof WebService)) continue; edu.isi.karma.rep.model.Model m = ((WebService)service).getInputModel(); if (m == null) continue; Map<String, Map<String, String>> serviceIdsAndMappings = m.findInJenaModel(jenaModel, null); if (serviceIdsAndMappings == null) continue; Iterator<String> itr = serviceIdsAndMappings.keySet().iterator(); if (itr.hasNext()) { String key = itr.next(); servicesAndMappings.put((WebService)service, serviceIdsAndMappings.get(key)); } } return servicesAndMappings; }
/** * Searches the repository to find the services whose input model is contained in the semantic model parameter. * Note that the services in the return list only include the operations that match the model parameter. * @param semanticModel The input model whose pattern will be searched in the repository * @return a hashmap of all found services and a mapping from the found service parameters to the model parameters. * This help us later to how to join the model's corresponding source and the matched service */
Searches the repository to find the services whose input model is contained in the semantic model parameter. Note that the services in the return list only include the operations that match the model parameter
getServicesWithInputContainedInModel
{ "repo_name": "usc-isi-i2/Web-Karma", "path": "karma-common/src/main/java/edu/isi/karma/model/serialization/WebServiceLoader.java", "license": "apache-2.0", "size": 33950 }
[ "com.hp.hpl.jena.rdf.model.Model", "edu.isi.karma.rep.sources.Source", "edu.isi.karma.rep.sources.WebService", "java.util.HashMap", "java.util.Iterator", "java.util.List", "java.util.Map" ]
import com.hp.hpl.jena.rdf.model.Model; import edu.isi.karma.rep.sources.Source; import edu.isi.karma.rep.sources.WebService; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map;
import com.hp.hpl.jena.rdf.model.*; import edu.isi.karma.rep.sources.*; import java.util.*;
[ "com.hp.hpl", "edu.isi.karma", "java.util" ]
com.hp.hpl; edu.isi.karma; java.util;
1,126,813
@Override public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) { try { Log.i(DatabaseHelper.class.getName(), "onCreate"); // Create the databases we're using TableUtils.createTable(connectionSource, Person.class); TableUtils.createTable(connectionSource, Stream.class); TableUtils.createTable(connectionSource, Message.class); TableUtils.createTable(connectionSource, MessageRange.class); TableUtils.createTable(connectionSource, Emoji.class); } catch (SQLException e) { Log.e(DatabaseHelper.class.getName(), "Can't create database", e); throw new RuntimeException(e); } }
void function(SQLiteDatabase db, ConnectionSource connectionSource) { try { Log.i(DatabaseHelper.class.getName(), STR); TableUtils.createTable(connectionSource, Person.class); TableUtils.createTable(connectionSource, Stream.class); TableUtils.createTable(connectionSource, Message.class); TableUtils.createTable(connectionSource, MessageRange.class); TableUtils.createTable(connectionSource, Emoji.class); } catch (SQLException e) { Log.e(DatabaseHelper.class.getName(), STR, e); throw new RuntimeException(e); } }
/** * This is called when the database is first created. Usually you should * call createTable statements here to create the tables that will store * your data. */
This is called when the database is first created. Usually you should call createTable statements here to create the tables that will store your data
onCreate
{ "repo_name": "abhaymaniyar/zulip-android", "path": "app/src/main/java/com/zulip/android/database/DatabaseHelper.java", "license": "apache-2.0", "size": 4064 }
[ "android.database.sqlite.SQLiteDatabase", "android.util.Log", "com.j256.ormlite.support.ConnectionSource", "com.j256.ormlite.table.TableUtils", "com.zulip.android.models.Emoji", "com.zulip.android.models.Message", "com.zulip.android.models.MessageRange", "com.zulip.android.models.Person", "com.zulip.android.models.Stream", "java.sql.SQLException" ]
import android.database.sqlite.SQLiteDatabase; import android.util.Log; import com.j256.ormlite.support.ConnectionSource; import com.j256.ormlite.table.TableUtils; import com.zulip.android.models.Emoji; import com.zulip.android.models.Message; import com.zulip.android.models.MessageRange; import com.zulip.android.models.Person; import com.zulip.android.models.Stream; import java.sql.SQLException;
import android.database.sqlite.*; import android.util.*; import com.j256.ormlite.support.*; import com.j256.ormlite.table.*; import com.zulip.android.models.*; import java.sql.*;
[ "android.database", "android.util", "com.j256.ormlite", "com.zulip.android", "java.sql" ]
android.database; android.util; com.j256.ormlite; com.zulip.android; java.sql;
1,097,100
private void createAndCloseGeoPackage(GeoPackageDatabase db) { GeoPackageConnection connection = new GeoPackageConnection(db); // Set the GeoPackage application id and user version connection.setApplicationId(); connection.setUserVersion(); // Create the minimum required tables GeoPackageTableCreator tableCreator = new GeoPackageTableCreator(connection); tableCreator.createRequired(); connection.close(); } /** * {@inheritDoc}
void function(GeoPackageDatabase db) { GeoPackageConnection connection = new GeoPackageConnection(db); connection.setApplicationId(); connection.setUserVersion(); GeoPackageTableCreator tableCreator = new GeoPackageTableCreator(connection); tableCreator.createRequired(); connection.close(); } /** * {@inheritDoc}
/** * Create the required GeoPackage application id and tables in the newly created and open database connection. Then close the connection. * * @param db database connection */
Create the required GeoPackage application id and tables in the newly created and open database connection. Then close the connection
createAndCloseGeoPackage
{ "repo_name": "ngageoint/geopackage-android", "path": "geopackage-sdk/src/main/java/mil/nga/geopackage/GeoPackageManagerImpl.java", "license": "mit", "size": 54233 }
[ "mil.nga.geopackage.db.GeoPackageConnection", "mil.nga.geopackage.db.GeoPackageDatabase", "mil.nga.geopackage.db.GeoPackageTableCreator" ]
import mil.nga.geopackage.db.GeoPackageConnection; import mil.nga.geopackage.db.GeoPackageDatabase; import mil.nga.geopackage.db.GeoPackageTableCreator;
import mil.nga.geopackage.db.*;
[ "mil.nga.geopackage" ]
mil.nga.geopackage;
1,213,486
public void error(String msg, Object arg0) { logIfEnabled(Level.ERROR, null, msg, arg0, UNKNOWN_ARG, UNKNOWN_ARG, null); }
void function(String msg, Object arg0) { logIfEnabled(Level.ERROR, null, msg, arg0, UNKNOWN_ARG, UNKNOWN_ARG, null); }
/** * Log a error message. */
Log a error message
error
{ "repo_name": "lobo12/ormlite-core", "path": "src/main/java/com/j256/ormlite/logger/Logger.java", "license": "isc", "size": 17397 }
[ "com.j256.ormlite.logger.Log" ]
import com.j256.ormlite.logger.Log;
import com.j256.ormlite.logger.*;
[ "com.j256.ormlite" ]
com.j256.ormlite;
1,833,754
public Date addToDate(Date base) { Calendar calendar = Calendar.getInstance(); calendar.setTime(base); calendar.add(getCalendarField(this.unit), this.count); return calendar.getTime(); }
Date function(Date base) { Calendar calendar = Calendar.getInstance(); calendar.setTime(base); calendar.add(getCalendarField(this.unit), this.count); return calendar.getTime(); }
/** * Calculates a new date by adding this unit to the base date. * * @param base the base date. * * @return A new date one unit after the base date. * * @see #addToDate(Date, TimeZone) */
Calculates a new date by adding this unit to the base date
addToDate
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/axis/DateTickUnit.java", "license": "mit", "size": 13135 }
[ "java.util.Calendar", "java.util.Date" ]
import java.util.Calendar; import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
545,467
@Test public void testT1RV8D3_T1LV4D9() { test_id = getTestId("T1RV8D3", "T1LV4D9", "86"); String src = selectTRVD("T1RV8D3"); String dest = selectTLVD("T1LV4D9"); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ParamFailure2, checkResult_ParamFailure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } } // TODO FIXME: This test must pass when CQ issue // dts0100659374 is resolved. // // public void testT1RV8D3_T1LV5D1() { // test_id = getTestId("T1RV8D3", "T1LV5D1", "87"); // // String src = selectTRVD("T1RV8D3"); // // String dest = selectTLVD("T1LV5D1"); // // String result = "."; // try { // result = TRVD_TLVD_Action(src, dest); // } catch (RecognitionException e) { // e.printStackTrace(); // } catch (TokenStreamException e) { // e.printStackTrace(); // } // assertTrue(ParamFailure4, checkResult_ParamFailure4(src, dest, result)); // // GraphicalEditor editor = getActiveEditor(); // if (editor != null) { // validateOrGenerateResults(editor, generateResults); // } // } // TODO FIXME: This test must pass when CQ issue // dts0100659374 is resolved. // // public void testT1RV8D3_T1LV5D2() { // test_id = getTestId("T1RV8D3", "T1LV5D2", "88"); // // String src = selectTRVD("T1RV8D3"); // // String dest = selectTLVD("T1LV5D2"); // // String result = "."; // try { // result = TRVD_TLVD_Action(src, dest); // } catch (RecognitionException e) { // e.printStackTrace(); // } catch (TokenStreamException e) { // e.printStackTrace(); // } // assertTrue(ParamFailure4, checkResult_ParamFailure4(src, dest, result)); // // GraphicalEditor editor = getActiveEditor(); // if (editor != null) { // validateOrGenerateResults(editor, generateResults); // } // }
void function() { test_id = getTestId(STR, STR, "86"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ParamFailure2, checkResult_ParamFailure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
/** * Perform the test for the given matrix column (T1RV8D3) and row (T1LV4D9). * */
Perform the test for the given matrix column (T1RV8D3) and row (T1LV4D9)
testT1RV8D3_T1LV4D9
{ "repo_name": "jason-rhodes/bridgepoint", "path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_16_Generics.java", "license": "apache-2.0", "size": 186177 }
[ "org.xtuml.bp.ui.graphics.editor.GraphicalEditor" ]
import org.xtuml.bp.ui.graphics.editor.GraphicalEditor;
import org.xtuml.bp.ui.graphics.editor.*;
[ "org.xtuml.bp" ]
org.xtuml.bp;
572,932
public FileHandle getFile() { return _file; }
FileHandle function() { return _file; }
/** * Returns the file for this job. This file is used to tell the slaves what * file to transfer & receive. */
Returns the file for this job. This file is used to tell the slaves what file to transfer & receive
getFile
{ "repo_name": "d-fens/drftpd", "path": "src/plugins/org.drftpd.plugins.jobmanager/src/org/drftpd/plugins/jobmanager/Job.java", "license": "gpl-2.0", "size": 15027 }
[ "org.drftpd.vfs.FileHandle" ]
import org.drftpd.vfs.FileHandle;
import org.drftpd.vfs.*;
[ "org.drftpd.vfs" ]
org.drftpd.vfs;
2,475,355
return bool ? TRUE : FALSE; } /** * Constructs a new {@code Optional&lt;Boolean&gt;} from the given {@link Boolean}. * * @param bool The boolean * @return The constructed Optional, or {@link Optional#empty()}
return bool ? TRUE : FALSE; } /** * Constructs a new {@code Optional&lt;Boolean&gt;} from the given {@link Boolean}. * * @param bool The boolean * @return The constructed Optional, or {@link Optional#empty()}
/** * Constructs a new {@code Optional&lt;Boolean&gt;} from the given boolean. * * @param bool The boolean * @return The constructed Optional */
Constructs a new Optional&lt;Boolean&gt; from the given boolean
of
{ "repo_name": "natrolite/natrolite", "path": "natrolite-api/src/main/java/org/natrolite/util/OptBool.java", "license": "gpl-3.0", "size": 3036 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
993,913
public synchronized void rollback() throws HeuristicCommitException, HeuristicMixedException, HeuristicHazardException, SystemException { if (tc.isEntryEnabled()) Tr.entry(tc, "rollback", this); // Ensure timeout cannot rollback the underlying transaction ((DistributableTransaction) _transaction).addAssociation(); boolean sysException = false; // Cancel any outstanding (in-doubt or transaction) timer EmbeddableTimeoutManager.setTimeout(_transaction, EmbeddableTimeoutManager.CANCEL_TIMEOUT, 0); final int state = _transaction.getTransactionState().getState(); switch (state) { case TransactionState.STATE_ACTIVE: case TransactionState.STATE_PREPARED: try { _transaction.getTransactionState().setState(TransactionState.STATE_ROLLING_BACK); } catch (javax.transaction.SystemException se) { FFDCFilter.processException(se, "com.ibm.tx.remote.TransactionWrapper.rollback", "586", this); if (tc.isDebugEnabled()) Tr.debug(tc, "Exception caught setting state to ROLLING_BACK!", se); sysException = true; } try { // Resume the transaction created from the incoming // request so that it is installed on the thread. ((EmbeddableTranManagerSet) TransactionManagerFactory.getTransactionManager()).resume(_transaction); _transaction.internalRollback(); _transaction.notifyCompletion(); } catch (HeuristicMixedException hme) { // No FFDC code needed. _heuristic = StatefulResource.HEURISTIC_MIXED; } catch (HeuristicHazardException hhe) { // No FFDC code needed. _heuristic = StatefulResource.HEURISTIC_HAZARD; } catch (HeuristicCommitException hce) { // No FFDC code needed. _heuristic = StatefulResource.HEURISTIC_COMMIT; } catch (Throwable exc) // javax.transaction.SystemException { FFDCFilter.processException(exc, "com.ibm.tx.remote.TransactionWrapper.rollback", "610", this); Tr.error(tc, "WTRN0071_ROLLBACK_FAILED", exc); _transaction.notifyCompletion(); sysException = true; } break; // If the transaction that this object represents has already been completed, // raise a heuristic exception if necessary. This object must wait for a // forget before destroying itself if it returns a heuristic exception. case TransactionState.STATE_HEURISTIC_ON_ROLLBACK: case TransactionState.STATE_ROLLED_BACK: // Return last heuristic value and allow for recovery _heuristic = _transaction.getResources().getHeuristicOutcome(); break; case TransactionState.STATE_ROLLING_BACK: // We should only get in this state if we are in recovery and this // inbound rollback arrives. In other cases, if we are rolling back // we will hold out using the association counts and if we are // locally retrying we will be in a heuristic state as we returned // heuristic hazard to the superior. ((DistributableTransaction) _transaction).removeAssociation(); final TRANSIENT tre = new TRANSIENT(); if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", tre); throw tre; case TransactionState.STATE_COMMITTING: case TransactionState.STATE_HEURISTIC_ON_COMMIT: case TransactionState.STATE_COMMITTED: // Admin heuristic commit ... // again retry ... respond with heurcom _heuristic = StatefulResource.HEURISTIC_COMMIT; break; case TransactionState.STATE_NONE: // Transaction has completed and is now finished // Normally the remoteable object would be disconnected from the orb, // but ... timing may mean get got here while it was happenning // We could just return ok, but it is more true to return exception ((DistributableTransaction) _transaction).removeAssociation(); final OBJECT_NOT_EXIST one = new OBJECT_NOT_EXIST(); if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", one); throw one; default: Tr.error(tc, "WTRN0072_ROLLBACK_BAD_STATE", TransactionState.stateToString(state)); sysException = true; _transaction.notifyCompletion(); break; } // end switch ((DistributableTransaction) _transaction).removeAssociation(); switch (_heuristic) { case StatefulResource.NONE: break; case StatefulResource.HEURISTIC_HAZARD: // _transaction.addHeuristic(); final HeuristicHazardException hh = new HeuristicHazardException(); if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", hh); throw hh; case StatefulResource.HEURISTIC_COMMIT: // _transaction.addHeuristic(); final HeuristicCommitException hc = new HeuristicCommitException(); if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", hc); throw hc; default: // _transaction.addHeuristic(); final HeuristicMixedException hm = new HeuristicMixedException(); if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", hm); throw hm; } if (sysException) { // destroy(); final INTERNAL ie = new INTERNAL(MinorCode.LOGIC_ERROR, null); if (tc.isEntryEnabled()) Tr.exit(tc, "rollback", ie); throw ie; } if (tc.isEntryEnabled()) Tr.exit(tc, "rollback"); } //----------------------------------------------------------------------------
synchronized void function() throws HeuristicCommitException, HeuristicMixedException, HeuristicHazardException, SystemException { if (tc.isEntryEnabled()) Tr.entry(tc, STR, this); ((DistributableTransaction) _transaction).addAssociation(); boolean sysException = false; EmbeddableTimeoutManager.setTimeout(_transaction, EmbeddableTimeoutManager.CANCEL_TIMEOUT, 0); final int state = _transaction.getTransactionState().getState(); switch (state) { case TransactionState.STATE_ACTIVE: case TransactionState.STATE_PREPARED: try { _transaction.getTransactionState().setState(TransactionState.STATE_ROLLING_BACK); } catch (javax.transaction.SystemException se) { FFDCFilter.processException(se, STR, "586", this); if (tc.isDebugEnabled()) Tr.debug(tc, STR, se); sysException = true; } try { ((EmbeddableTranManagerSet) TransactionManagerFactory.getTransactionManager()).resume(_transaction); _transaction.internalRollback(); _transaction.notifyCompletion(); } catch (HeuristicMixedException hme) { _heuristic = StatefulResource.HEURISTIC_MIXED; } catch (HeuristicHazardException hhe) { _heuristic = StatefulResource.HEURISTIC_HAZARD; } catch (HeuristicCommitException hce) { _heuristic = StatefulResource.HEURISTIC_COMMIT; } catch (Throwable exc) { FFDCFilter.processException(exc, STR, "610", this); Tr.error(tc, STR, exc); _transaction.notifyCompletion(); sysException = true; } break; case TransactionState.STATE_HEURISTIC_ON_ROLLBACK: case TransactionState.STATE_ROLLED_BACK: _heuristic = _transaction.getResources().getHeuristicOutcome(); break; case TransactionState.STATE_ROLLING_BACK: ((DistributableTransaction) _transaction).removeAssociation(); final TRANSIENT tre = new TRANSIENT(); if (tc.isEntryEnabled()) Tr.exit(tc, STR, tre); throw tre; case TransactionState.STATE_COMMITTING: case TransactionState.STATE_HEURISTIC_ON_COMMIT: case TransactionState.STATE_COMMITTED: _heuristic = StatefulResource.HEURISTIC_COMMIT; break; case TransactionState.STATE_NONE: ((DistributableTransaction) _transaction).removeAssociation(); final OBJECT_NOT_EXIST one = new OBJECT_NOT_EXIST(); if (tc.isEntryEnabled()) Tr.exit(tc, STR, one); throw one; default: Tr.error(tc, STR, TransactionState.stateToString(state)); sysException = true; _transaction.notifyCompletion(); break; } ((DistributableTransaction) _transaction).removeAssociation(); switch (_heuristic) { case StatefulResource.NONE: break; case StatefulResource.HEURISTIC_HAZARD: final HeuristicHazardException hh = new HeuristicHazardException(); if (tc.isEntryEnabled()) Tr.exit(tc, STR, hh); throw hh; case StatefulResource.HEURISTIC_COMMIT: final HeuristicCommitException hc = new HeuristicCommitException(); if (tc.isEntryEnabled()) Tr.exit(tc, STR, hc); throw hc; default: final HeuristicMixedException hm = new HeuristicMixedException(); if (tc.isEntryEnabled()) Tr.exit(tc, STR, hm); throw hm; } if (sysException) { final INTERNAL ie = new INTERNAL(MinorCode.LOGIC_ERROR, null); if (tc.isEntryEnabled()) Tr.exit(tc, STR, ie); throw ie; } if (tc.isEntryEnabled()) Tr.exit(tc, STR); }
/** * Informs the object that the transaction is to be rolled back. * <p> * Passes the superior Coordinator's rollback request on to the TransactionImpl * that registered the CoordinatorResourceImpl, using a private interface. * <p> * If the TransactionImpl does not raise any heuristic exception, the * CoordinatorResourceImpl destroys itself. * * @param * * @return * * @exception HeuristicCommit The transaction has already been committed. * @exception HeuristicMixed At least one participant in the transaction has * committed its changes. * @exception HeuristicHazard At least one participant in the transaction may * not report its outcome. * @exception SystemException An error occurred. The minor code indicates * the reason for the exception. * * @see Resource */
Informs the object that the transaction is to be rolled back. Passes the superior Coordinator's rollback request on to the TransactionImpl that registered the CoordinatorResourceImpl, using a private interface. If the TransactionImpl does not raise any heuristic exception, the CoordinatorResourceImpl destroys itself
rollback
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.tx.embeddable/src/com/ibm/tx/remote/TransactionWrapper.java", "license": "epl-1.0", "size": 45681 }
[ "com.ibm.tx.jta.TransactionManagerFactory", "com.ibm.tx.jta.embeddable.impl.EmbeddableTimeoutManager", "com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerSet", "com.ibm.tx.jta.impl.TransactionState", "com.ibm.websphere.ras.Tr", "com.ibm.ws.Transaction", "com.ibm.ws.ffdc.FFDCFilter", "javax.transaction.HeuristicCommitException", "javax.transaction.HeuristicMixedException", "javax.transaction.SystemException" ]
import com.ibm.tx.jta.TransactionManagerFactory; import com.ibm.tx.jta.embeddable.impl.EmbeddableTimeoutManager; import com.ibm.tx.jta.embeddable.impl.EmbeddableTranManagerSet; import com.ibm.tx.jta.impl.TransactionState; import com.ibm.websphere.ras.Tr; import com.ibm.ws.Transaction; import com.ibm.ws.ffdc.FFDCFilter; import javax.transaction.HeuristicCommitException; import javax.transaction.HeuristicMixedException; import javax.transaction.SystemException;
import com.ibm.tx.jta.*; import com.ibm.tx.jta.embeddable.impl.*; import com.ibm.tx.jta.impl.*; import com.ibm.websphere.ras.*; import com.ibm.ws.*; import com.ibm.ws.ffdc.*; import javax.transaction.*;
[ "com.ibm.tx", "com.ibm.websphere", "com.ibm.ws", "javax.transaction" ]
com.ibm.tx; com.ibm.websphere; com.ibm.ws; javax.transaction;
556,592
public static Actions read(final int actionClass, final SeekableInputStream stream, final SpecialActionTable specialActionTable) throws IOException { Action action; int quantity; List<Integer> offsets; int endOffset; int pos; int offset; Actions actions; // Create the actions object actions = new Actions(); // Read the action offsets pos = (int) stream.tell(); offsets = new ArrayList<Integer>(); endOffset = 0; while (pos != endOffset) { offset = stream.readWord(); offsets.add(offset); pos += 2; if (offset != 0 && (endOffset == 0 || offset < endOffset)) { endOffset = offset; } } // Count the actions quantity = offsets.size(); // Read the actions actions.actions = new ArrayList<Action>(quantity); for (int i = 0; i < quantity; i++) { final int actionOffset = offsets.get(i).intValue(); if (actionOffset != 0) { stream.seek(actionOffset); action = ActionFactory.read(actionClass, stream, specialActionTable); } else { action = null; } actions.actions.add(action); } // Return the actions return actions; }
static Actions function(final int actionClass, final SeekableInputStream stream, final SpecialActionTable specialActionTable) throws IOException { Action action; int quantity; List<Integer> offsets; int endOffset; int pos; int offset; Actions actions; actions = new Actions(); pos = (int) stream.tell(); offsets = new ArrayList<Integer>(); endOffset = 0; while (pos != endOffset) { offset = stream.readWord(); offsets.add(offset); pos += 2; if (offset != 0 && (endOffset == 0 offset < endOffset)) { endOffset = offset; } } quantity = offsets.size(); actions.actions = new ArrayList<Action>(quantity); for (int i = 0; i < quantity; i++) { final int actionOffset = offsets.get(i).intValue(); if (actionOffset != 0) { stream.seek(actionOffset); action = ActionFactory.read(actionClass, stream, specialActionTable); } else { action = null; } actions.actions.add(action); } return actions; }
/** * Creates and returns a new Actions object. * * @param actionClass * The action class * @param stream * The input stream * @param specialActionTable * The special action table * @return The Actions object * @throws IOException * When file operation fails. */
Creates and returns a new Actions object
read
{ "repo_name": "delMar43/wlandsuite", "path": "src/main/java/de/ailis/wlandsuite/game/parts/Actions.java", "license": "mit", "size": 7100 }
[ "de.ailis.wlandsuite.io.SeekableInputStream", "java.io.IOException", "java.util.ArrayList", "java.util.List" ]
import de.ailis.wlandsuite.io.SeekableInputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List;
import de.ailis.wlandsuite.io.*; import java.io.*; import java.util.*;
[ "de.ailis.wlandsuite", "java.io", "java.util" ]
de.ailis.wlandsuite; java.io; java.util;
2,049,049
protected final void packShareHandle(String shareName, RpcPacket rpc) { // Indicate that a handle follows, pack the handle rpc.packInt(Rpc.True); NFSHandle.packShareHandle(shareName, rpc, NFS.FileHandleSize); }
final void function(String shareName, RpcPacket rpc) { rpc.packInt(Rpc.True); NFSHandle.packShareHandle(shareName, rpc, NFS.FileHandleSize); }
/** * Pack a share handle * * @param shareName String * @param rpc RpcPacket */
Pack a share handle
packShareHandle
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/alfresco-jlan/source/java/org/alfresco/jlan/oncrpc/nfs/NFSServer.java", "license": "lgpl-3.0", "size": 140029 }
[ "org.alfresco.jlan.oncrpc.Rpc", "org.alfresco.jlan.oncrpc.RpcPacket" ]
import org.alfresco.jlan.oncrpc.Rpc; import org.alfresco.jlan.oncrpc.RpcPacket;
import org.alfresco.jlan.oncrpc.*;
[ "org.alfresco.jlan" ]
org.alfresco.jlan;
1,629,323
@ApiStatus.NonExtendable public interface JoinConfiguration extends Buildable<JoinConfiguration, JoinConfiguration.Builder>, Examinable { static @NotNull Builder builder() { return new JoinConfigurationImpl.BuilderImpl(); }
@ApiStatus.NonExtendable interface JoinConfiguration extends Buildable<JoinConfiguration, JoinConfiguration.Builder>, Examinable { static @NotNull Builder function() { return new JoinConfigurationImpl.BuilderImpl(); }
/** * Creates a new builder. * * @return a new builder * @since 4.9.0 */
Creates a new builder
builder
{ "repo_name": "KyoriPowered/text", "path": "api/src/main/java/net/kyori/adventure/text/JoinConfiguration.java", "license": "mit", "size": 9144 }
[ "net.kyori.adventure.util.Buildable", "net.kyori.examination.Examinable", "org.jetbrains.annotations.ApiStatus", "org.jetbrains.annotations.NotNull" ]
import net.kyori.adventure.util.Buildable; import net.kyori.examination.Examinable; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull;
import net.kyori.adventure.util.*; import net.kyori.examination.*; import org.jetbrains.annotations.*;
[ "net.kyori.adventure", "net.kyori.examination", "org.jetbrains.annotations" ]
net.kyori.adventure; net.kyori.examination; org.jetbrains.annotations;
1,708,048
public CounterName withOriginalName(String originalName) { return create( name(), origin(), stepName(), prefix(), checkNotNull(originalName, "Expected original name in string %s", originalName), contextSystemName(), originalRequestingStepName(), inputIndex()); }
CounterName function(String originalName) { return create( name(), origin(), stepName(), prefix(), checkNotNull(originalName, STR, originalName), contextSystemName(), originalRequestingStepName(), inputIndex()); }
/** * Returns a {@link CounterName} identical to this, but with the {@code originalName} from a * {@link String}. */
Returns a <code>CounterName</code> identical to this, but with the originalName from a <code>String</code>
withOriginalName
{ "repo_name": "lukecwik/incubator-beam", "path": "runners/google-cloud-dataflow-java/worker/src/main/java/org/apache/beam/runners/dataflow/worker/counters/CounterName.java", "license": "apache-2.0", "size": 9370 }
[ "org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions" ]
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.*;
[ "org.apache.beam" ]
org.apache.beam;
2,156,005
public void paintComponent(Graphics og) { super.paintComponent(og); Graphics2D g = (Graphics2D) og; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); double width = getWidth(); double height = getHeight(); g.setColor(FILLCOLOUR); g.fillRect(1, 1, (int) width-1, (int) height-1); g.setColor(BORDERCOLOUR); g.setStroke(STROKE2); g.drawRect(0, 0, (int) width-1, (int) height-1); if (histogramImage != null) g.drawImage(histogramImage.getImage(), 0, 0, (int) width-1, (int) height-1, null); double codomainMin = model.getCodomainStart(); double codomainMax = model.getCodomainEnd(); //double domainGlobalMin = model.getGlobalMin(); //double domainGlobalMax = model.getGlobalMax(); double domainGlobalMin = view.getPartialMinimum(); double domainGlobalMax = view.getPartialMaximum(); double domainMin = model.getWindowStart(); double domainMax = model.getWindowEnd(); //Added jmarie 03/10/07 if (domainMin < domainGlobalMin) domainMin = domainGlobalMin; if (domainMax > domainGlobalMax) domainMax = domainGlobalMax; double domainMinScreenX = ((domainMin-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; double domainMaxScreenX = ((domainMax-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; double codomainMinScreenY = ((255-codomainMin)/255.0f)*height; double codomainMaxScreenY = ((255-codomainMax)/255.0f)*height; double domainRangeScreen = domainMaxScreenX-domainMinScreenX; double codomainRangeScreen = codomainMinScreenY-codomainMaxScreenY; g.setColor(GREYCOLOUR); g.fillRect(0, 0, (int) domainMinScreenX+1, (int) height); g.fillRect((int) domainMaxScreenX-1, 0, (int) width, (int) height); g.fillRect(0, 0, (int) domainMinScreenX, (int) height); g.fillRect((int) domainMaxScreenX, 0, (int) width, (int) height); g.fillRect(0, 0, (int) width, (int) codomainMaxScreenY); g.fillRect(0, (int) codomainMinScreenY, (int) width, (int) height); String family = model.getFamily(); double k = model.getCurveCoefficient(); double a = 0; if (family.equals(RendererModel.LINEAR)) a = codomainRangeScreen/domainRangeScreen; else if (family.equals(RendererModel.POLYNOMIAL)) a = codomainRangeScreen/Math.pow(domainRangeScreen, k); else if (family.equals(RendererModel.EXPONENTIAL)) a = codomainRangeScreen/Math.exp(Math.pow(domainRangeScreen, k)); else if (family.equals(RendererModel.LOGARITHMIC)) { if (domainRangeScreen <= 1) domainRangeScreen = 1; a = codomainRangeScreen/Math.log(domainRangeScreen); } double b = codomainMinScreenY; double currentX = domainMinScreenX-1; double currentY = b; double oldX, oldY; g.setColor(model.getChannelColor(model.getSelectedChannel())); g.setStroke(STROKE1_5); for (double x = 1; x < domainRangeScreen; x += 1) { oldX = currentX; oldY = currentY; currentX = x+domainMinScreenX-1; if (family.equals(RendererModel.LINEAR)) currentY = b-a*x; else if (family.equals(RendererModel.EXPONENTIAL)) currentY = b-a*Math.exp(Math.pow(x, k)); else if (family.equals(RendererModel.POLYNOMIAL)) currentY = b-a*Math.pow(x, k); else if (family.equals(RendererModel.LOGARITHMIC)) currentY = b-a*Math.log(x); g.drawLine((int) oldX, (int) oldY, (int) currentX, (int) currentY); } if (view.isPaintLine()) { int vertical = view.getVerticalLine(); g.setColor(LINECOLOUR); double v; if (view.paintVertical()) { v = ((vertical-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; g.drawLine((int) v, 0, (int) v, (int) height); } int horizontal = view.getHorizontalLine(); if (view.paintHorizontal()) { v = ((255-horizontal)/255.0f)*height; g.drawLine(0, (int) v, (int) width, (int) v); } } }
void function(Graphics og) { super.paintComponent(og); Graphics2D g = (Graphics2D) og; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); double width = getWidth(); double height = getHeight(); g.setColor(FILLCOLOUR); g.fillRect(1, 1, (int) width-1, (int) height-1); g.setColor(BORDERCOLOUR); g.setStroke(STROKE2); g.drawRect(0, 0, (int) width-1, (int) height-1); if (histogramImage != null) g.drawImage(histogramImage.getImage(), 0, 0, (int) width-1, (int) height-1, null); double codomainMin = model.getCodomainStart(); double codomainMax = model.getCodomainEnd(); double domainGlobalMin = view.getPartialMinimum(); double domainGlobalMax = view.getPartialMaximum(); double domainMin = model.getWindowStart(); double domainMax = model.getWindowEnd(); if (domainMin < domainGlobalMin) domainMin = domainGlobalMin; if (domainMax > domainGlobalMax) domainMax = domainGlobalMax; double domainMinScreenX = ((domainMin-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; double domainMaxScreenX = ((domainMax-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; double codomainMinScreenY = ((255-codomainMin)/255.0f)*height; double codomainMaxScreenY = ((255-codomainMax)/255.0f)*height; double domainRangeScreen = domainMaxScreenX-domainMinScreenX; double codomainRangeScreen = codomainMinScreenY-codomainMaxScreenY; g.setColor(GREYCOLOUR); g.fillRect(0, 0, (int) domainMinScreenX+1, (int) height); g.fillRect((int) domainMaxScreenX-1, 0, (int) width, (int) height); g.fillRect(0, 0, (int) domainMinScreenX, (int) height); g.fillRect((int) domainMaxScreenX, 0, (int) width, (int) height); g.fillRect(0, 0, (int) width, (int) codomainMaxScreenY); g.fillRect(0, (int) codomainMinScreenY, (int) width, (int) height); String family = model.getFamily(); double k = model.getCurveCoefficient(); double a = 0; if (family.equals(RendererModel.LINEAR)) a = codomainRangeScreen/domainRangeScreen; else if (family.equals(RendererModel.POLYNOMIAL)) a = codomainRangeScreen/Math.pow(domainRangeScreen, k); else if (family.equals(RendererModel.EXPONENTIAL)) a = codomainRangeScreen/Math.exp(Math.pow(domainRangeScreen, k)); else if (family.equals(RendererModel.LOGARITHMIC)) { if (domainRangeScreen <= 1) domainRangeScreen = 1; a = codomainRangeScreen/Math.log(domainRangeScreen); } double b = codomainMinScreenY; double currentX = domainMinScreenX-1; double currentY = b; double oldX, oldY; g.setColor(model.getChannelColor(model.getSelectedChannel())); g.setStroke(STROKE1_5); for (double x = 1; x < domainRangeScreen; x += 1) { oldX = currentX; oldY = currentY; currentX = x+domainMinScreenX-1; if (family.equals(RendererModel.LINEAR)) currentY = b-a*x; else if (family.equals(RendererModel.EXPONENTIAL)) currentY = b-a*Math.exp(Math.pow(x, k)); else if (family.equals(RendererModel.POLYNOMIAL)) currentY = b-a*Math.pow(x, k); else if (family.equals(RendererModel.LOGARITHMIC)) currentY = b-a*Math.log(x); g.drawLine((int) oldX, (int) oldY, (int) currentX, (int) currentY); } if (view.isPaintLine()) { int vertical = view.getVerticalLine(); g.setColor(LINECOLOUR); double v; if (view.paintVertical()) { v = ((vertical-domainGlobalMin)/ (domainGlobalMax-domainGlobalMin))*width; g.drawLine((int) v, 0, (int) v, (int) height); } int horizontal = view.getHorizontalLine(); if (view.paintHorizontal()) { v = ((255-horizontal)/255.0f)*height; g.drawLine(0, (int) v, (int) width, (int) v); } } }
/** * Overridden to paint the histogram image. * @see JPanel#paintComponent(Graphics) */
Overridden to paint the histogram image
paintComponent
{ "repo_name": "simleo/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/rnd/GraphicsPaneUI.java", "license": "gpl-2.0", "size": 7405 }
[ "java.awt.Graphics", "java.awt.Graphics2D", "java.awt.RenderingHints" ]
import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.RenderingHints;
import java.awt.*;
[ "java.awt" ]
java.awt;
876,005
@Generated @Deprecated @Selector("currentInputMode") public static native UITextInputMode currentInputMode();
@Selector(STR) static native UITextInputMode function();
/** * The current input mode. Nil if unset. */
The current input mode. Nil if unset
currentInputMode
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UITextInputMode.java", "license": "apache-2.0", "size": 6203 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
994,490
public void println() throws IOException { onNewLine = true; aligned = false; needsNewLine = false; out.write(lineSep); } String lineSep = System.getProperty("line.separator"); private static class UncheckedIOException extends Error { static final long serialVersionUID = -4032692679158424751L; UncheckedIOException(IOException e) { super(e.getMessage(), e); } } int prec;
void function() throws IOException { onNewLine = true; aligned = false; needsNewLine = false; out.write(lineSep); } String lineSep = System.getProperty(STR); private static class UncheckedIOException extends Error { static final long serialVersionUID = -4032692679158424751L; UncheckedIOException(IOException e) { super(e.getMessage(), e); } } int prec;
/** Print new line. */
Print new line
println
{ "repo_name": "digitalheir/lombok", "path": "src/delombok/lombok/delombok/PrettyCommentsPrinter.java", "license": "mit", "size": 49628 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
909,844
private static int[][] parse(String members) { // Create vector to hold int[] elements, each element being one range // parsed out of members. Vector theRanges = new Vector(); // Run state machine over members. int n = (members == null ? 0 : members.length()); int i = 0; int state = 0; int lb = 0; int ub = 0; char c; int digit; while (i < n) { c = members.charAt(i ++); switch (state) { case 0: // Before first integer in first group if (Character.isWhitespace(c)) { state = 0; } else if ((digit = Character.digit(c, 10)) != -1) { lb = digit; state = 1; } else { throw new IllegalArgumentException(); } break; case 1: // In first integer in a group if (Character.isWhitespace(c)){ state = 2; } else if ((digit = Character.digit(c, 10)) != -1) { lb = 10 * lb + digit; state = 1; } else if (c == '-' || c == ':') { state = 3; } else if (c == ',') { accumulate (theRanges, lb, lb); state = 6; } else { throw new IllegalArgumentException(); } break; case 2: // After first integer in a group if (Character.isWhitespace(c)) { state = 2; } else if (c == '-' || c == ':') { state = 3; } else if (c == ',') { accumulate(theRanges, lb, lb); state = 6; } else { throw new IllegalArgumentException(); } break; case 3: // Before second integer in a group if (Character.isWhitespace(c)) { state = 3; } else if ((digit = Character.digit(c, 10)) != -1) { ub = digit; state = 4; } else { throw new IllegalArgumentException(); } break; case 4: // In second integer in a group if (Character.isWhitespace(c)) { state = 5; } else if ((digit = Character.digit(c, 10)) != -1) { ub = 10 * ub + digit; state = 4; } else if (c == ',') { accumulate(theRanges, lb, ub); state = 6; } else { throw new IllegalArgumentException(); } break; case 5: // After second integer in a group if (Character.isWhitespace(c)) { state = 5; } else if (c == ',') { accumulate(theRanges, lb, ub); state = 6; } else { throw new IllegalArgumentException(); } break; case 6: // Before first integer in second or later group if (Character.isWhitespace(c)) { state = 6; } else if ((digit = Character.digit(c, 10)) != -1) { lb = digit; state = 1; } else { throw new IllegalArgumentException(); } break; } } // Finish off the state machine. switch (state) { case 0: // Before first integer in first group break; case 1: // In first integer in a group case 2: // After first integer in a group accumulate(theRanges, lb, lb); break; case 4: // In second integer in a group case 5: // After second integer in a group accumulate(theRanges, lb, ub); break; case 3: // Before second integer in a group case 6: // Before first integer in second or later group throw new IllegalArgumentException(); } // Return canonical array form. return canonicalArrayForm (theRanges); }
static int[][] function(String members) { Vector theRanges = new Vector(); int n = (members == null ? 0 : members.length()); int i = 0; int state = 0; int lb = 0; int ub = 0; char c; int digit; while (i < n) { c = members.charAt(i ++); switch (state) { case 0: if (Character.isWhitespace(c)) { state = 0; } else if ((digit = Character.digit(c, 10)) != -1) { lb = digit; state = 1; } else { throw new IllegalArgumentException(); } break; case 1: if (Character.isWhitespace(c)){ state = 2; } else if ((digit = Character.digit(c, 10)) != -1) { lb = 10 * lb + digit; state = 1; } else if (c == '-' c == ':') { state = 3; } else if (c == ',') { accumulate (theRanges, lb, lb); state = 6; } else { throw new IllegalArgumentException(); } break; case 2: if (Character.isWhitespace(c)) { state = 2; } else if (c == '-' c == ':') { state = 3; } else if (c == ',') { accumulate(theRanges, lb, lb); state = 6; } else { throw new IllegalArgumentException(); } break; case 3: if (Character.isWhitespace(c)) { state = 3; } else if ((digit = Character.digit(c, 10)) != -1) { ub = digit; state = 4; } else { throw new IllegalArgumentException(); } break; case 4: if (Character.isWhitespace(c)) { state = 5; } else if ((digit = Character.digit(c, 10)) != -1) { ub = 10 * ub + digit; state = 4; } else if (c == ',') { accumulate(theRanges, lb, ub); state = 6; } else { throw new IllegalArgumentException(); } break; case 5: if (Character.isWhitespace(c)) { state = 5; } else if (c == ',') { accumulate(theRanges, lb, ub); state = 6; } else { throw new IllegalArgumentException(); } break; case 6: if (Character.isWhitespace(c)) { state = 6; } else if ((digit = Character.digit(c, 10)) != -1) { lb = digit; state = 1; } else { throw new IllegalArgumentException(); } break; } } switch (state) { case 0: break; case 1: case 2: accumulate(theRanges, lb, lb); break; case 4: case 5: accumulate(theRanges, lb, ub); break; case 3: case 6: throw new IllegalArgumentException(); } return canonicalArrayForm (theRanges); }
/** * Parse the given string, returning canonical array form. */
Parse the given string, returning canonical array form
parse
{ "repo_name": "shun634501730/java_source_cn", "path": "src_en/javax/print/attribute/SetOfIntegerSyntax.java", "license": "apache-2.0", "size": 19979 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
1,716,864
public long getEstimatedResourceConstrainedSize() { return estimatedResourceConstrainedSize; } /** * Writes a JSON representation of the data to the specified {@link PrintWriter}. The data has the * following form: <code> * <br>{ * <br>&nbsp;&nbsp;estimatedNewSize = &lt;number&gt;, * <br>&nbsp;&nbsp;estimatedChangedSize = &lt;number&gt;, * <br>&nbsp;&nbsp;explainedAsNew = [ * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry_list&gt; * <br>&nbsp;&nbsp;], * <br>&nbsp;&nbsp;explainedAsChanged = [ * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry_list&gt; * <br>&nbsp;&nbsp;], * <br>&nbsp;&nbsp;explainedAsUnchangedOrFree = [ * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry_list&gt; * <br>&nbsp;&nbsp;] * <br>} * </code> <br> * Where <code>&lt;entry_list&gt;</code> is a list of zero or more entries of the following form: * <code> * <br>{ path: '&lt;path_string&gt;', isNew: &lt;true|false&gt;, * reasonIncluded: &lt;undefined|'&lt;reason_string'&gt;, compressedSizeInPatch: &lt;number&gt; * }
long function() { return estimatedResourceConstrainedSize; } /** * Writes a JSON representation of the data to the specified {@link PrintWriter}. The data has the * following form: <code> * <br>{ * <br>&nbsp;&nbsp;estimatedNewSize = &lt;number&gt;, * <br>&nbsp;&nbsp;estimatedChangedSize = &lt;number&gt;, * <br>&nbsp;&nbsp;explainedAsNew = [ * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry_list&gt; * <br>&nbsp;&nbsp;], * <br>&nbsp;&nbsp;explainedAsChanged = [ * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry_list&gt; * <br>&nbsp;&nbsp;], * <br>&nbsp;&nbsp;explainedAsUnchangedOrFree = [ * <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;entry_list&gt; * <br>&nbsp;&nbsp;] * <br>} * </code> <br> * Where <code>&lt;entry_list&gt;</code> is a list of zero or more entries of the following form: * <code> * <br>{ path: '&lt;path_string&gt;', isNew: &lt;true false&gt;, * reasonIncluded: &lt;undefined '&lt;reason_string'&gt;, compressedSizeInPatch: &lt;number&gt; * }
/** * Returns the sum total of the sizes of all entries that could have been uncompressed for * patching but have been prevented due to resource constraints by a {@link * TotalRecompressionLimiter}. As noted in {@link EntryExplanation#getCompressedSizeInPatch()}, * this is an <strong>approximation</strong>. * * @return as described */
Returns the sum total of the sizes of all entries that could have been uncompressed for patching but have been prevented due to resource constraints by a <code>TotalRecompressionLimiter</code>. As noted in <code>EntryExplanation#getCompressedSizeInPatch()</code>, this is an approximation
getEstimatedResourceConstrainedSize
{ "repo_name": "google/archive-patcher", "path": "explainer/src/main/java/com/google/archivepatcher/explainer/PatchExplanation.java", "license": "apache-2.0", "size": 11393 }
[ "java.io.PrintWriter" ]
import java.io.PrintWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,396,745
public void removeTmpStore(IMXStore store) { if (null != store) { mTmpStores.remove(store); } }
void function(IMXStore store) { if (null != store) { mTmpStores.remove(store); } }
/** * Remove the dedicated store from the tmp stores list. * @param store the store to remove */
Remove the dedicated store from the tmp stores list
removeTmpStore
{ "repo_name": "floviolleau/vector-android", "path": "vector/src/main/java/im/vector/Matrix.java", "license": "apache-2.0", "size": 24868 }
[ "org.matrix.androidsdk.data.IMXStore" ]
import org.matrix.androidsdk.data.IMXStore;
import org.matrix.androidsdk.data.*;
[ "org.matrix.androidsdk" ]
org.matrix.androidsdk;
2,201,616
@Override public void send(String name, String value, long timestamp) throws IOException { try { writer.write(dateFormat.format(new Date(timestamp*1000))); writer.write(' '); writer.write(sanitize(name)); writer.write(' '); writer.write(sanitize(value)); writer.write('\n'); writer.flush(); } catch (IOException e) { throw e; } }
void function(String name, String value, long timestamp) throws IOException { try { writer.write(dateFormat.format(new Date(timestamp*1000))); writer.write(' '); writer.write(sanitize(name)); writer.write(' '); writer.write(sanitize(value)); writer.write('\n'); writer.flush(); } catch (IOException e) { throw e; } }
/** * Writes the given measurement to the console. * * @param name the name of the metric * @param value the value of the metric * @param timestamp the timestamp of the metric * @throws IOException if there was an error sending the metric */
Writes the given measurement to the console
send
{ "repo_name": "chetan/sewer", "path": "src/main/java/net/pixelcop/sewer/sink/debug/GraphiteConsole.java", "license": "apache-2.0", "size": 1673 }
[ "java.io.IOException", "java.util.Date" ]
import java.io.IOException; import java.util.Date;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,366,755
public void processPacket(INetHandlerPlayClient handler) { handler.handleTabComplete(this); }
void function(INetHandlerPlayClient handler) { handler.handleTabComplete(this); }
/** * Passes this Packet on to the NetHandler for processing. */
Passes this Packet on to the NetHandler for processing
processPacket
{ "repo_name": "Hexeption/Youtube-Hacked-Client-1.8", "path": "minecraft/net/minecraft/network/play/server/S3APacketTabComplete.java", "license": "mit", "size": 1856 }
[ "net.minecraft.network.play.INetHandlerPlayClient" ]
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.network.play.*;
[ "net.minecraft.network" ]
net.minecraft.network;
2,503,674
public String testString() { return mTestString; } } public static enum EventValueType { UNKNOWN(0), INT(1), LONG(2), STRING(3), LIST(4), TREE(5); private final static Pattern STORAGE_PATTERN = Pattern.compile("^(\\d+)@(.*)$"); //$NON-NLS-1$ private int mValue;
String function() { return mTestString; } } public static enum EventValueType { UNKNOWN(0), INT(1), LONG(2), STRING(3), LIST(4), TREE(5); private final static Pattern STORAGE_PATTERN = Pattern.compile(STR); private int mValue;
/** * Returns a short string representing the comparison. */
Returns a short string representing the comparison
testString
{ "repo_name": "i25ffz/screenshot", "path": "src/com/android/ddmlib/log/EventContainer.java", "license": "apache-2.0", "size": 15661 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,604,013
private static HttpHeaders getActiveHeaders(FullHttpMessage msg) { return msg.content().isReadable() ? msg.trailingHeaders() : msg.headers(); } /** * This method will add the {@code headers} to the out of order headers map * @param streamId The stream id associated with {@code headers}
static HttpHeaders function(FullHttpMessage msg) { return msg.content().isReadable() ? msg.trailingHeaders() : msg.headers(); } /** * This method will add the {@code headers} to the out of order headers map * @param streamId The stream id associated with {@code headers}
/** * Get either the header or the trailing headers depending on which is valid to add to * @param msg The message containing the headers and trailing headers * @return The headers object which can be appended to or modified */
Get either the header or the trailing headers depending on which is valid to add to
getActiveHeaders
{ "repo_name": "sameira/netty", "path": "codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttp2ToHttpPriorityAdapter.java", "license": "apache-2.0", "size": 9936 }
[ "io.netty.handler.codec.http.FullHttpMessage", "io.netty.handler.codec.http.HttpHeaders" ]
import io.netty.handler.codec.http.FullHttpMessage; import io.netty.handler.codec.http.HttpHeaders;
import io.netty.handler.codec.http.*;
[ "io.netty.handler" ]
io.netty.handler;
1,644,459
protected void addTab(String title, int iconStateId, int offShade, int onShade, Intent intent) { int[] iconStates = {iconStateId, offShade, onShade}; states.add(iconStates); intentList.add(intent); titleList.add(title); //commit(); }
void function(String title, int iconStateId, int offShade, int onShade, Intent intent) { int[] iconStates = {iconStateId, offShade, onShade}; states.add(iconStates); intentList.add(intent); titleList.add(title); }
/** * <b><i>protected void addTab(String title, int iconStateId, int offShade, int onShade, Intent intent)</i></b> <p><p> * Add a tab to the navigation bar by specifying the title, and 1 image for the button. Default yellow/gray shade is used for button on/off state<p> * @param title a String that specifies that title of the tab button * @param iconStateId id of the image used for both on/off state * @param offShade id for off-state color shades (e.g. RadioStateDrawable.SHADE_GRAY, RadioStateDrawable.SHADE_GREEN etc) * @param onShade id for on-state color shades (e.g. RadioStateDrawable.SHADE_GRAY, RadioStateDrawable.SHADE_GREEN etc) * @param intent intent to start when button is tapped */
protected void addTab(String title, int iconStateId, int offShade, int onShade, Intent intent) Add a tab to the navigation bar by specifying the title, and 1 image for the button. Default yellow/gray shade is used for button on/off state
addTab
{ "repo_name": "kkooff114/LJWCommon", "path": "src/com/loujiwei/common/activity/LJWScrollableTabActivity.java", "license": "gpl-3.0", "size": 12151 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
1,674,831
@Override @JsonIgnore public void setExpires(Date expires) { this.expires = expires; }
void function(Date expires) { this.expires = expires; }
/** * Set the expiry date/time for this lock. Set to null for never expires. * * @param expires the expires to set */
Set the expiry date/time for this lock. Set to null for never expires
setExpires
{ "repo_name": "loftuxab/community-edition-old", "path": "projects/remote-api/source/java/org/alfresco/repo/webdav/LockInfoImpl.java", "license": "lgpl-3.0", "size": 10151 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,880,701
if (userName == null) throw new NullPointerException("user name not set"); if (userName.length() == 0) throw new IllegalArgumentException("empty user name not allowed"); removeAttributes(USER_NAME); addAttribute(new StringAttribute(USER_NAME, userName)); }
if (userName == null) throw new NullPointerException(STR); if (userName.length() == 0) throw new IllegalArgumentException(STR); removeAttributes(USER_NAME); addAttribute(new StringAttribute(USER_NAME, userName)); }
/** * Sets the RadUser-Name attribute of this Access-Request. * * @param userName * user name to set */
Sets the RadUser-Name attribute of this Access-Request
setUserName
{ "repo_name": "talkincode/ToughRADIUS", "path": "src/main/java/org/tinyradius/packet/AccessRequest.java", "license": "lgpl-3.0", "size": 19483 }
[ "org.tinyradius.attribute.StringAttribute" ]
import org.tinyradius.attribute.StringAttribute;
import org.tinyradius.attribute.*;
[ "org.tinyradius.attribute" ]
org.tinyradius.attribute;
2,534,316
@Override public void onDrawEye(Eye eye) { GLES20.glEnable(GLES20.GL_DEPTH_TEST); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); checkGLError("colorParam"); // Apply the eye transformation to the camera. Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0); // Build the ModelView and ModelViewProjection matrices for calculating cube position and light. float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR); if(viewMenu) { Matrix.multiplyMM(modelView, 0, view, 0, modelScreen, 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); drawScreen(); // Set modelView for the floor, so we draw floor in the correct location Matrix.multiplyMM(modelView, 0, view, 0, modelFloor, 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); drawFloor(); } else { Matrix.multiplyMM(modelView, 0, view, 0, modelCube, 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); drawCube(); } }
void function(Eye eye) { GLES20.glEnable(GLES20.GL_DEPTH_TEST); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT GLES20.GL_DEPTH_BUFFER_BIT); checkGLError(STR); Matrix.multiplyMM(view, 0, eye.getEyeView(), 0, camera, 0); float[] perspective = eye.getPerspective(Z_NEAR, Z_FAR); if(viewMenu) { Matrix.multiplyMM(modelView, 0, view, 0, modelScreen, 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); drawScreen(); Matrix.multiplyMM(modelView, 0, view, 0, modelFloor, 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); drawFloor(); } else { Matrix.multiplyMM(modelView, 0, view, 0, modelCube, 0); Matrix.multiplyMM(modelViewProjection, 0, perspective, 0, modelView, 0); drawCube(); } }
/** * Draws a frame for an eye. * * @param eye The eye to render. Includes all required transformations. */
Draws a frame for an eye
onDrawEye
{ "repo_name": "joster422/Cardboard-Tour", "path": "CardboardSample/src/main/java/com/google/vrtoolkit/cardboard/samples/treasurehunt/MainActivity.java", "license": "apache-2.0", "size": 23281 }
[ "android.opengl.Matrix", "com.google.vrtoolkit.cardboard.Eye" ]
import android.opengl.Matrix; import com.google.vrtoolkit.cardboard.Eye;
import android.opengl.*; import com.google.vrtoolkit.cardboard.*;
[ "android.opengl", "com.google.vrtoolkit" ]
android.opengl; com.google.vrtoolkit;
2,655,882
private void registerNode(String id, String participant, ProcessNode node) { if(!allNodes.containsKey(id)) { allNodes.put(id, new HashMap<String, Collection<ProcessNode>>()); } if(!allNodes.get(id).containsKey(participant)) { allNodes.get(id).put(participant, new HashSet<ProcessNode>()); } allNodes.get(id).get(participant).add(node); }
void function(String id, String participant, ProcessNode node) { if(!allNodes.containsKey(id)) { allNodes.put(id, new HashMap<String, Collection<ProcessNode>>()); } if(!allNodes.get(id).containsKey(participant)) { allNodes.get(id).put(participant, new HashSet<ProcessNode>()); } allNodes.get(id).get(participant).add(node); }
/** * registers, that node is some node concerned with relizing the node with id * for participant. */
registers, that node is some node concerned with relizing the node with id for participant
registerNode
{ "repo_name": "bptlab/processeditor", "path": "src/com/inubit/research/gui/plugins/choreography/interfaceGenerator/BehavioralInterfaceGenerator.java", "license": "apache-2.0", "size": 12510 }
[ "java.util.Collection", "java.util.HashMap", "java.util.HashSet", "net.frapu.code.visualization.ProcessNode" ]
import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import net.frapu.code.visualization.ProcessNode;
import java.util.*; import net.frapu.code.visualization.*;
[ "java.util", "net.frapu.code" ]
java.util; net.frapu.code;
2,357,699
public DataValiditySettingsRecord getDataValiditySettings(int col, int row) { boolean found = false; DataValiditySettingsRecord foundRecord = null; for (Iterator i = validitySettings.iterator(); i.hasNext() && !found;) { DataValiditySettingsRecord dvsr = (DataValiditySettingsRecord) i.next(); if (dvsr.getFirstColumn() == col && dvsr.getFirstRow() == row) { found = true; foundRecord = dvsr; } } return foundRecord; }
DataValiditySettingsRecord function(int col, int row) { boolean found = false; DataValiditySettingsRecord foundRecord = null; for (Iterator i = validitySettings.iterator(); i.hasNext() && !found;) { DataValiditySettingsRecord dvsr = (DataValiditySettingsRecord) i.next(); if (dvsr.getFirstColumn() == col && dvsr.getFirstRow() == row) { found = true; foundRecord = dvsr; } } return foundRecord; }
/** * Used during the copy process to retrieve the validity settings for * a particular cell */
Used during the copy process to retrieve the validity settings for a particular cell
getDataValiditySettings
{ "repo_name": "stefandmn/AREasy", "path": "src/java/org/areasy/common/parser/excel/biff/DataValidation.java", "license": "lgpl-3.0", "size": 8215 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
270,698
public boolean isPrivate() { for(Modifier m : modifiers) { if(m instanceof Modifier.Private) { return true; } } return false; } } public static class InitialiserBlock extends Stmt.Block implements Decl { public InitialiserBlock(List<Stmt> statements, SyntacticAttribute... attributes) { super(statements,attributes); } } public static class StaticInitialiserBlock extends Stmt.Block implements Decl { public StaticInitialiserBlock(List<Stmt> statements, SyntacticAttribute... attributes) { super(statements,attributes); } }
boolean function() { for(Modifier m : modifiers) { if(m instanceof Modifier.Private) { return true; } } return false; } } public static class InitialiserBlock extends Stmt.Block implements Decl { public InitialiserBlock(List<Stmt> statements, SyntacticAttribute... attributes) { super(statements,attributes); } } public static class StaticInitialiserBlock extends Stmt.Block implements Decl { public StaticInitialiserBlock(List<Stmt> statements, SyntacticAttribute... attributes) { super(statements,attributes); } }
/** * Check whether this field is private */
Check whether this field is private
isPrivate
{ "repo_name": "DavePearce/jkit", "path": "jkit/java/tree/Decl.java", "license": "gpl-2.0", "size": 17063 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
601,115
TypeConstraintMappingContext<C> defaultGroupSequenceProviderClass( Class<? extends DefaultGroupSequenceProvider<? super C>> defaultGroupSequenceProviderClass);
TypeConstraintMappingContext<C> defaultGroupSequenceProviderClass( Class<? extends DefaultGroupSequenceProvider<? super C>> defaultGroupSequenceProviderClass);
/** * Defines the default group sequence provider for the current type. * * @param defaultGroupSequenceProviderClass The default group sequence provider class. * * @return The current creational context following the method chaining pattern. */
Defines the default group sequence provider for the current type
defaultGroupSequenceProviderClass
{ "repo_name": "DavideD/hibernate-validator", "path": "engine/src/main/java/org/hibernate/validator/cfg/context/TypeConstraintMappingContext.java", "license": "apache-2.0", "size": 1973 }
[ "org.hibernate.validator.spi.group.DefaultGroupSequenceProvider" ]
import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;
import org.hibernate.validator.spi.group.*;
[ "org.hibernate.validator" ]
org.hibernate.validator;
2,376,644
@JsonProperty("id") public void setId(String id) { this.id = id; }
@JsonProperty("id") void function(String id) { this.id = id; }
/** * Release ID * <p> * An identifier for this particular release of information. A release identifier must be unique within the scope * of its related contracting process (defined by a common ocid), and unique within any release package it * appears in. A release identifier must not contain the # character. * (Required) */
Release ID An identifier for this particular release of information. A release identifier must be unique within the scope of its related contracting process (defined by a common ocid), and unique within any release package it appears in. A release identifier must not contain the # character. (Required)
setId
{ "repo_name": "devgateway/ocua", "path": "persistence-mongodb/src/main/java/org/devgateway/ocds/persistence/mongo/Release.java", "license": "mit", "size": 24880 }
[ "com.fasterxml.jackson.annotation.JsonProperty" ]
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.*;
[ "com.fasterxml.jackson" ]
com.fasterxml.jackson;
956,741
public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( com.azure.resourcemanager.mysql.MySqlManager manager) { ServerSecurityAlertPolicy resource = manager .serverSecurityAlertPolicies() .getWithResponse( "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) .getValue(); resource.update().withState(ServerSecurityAlertPolicyState.DISABLED).withEmailAccountAdmins(true).apply(); }
static void function( com.azure.resourcemanager.mysql.MySqlManager manager) { ServerSecurityAlertPolicy resource = manager .serverSecurityAlertPolicies() .getWithResponse( STR, STR, SecurityAlertPolicyName.DEFAULT, Context.NONE) .getValue(); resource.update().withState(ServerSecurityAlertPolicyState.DISABLED).withEmailAccountAdmins(true).apply(); }
/** * Sample code: Update a server's threat detection policy with minimal parameters. * * @param manager Entry point to MySqlManager. */
Sample code: Update a server's threat detection policy with minimal parameters
updateAServerSThreatDetectionPolicyWithMinimalParameters
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mysql/azure-resourcemanager-mysql/src/samples/java/com/azure/resourcemanager/mysql/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java", "license": "mit", "size": 2841 }
[ "com.azure.core.util.Context", "com.azure.resourcemanager.mysql.models.SecurityAlertPolicyName", "com.azure.resourcemanager.mysql.models.ServerSecurityAlertPolicy", "com.azure.resourcemanager.mysql.models.ServerSecurityAlertPolicyState" ]
import com.azure.core.util.Context; import com.azure.resourcemanager.mysql.models.SecurityAlertPolicyName; import com.azure.resourcemanager.mysql.models.ServerSecurityAlertPolicy; import com.azure.resourcemanager.mysql.models.ServerSecurityAlertPolicyState;
import com.azure.core.util.*; import com.azure.resourcemanager.mysql.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
130,645
private static RatingWriter createFilters(RatingWriter lastWriter, Optional<Integer> maxUsers, Optional<Integer> minRatingsByMovie, Optional<UserSimilarityType> similarityType, Optional<Integer> minCommonRatings, Optional<String> targetUser) { RatingWriter nextWriter = lastWriter; if (minRatingsByMovie.isPresent()) { nextWriter = new MinRatingByMovieFilter(nextWriter, minRatingsByMovie.get()); } if (maxUsers.isPresent()) { if (similarityType.isPresent()) { nextWriter = new MaxNeighborUserFilter(nextWriter, targetUser.get(), maxUsers.get(), similarityType.get()); } else { nextWriter = new MaxUserFilter(nextWriter, maxUsers.get()); } } if (minCommonRatings.isPresent()) { checkArgument(targetUser.isPresent(), "The user parameter is missing."); nextWriter = new MinCommonRatingFilter(nextWriter, targetUser.get(), minCommonRatings.get()); } nextWriter = new ScaleValueWriter(nextWriter); nextWriter = new DuplicateRemover(nextWriter); nextWriter = new UnivalueRemover(nextWriter); return nextWriter; }
static RatingWriter function(RatingWriter lastWriter, Optional<Integer> maxUsers, Optional<Integer> minRatingsByMovie, Optional<UserSimilarityType> similarityType, Optional<Integer> minCommonRatings, Optional<String> targetUser) { RatingWriter nextWriter = lastWriter; if (minRatingsByMovie.isPresent()) { nextWriter = new MinRatingByMovieFilter(nextWriter, minRatingsByMovie.get()); } if (maxUsers.isPresent()) { if (similarityType.isPresent()) { nextWriter = new MaxNeighborUserFilter(nextWriter, targetUser.get(), maxUsers.get(), similarityType.get()); } else { nextWriter = new MaxUserFilter(nextWriter, maxUsers.get()); } } if (minCommonRatings.isPresent()) { checkArgument(targetUser.isPresent(), STR); nextWriter = new MinCommonRatingFilter(nextWriter, targetUser.get(), minCommonRatings.get()); } nextWriter = new ScaleValueWriter(nextWriter); nextWriter = new DuplicateRemover(nextWriter); nextWriter = new UnivalueRemover(nextWriter); return nextWriter; }
/** * Interposes the necessary filters before the last writer, according to the given parameters. */
Interposes the necessary filters before the last writer, according to the given parameters
createFilters
{ "repo_name": "norbertdev/mynemo", "path": "src/main/java/norbert/mynemo/dataimport/FileImporter.java", "license": "apache-2.0", "size": 8061 }
[ "com.google.common.base.Optional", "com.google.common.base.Preconditions", "norbert.mynemo.dataimport.fileformat.output.DuplicateRemover", "norbert.mynemo.dataimport.fileformat.output.MaxNeighborUserFilter", "norbert.mynemo.dataimport.fileformat.output.MaxUserFilter", "norbert.mynemo.dataimport.fileformat.output.MinCommonRatingFilter", "norbert.mynemo.dataimport.fileformat.output.MinRatingByMovieFilter", "norbert.mynemo.dataimport.fileformat.output.RatingWriter", "norbert.mynemo.dataimport.fileformat.output.ScaleValueWriter", "norbert.mynemo.dataimport.fileformat.output.UnivalueRemover", "norbert.mynemo.dataimport.fileformat.output.UserSimilarityType" ]
import com.google.common.base.Optional; import com.google.common.base.Preconditions; import norbert.mynemo.dataimport.fileformat.output.DuplicateRemover; import norbert.mynemo.dataimport.fileformat.output.MaxNeighborUserFilter; import norbert.mynemo.dataimport.fileformat.output.MaxUserFilter; import norbert.mynemo.dataimport.fileformat.output.MinCommonRatingFilter; import norbert.mynemo.dataimport.fileformat.output.MinRatingByMovieFilter; import norbert.mynemo.dataimport.fileformat.output.RatingWriter; import norbert.mynemo.dataimport.fileformat.output.ScaleValueWriter; import norbert.mynemo.dataimport.fileformat.output.UnivalueRemover; import norbert.mynemo.dataimport.fileformat.output.UserSimilarityType;
import com.google.common.base.*; import norbert.mynemo.dataimport.fileformat.output.*;
[ "com.google.common", "norbert.mynemo.dataimport" ]
com.google.common; norbert.mynemo.dataimport;
1,632,030
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False") @SimpleProperty public void ReleasedEventEnabled(boolean enabled) { releasedEventEnabled = enabled; }
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_BOOLEAN, defaultValue = "False") void function(boolean enabled) { releasedEventEnabled = enabled; }
/** * Specifies whether the Released event should fire when the touch sensor is * released. */
Specifies whether the Released event should fire when the touch sensor is released
ReleasedEventEnabled
{ "repo_name": "afmckinney/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Ev3TouchSensor.java", "license": "apache-2.0", "size": 6044 }
[ "com.google.appinventor.components.annotations.DesignerProperty", "com.google.appinventor.components.common.PropertyTypeConstants" ]
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*;
[ "com.google.appinventor" ]
com.google.appinventor;
826,390
public PaillierInteger fakeEncrypt (BigInteger plaintext) { return new PaillierInteger (g.modPow(plaintext, nsquare), this.nsquare); }
PaillierInteger function (BigInteger plaintext) { return new PaillierInteger (g.modPow(plaintext, nsquare), this.nsquare); }
/** Fakes the encryption of an integer * @param plaintext plaintext integer * @return cyphertext */
Fakes the encryption of an integer
fakeEncrypt
{ "repo_name": "heniancheng/FRODO", "path": "src/frodo2/algorithms/mpc_discsp/PaillierPublicKey.java", "license": "agpl-3.0", "size": 3343 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,686,710
private String getReplicaInfo(BlockInfo storedBlock) { if (!(showLocations || showRacks || showReplicaDetails || showUpgradeDomains)) { return ""; } final boolean isComplete = storedBlock.isComplete(); Iterator<DatanodeStorageInfo> storagesItr; StringBuilder sb = new StringBuilder(" ["); final boolean isStriped = storedBlock.isStriped(); Map<DatanodeStorageInfo, Long> storage2Id = new HashMap<>(); if (isComplete) { if (isStriped) { long blockId = storedBlock.getBlockId(); Iterable<StorageAndBlockIndex> sis = ((BlockInfoStriped) storedBlock).getStorageAndIndexInfos(); for (StorageAndBlockIndex si : sis) { storage2Id.put(si.getStorage(), blockId + si.getBlockIndex()); } } storagesItr = storedBlock.getStorageInfos(); } else { storagesItr = storedBlock.getUnderConstructionFeature() .getExpectedStorageLocationsIterator(); } while (storagesItr.hasNext()) { DatanodeStorageInfo storage = storagesItr.next(); if (isStriped && isComplete) { long index = storage2Id.get(storage); sb.append("blk_" + index + ":"); } DatanodeDescriptor dnDesc = storage.getDatanodeDescriptor(); if (showRacks) { sb.append(NodeBase.getPath(dnDesc)); } else { sb.append(new DatanodeInfoWithStorage(dnDesc, storage.getStorageID(), storage.getStorageType())); } if (showUpgradeDomains) { String upgradeDomain = (dnDesc.getUpgradeDomain() != null) ? dnDesc.getUpgradeDomain() : UNDEFINED; sb.append("(ud=" + upgradeDomain +")"); } if (showReplicaDetails) { Collection<DatanodeDescriptor> corruptReplicas = blockManager.getCorruptReplicas(storedBlock); sb.append("("); if (dnDesc.isDecommissioned()) { sb.append("DECOMMISSIONED)"); } else if (dnDesc.isDecommissionInProgress()) { sb.append("DECOMMISSIONING)"); } else if (this.showMaintenanceState && dnDesc.isEnteringMaintenance()) { sb.append("ENTERING MAINTENANCE)"); } else if (this.showMaintenanceState && dnDesc.isInMaintenance()) { sb.append("IN MAINTENANCE)"); } else if (corruptReplicas != null && corruptReplicas.contains(dnDesc)) { sb.append("CORRUPT)"); } else if (blockManager.isExcess(dnDesc, storedBlock)) { sb.append("EXCESS)"); } else if (dnDesc.isStale(this.staleInterval)) { sb.append("STALE_NODE)"); } else if (storage.areBlockContentsStale()) { sb.append("STALE_BLOCK_CONTENT)"); } else { sb.append("LIVE)"); } } if (storagesItr.hasNext()) { sb.append(", "); } } sb.append(']'); return sb.toString(); }
String function(BlockInfo storedBlock) { if (!(showLocations showRacks showReplicaDetails showUpgradeDomains)) { return STR [STRblk_STR:STR(ud=STR)STR(STRDECOMMISSIONED)STRDECOMMISSIONING)STRENTERING MAINTENANCE)STRIN MAINTENANCE)STRCORRUPT)STREXCESS)STRSTALE_NODE)STRSTALE_BLOCK_CONTENT)STRLIVE)STR, "); } } sb.append(']'); return sb.toString(); }
/** * Display info of each replica for replication block. * For striped block group, display info of each internal block. */
Display info of each replica for replication block. For striped block group, display info of each internal block
getReplicaInfo
{ "repo_name": "plusplusjiajia/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java", "license": "apache-2.0", "size": 56834 }
[ "org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo" ]
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo;
import org.apache.hadoop.hdfs.server.blockmanagement.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
757,405
private void renderAnimations() { Keyframe kf0, kf1; // Set up animator for disappearing. kf0 = Keyframe.ofFloat(0f, 1f); kf1 = Keyframe.ofFloat(1f, 0.8f); PropertyValuesHolder radius = PropertyValuesHolder.ofKeyframe( "animationRadiusMultiplier", kf0, kf1); kf0 = Keyframe.ofFloat(0f, 1f); kf1 = Keyframe.ofFloat(1f, 0f); PropertyValuesHolder fade = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1); kf0 = Keyframe.ofFloat(0f, 0f); kf1 = Keyframe.ofFloat(1f, 70f); PropertyValuesHolder rotation = PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1); mDisappearAnimator = ObjectAnimator.ofPropertyValuesHolder( this, radius, fade, rotation).setDuration(300); mDisappearAnimator.addUpdateListener(mInvalidateUpdateListener); // Set up animator for reappearing. kf0 = Keyframe.ofFloat(0f, 0.8f); kf1 = Keyframe.ofFloat(1f, 1f); radius = PropertyValuesHolder.ofKeyframe( "animationRadiusMultiplier", kf0, kf1); kf0 = Keyframe.ofFloat(0f, 0f); kf1 = Keyframe.ofFloat(1f, 1f); fade = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1); kf0 = Keyframe.ofFloat(0f, -70f); kf1 = Keyframe.ofFloat(1f, 0f); rotation = PropertyValuesHolder.ofKeyframe("rotation", kf0, kf1); mReappearAnimator = ObjectAnimator.ofPropertyValuesHolder( this, radius, fade, rotation).setDuration(300); mReappearAnimator.addUpdateListener(mInvalidateUpdateListener); }
void function() { Keyframe kf0, kf1; kf0 = Keyframe.ofFloat(0f, 1f); kf1 = Keyframe.ofFloat(1f, 0.8f); PropertyValuesHolder radius = PropertyValuesHolder.ofKeyframe( STR, kf0, kf1); kf0 = Keyframe.ofFloat(0f, 1f); kf1 = Keyframe.ofFloat(1f, 0f); PropertyValuesHolder fade = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1); kf0 = Keyframe.ofFloat(0f, 0f); kf1 = Keyframe.ofFloat(1f, 70f); PropertyValuesHolder rotation = PropertyValuesHolder.ofKeyframe(STR, kf0, kf1); mDisappearAnimator = ObjectAnimator.ofPropertyValuesHolder( this, radius, fade, rotation).setDuration(300); mDisappearAnimator.addUpdateListener(mInvalidateUpdateListener); kf0 = Keyframe.ofFloat(0f, 0.8f); kf1 = Keyframe.ofFloat(1f, 1f); radius = PropertyValuesHolder.ofKeyframe( STR, kf0, kf1); kf0 = Keyframe.ofFloat(0f, 0f); kf1 = Keyframe.ofFloat(1f, 1f); fade = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1); kf0 = Keyframe.ofFloat(0f, -70f); kf1 = Keyframe.ofFloat(1f, 0f); rotation = PropertyValuesHolder.ofKeyframe(STR, kf0, kf1); mReappearAnimator = ObjectAnimator.ofPropertyValuesHolder( this, radius, fade, rotation).setDuration(300); mReappearAnimator.addUpdateListener(mInvalidateUpdateListener); }
/** * Render the animations for appearing and disappearing. */
Render the animations for appearing and disappearing
renderAnimations
{ "repo_name": "0359xiaodong/HoloEverywhere", "path": "library/src/org/holoeverywhere/widget/datetimepicker/time/RadialTextsView.java", "license": "mit", "size": 15092 }
[ "com.nineoldandroids.animation.Keyframe", "com.nineoldandroids.animation.ObjectAnimator", "com.nineoldandroids.animation.PropertyValuesHolder" ]
import com.nineoldandroids.animation.Keyframe; import com.nineoldandroids.animation.ObjectAnimator; import com.nineoldandroids.animation.PropertyValuesHolder;
import com.nineoldandroids.animation.*;
[ "com.nineoldandroids.animation" ]
com.nineoldandroids.animation;
330,792
public static long addCompletedDownload(File file) { String title = file.getName(); String path = file.getPath(); long length = file.length(); return DownloadUtils.addCompletedDownload( title, title, getImageMimeType(file), path, length, null, null); }
static long function(File file) { String title = file.getName(); String path = file.getPath(); long length = file.length(); return DownloadUtils.addCompletedDownload( title, title, getImageMimeType(file), path, length, null, null); }
/** * This is a pass through to the {@link AndroidDownloadManager} function of the same name. * @param file The File corresponding to the download. * @return the download ID of this item as assigned by the download manager. */
This is a pass through to the <code>AndroidDownloadManager</code> function of the same name
addCompletedDownload
{ "repo_name": "chromium/chromium", "path": "components/browser_ui/share/android/java/src/org/chromium/components/browser_ui/share/ShareImageFileUtils.java", "license": "bsd-3-clause", "size": 23375 }
[ "java.io.File", "org.chromium.components.browser_ui.util.DownloadUtils" ]
import java.io.File; import org.chromium.components.browser_ui.util.DownloadUtils;
import java.io.*; import org.chromium.components.browser_ui.util.*;
[ "java.io", "org.chromium.components" ]
java.io; org.chromium.components;
371,549
public static NativeDaemonEvent parseRawEvent(String rawEvent, FileDescriptor[] fdList) { final String[] parsed = rawEvent.split(" "); if (parsed.length < 2) { throw new IllegalArgumentException("Insufficient arguments"); } int skiplength = 0; final int code; try { code = Integer.parseInt(parsed[0]); skiplength = parsed[0].length() + 1; } catch (NumberFormatException e) { throw new IllegalArgumentException("problem parsing code", e); } int cmdNumber = -1; if (isClassUnsolicited(code) == false) { if (parsed.length < 3) { throw new IllegalArgumentException("Insufficient arguemnts"); } try { cmdNumber = Integer.parseInt(parsed[1]); skiplength += parsed[1].length() + 1; } catch (NumberFormatException e) { throw new IllegalArgumentException("problem parsing cmdNumber", e); } } String logMessage = rawEvent; if (parsed.length > 2 && parsed[2].equals(SENSITIVE_MARKER)) { skiplength += parsed[2].length() + 1; logMessage = parsed[0] + " " + parsed[1] + " {}"; } final String message = rawEvent.substring(skiplength); return new NativeDaemonEvent(cmdNumber, code, message, rawEvent, logMessage, fdList); }
static NativeDaemonEvent function(String rawEvent, FileDescriptor[] fdList) { final String[] parsed = rawEvent.split(" "); if (parsed.length < 2) { throw new IllegalArgumentException(STR); } int skiplength = 0; final int code; try { code = Integer.parseInt(parsed[0]); skiplength = parsed[0].length() + 1; } catch (NumberFormatException e) { throw new IllegalArgumentException(STR, e); } int cmdNumber = -1; if (isClassUnsolicited(code) == false) { if (parsed.length < 3) { throw new IllegalArgumentException(STR); } try { cmdNumber = Integer.parseInt(parsed[1]); skiplength += parsed[1].length() + 1; } catch (NumberFormatException e) { throw new IllegalArgumentException(STR, e); } } String logMessage = rawEvent; if (parsed.length > 2 && parsed[2].equals(SENSITIVE_MARKER)) { skiplength += parsed[2].length() + 1; logMessage = parsed[0] + " " + parsed[1] + STR; } final String message = rawEvent.substring(skiplength); return new NativeDaemonEvent(cmdNumber, code, message, rawEvent, logMessage, fdList); }
/** * Parse the given raw event into {@link NativeDaemonEvent} instance. * * @throws IllegalArgumentException when line doesn't match format expected * from native side. */
Parse the given raw event into <code>NativeDaemonEvent</code> instance
parseRawEvent
{ "repo_name": "xorware/android_frameworks_base", "path": "services/core/java/com/android/server/NativeDaemonEvent.java", "license": "apache-2.0", "size": 8615 }
[ "java.io.FileDescriptor" ]
import java.io.FileDescriptor;
import java.io.*;
[ "java.io" ]
java.io;
1,977,572
private void writeAttribute(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } }
void function(java.lang.String namespace,java.lang.String attName, java.lang.String attValue,javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException{ if (namespace.equals("")) { xmlWriter.writeAttribute(attName,attValue); } else { registerPrefix(xmlWriter, namespace); xmlWriter.writeAttribute(namespace,attName,attValue); } }
/** * Util method to write an attribute without the ns prefix */
Util method to write an attribute without the ns prefix
writeAttribute
{ "repo_name": "sandamal/wso2-axis2", "path": "modules/adb/src/org/apache/axis2/databinding/types/soapencoding/NMTOKEN.java", "license": "apache-2.0", "size": 21097 }
[ "javax.xml.stream.XMLStreamWriter" ]
import javax.xml.stream.XMLStreamWriter;
import javax.xml.stream.*;
[ "javax.xml" ]
javax.xml;
995,663
public void logStatistics() { LOG.info("Transaction Statistics: write pointer = " + lastWritePointer + ", invalid = " + invalid.size() + ", in progress = " + inProgress.size() + ", committing = " + committingChangeSets.size() + ", committed = " + committedChangeSets.size()); } private abstract static class DaemonThreadExecutor extends Thread { private AtomicBoolean stopped = new AtomicBoolean(false); public DaemonThreadExecutor(String name) { super(name); setDaemon(true); }
void function() { LOG.info(STR + lastWritePointer + STR + invalid.size() + STR + inProgress.size() + STR + committingChangeSets.size() + STR + committedChangeSets.size()); } private abstract static class DaemonThreadExecutor extends Thread { private AtomicBoolean stopped = new AtomicBoolean(false); public DaemonThreadExecutor(String name) { super(name); setDaemon(true); }
/** * Called from the tx service every 10 seconds. * This hack is needed because current metrics system is not flexible when it comes to adding new metrics. */
Called from the tx service every 10 seconds. This hack is needed because current metrics system is not flexible when it comes to adding new metrics
logStatistics
{ "repo_name": "StackVista/tephra", "path": "tephra-core/src/main/java/co/cask/tephra/TransactionManager.java", "license": "apache-2.0", "size": 40790 }
[ "java.util.concurrent.atomic.AtomicBoolean" ]
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.*;
[ "java.util" ]
java.util;
1,056,497
public boolean isLocked() { return getSplitterState(false).locked; } public interface SplitterClickListener extends ConnectorEventListener { public static final Method clickMethod = ReflectTools.findMethod( SplitterClickListener.class, "splitterClick", SplitterClickEvent.class);
boolean function() { return getSplitterState(false).locked; } public interface SplitterClickListener extends ConnectorEventListener { public static final Method clickMethod = ReflectTools.findMethod( SplitterClickListener.class, STR, SplitterClickEvent.class);
/** * Is the SplitPanel handle locked (user not allowed to change split * position by dragging). * * @return <code>true</code> if locked, <code>false</code> otherwise. */
Is the SplitPanel handle locked (user not allowed to change split position by dragging)
isLocked
{ "repo_name": "carrchang/vaadin", "path": "server/src/com/vaadin/ui/AbstractSplitPanel.java", "license": "apache-2.0", "size": 25264 }
[ "com.vaadin.event.ConnectorEventListener", "com.vaadin.util.ReflectTools", "java.lang.reflect.Method" ]
import com.vaadin.event.ConnectorEventListener; import com.vaadin.util.ReflectTools; import java.lang.reflect.Method;
import com.vaadin.event.*; import com.vaadin.util.*; import java.lang.reflect.*;
[ "com.vaadin.event", "com.vaadin.util", "java.lang" ]
com.vaadin.event; com.vaadin.util; java.lang;
1,476,718
public static boolean isConfigurationCandidate(AnnotationMetadata metadata) { return (isFullConfigurationCandidate(metadata) || isLiteConfigurationCandidate(metadata)); }
static boolean function(AnnotationMetadata metadata) { return (isFullConfigurationCandidate(metadata) isLiteConfigurationCandidate(metadata)); }
/** * Check the given metadata for a configuration class candidate * (or nested component class declared within a configuration/component class). * @param metadata the metadata of the annotated class * @return {@code true} if the given class is to be registered as a * reflection-detected bean definition; {@code false} otherwise */
Check the given metadata for a configuration class candidate (or nested component class declared within a configuration/component class)
isConfigurationCandidate
{ "repo_name": "boggad/jdk9-sample", "path": "sample-catalog/src/main/spring.context/org/springframework/context/annotation/ConfigurationClassUtils.java", "license": "mit", "size": 8288 }
[ "org.springframework.core.type.AnnotationMetadata" ]
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.core.type.*;
[ "org.springframework.core" ]
org.springframework.core;
88,595
public void setThumbColor(int thumbColor, int indicatorColor) { mThumb.setColorStateList(ColorStateList.valueOf(thumbColor)); mIndicator.setColors(indicatorColor, thumbColor); }
void function(int thumbColor, int indicatorColor) { mThumb.setColorStateList(ColorStateList.valueOf(thumbColor)); mIndicator.setColors(indicatorColor, thumbColor); }
/** * Sets the color of the seek thumb, as well as the color of the popup indicator. * * @param thumbColor The color the seek thumb will be changed to * @param indicatorColor The color the popup indicator will be changed to * The indicator will animate from thumbColor to indicatorColor * when opening */
Sets the color of the seek thumb, as well as the color of the popup indicator
setThumbColor
{ "repo_name": "DangHoach/Camera2Video", "path": "Application/src/main/java/com/example/android/camera2video/DiscreteSeekBar.java", "license": "apache-2.0", "size": 36259 }
[ "android.content.res.ColorStateList" ]
import android.content.res.ColorStateList;
import android.content.res.*;
[ "android.content" ]
android.content;
1,760,575
private File getCacheDir() { // Get the root cache dir File cacheDir = new File(configuration.getOptimizerCacheDir()); if (!cacheDir.exists()) { cacheDir.mkdir(); } // Get the directory that represent the host directory // return FootprintGenerator.footprint(getMandatory(P_ROX_URL)); File roxCacheDir = new File(cacheDir, configuration.getServerConfiguration().getBaseUrlFootprint()); if (!roxCacheDir.exists()) { roxCacheDir.mkdirs(); } return roxCacheDir; }
File function() { File cacheDir = new File(configuration.getOptimizerCacheDir()); if (!cacheDir.exists()) { cacheDir.mkdir(); } File roxCacheDir = new File(cacheDir, configuration.getServerConfiguration().getBaseUrlFootprint()); if (!roxCacheDir.exists()) { roxCacheDir.mkdirs(); } return roxCacheDir; }
/** * Get the cache directory. if not exist, it is created and returned. * * @return The cache base directory */
Get the cache directory. if not exist, it is created and returned
getCacheDir
{ "repo_name": "lotaris/rox-client-java", "path": "rox-client-java/src/main/java/com/lotaris/rox/core/cache/CacheOptimizerStore.java", "license": "mit", "size": 6463 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,237,871
@Override public void setRangeZoomable(boolean flag) { if (flag) { Plot plot = this.chart.getPlot(); if (plot instanceof Zoomable) { Zoomable z = (Zoomable) plot; this.rangeZoomable = flag && (z.isRangeZoomable()); } } else { this.rangeZoomable = false; } }
void function(boolean flag) { if (flag) { Plot plot = this.chart.getPlot(); if (plot instanceof Zoomable) { Zoomable z = (Zoomable) plot; this.rangeZoomable = flag && (z.isRangeZoomable()); } } else { this.rangeZoomable = false; } }
/** * A flag that controls mouse-based zooming on the vertical axis. * * @param flag * <code>true</code> enables zooming. */
A flag that controls mouse-based zooming on the vertical axis
setRangeZoomable
{ "repo_name": "aborg0/RapidMiner-Unuk", "path": "src/com/rapidminer/gui/plotter/charts/AbstractChartPanel.java", "license": "agpl-3.0", "size": 82675 }
[ "org.jfree.chart.plot.Plot", "org.jfree.chart.plot.Zoomable" ]
import org.jfree.chart.plot.Plot; import org.jfree.chart.plot.Zoomable;
import org.jfree.chart.plot.*;
[ "org.jfree.chart" ]
org.jfree.chart;
808,463
public Drawable getBadgeDrawable() { return mBadgeView.getDrawable(); }
Drawable function() { return mBadgeView.getDrawable(); }
/** * Returns the badge drawable. */
Returns the badge drawable
getBadgeDrawable
{ "repo_name": "kingargyle/adt-leanback-support", "path": "leanback-v17/src/main/java/android/support/v17/leanback/widget/TitleView.java", "license": "apache-2.0", "size": 3653 }
[ "android.graphics.drawable.Drawable" ]
import android.graphics.drawable.Drawable;
import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
2,441,905
public static void copy(Reader reader, boolean closeIn, Appendable out) throws IOException { try { CharBuffer buffer = CharBuffer.allocate(4096); while (reader.read(buffer) > 0) { buffer.flip(); buffer.rewind(); out.append(buffer); } } finally { if (closeIn) IOUtils.closeQuietly(reader); } }
static void function(Reader reader, boolean closeIn, Appendable out) throws IOException { try { CharBuffer buffer = CharBuffer.allocate(4096); while (reader.read(buffer) > 0) { buffer.flip(); buffer.rewind(); out.append(buffer); } } finally { if (closeIn) IOUtils.closeQuietly(reader); } }
/** Copy a Reader to an Appendable, optionally closing the input. * * @param reader the Reader to copy from * @param closeIn whether to close the input when the copy is done * @param out the Appendable to copy to * @throws IOException if an error occurs */
Copy a Reader to an Appendable, optionally closing the input
copy
{ "repo_name": "yuri0x7c1/ofbiz-explorer", "path": "src/test/resources/apache-ofbiz-16.11.03/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilIO.java", "license": "apache-2.0", "size": 12703 }
[ "java.io.IOException", "java.io.Reader", "java.nio.CharBuffer", "org.apache.commons.io.IOUtils" ]
import java.io.IOException; import java.io.Reader; import java.nio.CharBuffer; import org.apache.commons.io.IOUtils;
import java.io.*; import java.nio.*; import org.apache.commons.io.*;
[ "java.io", "java.nio", "org.apache.commons" ]
java.io; java.nio; org.apache.commons;
1,923,516
void storeAggregatedPartitionClassStorageStats( AggregatedPartitionClassStorageStats aggregatedPartitionClassStorageStats) throws Exception;
void storeAggregatedPartitionClassStorageStats( AggregatedPartitionClassStorageStats aggregatedPartitionClassStorageStats) throws Exception;
/** * Store the aggregated partition class storage stats in the {@link AggregatedPartitionClassStorageStats}. * @param aggregatedPartitionClassStorageStats The {@link AggregatedPartitionClassStorageStats} that contains aggregated * partition class container storage stats. * @throws Exception */
Store the aggregated partition class storage stats in the <code>AggregatedPartitionClassStorageStats</code>
storeAggregatedPartitionClassStorageStats
{ "repo_name": "linkedin/ambry", "path": "ambry-api/src/main/java/com/github/ambry/accountstats/AccountStatsStore.java", "license": "apache-2.0", "size": 7693 }
[ "com.github.ambry.server.storagestats.AggregatedPartitionClassStorageStats" ]
import com.github.ambry.server.storagestats.AggregatedPartitionClassStorageStats;
import com.github.ambry.server.storagestats.*;
[ "com.github.ambry" ]
com.github.ambry;
2,769,753
public void enqueueOutboundBlock(TcpClDataBlock block) throws InterruptedException { if (GeneralManagement.isDebugLogging()) { _logger.finer("enqueueOutboundBlock"); } _initiatorStateMachine.enqueueOutboundBlock(block); if (GeneralManagement.isDebugLogging()) { _logger.finer("enqueueOutboundBlock DONE"); } }
void function(TcpClDataBlock block) throws InterruptedException { if (GeneralManagement.isDebugLogging()) { _logger.finer(STR); } _initiatorStateMachine.enqueueOutboundBlock(block); if (GeneralManagement.isDebugLogging()) { _logger.finer(STR); } }
/** * Request from upper layer to transmit given Data Block * @param block Given Data Block * @throws InterruptedException if interrupted waiting for queue space */
Request from upper layer to transmit given Data Block
enqueueOutboundBlock
{ "repo_name": "KritikalFabric/corefabric.io", "path": "src/contrib/java/com/cisco/qte/jdtn/tcpcl/TcpClNeighbor.java", "license": "apache-2.0", "size": 21509 }
[ "com.cisco.qte.jdtn.general.GeneralManagement" ]
import com.cisco.qte.jdtn.general.GeneralManagement;
import com.cisco.qte.jdtn.general.*;
[ "com.cisco.qte" ]
com.cisco.qte;
1,621,429
Observable<WorkflowTrigger> listAsync(final String resourceGroupName, final String workflowName);
Observable<WorkflowTrigger> listAsync(final String resourceGroupName, final String workflowName);
/** * Gets a list of workflow triggers. * * @param resourceGroupName The resource group name. * @param workflowName The workflow name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Gets a list of workflow triggers
listAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/logic/mgmt-v2018_07_01_preview/src/main/java/com/microsoft/azure/management/logic/v2018_07_01_preview/WorkflowTriggers.java", "license": "mit", "size": 3814 }
[ "com.microsoft.azure.management.logic.v2018_07_01_preview.WorkflowTrigger" ]
import com.microsoft.azure.management.logic.v2018_07_01_preview.WorkflowTrigger;
import com.microsoft.azure.management.logic.v2018_07_01_preview.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,439,482
byte[] generateDirectMethodHandleHolderClassBytes(String className, MethodType[] methodTypes, int[] types);
byte[] generateDirectMethodHandleHolderClassBytes(String className, MethodType[] methodTypes, int[] types);
/** * Returns a {@code byte[]} containing the bytecode for a class implementing * DirectMethodHandle of each pairwise combination of {@code MethodType} and * an {@code int} representing method type. Used by * GenerateJLIClassesPlugin to generate such a class during the jlink phase. */
Returns a byte[] containing the bytecode for a class implementing DirectMethodHandle of each pairwise combination of MethodType and an int representing method type. Used by GenerateJLIClassesPlugin to generate such a class during the jlink phase
generateDirectMethodHandleHolderClassBytes
{ "repo_name": "FauxFaux/jdk9-jdk", "path": "src/java.base/share/classes/jdk/internal/misc/JavaLangInvokeAccess.java", "license": "gpl-2.0", "size": 3287 }
[ "java.lang.invoke.MethodType" ]
import java.lang.invoke.MethodType;
import java.lang.invoke.*;
[ "java.lang" ]
java.lang;
2,075,855
private void getPublicRepComments( final HttpServletRequest request, final HttpServletResponse response ) throws IOException { final String sha1 = request.getParameter( PARAM_SHA1 ); final Integer offset = request.getParameter( PARAM_OFFSET ) == null ? 0 : getIntParam( request, PARAM_OFFSET ); final Integer limit = request.getParameter( PARAM_LIMIT ) == null ? 10 : getIntParam( request, PARAM_LIMIT ); final String timeZone = request.getParameter( PARAM_TIME_ZONE ); if ( sha1 == null || sha1.isEmpty() ) { LOGGER.warning( "Missing parameters!" ); response.sendError( HttpServletResponse.SC_BAD_REQUEST, "Missing parameters!" ); return; } if ( offset == null || offset < 0 ) { LOGGER.warning( "Invalid Offset: " + offset ); response.sendError( HttpServletResponse.SC_BAD_REQUEST, "Invalid Offset!" ); return; } if ( limit == null || limit < 0 || limit > MAX_LIMIT_VALUE ) { LOGGER.warning( "Invalid Limit: " + limit ); response.sendError( HttpServletResponse.SC_BAD_REQUEST, "Invalid Limit!" ); return; } LOGGER.fine( "sha1: " + sha1 + ", offset: " + offset ); final DateFormat dateFormat = (DateFormat) DATE_FORMAT.clone(); if ( timeZone != null ) dateFormat.setTimeZone( TimeZone.getTimeZone( timeZone ) ); final String userAgent = request.getHeader( "User-Agent" ); final boolean nonJavaClient = userAgent != null && !userAgent.contains( "Java" ); PersistenceManager pm = null; try { pm = PMF.get().getPersistenceManager(); final List< RepComment > repCommentList = new JQBuilder<>( pm, RepComment.class ).filter( "sha1==p1", "String p1" ).desc( "date" ).range( offset, offset + limit ).get( sha1 ); response.setContentType( "text/html" ); // Set no-cache setNoCache( response ); final PrintWriter out = response.getWriter(); out.println( "<html><head>" ); if ( nonJavaClient ) out.println( "<title>Public replay comments - Sc2gears&trade; Database</title>" ); includeDefaultCss( out ); // Include GA tracker code for browsers if ( nonJavaClient ) out.println( GA_TRACKER_HTML_SCRIPT ); out.println( "</head><body>" ); final String range = repCommentList.isEmpty() ? "No more comments." : ( offset + 1 ) + ".." + ( offset + repCommentList.size() ); out.println( "<h3 class=\"h3\">Public replay comments: " + range + "</h3>" ); int counter = offset; for ( final RepComment repComment : repCommentList ) { final boolean hidden = repComment.isHidden(); out.print ( "<br><div class='" ); out.print ( hidden ? "hiddenHeader" : "commentHeader" ); out.print ( "'>&nbsp;#" ); out.print ( ++counter ); out.print ( " &#9658; " ); out.print ( dateFormat.format( repComment.getDate() ) ); out.print ( " &#9658; " ); out.print ( hidden ? "*REMOVED*" : ServerUtils.encodeHtmlString( repComment.getUserName(), false ) ); out.println( "</div><p>" ); out.println( hidden ? "*REMOVED*" : ServerUtils.encodeHtmlString( repComment.getComment().getValue(), true ) ); out.println( "</p>" ); } // Include Footer for browsers if ( nonJavaClient ) out.println( FOOTER_COPYRIGHT_HTML ); out.println( "</body></html>" ); } finally { if ( pm != null ) pm.close(); } }
void function( final HttpServletRequest request, final HttpServletResponse response ) throws IOException { final String sha1 = request.getParameter( PARAM_SHA1 ); final Integer offset = request.getParameter( PARAM_OFFSET ) == null ? 0 : getIntParam( request, PARAM_OFFSET ); final Integer limit = request.getParameter( PARAM_LIMIT ) == null ? 10 : getIntParam( request, PARAM_LIMIT ); final String timeZone = request.getParameter( PARAM_TIME_ZONE ); if ( sha1 == null sha1.isEmpty() ) { LOGGER.warning( STR ); response.sendError( HttpServletResponse.SC_BAD_REQUEST, STR ); return; } if ( offset == null offset < 0 ) { LOGGER.warning( STR + offset ); response.sendError( HttpServletResponse.SC_BAD_REQUEST, STR ); return; } if ( limit == null limit < 0 limit > MAX_LIMIT_VALUE ) { LOGGER.warning( STR + limit ); response.sendError( HttpServletResponse.SC_BAD_REQUEST, STR ); return; } LOGGER.fine( STR + sha1 + STR + offset ); final DateFormat dateFormat = (DateFormat) DATE_FORMAT.clone(); if ( timeZone != null ) dateFormat.setTimeZone( TimeZone.getTimeZone( timeZone ) ); final String userAgent = request.getHeader( STR ); final boolean nonJavaClient = userAgent != null && !userAgent.contains( "Java" ); PersistenceManager pm = null; try { pm = PMF.get().getPersistenceManager(); final List< RepComment > repCommentList = new JQBuilder<>( pm, RepComment.class ).filter( STR, STR ).desc( "date" ).range( offset, offset + limit ).get( sha1 ); response.setContentType( STR ); setNoCache( response ); final PrintWriter out = response.getWriter(); out.println( STR ); if ( nonJavaClient ) out.println( STR ); includeDefaultCss( out ); if ( nonJavaClient ) out.println( GA_TRACKER_HTML_SCRIPT ); out.println( STR ); final String range = repCommentList.isEmpty() ? STR : ( offset + 1 ) + ".." + ( offset + repCommentList.size() ); out.println( STRh3\STR + range + "</h3>" ); int counter = offset; for ( final RepComment repComment : repCommentList ) { final boolean hidden = repComment.isHidden(); out.print ( STR ); out.print ( hidden ? STR : STR ); out.print ( STR ); out.print ( ++counter ); out.print ( STR ); out.print ( dateFormat.format( repComment.getDate() ) ); out.print ( STR ); out.print ( hidden ? STR : ServerUtils.encodeHtmlString( repComment.getUserName(), false ) ); out.println( STR ); out.println( hidden ? STR : ServerUtils.encodeHtmlString( repComment.getComment().getValue(), true ) ); out.println( "</p>" ); } if ( nonJavaClient ) out.println( FOOTER_COPYRIGHT_HTML ); out.println( STR ); } finally { if ( pm != null ) pm.close(); } }
/** * Returns public comments of a replay. * * <p> * Example GET url:<br> * https://sciigears.appspot.com/info?protVer=1&op=getPubRepCom&sha1=fc9f84e5caac72ed8899483508809632b07f5d57&offset=0&limit=10&tzone=Europe%2fBudapest * </p> */
Returns public comments of a replay. Example GET url: HREF
getPublicRepComments
{ "repo_name": "icza/sc2gears", "path": "src-sc2gearsdb/hu/belicza/andras/sc2gearsdb/InfoServlet.java", "license": "apache-2.0", "size": 26806 }
[ "hu.belicza.andras.sc2gearsdb.datastore.RepComment", "hu.belicza.andras.sc2gearsdb.util.JQBuilder", "hu.belicza.andras.sc2gearsdb.util.PMF", "hu.belicza.andras.sc2gearsdb.util.ServerUtils", "java.io.IOException", "java.io.PrintWriter", "java.text.DateFormat", "java.util.List", "java.util.TimeZone", "javax.jdo.PersistenceManager", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import hu.belicza.andras.sc2gearsdb.datastore.RepComment; import hu.belicza.andras.sc2gearsdb.util.JQBuilder; import hu.belicza.andras.sc2gearsdb.util.PMF; import hu.belicza.andras.sc2gearsdb.util.ServerUtils; import java.io.IOException; import java.io.PrintWriter; import java.text.DateFormat; import java.util.List; import java.util.TimeZone; import javax.jdo.PersistenceManager; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import hu.belicza.andras.sc2gearsdb.datastore.*; import hu.belicza.andras.sc2gearsdb.util.*; import java.io.*; import java.text.*; import java.util.*; import javax.jdo.*; import javax.servlet.http.*;
[ "hu.belicza.andras", "java.io", "java.text", "java.util", "javax.jdo", "javax.servlet" ]
hu.belicza.andras; java.io; java.text; java.util; javax.jdo; javax.servlet;
525,813
public ClusterInfo getClusterInfo(String clusterName) throws KeeperException { List<String> clusters = ZKUtil.listChildrenNoWatch(this.zkw, this.clustersZNode); if (clusters != null) { for (String cluster : clusters) { if (cluster.equals(clusterName)) { String address = Bytes .toString(ZKUtil.getData(this.zkw, getClusterAddressZNode(cluster))); if (address != null) { List<ClusterInfo> peers = getPeerClusters(cluster); Set<ClusterInfo> peerSet = new TreeSet<ClusterInfo>(); if (peers != null) { peerSet.addAll(peers); } ClusterInfo ci = new ClusterInfo(cluster, address, peerSet); return ci; } else { return null; } } } } return null; }
ClusterInfo function(String clusterName) throws KeeperException { List<String> clusters = ZKUtil.listChildrenNoWatch(this.zkw, this.clustersZNode); if (clusters != null) { for (String cluster : clusters) { if (cluster.equals(clusterName)) { String address = Bytes .toString(ZKUtil.getData(this.zkw, getClusterAddressZNode(cluster))); if (address != null) { List<ClusterInfo> peers = getPeerClusters(cluster); Set<ClusterInfo> peerSet = new TreeSet<ClusterInfo>(); if (peers != null) { peerSet.addAll(peers); } ClusterInfo ci = new ClusterInfo(cluster, address, peerSet); return ci; } else { return null; } } } } return null; }
/** * Returns the clusterInfo for the given clusterName * @param clusterName * @return * @throws KeeperException */
Returns the clusterInfo for the given clusterName
getClusterInfo
{ "repo_name": "intel-hadoop/CSBT", "path": "csbt-client/src/main/java/org/apache/hadoop/hbase/crosssite/CrossSiteZNodes.java", "license": "apache-2.0", "size": 33331 }
[ "java.util.List", "java.util.Set", "java.util.TreeSet", "org.apache.hadoop.hbase.util.Bytes", "org.apache.hadoop.hbase.zookeeper.ZKUtil", "org.apache.zookeeper.KeeperException" ]
import java.util.List; import java.util.Set; import java.util.TreeSet; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.zookeeper.KeeperException;
import java.util.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.hbase.zookeeper.*; import org.apache.zookeeper.*;
[ "java.util", "org.apache.hadoop", "org.apache.zookeeper" ]
java.util; org.apache.hadoop; org.apache.zookeeper;
144,280
public Application[] getApplicationsByTier(String tier) throws APIManagementException { if (tier == null) { return null; } Connection connection = null; PreparedStatement prepStmt = null; ResultSet rs = null; Application[] applications = null; String sqlQuery = SQLConstants.GET_APPLICATION_BY_TIER_SQL; try { connection = APIMgtDBUtil.getConnection(); prepStmt = connection.prepareStatement(sqlQuery); prepStmt.setString(1, tier); rs = prepStmt.executeQuery(); ArrayList<Application> applicationsList = new ArrayList<Application>(); Application application; while (rs.next()) { application = new Application(rs.getString("NAME"), getSubscriber(rs.getString("SUBSCRIBER_ID"))); application.setId(rs.getInt("APPLICATION_ID")); }
Application[] function(String tier) throws APIManagementException { if (tier == null) { return null; } Connection connection = null; PreparedStatement prepStmt = null; ResultSet rs = null; Application[] applications = null; String sqlQuery = SQLConstants.GET_APPLICATION_BY_TIER_SQL; try { connection = APIMgtDBUtil.getConnection(); prepStmt = connection.prepareStatement(sqlQuery); prepStmt.setString(1, tier); rs = prepStmt.executeQuery(); ArrayList<Application> applicationsList = new ArrayList<Application>(); Application application; while (rs.next()) { application = new Application(rs.getString("NAME"), getSubscriber(rs.getString(STR))); application.setId(rs.getInt(STR)); }
/** * Get all applications associated with given tier * * @param tier String tier name * @return Application object array associated with tier * @throws APIManagementException on error in getting applications array */
Get all applications associated with given tier
getApplicationsByTier
{ "repo_name": "charithag/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 345861 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.util.ArrayList", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.Application", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Application; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "java.util", "org.wso2.carbon" ]
java.sql; java.util; org.wso2.carbon;
2,010,650
// Naming in faces-config.xml Refresh jsp- "refresh" , Notification jsp- "noti" , tab cutomization jsp- "tab" // ///////////////////////////////////// PROCESS ACTION /////////////////////////////////////////// public String processActionAdd() { LOG.debug("processActionAdd()"); tabUpdated = false; // reset successful text message if existing with same jsp String[] values = getSelectedExcludeItems(); if (values.length < 1) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(msgs.getString("add_to_sites_msg"))); return m_TabOutcome; } for (int i = 0; i < values.length; i++) { String value = values[i]; getPrefOrderItems().add(removeItems(value, getPrefExcludeItems(), ORDER_SITE_LISTS, EXCLUDE_SITE_LISTS)); } return m_TabOutcome; }
String function() { LOG.debug(STR); tabUpdated = false; String[] values = getSelectedExcludeItems(); if (values.length < 1) { FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(msgs.getString(STR))); return m_TabOutcome; } for (int i = 0; i < values.length; i++) { String value = values[i]; getPrefOrderItems().add(removeItems(value, getPrefExcludeItems(), ORDER_SITE_LISTS, EXCLUDE_SITE_LISTS)); } return m_TabOutcome; }
/** * Process the add command from the edit view. * * @return navigation outcome to tab customization page (edit) */
Process the add command from the edit view
processActionAdd
{ "repo_name": "eemirtekin/Sakai-10.6-TR", "path": "user/user-tool-prefs/tool/src/java/org/sakaiproject/user/tool/UserPrefsTool.java", "license": "apache-2.0", "size": 84800 }
[ "javax.faces.application.FacesMessage", "javax.faces.context.FacesContext" ]
import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext;
import javax.faces.application.*; import javax.faces.context.*;
[ "javax.faces" ]
javax.faces;
2,795,517
public SecretBundle setSecret(String vaultBaseUrl, String secretName, String value) { return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value).toBlocking().single().body(); }
SecretBundle function(String vaultBaseUrl, String secretName, String value) { return setSecretWithServiceResponseAsync(vaultBaseUrl, secretName, value).toBlocking().single().body(); }
/** * Sets a secret in a specified key vault. * The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission. * * @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. * @param secretName The name of the secret. * @param value The value of the secret. * @throws IllegalArgumentException thrown if parameters fail the validation * @throws KeyVaultErrorException thrown if the request is rejected by server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @return the SecretBundle object if successful. */
Sets a secret in a specified key vault. The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, Azure Key Vault creates a new version of that secret. This operation requires the secrets/set permission
setSecret
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java", "license": "mit", "size": 884227 }
[ "com.microsoft.azure.keyvault.models.SecretBundle" ]
import com.microsoft.azure.keyvault.models.SecretBundle;
import com.microsoft.azure.keyvault.models.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
1,553,043
public DocumentType getDoctype() { if (needsSyncChildren()) { synchronizeChildren(); } return docType; }
DocumentType function() { if (needsSyncChildren()) { synchronizeChildren(); } return docType; }
/** * For XML, this provides access to the Document Type Definition. * For HTML documents, and XML documents which don't specify a DTD, * it will be null. */
For XML, this provides access to the Document Type Definition. For HTML documents, and XML documents which don't specify a DTD, it will be null
getDoctype
{ "repo_name": "openjdk/jdk8u", "path": "jaxp/src/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java", "license": "gpl-2.0", "size": 105220 }
[ "org.w3c.dom.DocumentType" ]
import org.w3c.dom.DocumentType;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,147,728
public static int getOutputImageWidth(@NonNull Intent intent) { return intent.getIntExtra(EXTRA_OUTPUT_IMAGE_WIDTH, -1); }
static int function(@NonNull Intent intent) { return intent.getIntExtra(EXTRA_OUTPUT_IMAGE_WIDTH, -1); }
/** * Retrieve the width of the cropped image * * @param intent crop result intent */
Retrieve the width of the cropped image
getOutputImageWidth
{ "repo_name": "gaojianyang/only", "path": "Only/ucrop/src/main/java/com/yalantis/ucrop/UCrop.java", "license": "gpl-3.0", "size": 20781 }
[ "android.content.Intent", "android.support.annotation.NonNull" ]
import android.content.Intent; import android.support.annotation.NonNull;
import android.content.*; import android.support.annotation.*;
[ "android.content", "android.support" ]
android.content; android.support;
1,992,107
public void setBackgroundBaseColor(String backgroundBaseColor) { try { this.backgroundBaseColor = Color.parseColor(backgroundBaseColor); } catch (IllegalArgumentException e) { e.printStackTrace(); } invalidate(); }
void function(String backgroundBaseColor) { try { this.backgroundBaseColor = Color.parseColor(backgroundBaseColor); } catch (IllegalArgumentException e) { e.printStackTrace(); } invalidate(); }
/** * Sets the background color for this contributions view. * * @param backgroundBaseColor * the color of the background */
Sets the background color for this contributions view
setBackgroundBaseColor
{ "repo_name": "k0shk0sh/FastHub", "path": "app/src/main/java/com/fastaccess/ui/widgets/contributions/GitHubContributionsView.java", "license": "gpl-3.0", "size": 13583 }
[ "android.graphics.Color" ]
import android.graphics.Color;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,764,049
private void generateSingleMLBytecodeCompilation( Map<Path, ImmutableSortedSet<BuildRule>> sourceToRule, ImmutableList.Builder<SourcePath> cmoFiles, Path mlSource, ImmutableMap<Path, ImmutableList<Path>> sources, ImmutableList<Path> cycleDetector) { ImmutableList<Path> newCycleDetector = ImmutableList.<Path>builder() .addAll(cycleDetector) .add(mlSource) .build(); if (cycleDetector.contains(mlSource)) { throw new HumanReadableException("Dependency cycle detected: %s", Joiner.on(" -> ").join(newCycleDetector)); } if (sourceToRule.containsKey(mlSource)) { return; } ImmutableSortedSet.Builder<BuildRule> depsBuilder = ImmutableSortedSet.naturalOrder(); if (sources.containsKey(mlSource)) { for (Path dep : checkNotNull(sources.get(mlSource))) { generateSingleMLBytecodeCompilation( sourceToRule, cmoFiles, dep, sources, newCycleDetector); depsBuilder.addAll(checkNotNull(sourceToRule.get(dep))); } } ImmutableSortedSet<BuildRule> deps = depsBuilder.build(); String name = mlSource.toFile().getName(); BuildTarget buildTarget = createMLBytecodeCompileBuildTarget( params.getBuildTarget(), name); BuildRuleParams compileParams = params.copyWithChanges( buildTarget, Suppliers.ofInstance( ImmutableSortedSet.<BuildRule>naturalOrder() .addAll(params.getDeclaredDeps().get()) .addAll(deps) .addAll(ocamlContext.getBytecodeCompileDeps()) .addAll(cCompiler.getDeps(pathResolver)) .build()), params.getExtraDeps()); String outputFileName = getMLBytecodeOutputName(name); Path outputPath = ocamlContext.getCompileBytecodeOutputDir() .resolve(outputFileName); final ImmutableList<String> compileFlags = getCompileFlags( true, false); BuildRule compileBytecode = new OCamlMLCompile( compileParams, pathResolver, new OCamlMLCompileStep.Args( params.getProjectFilesystem().getAbsolutifier(), cCompiler.getEnvironment(pathResolver), cCompiler.getCommandPrefix(pathResolver), ocamlContext.getOcamlBytecodeCompiler().get(), ocamlContext.getOCamlInteropIncludesDir(), outputPath, mlSource, compileFlags)); resolver.addToIndex(compileBytecode); sourceToRule.put( mlSource, ImmutableSortedSet.<BuildRule>naturalOrder() .add(compileBytecode) .addAll(deps) .build()); if (!outputFileName.endsWith(OCamlCompilables.OCAML_CMI)) { cmoFiles.add( new BuildTargetSourcePath(compileBytecode.getBuildTarget())); } }
void function( Map<Path, ImmutableSortedSet<BuildRule>> sourceToRule, ImmutableList.Builder<SourcePath> cmoFiles, Path mlSource, ImmutableMap<Path, ImmutableList<Path>> sources, ImmutableList<Path> cycleDetector) { ImmutableList<Path> newCycleDetector = ImmutableList.<Path>builder() .addAll(cycleDetector) .add(mlSource) .build(); if (cycleDetector.contains(mlSource)) { throw new HumanReadableException(STR, Joiner.on(STR).join(newCycleDetector)); } if (sourceToRule.containsKey(mlSource)) { return; } ImmutableSortedSet.Builder<BuildRule> depsBuilder = ImmutableSortedSet.naturalOrder(); if (sources.containsKey(mlSource)) { for (Path dep : checkNotNull(sources.get(mlSource))) { generateSingleMLBytecodeCompilation( sourceToRule, cmoFiles, dep, sources, newCycleDetector); depsBuilder.addAll(checkNotNull(sourceToRule.get(dep))); } } ImmutableSortedSet<BuildRule> deps = depsBuilder.build(); String name = mlSource.toFile().getName(); BuildTarget buildTarget = createMLBytecodeCompileBuildTarget( params.getBuildTarget(), name); BuildRuleParams compileParams = params.copyWithChanges( buildTarget, Suppliers.ofInstance( ImmutableSortedSet.<BuildRule>naturalOrder() .addAll(params.getDeclaredDeps().get()) .addAll(deps) .addAll(ocamlContext.getBytecodeCompileDeps()) .addAll(cCompiler.getDeps(pathResolver)) .build()), params.getExtraDeps()); String outputFileName = getMLBytecodeOutputName(name); Path outputPath = ocamlContext.getCompileBytecodeOutputDir() .resolve(outputFileName); final ImmutableList<String> compileFlags = getCompileFlags( true, false); BuildRule compileBytecode = new OCamlMLCompile( compileParams, pathResolver, new OCamlMLCompileStep.Args( params.getProjectFilesystem().getAbsolutifier(), cCompiler.getEnvironment(pathResolver), cCompiler.getCommandPrefix(pathResolver), ocamlContext.getOcamlBytecodeCompiler().get(), ocamlContext.getOCamlInteropIncludesDir(), outputPath, mlSource, compileFlags)); resolver.addToIndex(compileBytecode); sourceToRule.put( mlSource, ImmutableSortedSet.<BuildRule>naturalOrder() .add(compileBytecode) .addAll(deps) .build()); if (!outputFileName.endsWith(OCamlCompilables.OCAML_CMI)) { cmoFiles.add( new BuildTargetSourcePath(compileBytecode.getBuildTarget())); } }
/** * Compiles a single .ml file to a .cmo */
Compiles a single .ml file to a .cmo
generateSingleMLBytecodeCompilation
{ "repo_name": "raviagarwal7/buck", "path": "src/com/facebook/buck/ocaml/OCamlBuildRulesGenerator.java", "license": "apache-2.0", "size": 22482 }
[ "com.facebook.buck.model.BuildTarget", "com.facebook.buck.rules.BuildRule", "com.facebook.buck.rules.BuildRuleParams", "com.facebook.buck.rules.BuildTargetSourcePath", "com.facebook.buck.rules.SourcePath", "com.facebook.buck.util.HumanReadableException", "com.google.common.base.Joiner", "com.google.common.base.Preconditions", "com.google.common.base.Suppliers", "com.google.common.collect.ImmutableList", "com.google.common.collect.ImmutableMap", "com.google.common.collect.ImmutableSortedSet", "java.nio.file.Path", "java.util.Map" ]
import com.facebook.buck.model.BuildTarget; import com.facebook.buck.rules.BuildRule; import com.facebook.buck.rules.BuildRuleParams; import com.facebook.buck.rules.BuildTargetSourcePath; import com.facebook.buck.rules.SourcePath; import com.facebook.buck.util.HumanReadableException; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSortedSet; import java.nio.file.Path; import java.util.Map;
import com.facebook.buck.model.*; import com.facebook.buck.rules.*; import com.facebook.buck.util.*; import com.google.common.base.*; import com.google.common.collect.*; import java.nio.file.*; import java.util.*;
[ "com.facebook.buck", "com.google.common", "java.nio", "java.util" ]
com.facebook.buck; com.google.common; java.nio; java.util;
877,315
@Test public void testSetGroupIdOnNewMessage() throws Exception { String groupId = "testValue"; AmqpJmsMessageFacade amqpMessageFacade = createNewMessageFacade(); amqpMessageFacade.setGroupId(groupId); assertNotNull("properties section was not created", amqpMessageFacade.getAmqpMessage().getProperties()); assertEquals("value was not set for GroupId as expected", groupId, amqpMessageFacade.getAmqpMessage().getProperties().getGroupId()); assertEquals("value was not set for GroupId as expected", groupId, amqpMessageFacade.getGroupId()); }
void function() throws Exception { String groupId = STR; AmqpJmsMessageFacade amqpMessageFacade = createNewMessageFacade(); amqpMessageFacade.setGroupId(groupId); assertNotNull(STR, amqpMessageFacade.getAmqpMessage().getProperties()); assertEquals(STR, groupId, amqpMessageFacade.getAmqpMessage().getProperties().getGroupId()); assertEquals(STR, groupId, amqpMessageFacade.getGroupId()); }
/** * Check that setting GroupId on the message causes creation of the underlying properties * section with the expected value. New messages lack the properties section section, * as tested by {@link #testNewMessageHasNoUnderlyingPropertiesSection()}. */
Check that setting GroupId on the message causes creation of the underlying properties section with the expected value. New messages lack the properties section section, as tested by <code>#testNewMessageHasNoUnderlyingPropertiesSection()</code>
testSetGroupIdOnNewMessage
{ "repo_name": "avranju/qpid-jms", "path": "qpid-jms-client/src/test/java/org/apache/qpid/jms/provider/amqp/message/AmqpJmsMessageFacadeTest.java", "license": "apache-2.0", "size": 79428 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,384,876
public Facets facets() { return internalResponse.facets(); }
Facets function() { return internalResponse.facets(); }
/** * The search facets. */
The search facets
facets
{ "repo_name": "chanil1218/elasticsearch", "path": "src/main/java/org/elasticsearch/action/search/SearchResponse.java", "license": "apache-2.0", "size": 10403 }
[ "org.elasticsearch.search.facet.Facets" ]
import org.elasticsearch.search.facet.Facets;
import org.elasticsearch.search.facet.*;
[ "org.elasticsearch.search" ]
org.elasticsearch.search;
1,634,031
public boolean containsKey(MethodBinding key) { int index = hashCode(key); while (keyTable[index] != null) { if (equalsForNameAndType(keyTable[index], key)) return true; index = (index + 1) % keyTable.length; } return false; }
boolean function(MethodBinding key) { int index = hashCode(key); while (keyTable[index] != null) { if (equalsForNameAndType(keyTable[index], key)) return true; index = (index + 1) % keyTable.length; } return false; }
/** Returns true if the collection contains an element for the key. * * @param key char[] the key that we are looking for * @return boolean */
Returns true if the collection contains an element for the key
containsKey
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/codegen/MethodNameAndTypeCache.java", "license": "gpl-3.0", "size": 5019 }
[ "org.eclipse.jdt.internal.compiler.lookup.MethodBinding" ]
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
219,792
private void assertTiles(String output, String compression, int n, int m, boolean bigTiff) throws Exception { TiffWriter writer = initializeWriter(output, compression, bigTiff); int x, y; byte[] tile; long[] rowPerStrip; int w, h; IFD ifd; int count; int series = reader.getSeriesCount(); String[][][] tileMD5s = new String[series][][]; for (int s = 0; s < series; s++) { reader.setSeries(s); w = reader.getSizeX()/n; h = reader.getSizeY()/m; rowPerStrip = new long[1]; rowPerStrip[0] = h; count = reader.getImageCount(); tileMD5s[s] = new String[count][m * n]; for (int k = 0; k < count; k++) { ifd = new IFD(); ifd.put(IFD.TILE_WIDTH, w); ifd.put(IFD.TILE_LENGTH, h); ifd.put(IFD.ROWS_PER_STRIP, rowPerStrip); for (int i = 0; i < m; i++) { y = h*i; for (int j = 0; j < n; j++) { x = w*j; tile = reader.openBytes(k, x, y, w, h); tileMD5s[s][k][(i * n) + j] = TestTools.md5(tile); writer.saveBytes(k, tile, ifd, x, y, w, h); } } } } writer.close(); //Now going to read the output. TiffReader outputReader = new TiffReader(); outputReader.setId(output); //first series. String writtenDigest; String readDigest; for (int s = 0; s < series; s++) { outputReader.setSeries(s); count = outputReader.getImageCount(); h = outputReader.getSizeY()/m; w = outputReader.getSizeX()/n; for (int k = 0; k < count; k++) { for (int i = 0; i < m; i++) { y = h*i; for (int j = 0; j < n; j++) { x = w*j; tile = outputReader.openBytes(k, x, y, w, h); writtenDigest = tileMD5s[s][k][(i * n) + j]; readDigest = TestTools.md5(tile); if (!writtenDigest.equals(readDigest)) { fail(String.format( "Compression:%s MD5:%d;%d;%d;%d;%d; %s != %s", compression, k, x, y, w, h, writtenDigest, readDigest)); } } } } } outputReader.close(); }
void function(String output, String compression, int n, int m, boolean bigTiff) throws Exception { TiffWriter writer = initializeWriter(output, compression, bigTiff); int x, y; byte[] tile; long[] rowPerStrip; int w, h; IFD ifd; int count; int series = reader.getSeriesCount(); String[][][] tileMD5s = new String[series][][]; for (int s = 0; s < series; s++) { reader.setSeries(s); w = reader.getSizeX()/n; h = reader.getSizeY()/m; rowPerStrip = new long[1]; rowPerStrip[0] = h; count = reader.getImageCount(); tileMD5s[s] = new String[count][m * n]; for (int k = 0; k < count; k++) { ifd = new IFD(); ifd.put(IFD.TILE_WIDTH, w); ifd.put(IFD.TILE_LENGTH, h); ifd.put(IFD.ROWS_PER_STRIP, rowPerStrip); for (int i = 0; i < m; i++) { y = h*i; for (int j = 0; j < n; j++) { x = w*j; tile = reader.openBytes(k, x, y, w, h); tileMD5s[s][k][(i * n) + j] = TestTools.md5(tile); writer.saveBytes(k, tile, ifd, x, y, w, h); } } } } writer.close(); TiffReader outputReader = new TiffReader(); outputReader.setId(output); String writtenDigest; String readDigest; for (int s = 0; s < series; s++) { outputReader.setSeries(s); count = outputReader.getImageCount(); h = outputReader.getSizeY()/m; w = outputReader.getSizeX()/n; for (int k = 0; k < count; k++) { for (int i = 0; i < m; i++) { y = h*i; for (int j = 0; j < n; j++) { x = w*j; tile = outputReader.openBytes(k, x, y, w, h); writtenDigest = tileMD5s[s][k][(i * n) + j]; readDigest = TestTools.md5(tile); if (!writtenDigest.equals(readDigest)) { fail(String.format( STR, compression, k, x, y, w, h, writtenDigest, readDigest)); } } } } } outputReader.close(); }
/** * Tests the writing of the tiles. * @param output The output where to write the data. * @param compression The compression to use. * @param n The value by which to divide the width of the image. * @param m The value by which to divide the height of the image. * @param bigTiff Pass <code>true</code> to set the <code>bigTiff</code> flag, * <code>false</code> otherwise. */
Tests the writing of the tiles
assertTiles
{ "repo_name": "stelfrich/bioformats", "path": "components/test-suite/src/loci/tests/testng/TiffWriterTest.java", "license": "gpl-2.0", "size": 14003 }
[ "org.testng.AssertJUnit" ]
import org.testng.AssertJUnit;
import org.testng.*;
[ "org.testng" ]
org.testng;
342,403
@NonNull public static UpdateCenter createUpdateCenter(@CheckForNull UpdateCenterConfiguration config) { String requiredClassName = SystemProperties.getString(UpdateCenter.class.getName()+".className", null); if (requiredClassName == null) { // Use the default Update Center LOGGER.log(Level.FINE, "Using the default Update Center implementation"); return createDefaultUpdateCenter(config); } LOGGER.log(Level.FINE, "Using the custom update center: {0}", requiredClassName); try { final Class<?> clazz = Class.forName(requiredClassName).asSubclass(UpdateCenter.class); if (!UpdateCenter.class.isAssignableFrom(clazz)) { LOGGER.log(Level.SEVERE, "The specified custom Update Center {0} is not an instance of {1}. Falling back to default.", new Object[] {requiredClassName, UpdateCenter.class.getName()}); return createDefaultUpdateCenter(config); } final Class<? extends UpdateCenter> ucClazz = clazz.asSubclass(UpdateCenter.class); final Constructor<? extends UpdateCenter> defaultConstructor = ucClazz.getConstructor(); final Constructor<? extends UpdateCenter> configConstructor = ucClazz.getConstructor(UpdateCenterConfiguration.class); LOGGER.log(Level.FINE, "Using the constructor {0} Update Center configuration for {1}", new Object[] {config != null ? "with" : "without", requiredClassName}); return config != null ? configConstructor.newInstance(config) : defaultConstructor.newInstance(); } catch(ClassCastException e) { // Should never happen LOGGER.log(WARNING, "UpdateCenter class {0} does not extend hudson.model.UpdateCenter. Using default.", requiredClassName); } catch(NoSuchMethodException e) { LOGGER.log(WARNING, String.format("UpdateCenter class %s does not define one of the required constructors. Using default", requiredClassName), e); } catch(Exception e) { LOGGER.log(WARNING, String.format("Unable to instantiate custom plugin manager [%s]. Using default.", requiredClassName), e); } return createDefaultUpdateCenter(config); }
static UpdateCenter function(@CheckForNull UpdateCenterConfiguration config) { String requiredClassName = SystemProperties.getString(UpdateCenter.class.getName()+STR, null); if (requiredClassName == null) { LOGGER.log(Level.FINE, STR); return createDefaultUpdateCenter(config); } LOGGER.log(Level.FINE, STR, requiredClassName); try { final Class<?> clazz = Class.forName(requiredClassName).asSubclass(UpdateCenter.class); if (!UpdateCenter.class.isAssignableFrom(clazz)) { LOGGER.log(Level.SEVERE, STR, new Object[] {requiredClassName, UpdateCenter.class.getName()}); return createDefaultUpdateCenter(config); } final Class<? extends UpdateCenter> ucClazz = clazz.asSubclass(UpdateCenter.class); final Constructor<? extends UpdateCenter> defaultConstructor = ucClazz.getConstructor(); final Constructor<? extends UpdateCenter> configConstructor = ucClazz.getConstructor(UpdateCenterConfiguration.class); LOGGER.log(Level.FINE, STR, new Object[] {config != null ? "with" : STR, requiredClassName}); return config != null ? configConstructor.newInstance(config) : defaultConstructor.newInstance(); } catch(ClassCastException e) { LOGGER.log(WARNING, STR, requiredClassName); } catch(NoSuchMethodException e) { LOGGER.log(WARNING, String.format(STR, requiredClassName), e); } catch(Exception e) { LOGGER.log(WARNING, String.format(STR, requiredClassName), e); } return createDefaultUpdateCenter(config); }
/** * Creates an update center. * @param config Requested configuration. May be {@code null} if defaults should be used * @return Created Update center. {@link UpdateCenter} by default, but may be overridden * @since 2.4 */
Creates an update center
createUpdateCenter
{ "repo_name": "damianszczepanik/jenkins", "path": "core/src/main/java/hudson/model/UpdateCenter.java", "license": "mit", "size": 97521 }
[ "edu.umd.cs.findbugs.annotations.CheckForNull", "java.lang.reflect.Constructor", "java.util.logging.Level" ]
import edu.umd.cs.findbugs.annotations.CheckForNull; import java.lang.reflect.Constructor; import java.util.logging.Level;
import edu.umd.cs.findbugs.annotations.*; import java.lang.reflect.*; import java.util.logging.*;
[ "edu.umd.cs", "java.lang", "java.util" ]
edu.umd.cs; java.lang; java.util;
1,112,600
public static boolean containsAllUuids(ParcelUuid[] uuidA, ParcelUuid[] uuidB) { if (uuidA == null && uuidB == null) return true; if (uuidA == null) { return uuidB.length == 0 ? true : false; } if (uuidB == null) return true; HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid> (Arrays.asList(uuidA)); for (ParcelUuid uuid: uuidB) { if (!uuidSet.contains(uuid)) return false; } return true; }
static boolean function(ParcelUuid[] uuidA, ParcelUuid[] uuidB) { if (uuidA == null && uuidB == null) return true; if (uuidA == null) { return uuidB.length == 0 ? true : false; } if (uuidB == null) return true; HashSet<ParcelUuid> uuidSet = new HashSet<ParcelUuid> (Arrays.asList(uuidA)); for (ParcelUuid uuid: uuidB) { if (!uuidSet.contains(uuid)) return false; } return true; }
/** * Returns true if all the ParcelUuids in ParcelUuidB are present in * ParcelUuidA * * @param uuidA - Array of ParcelUuidsA * @param uuidB - Array of ParcelUuidsB * */
Returns true if all the ParcelUuids in ParcelUuidB are present in ParcelUuidA
containsAllUuids
{ "repo_name": "shelmesky/nexfi_android_ble", "path": "underdark/src/main/java/impl/underdark/transport/bluetooth/discovery/ble/detector/BluetoothUuid.java", "license": "gpl-3.0", "size": 9873 }
[ "android.os.ParcelUuid", "java.util.Arrays", "java.util.HashSet" ]
import android.os.ParcelUuid; import java.util.Arrays; import java.util.HashSet;
import android.os.*; import java.util.*;
[ "android.os", "java.util" ]
android.os; java.util;
319,590
void login(Authentication authentication, boolean rememberMe) throws AuthenticationException, Exception;
void login(Authentication authentication, boolean rememberMe) throws AuthenticationException, Exception;
/** * Tries to login using the specified authentication object. If authentication succeeds, this method * will return without exceptions. * * @param authentication the authentication object to authenticate, must not be {@code null}. * @param rememberMe boolean to indicate if remember me authentication should be activated * @throws org.springframework.security.core.AuthenticationException if authentication fails. * @throws Exception */
Tries to login using the specified authentication object. If authentication succeeds, this method will return without exceptions
login
{ "repo_name": "zkendall/vaadin4spring", "path": "extensions/security/src/main/java/org/vaadin/spring/security/VaadinSecurity.java", "license": "apache-2.0", "size": 9007 }
[ "org.springframework.security.core.Authentication", "org.springframework.security.core.AuthenticationException" ]
import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.*;
[ "org.springframework.security" ]
org.springframework.security;
1,300,464
private void writeMetaData(final JarPackageData data, final File file, final IPath path) throws FileNotFoundException, IOException { Assert.isNotNull(data); Assert.isNotNull(file); Assert.isNotNull(path); final JarEntry entry= new JarEntry(path.toString().replace(File.separatorChar, '/')); byte[] buffer= new byte[4096]; if (data.isCompressed()) entry.setMethod(ZipEntry.DEFLATED); else { entry.setMethod(ZipEntry.STORED); JarPackagerUtil.calculateCrcAndSize(entry, new BufferedInputStream(new FileInputStream(file)), buffer); } entry.setTime(System.currentTimeMillis()); final InputStream stream= new BufferedInputStream(new FileInputStream(file)); try { fJarOutputStream.putNextEntry(entry); int count; while ((count= stream.read(buffer, 0, buffer.length)) != -1) fJarOutputStream.write(buffer, 0, count); } finally { try { stream.close(); } catch (IOException exception) { // Do nothing } } }
void function(final JarPackageData data, final File file, final IPath path) throws FileNotFoundException, IOException { Assert.isNotNull(data); Assert.isNotNull(file); Assert.isNotNull(path); final JarEntry entry= new JarEntry(path.toString().replace(File.separatorChar, '/')); byte[] buffer= new byte[4096]; if (data.isCompressed()) entry.setMethod(ZipEntry.DEFLATED); else { entry.setMethod(ZipEntry.STORED); JarPackagerUtil.calculateCrcAndSize(entry, new BufferedInputStream(new FileInputStream(file)), buffer); } entry.setTime(System.currentTimeMillis()); final InputStream stream= new BufferedInputStream(new FileInputStream(file)); try { fJarOutputStream.putNextEntry(entry); int count; while ((count= stream.read(buffer, 0, buffer.length)) != -1) fJarOutputStream.write(buffer, 0, count); } finally { try { stream.close(); } catch (IOException exception) { } } }
/** * Writes the meta file to the JAR file. * * @param data * the jar package data * @param file * the file containing the meta data * @param path * the path of the meta file within the archive * @throws FileNotFoundException * if the meta file could not be found * @throws IOException * if an input/output error occurs */
Writes the meta file to the JAR file
writeMetaData
{ "repo_name": "brunyuriy/quick-fix-scout", "path": "org.eclipse.jdt.ui_3.7.1.r371_v20110824-0800/src/org/eclipse/jdt/ui/jarpackager/JarWriter3.java", "license": "mit", "size": 16659 }
[ "java.io.BufferedInputStream", "java.io.File", "java.io.FileInputStream", "java.io.FileNotFoundException", "java.io.IOException", "java.io.InputStream", "java.util.jar.JarEntry", "java.util.zip.ZipEntry", "org.eclipse.core.runtime.Assert", "org.eclipse.core.runtime.IPath", "org.eclipse.jdt.internal.ui.jarpackager.JarPackagerUtil" ]
import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.jar.JarEntry; import java.util.zip.ZipEntry; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.internal.ui.jarpackager.JarPackagerUtil;
import java.io.*; import java.util.jar.*; import java.util.zip.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.internal.ui.jarpackager.*;
[ "java.io", "java.util", "org.eclipse.core", "org.eclipse.jdt" ]
java.io; java.util; org.eclipse.core; org.eclipse.jdt;
634,711
public String toJVMOptions() { StringBuffer sb = new StringBuffer(); if (mVDSProps != null) { for (Iterator it = mVDSProps.iterator(); it.hasNext(); ) { NameValue nv = (NameValue) it.next(); sb.append(" -D").append(nv.getKey()).append("=").append(nv.getValue()); } } // add all the properties specified in the dax elements for (Iterator<Object> it = mProperties.keySet().iterator(); it.hasNext(); ) { String key = (String) it.next(); sb.append(" -D").append(key).append("=").append(mProperties.getProperty(key)); } // pass on all the -X options to jvm for (Iterator<String> it = this.mNonStandardJavaOptions.iterator(); it.hasNext(); ) { sb.append(" ").append(it.next()); } return sb.toString(); }
String function() { StringBuffer sb = new StringBuffer(); if (mVDSProps != null) { for (Iterator it = mVDSProps.iterator(); it.hasNext(); ) { NameValue nv = (NameValue) it.next(); sb.append(STR).append(nv.getKey()).append("=").append(nv.getValue()); } } for (Iterator<Object> it = mProperties.keySet().iterator(); it.hasNext(); ) { String key = (String) it.next(); sb.append(STR).append(key).append("=").append(mProperties.getProperty(key)); } for (Iterator<String> it = this.mNonStandardJavaOptions.iterator(); it.hasNext(); ) { sb.append(" ").append(it.next()); } return sb.toString(); }
/** * Converts the vds properties that need to be passed to the jvm as an option. * * @return the jvm options as String. */
Converts the vds properties that need to be passed to the jvm as an option
toJVMOptions
{ "repo_name": "pegasus-isi/pegasus", "path": "src/edu/isi/pegasus/planner/classes/PlannerOptions.java", "license": "apache-2.0", "size": 50453 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,026,597
protected final Parser ref(String name) { return new Reference(name); }
final Parser function(String name) { return new Reference(name); }
/** * Returns a reference to the production with the given {@code name}. */
Returns a reference to the production with the given name
ref
{ "repo_name": "petitparser/java-petitparser", "path": "petitparser-core/src/main/java/org/petitparser/tools/GrammarDefinition.java", "license": "mit", "size": 5768 }
[ "org.petitparser.parser.Parser" ]
import org.petitparser.parser.Parser;
import org.petitparser.parser.*;
[ "org.petitparser.parser" ]
org.petitparser.parser;
2,317,902
void setScaleType(ImageView.ScaleType scaleType);
void setScaleType(ImageView.ScaleType scaleType);
/** * Controls how the image should be resized or moved to match the size of the ImageView. Any * scaling or panning will happen within the confines of this {@link * android.widget.ImageView.ScaleType}. * * @param scaleType - The desired scaling mode. */
Controls how the image should be resized or moved to match the size of the ImageView. Any scaling or panning will happen within the confines of this <code>android.widget.ImageView.ScaleType</code>
setScaleType
{ "repo_name": "Kimhuang/APICore", "path": "commonlibs/PhotoViewer/src/main/java/com/kim/PhotoViewer/IPhotoView.java", "license": "apache-2.0", "size": 11344 }
[ "android.widget.ImageView" ]
import android.widget.ImageView;
import android.widget.*;
[ "android.widget" ]
android.widget;
177,193
@Override public boolean onOwnerChanged(GridCacheEntryEx entry, GridCacheMvccCandidate owner) { if (isDone()) return false; // Check other futures. if (log.isDebugEnabled()) log.debug("Received onOwnerChanged() callback [entry=" + entry + ", owner=" + owner + "]"); if (owner != null && owner.version().equals(lockVer)) { synchronized (this) { pendingLocks.remove(entry.key()); } if (checkLocks()) map(entries()); return true; } return false; }
@Override boolean function(GridCacheEntryEx entry, GridCacheMvccCandidate owner) { if (isDone()) return false; if (log.isDebugEnabled()) log.debug(STR + entry + STR + owner + "]"); if (owner != null && owner.version().equals(lockVer)) { synchronized (this) { pendingLocks.remove(entry.key()); } if (checkLocks()) map(entries()); return true; } return false; }
/** * Callback for whenever entry lock ownership changes. * * @param entry Entry whose lock ownership changed. */
Callback for whenever entry lock ownership changes
onOwnerChanged
{ "repo_name": "kromulan/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java", "license": "apache-2.0", "size": 43199 }
[ "org.apache.ignite.internal.processors.cache.GridCacheEntryEx", "org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate" ]
import org.apache.ignite.internal.processors.cache.GridCacheEntryEx; import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
import org.apache.ignite.internal.processors.cache.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,901,737
@SuppressWarnings("unchecked") public static XmlRDParser getXmlStreamReader(Reader reader) throws JDtnException { try { String platform = System.getProperty("java.runtime.name"); Class<XmlRDParser> parserClass = null; if (platform == null || !platform.contains("Android")) { // Non-Android platform. We will use a parser based on the // javax.xml.stream package. parserClass = (Class<XmlRDParser>)Class.forName( "com.cisco.qte.jdtn.general.XmlRdParserStreamReader"); } else { // Android platform. We will use a parser based on the // org.xmlpull.v1 available on the Android platform. parserClass = (Class<XmlRDParser>)Class.forName( "com.cisco.qte.jdtng1.misc.XmlRdParserPullParser"); } XmlRDParser parser = parserClass.newInstance(); parser.setInput(reader); return parser; } catch (ClassNotFoundException e) { throw new JDtnException(e); } catch (InstantiationException e) { throw new JDtnException(e); } catch (IllegalAccessException e) { throw new JDtnException(e); } catch (XmlRdParserException e) { throw new JDtnException(e); } }
@SuppressWarnings(STR) static XmlRDParser function(Reader reader) throws JDtnException { try { String platform = System.getProperty(STR); Class<XmlRDParser> parserClass = null; if (platform == null !platform.contains(STR)) { parserClass = (Class<XmlRDParser>)Class.forName( STR); } else { parserClass = (Class<XmlRDParser>)Class.forName( STR); } XmlRDParser parser = parserClass.newInstance(); parser.setInput(reader); return parser; } catch (ClassNotFoundException e) { throw new JDtnException(e); } catch (InstantiationException e) { throw new JDtnException(e); } catch (IllegalAccessException e) { throw new JDtnException(e); } catch (XmlRdParserException e) { throw new JDtnException(e); } }
/** * Get an instance of XmlRDParser, a recursive descent XML parser. * @return Instance of XmlRDParser * @throws JDtnException encapsulates exceptions from j * avax.xml.stream.XMLInputFactory */
Get an instance of XmlRDParser, a recursive descent XML parser
getXmlStreamReader
{ "repo_name": "KritikalFabric/corefabric.io", "path": "src/contrib/java/com/cisco/qte/jdtn/general/Platform.java", "license": "apache-2.0", "size": 4238 }
[ "com.cisco.qte.jdtn.general.XmlRDParser", "com.cisco.qte.jdtn.general.XmlRdParserException", "java.io.Reader" ]
import com.cisco.qte.jdtn.general.XmlRDParser; import com.cisco.qte.jdtn.general.XmlRdParserException; import java.io.Reader;
import com.cisco.qte.jdtn.general.*; import java.io.*;
[ "com.cisco.qte", "java.io" ]
com.cisco.qte; java.io;
1,643,223
@Test(timeout=60000) public void testCompat400() throws Exception { File journalDir = createTempDir("bookie", "journal"); File ledgerDir = createTempDir("bookie", "ledger"); int port = PortManager.nextFreePort(); // start server, upgrade Server400 s400 = new Server400(journalDir, ledgerDir, port); s400.start(); Ledger400 l400 = Ledger400.newLedger(); l400.write100(); long oldLedgerId = l400.getId(); l400.close(); // Check that current client isn't able to write to old server LedgerCurrent lcur = LedgerCurrent.newLedger(); try { lcur.write100(); fail("Current shouldn't be able to write to 4.0.0 server"); } catch (Exception e) { } lcur.close(); s400.stop(); // Start the current server, will require a filesystem upgrade ServerCurrent scur = new ServerCurrent(journalDir, ledgerDir, port, false); try { scur.start(); fail("Shouldn't be able to start without directory upgrade"); } catch (Exception e) { } FileSystemUpgrade.upgrade(scur.getConf()); scur.start(); // check that old client can read its old ledgers on new server l400 = Ledger400.openLedger(oldLedgerId); assertEquals(100, l400.readAll()); l400.close(); // check that old client can create ledgers on new server l400 = Ledger400.newLedger(); l400.write100(); l400.close(); // check that current client can read old ledger lcur = LedgerCurrent.openLedger(oldLedgerId); assertEquals(100, lcur.readAll()); lcur.close(); // check that old client can read current client's ledgers lcur = LedgerCurrent.openLedger(oldLedgerId); assertEquals(100, lcur.readAll()); lcur.close(); // check that old client can not fence a current client // due to lack of password lcur = LedgerCurrent.newLedger(); lcur.write100(); long fenceLedgerId = lcur.getId(); try { l400 = Ledger400.openLedger(fenceLedgerId); fail("Shouldn't be able to open ledger"); } catch (Exception e) { // correct behaviour } lcur.write100(); lcur.close(); lcur = LedgerCurrent.openLedger(fenceLedgerId); assertEquals(200, lcur.readAll()); lcur.close(); scur.stop(); }
@Test(timeout=60000) void function() throws Exception { File journalDir = createTempDir(STR, STR); File ledgerDir = createTempDir(STR, STR); int port = PortManager.nextFreePort(); Server400 s400 = new Server400(journalDir, ledgerDir, port); s400.start(); Ledger400 l400 = Ledger400.newLedger(); l400.write100(); long oldLedgerId = l400.getId(); l400.close(); LedgerCurrent lcur = LedgerCurrent.newLedger(); try { lcur.write100(); fail(STR); } catch (Exception e) { } lcur.close(); s400.stop(); ServerCurrent scur = new ServerCurrent(journalDir, ledgerDir, port, false); try { scur.start(); fail(STR); } catch (Exception e) { } FileSystemUpgrade.upgrade(scur.getConf()); scur.start(); l400 = Ledger400.openLedger(oldLedgerId); assertEquals(100, l400.readAll()); l400.close(); l400 = Ledger400.newLedger(); l400.write100(); l400.close(); lcur = LedgerCurrent.openLedger(oldLedgerId); assertEquals(100, lcur.readAll()); lcur.close(); lcur = LedgerCurrent.openLedger(oldLedgerId); assertEquals(100, lcur.readAll()); lcur.close(); lcur = LedgerCurrent.newLedger(); lcur.write100(); long fenceLedgerId = lcur.getId(); try { l400 = Ledger400.openLedger(fenceLedgerId); fail(STR); } catch (Exception e) { } lcur.write100(); lcur.close(); lcur = LedgerCurrent.openLedger(fenceLedgerId); assertEquals(200, lcur.readAll()); lcur.close(); scur.stop(); }
/** * Test compatability between version 4.0.0 and the current version. * Incompatabilities are: * - Current client will not be able to talk to 4.0.0 server. * - 4.0.0 client will not be able to fence ledgers on current server. * - Current server won't start with 4.0.0 server directories without upgrade. */
Test compatability between version 4.0.0 and the current version. Incompatabilities are: - Current client will not be able to talk to 4.0.0 server. - 4.0.0 client will not be able to fence ledgers on current server. - Current server won't start with 4.0.0 server directories without upgrade
testCompat400
{ "repo_name": "robindh/bookkeeper", "path": "bookkeeper-server/src/test/java/org/apache/bookkeeper/test/TestBackwardCompat.java", "license": "apache-2.0", "size": 29310 }
[ "java.io.File", "org.apache.bookkeeper.bookie.FileSystemUpgrade", "org.junit.Assert", "org.junit.Test" ]
import java.io.File; import org.apache.bookkeeper.bookie.FileSystemUpgrade; import org.junit.Assert; import org.junit.Test;
import java.io.*; import org.apache.bookkeeper.bookie.*; import org.junit.*;
[ "java.io", "org.apache.bookkeeper", "org.junit" ]
java.io; org.apache.bookkeeper; org.junit;
629,634
public final IBreadCrumbModel getBreadCrumbModel() { return breadCrumbModel; }
final IBreadCrumbModel function() { return breadCrumbModel; }
/** * Gets the bread crumb panel. * * @return The bread crumb panel */
Gets the bread crumb panel
getBreadCrumbModel
{ "repo_name": "mosoft521/wicket", "path": "wicket-extensions/src/main/java/org/apache/wicket/extensions/breadcrumb/panel/BreadCrumbPanel.java", "license": "apache-2.0", "size": 5757 }
[ "org.apache.wicket.extensions.breadcrumb.IBreadCrumbModel" ]
import org.apache.wicket.extensions.breadcrumb.IBreadCrumbModel;
import org.apache.wicket.extensions.breadcrumb.*;
[ "org.apache.wicket" ]
org.apache.wicket;
2,848,886
private void retryFlushAfterCreatingTable(DynamoDBMapper mapper, Deque<DynamoDBItem<?>> batch, FailedBatch failedBatch) { logger.debug("Table was not found. Trying to create table and try saving again"); if (createTable(mapper, batch.peek().getClass())) { logger.debug("Table creation successful, trying to save again"); if (!failedBatch.getUnprocessedItems().isEmpty()) { ExponentialBackoffRetry retry = new ExponentialBackoffRetry(failedBatch.getUnprocessedItems()); retry.run(); if (retry.getUnprocessedItems().isEmpty()) { logger.debug("Successfully saved items after table creation"); } } } else { logger.warn("Table creation failed. Not storing some parts of batch: {}. Unprocessed items: {}", batch, failedBatch.getUnprocessedItems()); } }
void function(DynamoDBMapper mapper, Deque<DynamoDBItem<?>> batch, FailedBatch failedBatch) { logger.debug(STR); if (createTable(mapper, batch.peek().getClass())) { logger.debug(STR); if (!failedBatch.getUnprocessedItems().isEmpty()) { ExponentialBackoffRetry retry = new ExponentialBackoffRetry(failedBatch.getUnprocessedItems()); retry.run(); if (retry.getUnprocessedItems().isEmpty()) { logger.debug(STR); } } } else { logger.warn(STR, batch, failedBatch.getUnprocessedItems()); } }
/** * Retry flushing data after creating table associated with mapper * * @param mapper mapper associated with the batch * @param batch original batch of data. Used for logging and to determine table name * @param failedBatch failed batch that should be retried */
Retry flushing data after creating table associated with mapper
retryFlushAfterCreatingTable
{ "repo_name": "MikeJMajor/openhab2-addons-dlinksmarthome", "path": "bundles/org.openhab.persistence.dynamodb/src/main/java/org/openhab/persistence/dynamodb/internal/DynamoDBPersistenceService.java", "license": "epl-1.0", "size": 24102 }
[ "com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper", "java.util.Deque" ]
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import java.util.Deque;
import com.amazonaws.services.dynamodbv2.datamodeling.*; import java.util.*;
[ "com.amazonaws.services", "java.util" ]
com.amazonaws.services; java.util;
61,833
private static List<XSLConverterItem> load(IEclipsePreferences store, String keywords) { List<XSLConverterItem> converters = new ArrayList<XSLConverterItem>(); String [] converterNames = keywords.split(COMMA); for (String name : converterNames) { if (name == null || name.length() == 0) { continue; } String path = store.get(String.format( FORMAT_CONVERTER_PATH_KEY, name), BLANK); XSLConverterItem item = new XSLConverterItem(); item.setName(name); item.setPath(path); converters.add(item); } return converters; }
static List<XSLConverterItem> function(IEclipsePreferences store, String keywords) { List<XSLConverterItem> converters = new ArrayList<XSLConverterItem>(); String [] converterNames = keywords.split(COMMA); for (String name : converterNames) { if (name == null name.length() == 0) { continue; } String path = store.get(String.format( FORMAT_CONVERTER_PATH_KEY, name), BLANK); XSLConverterItem item = new XSLConverterItem(); item.setName(name); item.setPath(path); converters.add(item); } return converters; }
/** * Load converter configure. * @param store A Preference store. * @param keywords The converter names. * @return A list of converter item. */
Load converter configure
load
{ "repo_name": "kuriking/testdc2", "path": "net.dependableos.dcase.diagram.editor/src/net/dependableos/dcase/diagram/editor/logic/xmlconv/XSLConverterItem.java", "license": "epl-1.0", "size": 4982 }
[ "java.util.ArrayList", "java.util.List", "org.eclipse.core.runtime.preferences.IEclipsePreferences" ]
import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import java.util.*; import org.eclipse.core.runtime.preferences.*;
[ "java.util", "org.eclipse.core" ]
java.util; org.eclipse.core;
1,400,940
public void lookupRepositoryReferences(Repository repository) throws KettleException { for (StepMeta stepMeta : steps) { stepMeta.getStepMetaInterface().lookupRepositoryReferences(repository); } }
void function(Repository repository) throws KettleException { for (StepMeta stepMeta : steps) { stepMeta.getStepMetaInterface().lookupRepositoryReferences(repository); } }
/** * Look up the references after import * @param repository the repository to reference. */
Look up the references after import
lookupRepositoryReferences
{ "repo_name": "soluvas/pdi-ce", "path": "src/org/pentaho/di/trans/TransMeta.java", "license": "apache-2.0", "size": 203052 }
[ "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.repository.Repository", "org.pentaho.di.trans.step.StepMeta" ]
import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.repository.Repository; import org.pentaho.di.trans.step.StepMeta;
import org.pentaho.di.core.exception.*; import org.pentaho.di.repository.*; import org.pentaho.di.trans.step.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,767,952
List<Group> getAllowedGroups(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) throws InternalErrorException, PrivilegeException, FacilityNotExistsException, ServiceNotExistsException, VoNotExistsException;
List<Group> getAllowedGroups(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) throws InternalErrorException, PrivilegeException, FacilityNotExistsException, ServiceNotExistsException, VoNotExistsException;
/** * Get all Groups which can use this facility (Groups must be assigned to resource which belongs to this facility) * specificVo and specificService can choose concrete groups * if specificVo, specificService or both are null, they do not specific (all possible results are returned) * * @param facility searching for this facility * @param specificVo specific only those results which are in specific VO (with null, all results) * @param specificService specific only those results, which have resource with assigned specific service (if null, all results) * @return list of allowed groups * @throws FacilityNotExistsException if facility not exist, return this exception * @throws ServiceNotExistsException if service is not null and not exist * @throws VoNotExistsException if vo is not null and not exist */
Get all Groups which can use this facility (Groups must be assigned to resource which belongs to this facility) specificVo and specificService can choose concrete groups if specificVo, specificService or both are null, they do not specific (all possible results are returned)
getAllowedGroups
{ "repo_name": "stavamichal/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/FacilitiesManager.java", "license": "bsd-2-clause", "size": 31409 }
[ "cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "cz.metacentrum.perun.core.api.exceptions.PrivilegeException", "cz.metacentrum.perun.core.api.exceptions.ServiceNotExistsException", "cz.metacentrum.perun.core.api.exceptions.VoNotExistsException", "java.util.List" ]
import cz.metacentrum.perun.core.api.exceptions.FacilityNotExistsException; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.ServiceNotExistsException; import cz.metacentrum.perun.core.api.exceptions.VoNotExistsException; import java.util.List;
import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,685,196
protected void updateLaunchConfiguration(ILaunchConfigurationWorkingCopy wc){ }
void function(ILaunchConfigurationWorkingCopy wc){ }
/** * Update the launch configuration with platform implementation specific values. * * @param wc */
Update the launch configuration with platform implementation specific values
updateLaunchConfiguration
{ "repo_name": "reilove/thym", "path": "plugins/org.eclipse.thym.ui/src/org/eclipse/thym/ui/launch/HybridProjectLaunchShortcut.java", "license": "epl-1.0", "size": 6171 }
[ "org.eclipse.debug.core.ILaunchConfigurationWorkingCopy" ]
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.*;
[ "org.eclipse.debug" ]
org.eclipse.debug;
1,161,528
public void setTestInjectionControls(final ControlsInjector testInjector, final ExecutionControls testControls, final org.slf4j.Logger testLogger) { tunnel.setTestInjectionControls(testInjector, testControls, testLogger); }
void function(final ControlsInjector testInjector, final ExecutionControls testControls, final org.slf4j.Logger testLogger) { tunnel.setTestInjectionControls(testInjector, testControls, testLogger); }
/** * See {@link DataTunnel#setTestInjectionControls(ControlsInjector, ExecutionControls, Logger)}. */
See <code>DataTunnel#setTestInjectionControls(ControlsInjector, ExecutionControls, Logger)</code>
setTestInjectionControls
{ "repo_name": "maryannxue/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/ops/AccountingDataTunnel.java", "license": "apache-2.0", "size": 2323 }
[ "org.apache.drill.exec.testing.ControlsInjector", "org.apache.drill.exec.testing.ExecutionControls", "org.slf4j.Logger" ]
import org.apache.drill.exec.testing.ControlsInjector; import org.apache.drill.exec.testing.ExecutionControls; import org.slf4j.Logger;
import org.apache.drill.exec.testing.*; import org.slf4j.*;
[ "org.apache.drill", "org.slf4j" ]
org.apache.drill; org.slf4j;
791,054
@Test @DirtiesContext public void getLatestTaskExecutionsByTaskNamesWithIdenticalTaskExecutions() { long executionIdOffset = initializeRepositoryNotInOrderWithMultipleTaskExecutions(); final List<TaskExecution> latestTaskExecutions = this.dao .getLatestTaskExecutionsByTaskNames("FOO5"); assertThat(latestTaskExecutions.size() == 1).as( "Expected only 1 taskExecution but got " + latestTaskExecutions.size()) .isTrue(); final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")); dateTime.setTime(latestTaskExecutions.get(0).getStartTime()); assertThat(dateTime.get(Calendar.YEAR)).isEqualTo(2015); assertThat(dateTime.get(Calendar.MONTH) + 1).isEqualTo(2); assertThat(dateTime.get(Calendar.DAY_OF_MONTH)).isEqualTo(22); assertThat(dateTime.get(Calendar.HOUR_OF_DAY)).isEqualTo(23); assertThat(dateTime.get(Calendar.MINUTE)).isEqualTo(59); assertThat(dateTime.get(Calendar.SECOND)).isEqualTo(0); assertThat(latestTaskExecutions.get(0).getExecutionId()) .isEqualTo(9 + executionIdOffset); }
void function() { long executionIdOffset = initializeRepositoryNotInOrderWithMultipleTaskExecutions(); final List<TaskExecution> latestTaskExecutions = this.dao .getLatestTaskExecutionsByTaskNames("FOO5"); assertThat(latestTaskExecutions.size() == 1).as( STR + latestTaskExecutions.size()) .isTrue(); final Calendar dateTime = Calendar.getInstance(TimeZone.getTimeZone("UTC")); dateTime.setTime(latestTaskExecutions.get(0).getStartTime()); assertThat(dateTime.get(Calendar.YEAR)).isEqualTo(2015); assertThat(dateTime.get(Calendar.MONTH) + 1).isEqualTo(2); assertThat(dateTime.get(Calendar.DAY_OF_MONTH)).isEqualTo(22); assertThat(dateTime.get(Calendar.HOUR_OF_DAY)).isEqualTo(23); assertThat(dateTime.get(Calendar.MINUTE)).isEqualTo(59); assertThat(dateTime.get(Calendar.SECOND)).isEqualTo(0); assertThat(latestTaskExecutions.get(0).getExecutionId()) .isEqualTo(9 + executionIdOffset); }
/** * This test is a special use-case. While not common, it is theoretically possible, * that a task may have executed with the exact same start time multiple times. In * that case we should still only get 1 returned {@link TaskExecution}. */
This test is a special use-case. While not common, it is theoretically possible, that a task may have executed with the exact same start time multiple times. In that case we should still only get 1 returned <code>TaskExecution</code>
getLatestTaskExecutionsByTaskNamesWithIdenticalTaskExecutions
{ "repo_name": "mminella/spring-cloud-task", "path": "spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/BaseTaskExecutionDaoTestCases.java", "license": "apache-2.0", "size": 13003 }
[ "java.util.Calendar", "java.util.List", "java.util.TimeZone", "org.assertj.core.api.Assertions", "org.springframework.cloud.task.repository.TaskExecution" ]
import java.util.Calendar; import java.util.List; import java.util.TimeZone; import org.assertj.core.api.Assertions; import org.springframework.cloud.task.repository.TaskExecution;
import java.util.*; import org.assertj.core.api.*; import org.springframework.cloud.task.repository.*;
[ "java.util", "org.assertj.core", "org.springframework.cloud" ]
java.util; org.assertj.core; org.springframework.cloud;
1,087,710
private static void getChildDimensionDictionaryDetail(CarbonDimension queryDimensions, Set<String> dictionaryDimensionFromQuery) { for (int j = 0; j < queryDimensions.getNumberOfChild(); j++) { List<Encoding> encodingList = queryDimensions.getListOfChildDimensions().get(j).getEncoder(); if (queryDimensions.getListOfChildDimensions().get(j).getNumberOfChild() > 0) { getChildDimensionDictionaryDetail(queryDimensions.getListOfChildDimensions().get(j), dictionaryDimensionFromQuery); } else if (!CarbonUtil.hasEncoding(encodingList, Encoding.DIRECT_DICTIONARY)) { dictionaryDimensionFromQuery .add(queryDimensions.getListOfChildDimensions().get(j).getColumnId()); } } }
static void function(CarbonDimension queryDimensions, Set<String> dictionaryDimensionFromQuery) { for (int j = 0; j < queryDimensions.getNumberOfChild(); j++) { List<Encoding> encodingList = queryDimensions.getListOfChildDimensions().get(j).getEncoder(); if (queryDimensions.getListOfChildDimensions().get(j).getNumberOfChild() > 0) { getChildDimensionDictionaryDetail(queryDimensions.getListOfChildDimensions().get(j), dictionaryDimensionFromQuery); } else if (!CarbonUtil.hasEncoding(encodingList, Encoding.DIRECT_DICTIONARY)) { dictionaryDimensionFromQuery .add(queryDimensions.getListOfChildDimensions().get(j).getColumnId()); } } }
/** * Below method will be used to fill the children dimension column id * * @param queryDimensions query dimension * @param dictionaryDimensionFromQuery dictionary dimension for query */
Below method will be used to fill the children dimension column id
getChildDimensionDictionaryDetail
{ "repo_name": "jatin9896/incubator-carbondata", "path": "core/src/main/java/org/apache/carbondata/core/scan/executor/util/QueryUtil.java", "license": "apache-2.0", "size": 32061 }
[ "java.util.List", "java.util.Set", "org.apache.carbondata.core.metadata.encoder.Encoding", "org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension", "org.apache.carbondata.core.util.CarbonUtil" ]
import java.util.List; import java.util.Set; import org.apache.carbondata.core.metadata.encoder.Encoding; import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension; import org.apache.carbondata.core.util.CarbonUtil;
import java.util.*; import org.apache.carbondata.core.metadata.encoder.*; import org.apache.carbondata.core.metadata.schema.table.column.*; import org.apache.carbondata.core.util.*;
[ "java.util", "org.apache.carbondata" ]
java.util; org.apache.carbondata;
1,311,822
NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema) throws ControlServiceException;
NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema) throws ControlServiceException;
/** * Edits the notification schema. * * @param notificationSchema * the notification schema * @return the notification schema dto * @throws ControlServiceException * the control service exception */
Edits the notification schema
saveNotificationSchema
{ "repo_name": "Oleh-Kravchenko/kaa", "path": "server/node/src/main/java/org/kaaproject/kaa/server/control/service/ControlService.java", "license": "apache-2.0", "size": 64761 }
[ "org.kaaproject.kaa.common.dto.NotificationSchemaDto", "org.kaaproject.kaa.server.control.service.exception.ControlServiceException" ]
import org.kaaproject.kaa.common.dto.NotificationSchemaDto; import org.kaaproject.kaa.server.control.service.exception.ControlServiceException;
import org.kaaproject.kaa.common.dto.*; import org.kaaproject.kaa.server.control.service.exception.*;
[ "org.kaaproject.kaa" ]
org.kaaproject.kaa;
2,395,696
public void applyChanges() { SwingWorker<Boolean, Boolean> worker = new SwingWorker<Boolean, Boolean>() {
void function() { SwingWorker<Boolean, Boolean> worker = new SwingWorker<Boolean, Boolean>() {
/** * Applies the changes made to all of the {@link Account}s by synchronizing * with the {@link BurdeeRoot}. */
Applies the changes made to all of the <code>Account</code>s by synchronizing with the <code>BurdeeRoot</code>
applyChanges
{ "repo_name": "terryyiu/Burdee", "path": "src/main/java/ca/burdee/swing/AccountListModel.java", "license": "gpl-3.0", "size": 7669 }
[ "javax.swing.SwingWorker" ]
import javax.swing.SwingWorker;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
975,524
@ArgumentsChecked @Throws(IllegalNotNullArgumentException.class) public static MatchingStrategy type(final Class<?> clazz) { return new TypeMatchingStrategy(Check.notNull(clazz, "clazz")); } private Match() { // Do not create instances of this class }
@Throws(IllegalNotNullArgumentException.class) static MatchingStrategy function(final Class<?> clazz) { return new TypeMatchingStrategy(Check.notNull(clazz, "clazz")); } private Match() { }
/** * Match a type. * * @param clazz * Type that is matched * @return a {@code MatchingStrategy} which matches the given type. */
Match a type
type
{ "repo_name": "before/quality-check", "path": "modules/quality-test/src/main/java/net/sf/qualitytest/blueprint/Match.java", "license": "apache-2.0", "size": 3239 }
[ "net.sf.qualitycheck.Check", "net.sf.qualitycheck.Throws", "net.sf.qualitycheck.exception.IllegalNotNullArgumentException", "net.sf.qualitytest.blueprint.strategy.matching.TypeMatchingStrategy" ]
import net.sf.qualitycheck.Check; import net.sf.qualitycheck.Throws; import net.sf.qualitycheck.exception.IllegalNotNullArgumentException; import net.sf.qualitytest.blueprint.strategy.matching.TypeMatchingStrategy;
import net.sf.qualitycheck.*; import net.sf.qualitycheck.exception.*; import net.sf.qualitytest.blueprint.strategy.matching.*;
[ "net.sf.qualitycheck", "net.sf.qualitytest" ]
net.sf.qualitycheck; net.sf.qualitytest;
2,285,558
@Test public void testSerialization() throws IOException, ClassNotFoundException { BarRenderer r1 = new BarRenderer(); r1.setDefaultLegendTextFont(new Font("Dialog", Font.PLAIN, 4)); r1.setDefaultLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.green)); r1.setDefaultLegendShape(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(r1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); BarRenderer r2 = (BarRenderer) in.readObject(); in.close(); assertEquals(r1, r2); r2.notifyListeners(new RendererChangeEvent(r2)); }
void function() throws IOException, ClassNotFoundException { BarRenderer r1 = new BarRenderer(); r1.setDefaultLegendTextFont(new Font(STR, Font.PLAIN, 4)); r1.setDefaultLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.RED, 3.0f, 4.0f, Color.green)); r1.setDefaultLegendShape(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(r1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); BarRenderer r2 = (BarRenderer) in.readObject(); in.close(); assertEquals(r1, r2); r2.notifyListeners(new RendererChangeEvent(r2)); }
/** * Serialize an instance, restore it, and check for equality. In addition, * test for a bug that was reported where the listener list is 'null' after * deserialization. */
Serialize an instance, restore it, and check for equality. In addition, test for a bug that was reported where the listener list is 'null' after deserialization
testSerialization
{ "repo_name": "greearb/jfreechart-fse-ct", "path": "src/test/java/org/jfree/chart/renderer/AbstractRendererTest.java", "license": "lgpl-2.1", "size": 27742 }
[ "java.awt.Color", "java.awt.Font", "java.awt.GradientPaint", "java.awt.geom.Line2D", "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.ObjectInput", "java.io.ObjectInputStream", "java.io.ObjectOutput", "java.io.ObjectOutputStream", "org.jfree.chart.event.RendererChangeEvent", "org.jfree.chart.renderer.category.BarRenderer", "org.junit.Assert" ]
import java.awt.Color; import java.awt.Font; import java.awt.GradientPaint; import java.awt.geom.Line2D; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import org.jfree.chart.event.RendererChangeEvent; import org.jfree.chart.renderer.category.BarRenderer; import org.junit.Assert;
import java.awt.*; import java.awt.geom.*; import java.io.*; import org.jfree.chart.event.*; import org.jfree.chart.renderer.category.*; import org.junit.*;
[ "java.awt", "java.io", "org.jfree.chart", "org.junit" ]
java.awt; java.io; org.jfree.chart; org.junit;
395,923
public void deleteTreesBelow() throws IOException { fileSystem.deleteTreesBelow(this); }
void function() throws IOException { fileSystem.deleteTreesBelow(this); }
/** * Deletes all directory trees recursively beneath this path. Does nothing if the path is not a * directory. * * @throws IOException if the hierarchy cannot be removed successfully */
Deletes all directory trees recursively beneath this path. Does nothing if the path is not a directory
deleteTreesBelow
{ "repo_name": "davidzchen/bazel", "path": "src/main/java/com/google/devtools/build/lib/vfs/Path.java", "license": "apache-2.0", "size": 37594 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
250,856
public MicrosoftGraphDirectoryInner withAdministrativeUnits( List<MicrosoftGraphAdministrativeUnitInner> administrativeUnits) { this.administrativeUnits = administrativeUnits; return this; }
MicrosoftGraphDirectoryInner function( List<MicrosoftGraphAdministrativeUnitInner> administrativeUnits) { this.administrativeUnits = administrativeUnits; return this; }
/** * Set the administrativeUnits property: The administrativeUnits property. * * @param administrativeUnits the administrativeUnits value to set. * @return the MicrosoftGraphDirectoryInner object itself. */
Set the administrativeUnits property: The administrativeUnits property
withAdministrativeUnits
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/MicrosoftGraphDirectoryInner.java", "license": "mit", "size": 4156 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
441,062
Set<String> supportedIds = new HashSet<>(); for (String propertyId : propertyIds) { if (propertyId.startsWith(ZERO_PADDING_PARAM) || PropertyHelper.hasAggregateFunctionSuffix(propertyId)) { supportedIds.add(propertyId); } } propertyIds.removeAll(supportedIds); return propertyIds; }
Set<String> supportedIds = new HashSet<>(); for (String propertyId : propertyIds) { if (propertyId.startsWith(ZERO_PADDING_PARAM) PropertyHelper.hasAggregateFunctionSuffix(propertyId)) { supportedIds.add(propertyId); } } propertyIds.removeAll(supportedIds); return propertyIds; }
/** * Support properties with aggregate functions and metrics padding method. */
Support properties with aggregate functions and metrics padding method
checkPropertyIds
{ "repo_name": "radicalbit/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/controller/metrics/timeline/AMSReportPropertyProvider.java", "license": "apache-2.0", "size": 12677 }
[ "java.util.HashSet", "java.util.Set", "org.apache.ambari.server.controller.utilities.PropertyHelper" ]
import java.util.HashSet; import java.util.Set; import org.apache.ambari.server.controller.utilities.PropertyHelper;
import java.util.*; import org.apache.ambari.server.controller.utilities.*;
[ "java.util", "org.apache.ambari" ]
java.util; org.apache.ambari;
905,922
private static Date fromISODateString(String isoDateString) throws Exception { SimpleDateFormat f = new SimpleDateFormat(FORMAT_DATE_ISO); f.setTimeZone(TimeZone.getTimeZone("UTC")); return f.parse(isoDateString); }
static Date function(String isoDateString) throws Exception { SimpleDateFormat f = new SimpleDateFormat(FORMAT_DATE_ISO); f.setTimeZone(TimeZone.getTimeZone("UTC")); return f.parse(isoDateString); }
/** * Takes in an ISO date string of the following format: * yyyy-mm-ddThh:mm:ss.ms+HoMo * * @param isoDateString the iso date string * @return the date * @throws Exception the exception */
Takes in an ISO date string of the following format: yyyy-mm-ddThh:mm:ss.ms+HoMo
fromISODateString
{ "repo_name": "TecMunky/xDrip", "path": "app/src/main/java/com/eveningoutpost/dexdrip/Models/DateUtil.java", "license": "gpl-3.0", "size": 3340 }
[ "java.text.SimpleDateFormat", "java.util.Date", "java.util.TimeZone" ]
import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
1,284,427
DeploymentQuery parentDeploymentIds(List<String> parentDeploymentIds);
DeploymentQuery parentDeploymentIds(List<String> parentDeploymentIds);
/** * Only select deployments with a parent deployment id that is the same as one of the given deployment identifiers. */
Only select deployments with a parent deployment id that is the same as one of the given deployment identifiers
parentDeploymentIds
{ "repo_name": "flowable/flowable-engine", "path": "modules/flowable-engine/src/main/java/org/flowable/engine/repository/DeploymentQuery.java", "license": "apache-2.0", "size": 5125 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,915,648
void onActivityResult(int requestCode, int resultCode, Intent intent);
void onActivityResult(int requestCode, int resultCode, Intent intent);
/** * Called when an activity you launched exits, giving you the requestCode you started it with, * the resultCode it returned, and any additional data from it. * * @param requestCode The request code originally supplied to startActivityForResult(), * allowing you to identify who this result came from. * @param resultCode The integer result code returned by the child activity through its setResult(). * @param data An Intent, which can return result data to the caller (various data can be attached to Intent "extras"). */
Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it
onActivityResult
{ "repo_name": "roadlabs/android", "path": "appMobiLib/src/com/phonegap/api/IPlugin.java", "license": "mit", "size": 2895 }
[ "android.content.Intent" ]
import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
921,090
public static ViewDragHelper create(final ViewGroup forParent, final float sensitivity, final Callback cb) { final ViewDragHelper helper = create(forParent, cb); helper.mTouchSlop = (int) (helper.mTouchSlop * (1 / sensitivity)); return helper; }
static ViewDragHelper function(final ViewGroup forParent, final float sensitivity, final Callback cb) { final ViewDragHelper helper = create(forParent, cb); helper.mTouchSlop = (int) (helper.mTouchSlop * (1 / sensitivity)); return helper; }
/** * Factory method to create a new ViewDragHelper. * * @param forParent Parent view to monitor * @param sensitivity Multiplier for how sensitive the helper should be * about detecting the start of a drag. Larger values are more * sensitive. 1.0f is normal. * @param cb Callback to provide information and receive events * @return a new ViewDragHelper instance */
Factory method to create a new ViewDragHelper
create
{ "repo_name": "0359xiaodong/twidere", "path": "src/me/imid/swipebacklayout/lib/ViewDragHelper.java", "license": "gpl-3.0", "size": 52841 }
[ "android.view.ViewGroup" ]
import android.view.ViewGroup;
import android.view.*;
[ "android.view" ]
android.view;
1,166,099