method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void run() {
synchronized (processes) {
running = true;
Enumeration e = processes.elements();
while (e.hasMoreElements()) {
Process process = (Process) e.nextElement();
try {
process.destroy();
}
catch (Throwable t) {
System.err.println("Unable to terminate process during process shutdown");
}
}
}
} | void function() { synchronized (processes) { running = true; Enumeration e = processes.elements(); while (e.hasMoreElements()) { Process process = (Process) e.nextElement(); try { process.destroy(); } catch (Throwable t) { System.err.println(STR); } } } } | /**
* Invoked by the VM when it is exiting.
*/ | Invoked by the VM when it is exiting | run | {
"repo_name": "deim0s/XWBEx",
"path": "src/org/apache/commons/exec/ShutdownHookProcessDestroyer.java",
"license": "mit",
"size": 6130
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 1,634,612 |
public void testUserDefinedErrorWithCommentCreation() {
String message = "Error Message";
XMPPError error = new XMPPError(new XMPPError.Condition("my_own_error"), message);
error.toXML();
assertEquals(error.getCondition(), "my_own_error");
assertEquals(error.getCode(), 0);
assertNull(error.getType());
assertEquals(error.getMessage(), message);
} | void function() { String message = STR; XMPPError error = new XMPPError(new XMPPError.Condition(STR), message); error.toXML(); assertEquals(error.getCondition(), STR); assertEquals(error.getCode(), 0); assertNull(error.getType()); assertEquals(error.getMessage(), message); } | /**
* Check the creation of a new xmppError locally where there is not a default defined.
*/ | Check the creation of a new xmppError locally where there is not a default defined | testUserDefinedErrorWithCommentCreation | {
"repo_name": "qingsong-xu/Smack",
"path": "smack-core/src/integration-test/java/org/jivesoftware/smack/util/XMPPErrorTest.java",
"license": "apache-2.0",
"size": 6683
} | [
"org.jivesoftware.smack.packet.XMPPError"
] | import org.jivesoftware.smack.packet.XMPPError; | import org.jivesoftware.smack.packet.*; | [
"org.jivesoftware.smack"
] | org.jivesoftware.smack; | 1,923,869 |
private void actionTypeTest(String type) throws SQLException, IOException
{
println("actionTypeTest:"+type);
Statement s = createStatement();
actionTypesSetup(type);
actionTypesInsertTest(type);
actionTypesUpdateTest(type);
actionTypesDeleteTest(type);
s.executeUpdate("DROP TABLE T_MAIN");
s.executeUpdate("DROP TABLE T_ACTION_ROW");
s.executeUpdate("DROP TABLE T_ACTION_STATEMENT");
s.close();
commit();
} | void function(String type) throws SQLException, IOException { println(STR+type); Statement s = createStatement(); actionTypesSetup(type); actionTypesInsertTest(type); actionTypesUpdateTest(type); actionTypesDeleteTest(type); s.executeUpdate(STR); s.executeUpdate(STR); s.executeUpdate(STR); s.close(); commit(); } | /**
* Test that the action statement of a trigger
* can work with a specific datatype.
* @param type SQL type to be tested
* @throws SQLException
* @throws IOException
*/ | Test that the action statement of a trigger can work with a specific datatype | actionTypeTest | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TriggerTest.java",
"license": "apache-2.0",
"size": 85154
} | [
"java.io.IOException",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.io.IOException; import java.sql.SQLException; import java.sql.Statement; | import java.io.*; import java.sql.*; | [
"java.io",
"java.sql"
] | java.io; java.sql; | 1,993,186 |
@Test
public void testCallbackWithException() throws Exception {
setXmlFile(findFile("callbackWithException.xml"));
IgnoredException expectedException =
IgnoredException.addIgnoredException("While reading Cache XML file");
try {
getCache();
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
if (!(ex.getCause() instanceof AssertionError)) {
throw ex;
}
} finally {
expectedException.remove();
}
} | void function() throws Exception { setXmlFile(findFile(STR)); IgnoredException expectedException = IgnoredException.addIgnoredException(STR); try { getCache(); fail(STR); } catch (CacheXmlException ex) { if (!(ex.getCause() instanceof AssertionError)) { throw ex; } } finally { expectedException.remove(); } } | /**
* Tests parsing an XML file that specifies a cache listener whose constructor throws an
* {@linkplain AssertionError exception}.
*/ | Tests parsing an XML file that specifies a cache listener whose constructor throws an AssertionError exception | testCallbackWithException | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/cache30/CacheXml66DUnitTest.java",
"license": "apache-2.0",
"size": 167383
} | [
"org.apache.geode.cache.CacheXmlException",
"org.apache.geode.test.dunit.IgnoredException",
"org.junit.Assert"
] | import org.apache.geode.cache.CacheXmlException; import org.apache.geode.test.dunit.IgnoredException; import org.junit.Assert; | import org.apache.geode.cache.*; import org.apache.geode.test.dunit.*; import org.junit.*; | [
"org.apache.geode",
"org.junit"
] | org.apache.geode; org.junit; | 1,443,335 |
void recoveryFinished(Region region); | void recoveryFinished(Region region); | /**
* Indicates that recovery has finished on a given region.
*/ | Indicates that recovery has finished on a given region | recoveryFinished | {
"repo_name": "davinash/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java",
"license": "apache-2.0",
"size": 20867
} | [
"org.apache.geode.cache.Region"
] | import org.apache.geode.cache.Region; | import org.apache.geode.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 709,621 |
public void setFileDescriptor(FileDescriptor fileDescriptor) throws IOException {
this.source = factory.createMediaSource(fileDescriptor);
prepareMediaFile();
} | void function(FileDescriptor fileDescriptor) throws IOException { this.source = factory.createMediaSource(fileDescriptor); prepareMediaFile(); } | /**
* Sets input media file.
*
* @param fileDescriptor File descriptor.
* @throws IOException when the file descriptor is invalid or the file can not be opened.
*/ | Sets input media file | setFileDescriptor | {
"repo_name": "INDExOS/media-for-mobile",
"path": "domain/src/main/java/org/m4m/MediaFileInfo.java",
"license": "apache-2.0",
"size": 8313
} | [
"java.io.FileDescriptor",
"java.io.IOException"
] | import java.io.FileDescriptor; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,395,910 |
public void setResponse(HttpServletResponse response) {
this.response = response;
updateReadyStatus();
} | void function(HttpServletResponse response) { this.response = response; updateReadyStatus(); } | /**
* Sets HttpServletResponse object used to set headers and send
* output to
*
* @param response HttpServletResponse to be used
*/ | Sets HttpServletResponse object used to set headers and send output to | setResponse | {
"repo_name": "NorthFacing/step-by-Java",
"path": "fra-tomcat/fra-tomcat-analysis/source/book01/HowTomcatWorks/src/org/apache/catalina/util/ProcessHelper.java",
"license": "gpl-2.0",
"size": 17609
} | [
"javax.servlet.http.HttpServletResponse"
] | import javax.servlet.http.HttpServletResponse; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 802,529 |
public Object[] getRow( ResultSet rs, ResultSetMetaData dummy, RowMetaInterface rowInfo ) throws KettleDatabaseException {
long startTime = System.currentTimeMillis();
try {
int nrcols = rowInfo.size();
Object[] data = RowDataUtil.allocateRowData( nrcols );
if ( rs.next() ) {
for ( int i = 0; i < nrcols; i++ ) {
ValueMetaInterface val = rowInfo.getValueMeta( i );
data[i] = databaseMeta.getValueFromResultSet( rs, val, i );
}
} else {
data = null;
}
return data;
} catch ( Exception ex ) {
throw new KettleDatabaseException( "Couldn't get row from result set", ex );
} finally {
if ( log.isGatheringMetrics() ) {
long time = System.currentTimeMillis() - startTime;
log.snap( Metrics.METRIC_DATABASE_GET_ROW_SUM_TIME, databaseMeta.getName(), time );
log.snap( Metrics.METRIC_DATABASE_GET_ROW_MIN_TIME, databaseMeta.getName(), time );
log.snap( Metrics.METRIC_DATABASE_GET_ROW_MAX_TIME, databaseMeta.getName(), time );
log.snap( Metrics.METRIC_DATABASE_GET_ROW_COUNT, databaseMeta.getName() );
}
}
} | Object[] function( ResultSet rs, ResultSetMetaData dummy, RowMetaInterface rowInfo ) throws KettleDatabaseException { long startTime = System.currentTimeMillis(); try { int nrcols = rowInfo.size(); Object[] data = RowDataUtil.allocateRowData( nrcols ); if ( rs.next() ) { for ( int i = 0; i < nrcols; i++ ) { ValueMetaInterface val = rowInfo.getValueMeta( i ); data[i] = databaseMeta.getValueFromResultSet( rs, val, i ); } } else { data = null; } return data; } catch ( Exception ex ) { throw new KettleDatabaseException( STR, ex ); } finally { if ( log.isGatheringMetrics() ) { long time = System.currentTimeMillis() - startTime; log.snap( Metrics.METRIC_DATABASE_GET_ROW_SUM_TIME, databaseMeta.getName(), time ); log.snap( Metrics.METRIC_DATABASE_GET_ROW_MIN_TIME, databaseMeta.getName(), time ); log.snap( Metrics.METRIC_DATABASE_GET_ROW_MAX_TIME, databaseMeta.getName(), time ); log.snap( Metrics.METRIC_DATABASE_GET_ROW_COUNT, databaseMeta.getName() ); } } } | /**
* Get a row from the resultset.
*
* @param rs
* The resultset to get the row from
* @return one row or null if no row was found on the resultset or if an error occurred.
*/ | Get a row from the resultset | getRow | {
"repo_name": "andrei-viaryshka/pentaho-kettle",
"path": "core/src/org/pentaho/di/core/database/Database.java",
"license": "apache-2.0",
"size": 162372
} | [
"java.sql.ResultSet",
"java.sql.ResultSetMetaData",
"org.pentaho.di.core.exception.KettleDatabaseException",
"org.pentaho.di.core.logging.Metrics",
"org.pentaho.di.core.row.RowDataUtil",
"org.pentaho.di.core.row.RowMetaInterface",
"org.pentaho.di.core.row.ValueMetaInterface"
] | import java.sql.ResultSet; import java.sql.ResultSetMetaData; import org.pentaho.di.core.exception.KettleDatabaseException; import org.pentaho.di.core.logging.Metrics; import org.pentaho.di.core.row.RowDataUtil; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.core.row.ValueMetaInterface; | import java.sql.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.logging.*; import org.pentaho.di.core.row.*; | [
"java.sql",
"org.pentaho.di"
] | java.sql; org.pentaho.di; | 95,236 |
@Test
public void w_table_comment() throws Exception {
TableInfo table = new TableInfo.Builder("testing")
.withComment("Hello, world!")
.withColumn("col1", TypeName.INT)
.build();
emit(new SimpleCreateTable(table));
} | void function() throws Exception { TableInfo table = new TableInfo.Builder(STR) .withComment(STR) .withColumn("col1", TypeName.INT) .build(); emit(new SimpleCreateTable(table)); } | /**
* w/ table comment.
* @throws Exception if exists
*/ | w/ table comment | w_table_comment | {
"repo_name": "akirakw/asakusafw",
"path": "info/hive/src/test/java/com/asakusafw/info/hive/syntax/HiveQlEmitterTest.java",
"license": "apache-2.0",
"size": 11386
} | [
"com.asakusafw.info.hive.FieldType",
"com.asakusafw.info.hive.TableInfo"
] | import com.asakusafw.info.hive.FieldType; import com.asakusafw.info.hive.TableInfo; | import com.asakusafw.info.hive.*; | [
"com.asakusafw.info"
] | com.asakusafw.info; | 2,137,322 |
@Override
public void serializeInstance(SerializationStreamWriter streamWriter, OWLLiteralImplString instance) throws SerializationException {
serialize(streamWriter, instance);
} | void function(SerializationStreamWriter streamWriter, OWLLiteralImplString instance) throws SerializationException { serialize(streamWriter, instance); } | /**
* Serializes the content of the object into the
* {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}.
* @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the
* object's content to
* @param instance the object instance to serialize
* @throws com.google.gwt.user.client.rpc.SerializationException
* if the serialization operation is not
* successful
*/ | Serializes the content of the object into the <code>com.google.gwt.user.client.rpc.SerializationStreamWriter</code> | serializeInstance | {
"repo_name": "matthewhorridge/owlapi-gwt",
"path": "owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLLiteralImplString_CustomFieldSerializer.java",
"license": "lgpl-3.0",
"size": 3862
} | [
"com.google.gwt.user.client.rpc.SerializationException",
"com.google.gwt.user.client.rpc.SerializationStreamWriter"
] | import com.google.gwt.user.client.rpc.SerializationException; import com.google.gwt.user.client.rpc.SerializationStreamWriter; | import com.google.gwt.user.client.rpc.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,304,012 |
public String getPackageFromNamespace(String namespace){
return URLProcessor.makePackageName(namespace);
}
| String function(String namespace){ return URLProcessor.makePackageName(namespace); } | /**
* get the package derived by Namespace
*/ | get the package derived by Namespace | getPackageFromNamespace | {
"repo_name": "arunasujith/wso2-axis2",
"path": "modules/tool/axis2-eclipse-codegen-plugin/src/main/java/org/apache/axis2/tool/codegen/eclipse/ui/OptionsPage.java",
"license": "apache-2.0",
"size": 42218
} | [
"org.apache.axis2.util.URLProcessor"
] | import org.apache.axis2.util.URLProcessor; | import org.apache.axis2.util.*; | [
"org.apache.axis2"
] | org.apache.axis2; | 2,821,774 |
public void invokePropagateNotFound(HttpRequest request, HttpResponse response) throws NotFoundException
{
try
{
pushContextObjects(request, response);
ResourceInvoker invoker = null;
try
{
invoker = getInvoker(request);
}
catch (Exception failure)
{
if (failure instanceof NotFoundException)
{
throw ((NotFoundException) failure);
}
else
{
handleException(request, response, failure);
return;
}
}
try
{
invoke(request, response, invoker);
}
catch (Failure e)
{
handleException(request, response, e);
return;
}
}
finally
{
clearContextData();
}
}
| void function(HttpRequest request, HttpResponse response) throws NotFoundException { try { pushContextObjects(request, response); ResourceInvoker invoker = null; try { invoker = getInvoker(request); } catch (Exception failure) { if (failure instanceof NotFoundException) { throw ((NotFoundException) failure); } else { handleException(request, response, failure); return; } } try { invoke(request, response, invoker); } catch (Failure e) { handleException(request, response, e); return; } } finally { clearContextData(); } } | /**
* Propagate NotFoundException. This is used for Filters
*
* @param request
* @param response
*/ | Propagate NotFoundException. This is used for Filters | invokePropagateNotFound | {
"repo_name": "kabir/re-play",
"path": "resteasy-jaxrs/src/main/java/org/jboss/resteasy/core/SynchronousDispatcher.java",
"license": "apache-2.0",
"size": 21133
} | [
"org.jboss.resteasy.spi.Failure",
"org.jboss.resteasy.spi.HttpRequest",
"org.jboss.resteasy.spi.HttpResponse",
"org.jboss.resteasy.spi.NotFoundException"
] | import org.jboss.resteasy.spi.Failure; import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpResponse; import org.jboss.resteasy.spi.NotFoundException; | import org.jboss.resteasy.spi.*; | [
"org.jboss.resteasy"
] | org.jboss.resteasy; | 1,297,767 |
public void refreshSources(String peerId) throws IOException {
String terminateMessage = "Peer " + peerId +
" state or config changed. Will close the previous replication source and open a new one";
ReplicationPeer peer = replicationPeers.getPeer(peerId);
ReplicationSourceInterface src = createSource(peerId, peer);
// synchronized on latestPaths to avoid missing the new log
synchronized (this.latestPaths) {
ReplicationSourceInterface toRemove = this.sources.put(peerId, src);
if (toRemove != null) {
LOG.info("Terminate replication source for " + toRemove.getPeerId());
// Do not clear metrics
toRemove.terminate(terminateMessage, null, false);
}
for (NavigableSet<String> walsByGroup : walsById.get(peerId).values()) {
walsByGroup.forEach(wal -> src.enqueueLog(new Path(this.logDir, wal)));
}
}
LOG.info("Startup replication source for " + src.getPeerId());
src.startup();
List<ReplicationSourceInterface> toStartup = new ArrayList<>();
// synchronized on oldsources to avoid race with NodeFailoverWorker
synchronized (this.oldsources) {
List<String> previousQueueIds = new ArrayList<>();
for (Iterator<ReplicationSourceInterface> iter = this.oldsources.iterator(); iter
.hasNext();) {
ReplicationSourceInterface oldSource = iter.next();
if (oldSource.getPeerId().equals(peerId)) {
previousQueueIds.add(oldSource.getQueueId());
oldSource.terminate(terminateMessage);
iter.remove();
}
}
for (String queueId : previousQueueIds) {
ReplicationSourceInterface recoveredReplicationSource = createSource(queueId, peer);
this.oldsources.add(recoveredReplicationSource);
for (SortedSet<String> walsByGroup : walsByIdRecoveredQueues.get(queueId).values()) {
walsByGroup.forEach(wal -> recoveredReplicationSource.enqueueLog(new Path(wal)));
}
toStartup.add(recoveredReplicationSource);
}
}
for (ReplicationSourceInterface replicationSource : toStartup) {
replicationSource.startup();
}
} | void function(String peerId) throws IOException { String terminateMessage = STR + peerId + STR; ReplicationPeer peer = replicationPeers.getPeer(peerId); ReplicationSourceInterface src = createSource(peerId, peer); synchronized (this.latestPaths) { ReplicationSourceInterface toRemove = this.sources.put(peerId, src); if (toRemove != null) { LOG.info(STR + toRemove.getPeerId()); toRemove.terminate(terminateMessage, null, false); } for (NavigableSet<String> walsByGroup : walsById.get(peerId).values()) { walsByGroup.forEach(wal -> src.enqueueLog(new Path(this.logDir, wal))); } } LOG.info(STR + src.getPeerId()); src.startup(); List<ReplicationSourceInterface> toStartup = new ArrayList<>(); synchronized (this.oldsources) { List<String> previousQueueIds = new ArrayList<>(); for (Iterator<ReplicationSourceInterface> iter = this.oldsources.iterator(); iter .hasNext();) { ReplicationSourceInterface oldSource = iter.next(); if (oldSource.getPeerId().equals(peerId)) { previousQueueIds.add(oldSource.getQueueId()); oldSource.terminate(terminateMessage); iter.remove(); } } for (String queueId : previousQueueIds) { ReplicationSourceInterface recoveredReplicationSource = createSource(queueId, peer); this.oldsources.add(recoveredReplicationSource); for (SortedSet<String> walsByGroup : walsByIdRecoveredQueues.get(queueId).values()) { walsByGroup.forEach(wal -> recoveredReplicationSource.enqueueLog(new Path(wal))); } toStartup.add(recoveredReplicationSource); } } for (ReplicationSourceInterface replicationSource : toStartup) { replicationSource.startup(); } } | /**
* Close the previous replication sources of this peer id and open new sources to trigger the new
* replication state changes or new replication config changes. Here we don't need to change
* replication queue storage and only to enqueue all logs to the new replication source
* @param peerId the id of the replication peer
*/ | Close the previous replication sources of this peer id and open new sources to trigger the new replication state changes or new replication config changes. Here we don't need to change replication queue storage and only to enqueue all logs to the new replication source | refreshSources | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java",
"license": "apache-2.0",
"size": 45220
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"java.util.NavigableSet",
"java.util.SortedSet",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.replication.ReplicationPeer"
] | import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.NavigableSet; import java.util.SortedSet; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.replication.ReplicationPeer; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.replication.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 438,621 |
public void setFilter (NodeFilter filter)
{
mFilter = filter;
} | void function (NodeFilter filter) { mFilter = filter; } | /** Setter for property filter.
* @param filter New value of property filter.
*
*/ | Setter for property filter | setFilter | {
"repo_name": "bbossgroups/bbossgroups-3.5",
"path": "bboss-htmlparser/src/org/htmlparser/parserapplications/SiteCapturer.java",
"license": "apache-2.0",
"size": 27407
} | [
"org.htmlparser.NodeFilter"
] | import org.htmlparser.NodeFilter; | import org.htmlparser.*; | [
"org.htmlparser"
] | org.htmlparser; | 2,890,397 |
private Reader safeReader(String input) {
StringReader output = null;
if (input == null) {
input = "";
}
else {
input = oldschoolIfy(input);
}
try {
output = new StringReader(input + "<br/>");
}
catch(Exception e) {
log.error("could not get StringReader for String " + input + " due to : " + e);
}
return output;
} | Reader function(String input) { StringReader output = null; if (input == null) { input = STR<br/>STRcould not get StringReader for String STR due to : " + e); } return output; } | /**
* Turns a string into a StringReader with out the fuss of an IOException
*
* @param input
* @return StringReader
*/ | Turns a string into a StringReader with out the fuss of an IOException | safeReader | {
"repo_name": "OpenCollabZA/sakai",
"path": "samigo/samigo-app/src/java/org/sakaiproject/tool/assessment/ui/bean/print/PDFAssessmentBean.java",
"license": "apache-2.0",
"size": 40630
} | [
"java.io.Reader",
"java.io.StringReader"
] | import java.io.Reader; import java.io.StringReader; | import java.io.*; | [
"java.io"
] | java.io; | 361,188 |
public CuratorFramework mkClient(Map conf, List<String> servers, Object port,
String root, final WatcherCallBack watcher) {
CuratorFramework fk = Utils.newCurator(conf, servers, port, root); | CuratorFramework function(Map conf, List<String> servers, Object port, String root, final WatcherCallBack watcher) { CuratorFramework fk = Utils.newCurator(conf, servers, port, root); | /**
* connect ZK, register watchers
*/ | connect ZK, register watchers | mkClient | {
"repo_name": "penuel-leo/jstorm",
"path": "jstorm-core/src/main/java/com/alibaba/jstorm/zk/Zookeeper.java",
"license": "apache-2.0",
"size": 7854
} | [
"com.alibaba.jstorm.callback.WatcherCallBack",
"java.util.List",
"java.util.Map",
"org.apache.curator.framework.CuratorFramework"
] | import com.alibaba.jstorm.callback.WatcherCallBack; import java.util.List; import java.util.Map; import org.apache.curator.framework.CuratorFramework; | import com.alibaba.jstorm.callback.*; import java.util.*; import org.apache.curator.framework.*; | [
"com.alibaba.jstorm",
"java.util",
"org.apache.curator"
] | com.alibaba.jstorm; java.util; org.apache.curator; | 1,602,973 |
static final void putRaw(RestApi api, String in, JavaScriptObject cb) {
api.put(in, wrapRaw(cb));
} | static final void putRaw(RestApi api, String in, JavaScriptObject cb) { api.put(in, wrapRaw(cb)); } | /**
* The same as {@link #put(RestApi, String, JavaScriptObject)} but without
* converting a {@link NativeString} result to String.
*/ | The same as <code>#put(RestApi, String, JavaScriptObject)</code> but without converting a <code>NativeString</code> result to String | putRaw | {
"repo_name": "netroby/gerrit",
"path": "gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ActionContext.java",
"license": "apache-2.0",
"size": 9930
} | [
"com.google.gerrit.client.rpc.RestApi",
"com.google.gwt.core.client.JavaScriptObject"
] | import com.google.gerrit.client.rpc.RestApi; import com.google.gwt.core.client.JavaScriptObject; | import com.google.gerrit.client.rpc.*; import com.google.gwt.core.client.*; | [
"com.google.gerrit",
"com.google.gwt"
] | com.google.gerrit; com.google.gwt; | 352,595 |
protected byte[] getSerializedValue(ObjectInspector fieldObjectInspector, Object value,
ByteStream.Output output, ColumnMapping mapping) throws IOException {
// Reset the buffer we're going to use
output.reset();
// Start by only serializing primitives as-is
if (fieldObjectInspector.getCategory() == ObjectInspector.Category.PRIMITIVE) {
writeSerializedPrimitive((PrimitiveObjectInspector) fieldObjectInspector, output, value,
mapping.getEncoding());
} else {
// We only accept a struct, which means that we're already nested one level deep
writeWithLevel(fieldObjectInspector, value, output, mapping, 2);
}
return output.toByteArray();
} | byte[] function(ObjectInspector fieldObjectInspector, Object value, ByteStream.Output output, ColumnMapping mapping) throws IOException { output.reset(); if (fieldObjectInspector.getCategory() == ObjectInspector.Category.PRIMITIVE) { writeSerializedPrimitive((PrimitiveObjectInspector) fieldObjectInspector, output, value, mapping.getEncoding()); } else { writeWithLevel(fieldObjectInspector, value, output, mapping, 2); } return output.toByteArray(); } | /**
* Compute the serialized value from the given element and object inspectors. Based on the Hive
* types, represented through the ObjectInspectors for the whole object and column within the
* object, serialize the object appropriately.
*
* @param fieldObjectInspector
* ObjectInspector for the column value being serialized
* @param value
* The Object itself being serialized
* @param output
* A temporary buffer to reduce object creation
* @return The serialized bytes from the provided value.
* @throws IOException
* An error occurred when performing IO to serialize the data
*/ | Compute the serialized value from the given element and object inspectors. Based on the Hive types, represented through the ObjectInspectors for the whole object and column within the object, serialize the object appropriately | getSerializedValue | {
"repo_name": "WANdisco/amplab-hive",
"path": "accumulo-handler/src/java/org/apache/hadoop/hive/accumulo/serde/AccumuloRowSerializer.java",
"license": "apache-2.0",
"size": 15579
} | [
"java.io.IOException",
"org.apache.hadoop.hive.accumulo.columns.ColumnMapping",
"org.apache.hadoop.hive.serde2.ByteStream",
"org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector",
"org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector"
] | import java.io.IOException; import org.apache.hadoop.hive.accumulo.columns.ColumnMapping; import org.apache.hadoop.hive.serde2.ByteStream; import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; | import java.io.*; import org.apache.hadoop.hive.accumulo.columns.*; import org.apache.hadoop.hive.serde2.*; import org.apache.hadoop.hive.serde2.objectinspector.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 973,397 |
@Override
public void setBlob(String parameterName, Blob x)
throws SQLException {
setBlob(getIndexForName(parameterName), x);
} | void function(String parameterName, Blob x) throws SQLException { setBlob(getIndexForName(parameterName), x); } | /**
* Sets the value of a parameter as a Blob.
*
* @param parameterName the parameter name
* @param x the value
* @throws SQLException if this object is closed
*/ | Sets the value of a parameter as a Blob | setBlob | {
"repo_name": "paulnguyen/data",
"path": "sqldbs/h2java/src/main/org/h2/jdbc/JdbcCallableStatement.java",
"license": "apache-2.0",
"size": 53148
} | [
"java.sql.Blob",
"java.sql.SQLException"
] | import java.sql.Blob; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,506,753 |
static int findClosestNumBits(long value)
{
int count = 0;
while (value != 0) {
count++;
value = value >>> 1;
}
return getClosestFixedBits(count);
} | static int findClosestNumBits(long value) { int count = 0; while (value != 0) { count++; value = value >>> 1; } return getClosestFixedBits(count); } | /**
* Count the number of bits required to encode the given value
*/ | Count the number of bits required to encode the given value | findClosestNumBits | {
"repo_name": "arhimondr/presto",
"path": "presto-orc/src/main/java/com/facebook/presto/orc/stream/LongOutputStreamV2.java",
"license": "apache-2.0",
"size": 52464
} | [
"com.facebook.presto.orc.stream.LongOutputStreamV2"
] | import com.facebook.presto.orc.stream.LongOutputStreamV2; | import com.facebook.presto.orc.stream.*; | [
"com.facebook.presto"
] | com.facebook.presto; | 488,719 |
public void sendSelf(final FutureResponse futureResponse, final Message message) {
LOG.debug("Handle message that is intended for the sender itself {}", message);
message.sendSelf(); | void function(final FutureResponse futureResponse, final Message message) { LOG.debug(STR, message); message.sendSelf(); | /**
* In case a message is sent to the sender itself, this is the cutoff.
*
* @param futureResponse
* the future to respond as soon as the proper handler returns it
* @param message
* the request
*/ | In case a message is sent to the sender itself, this is the cutoff | sendSelf | {
"repo_name": "tomp2p/TomP2P",
"path": "core/src/main/java/net/tomp2p/connection/Sender.java",
"license": "apache-2.0",
"size": 35398
} | [
"net.tomp2p.futures.FutureResponse",
"net.tomp2p.message.Message"
] | import net.tomp2p.futures.FutureResponse; import net.tomp2p.message.Message; | import net.tomp2p.futures.*; import net.tomp2p.message.*; | [
"net.tomp2p.futures",
"net.tomp2p.message"
] | net.tomp2p.futures; net.tomp2p.message; | 309,577 |
public SearchSourceBuilder fetchSource(@Nullable String[] includes, @Nullable String[] excludes) {
FetchSourceContext fetchSourceContext = this.fetchSourceContext != null ? this.fetchSourceContext
: FetchSourceContext.FETCH_SOURCE;
this.fetchSourceContext = new FetchSourceContext(fetchSourceContext.fetchSource(), includes, excludes);
return this;
} | SearchSourceBuilder function(@Nullable String[] includes, @Nullable String[] excludes) { FetchSourceContext fetchSourceContext = this.fetchSourceContext != null ? this.fetchSourceContext : FetchSourceContext.FETCH_SOURCE; this.fetchSourceContext = new FetchSourceContext(fetchSourceContext.fetchSource(), includes, excludes); return this; } | /**
* Indicate that _source should be returned with every hit, with an
* "include" and/or "exclude" set which can include simple wildcard
* elements.
*
* @param includes
* An optional list of include (optionally wildcarded) pattern to
* filter the returned _source
* @param excludes
* An optional list of exclude (optionally wildcarded) pattern to
* filter the returned _source
*/ | Indicate that _source should be returned with every hit, with an "include" and/or "exclude" set which can include simple wildcard elements | fetchSource | {
"repo_name": "nezirus/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java",
"license": "apache-2.0",
"size": 58739
} | [
"org.elasticsearch.common.Nullable",
"org.elasticsearch.search.fetch.subphase.FetchSourceContext"
] | import org.elasticsearch.common.Nullable; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; | import org.elasticsearch.common.*; import org.elasticsearch.search.fetch.subphase.*; | [
"org.elasticsearch.common",
"org.elasticsearch.search"
] | org.elasticsearch.common; org.elasticsearch.search; | 843,403 |
private JFreeChart createChart(String title, final XYDataset dataset) {
// create the chart...
final JFreeChart chart = ChartFactory.createTimeSeriesChart(
title, // chart title
"Time", // x axis label
"Intensity", // y axis label
dataset, // data
true, // include legend
true, // tooltips
false // urls
);
// NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
chart.setBackgroundPaint(Color.white);
// final StandardLegend legend = (StandardLegend) chart.getLegend();
// legend.setDisplaySeriesShapes(true);
// get a reference to the plot for further customisation...
final XYPlot plot = chart.getXYPlot();
plot.setBackgroundPaint(Color.lightGray);
// plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
final BasicStroke stroke = new BasicStroke(2.0f);
renderer.setSeriesShapesVisible(0, false);
renderer.setSeriesStroke(0, stroke);
renderer.setSeriesShapesVisible(1, false);
renderer.setSeriesStroke(1, stroke);
plot.setRenderer(renderer);
// change the auto tick unit selection to integer units only...
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// OPTIONAL CUSTOMISATION COMPLETED.
saveChart(chart, 800, 600);
return chart;
}
| JFreeChart function(String title, final XYDataset dataset) { final JFreeChart chart = ChartFactory.createTimeSeriesChart( title, "Time", STR, dataset, true, true, false ); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); final BasicStroke stroke = new BasicStroke(2.0f); renderer.setSeriesShapesVisible(0, false); renderer.setSeriesStroke(0, stroke); renderer.setSeriesShapesVisible(1, false); renderer.setSeriesStroke(1, stroke); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); saveChart(chart, 800, 600); return chart; } | /**
* Creates a chart.
*
* @param dataset the data for the chart.
*
* @return a chart.
*/ | Creates a chart | createChart | {
"repo_name": "V2G-Ltd/Carbon-Intensity-Java",
"path": "CarbonIntensity/src/main/java/com/v2g/CarbonIntensity/LineChart.java",
"license": "mit",
"size": 6142
} | [
"java.awt.BasicStroke",
"java.awt.Color",
"org.jfree.chart.ChartFactory",
"org.jfree.chart.JFreeChart",
"org.jfree.chart.axis.NumberAxis",
"org.jfree.chart.plot.XYPlot",
"org.jfree.chart.renderer.xy.XYLineAndShapeRenderer",
"org.jfree.data.xy.XYDataset"
] | import java.awt.BasicStroke; import java.awt.Color; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; import org.jfree.data.xy.XYDataset; | import java.awt.*; import org.jfree.chart.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.chart.renderer.xy.*; import org.jfree.data.xy.*; | [
"java.awt",
"org.jfree.chart",
"org.jfree.data"
] | java.awt; org.jfree.chart; org.jfree.data; | 395,331 |
public StoredSortedMap getShipmentByPartMap() {
return shipmentByPartMap;
} | StoredSortedMap function() { return shipmentByPartMap; } | /**
* Return a map view of the shipment-by-part index.
*/ | Return a map view of the shipment-by-part index | getShipmentByPartMap | {
"repo_name": "mxrrow/zaicoin",
"path": "src/deps/db/examples_java/src/collections/ship/index/SampleViews.java",
"license": "mit",
"size": 5178
} | [
"com.sleepycat.collections.StoredSortedMap"
] | import com.sleepycat.collections.StoredSortedMap; | import com.sleepycat.collections.*; | [
"com.sleepycat.collections"
] | com.sleepycat.collections; | 149,822 |
public CellValue< ? extends Comparable< ? >> makeCellValue(TemplateDataColumn column,
int iRow,
int iCol,
String initialValue) {
DTDataTypes dataType = getDataType( column );
CellValue< ? extends Comparable< ? >> cell = null;
switch ( dataType ) {
case BOOLEAN :
Boolean b = Boolean.FALSE;
try {
b = Boolean.valueOf( initialValue );
} catch ( Exception e ) {
}
cell = makeNewBooleanCellValue( iRow,
iCol,
b );
break;
case DATE :
Date d = null;
try {
if ( DATE_CONVERTOR == null ) {
throw new IllegalArgumentException( "DATE_CONVERTOR has not been initialised." );
}
d = DATE_CONVERTOR.parse( initialValue );
} catch ( Exception e ) {
}
cell = makeNewDateCellValue( iRow,
iCol,
d );
break;
case NUMERIC :
BigDecimal bd = null;
try {
bd = new BigDecimal( initialValue );
} catch ( Exception e ) {
}
cell = makeNewNumericCellValue( iRow,
iCol,
bd );
break;
default :
cell = makeNewStringCellValue( iRow,
iCol,
initialValue );
}
return cell;
} | CellValue< ? extends Comparable< ? >> function(TemplateDataColumn column, int iRow, int iCol, String initialValue) { DTDataTypes dataType = getDataType( column ); CellValue< ? extends Comparable< ? >> cell = null; switch ( dataType ) { case BOOLEAN : Boolean b = Boolean.FALSE; try { b = Boolean.valueOf( initialValue ); } catch ( Exception e ) { } cell = makeNewBooleanCellValue( iRow, iCol, b ); break; case DATE : Date d = null; try { if ( DATE_CONVERTOR == null ) { throw new IllegalArgumentException( STR ); } d = DATE_CONVERTOR.parse( initialValue ); } catch ( Exception e ) { } cell = makeNewDateCellValue( iRow, iCol, d ); break; case NUMERIC : BigDecimal bd = null; try { bd = new BigDecimal( initialValue ); } catch ( Exception e ) { } cell = makeNewNumericCellValue( iRow, iCol, bd ); break; default : cell = makeNewStringCellValue( iRow, iCol, initialValue ); } return cell; } | /**
* Make a CellValue applicable for the column. This is used by legacy UI
* Models (Template Data Editor and legacy Guided Decision Tables) that
* store values in a two-dimensional array of Strings.
*
* @param column
* The model column
* @param iRow
* Row coordinate for initialisation
* @param iCol
* Column coordinate for initialisation
* @param initialValue
* The initial value of the cell
* @return A CellValue
*/ | Make a CellValue applicable for the column. This is used by legacy UI Models (Template Data Editor and legacy Guided Decision Tables) that store values in a two-dimensional array of Strings | makeCellValue | {
"repo_name": "Rikkola/guvnor",
"path": "guvnor-webapp/src/main/java/org/drools/guvnor/client/modeldriven/ui/TemplateDataCellValueFactory.java",
"license": "apache-2.0",
"size": 7025
} | [
"java.math.BigDecimal",
"java.util.Date",
"org.drools.guvnor.client.widgets.decoratedgrid.CellValue",
"org.drools.ide.common.client.modeldriven.dt.DTDataTypes"
] | import java.math.BigDecimal; import java.util.Date; import org.drools.guvnor.client.widgets.decoratedgrid.CellValue; import org.drools.ide.common.client.modeldriven.dt.DTDataTypes; | import java.math.*; import java.util.*; import org.drools.guvnor.client.widgets.decoratedgrid.*; import org.drools.ide.common.client.modeldriven.dt.*; | [
"java.math",
"java.util",
"org.drools.guvnor",
"org.drools.ide"
] | java.math; java.util; org.drools.guvnor; org.drools.ide; | 940,876 |
@Override
public void reset() {
if (DEBUG) Log.d(TAG, "Received reset request.");
mStarted = false;
mScroller.reset();
} | void function() { if (DEBUG) Log.d(TAG, STR); mStarted = false; mScroller.reset(); } | /**
* Immediately "Stops" active gesture selection, and resets all related state.
*/ | Immediately "Stops" active gesture selection, and resets all related state | reset | {
"repo_name": "AndroidX/androidx",
"path": "recyclerview/recyclerview-selection/src/main/java/androidx/recyclerview/selection/GestureSelectionHelper.java",
"license": "apache-2.0",
"size": 11022
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 1,600,944 |
final HttpUriRequest request = new HttpGet(url);
execute(request, handler);
} | final HttpUriRequest request = new HttpGet(url); execute(request, handler); } | /**
* Execute a {@link HttpGet} request, passing a valid response through
* {@link XmlHandler#parseAndApply(XmlPullParser, ContentResolver)}.
*/ | Execute a <code>HttpGet</code> request, passing a valid response through <code>XmlHandler#parseAndApply(XmlPullParser, ContentResolver)</code> | executeGet | {
"repo_name": "underhilllabs/dccsched",
"path": "src/com/underhilllabs/dccsched/io/RemoteExecutor.java",
"license": "apache-2.0",
"size": 3234
} | [
"org.apache.http.client.methods.HttpGet",
"org.apache.http.client.methods.HttpUriRequest"
] | import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpUriRequest; | import org.apache.http.client.methods.*; | [
"org.apache.http"
] | org.apache.http; | 2,700,018 |
protected void addServicePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Constraint_service_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Constraint_service_feature", "_UI_Constraint_type"),
MetawebdesignPackage.Literals.CONSTRAINT__SERVICE,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), MetawebdesignPackage.Literals.CONSTRAINT__SERVICE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Service feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Service feature. | addServicePropertyDescriptor | {
"repo_name": "MetaWebDesign/Editor",
"path": "Editor_MWD.edit/src/Metawebdesign/metawebdesign/provider/ConstraintItemProvider.java",
"license": "agpl-3.0",
"size": 8485
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,158,599 |
@PublicAPI(usage = ACCESS)
CONJUNCTION areNotProtected(); | @PublicAPI(usage = ACCESS) CONJUNCTION areNotProtected(); | /**
* Matches non-protected members.
*
* @return A syntax conjunction element, which can be completed to form a full rule
*/ | Matches non-protected members | areNotProtected | {
"repo_name": "TNG/ArchUnit",
"path": "archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersThat.java",
"license": "apache-2.0",
"size": 18147
} | [
"com.tngtech.archunit.PublicAPI"
] | import com.tngtech.archunit.PublicAPI; | import com.tngtech.archunit.*; | [
"com.tngtech.archunit"
] | com.tngtech.archunit; | 95,385 |
int inferMessageSize(ByteBuffer buf, int index, int limit, int version) throws InvalidLegacyProtocolMagic
{
int size = version >= VERSION_40 ? inferMessageSizePost40(buf, index, limit) : inferMessageSizePre40(buf, index, limit);
if (size > DatabaseDescriptor.getInternodeMaxMessageSizeInBytes())
throw new OversizedMessageException(size);
return size;
}
/**
* Partially deserialize the message - by only extracting the header and leaving the payload alone.
*
* To get the rest of the message without repeating the work done here, use {@link #deserialize(DataInputPlus, Header, int)} | int inferMessageSize(ByteBuffer buf, int index, int limit, int version) throws InvalidLegacyProtocolMagic { int size = version >= VERSION_40 ? inferMessageSizePost40(buf, index, limit) : inferMessageSizePre40(buf, index, limit); if (size > DatabaseDescriptor.getInternodeMaxMessageSizeInBytes()) throw new OversizedMessageException(size); return size; } /** * Partially deserialize the message - by only extracting the header and leaving the payload alone. * * To get the rest of the message without repeating the work done here, use {@link #deserialize(DataInputPlus, Header, int)} | /**
* Size of the next message in the stream. Returns -1 if there aren't sufficient bytes read yet to determine size.
*/ | Size of the next message in the stream. Returns -1 if there aren't sufficient bytes read yet to determine size | inferMessageSize | {
"repo_name": "thelastpickle/cassandra",
"path": "src/java/org/apache/cassandra/net/Message.java",
"license": "apache-2.0",
"size": 51272
} | [
"java.nio.ByteBuffer",
"org.apache.cassandra.config.DatabaseDescriptor",
"org.apache.cassandra.io.util.DataInputPlus"
] | import java.nio.ByteBuffer; import org.apache.cassandra.config.DatabaseDescriptor; import org.apache.cassandra.io.util.DataInputPlus; | import java.nio.*; import org.apache.cassandra.config.*; import org.apache.cassandra.io.util.*; | [
"java.nio",
"org.apache.cassandra"
] | java.nio; org.apache.cassandra; | 2,844,032 |
@Test(timeout = 90000)
public void testSessionEstablishment() throws Exception {
qu.shutdown(2);
CountdownWatcher watcher = new CountdownWatcher();
ZooKeeper zk = new ZooKeeper(qu.getConnString(), CONNECTION_TIMEOUT,
watcher, true);
watcher.waitForConnected(CONNECTION_TIMEOUT);
Assert.assertSame("should be in r/o mode", States.CONNECTEDREADONLY, zk
.getState());
long fakeId = zk.getSessionId();
watcher.reset();
qu.start(2);
Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp(
"127.0.0.1:" + qu.getPeer(2).clientPort, CONNECTION_TIMEOUT));
watcher.waitForConnected(CONNECTION_TIMEOUT);
zk.create("/test", "test".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE,
CreateMode.PERSISTENT);
Assert.assertFalse("fake session and real session have same id", zk
.getSessionId() == fakeId);
zk.close();
} | @Test(timeout = 90000) void function() throws Exception { qu.shutdown(2); CountdownWatcher watcher = new CountdownWatcher(); ZooKeeper zk = new ZooKeeper(qu.getConnString(), CONNECTION_TIMEOUT, watcher, true); watcher.waitForConnected(CONNECTION_TIMEOUT); Assert.assertSame(STR, States.CONNECTEDREADONLY, zk .getState()); long fakeId = zk.getSessionId(); watcher.reset(); qu.start(2); Assert.assertTrue(STR, ClientBase.waitForServerUp( STR + qu.getPeer(2).clientPort, CONNECTION_TIMEOUT)); watcher.waitForConnected(CONNECTION_TIMEOUT); zk.create("/test", "test".getBytes(), ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); Assert.assertFalse(STR, zk .getSessionId() == fakeId); zk.close(); } | /**
* Tests a situation when client firstly connects to a read-only server and
* then connects to a majority server. Transition should be transparent for
* the user.
*/ | Tests a situation when client firstly connects to a read-only server and then connects to a majority server. Transition should be transparent for the user | testSessionEstablishment | {
"repo_name": "pedrohrf/ZookeeperQuasarFibers",
"path": "src/java/test/org/apache/zookeeper/test/ReadOnlyModeTest.java",
"license": "apache-2.0",
"size": 11886
} | [
"org.apache.zookeeper.CreateMode",
"org.apache.zookeeper.ZooDefs",
"org.apache.zookeeper.ZooKeeper",
"org.apache.zookeeper.test.ClientBase",
"org.junit.Assert",
"org.junit.Test"
] | import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.ZooDefs; import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.test.ClientBase; import org.junit.Assert; import org.junit.Test; | import org.apache.zookeeper.*; import org.apache.zookeeper.test.*; import org.junit.*; | [
"org.apache.zookeeper",
"org.junit"
] | org.apache.zookeeper; org.junit; | 2,412,142 |
public void nextPacket(PcapPacket packet, Object user) {
list.add(packet);
} | void function(PcapPacket packet, Object user) { list.add(packet); } | /**
* Next packet.
*
* @param packet
* the packet
* @param user
* the user
* @see org.jnetpcap.packet.PcapPacketHandler#nextPacket(org.jnetpcap.packet.PcapPacket,
* java.lang.Object)
*/ | Next packet | nextPacket | {
"repo_name": "universsky/diddler",
"path": "src/org/jnetpcap/util/PcapPacketArrayList.java",
"license": "lgpl-3.0",
"size": 8818
} | [
"org.jnetpcap.packet.PcapPacket"
] | import org.jnetpcap.packet.PcapPacket; | import org.jnetpcap.packet.*; | [
"org.jnetpcap.packet"
] | org.jnetpcap.packet; | 2,819,440 |
protected void processGrayColorSpace(PDColorSpace colorSpace)
{
if (!processDefaultColorSpace(colorSpace) && iccpw == null)
{
context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING,
"DestOutputProfile is missing"));
}
} | void function(PDColorSpace colorSpace) { if (!processDefaultColorSpace(colorSpace) && iccpw == null) { context.addValidationError(new ValidationError(ERROR_GRAPHIC_INVALID_COLOR_SPACE_MISSING, STR)); } } | /**
* Method called by the processAllColorSpace if the ColorSpace to check is DeviceGray.
*
*/ | Method called by the processAllColorSpace if the ColorSpace to check is DeviceGray | processGrayColorSpace | {
"repo_name": "BezrukovM/veraPDF-pdfbox",
"path": "preflight/src/main/java/org/apache/pdfbox/preflight/graphic/StandardColorSpaceHelper.java",
"license": "apache-2.0",
"size": 17946
} | [
"org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace",
"org.apache.pdfbox.preflight.ValidationResult"
] | import org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace; import org.apache.pdfbox.preflight.ValidationResult; | import org.apache.pdfbox.pdmodel.graphics.color.*; import org.apache.pdfbox.preflight.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 777,975 |
private void intersect( Merger<V> m, FlowMap<K,V> m1, FlowMap<K,V> m2 )
{
if( m1 == m2 )
return;
else{
List<K> keysToRemove = Lists.newLinkedList();
List<K> keysToMerge = Lists.newLinkedList();
for( K key : m2.keySet() )
if( !m1.containsKey( key ) )
keysToRemove.add( key );
else
keysToMerge.add(key);
m2.removeKeys( keysToRemove );
for( K key : keysToMerge )
m2.mergePut( m, key, m1.get(key) );
}
} | void function( Merger<V> m, FlowMap<K,V> m1, FlowMap<K,V> m2 ) { if( m1 == m2 ) return; else{ List<K> keysToRemove = Lists.newLinkedList(); List<K> keysToMerge = Lists.newLinkedList(); for( K key : m2.keySet() ) if( !m1.containsKey( key ) ) keysToRemove.add( key ); else keysToMerge.add(key); m2.removeKeys( keysToRemove ); for( K key : keysToMerge ) m2.mergePut( m, key, m1.get(key) ); } } | /**
* Intersect {@code m1} and {@code m2}, putting the result into
* {@code m2}. The Merger {@code m} is used for merging. This
* assumes that all inputs are not null.
*/ | Intersect m1 and m2, putting the result into m2. The Merger m is used for merging. This assumes that all inputs are not null | intersect | {
"repo_name": "bpilania/Comp621Project",
"path": "languages/Natlab/src/natlab/toolkits/analysis/AbstractFlowMap.java",
"license": "apache-2.0",
"size": 15240
} | [
"com.google.common.collect.Lists",
"java.util.List"
] | import com.google.common.collect.Lists; import java.util.List; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 248,184 |
public static Provider[] getProviders(String filter) {
if (filter == null) {
throw new NullPointerException("filter == null");
}
if (filter.length() == 0) {
throw new InvalidParameterException();
}
HashMap<String, String> hm = new HashMap<String, String>();
int i = filter.indexOf(':');
if ((i == filter.length() - 1) || (i == 0)) {
throw new InvalidParameterException();
}
if (i < 1) {
hm.put(filter, "");
} else {
hm.put(filter.substring(0, i), filter.substring(i + 1));
}
return getProviders(hm);
} | static Provider[] function(String filter) { if (filter == null) { throw new NullPointerException(STR); } if (filter.length() == 0) { throw new InvalidParameterException(); } HashMap<String, String> hm = new HashMap<String, String>(); int i = filter.indexOf(':'); if ((i == filter.length() - 1) (i == 0)) { throw new InvalidParameterException(); } if (i < 1) { hm.put(filter, ""); } else { hm.put(filter.substring(0, i), filter.substring(i + 1)); } return getProviders(hm); } | /**
* Returns the array of providers which meet the user supplied string
* filter. The specified filter must be supplied in one of two formats:
* <nl>
* <li> CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE
* <p>
* (for example: "MessageDigest.SHA")
* <li> CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE
* ATTR_NAME:ATTR_VALUE
* <p>
* (for example: "Signature.MD2withRSA KeySize:512")
* </nl>
*
* @param filter
* case-insensitive filter.
* @return the providers which meet the user supplied string filter {@code
* filter}. A {@code null} value signifies that none of the
* installed providers meets the filter specification.
* @throws InvalidParameterException
* if an unusable filter is supplied.
* @throws NullPointerException
* if {@code filter} is {@code null}.
*/ | Returns the array of providers which meet the user supplied string filter. The specified filter must be supplied in one of two formats: CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE (for example: "MessageDigest.SHA") CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE (for example: "Signature.MD2withRSA KeySize:512") | getProviders | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/java/security/Security.java",
"license": "apache-2.0",
"size": 15212
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,761,567 |
@SuppressWarnings("deprecation")
public void about() {
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle(R.string.about);
alertDialog.setMessage("Ôï ViThess åßíáé ìßá åöáñìïãÞ ç ïðïßá áíáðôý÷èçêå áðü ôçí ËÜôóéïõ Ãåùñãßá êáé ôïí Êáðßñç ÓôÝöáíï, óå óõíåñãáóßá ìå ôo AÐÈ, êáé óôü÷ïò ôçò åßíáé íá ðñïùèÞóåé ôçí Èåóóáëïíßêç ùò Ýîõðíç ðüëç.");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) { }
| @SuppressWarnings(STR) void function() { AlertDialog alertDialog = new AlertDialog.Builder(this).create(); alertDialog.setTitle(R.string.about); alertDialog.setMessage(STR); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } | /**
* Function about
*/ | Function about | about | {
"repo_name": "GRboss/vithess",
"path": "ViThess_Android/src/com/vithess/ListMessages.java",
"license": "gpl-3.0",
"size": 25971
} | [
"android.app.AlertDialog",
"android.content.DialogInterface",
"android.view.View"
] | import android.app.AlertDialog; import android.content.DialogInterface; import android.view.View; | import android.app.*; import android.content.*; import android.view.*; | [
"android.app",
"android.content",
"android.view"
] | android.app; android.content; android.view; | 2,845,025 |
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
public static EquityBarrierOptionSecurity.Meta meta() {
return EquityBarrierOptionSecurity.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(EquityBarrierOptionSecurity.Meta.INSTANCE);
} | static EquityBarrierOptionSecurity.Meta function() { return EquityBarrierOptionSecurity.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(EquityBarrierOptionSecurity.Meta.INSTANCE); } | /**
* The meta-bean for {@code EquityBarrierOptionSecurity}.
* @return the meta-bean, not null
*/ | The meta-bean for EquityBarrierOptionSecurity | meta | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial-types/src/main/java/com/opengamma/financial/security/option/EquityBarrierOptionSecurity.java",
"license": "apache-2.0",
"size": 32422
} | [
"org.joda.beans.JodaBeanUtils"
] | import org.joda.beans.JodaBeanUtils; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 213,634 |
public Date getCreatedDate() {
return createdDate;
} | Date function() { return createdDate; } | /**
* Pass lastModified parameter from parent to child.
*
* @return Returns the creationDate.
*/ | Pass lastModified parameter from parent to child | getCreatedDate | {
"repo_name": "RLDevOps/Demo",
"path": "src/main/java/org/olat/search/service/SearchResourceContext.java",
"license": "apache-2.0",
"size": 6681
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 821,186 |
private JSType testNameNode(String name) {
Node node = Node.newString(Token.NAME, name);
Node parent = new Node(Token.SCRIPT, node);
parent.setInputId(new InputId("code"));
Node externs = new Node(Token.SCRIPT);
externs.setInputId(new InputId("externs"));
Node externAndJsRoot = new Node(Token.BLOCK, externs, parent);
externAndJsRoot.setIsSyntheticBlock(true);
makeTypeCheck().processForTesting(null, parent);
return node.getJSType();
} | JSType function(String name) { Node node = Node.newString(Token.NAME, name); Node parent = new Node(Token.SCRIPT, node); parent.setInputId(new InputId("code")); Node externs = new Node(Token.SCRIPT); externs.setInputId(new InputId(STR)); Node externAndJsRoot = new Node(Token.BLOCK, externs, parent); externAndJsRoot.setIsSyntheticBlock(true); makeTypeCheck().processForTesting(null, parent); return node.getJSType(); } | /**
* Type checks a NAME node and retrieve its type.
*/ | Type checks a NAME node and retrieve its type | testNameNode | {
"repo_name": "tntim96/closure-compiler",
"path": "test/com/google/javascript/jscomp/TypeCheckTest.java",
"license": "apache-2.0",
"size": 480049
} | [
"com.google.javascript.rhino.InputId",
"com.google.javascript.rhino.Node",
"com.google.javascript.rhino.Token",
"com.google.javascript.rhino.jstype.JSType"
] | import com.google.javascript.rhino.InputId; import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; import com.google.javascript.rhino.jstype.JSType; | import com.google.javascript.rhino.*; import com.google.javascript.rhino.jstype.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,552,540 |
public void buildLabel(final PresentationPropertyDescriptor<?, ?> property, final RenderContext context, final Locale locale) {
this.label = new HtmlOutputLabel();
this.label.setId(this.compileLabelName(context.getPrefixDeque()));
this.label.setFor(this.compileInputName(context.getPrefixDeque()));
final StringBuilder builder = new StringBuilder();
builder.append(property.getDescription(locale));
builder.append(DefaultReadOnlyOutput.LABEL_SEPARATOR);
this.label.setValue(builder.toString());
this.label.setStyleClass(context.resolveStyleClass(JsfStyleClasses.FORM_OUTPUT_LABEL));
} | void function(final PresentationPropertyDescriptor<?, ?> property, final RenderContext context, final Locale locale) { this.label = new HtmlOutputLabel(); this.label.setId(this.compileLabelName(context.getPrefixDeque())); this.label.setFor(this.compileInputName(context.getPrefixDeque())); final StringBuilder builder = new StringBuilder(); builder.append(property.getDescription(locale)); builder.append(DefaultReadOnlyOutput.LABEL_SEPARATOR); this.label.setValue(builder.toString()); this.label.setStyleClass(context.resolveStyleClass(JsfStyleClasses.FORM_OUTPUT_LABEL)); } | /**
* Build the label.
*
* @param property
* The property.
* @param context
* The render context.
* @param locale
* The locale.
*/ | Build the label | buildLabel | {
"repo_name": "lunarray-org/model-gen-jsf",
"path": "src/main/java/org/lunarray/model/generation/jsf/render/factories/form/jsf/components/DefaultReadOnlyOutput.java",
"license": "lgpl-3.0",
"size": 8122
} | [
"java.util.Locale",
"javax.faces.component.html.HtmlOutputLabel",
"org.lunarray.model.descriptor.presentation.PresentationPropertyDescriptor",
"org.lunarray.model.generation.jsf.render.JsfStyleClasses",
"org.lunarray.model.generation.jsf.render.RenderContext"
] | import java.util.Locale; import javax.faces.component.html.HtmlOutputLabel; import org.lunarray.model.descriptor.presentation.PresentationPropertyDescriptor; import org.lunarray.model.generation.jsf.render.JsfStyleClasses; import org.lunarray.model.generation.jsf.render.RenderContext; | import java.util.*; import javax.faces.component.html.*; import org.lunarray.model.descriptor.presentation.*; import org.lunarray.model.generation.jsf.render.*; | [
"java.util",
"javax.faces",
"org.lunarray.model"
] | java.util; javax.faces; org.lunarray.model; | 2,519,163 |
public void testCase21() {
byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3};
int aSign = 1;
BigInteger aNumber = new BigInteger(aSign, aBytes);
BigInteger bNumber = BigInteger.ZERO;
BigInteger result = aNumber.subtract(bNumber);
byte resBytes[] = new byte[rBytes.length];
resBytes = result.toByteArray();
for(int i = 0; i < resBytes.length; i++) {
assertTrue(resBytes[i] == rBytes[i]);
}
assertEquals(1, result.signum());
}
| void function() { byte aBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; byte rBytes[] = {120, 34, 78, -23, -111, 45, 127, 23, 45, -3}; int aSign = 1; BigInteger aNumber = new BigInteger(aSign, aBytes); BigInteger bNumber = BigInteger.ZERO; BigInteger result = aNumber.subtract(bNumber); byte resBytes[] = new byte[rBytes.length]; resBytes = result.toByteArray(); for(int i = 0; i < resBytes.length; i++) { assertTrue(resBytes[i] == rBytes[i]); } assertEquals(1, result.signum()); } | /**
* Subtract ZERO from a number.
* The number is positive.
*/ | Subtract ZERO from a number. The number is positive | testCase21 | {
"repo_name": "shannah/cn1",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/math/src/test/java/org/apache/harmony/tests/java/math/BigIntegerSubtractTest.java",
"license": "gpl-2.0",
"size": 21339
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 737,005 |
private void handleCompletedReceives(List<ClientResponse> responses, long now) {
for (NetworkReceive receive : this.selector.completedReceives()) {
String source = receive.source();
ClientRequest req = inFlightRequests.completeNext(source);
ResponseHeader header = ResponseHeader.parse(receive.payload());
short apiKey = req.request().header().apiKey();
Struct body = (Struct) ProtoUtils.currentResponseSchema(apiKey).read(receive.payload());
correlate(req.request().header(), header);
if (!metadataUpdater.maybeHandleCompletedReceive(req, now, body))
responses.add(new ClientResponse(req, now, false, body));
}
} | void function(List<ClientResponse> responses, long now) { for (NetworkReceive receive : this.selector.completedReceives()) { String source = receive.source(); ClientRequest req = inFlightRequests.completeNext(source); ResponseHeader header = ResponseHeader.parse(receive.payload()); short apiKey = req.request().header().apiKey(); Struct body = (Struct) ProtoUtils.currentResponseSchema(apiKey).read(receive.payload()); correlate(req.request().header(), header); if (!metadataUpdater.maybeHandleCompletedReceive(req, now, body)) responses.add(new ClientResponse(req, now, false, body)); } } | /**
* Handle any completed receives and update the response list with the responses received.
*
* @param responses The list of responses to update
* @param now The current time
*/ | Handle any completed receives and update the response list with the responses received | handleCompletedReceives | {
"repo_name": "jack6215/kafka",
"path": "clients/src/main/java/org/apache/kafka/clients/NetworkClient.java",
"license": "apache-2.0",
"size": 28529
} | [
"java.util.List",
"org.apache.kafka.common.network.NetworkReceive",
"org.apache.kafka.common.protocol.ProtoUtils",
"org.apache.kafka.common.protocol.types.Struct",
"org.apache.kafka.common.requests.ResponseHeader"
] | import java.util.List; import org.apache.kafka.common.network.NetworkReceive; import org.apache.kafka.common.protocol.ProtoUtils; import org.apache.kafka.common.protocol.types.Struct; import org.apache.kafka.common.requests.ResponseHeader; | import java.util.*; import org.apache.kafka.common.network.*; import org.apache.kafka.common.protocol.*; import org.apache.kafka.common.protocol.types.*; import org.apache.kafka.common.requests.*; | [
"java.util",
"org.apache.kafka"
] | java.util; org.apache.kafka; | 593,370 |
public static void getInnertangentPoints(PointF circleCenter, float radius, Double slopeLine, List<PointF> points) {
float radian, xOffset, yOffset;
if (slopeLine != null) {
radian = (float) Math.atan(slopeLine);
xOffset = (float) (Math.cos(radian) * radius);
yOffset = (float) (Math.sin(radian) * radius);
} else {
xOffset = radius;
yOffset = 0;
}
points.add(new PointF(circleCenter.x + xOffset, circleCenter.y + yOffset));
points.add(new PointF(circleCenter.x - xOffset, circleCenter.y - yOffset));
} | static void function(PointF circleCenter, float radius, Double slopeLine, List<PointF> points) { float radian, xOffset, yOffset; if (slopeLine != null) { radian = (float) Math.atan(slopeLine); xOffset = (float) (Math.cos(radian) * radius); yOffset = (float) (Math.sin(radian) * radius); } else { xOffset = radius; yOffset = 0; } points.add(new PointF(circleCenter.x + xOffset, circleCenter.y + yOffset)); points.add(new PointF(circleCenter.x - xOffset, circleCenter.y - yOffset)); } | /**
* this formula is designed by mabeijianxi
* website : http://blog.csdn.net/mabeijianxi/article/details/50560361
*
* @param circleCenter The circle center point.
* @param radius The circle radius.
* @param slopeLine The slope of line which cross the pMiddle.
*/ | this formula is designed by mabeijianxi website : HREF | getInnertangentPoints | {
"repo_name": "fishwjy/BottomNavigationBar",
"path": "bottomnavigationbar/src/main/java/com/vincent/bottomnavigationbar/badge/MathUtil.java",
"license": "apache-2.0",
"size": 2102
} | [
"android.graphics.PointF",
"java.util.List"
] | import android.graphics.PointF; import java.util.List; | import android.graphics.*; import java.util.*; | [
"android.graphics",
"java.util"
] | android.graphics; java.util; | 499,017 |
private void importCell( Cell cell ) {
this.content = new ArrayList<RtfBasicElement>();
if ( cell == null ) {
this.borders =
new PatchRtfBorderGroup( this.document, PatchRtfBorder.CELL_BORDER, this.parentRow.getParentTable()
.getBorders() );
return;
}
if ( cell instanceof PatchRtfCell ) {
PatchRtfCell rtfCell = (PatchRtfCell) cell;
this.minimumHeight = rtfCell.minimumHeight;
}
this.colspan = cell.getColspan();
this.rowspan = cell.getRowspan();
if ( cell.getRowspan() > 1 ) {
this.mergeType = MERGE_VERT_PARENT;
}
if ( cell instanceof PatchRtfCell ) {
this.borders =
new PatchRtfBorderGroup( this.document, PatchRtfBorder.CELL_BORDER, ( (PatchRtfCell) cell ).getBorders() );
} else {
this.borders =
new PatchRtfBorderGroup( this.document, PatchRtfBorder.CELL_BORDER, cell.getBorder(), cell.getBorderWidth(),
cell.getBorderColor() );
}
this.verticalAlignment = cell.getVerticalAlignment();
if ( cell.getBackgroundColor() == null ) {
this.backgroundColor = new RtfColor( this.document, 255, 255, 255 );
} else {
this.backgroundColor = new RtfColor( this.document, cell.getBackgroundColor() );
}
this.cellPadding = (int) this.parentRow.getParentTable().getCellPadding();
Iterator cellIterator = cell.getElements();
Paragraph container = null;
while ( cellIterator.hasNext() ) {
try {
Element element = (Element) cellIterator.next();
// should we wrap it in a paragraph
if ( !( element instanceof Paragraph ) && !( element instanceof List ) ) {
if ( container != null ) {
container.add( element );
} else {
container = new Paragraph();
container.setAlignment( cell.getHorizontalAlignment() );
container.add( element );
}
} else {
if ( container != null ) {
RtfBasicElement[] rtfElements = this.document.getMapper().mapElement( container );
for ( int i = 0; i < rtfElements.length; i++ ) {
rtfElements[i].setInTable( true );
this.content.add( rtfElements[i] );
}
container = null;
}
// if horizontal alignment is undefined overwrite
// with that of enclosing cell
if ( element instanceof Paragraph && ( (Paragraph) element ).getAlignment() == Element.ALIGN_UNDEFINED ) {
( (Paragraph) element ).setAlignment( cell.getHorizontalAlignment() );
}
RtfBasicElement[] rtfElements = this.document.getMapper().mapElement( element );
for ( int i = 0; i < rtfElements.length; i++ ) {
rtfElements[i].setInTable( true );
this.content.add( rtfElements[i] );
}
}
} catch ( DocumentException de ) {
de.printStackTrace();
}
}
if ( container != null ) {
try {
RtfBasicElement[] rtfElements = this.document.getMapper().mapElement( container );
for ( int i = 0; i < rtfElements.length; i++ ) {
rtfElements[i].setInTable( true );
this.content.add( rtfElements[i] );
}
} catch ( DocumentException de ) {
de.printStackTrace();
}
}
} | void function( Cell cell ) { this.content = new ArrayList<RtfBasicElement>(); if ( cell == null ) { this.borders = new PatchRtfBorderGroup( this.document, PatchRtfBorder.CELL_BORDER, this.parentRow.getParentTable() .getBorders() ); return; } if ( cell instanceof PatchRtfCell ) { PatchRtfCell rtfCell = (PatchRtfCell) cell; this.minimumHeight = rtfCell.minimumHeight; } this.colspan = cell.getColspan(); this.rowspan = cell.getRowspan(); if ( cell.getRowspan() > 1 ) { this.mergeType = MERGE_VERT_PARENT; } if ( cell instanceof PatchRtfCell ) { this.borders = new PatchRtfBorderGroup( this.document, PatchRtfBorder.CELL_BORDER, ( (PatchRtfCell) cell ).getBorders() ); } else { this.borders = new PatchRtfBorderGroup( this.document, PatchRtfBorder.CELL_BORDER, cell.getBorder(), cell.getBorderWidth(), cell.getBorderColor() ); } this.verticalAlignment = cell.getVerticalAlignment(); if ( cell.getBackgroundColor() == null ) { this.backgroundColor = new RtfColor( this.document, 255, 255, 255 ); } else { this.backgroundColor = new RtfColor( this.document, cell.getBackgroundColor() ); } this.cellPadding = (int) this.parentRow.getParentTable().getCellPadding(); Iterator cellIterator = cell.getElements(); Paragraph container = null; while ( cellIterator.hasNext() ) { try { Element element = (Element) cellIterator.next(); if ( !( element instanceof Paragraph ) && !( element instanceof List ) ) { if ( container != null ) { container.add( element ); } else { container = new Paragraph(); container.setAlignment( cell.getHorizontalAlignment() ); container.add( element ); } } else { if ( container != null ) { RtfBasicElement[] rtfElements = this.document.getMapper().mapElement( container ); for ( int i = 0; i < rtfElements.length; i++ ) { rtfElements[i].setInTable( true ); this.content.add( rtfElements[i] ); } container = null; } if ( element instanceof Paragraph && ( (Paragraph) element ).getAlignment() == Element.ALIGN_UNDEFINED ) { ( (Paragraph) element ).setAlignment( cell.getHorizontalAlignment() ); } RtfBasicElement[] rtfElements = this.document.getMapper().mapElement( element ); for ( int i = 0; i < rtfElements.length; i++ ) { rtfElements[i].setInTable( true ); this.content.add( rtfElements[i] ); } } } catch ( DocumentException de ) { de.printStackTrace(); } } if ( container != null ) { try { RtfBasicElement[] rtfElements = this.document.getMapper().mapElement( container ); for ( int i = 0; i < rtfElements.length; i++ ) { rtfElements[i].setInTable( true ); this.content.add( rtfElements[i] ); } } catch ( DocumentException de ) { de.printStackTrace(); } } } | /**
* Imports the Cell properties into the PatchRtfCell
*
* @param cell
* The Cell to import
*/ | Imports the Cell properties into the PatchRtfCell | importCell | {
"repo_name": "EgorZhuk/pentaho-reporting",
"path": "engine/core/src/main/java/org/pentaho/reporting/engine/classic/core/modules/output/table/rtf/itext/PatchRtfCell.java",
"license": "lgpl-2.1",
"size": 22677
} | [
"com.lowagie.text.Cell",
"com.lowagie.text.DocumentException",
"com.lowagie.text.Element",
"com.lowagie.text.List",
"com.lowagie.text.Paragraph",
"com.lowagie.text.rtf.RtfBasicElement",
"com.lowagie.text.rtf.style.RtfColor",
"java.util.ArrayList",
"java.util.Iterator"
] | import com.lowagie.text.Cell; import com.lowagie.text.DocumentException; import com.lowagie.text.Element; import com.lowagie.text.List; import com.lowagie.text.Paragraph; import com.lowagie.text.rtf.RtfBasicElement; import com.lowagie.text.rtf.style.RtfColor; import java.util.ArrayList; import java.util.Iterator; | import com.lowagie.text.*; import com.lowagie.text.rtf.*; import com.lowagie.text.rtf.style.*; import java.util.*; | [
"com.lowagie.text",
"java.util"
] | com.lowagie.text; java.util; | 1,417,265 |
protected Expression lt(int opPos) throws TransformerException
{
return compileOperation(new Lt(), opPos);
} | Expression function(int opPos) throws TransformerException { return compileOperation(new Lt(), opPos); } | /**
* Compile a '<' operation.
*
* @param opPos The current position in the m_opMap array.
*
* @return reference to {@link com.sun.org.apache.xpath.internal.operations.Lt} instance.
*
* @throws TransformerException if a error occurs creating the Expression.
*/ | Compile a '<' operation | lt | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xpath/internal/compiler/Compiler.java",
"license": "apache-2.0",
"size": 39045
} | [
"com.sun.org.apache.xpath.internal.Expression",
"com.sun.org.apache.xpath.internal.operations.Lt",
"javax.xml.transform.TransformerException"
] | import com.sun.org.apache.xpath.internal.Expression; import com.sun.org.apache.xpath.internal.operations.Lt; import javax.xml.transform.TransformerException; | import com.sun.org.apache.xpath.internal.*; import com.sun.org.apache.xpath.internal.operations.*; import javax.xml.transform.*; | [
"com.sun.org",
"javax.xml"
] | com.sun.org; javax.xml; | 710,075 |
public static Soundbank getSoundbank(InputStream stream)
throws InvalidMidiDataException, IOException
{
Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class);
while (readers.hasNext())
{
SoundbankReader sr = (SoundbankReader) readers.next();
Soundbank sb = sr.getSoundbank(stream);
if (sb != null)
return sb;
}
throw new InvalidMidiDataException("Cannot read soundbank from stream");
} | static Soundbank function(InputStream stream) throws InvalidMidiDataException, IOException { Iterator readers = ServiceFactory.lookupProviders(SoundbankReader.class); while (readers.hasNext()) { SoundbankReader sr = (SoundbankReader) readers.next(); Soundbank sb = sr.getSoundbank(stream); if (sb != null) return sb; } throw new InvalidMidiDataException(STR); } | /**
* Read a Soundbank object from the given stream.
*
* @param stream the stream from which to read the Soundbank
* @return the Soundbank object
* @throws InvalidMidiDataException if we were unable to read the soundbank
* @throws IOException if an I/O error happened while reading
*/ | Read a Soundbank object from the given stream | getSoundbank | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/sound/midi/MidiSystem.java",
"license": "gpl-2.0",
"size": 19132
} | [
"gnu.classpath.ServiceFactory",
"java.io.IOException",
"java.io.InputStream",
"java.util.Iterator",
"javax.sound.midi.spi.SoundbankReader"
] | import gnu.classpath.ServiceFactory; import java.io.IOException; import java.io.InputStream; import java.util.Iterator; import javax.sound.midi.spi.SoundbankReader; | import gnu.classpath.*; import java.io.*; import java.util.*; import javax.sound.midi.spi.*; | [
"gnu.classpath",
"java.io",
"java.util",
"javax.sound"
] | gnu.classpath; java.io; java.util; javax.sound; | 1,502,119 |
public boolean isCurrentDBDef(DBDef currentDBDef) {
return _currentDBDef.equals(currentDBDef);
}
| boolean function(DBDef currentDBDef) { return _currentDBDef.equals(currentDBDef); } | /**
* Is the current DB specified DB?
* @param currentDBDef The DB definition of current DB. (NullAllowed: if null, returns false)
* @return The determination, true or false.
*/ | Is the current DB specified DB | isCurrentDBDef | {
"repo_name": "dbflute-test/dbflute-test-dbms-mysql",
"path": "src/main/java/org/docksidestage/mysql/dbflute/immuhama/allcommon/ImmuDBCurrent.java",
"license": "apache-2.0",
"size": 5256
} | [
"org.dbflute.dbway.DBDef"
] | import org.dbflute.dbway.DBDef; | import org.dbflute.dbway.*; | [
"org.dbflute.dbway"
] | org.dbflute.dbway; | 2,468,921 |
void showPageInfo(final Tab tab,
final boolean fromShowSSLCertificateOnError,
final String urlCertificateOnError) {
if (tab == null) return;
final LayoutInflater factory = LayoutInflater.from(mContext);
final View pageInfoView = factory.inflate(R.layout.page_info, null);
final WebView view = tab.getWebView();
String url = fromShowSSLCertificateOnError ? urlCertificateOnError : tab.getUrl();
String title = tab.getTitle();
if (url == null) {
url = "";
}
if (title == null) {
title = "";
}
((TextView) pageInfoView.findViewById(R.id.address)).setText(url);
((TextView) pageInfoView.findViewById(R.id.title)).setText(title);
mPageInfoView = tab;
mPageInfoFromShowSSLCertificateOnError = fromShowSSLCertificateOnError;
mUrlCertificateOnError = urlCertificateOnError; | void showPageInfo(final Tab tab, final boolean fromShowSSLCertificateOnError, final String urlCertificateOnError) { if (tab == null) return; final LayoutInflater factory = LayoutInflater.from(mContext); final View pageInfoView = factory.inflate(R.layout.page_info, null); final WebView view = tab.getWebView(); String url = fromShowSSLCertificateOnError ? urlCertificateOnError : tab.getUrl(); String title = tab.getTitle(); if (url == null) { url = STR"; } ((TextView) pageInfoView.findViewById(R.id.address)).setText(url); ((TextView) pageInfoView.findViewById(R.id.title)).setText(title); mPageInfoView = tab; mPageInfoFromShowSSLCertificateOnError = fromShowSSLCertificateOnError; mUrlCertificateOnError = urlCertificateOnError; | /**
* Displays a page-info dialog.
* @param tab The tab to show info about
* @param fromShowSSLCertificateOnError The flag that indicates whether
* this dialog was opened from the SSL-certificate-on-error dialog or
* not. This is important, since we need to know whether to return to
* the parent dialog or simply dismiss.
* @param urlCertificateOnError The URL that invokes SSLCertificateError.
* Null when fromShowSSLCertificateOnError is false.
*/ | Displays a page-info dialog | showPageInfo | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Browser/src/com/android/browser/PageDialogsHandler.java",
"license": "gpl-2.0",
"size": 21870
} | [
"android.view.LayoutInflater",
"android.view.View",
"android.webkit.WebView",
"android.widget.TextView"
] | import android.view.LayoutInflater; import android.view.View; import android.webkit.WebView; import android.widget.TextView; | import android.view.*; import android.webkit.*; import android.widget.*; | [
"android.view",
"android.webkit",
"android.widget"
] | android.view; android.webkit; android.widget; | 1,831,825 |
List<QIndexColumnDef> getColumns(); | List<QIndexColumnDef> getColumns(); | /**
* Returns the value of the '<em><b>Columns</b></em>' containment reference list.
* The list contents are of type {@link org.smeup.sys.db.core.QIndexColumnDef}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Fields</em>' containment reference list isn't
* clear, there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Columns</em>' containment reference list.
* @see org.smeup.sys.db.core.QDatabaseCorePackage#getIndexDef_Columns()
* @model containment="true"
* @generated
*/ | Returns the value of the 'Columns' containment reference list. The list contents are of type <code>org.smeup.sys.db.core.QIndexColumnDef</code>. If the meaning of the 'Fields' containment reference list isn't clear, there really should be more of a description here... | getColumns | {
"repo_name": "smeup/asup",
"path": "org.smeup.sys.db.core/src/org/smeup/sys/db/core/QIndexDef.java",
"license": "epl-1.0",
"size": 3222
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,645,498 |
public void initIncomingLinks(ReferencesTableSettings settings); | void function(ReferencesTableSettings settings); | /**
* Init the incomingLinks
*
* @param settings
* settings for the incomingLinks ReferencesTable
*/ | Init the incomingLinks | initIncomingLinks | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src-gen/org/wso2/developerstudio/eclipse/gmf/esb/parts/PropertyGroupMediatorInputConnectorPropertiesEditionPart.java",
"license": "apache-2.0",
"size": 1576
} | [
"org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings"
] | import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings; | import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 42,966 |
@Test(expected = IllegalArgumentException.class)
public void test_update_paymentsContains() throws Exception {
instance.update(Arrays.asList((Payment) null));
} | @Test(expected = IllegalArgumentException.class) void function() throws Exception { instance.update(Arrays.asList((Payment) null)); } | /**
* <p>
* Failure test for the method <code>update(List<Payment> payments)</code> with payments contains null.<br>
* <code>IllegalArgumentException</code> is expected.
* </p>
*
* @throws Exception
* to JUnit.
*/ | Failure test for the method <code>update(List<Payment> payments)</code> with payments contains null. <code>IllegalArgumentException</code> is expected. | test_update_paymentsContains | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/services/impl/PaymentServiceImplUnitTests.java",
"license": "apache-2.0",
"size": 28086
} | [
"gov.opm.scrd.entities.application.Payment",
"java.util.Arrays",
"org.junit.Test"
] | import gov.opm.scrd.entities.application.Payment; import java.util.Arrays; import org.junit.Test; | import gov.opm.scrd.entities.application.*; import java.util.*; import org.junit.*; | [
"gov.opm.scrd",
"java.util",
"org.junit"
] | gov.opm.scrd; java.util; org.junit; | 2,866,287 |
@POST
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
Response create(@NotNull ResourceTO resourceTO); | @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) Response create(@NotNull ResourceTO resourceTO); | /**
* Creates a new resource.
*
* @param resourceTO Resource to be created
* @return Response object featuring Location header of created resource
*/ | Creates a new resource | create | {
"repo_name": "tmess567/syncope",
"path": "common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java",
"license": "apache-2.0",
"size": 6163
} | [
"javax.validation.constraints.NotNull",
"javax.ws.rs.Consumes",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.apache.syncope.common.lib.to.ResourceTO"
] | import javax.validation.constraints.NotNull; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.syncope.common.lib.to.ResourceTO; | import javax.validation.constraints.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.syncope.common.lib.to.*; | [
"javax.validation",
"javax.ws",
"org.apache.syncope"
] | javax.validation; javax.ws; org.apache.syncope; | 2,879,396 |
public Locale getLocale() {
return this.response.getLocale();
} | Locale function() { return this.response.getLocale(); } | /**
* The default behavior of this method is to return getLocale()
* on the wrapped response object.
*/ | The default behavior of this method is to return getLocale() on the wrapped response object | getLocale | {
"repo_name": "syntelos/gap-data",
"path": "gae/lib/servlet/src/javax/servlet/ServletResponseWrapper.java",
"license": "lgpl-3.0",
"size": 6722
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,757,219 |
public Observable<String> clusterResetWithOptionsObservable(ResetOptions options) {
io.vertx.rx.java.ObservableFuture<String> handler = io.vertx.rx.java.RxHelper.observableFuture();
clusterResetWithOptions(options, handler.toHandler());
return handler;
} | Observable<String> function(ResetOptions options) { io.vertx.rx.java.ObservableFuture<String> handler = io.vertx.rx.java.RxHelper.observableFuture(); clusterResetWithOptions(options, handler.toHandler()); return handler; } | /**
* Reset a Redis Cluster node.
* @param options
* @return
*/ | Reset a Redis Cluster node | clusterResetWithOptionsObservable | {
"repo_name": "brianjcj/vertx-redis-client",
"path": "src/main/generated/io/vertx/rxjava/redis/RedisTransaction.java",
"license": "apache-2.0",
"size": 184983
} | [
"io.vertx.redis.op.ResetOptions"
] | import io.vertx.redis.op.ResetOptions; | import io.vertx.redis.op.*; | [
"io.vertx.redis"
] | io.vertx.redis; | 638,514 |
@GET
@Path("dependencies/{type}/{entity}")
@Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON})
@Monitored(event = "dependencies")
@Override
public EntityList getDependencies(@Dimension("entityType") @PathParam("type") String type,
@Dimension("entityName") @PathParam("entity") String entity) {
return super.getDependencies(type, entity);
} | @Path(STR) @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) @Monitored(event = STR) EntityList function(@Dimension(STR) @PathParam("type") String type, @Dimension(STR) @PathParam(STR) String entity) { return super.getDependencies(type, entity); } | /**
* Get dependencies of the entity.
* @param type Valid options are cluster, feed or process.
* @param entity Name of the entity.
* @return Dependencies of the entity.
*/ | Get dependencies of the entity | getDependencies | {
"repo_name": "sanjeevtripurari/falcon",
"path": "prism/src/main/java/org/apache/falcon/resource/proxy/SchedulableEntityManagerProxy.java",
"license": "apache-2.0",
"size": 39449
} | [
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"org.apache.falcon.monitors.Dimension",
"org.apache.falcon.monitors.Monitored",
"org.apache.falcon.resource.EntityList"
] | import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.apache.falcon.monitors.Dimension; import org.apache.falcon.monitors.Monitored; import org.apache.falcon.resource.EntityList; | import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.falcon.monitors.*; import org.apache.falcon.resource.*; | [
"javax.ws",
"org.apache.falcon"
] | javax.ws; org.apache.falcon; | 879,588 |
protected void addRandomArmor()
{
super.addRandomArmor();
this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ItemRegistry.defenderBlaster));
}
| void function() { super.addRandomArmor(); this.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(ItemRegistry.defenderBlaster)); } | /**
* Makes entity wear random armor based on difficulty
*/ | Makes entity wear random armor based on difficulty | addRandomArmor | {
"repo_name": "mpbagot/Slugterra-Mod",
"path": "main/java/com/slugterra/entity/slingers/AllySlinger.java",
"license": "mit",
"size": 872
} | [
"com.slugterra.item.ItemRegistry",
"net.minecraft.inventory.EntityEquipmentSlot",
"net.minecraft.item.ItemStack"
] | import com.slugterra.item.ItemRegistry; import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemStack; | import com.slugterra.item.*; import net.minecraft.inventory.*; import net.minecraft.item.*; | [
"com.slugterra.item",
"net.minecraft.inventory",
"net.minecraft.item"
] | com.slugterra.item; net.minecraft.inventory; net.minecraft.item; | 50,890 |
public static void setEnd(IteratorSetting is, String end, boolean endInclusive) {
SimpleDateFormat dateParser = initDateParser();
try {
long endTS = dateParser.parse(end).getTime();
setEnd(is, endTS, endInclusive);
} catch (ParseException e) {
throw new IllegalArgumentException("couldn't parse " + end);
}
} | static void function(IteratorSetting is, String end, boolean endInclusive) { SimpleDateFormat dateParser = initDateParser(); try { long endTS = dateParser.parse(end).getTime(); setEnd(is, endTS, endInclusive); } catch (ParseException e) { throw new IllegalArgumentException(STR + end); } } | /**
* A convenience method for setting the end timestamp accepted by the timestamp filter.
*
* @param is
* the iterator setting object to configure
* @param end
* the end timestamp (yyyyMMddHHmmssz)
* @param endInclusive
* boolean indicating whether the end is inclusive
*/ | A convenience method for setting the end timestamp accepted by the timestamp filter | setEnd | {
"repo_name": "wjsl/jaredcumulo",
"path": "core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java",
"license": "apache-2.0",
"size": 10758
} | [
"java.text.ParseException",
"java.text.SimpleDateFormat",
"org.apache.accumulo.core.client.IteratorSetting"
] | import java.text.ParseException; import java.text.SimpleDateFormat; import org.apache.accumulo.core.client.IteratorSetting; | import java.text.*; import org.apache.accumulo.core.client.*; | [
"java.text",
"org.apache.accumulo"
] | java.text; org.apache.accumulo; | 2,519,696 |
protected void addStylePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_LabelStyleType_style_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LabelStyleType_style_feature", "_UI_LabelStyleType_type"),
GmlPackage.eINSTANCE.getLabelStyleType_Style(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), GmlPackage.eINSTANCE.getLabelStyleType_Style(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Style feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Style feature. | addStylePropertyDescriptor | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/LabelStyleTypeItemProvider.java",
"license": "apache-2.0",
"size": 7401
} | [
"net.opengis.gml.GmlPackage",
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import net.opengis.gml.GmlPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import net.opengis.gml.*; import org.eclipse.emf.edit.provider.*; | [
"net.opengis.gml",
"org.eclipse.emf"
] | net.opengis.gml; org.eclipse.emf; | 396,304 |
public void setUriConverter(ResultURIConverter uriConverter) {
this.uriConverter = uriConverter;
} | void function(ResultURIConverter uriConverter) { this.uriConverter = uriConverter; } | /**
* <p>Refactoring: remove this method. let {@link #getUriConverter()} create
* ResultURIConverter with factory (like AccessPointAdapter does).</p>
* @param uriConverter the ResultURIConverter to use with this AccessPoint
* to construct Replay URLs
*/ | Refactoring: remove this method. let <code>#getUriConverter()</code> create ResultURIConverter with factory (like AccessPointAdapter does) | setUriConverter | {
"repo_name": "sul-dlss/openwayback",
"path": "wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java",
"license": "apache-2.0",
"size": 56110
} | [
"org.archive.wayback.ResultURIConverter"
] | import org.archive.wayback.ResultURIConverter; | import org.archive.wayback.*; | [
"org.archive.wayback"
] | org.archive.wayback; | 776,886 |
private void saveMeasureNotesInDraftMeasure(String draftMeasureId,
Measure measure) {
List<MeasureNotes> measureNotesList = getMeasureNotesService()
.getAllMeasureNotesByMeasureID(measure.getId());
if ((measureNotesList != null) && !measureNotesList.isEmpty()) {
for (MeasureNotes measureNotes : measureNotesList) {
if (measureNotes != null) {
try {
MeasureNotes measureNotesDraft = measureNotes
.clone();
measureNotesDraft.setMeasure_id(draftMeasureId);
getMeasureNotesService().saveMeasureNote(
measureNotesDraft);
logger.info("MeasureNotes saved successfully on creating draft measure.");
} catch (Exception e) {
logger.info("Failed to save MeasureNotes on creating draft measure. Exception occured:"
+ e.getMessage());
}
}
}
}
}
| void function(String draftMeasureId, Measure measure) { List<MeasureNotes> measureNotesList = getMeasureNotesService() .getAllMeasureNotesByMeasureID(measure.getId()); if ((measureNotesList != null) && !measureNotesList.isEmpty()) { for (MeasureNotes measureNotes : measureNotesList) { if (measureNotes != null) { try { MeasureNotes measureNotesDraft = measureNotes .clone(); measureNotesDraft.setMeasure_id(draftMeasureId); getMeasureNotesService().saveMeasureNote( measureNotesDraft); logger.info(STR); } catch (Exception e) { logger.info(STR + e.getMessage()); } } } } } | /**
* Save measure notes in draft measure.
*
* @param draftMeasureId
* the draft measure id
* @param measure
* the measure
*/ | Save measure notes in draft measure | saveMeasureNotesInDraftMeasure | {
"repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint",
"path": "mat/src/mat/server/clause/MeasureCloningServiceImpl.java",
"license": "apache-2.0",
"size": 16038
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,194,542 |
public OutputStream create(String src,
boolean overwrite,
short replication,
long blockSize) throws IOException {
return create(src, overwrite, replication, blockSize, null);
}
/**
* Call {@link #create(String, boolean, short, long, Progressable, int)} | OutputStream function(String src, boolean overwrite, short replication, long blockSize) throws IOException { return create(src, overwrite, replication, blockSize, null); } /** * Call {@link #create(String, boolean, short, long, Progressable, int)} | /**
* Call {@link #create(String, boolean, short, long, Progressable)} with
* null <code>progress</code>.
*/ | Call <code>#create(String, boolean, short, long, Progressable)</code> with null <code>progress</code> | create | {
"repo_name": "moreus/hadoop",
"path": "hadoop-0.23.10/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java",
"license": "apache-2.0",
"size": 68830
} | [
"java.io.IOException",
"java.io.OutputStream",
"org.apache.hadoop.util.Progressable"
] | import java.io.IOException; import java.io.OutputStream; import org.apache.hadoop.util.Progressable; | import java.io.*; import org.apache.hadoop.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,063,573 |
public HttpServiceWithRoutes newSamlService() {
return new SamlService(this);
} | HttpServiceWithRoutes function() { return new SamlService(this); } | /**
* Creates an {@link HttpService} which handles SAML messages.
*/ | Creates an <code>HttpService</code> which handles SAML messages | newSamlService | {
"repo_name": "line/armeria",
"path": "saml/src/main/java/com/linecorp/armeria/server/saml/SamlServiceProvider.java",
"license": "apache-2.0",
"size": 8902
} | [
"com.linecorp.armeria.server.HttpServiceWithRoutes"
] | import com.linecorp.armeria.server.HttpServiceWithRoutes; | import com.linecorp.armeria.server.*; | [
"com.linecorp.armeria"
] | com.linecorp.armeria; | 1,977,655 |
public ServiceFuture<List<PercentileMetricInner>> listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter, final ServiceCallback<List<PercentileMetricInner>> serviceCallback) {
return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter), serviceCallback);
} | ServiceFuture<List<PercentileMetricInner>> function(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter, final ServiceCallback<List<PercentileMetricInner>> serviceCallback) { return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter), serviceCallback); } | /**
* Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data.
*
* @param resourceGroupName Name of an Azure resource group.
* @param accountName Cosmos DB database account name.
* @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized.
* @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized.
* @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data | listMetricsAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/cosmosdb/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_08_01_preview/implementation/PercentileSourceTargetsInner.java",
"license": "mit",
"size": 11297
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.List"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 352,015 |
public void beginDisconnectVirtualNetworkGatewayVpnConnections(String resourceGroupName, String virtualNetworkGatewayName, List<String> vpnConnectionIds) {
beginDisconnectVirtualNetworkGatewayVpnConnectionsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnConnectionIds).toBlocking().single().body();
} | void function(String resourceGroupName, String virtualNetworkGatewayName, List<String> vpnConnectionIds) { beginDisconnectVirtualNetworkGatewayVpnConnectionsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, vpnConnectionIds).toBlocking().single().body(); } | /**
* Disconnect vpn connections of virtual network gateway in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @param vpnConnectionIds List of p2s vpn connection Ids.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/ | Disconnect vpn connections of virtual network gateway in the specified resource group | beginDisconnectVirtualNetworkGatewayVpnConnections | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/VirtualNetworkGatewaysInner.java",
"license": "mit",
"size": 304865
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,790,241 |
public void addChild(AccessibilityNodeInfo child) {
if (children == null) {
children = new ArrayList<>();
}
children.add(child);
ShadowAccessibilityNodeInfo shadowAccessibilityNodeInfo = Shadow.extract(child);
shadowAccessibilityNodeInfo.parent = realAccessibilityNodeInfo;
} | void function(AccessibilityNodeInfo child) { if (children == null) { children = new ArrayList<>(); } children.add(child); ShadowAccessibilityNodeInfo shadowAccessibilityNodeInfo = Shadow.extract(child); shadowAccessibilityNodeInfo.parent = realAccessibilityNodeInfo; } | /**
* Add a child node to this one. Also initializes the parent field of the
* child.
*
* @param child The node to be added as a child.
*/ | Add a child node to this one. Also initializes the parent field of the child | addChild | {
"repo_name": "spotify/robolectric",
"path": "shadows/framework/src/main/java/org/robolectric/shadows/ShadowAccessibilityNodeInfo.java",
"license": "mit",
"size": 37650
} | [
"android.view.accessibility.AccessibilityNodeInfo",
"java.util.ArrayList",
"org.robolectric.shadow.api.Shadow"
] | import android.view.accessibility.AccessibilityNodeInfo; import java.util.ArrayList; import org.robolectric.shadow.api.Shadow; | import android.view.accessibility.*; import java.util.*; import org.robolectric.shadow.api.*; | [
"android.view",
"java.util",
"org.robolectric.shadow"
] | android.view; java.util; org.robolectric.shadow; | 620,407 |
public Comment getComment(String response)throws Exception
{
JSONObject jsonObject = new JSONObject(response.trim());
JSONObject comment = jsonObject.getJSONObject("comment"); //No I18N
Comment comments = new Comment();
comments.setCommentId(comment.getString("comment_id"));
comments.setDescription(comment.getString("description"));
comments.setEstimateId(comment.getString("estimate_id"));
comments.setCommentedById(comment.getString("commented_by_id"));
comments.setCommentedBy(comment.getString("commented_by"));
comments.setCommentType(comment.getString("comment_type"));
comments.setDate(comment.getString("date"));
comments.setDateDescription(comment.getString("date_description"));
comments.setTime(comment.getString("time"));
return comments;
}
| Comment function(String response)throws Exception { JSONObject jsonObject = new JSONObject(response.trim()); JSONObject comment = jsonObject.getJSONObject(STR); Comment comments = new Comment(); comments.setCommentId(comment.getString(STR)); comments.setDescription(comment.getString(STR)); comments.setEstimateId(comment.getString(STR)); comments.setCommentedById(comment.getString(STR)); comments.setCommentedBy(comment.getString(STR)); comments.setCommentType(comment.getString(STR)); comments.setDate(comment.getString("date")); comments.setDateDescription(comment.getString(STR)); comments.setTime(comment.getString("time")); return comments; } | /**
* Parse the json respone and returns the Comment object.
* @param response This json response contains the comment details for estimate.
* @return Returns the Comment object.
*/ | Parse the json respone and returns the Comment object | getComment | {
"repo_name": "zoho/books-java-wrappers",
"path": "source/com/zoho/books/parser/EstimateParser.java",
"license": "mit",
"size": 20072
} | [
"com.zoho.books.model.Comment",
"org.json.JSONObject"
] | import com.zoho.books.model.Comment; import org.json.JSONObject; | import com.zoho.books.model.*; import org.json.*; | [
"com.zoho.books",
"org.json"
] | com.zoho.books; org.json; | 2,034,716 |
private void assertSequenceValuesMultipleSeq(long... seqVals) throws SQLException {
PreparedStatement stmt = conn.prepareStatement(NEXT_VAL_SQL);
ResultSet rs = stmt.executeQuery();
for (long seqVal : seqVals) {
assertTrue(rs.next());
assertEquals(seqVal, rs.getLong(1));
}
assertFalse(rs.next());
rs.close();
stmt.close();
} | void function(long... seqVals) throws SQLException { PreparedStatement stmt = conn.prepareStatement(NEXT_VAL_SQL); ResultSet rs = stmt.executeQuery(); for (long seqVal : seqVals) { assertTrue(rs.next()); assertEquals(seqVal, rs.getLong(1)); } assertFalse(rs.next()); rs.close(); stmt.close(); } | /**
* Helper to verify the sequence values returned in a single ResultSet containing multiple row
* @param seqVals expected sequence values (from one ResultSet)
*/ | Helper to verify the sequence values returned in a single ResultSet containing multiple row | assertSequenceValuesMultipleSeq | {
"repo_name": "julianhyde/phoenix",
"path": "phoenix-core/src/it/java/org/apache/phoenix/end2end/SequenceIT.java",
"license": "apache-2.0",
"size": 49466
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.junit.Assert"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.junit.Assert; | import java.sql.*; import org.junit.*; | [
"java.sql",
"org.junit"
] | java.sql; org.junit; | 166,388 |
public static void setInternalState(Object object, Object value, Object... additionalValues) {
setField(object, value,
findFieldInHierarchy(object, new AssignableFromFieldTypeMatcherStrategy(getType(value))));
if (additionalValues != null && additionalValues.length > 0) {
for (Object additionalValue : additionalValues) {
setField(
object,
additionalValue,
findFieldInHierarchy(object, new AssignableFromFieldTypeMatcherStrategy(
getType(additionalValue))));
}
}
} | static void function(Object object, Object value, Object... additionalValues) { setField(object, value, findFieldInHierarchy(object, new AssignableFromFieldTypeMatcherStrategy(getType(value)))); if (additionalValues != null && additionalValues.length > 0) { for (Object additionalValue : additionalValues) { setField( object, additionalValue, findFieldInHierarchy(object, new AssignableFromFieldTypeMatcherStrategy( getType(additionalValue)))); } } } | /**
* Set the value of a field using reflection. This method will traverse the
* super class hierarchy until the first field assignable to the
* <tt>value</tt> type is found. The <tt>value</tt> (or
* <tt>additionaValues</tt> if present) will then be assigned to this field.
*
* @param object the object to modify
* @param value the new value of the field
* @param additionalValues Additional values to set on the object
*/ | Set the value of a field using reflection. This method will traverse the super class hierarchy until the first field assignable to the value type is found. The value (or additionaValues if present) will then be assigned to this field | setInternalState | {
"repo_name": "jayway/powermock",
"path": "powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java",
"license": "apache-2.0",
"size": 115150
} | [
"org.powermock.reflect.internal.matcherstrategies.AssignableFromFieldTypeMatcherStrategy"
] | import org.powermock.reflect.internal.matcherstrategies.AssignableFromFieldTypeMatcherStrategy; | import org.powermock.reflect.internal.matcherstrategies.*; | [
"org.powermock.reflect"
] | org.powermock.reflect; | 968,448 |
void removeAllUserContacts(PerunSession sess, User user) throws InternalErrorException; | void removeAllUserContacts(PerunSession sess, User user) throws InternalErrorException; | /**
* Remove all facilities contacts assigned to this user.
*
* @param sess
* @param user
* @throws InternalErrorException
*/ | Remove all facilities contacts assigned to this user | removeAllUserContacts | {
"repo_name": "licehammer/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/FacilitiesManagerImplApi.java",
"license": "bsd-2-clause",
"size": 24484
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.User",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException"
] | import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 1,270,036 |
public static Path getPath(final String first, final String... more) {
final java.nio.file.Path path = Paths.get(first, more);
final String stringPath = FilenameUtils.separatorsToUnix(path.toAbsolutePath().toString());
final Path hadoopPath = new Path(stringPath);
return hadoopPath;
} | static Path function(final String first, final String... more) { final java.nio.file.Path path = Paths.get(first, more); final String stringPath = FilenameUtils.separatorsToUnix(path.toAbsolutePath().toString()); final Path hadoopPath = new Path(stringPath); return hadoopPath; } | /**
* Converts a path string, or a sequence of strings that when joined form a path string,
* to a {@link org.apache.hadoop.fs.Path}.
* @param first The path string or initial part of the path string.
* @param more Additional strings to be joined to form the path string.
* @return the resulting {@link org.apache.hadoop.fs.Path}.
*/ | Converts a path string, or a sequence of strings that when joined form a path string, to a <code>org.apache.hadoop.fs.Path</code> | getPath | {
"repo_name": "meiercaleb/incubator-rya",
"path": "extras/rya.merger/src/main/java/org/apache/rya/accumulo/mr/merge/CopyTool.java",
"license": "apache-2.0",
"size": 46343
} | [
"java.nio.file.Paths",
"org.apache.commons.io.FilenameUtils",
"org.apache.hadoop.fs.Path"
] | import java.nio.file.Paths; import org.apache.commons.io.FilenameUtils; import org.apache.hadoop.fs.Path; | import java.nio.file.*; import org.apache.commons.io.*; import org.apache.hadoop.fs.*; | [
"java.nio",
"org.apache.commons",
"org.apache.hadoop"
] | java.nio; org.apache.commons; org.apache.hadoop; | 911,482 |
private boolean parseRelativeImportDots() {
SyntaxTreeBuilder builder = myContext.getBuilder();
boolean had_dots = false;
while (builder.getTokenType() == PyTokenTypes.DOT) {
had_dots = true;
builder.advanceLexer();
}
return had_dots;
} | boolean function() { SyntaxTreeBuilder builder = myContext.getBuilder(); boolean had_dots = false; while (builder.getTokenType() == PyTokenTypes.DOT) { had_dots = true; builder.advanceLexer(); } return had_dots; } | /**
* Parses option dots before imported name.
*
* @return true iff there were dots.
*/ | Parses option dots before imported name | parseRelativeImportDots | {
"repo_name": "GunoH/intellij-community",
"path": "python/python-psi-impl/src/com/jetbrains/python/parsing/StatementParsing.java",
"license": "apache-2.0",
"size": 38079
} | [
"com.intellij.lang.SyntaxTreeBuilder",
"com.jetbrains.python.PyTokenTypes"
] | import com.intellij.lang.SyntaxTreeBuilder; import com.jetbrains.python.PyTokenTypes; | import com.intellij.lang.*; import com.jetbrains.python.*; | [
"com.intellij.lang",
"com.jetbrains.python"
] | com.intellij.lang; com.jetbrains.python; | 382,409 |
protected void deployApps()
{
// This function is only called by HostConfig.
// Now that the check() function is a no-op,
// there's no preiodic re-deployment of anything at all.
// Live updates only occur when done via the custom MBean server.
// To see this, check out: new Exception("").printStackTrace();
// Example appBase:
// /opt/apache-tomcat-5.5.15/avm_webapps
File appBase = appBase();
// Example configBase:
// /opt/apache-tomcat-5.5.15/conf/Catalina/avm.localhost
File configBase = configBase();
// Deploy XML descriptors from configBase
deployDescriptors(configBase, configBase.list());
// Deploy WARs, and loop if additional descriptors are found
// deployWARs(appBase, appBase.list());
deployAllAVMwebappsInRepository();
}
| void function() { File appBase = appBase(); File configBase = configBase(); deployDescriptors(configBase, configBase.list()); deployAllAVMwebappsInRepository(); } | /**
* Deploy applications for any directories or WAR files that are found
* in our "application root" directory.
*/ | Deploy applications for any directories or WAR files that are found in our "application root" directory | deployApps | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/catalina-virtual/source/java/org/alfresco/catalina/host/AVMHostConfig.java",
"license": "lgpl-3.0",
"size": 97038
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,434,267 |
public KeyPair generate()
{
if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "generate");
BigInteger p, q, n, d;
// 1. Generate a prime p in the interval [2**(M-1), 2**M - 1], where
// M = CEILING(L/2), and such that GCD(p, e) = 1
int M = (L + 1) / 2;
BigInteger lower = TWO.pow(M - 1);
BigInteger upper = TWO.pow(M).subtract(ONE);
byte[] kb = new byte[(M + 7) / 8]; // enough bytes to frame M bits
step1: while (true)
{
nextRandomBytes(kb);
p = new BigInteger(1, kb).setBit(0);
if (p.compareTo(lower) >= 0 && p.compareTo(upper) <= 0
&& p.isProbablePrime(80) && p.gcd(e).equals(ONE))
break step1;
}
// 2. Generate a prime q such that the product of p and q is an L-bit
// number, and such that GCD(q, e) = 1
step2: while (true)
{
nextRandomBytes(kb);
q = new BigInteger(1, kb).setBit(0);
n = p.multiply(q);
if (n.bitLength() == L && q.isProbablePrime(80) && q.gcd(e).equals(ONE))
break step2;
// TODO: test for p != q
}
// TODO: ensure p < q
// 3. Put n = pq. The public key is (n, e).
// 4. Compute the parameters necessary for the private key K (see
// Section 2.2).
BigInteger phi = p.subtract(ONE).multiply(q.subtract(ONE));
d = e.modInverse(phi);
// 5. Output the public key and the private key.
PublicKey pubK = new GnuRSAPublicKey(preferredFormat, n, e);
PrivateKey secK = new GnuRSAPrivateKey(preferredFormat, p, q, e, d);
KeyPair result = new KeyPair(pubK, secK);
if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "generate", result);
return result;
} | KeyPair function() { if (Configuration.DEBUG) log.entering(this.getClass().getName(), STR); BigInteger p, q, n, d; int M = (L + 1) / 2; BigInteger lower = TWO.pow(M - 1); BigInteger upper = TWO.pow(M).subtract(ONE); byte[] kb = new byte[(M + 7) / 8]; step1: while (true) { nextRandomBytes(kb); p = new BigInteger(1, kb).setBit(0); if (p.compareTo(lower) >= 0 && p.compareTo(upper) <= 0 && p.isProbablePrime(80) && p.gcd(e).equals(ONE)) break step1; } step2: while (true) { nextRandomBytes(kb); q = new BigInteger(1, kb).setBit(0); n = p.multiply(q); if (n.bitLength() == L && q.isProbablePrime(80) && q.gcd(e).equals(ONE)) break step2; } BigInteger phi = p.subtract(ONE).multiply(q.subtract(ONE)); d = e.modInverse(phi); PublicKey pubK = new GnuRSAPublicKey(preferredFormat, n, e); PrivateKey secK = new GnuRSAPrivateKey(preferredFormat, p, q, e, d); KeyPair result = new KeyPair(pubK, secK); if (Configuration.DEBUG) log.exiting(this.getClass().getName(), STR, result); return result; } | /**
* <p>
* The algorithm used here is described in <i>nessie-pss-B.pdf</i> document
* which is part of the RSA-PSS submission to NESSIE.
* </p>
*
* @return an RSA keypair.
*/ | The algorithm used here is described in nessie-pss-B.pdf document which is part of the RSA-PSS submission to NESSIE. | generate | {
"repo_name": "selmentdev/selment-toolchain",
"path": "source/gcc-latest/libjava/classpath/gnu/java/security/key/rsa/RSAKeyPairGenerator.java",
"license": "gpl-3.0",
"size": 8781
} | [
"gnu.java.security.Configuration",
"java.math.BigInteger",
"java.security.KeyPair",
"java.security.PrivateKey",
"java.security.PublicKey"
] | import gnu.java.security.Configuration; import java.math.BigInteger; import java.security.KeyPair; import java.security.PrivateKey; import java.security.PublicKey; | import gnu.java.security.*; import java.math.*; import java.security.*; | [
"gnu.java.security",
"java.math",
"java.security"
] | gnu.java.security; java.math; java.security; | 758,553 |
public ValueNode putAndsOnTop()
throws StandardException
{
NodeFactory nodeFactory = getNodeFactory();
QueryTreeNode trueNode = nodeFactory.getNode(
C_NodeTypes.BOOLEAN_CONSTANT_NODE,
Boolean.TRUE,
getContextManager());
AndNode andNode = (AndNode) nodeFactory.getNode(
C_NodeTypes.AND_NODE,
this,
trueNode,
getContextManager());
andNode.postBindFixup();
return andNode;
} | ValueNode function() throws StandardException { NodeFactory nodeFactory = getNodeFactory(); QueryTreeNode trueNode = nodeFactory.getNode( C_NodeTypes.BOOLEAN_CONSTANT_NODE, Boolean.TRUE, getContextManager()); AndNode andNode = (AndNode) nodeFactory.getNode( C_NodeTypes.AND_NODE, this, trueNode, getContextManager()); andNode.postBindFixup(); return andNode; } | /**
* Do the 1st step in putting an expression into conjunctive normal
* form. This step ensures that the top level of the expression is
* a chain of AndNodes.
*
* @return The modified expression
*
* @exception StandardException Thrown on error
*/ | Do the 1st step in putting an expression into conjunctive normal form. This step ensures that the top level of the expression is a chain of AndNodes | putAndsOnTop | {
"repo_name": "lpxz/grail-derby104",
"path": "java/engine/org/apache/derby/impl/sql/compile/ValueNode.java",
"license": "apache-2.0",
"size": 44750
} | [
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.sql.compile.NodeFactory"
] | import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.sql.compile.NodeFactory; | import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.sql.compile.*; | [
"org.apache.derby"
] | org.apache.derby; | 318,581 |
public boolean containsDriver(ISQLDriver driver) {
boolean result = false;
for (Iterator<ISQLDriver> iter = _cache.getAllForClass(SQL_DRIVER_IMPL); iter.hasNext();) {
ISQLDriver cachedDriver = iter.next();
if (cachedDriver.equals(driver)) {
result = true;
break;
}
}
return result;
} | boolean function(ISQLDriver driver) { boolean result = false; for (Iterator<ISQLDriver> iter = _cache.getAllForClass(SQL_DRIVER_IMPL); iter.hasNext();) { ISQLDriver cachedDriver = iter.next(); if (cachedDriver.equals(driver)) { result = true; break; } } return result; } | /**
* Returns a boolean value indicating whether or not the specified driver
* is contained in the cache.
*
* @param driver the ISQLDriver to search for.
* @return true if the specified driver was found; false otherwise.
*/ | Returns a boolean value indicating whether or not the specified driver is contained in the cache | containsDriver | {
"repo_name": "sdgdsffdsfff/bigtable-sql",
"path": "src/main/java/net/sourceforge/squirrel_sql/client/gui/db/DataCache.java",
"license": "apache-2.0",
"size": 20971
} | [
"java.util.Iterator",
"net.sourceforge.squirrel_sql.fw.sql.ISQLDriver"
] | import java.util.Iterator; import net.sourceforge.squirrel_sql.fw.sql.ISQLDriver; | import java.util.*; import net.sourceforge.squirrel_sql.fw.sql.*; | [
"java.util",
"net.sourceforge.squirrel_sql"
] | java.util; net.sourceforge.squirrel_sql; | 2,450,022 |
public Key min() {
if (isEmpty()) throw new NoSuchElementException("called min() with empty symbol table");
return st.firstKey();
} | Key function() { if (isEmpty()) throw new NoSuchElementException(STR); return st.firstKey(); } | /**
* Returns the smallest key in the symbol table.
* @return the smallest key in the symbol table
* @throws NoSuchElementException if the symbol table is empty
*/ | Returns the smallest key in the symbol table | min | {
"repo_name": "fracpete/princeton-java-algorithms",
"path": "src/main/java/edu/princeton/cs/algorithms/ST.java",
"license": "gpl-3.0",
"size": 8089
} | [
"java.util.NoSuchElementException"
] | import java.util.NoSuchElementException; | import java.util.*; | [
"java.util"
] | java.util; | 654,153 |
public AffineTransform getInitialTransform(int width, int height, Rectangle2D clip) {
AffineTransform at = new AffineTransform();
switch (getRotation()) {
case 0:
at = new AffineTransform(1, 0, 0, -1, 0, height);
break;
case 90:
at = new AffineTransform(0, 1, 1, 0, 0, 0);
break;
case 180:
at = new AffineTransform(-1, 0, 0, 1, width, 0);
break;
case 270:
at = new AffineTransform(0, -1, -1, 0, width, height);
break;
default:
break;
}
double clipW;
double clipH;
if (clip == null) {
clip = getBBox();
clipW = clip.getWidth();
clipH = clip.getHeight();
} else if (getRotation() == 90 || getRotation() == 270) {
int tmp = width;
width = height;
height = tmp;
clipW = clip.getHeight();
clipH = clip.getWidth();
} else {
clipW = clip.getWidth();
clipH = clip.getHeight();
}
// now scale the image to be the size of the clip
double scaleX = width / clipW;
double scaleY = height / clipH;
at.scale(scaleX, scaleY);
// create a transform that moves the top left corner of the clip region
// (minX, minY) to (0,0) in the image
at.translate(-clip.getMinX(), -clip.getMinY());
return at;
} | AffineTransform function(int width, int height, Rectangle2D clip) { AffineTransform at = new AffineTransform(); switch (getRotation()) { case 0: at = new AffineTransform(1, 0, 0, -1, 0, height); break; case 90: at = new AffineTransform(0, 1, 1, 0, 0, 0); break; case 180: at = new AffineTransform(-1, 0, 0, 1, width, 0); break; case 270: at = new AffineTransform(0, -1, -1, 0, width, height); break; default: break; } double clipW; double clipH; if (clip == null) { clip = getBBox(); clipW = clip.getWidth(); clipH = clip.getHeight(); } else if (getRotation() == 90 getRotation() == 270) { int tmp = width; width = height; height = tmp; clipW = clip.getHeight(); clipH = clip.getWidth(); } else { clipW = clip.getWidth(); clipH = clip.getHeight(); } double scaleX = width / clipW; double scaleY = height / clipH; at.scale(scaleX, scaleY); at.translate(-clip.getMinX(), -clip.getMinY()); return at; } | /**
* Get the initial transform to map from a specified clip rectangle in
* pdf coordinates to an image of the specfied width and
* height in device coordinates
*
* @param width
* the width of the image
* @param height
* the height of the image
* @param clip
* the desired clip rectangle (in PDF space) or null to use
* the page's bounding box
* @return a {@link java.awt.geom.AffineTransform} object.
*/ | Get the initial transform to map from a specified clip rectangle in pdf coordinates to an image of the specfied width and height in device coordinates | getInitialTransform | {
"repo_name": "oswetto/LoboEvolution",
"path": "LoboPDF/src/main/java/org/loboevolution/pdfview/PDFPage.java",
"license": "gpl-3.0",
"size": 30911
} | [
"java.awt.geom.AffineTransform",
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,844,837 |
private void beginActivity() {
UserBusinessActivity userBusinessActivity = UserBusinessActivityFactory.userBusinessActivity();
try {
userBusinessActivity.begin();
} catch (Exception e) {
throw new RuntimeException("Begin business activity failed.", e);
}
} | void function() { UserBusinessActivity userBusinessActivity = UserBusinessActivityFactory.userBusinessActivity(); try { userBusinessActivity.begin(); } catch (Exception e) { throw new RuntimeException(STR, e); } } | /**
* Begins business activity.
*/ | Begins business activity | beginActivity | {
"repo_name": "nmcl/scratch",
"path": "graalvm/transactions/fork/narayana/XTS/localjunit/disabled-context-propagation/src/test/java/com.arjuna.wstx.tests/arq/ba/DisabledContextPropagationTest.java",
"license": "apache-2.0",
"size": 13403
} | [
"com.arjuna.mw.wst11.UserBusinessActivity",
"com.arjuna.mw.wst11.UserBusinessActivityFactory"
] | import com.arjuna.mw.wst11.UserBusinessActivity; import com.arjuna.mw.wst11.UserBusinessActivityFactory; | import com.arjuna.mw.wst11.*; | [
"com.arjuna.mw"
] | com.arjuna.mw; | 1,067,261 |
public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection)
{
if (iterable == null)
{
throw new NullPointerException();
}
if (iterable instanceof Collection<?>)
{
return targetCollection.addAll((Collection<T>) iterable);
}
int oldSize = targetCollection.size();
Iterate.forEachWith(iterable, Procedures2.addToCollection(), targetCollection);
return targetCollection.size() != oldSize;
} | static <T> boolean function(Iterable<? extends T> iterable, Collection<T> targetCollection) { if (iterable == null) { throw new NullPointerException(); } if (iterable instanceof Collection<?>) { return targetCollection.addAll((Collection<T>) iterable); } int oldSize = targetCollection.size(); Iterate.forEachWith(iterable, Procedures2.addToCollection(), targetCollection); return targetCollection.size() != oldSize; } | /**
* Add all elements from the source Iterable to the target collection, returns true if any element was added.
*/ | Add all elements from the source Iterable to the target collection, returns true if any element was added | addAllIterable | {
"repo_name": "g-votte/eclipse-collections",
"path": "eclipse-collections/src/main/java/org/eclipse/collections/impl/utility/Iterate.java",
"license": "bsd-3-clause",
"size": 138506
} | [
"java.util.Collection",
"org.eclipse.collections.impl.block.factory.Procedures2"
] | import java.util.Collection; import org.eclipse.collections.impl.block.factory.Procedures2; | import java.util.*; import org.eclipse.collections.impl.block.factory.*; | [
"java.util",
"org.eclipse.collections"
] | java.util; org.eclipse.collections; | 1,185,104 |
public void setDateFormat(int style, Locale locale) {
setText(DateFormat.getDateInstance(style, locale).format(new Date()));
}
| void function(int style, Locale locale) { setText(DateFormat.getDateInstance(style, locale).format(new Date())); } | /**
* Set the format of the date.
* <P>
* The date style should be one of: {@code SHORT}, {@code MEDIUM},
* {@code LONG} or {@code FULL} (defined in {@code java.util.DateFormat}).
* <P>
* For the locale, you can use {@code Locale.getDefault()} for the
* default locale.
*
* @param style the date style.
* @param locale the locale.
*/ | Set the format of the date. The date style should be one of: SHORT, MEDIUM, LONG or FULL (defined in java.util.DateFormat). For the locale, you can use Locale.getDefault() for the default locale | setDateFormat | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/title/DateTitle.java",
"license": "lgpl-2.1",
"size": 6903
} | [
"java.text.DateFormat",
"java.util.Date",
"java.util.Locale"
] | import java.text.DateFormat; import java.util.Date; import java.util.Locale; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 629,893 |
public Date getLowerBound() {
return getSelectionModel().getLowerBound();
} | Date function() { return getSelectionModel().getLowerBound(); } | /**
* Return the lower bound date that is allowed to be selected for this
* model.
*
* @return lower bound date or null if not set
*/ | Return the lower bound date that is allowed to be selected for this model | getLowerBound | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/JXMonthView.java",
"license": "lgpl-2.1",
"size": 62756
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,664,206 |
public void loadImage(
String url,
ImageView target,
int height,
int width,
int loadingResId) {
Bitmap value = null;
if (mBitmapCache != null) {
value = mBitmapCache.getBitmapFromMemCache(getKeyForBitmapCache(url, height, width));
} | void function( String url, ImageView target, int height, int width, int loadingResId) { Bitmap value = null; if (mBitmapCache != null) { value = mBitmapCache.getBitmapFromMemCache(getKeyForBitmapCache(url, height, width)); } | /**
* Load an image asynchronously into a ImageView. The raw image file and the decoded Bitmap can be
* cached locally in memory and on disk.
* @param url image URL
* @param target target ImageView the image will load to
* @param height image height
* @param width image width
* @param loadingResId resource id of the loading indicator image
*/ | Load an image asynchronously into a ImageView. The raw image file and the decoded Bitmap can be cached locally in memory and on disk | loadImage | {
"repo_name": "Instagram/ig-disk-cache",
"path": "demo/src/main/java/com/instagram/igdiskcache/demo/cache/ImageLoader.java",
"license": "bsd-3-clause",
"size": 8052
} | [
"android.graphics.Bitmap",
"android.widget.ImageView"
] | import android.graphics.Bitmap; import android.widget.ImageView; | import android.graphics.*; import android.widget.*; | [
"android.graphics",
"android.widget"
] | android.graphics; android.widget; | 2,437,583 |
@Attribute("width")
Integer getWidth(); | @Attribute("width") Integer getWidth(); | /**
* Returns the <code>width</code> attribute's value as an integer.
* The integer's unit is pixels.
*
* @return the value of the <code>width</code> attribute
* @see Attribute
* @since 2.0
*/ | Returns the <code>width</code> attribute's value as an integer. The integer's unit is pixels | getWidth | {
"repo_name": "testIT-WebTester/webtester2-core",
"path": "webtester-core/src/main/java/info/novatec/testit/webtester/pagefragments/Image.java",
"license": "apache-2.0",
"size": 2035
} | [
"info.novatec.testit.webtester.pagefragments.annotations.Attribute"
] | import info.novatec.testit.webtester.pagefragments.annotations.Attribute; | import info.novatec.testit.webtester.pagefragments.annotations.*; | [
"info.novatec.testit"
] | info.novatec.testit; | 1,464,312 |
public final void testParse() throws Exception
{
Type1BaseContentCollectionSerializer t1 = new Type1BaseContentCollectionSerializer();
t1.setTimeService(new MockTimeService());
MockSerializableCollectionAcccess sc = new MockSerializableCollectionAcccess();
byte[] serialized = null;
Runtime r = Runtime.getRuntime();
r.gc();
Thread.sleep(2000);
{
long start = System.currentTimeMillis();
long ms = r.freeMemory();
for (int i = 0; i < 16000; i++)
{
serialized = t1.serialize(sc);
}
long me = r.freeMemory();
long m = ms - me;
long end = System.currentTimeMillis();
long t = (end - start);
log.info("Write 16000 Entities took " + t + "ms ");
log.info("Write 16000 Entities took " + (t * 1000) / 16000 + " us/entity ");
log.info("Write 16000 Entities took " + m + " bytes overhead ");
log.info("Write 16000 Entities took " + (m / 16000) + " bytes/entity overhead ");
}
r.gc();
Thread.sleep(2000);
{
long start = System.currentTimeMillis();
long ms = r.freeMemory();
for (int i = 0; i < 16000; i++)
{
t1.parse(sc, serialized);
}
long me = r.freeMemory();
long m = ms - me;
long end = System.currentTimeMillis();
long t = (end - start);
log.info("Read 16000 Entities took " + t + "ms ");
log.info("Read 16000 Entities took " + (t * 1000) / 16000 + " us/entity ");
log.info("Read 16000 Entities took " + m + " bytes overhead ");
log.info("Read 16000 Entities took " + (m / 16000) + " bytes/entity overhead ");
}
sc.check();
} | final void function() throws Exception { Type1BaseContentCollectionSerializer t1 = new Type1BaseContentCollectionSerializer(); t1.setTimeService(new MockTimeService()); MockSerializableCollectionAcccess sc = new MockSerializableCollectionAcccess(); byte[] serialized = null; Runtime r = Runtime.getRuntime(); r.gc(); Thread.sleep(2000); { long start = System.currentTimeMillis(); long ms = r.freeMemory(); for (int i = 0; i < 16000; i++) { serialized = t1.serialize(sc); } long me = r.freeMemory(); long m = ms - me; long end = System.currentTimeMillis(); long t = (end - start); log.info(STR + t + STR); log.info(STR + (t * 1000) / 16000 + STR); log.info(STR + m + STR); log.info(STR + (m / 16000) + STR); } r.gc(); Thread.sleep(2000); { long start = System.currentTimeMillis(); long ms = r.freeMemory(); for (int i = 0; i < 16000; i++) { t1.parse(sc, serialized); } long me = r.freeMemory(); long m = ms - me; long end = System.currentTimeMillis(); long t = (end - start); log.info(STR + t + STR); log.info(STR + (t * 1000) / 16000 + STR); log.info(STR + m + STR); log.info(STR + (m / 16000) + STR); } sc.check(); } | /**
* Test method for
* {@link org.sakaiproject.content.impl.serialize.impl.Type1BaseContentCollectionSerializer#parse(org.sakaiproject.entity.api.serialize.SerializableEntity, java.lang.String)}.
*
* @throws Exception
*/ | Test method for <code>org.sakaiproject.content.impl.serialize.impl.Type1BaseContentCollectionSerializer#parse(org.sakaiproject.entity.api.serialize.SerializableEntity, java.lang.String)</code> | testParse | {
"repo_name": "eemirtekin/Sakai-10.6-TR",
"path": "kernel/kernel-impl/src/test/java/org/sakaiproject/content/impl/serialize/impl/test/ProfileSerializerTest.java",
"license": "apache-2.0",
"size": 3747
} | [
"org.sakaiproject.content.impl.serialize.impl.Type1BaseContentCollectionSerializer"
] | import org.sakaiproject.content.impl.serialize.impl.Type1BaseContentCollectionSerializer; | import org.sakaiproject.content.impl.serialize.impl.*; | [
"org.sakaiproject.content"
] | org.sakaiproject.content; | 1,803,812 |
@TimerJ
private void logBulkInsert(TableMetadata tableMetadata, Collection<Row> rows) {
if (logger.isDebugEnabled()) {
String index = tableMetadata.getName().getCatalogName().getName();
String type = tableMetadata.getName().getName();
logger.debug("Insert " + rows.size() + " rows in ElasticSearch Database. Index [" + index + "] Type ["
+ type + "]");
}
} | void function(TableMetadata tableMetadata, Collection<Row> rows) { if (logger.isDebugEnabled()) { String index = tableMetadata.getName().getCatalogName().getName(); String type = tableMetadata.getName().getName(); logger.debug(STR + rows.size() + STR + index + STR + type + "]"); } } | /**
* Log the bulf insert.
*
* @param tableMetadata
* the table metadata.
* @param rows
* the rows.
*/ | Log the bulf insert | logBulkInsert | {
"repo_name": "Stratio/stratio-connector-elasticsearch",
"path": "connector-elasticsearch/src/main/java/com/stratio/connector/elasticsearch/core/engine/ElasticsearchStorageEngine.java",
"license": "apache-2.0",
"size": 10478
} | [
"com.stratio.crossdata.common.data.Row",
"com.stratio.crossdata.common.metadata.TableMetadata",
"java.util.Collection"
] | import com.stratio.crossdata.common.data.Row; import com.stratio.crossdata.common.metadata.TableMetadata; import java.util.Collection; | import com.stratio.crossdata.common.data.*; import com.stratio.crossdata.common.metadata.*; import java.util.*; | [
"com.stratio.crossdata",
"java.util"
] | com.stratio.crossdata; java.util; | 576,500 |
public void connectTo(String host, int port)
throws UnknownHostException, IOException {
CommandListener listener = new CommandListener(mm_master,
host, port, this);
listener.start();
lock();
mm_listeners.add(listener);
release();
} | void function(String host, int port) throws UnknownHostException, IOException { CommandListener listener = new CommandListener(mm_master, host, port, this); listener.start(); lock(); mm_listeners.add(listener); release(); } | /**
* Create a listener attached to a client socket at the
* given host and port.
* @param host The host name or IP.
* @param port The port number.
* @throws IOException If there is an I/O error in connecting.
* @throws UnknownHostException If the host cannot be found.
*/ | Create a listener attached to a client socket at the given host and port | connectTo | {
"repo_name": "OpenVnmrJ/OpenVnmrJ",
"path": "src/apt_32_MMI/src/vnmr/apt/ProbeTune.java",
"license": "apache-2.0",
"size": 174511
} | [
"java.io.IOException",
"java.net.UnknownHostException"
] | import java.io.IOException; import java.net.UnknownHostException; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 3,880 |
@Test(expected = IllegalArgumentException.class)
public void createAccessId_uniqueIdEmpty() {
AccessIdUtil.createAccessId("type", defaultRealm, "");
} | @Test(expected = IllegalArgumentException.class) void function() { AccessIdUtil.createAccessId("type", defaultRealm, ""); } | /**
* Test method for {@link com.ibm.ws.security.AccessIdUtil#createAccessId(java.lang.String, java.lang.String, java.lang.String)} .
*/ | Test method for <code>com.ibm.ws.security.AccessIdUtil#createAccessId(java.lang.String, java.lang.String, java.lang.String)</code> | createAccessId_uniqueIdEmpty | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security/test/com/ibm/ws/security/AccessIdUtilTest.java",
"license": "epl-1.0",
"size": 26900
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,318,940 |
public SessionBeanType<T> removeAllEnvEntry()
{
childNode.removeChildren("env-entry");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: SessionBeanType ElementName: javaee:ejb-refType ElementType : ejb-ref
// MaxOccurs: -unbounded isGeneric: true isAttribute: false isEnum: false isDataType: false
// --------------------------------------------------------------------------------------------------------|| | SessionBeanType<T> function() { childNode.removeChildren(STR); return this; } | /**
* Removes all <code>env-entry</code> elements
* @return the current instance of <code>EnvEntryType<SessionBeanType<T>></code>
*/ | Removes all <code>env-entry</code> elements | removeAllEnvEntry | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar32/SessionBeanTypeImpl.java",
"license": "epl-1.0",
"size": 107840
} | [
"org.jboss.shrinkwrap.descriptor.api.ejbjar32.SessionBeanType"
] | import org.jboss.shrinkwrap.descriptor.api.ejbjar32.SessionBeanType; | import org.jboss.shrinkwrap.descriptor.api.ejbjar32.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 2,761,643 |
@SuppressWarnings("serial")
public static void modifyTableSync(Admin admin, HTableDescriptor desc)
throws IOException, InterruptedException {
admin.modifyTable(desc.getTableName(), desc);
Pair<Integer, Integer> status = new Pair<Integer, Integer>() {{
setFirst(0);
setSecond(0);
}};
int i = 0;
do {
status = admin.getAlterStatus(desc.getTableName());
if (status.getSecond() != 0) {
LOG.debug(status.getSecond() - status.getFirst() + "/" + status.getSecond()
+ " regions updated.");
Thread.sleep(1 * 1000l);
} else {
LOG.debug("All regions updated.");
break;
}
} while (status.getFirst() != 0 && i++ < 500);
if (status.getFirst() != 0) {
throw new IOException("Failed to update all regions even after 500 seconds.");
}
} | @SuppressWarnings(STR) static void function(Admin admin, HTableDescriptor desc) throws IOException, InterruptedException { admin.modifyTable(desc.getTableName(), desc); Pair<Integer, Integer> status = new Pair<Integer, Integer>() {{ setFirst(0); setSecond(0); }}; int i = 0; do { status = admin.getAlterStatus(desc.getTableName()); if (status.getSecond() != 0) { LOG.debug(status.getSecond() - status.getFirst() + "/" + status.getSecond() + STR); Thread.sleep(1 * 1000l); } else { LOG.debug(STR); break; } } while (status.getFirst() != 0 && i++ < 500); if (status.getFirst() != 0) { throw new IOException(STR); } } | /**
* Modify a table, synchronous. Waiting logic similar to that of {@code admin.rb#alter_status}.
*/ | Modify a table, synchronous. Waiting logic similar to that of admin.rb#alter_status | modifyTableSync | {
"repo_name": "juwi/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 151512
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.client.Admin",
"org.apache.hadoop.hbase.util.Pair"
] | import java.io.IOException; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.util.Pair; | import java.io.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 95,126 |
void updateConfig(Config config); | void updateConfig(Config config); | /**
* Updates configuration with the same name with the passed data. If configuration with the name does not exist a
* {@link ConfigurationNotFoundException} exception will be thrown.
*
* @param config the configuration to serve as an update source
*/ | Updates configuration with the same name with the passed data. If configuration with the name does not exist a <code>ConfigurationNotFoundException</code> exception will be thrown | updateConfig | {
"repo_name": "koshalt/modules",
"path": "openmrs/src/main/java/org/motechproject/openmrs/service/OpenMRSConfigService.java",
"license": "bsd-3-clause",
"size": 2612
} | [
"org.motechproject.openmrs.config.Config"
] | import org.motechproject.openmrs.config.Config; | import org.motechproject.openmrs.config.*; | [
"org.motechproject.openmrs"
] | org.motechproject.openmrs; | 460,619 |
public static void setGlobalContext(GlobalContext gctx) {
_gctx = gctx;
} | static void function(GlobalContext gctx) { _gctx = gctx; } | /**
* This method is needed by the TestCases.
*
* @param gctx
*/ | This method is needed by the TestCases | setGlobalContext | {
"repo_name": "drftpd-ng/drftpd3",
"path": "src/core/master/src/main/java/org/drftpd/master/slaveselection/filter/AssignSlave.java",
"license": "gpl-2.0",
"size": 4500
} | [
"org.drftpd.master.GlobalContext"
] | import org.drftpd.master.GlobalContext; | import org.drftpd.master.*; | [
"org.drftpd.master"
] | org.drftpd.master; | 1,892,105 |
public boolean delistResource(XAResource xaRes, int flag)
throws IllegalStateException, SystemException; | boolean function(XAResource xaRes, int flag) throws IllegalStateException, SystemException; | /**
* Delists a resource from the transaction.
*/ | Delists a resource from the transaction | delistResource | {
"repo_name": "christianchristensen/resin",
"path": "modules/jta/src/javax/transaction/Transaction.java",
"license": "gpl-2.0",
"size": 2348
} | [
"javax.transaction.xa.XAResource"
] | import javax.transaction.xa.XAResource; | import javax.transaction.xa.*; | [
"javax.transaction"
] | javax.transaction; | 197,209 |
private UserRegistry getUserRegistryFromConfiguration() throws RegistryException {
String[] refIds = this.refId;
if (refIds == null || refIds.length == 0) {
// Can look for config.source = file
// If thats set, and we're missing this, we can error.
// If its not set, we don't have configuration from the
// file and we should try to resolve if we have one instance defined?
Tr.error(tc, "USER_REGISTRY_SERVICE_CONFIG_ERROR_NO_REFID");
throw new RegistryException(TraceNLS.getFormattedMessage(
this.getClass(),
TraceConstants.MESSAGE_BUNDLE,
"USER_REGISTRY_SERVICE_CONFIG_ERROR_NO_REFID",
null,
"CWWKS3000E: A configuration error has occurred. There is no configured refId parameter for the userRegistry configuration."));
} else if (refIds.length == 1) {
return getUserRegistry(refIds[0]);
} else {
// Multiple refIds, we'll use the UserRegistryProxy.
List<UserRegistry> delegates = new ArrayList<UserRegistry>();
for (String refId : refIds) {
delegates.add(getUserRegistry(refId));
}
return new UserRegistryProxy(realm, delegates);
}
} | UserRegistry function() throws RegistryException { String[] refIds = this.refId; if (refIds == null refIds.length == 0) { Tr.error(tc, STR); throw new RegistryException(TraceNLS.getFormattedMessage( this.getClass(), TraceConstants.MESSAGE_BUNDLE, STR, null, STR)); } else if (refIds.length == 1) { return getUserRegistry(refIds[0]); } else { List<UserRegistry> delegates = new ArrayList<UserRegistry>(); for (String refId : refIds) { delegates.add(getUserRegistry(refId)); } return new UserRegistryProxy(realm, delegates); } } | /**
* When a configuration element is defined, use it to resolve the effective
* UserRegistry configuration.
*
* @return
* @throws RegistryException
*/ | When a configuration element is defined, use it to resolve the effective UserRegistry configuration | getUserRegistryFromConfiguration | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.registry/src/com/ibm/ws/security/registry/internal/UserRegistryServiceImpl.java",
"license": "epl-1.0",
"size": 26435
} | [
"com.ibm.ejs.ras.TraceNLS",
"com.ibm.websphere.ras.Tr",
"com.ibm.ws.security.registry.RegistryException",
"com.ibm.ws.security.registry.UserRegistry",
"java.util.ArrayList",
"java.util.List"
] | import com.ibm.ejs.ras.TraceNLS; import com.ibm.websphere.ras.Tr; import com.ibm.ws.security.registry.RegistryException; import com.ibm.ws.security.registry.UserRegistry; import java.util.ArrayList; import java.util.List; | import com.ibm.ejs.ras.*; import com.ibm.websphere.ras.*; import com.ibm.ws.security.registry.*; import java.util.*; | [
"com.ibm.ejs",
"com.ibm.websphere",
"com.ibm.ws",
"java.util"
] | com.ibm.ejs; com.ibm.websphere; com.ibm.ws; java.util; | 2,236,765 |
private static final String getDigestedPasswordMessageContent(
final String path, final String user, final String password)
throws Exception {
final String nonce; // Nonce for the message
final String date; // Current date
final String digest; // Digested password
final Template template; // Freemarker template
final Map<String, Object> data; // Data for the template
final ByteArrayOutputStream out; // Steam with the message
// Generates security data
nonce = getNonce();
date = getCurrentDate();
digest = generateDigest(password, date, nonce);
// Prepares the data for the template
data = new HashMap<String, Object>();
data.put("user", user);
data.put("password", password);
data.put("nonce", nonce);
data.put("date", date);
data.put("digest", digest);
// Processes the template to the output
out = new ByteArrayOutputStream();
template = new Configuration(Configuration.VERSION_2_3_0)
.getTemplate(path);
template.process(data, new OutputStreamWriter(out));
return new String(out.toByteArray());
} | static final String function( final String path, final String user, final String password) throws Exception { final String nonce; final String date; final String digest; final Template template; final Map<String, Object> data; final ByteArrayOutputStream out; nonce = getNonce(); date = getCurrentDate(); digest = generateDigest(password, date, nonce); data = new HashMap<String, Object>(); data.put("user", user); data.put(STR, password); data.put("nonce", nonce); data.put("date", date); data.put(STR, digest); out = new ByteArrayOutputStream(); template = new Configuration(Configuration.VERSION_2_3_0) .getTemplate(path); template.process(data, new OutputStreamWriter(out)); return new String(out.toByteArray()); } | /**
* Generates the text content for the digested password SOAP message.
* <p>
* This will be created from a freemarker template.
*
* @param path
* path to the freemarker template
* @param user
* username to use
* @param password
* password to use
* @return the text content for the digested password message
* @throws Exception
* if any error occurs during the message creation
*/ | Generates the text content for the digested password SOAP message. This will be created from a freemarker template | getDigestedPasswordMessageContent | {
"repo_name": "Bernardo-MG/spring-soap-ws-security-example",
"path": "src/test/java/com/bernardomg/example/swss/test/util/factory/SecureSoapMessages.java",
"license": "mit",
"size": 19631
} | [
"freemarker.template.Configuration",
"freemarker.template.Template",
"java.io.ByteArrayOutputStream",
"java.io.OutputStreamWriter",
"java.util.HashMap",
"java.util.Map"
] | import freemarker.template.Configuration; import freemarker.template.Template; import java.io.ByteArrayOutputStream; import java.io.OutputStreamWriter; import java.util.HashMap; import java.util.Map; | import freemarker.template.*; import java.io.*; import java.util.*; | [
"freemarker.template",
"java.io",
"java.util"
] | freemarker.template; java.io; java.util; | 440,231 |
@Test
public void testSingleChannelWithBarriers() throws Exception {
BufferOrEvent[] sequence = {
createBuffer(0), createBuffer(0), createBuffer(0),
createBarrier(1, 0),
createBuffer(0), createBuffer(0), createBuffer(0), createBuffer(0),
createBarrier(2, 0), createBarrier(3, 0),
createBuffer(0), createBuffer(0),
createBarrier(4, 0), createBarrier(5, 0), createBarrier(6, 0),
createBuffer(0), createEndOfPartition(0)
};
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
inputGate = createBarrierBuffer(1, sequence, handler);
handler.setNextExpectedCheckpointId(1L);
for (BufferOrEvent boe : sequence) {
if (boe.isBuffer() || boe.getEvent().getClass() != CheckpointBarrier.class) {
assertEquals(boe, inputGate.pollNext().get());
}
}
} | void function() throws Exception { BufferOrEvent[] sequence = { createBuffer(0), createBuffer(0), createBuffer(0), createBarrier(1, 0), createBuffer(0), createBuffer(0), createBuffer(0), createBuffer(0), createBarrier(2, 0), createBarrier(3, 0), createBuffer(0), createBuffer(0), createBarrier(4, 0), createBarrier(5, 0), createBarrier(6, 0), createBuffer(0), createEndOfPartition(0) }; ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler(); inputGate = createBarrierBuffer(1, sequence, handler); handler.setNextExpectedCheckpointId(1L); for (BufferOrEvent boe : sequence) { if (boe.isBuffer() boe.getEvent().getClass() != CheckpointBarrier.class) { assertEquals(boe, inputGate.pollNext().get()); } } } | /**
* Validates that the buffer preserved the order of elements for a
* input with a single input channel, and checkpoint events.
*/ | Validates that the buffer preserved the order of elements for a input with a single input channel, and checkpoint events | testSingleChannelWithBarriers | {
"repo_name": "fhueske/flink",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierAlignerTestBase.java",
"license": "apache-2.0",
"size": 54591
} | [
"org.apache.flink.runtime.io.network.api.CheckpointBarrier",
"org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent",
"org.junit.Assert"
] | import org.apache.flink.runtime.io.network.api.CheckpointBarrier; import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent; import org.junit.Assert; | import org.apache.flink.runtime.io.network.api.*; import org.apache.flink.runtime.io.network.partition.consumer.*; import org.junit.*; | [
"org.apache.flink",
"org.junit"
] | org.apache.flink; org.junit; | 131,851 |
public PagingResults<NodeRef> listArchivedNodes(ArchivedNodesCannedQueryBuilder cannedQueryBuilder);
| PagingResults<NodeRef> function(ArchivedNodesCannedQueryBuilder cannedQueryBuilder); | /**
* Get the archived nodes deleted by the current user. If the current user
* is an Administrator, then all the deleted nodes are fetched.
*
* @param cannedQueryBuilder the object that holds the required and optional
* parameters to perform the canned query
* @return the results of the attempted search
* @since 4.2
*/ | Get the archived nodes deleted by the current user. If the current user is an Administrator, then all the deleted nodes are fetched | listArchivedNodes | {
"repo_name": "daniel-he/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/node/archive/NodeArchiveService.java",
"license": "lgpl-3.0",
"size": 8489
} | [
"org.alfresco.query.PagingResults",
"org.alfresco.service.cmr.repository.NodeRef"
] | import org.alfresco.query.PagingResults; import org.alfresco.service.cmr.repository.NodeRef; | import org.alfresco.query.*; import org.alfresco.service.cmr.repository.*; | [
"org.alfresco.query",
"org.alfresco.service"
] | org.alfresco.query; org.alfresco.service; | 2,871,996 |
public SupportTicketDetailsInner withContactDetails(ContactProfile contactDetails) {
this.contactDetails = contactDetails;
return this;
} | SupportTicketDetailsInner function(ContactProfile contactDetails) { this.contactDetails = contactDetails; return this; } | /**
* Set the contactDetails property: Contact information of the user requesting to create a support ticket.
*
* @param contactDetails the contactDetails value to set.
* @return the SupportTicketDetailsInner object itself.
*/ | Set the contactDetails property: Contact information of the user requesting to create a support ticket | withContactDetails | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/support/azure-resourcemanager-support/src/main/java/com/azure/resourcemanager/support/fluent/models/SupportTicketDetailsInner.java",
"license": "mit",
"size": 17405
} | [
"com.azure.resourcemanager.support.models.ContactProfile"
] | import com.azure.resourcemanager.support.models.ContactProfile; | import com.azure.resourcemanager.support.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,472,039 |
protected JComponent buildMainDisplayArea() {
m_gui = new BHTSimGUI();
m_bhtModel = new BHTableModel(BHTSimulator.BHT_DEFAULT_SIZE, BHTSimulator.BHT_DEFAULT_HISTORY, BHT_DEFAULT_INITVAL);
m_gui.getTabBHT().setModel(m_bhtModel);
m_gui.getCbBHThistory().setSelectedItem(new Integer(BHTSimulator.BHT_DEFAULT_HISTORY));
m_gui.getCbBHTentries().setSelectedItem(new Integer(BHTSimulator.BHT_DEFAULT_SIZE));
m_gui.getCbBHTentries().addActionListener(this);
m_gui.getCbBHThistory().addActionListener(this);
m_gui.getCbBHTinitVal().addActionListener(this);
return m_gui;
}
| JComponent function() { m_gui = new BHTSimGUI(); m_bhtModel = new BHTableModel(BHTSimulator.BHT_DEFAULT_SIZE, BHTSimulator.BHT_DEFAULT_HISTORY, BHT_DEFAULT_INITVAL); m_gui.getTabBHT().setModel(m_bhtModel); m_gui.getCbBHThistory().setSelectedItem(new Integer(BHTSimulator.BHT_DEFAULT_HISTORY)); m_gui.getCbBHTentries().setSelectedItem(new Integer(BHTSimulator.BHT_DEFAULT_SIZE)); m_gui.getCbBHTentries().addActionListener(this); m_gui.getCbBHThistory().addActionListener(this); m_gui.getCbBHTinitVal().addActionListener(this); return m_gui; } | /**
* Creates a GUI and initialize the GUI with the default values.
*/ | Creates a GUI and initialize the GUI with the default values | buildMainDisplayArea | {
"repo_name": "gon1332/mars",
"path": "src/main/java/mars/tools/BHTSimulator.java",
"license": "mit",
"size": 14068
} | [
"javax.swing.JComponent"
] | import javax.swing.JComponent; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 510,992 |
public void searchResult(Index index, Query query, JSONObject results); | void function(Index index, Query query, JSONObject results); | /**
* Asynchronously receive result of Index.searchASync method.
*/ | Asynchronously receive result of Index.searchASync method | searchResult | {
"repo_name": "Acidburn0zzz/algoliasearch-client-android",
"path": "src/main/java/com/algolia/search/saas/IndexListener.java",
"license": "mit",
"size": 7800
} | [
"org.json.JSONObject"
] | import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 2,067,447 |
private WsmResource constructResource(DbResource dbResource) {
WsmResourceHandler handler = dbResource.getResourceType().getResourceHandler();
return handler.makeResourceFromDb(dbResource);
} | WsmResource function(DbResource dbResource) { WsmResourceHandler handler = dbResource.getResourceType().getResourceHandler(); return handler.makeResourceFromDb(dbResource); } | /**
* Dispatch by stewardship and resource type to call the correct constructor for the WsmResource
*
* @param dbResource Resource data from the database
* @return WsmResource
*/ | Dispatch by stewardship and resource type to call the correct constructor for the WsmResource | constructResource | {
"repo_name": "DataBiosphere/terra-workspace-manager",
"path": "service/src/main/java/bio/terra/workspace/db/ResourceDao.java",
"license": "bsd-3-clause",
"size": 41233
} | [
"bio.terra.workspace.db.model.DbResource",
"bio.terra.workspace.service.resource.model.WsmResource",
"bio.terra.workspace.service.resource.model.WsmResourceHandler"
] | import bio.terra.workspace.db.model.DbResource; import bio.terra.workspace.service.resource.model.WsmResource; import bio.terra.workspace.service.resource.model.WsmResourceHandler; | import bio.terra.workspace.db.model.*; import bio.terra.workspace.service.resource.model.*; | [
"bio.terra.workspace"
] | bio.terra.workspace; | 2,654,342 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.