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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
private List<Double> computeCenterOfMass() {
if (hasChild) {
@SuppressWarnings("unchecked")
List<Double>[] lmass = new ArrayList[8];
// Calculate recursively the values of his sons
for (int i = 0; i < 8; i++) {
if (sons.get(i) != null) {
lmass[i] = sons.get(i).computeCenterOfMass();
}
}
double masse = 0;
double massCenterCx = 0;
double massCenterCy = 0;
double massCenterCz = 0;
double ma;
for (int i = 0; i < 8; i++) {
if (lmass[i] != null) {
ma = ((Double) lmass[i].get(0)).doubleValue();
masse += ma;
massCenterCx += ma * ((Double) lmass[i].get(1)).doubleValue();
massCenterCy += ma * ((Double) lmass[i].get(2)).doubleValue();
massCenterCz += ma * ((Double) lmass[i].get(3)).doubleValue();
}
}
mass = masse;
massCenterx = massCenterCx / masse;
massCentery = massCenterCy / masse;
massCenterz = massCenterCz / masse;
}
// If it's a leaf, we return the values
// Also if the node have finished its calculs
List<Double> ltmp = new ArrayList<Double>(4);
ltmp.add(new Double(mass));
ltmp.add(new Double(massCenterx));
ltmp.add(new Double(massCentery));
ltmp.add(new Double(massCenterz));
return ltmp;
} | List<Double> function() { if (hasChild) { @SuppressWarnings(STR) List<Double>[] lmass = new ArrayList[8]; for (int i = 0; i < 8; i++) { if (sons.get(i) != null) { lmass[i] = sons.get(i).computeCenterOfMass(); } } double masse = 0; double massCenterCx = 0; double massCenterCy = 0; double massCenterCz = 0; double ma; for (int i = 0; i < 8; i++) { if (lmass[i] != null) { ma = ((Double) lmass[i].get(0)).doubleValue(); masse += ma; massCenterCx += ma * ((Double) lmass[i].get(1)).doubleValue(); massCenterCy += ma * ((Double) lmass[i].get(2)).doubleValue(); massCenterCz += ma * ((Double) lmass[i].get(3)).doubleValue(); } } mass = masse; massCenterx = massCenterCx / masse; massCentery = massCenterCy / masse; massCenterz = massCenterCz / masse; } List<Double> ltmp = new ArrayList<Double>(4); ltmp.add(new Double(mass)); ltmp.add(new Double(massCenterx)); ltmp.add(new Double(massCentery)); ltmp.add(new Double(massCenterz)); return ltmp; } | /**
* Fill the entire OctTree with good mass and center of mass
* At beginning only leafs have a mass and mass center initialized (in createOctTree)
* At the end of function, all tree's nodes have their attributes initialized
* with the good value
* @result List for going up the values of the leafs, first argument in the list
* is mass, then mass center x, mass center y, mass center z.
*/ | Fill the entire OctTree with good mass and center of mass At beginning only leafs have a mass and mass center initialized (in createOctTree) At the end of function, all tree's nodes have their attributes initialized with the good value | computeCenterOfMass | {
"repo_name": "moliva/proactive",
"path": "src/Examples/org/objectweb/proactive/examples/nbody/barneshut/OctTree.java",
"license": "agpl-3.0",
"size": 14084
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,112,447 |
public void setArgument(Buffer buffer, Argument.Direction d) {
BufferArgument arg = new BufferArgument(context, writeQueue, readQueue, writeBufferEvents, buffer, d);
setArgument(Sizeof.cl_mem, arg);
argsToClean.add(arg);
} | void function(Buffer buffer, Argument.Direction d) { BufferArgument arg = new BufferArgument(context, writeQueue, readQueue, writeBufferEvents, buffer, d); setArgument(Sizeof.cl_mem, arg); argsToClean.add(arg); } | /**
* Set an argument for this launch. The value will be copied to the device before the kernel launches.
*
* @param buffer
* the argument to be set for this kernel
* @param d
* indicates whether the value is only read, only written, or both
*/ | Set an argument for this launch. The value will be copied to the device before the kernel launches | setArgument | {
"repo_name": "pieterhijma/cashmere",
"path": "src/main/java/ibis/cashmere/constellation/Launch.java",
"license": "apache-2.0",
"size": 20350
} | [
"org.jocl.Sizeof"
] | import org.jocl.Sizeof; | import org.jocl.*; | [
"org.jocl"
] | org.jocl; | 2,448,814 |
public void cleanup() throws ResourceException {
log.trace("cleanup()");
} | void function() throws ResourceException { log.trace(STR); } | /**
* Application server calls this method to force any cleanup on the ManagedConnection instance.
*
* @throws ResourceException generic exception if operation fails
*/ | Application server calls this method to force any cleanup on the ManagedConnection instance | cleanup | {
"repo_name": "jstourac/wildfly",
"path": "testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/rar/MultipleManagedConnection2.java",
"license": "lgpl-2.1",
"size": 7359
} | [
"javax.resource.ResourceException"
] | import javax.resource.ResourceException; | import javax.resource.*; | [
"javax.resource"
] | javax.resource; | 1,019,978 |
@Test
void testBuildWithDefaultExceptionMapping() {
final RuntimeException exception = new RuntimeException("Something went wrong");
final RestApiException model = restApiExceptionMapper.build(
exception, "/api/something", null);
assertNotNull(model);
assertNull(model.getErrorCode());
assertFalse(model.getErrorCodeInherited());
assertEquals(exception.getMessage(), model.getMessage());
assertEquals("/api/something", model.getPath());
assertNotNull(model.getId());
} | void testBuildWithDefaultExceptionMapping() { final RuntimeException exception = new RuntimeException(STR); final RestApiException model = restApiExceptionMapper.build( exception, STR, null); assertNotNull(model); assertNull(model.getErrorCode()); assertFalse(model.getErrorCodeInherited()); assertEquals(exception.getMessage(), model.getMessage()); assertEquals(STR, model.getPath()); assertNotNull(model.getId()); } | /**
* Test build with default exception mapping.
*/ | Test build with default exception mapping | testBuildWithDefaultExceptionMapping | {
"repo_name": "bremersee/common",
"path": "common-base-autoconfigure/src/test/java/org/bremersee/converter/integration/servlet/ConverterIntegrationTest.java",
"license": "apache-2.0",
"size": 9189
} | [
"org.bremersee.exception.model.RestApiException",
"org.junit.jupiter.api.Assertions"
] | import org.bremersee.exception.model.RestApiException; import org.junit.jupiter.api.Assertions; | import org.bremersee.exception.model.*; import org.junit.jupiter.api.*; | [
"org.bremersee.exception",
"org.junit.jupiter"
] | org.bremersee.exception; org.junit.jupiter; | 2,586,961 |
private void parseQuery() throws FrontendException {
UDFContext.getUDFContext().reset();
UDFContext.getUDFContext().setClientSystemProps(pigContext.getProperties());
String query = buildQuery();
if( query.isEmpty() ) {
lp = new LogicalPlan();
return;
}
try {
QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap );
lp = parserDriver.parse( query );
operators = parserDriver.getOperators();
lastRel = parserDriver.getLastRel();
} catch(Exception ex) {
scriptCache.remove( scriptCache.size() -1 ); // remove the bad script from the cache.
PigException pe = LogUtils.getPigException(ex);
int errCode = 1000;
String msg = "Error during parsing. "
+ (pe == null ? ex.getMessage() : pe.getMessage());
throw new FrontendException (msg, errCode, PigException.INPUT , ex );
}
} | void function() throws FrontendException { UDFContext.getUDFContext().reset(); UDFContext.getUDFContext().setClientSystemProps(pigContext.getProperties()); String query = buildQuery(); if( query.isEmpty() ) { lp = new LogicalPlan(); return; } try { QueryParserDriver parserDriver = new QueryParserDriver( pigContext, scope, fileNameMap ); lp = parserDriver.parse( query ); operators = parserDriver.getOperators(); lastRel = parserDriver.getLastRel(); } catch(Exception ex) { scriptCache.remove( scriptCache.size() -1 ); PigException pe = LogUtils.getPigException(ex); int errCode = 1000; String msg = STR + (pe == null ? ex.getMessage() : pe.getMessage()); throw new FrontendException (msg, errCode, PigException.INPUT , ex ); } } | /**
* Parse the accumulated pig statements and generate an overall plan.
*/ | Parse the accumulated pig statements and generate an overall plan | parseQuery | {
"repo_name": "twitter/pig",
"path": "src/org/apache/pig/PigServer.java",
"license": "apache-2.0",
"size": 70320
} | [
"org.apache.pig.impl.logicalLayer.FrontendException",
"org.apache.pig.impl.util.LogUtils",
"org.apache.pig.impl.util.UDFContext",
"org.apache.pig.newplan.logical.relational.LogicalPlan",
"org.apache.pig.parser.QueryParserDriver"
] | import org.apache.pig.impl.logicalLayer.FrontendException; import org.apache.pig.impl.util.LogUtils; import org.apache.pig.impl.util.UDFContext; import org.apache.pig.newplan.logical.relational.LogicalPlan; import org.apache.pig.parser.QueryParserDriver; | import org.apache.pig.impl.*; import org.apache.pig.impl.util.*; import org.apache.pig.newplan.logical.relational.*; import org.apache.pig.parser.*; | [
"org.apache.pig"
] | org.apache.pig; | 1,619,258 |
public String downloadContentFrom(String urlOrLink) {
String result = null;
if (urlOrLink != null) {
String url = getUrl(urlOrLink);
BinaryHttpResponse resp = new BinaryHttpResponse();
getUrlContent(url, resp);
byte[] content = resp.getResponseContent();
if (content == null) {
result = resp.getResponse();
} else {
String fileName = resp.getFileName();
if (StringUtils.isEmpty(fileName)) {
fileName = "download";
}
String baseName = FilenameUtils.getBaseName(fileName);
String ext = FilenameUtils.getExtension(fileName);
String downloadedFile = FileUtil.saveToFile(getDownloadName(baseName), ext, content);
String wikiUrl = getWikiUrl(downloadedFile);
if (wikiUrl != null) {
// make href to file
result = String.format("<a href=\"%s\">%s</a>", wikiUrl, fileName);
} else {
result = downloadedFile;
}
}
}
return result;
} | String function(String urlOrLink) { String result = null; if (urlOrLink != null) { String url = getUrl(urlOrLink); BinaryHttpResponse resp = new BinaryHttpResponse(); getUrlContent(url, resp); byte[] content = resp.getResponseContent(); if (content == null) { result = resp.getResponse(); } else { String fileName = resp.getFileName(); if (StringUtils.isEmpty(fileName)) { fileName = STR; } String baseName = FilenameUtils.getBaseName(fileName); String ext = FilenameUtils.getExtension(fileName); String downloadedFile = FileUtil.saveToFile(getDownloadName(baseName), ext, content); String wikiUrl = getWikiUrl(downloadedFile); if (wikiUrl != null) { result = String.format(STR%s\STR, wikiUrl, fileName); } else { result = downloadedFile; } } } return result; } | /**
* Downloads binary content from specified url (using the browser's cookies).
* @param urlOrLink url to download from
* @return link to downloaded file
*/ | Downloads binary content from specified url (using the browser's cookies) | downloadContentFrom | {
"repo_name": "GDasai/hsac-fitnesse-fixtures",
"path": "src/main/java/nl/hsac/fitnesse/fixture/slim/web/BrowserTest.java",
"license": "apache-2.0",
"size": 86267
} | [
"nl.hsac.fitnesse.fixture.util.BinaryHttpResponse",
"nl.hsac.fitnesse.fixture.util.FileUtil",
"org.apache.commons.io.FilenameUtils",
"org.apache.commons.lang3.StringUtils"
] | import nl.hsac.fitnesse.fixture.util.BinaryHttpResponse; import nl.hsac.fitnesse.fixture.util.FileUtil; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; | import nl.hsac.fitnesse.fixture.util.*; import org.apache.commons.io.*; import org.apache.commons.lang3.*; | [
"nl.hsac.fitnesse",
"org.apache.commons"
] | nl.hsac.fitnesse; org.apache.commons; | 814,620 |
boolean deleteExpenses(List<Integer> deleteIdList); | boolean deleteExpenses(List<Integer> deleteIdList); | /**
* <p>Delete Expense Records.</p>
*
* @param deleteIdList target ID List
* @return successFlg
*/ | Delete Expense Records | deleteExpenses | {
"repo_name": "tumo17th/acbook",
"path": "acbook-core/src/main/java/com/acbook/service/ExpenseService.java",
"license": "mit",
"size": 933
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,740,009 |
void setNextFrame(byte[] data, Camera camera) {
synchronized (lock) {
if (pendingFrameData != null) {
camera.addCallbackBuffer(pendingFrameData.array());
pendingFrameData = null;
}
if (!bytesToByteBuffer.containsKey(data)) {
Log.d(
TAG,
"Skipping frame. Could not find ByteBuffer associated with the image "
+ "data from the camera.");
return;
}
pendingFrameData = bytesToByteBuffer.get(data);
// Notify the processor thread if it is waiting on the next frame (see below).
lock.notifyAll();
}
} | void setNextFrame(byte[] data, Camera camera) { synchronized (lock) { if (pendingFrameData != null) { camera.addCallbackBuffer(pendingFrameData.array()); pendingFrameData = null; } if (!bytesToByteBuffer.containsKey(data)) { Log.d( TAG, STR + STR); return; } pendingFrameData = bytesToByteBuffer.get(data); lock.notifyAll(); } } | /**
* Sets the frame data received from the camera. This adds the previous unused frame buffer (if
* present) back to the camera, and keeps a pending reference to the frame data for future use.
*/ | Sets the frame data received from the camera. This adds the previous unused frame buffer (if present) back to the camera, and keeps a pending reference to the frame data for future use | setNextFrame | {
"repo_name": "JimSeker/googleplayAPI",
"path": "FirebaseAPI/legacy/firebaseMLKit/app/src/main/java/edu/cs4730/firebasemlkit/common/CameraSource.java",
"license": "apache-2.0",
"size": 28406
} | [
"android.hardware.Camera",
"android.util.Log"
] | import android.hardware.Camera; import android.util.Log; | import android.hardware.*; import android.util.*; | [
"android.hardware",
"android.util"
] | android.hardware; android.util; | 898,926 |
@Test
public void testDeletePhysicalPages() throws Exception {
clearDataRecreateServerDirs();
Configuration config = createDefaultInVMConfig().setPersistDeliveryCountBeforeDelivery(true);
config.setJournalSyncNonTransactional(false);
server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX);
server.start();
final int numberOfMessages = 1000;
locator = createInVMNonHALocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true);
sf = createSessionFactory(locator);
ClientSession session = sf.createSession(false, false, false);
session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true);
ClientProducer producer = session.createProducer(PagingTest.ADDRESS);
ClientMessage message = null;
byte[] body = new byte[MESSAGE_SIZE];
ByteBuffer bb = ByteBuffer.wrap(body);
for (int j = 1; j <= MESSAGE_SIZE; j++) {
bb.put(getSamplebyte(j));
}
for (int i = 0; i < numberOfMessages; i++) {
message = session.createMessage(true);
ActiveMQBuffer bodyLocal = message.getBodyBuffer();
bodyLocal.writeBytes(body);
message.putIntProperty(new SimpleString("id"), i);
producer.send(message);
if (i % 1000 == 0) {
session.commit();
}
}
session.commit();
session.close();
session = null;
sf.close();
locator.close();
server.stop();
server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX);
server.start();
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
Queue queue = server.locateQueue(ADDRESS);
assertEquals(numberOfMessages, getMessageCount(queue));
int msgReceived = 0;
ClientSession sessionConsumer = sf.createSession(false, false, false);
sessionConsumer.start();
ClientConsumer consumer = sessionConsumer.createConsumer(PagingTest.ADDRESS);
for (int msgCount = 0; msgCount < numberOfMessages; msgCount++) {
log.info("Received " + msgCount);
msgReceived++;
ClientMessage msg = consumer.receiveImmediate();
if (msg == null) {
log.info("It's null. leaving now");
sessionConsumer.commit();
fail("Didn't receive a message");
}
msg.acknowledge();
if (msgCount % 5 == 0) {
log.info("commit");
sessionConsumer.commit();
}
}
sessionConsumer.commit();
sessionConsumer.close();
sf.close();
locator.close();
assertEquals(0, getMessageCount(queue));
long timeout = System.currentTimeMillis() + 5000;
while (timeout > System.currentTimeMillis() && queue.getPageSubscription().getPagingStore().isPaging()) {
Thread.sleep(100);
}
assertFalse(queue.getPageSubscription().getPagingStore().isPaging());
server.stop();
// Deleting the paging data. Simulating a failure
// a dumb user, or anything that will remove the data
deleteDirectory(new File(getPageDir()));
server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX);
server.start();
locator = createInVMNonHALocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true);
sf = createSessionFactory(locator);
queue = server.locateQueue(ADDRESS);
sf = createSessionFactory(locator);
session = sf.createSession(false, false, false);
producer = session.createProducer(PagingTest.ADDRESS);
for (int i = 0; i < numberOfMessages * 2; i++) {
message = session.createMessage(true);
ActiveMQBuffer bodyLocal = message.getBodyBuffer();
bodyLocal.writeBytes(body);
message.putIntProperty(new SimpleString("theid"), i);
producer.send(message);
if (i % 1000 == 0) {
session.commit();
}
}
session.commit();
server.stop();
server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX);
server.start();
locator = createInVMNonHALocator();
sf = createSessionFactory(locator);
queue = server.locateQueue(ADDRESS);
// assertEquals(numberOfMessages, getMessageCount(queue));
msgReceived = 0;
sessionConsumer = sf.createSession(false, false, false);
sessionConsumer.start();
consumer = sessionConsumer.createConsumer(PagingTest.ADDRESS);
for (int msgCount = 0; msgCount < numberOfMessages; msgCount++) {
log.info("Received " + msgCount);
msgReceived++;
ClientMessage msg = consumer.receive(5000);
if (msg == null) {
log.info("It's null. leaving now");
sessionConsumer.commit();
fail("Didn't receive a message");
}
System.out.println("Message " + msg.getIntProperty(SimpleString.toSimpleString("theid")));
msg.acknowledge();
if (msgCount % 5 == 0) {
log.info("commit");
sessionConsumer.commit();
}
}
sessionConsumer.commit();
sessionConsumer.close();
} | void function() throws Exception { clearDataRecreateServerDirs(); Configuration config = createDefaultInVMConfig().setPersistDeliveryCountBeforeDelivery(true); config.setJournalSyncNonTransactional(false); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX); server.start(); final int numberOfMessages = 1000; locator = createInVMNonHALocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true); sf = createSessionFactory(locator); ClientSession session = sf.createSession(false, false, false); session.createQueue(PagingTest.ADDRESS, PagingTest.ADDRESS, null, true); ClientProducer producer = session.createProducer(PagingTest.ADDRESS); ClientMessage message = null; byte[] body = new byte[MESSAGE_SIZE]; ByteBuffer bb = ByteBuffer.wrap(body); for (int j = 1; j <= MESSAGE_SIZE; j++) { bb.put(getSamplebyte(j)); } for (int i = 0; i < numberOfMessages; i++) { message = session.createMessage(true); ActiveMQBuffer bodyLocal = message.getBodyBuffer(); bodyLocal.writeBytes(body); message.putIntProperty(new SimpleString("id"), i); producer.send(message); if (i % 1000 == 0) { session.commit(); } } session.commit(); session.close(); session = null; sf.close(); locator.close(); server.stop(); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX); server.start(); locator = createInVMNonHALocator(); sf = createSessionFactory(locator); Queue queue = server.locateQueue(ADDRESS); assertEquals(numberOfMessages, getMessageCount(queue)); int msgReceived = 0; ClientSession sessionConsumer = sf.createSession(false, false, false); sessionConsumer.start(); ClientConsumer consumer = sessionConsumer.createConsumer(PagingTest.ADDRESS); for (int msgCount = 0; msgCount < numberOfMessages; msgCount++) { log.info(STR + msgCount); msgReceived++; ClientMessage msg = consumer.receiveImmediate(); if (msg == null) { log.info(STR); sessionConsumer.commit(); fail(STR); } msg.acknowledge(); if (msgCount % 5 == 0) { log.info(STR); sessionConsumer.commit(); } } sessionConsumer.commit(); sessionConsumer.close(); sf.close(); locator.close(); assertEquals(0, getMessageCount(queue)); long timeout = System.currentTimeMillis() + 5000; while (timeout > System.currentTimeMillis() && queue.getPageSubscription().getPagingStore().isPaging()) { Thread.sleep(100); } assertFalse(queue.getPageSubscription().getPagingStore().isPaging()); server.stop(); deleteDirectory(new File(getPageDir())); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX); server.start(); locator = createInVMNonHALocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true); sf = createSessionFactory(locator); queue = server.locateQueue(ADDRESS); sf = createSessionFactory(locator); session = sf.createSession(false, false, false); producer = session.createProducer(PagingTest.ADDRESS); for (int i = 0; i < numberOfMessages * 2; i++) { message = session.createMessage(true); ActiveMQBuffer bodyLocal = message.getBodyBuffer(); bodyLocal.writeBytes(body); message.putIntProperty(new SimpleString("theid"), i); producer.send(message); if (i % 1000 == 0) { session.commit(); } } session.commit(); server.stop(); server = createServer(true, config, PagingTest.PAGE_SIZE, PagingTest.PAGE_MAX); server.start(); locator = createInVMNonHALocator(); sf = createSessionFactory(locator); queue = server.locateQueue(ADDRESS); msgReceived = 0; sessionConsumer = sf.createSession(false, false, false); sessionConsumer.start(); consumer = sessionConsumer.createConsumer(PagingTest.ADDRESS); for (int msgCount = 0; msgCount < numberOfMessages; msgCount++) { log.info(STR + msgCount); msgReceived++; ClientMessage msg = consumer.receive(5000); if (msg == null) { log.info(STR); sessionConsumer.commit(); fail(STR); } System.out.println(STR + msg.getIntProperty(SimpleString.toSimpleString("theid"))); msg.acknowledge(); if (msgCount % 5 == 0) { log.info(STR); sessionConsumer.commit(); } } sessionConsumer.commit(); sessionConsumer.close(); } | /**
* This test will remove all the page directories during a restart, simulating a crash scenario. The server should still start after this
*/ | This test will remove all the page directories during a restart, simulating a crash scenario. The server should still start after this | testDeletePhysicalPages | {
"repo_name": "dejanb/activemq-artemis",
"path": "tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingTest.java",
"license": "apache-2.0",
"size": 177248
} | [
"java.io.File",
"java.nio.ByteBuffer",
"org.apache.activemq.artemis.api.core.ActiveMQBuffer",
"org.apache.activemq.artemis.api.core.SimpleString",
"org.apache.activemq.artemis.api.core.client.ClientConsumer",
"org.apache.activemq.artemis.api.core.client.ClientMessage",
"org.apache.activemq.artemis.api.core.client.ClientProducer",
"org.apache.activemq.artemis.api.core.client.ClientSession",
"org.apache.activemq.artemis.core.config.Configuration",
"org.apache.activemq.artemis.core.server.Queue"
] | import java.io.File; import java.nio.ByteBuffer; import org.apache.activemq.artemis.api.core.ActiveMQBuffer; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.client.ClientSession; import org.apache.activemq.artemis.core.config.Configuration; import org.apache.activemq.artemis.core.server.Queue; | import java.io.*; import java.nio.*; import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.api.core.client.*; import org.apache.activemq.artemis.core.config.*; import org.apache.activemq.artemis.core.server.*; | [
"java.io",
"java.nio",
"org.apache.activemq"
] | java.io; java.nio; org.apache.activemq; | 2,867,577 |
protected Collection<IOValCheckConvertor<?>> createDefaultConvertors() {
List<IOValCheckConvertor<?>> convertors = new LinkedList<IOValCheckConvertor<?>>();
convertors.add(new AssertValidConvertor());
convertors.add(new DateRangeConvertor());
convertors.add(new EmailConvertor());
convertors.add(new LengthConvertor());
convertors.add(new NotBlankConvertor());
convertors.add(new NotEmptyConvertor());
convertors.add(new NotNegativeConvertor());
convertors.add(new NotNullConvertor());
convertors.add(new TheNumberConvertor());
convertors.add(new NumberFormatConvertor());
convertors.add(new SizeConvertor());
convertors.add(new PropertyScriptConvertor());
convertors.add(new TextFormatConvertor());
convertors.add(new BeanScriptConvertor());
return convertors;
}
| Collection<IOValCheckConvertor<?>> function() { List<IOValCheckConvertor<?>> convertors = new LinkedList<IOValCheckConvertor<?>>(); convertors.add(new AssertValidConvertor()); convertors.add(new DateRangeConvertor()); convertors.add(new EmailConvertor()); convertors.add(new LengthConvertor()); convertors.add(new NotBlankConvertor()); convertors.add(new NotEmptyConvertor()); convertors.add(new NotNegativeConvertor()); convertors.add(new NotNullConvertor()); convertors.add(new TheNumberConvertor()); convertors.add(new NumberFormatConvertor()); convertors.add(new SizeConvertor()); convertors.add(new PropertyScriptConvertor()); convertors.add(new TextFormatConvertor()); convertors.add(new BeanScriptConvertor()); return convertors; } | /**
* create default convertors
*
* @return
*/ | create default convertors | createDefaultConvertors | {
"repo_name": "bradwoo8621/nest-old",
"path": "arcteryx-meta-beans/src/main/java/com/github/nest/arcteryx/meta/beans/internal/validators/oval/OValValidationConfigurationInitializer.java",
"license": "apache-2.0",
"size": 17032
} | [
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.AssertValidConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.BeanScriptConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.DateRangeConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.EmailConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.LengthConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotBlankConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotEmptyConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotNegativeConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotNullConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NumberFormatConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.PropertyScriptConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.SizeConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.TextFormatConvertor",
"com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.TheNumberConvertor",
"java.util.Collection",
"java.util.LinkedList",
"java.util.List"
] | import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.AssertValidConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.BeanScriptConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.DateRangeConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.EmailConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.LengthConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotBlankConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotEmptyConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotNegativeConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NotNullConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.NumberFormatConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.PropertyScriptConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.SizeConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.TextFormatConvertor; import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.TheNumberConvertor; import java.util.Collection; import java.util.LinkedList; import java.util.List; | import com.github.nest.arcteryx.meta.beans.internal.validators.oval.convertors.*; import java.util.*; | [
"com.github.nest",
"java.util"
] | com.github.nest; java.util; | 801,647 |
public static void join(GridWorker w) throws IgniteInterruptedCheckedException {
try {
if (w != null)
w.join();
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IgniteInterruptedCheckedException(e);
}
} | static void function(GridWorker w) throws IgniteInterruptedCheckedException { try { if (w != null) w.join(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IgniteInterruptedCheckedException(e); } } | /**
* Joins worker.
*
* @param w Worker.
* @throws IgniteInterruptedCheckedException Wrapped {@link InterruptedException}.
*/ | Joins worker | join | {
"repo_name": "pperalta/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 314980
} | [
"org.apache.ignite.internal.IgniteInterruptedCheckedException",
"org.apache.ignite.internal.util.worker.GridWorker"
] | import org.apache.ignite.internal.IgniteInterruptedCheckedException; import org.apache.ignite.internal.util.worker.GridWorker; | import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.worker.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,151,870 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object. | collectNewChildDescriptors | {
"repo_name": "EPiCS/soundgates",
"path": "software/editor/Soundgates.edit/src/soundgates/provider/EStringToEIntegerObjectItemProvider.java",
"license": "mit",
"size": 5437
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,721,697 |
@Test
@RequireAssertEnabled
public void testMergerRun() {
TestMergeOperation operation = new TestMergeOperation();
TestContainerMerger merger = new TestContainerMerger(collector, nodeEngine, operation);
merger.run();
assertTrue("Expected the merge operation to be invoked", operation.hasBeenInvoked);
assertTrue("Expected collected containers to be destroyed", collector.onDestroyHasBeenCalled);
} | void function() { TestMergeOperation operation = new TestMergeOperation(); TestContainerMerger merger = new TestContainerMerger(collector, nodeEngine, operation); merger.run(); assertTrue(STR, operation.hasBeenInvoked); assertTrue(STR, collector.onDestroyHasBeenCalled); } | /**
* Tests that the merger finished under normal conditions.
*/ | Tests that the merger finished under normal conditions | testMergerRun | {
"repo_name": "mdogan/hazelcast",
"path": "hazelcast/src/test/java/com/hazelcast/spi/impl/merge/AbstractContainerMergerTest.java",
"license": "apache-2.0",
"size": 6150
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,083,023 |
protected static String getClientString(SocketChannel channel) {
Socket socket = channel.socket();
return socket.getInetAddress().getHostName() + ":" + socket.getPort();
} | static String function(SocketChannel channel) { Socket socket = channel.socket(); return socket.getInetAddress().getHostName() + ":" + socket.getPort(); } | /**
* Determines a connection's hostname and port, then concatenates the two
* values, separated by a colon (:).
*
* @param channel Channel to get client information about.
*/ | Determines a connection's hostname and port, then concatenates the two values, separated by a colon (:) | getClientString | {
"repo_name": "CameronTolooee/galileo",
"path": "src/galileo/net/MessageRouter.java",
"license": "bsd-2-clause",
"size": 19491
} | [
"java.net.Socket",
"java.nio.channels.SocketChannel"
] | import java.net.Socket; import java.nio.channels.SocketChannel; | import java.net.*; import java.nio.channels.*; | [
"java.net",
"java.nio"
] | java.net; java.nio; | 1,289,084 |
public void connectToDevice(String macAddress) throws Exception {
if (connected) {
return;
}
BluetoothDevice device = bluetoothAdapter.
getRemoteDevice(macAddress);
Method m = device.getClass().getMethod("createRfcommSocket",
new Class[]{int.class});
sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
sock.connect();
in = sock.getInputStream();
byte[] buffer = new byte[50];
int read = 0;
// try {
// while (true) {
// read = in.read(buffer);
// connected = true;
// StringBuilder buf = new StringBuilder();
// for (int i = 0; i < read; i++) {
// int b = buffer[i] & 0xff;
// if (b < 0x10) {
// buf.append("0");
// }
// buf.append(Integer.toHexString(b)).append(" ");
// }
// Log.d("ZeeTest", "++++ Read "+ read +" bytes: "+ buf.toString());
// }
// } catch (IOException e) {}
} | void function(String macAddress) throws Exception { if (connected) { return; } BluetoothDevice device = bluetoothAdapter. getRemoteDevice(macAddress); Method m = device.getClass().getMethod(STR, new Class[]{int.class}); sock = (BluetoothSocket) m.invoke(device, Integer.valueOf(1)); sock.connect(); in = sock.getInputStream(); byte[] buffer = new byte[50]; int read = 0; } | /**
* Sends a request to pair with the selected device
*
* @param macAddress the mac address of the device to connect to
* @throws Exception
*/ | Sends a request to pair with the selected device | connectToDevice | {
"repo_name": "JKereliuk/BH2015",
"path": "app/src/main/java/com/charity/battle/fightforcharity/MainActivity.java",
"license": "gpl-2.0",
"size": 17670
} | [
"android.bluetooth.BluetoothDevice",
"android.bluetooth.BluetoothSocket",
"java.lang.reflect.Method"
] | import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import java.lang.reflect.Method; | import android.bluetooth.*; import java.lang.reflect.*; | [
"android.bluetooth",
"java.lang"
] | android.bluetooth; java.lang; | 1,894,145 |
private ContainerInfo createContainer()
throws IOException {
nodeManager.setChillmode(false);
ContainerWithPipeline containerWithPipeline = containerManager
.allocateContainer(xceiverClientManager.getType(),
xceiverClientManager.getFactor(), containerOwner);
ContainerInfo containerInfo = containerWithPipeline.getContainerInfo();
containerManager.updateContainerState(containerInfo.containerID(),
HddsProtos.LifeCycleEvent.CREATE);
containerManager.updateContainerState(containerInfo.containerID(),
HddsProtos.LifeCycleEvent.CREATED);
return containerInfo;
} | ContainerInfo function() throws IOException { nodeManager.setChillmode(false); ContainerWithPipeline containerWithPipeline = containerManager .allocateContainer(xceiverClientManager.getType(), xceiverClientManager.getFactor(), containerOwner); ContainerInfo containerInfo = containerWithPipeline.getContainerInfo(); containerManager.updateContainerState(containerInfo.containerID(), HddsProtos.LifeCycleEvent.CREATE); containerManager.updateContainerState(containerInfo.containerID(), HddsProtos.LifeCycleEvent.CREATED); return containerInfo; } | /**
* Creates a container with the given name in SCMContainerManager.
* @throws IOException
*/ | Creates a container with the given name in SCMContainerManager | createContainer | {
"repo_name": "ucare-uchicago/hadoop",
"path": "hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestSCMContainerManager.java",
"license": "apache-2.0",
"size": 14216
} | [
"java.io.IOException",
"org.apache.hadoop.hdds.protocol.proto.HddsProtos",
"org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline"
] | import java.io.IOException; import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline; | import java.io.*; import org.apache.hadoop.hdds.protocol.proto.*; import org.apache.hadoop.hdds.scm.container.common.helpers.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 228,376 |
private synchronized void sortTemplates() {
// Get the maximum length of a template ID.
maxTemplateIDLength = 0;
// Remove any null entries (should only happen because of
// IOExceptions, etc. when loading from files), and sort
// the remaining list.
for (Iterator<CodeTemplate> i=templates.iterator(); i.hasNext();) {
CodeTemplate temp = i.next();
if (temp==null || temp.getID()==null) {
i.remove();
}
else {
maxTemplateIDLength = Math.max(maxTemplateIDLength,
temp.getID().length());
}
}
Collections.sort(templates);
}
@SuppressWarnings("rawtypes")
private static class TemplateComparator implements Comparator, Serializable{
| synchronized void function() { maxTemplateIDLength = 0; for (Iterator<CodeTemplate> i=templates.iterator(); i.hasNext();) { CodeTemplate temp = i.next(); if (temp==null temp.getID()==null) { i.remove(); } else { maxTemplateIDLength = Math.max(maxTemplateIDLength, temp.getID().length()); } } Collections.sort(templates); } @SuppressWarnings(STR) private static class TemplateComparator implements Comparator, Serializable{ | /**
* Removes any null entries in the current set of templates (if
* any), sorts the remaining templates, and computes the new
* maximum template ID length.
*/ | Removes any null entries in the current set of templates (if any), sorts the remaining templates, and computes the new maximum template ID length | sortTemplates | {
"repo_name": "Thecarisma/powertext",
"path": "Power Text/src/com/power/text/ui/pteditor/CodeTemplateManager.java",
"license": "gpl-3.0",
"size": 11231
} | [
"com.power.text.pteditor.templates.CodeTemplate",
"java.io.Serializable",
"java.util.Collections",
"java.util.Comparator",
"java.util.Iterator"
] | import com.power.text.pteditor.templates.CodeTemplate; import java.io.Serializable; import java.util.Collections; import java.util.Comparator; import java.util.Iterator; | import com.power.text.pteditor.templates.*; import java.io.*; import java.util.*; | [
"com.power.text",
"java.io",
"java.util"
] | com.power.text; java.io; java.util; | 2,218,703 |
public void setFile( PDFileSpecification fs )
{
action.setItem( "F", fs );
} | void function( PDFileSpecification fs ) { action.setItem( "F", fs ); } | /**
* This will set the file in which the destination is located.
*
* @param fs The file specification.
*/ | This will set the file in which the destination is located | setFile | {
"repo_name": "myrridin/qz-print",
"path": "pdfbox_1.8.4_qz/src/org/apache/pdfbox/pdmodel/interactive/action/type/PDActionRemoteGoTo.java",
"license": "lgpl-2.1",
"size": 5231
} | [
"org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification"
] | import org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification; | import org.apache.pdfbox.pdmodel.common.filespecification.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 1,942,306 |
public static DesiredCapabilities retrieveCustomCapabilities(Class<? extends DefaultCapabilitiesBuilder> builder) {
logger.entering(builder);
DesiredCapabilities caps = new DesiredCapabilities();
if (builder != null && !builder.getName().equals(DefaultCapabilitiesBuilder.class.getName())) {
try {
caps = builder.newInstance().createCapabilities();
} catch (InstantiationException | IllegalAccessException e) {
throw new IllegalStateException("Unable to apply desired capabilities from " + builder.getName(), e);
}
}
logger.exiting(caps);
return caps;
} | static DesiredCapabilities function(Class<? extends DefaultCapabilitiesBuilder> builder) { logger.entering(builder); DesiredCapabilities caps = new DesiredCapabilities(); if (builder != null && !builder.getName().equals(DefaultCapabilitiesBuilder.class.getName())) { try { caps = builder.newInstance().createCapabilities(); } catch (InstantiationException IllegalAccessException e) { throw new IllegalStateException(STR + builder.getName(), e); } } logger.exiting(caps); return caps; } | /**
* Acquire capabilities from a {@link DefaultCapabilitiesBuilder} provider.
*
* @param builder
* the {@link DefaultCapabilitiesBuilder} provider to acquire capabilities from
* @return the {@link DesiredCapabilities} which came from the providers.
*/ | Acquire capabilities from a <code>DefaultCapabilitiesBuilder</code> provider | retrieveCustomCapabilities | {
"repo_name": "paypal/SeLion",
"path": "client/src/main/java/com/paypal/selion/internal/platform/grid/browsercapabilities/CapabilitiesHelper.java",
"license": "apache-2.0",
"size": 9946
} | [
"com.paypal.selion.platform.grid.browsercapabilities.DefaultCapabilitiesBuilder",
"org.openqa.selenium.remote.DesiredCapabilities"
] | import com.paypal.selion.platform.grid.browsercapabilities.DefaultCapabilitiesBuilder; import org.openqa.selenium.remote.DesiredCapabilities; | import com.paypal.selion.platform.grid.browsercapabilities.*; import org.openqa.selenium.remote.*; | [
"com.paypal.selion",
"org.openqa.selenium"
] | com.paypal.selion; org.openqa.selenium; | 337,793 |
@Override
public boolean isDescendent(final FileName descendent)
{
return isDescendent(descendent, NameScope.DESCENDENT);
} | boolean function(final FileName descendent) { return isDescendent(descendent, NameScope.DESCENDENT); } | /**
* Determines if another file name is a descendent of this file name.
* @param descendent The FileName to check.
* @return true if the FileName is a descendent, false otherwise.
*/ | Determines if another file name is a descendent of this file name | isDescendent | {
"repo_name": "distribuitech/datos",
"path": "datos-vfs/src/main/java/com/datos/vfs/provider/AbstractFileName.java",
"license": "apache-2.0",
"size": 15674
} | [
"com.datos.vfs.FileName",
"com.datos.vfs.NameScope"
] | import com.datos.vfs.FileName; import com.datos.vfs.NameScope; | import com.datos.vfs.*; | [
"com.datos.vfs"
] | com.datos.vfs; | 2,212,787 |
String firstWord = sql.substring(0, sql.indexOf(' '));
switch (firstWord.toUpperCase()) {
case "SELECT":
SQLQueryExpr sqlExpr = (SQLQueryExpr) SQLUtils.toMySqlExpr(sql);
Select select = new SqlParser().parseSelect(sqlExpr);
if (select.isAgg) {
return new AggregationQueryAction(client, select);
} else {
return new DefaultQueryAction(client, select);
}
case "DELETE":
SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, JdbcUtils.MYSQL);
SQLDeleteStatement deleteStatement = parser.parseDeleteStatement();
Delete delete = new SqlParser().parseDelete(deleteStatement);
return new DeleteQueryAction(client, delete);
default:
throw new SQLFeatureNotSupportedException(String.format("Unsupported query: %s", sql));
}
} | String firstWord = sql.substring(0, sql.indexOf(' ')); switch (firstWord.toUpperCase()) { case STR: SQLQueryExpr sqlExpr = (SQLQueryExpr) SQLUtils.toMySqlExpr(sql); Select select = new SqlParser().parseSelect(sqlExpr); if (select.isAgg) { return new AggregationQueryAction(client, select); } else { return new DefaultQueryAction(client, select); } case STR: SQLStatementParser parser = SQLParserUtils.createSQLStatementParser(sql, JdbcUtils.MYSQL); SQLDeleteStatement deleteStatement = parser.parseDeleteStatement(); Delete delete = new SqlParser().parseDelete(deleteStatement); return new DeleteQueryAction(client, delete); default: throw new SQLFeatureNotSupportedException(String.format(STR, sql)); } } | /**
* Create the compatible Query object
* based on the SQL query.
*
* @param sql The SQL query.
* @return Query object.
*/ | Create the compatible Query object based on the SQL query | create | {
"repo_name": "yangaoquan/elasticsearch-sql",
"path": "src/main/java/org/nlpcn/es4sql/query/ESActionFactory.java",
"license": "apache-2.0",
"size": 1648
} | [
"java.sql.SQLFeatureNotSupportedException",
"org.durid.sql.SQLUtils",
"org.durid.sql.ast.expr.SQLQueryExpr",
"org.durid.sql.ast.statement.SQLDeleteStatement",
"org.durid.sql.parser.SQLParserUtils",
"org.durid.sql.parser.SQLStatementParser",
"org.durid.util.JdbcUtils",
"org.nlpcn.es4sql.domain.Delete",
"org.nlpcn.es4sql.domain.Select",
"org.nlpcn.es4sql.parse.SqlParser"
] | import java.sql.SQLFeatureNotSupportedException; import org.durid.sql.SQLUtils; import org.durid.sql.ast.expr.SQLQueryExpr; import org.durid.sql.ast.statement.SQLDeleteStatement; import org.durid.sql.parser.SQLParserUtils; import org.durid.sql.parser.SQLStatementParser; import org.durid.util.JdbcUtils; import org.nlpcn.es4sql.domain.Delete; import org.nlpcn.es4sql.domain.Select; import org.nlpcn.es4sql.parse.SqlParser; | import java.sql.*; import org.durid.sql.*; import org.durid.sql.ast.expr.*; import org.durid.sql.ast.statement.*; import org.durid.sql.parser.*; import org.durid.util.*; import org.nlpcn.es4sql.domain.*; import org.nlpcn.es4sql.parse.*; | [
"java.sql",
"org.durid.sql",
"org.durid.util",
"org.nlpcn.es4sql"
] | java.sql; org.durid.sql; org.durid.util; org.nlpcn.es4sql; | 1,679,039 |
@VisibleForTesting
DataOutputStream getBufferedOutputStream() {
return new DataOutputStream(
new BufferedOutputStream(getOutputStream(), smallBufferSize));
} | DataOutputStream getBufferedOutputStream() { return new DataOutputStream( new BufferedOutputStream(getOutputStream(), smallBufferSize)); } | /**
* Separated for testing.
* @return
*/ | Separated for testing | getBufferedOutputStream | {
"repo_name": "Ethanlm/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataXceiver.java",
"license": "apache-2.0",
"size": 56490
} | [
"java.io.BufferedOutputStream",
"java.io.DataOutputStream"
] | import java.io.BufferedOutputStream; import java.io.DataOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,810,926 |
private Object createSoapHeader(AdManagerServiceDescriptor adsServiceDescriptor)
throws InstantiationException, IllegalAccessException, ClassNotFoundException {
return Class.forName(
adsServiceDescriptor.getInterfaceClass().getPackage().getName() + ".SoapRequestHeader")
.newInstance();
} | Object function(AdManagerServiceDescriptor adsServiceDescriptor) throws InstantiationException, IllegalAccessException, ClassNotFoundException { return Class.forName( adsServiceDescriptor.getInterfaceClass().getPackage().getName() + STR) .newInstance(); } | /**
* Creates a SOAP header.
*
* @param adsServiceDescriptor the ads service descriptor
* @return the instantiated SOAP header
* @throws ClassNotFoundException if the SOAP header class could not be found
* @throws IllegalAccessException if the SOAP header class could not be created
* @throws InstantiationException if the SOAP header class could not be created
*/ | Creates a SOAP header | createSoapHeader | {
"repo_name": "googleads/googleads-java-lib",
"path": "modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/AdManagerAxisHeaderHandler.java",
"license": "apache-2.0",
"size": 6635
} | [
"com.google.api.ads.admanager.lib.client.AdManagerServiceDescriptor"
] | import com.google.api.ads.admanager.lib.client.AdManagerServiceDescriptor; | import com.google.api.ads.admanager.lib.client.*; | [
"com.google.api"
] | com.google.api; | 2,389,102 |
@Override
public void load(Reader input) throws IOException, ParseException {
PushbackReader pushbackReader = new PushbackReader(input);
StreamTokenizer streamTokenizer = createConfiguredStreamTokenizer(pushbackReader);
parseNodeName(this, streamTokenizer);
//parse left child
parseChildNode(this, streamTokenizer, pushbackReader, true);
//examine right child
parseChildNode(this, streamTokenizer, pushbackReader, false);
} | void function(Reader input) throws IOException, ParseException { PushbackReader pushbackReader = new PushbackReader(input); StreamTokenizer streamTokenizer = createConfiguredStreamTokenizer(pushbackReader); parseNodeName(this, streamTokenizer); parseChildNode(this, streamTokenizer, pushbackReader, true); parseChildNode(this, streamTokenizer, pushbackReader, false); } | /**
* Parses the input from the specified reader. Wraps the reader to a
* {@link java.io.PushbackReader} to use its buffer for peeking ahead. Uses
* {@link java.io.StreamTokenizer} as a lexer. Uses static methods from
* {@link com.nng.tree.traversal.BinaryTreeInputParser} for the parsing.
*
* @param input the underlying reader
* @throws IOException if an I/O error occurs
* @throws ParseException if the input contains a syntax error
*/ | Parses the input from the specified reader. Wraps the reader to a <code>java.io.PushbackReader</code> to use its buffer for peeking ahead. Uses <code>java.io.StreamTokenizer</code> as a lexer. Uses static methods from <code>com.nng.tree.traversal.BinaryTreeInputParser</code> for the parsing | load | {
"repo_name": "dimuran/tree-traversal",
"path": "src/main/java/com/nng/tree/traversal/BinaryTreeNode.java",
"license": "gpl-3.0",
"size": 4947
} | [
"com.nng.tree.traversal.BinaryTreeInputParser",
"java.io.IOException",
"java.io.PushbackReader",
"java.io.Reader",
"java.io.StreamTokenizer",
"java.text.ParseException"
] | import com.nng.tree.traversal.BinaryTreeInputParser; import java.io.IOException; import java.io.PushbackReader; import java.io.Reader; import java.io.StreamTokenizer; import java.text.ParseException; | import com.nng.tree.traversal.*; import java.io.*; import java.text.*; | [
"com.nng.tree",
"java.io",
"java.text"
] | com.nng.tree; java.io; java.text; | 2,019,174 |
public void init(Properties properties) throws Exception; | void function(Properties properties) throws Exception; | /**
* Initializes data retriever module
*
* @param properties properties, that need to initialize the module. These properties can be
* defined in entitlement.properties file
* @throws Exception throws when initialization is failed
*/ | Initializes data retriever module | init | {
"repo_name": "wattale/carbon-identity",
"path": "components/identity/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/pap/EntitlementDataFinderModule.java",
"license": "apache-2.0",
"size": 4533
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,164,527 |
public ArrayList<OvhGenericProductDefinition> cart_cartId_ovhCloudConnect_GET(String cartId) throws IOException {
String qPath = "/order/cart/{cartId}/ovhCloudConnect";
StringBuilder sb = path(qPath, cartId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | ArrayList<OvhGenericProductDefinition> function(String cartId) throws IOException { String qPath = STR; StringBuilder sb = path(qPath, cartId); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); } | /**
* Get informations about OVHcloud Connect offers
*
* REST: GET /order/cart/{cartId}/ovhCloudConnect
* @param cartId [required] Cart identifier
*
* API beta
*/ | Get informations about OVHcloud Connect offers | cart_cartId_ovhCloudConnect_GET | {
"repo_name": "UrielCh/ovh-java-sdk",
"path": "ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java",
"license": "bsd-3-clause",
"size": 511080
} | [
"java.io.IOException",
"java.util.ArrayList",
"net.minidev.ovh.api.order.cart.OvhGenericProductDefinition"
] | import java.io.IOException; import java.util.ArrayList; import net.minidev.ovh.api.order.cart.OvhGenericProductDefinition; | import java.io.*; import java.util.*; import net.minidev.ovh.api.order.cart.*; | [
"java.io",
"java.util",
"net.minidev.ovh"
] | java.io; java.util; net.minidev.ovh; | 1,423,275 |
public boolean runAfter(List tasks, int size) {
return false;
}//end runAfter
}//end class SetGroupsTask | boolean function(List tasks, int size) { return false; } } | /** This method returns true if the current instance of this class
* must be run after at least one task in the input task list with
* an index less than the <code>size</code> parameter (size may be
* less than tasks.size()).
* <p>
* Note that using List.get will be more efficient than List.iterator.
*
* @param tasks the tasks to consider. A read-only List, with all
* elements being an instanceof Task.
* @param size elements with index less than size should be considered
*/ | This method returns true if the current instance of this class must be run after at least one task in the input task list with an index less than the <code>size</code> parameter (size may be less than tasks.size()). Note that using List.get will be more efficient than List.iterator | runAfter | {
"repo_name": "trasukg/river-qa-2.2",
"path": "src/com/sun/jini/fiddler/FiddlerImpl.java",
"license": "apache-2.0",
"size": 419323
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,605,605 |
private void computeJointPathLogProbability(
HashMap<DNCRPNode, Double> nodeLogProbs,
DNCRPNode curNode,
double parentLogProb) {
if (!isLeafNode(curNode)) {
double logprob = computeJointAssignmentLogProbability(curNode);
nodeLogProbs.put(curNode, parentLogProb + logprob);
for (DNCRPNode child : curNode.getChildren()) {
computeJointPathLogProbability(nodeLogProbs, child, parentLogProb + logprob);
}
}
} | void function( HashMap<DNCRPNode, Double> nodeLogProbs, DNCRPNode curNode, double parentLogProb) { if (!isLeafNode(curNode)) { double logprob = computeJointAssignmentLogProbability(curNode); nodeLogProbs.put(curNode, parentLogProb + logprob); for (DNCRPNode child : curNode.getChildren()) { computeJointPathLogProbability(nodeLogProbs, child, parentLogProb + logprob); } } } | /**
* Recursively compute the joint path log probabilities
*
* // TODO: this should be precomputed and updated as necessary
*
* @param nodeLogProbs Hash table to store the result. Set of keys are all
* internal nodes
* @param curNode The current node
* @param parentLogProb The log probability from the parent
*/ | Recursively compute the joint path log probabilities | computeJointPathLogProbability | {
"repo_name": "vietansegan/segan",
"path": "src/sampler/dynamic/DHLDASampler.java",
"license": "apache-2.0",
"size": 82530
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 775,323 |
public final void setImplicitMatch(boolean flag) {
checkState(isInterface());
isStructuralInterface = flag;
} | final void function(boolean flag) { checkState(isInterface()); isStructuralInterface = flag; } | /**
* sets the current interface type to support structural interface matching (abbr. SMI)
*
* @param flag indicates whether or not it should support SMI
*/ | sets the current interface type to support structural interface matching (abbr. SMI) | setImplicitMatch | {
"repo_name": "tiobe/closure-compiler",
"path": "src/com/google/javascript/rhino/jstype/FunctionType.java",
"license": "apache-2.0",
"size": 52311
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 611,179 |
public boolean isFull() {
if ((isFull == false) && this.diskSize >= IndexFileSystemConstants.DEFAULT_INDEX_SHARD_SIZE) {
isFull = true;
}
return isFull;
}
| boolean function() { if ((isFull == false) && this.diskSize >= IndexFileSystemConstants.DEFAULT_INDEX_SHARD_SIZE) { isFull = true; } return isFull; } | /**
* getter method for property isFull
*
* @return the isFull
*/ | getter method for property isFull | isFull | {
"repo_name": "lxqfirst/bi-platform",
"path": "tesseract/src/main/java/com/baidu/rigel/biplatform/tesseract/isservice/meta/IndexShard.java",
"license": "apache-2.0",
"size": 12487
} | [
"com.baidu.rigel.biplatform.tesseract.util.IndexFileSystemConstants"
] | import com.baidu.rigel.biplatform.tesseract.util.IndexFileSystemConstants; | import com.baidu.rigel.biplatform.tesseract.util.*; | [
"com.baidu.rigel"
] | com.baidu.rigel; | 1,794,775 |
public void appendAssignment(VariableReference var, ArrayReference array,
int index) {
ArrayIndex arrayIndex = new ArrayIndex(tc, array, index);
AssignmentStatement stmt = new AssignmentStatement(tc, var, arrayIndex);
tc.addStatement(stmt);
} | void function(VariableReference var, ArrayReference array, int index) { ArrayIndex arrayIndex = new ArrayIndex(tc, array, index); AssignmentStatement stmt = new AssignmentStatement(tc, var, arrayIndex); tc.addStatement(stmt); } | /**
* var := array[index]
*
* @param var
* @param array
* @param index
*/ | var := array[index] | appendAssignment | {
"repo_name": "SoftwareEngineeringToolDemos/FSE-2011-EvoSuite",
"path": "client/src/test/java/org/evosuite/symbolic/TestCaseBuilder.java",
"license": "lgpl-3.0",
"size": 8996
} | [
"org.evosuite.testcase.statements.AssignmentStatement",
"org.evosuite.testcase.variable.ArrayIndex",
"org.evosuite.testcase.variable.ArrayReference",
"org.evosuite.testcase.variable.VariableReference"
] | import org.evosuite.testcase.statements.AssignmentStatement; import org.evosuite.testcase.variable.ArrayIndex; import org.evosuite.testcase.variable.ArrayReference; import org.evosuite.testcase.variable.VariableReference; | import org.evosuite.testcase.statements.*; import org.evosuite.testcase.variable.*; | [
"org.evosuite.testcase"
] | org.evosuite.testcase; | 1,418,348 |
@DELETE
@Path("mappings/{macID}")
public Response deleteMapping(@PathParam("macID") String macID) {
ObjectNode root = mapper().createObjectNode();
if (!service.removeStaticMapping(MacAddress.valueOf(macID))) {
throw new IllegalArgumentException("Static Mapping Removal Failed.");
}
final Map<MacAddress, Ip4Address> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())
.put("ip", i.getValue().toString())));
return ok(root.toString()).build();
} | @Path(STR) Response function(@PathParam("macID") String macID) { ObjectNode root = mapper().createObjectNode(); if (!service.removeStaticMapping(MacAddress.valueOf(macID))) { throw new IllegalArgumentException(STR); } final Map<MacAddress, Ip4Address> intents = service.listMapping(); ArrayNode arrayNode = root.putArray(STR); intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode() .put("mac", i.getKey().toString()) .put("ip", i.getValue().toString()))); return ok(root.toString()).build(); } | /**
* Delete a static MAC/IP binding.
* Removes a static binding from the DHCP Server, and displays the current set of bindings.
*
* @return 200 OK
*/ | Delete a static MAC/IP binding. Removes a static binding from the DHCP Server, and displays the current set of bindings | deleteMapping | {
"repo_name": "chinghanyu/onos",
"path": "apps/dhcp/src/main/java/org/onosproject/dhcp/rest/DHCPWebResource.java",
"license": "apache-2.0",
"size": 5434
} | [
"com.fasterxml.jackson.databind.node.ArrayNode",
"com.fasterxml.jackson.databind.node.ObjectNode",
"java.util.Map",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.core.Response",
"org.onlab.packet.Ip4Address",
"org.onlab.packet.MacAddress"
] | import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import java.util.Map; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import org.onlab.packet.Ip4Address; import org.onlab.packet.MacAddress; | import com.fasterxml.jackson.databind.node.*; import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.onlab.packet.*; | [
"com.fasterxml.jackson",
"java.util",
"javax.ws",
"org.onlab.packet"
] | com.fasterxml.jackson; java.util; javax.ws; org.onlab.packet; | 1,203,791 |
protected String getJsonString(InputStream in) throws IOException,
JSONException {
BufferedReader streamReader =
new BufferedReader(new InputStreamReader(in, "UTF-8"));
StringBuilder responseStrBuilder = new StringBuilder();
String inputStr;
while ((inputStr = streamReader.readLine()) != null)
responseStrBuilder.append(inputStr);
String responseStr = responseStrBuilder.toString();
logger.debug("JSON={}", responseStr);
return responseStr;
}
| String function(InputStream in) throws IOException, JSONException { BufferedReader streamReader = new BufferedReader(new InputStreamReader(in, "UTF-8")); StringBuilder responseStrBuilder = new StringBuilder(); String inputStr; while ((inputStr = streamReader.readLine()) != null) responseStrBuilder.append(inputStr); String responseStr = responseStrBuilder.toString(); logger.debug(STR, responseStr); return responseStr; } | /**
* Converts the input stream into a JSON string. Useful for when processing
* a JSON feed.
*
* @param in
* @return the JSON string
* @throws IOException
* @throws JSONException
*/ | Converts the input stream into a JSON string. Useful for when processing a JSON feed | getJsonString | {
"repo_name": "scrudden/core",
"path": "transitime/src/main/java/org/transitime/avl/PollUrlAvlModule.java",
"license": "gpl-3.0",
"size": 9465
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"org.json.JSONException"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import org.json.JSONException; | import java.io.*; import org.json.*; | [
"java.io",
"org.json"
] | java.io; org.json; | 2,808,736 |
public TimeValue getDeleteTime() { return new TimeValue(deleteTimeInMillis); } | public TimeValue getDeleteTime() { return new TimeValue(deleteTimeInMillis); } | /**
* Gets the amount of time in a TimeValue that the index has been under merge throttling control
*/ | Gets the amount of time in a TimeValue that the index has been under merge throttling control | getThrottleTime | {
"repo_name": "qwerty4030/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/shard/IndexingStats.java",
"license": "apache-2.0",
"size": 10948
} | [
"org.elasticsearch.common.unit.TimeValue"
] | import org.elasticsearch.common.unit.TimeValue; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 438,833 |
private static Method getInheritableMethod(Class<?> cl, String name,
Class<?>[] argTypes,
Class<?> returnType)
{
Method meth = null;
Class<?> defCl = cl;
while (defCl != null) {
try {
meth = defCl.getDeclaredMethod(name, argTypes);
break;
} catch (NoSuchMethodException ex) {
defCl = defCl.getSuperclass();
}
}
if ((meth == null) || (meth.getReturnType() != returnType)) {
return null;
}
meth.setAccessible(true);
int mods = meth.getModifiers();
if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
return null;
} else if ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) {
return meth;
} else if ((mods & Modifier.PRIVATE) != 0) {
return (cl == defCl) ? meth : null;
} else {
return packageEquals(cl, defCl) ? meth : null;
}
} | static Method function(Class<?> cl, String name, Class<?>[] argTypes, Class<?> returnType) { Method meth = null; Class<?> defCl = cl; while (defCl != null) { try { meth = defCl.getDeclaredMethod(name, argTypes); break; } catch (NoSuchMethodException ex) { defCl = defCl.getSuperclass(); } } if ((meth == null) (meth.getReturnType() != returnType)) { return null; } meth.setAccessible(true); int mods = meth.getModifiers(); if ((mods & (Modifier.STATIC Modifier.ABSTRACT)) != 0) { return null; } else if ((mods & (Modifier.PUBLIC Modifier.PROTECTED)) != 0) { return meth; } else if ((mods & Modifier.PRIVATE) != 0) { return (cl == defCl) ? meth : null; } else { return packageEquals(cl, defCl) ? meth : null; } } | /**
* Returns non-static, non-abstract method with given signature provided it
* is defined by or accessible (via inheritance) by the given class, or
* null if no match found. Access checks are disabled on the returned
* method (if any).
*/ | Returns non-static, non-abstract method with given signature provided it is defined by or accessible (via inheritance) by the given class, or null if no match found. Access checks are disabled on the returned method (if any) | getInheritableMethod | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/share/classes/java/io/ObjectStreamClass.java",
"license": "mit",
"size": 86796
} | [
"java.lang.reflect.Method",
"java.lang.reflect.Modifier"
] | import java.lang.reflect.Method; import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 513,537 |
@Override public void filter(ContainerRequestContext request, ContainerResponseContext response)
throws IOException {
String sessionCookieName = sessionCookieConfig.getName();
// If the response will be setting a session cookie, don't overwrite it; just let it go.
if (response.getCookies().containsKey(sessionCookieName)) {
return;
}
// If the request doesn't have a session cookie, we're not going to renew one.
if (!request.getCookies().containsKey(sessionCookieName)) {
return;
}
Cookie requestCookie = request.getCookies().get(sessionCookieName);
Optional<User> optionalUser = authenticator.authenticate(requestCookie);
if (optionalUser.isPresent()) {
sessionLoginResource.cookiesForUser(optionalUser.get())
.forEach(c -> response.getHeaders().add(HttpHeaders.SET_COOKIE, c));
}
} | @Override void function(ContainerRequestContext request, ContainerResponseContext response) throws IOException { String sessionCookieName = sessionCookieConfig.getName(); if (response.getCookies().containsKey(sessionCookieName)) { return; } if (!request.getCookies().containsKey(sessionCookieName)) { return; } Cookie requestCookie = request.getCookies().get(sessionCookieName); Optional<User> optionalUser = authenticator.authenticate(requestCookie); if (optionalUser.isPresent()) { sessionLoginResource.cookiesForUser(optionalUser.get()) .forEach(c -> response.getHeaders().add(HttpHeaders.SET_COOKIE, c)); } } | /**
* If the user has a valid session token, set a new session token. The new one should have a later
* expiration time.
*/ | If the user has a valid session token, set a new session token. The new one should have a later expiration time | filter | {
"repo_name": "akshatknsl/keywhiz",
"path": "server/src/main/java/keywhiz/service/filters/CookieRenewingFilter.java",
"license": "apache-2.0",
"size": 2808
} | [
"com.google.common.net.HttpHeaders",
"java.io.IOException",
"java.util.Optional",
"javax.ws.rs.container.ContainerRequestContext",
"javax.ws.rs.container.ContainerResponseContext",
"javax.ws.rs.core.Cookie"
] | import com.google.common.net.HttpHeaders; import java.io.IOException; import java.util.Optional; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.core.Cookie; | import com.google.common.net.*; import java.io.*; import java.util.*; import javax.ws.rs.container.*; import javax.ws.rs.core.*; | [
"com.google.common",
"java.io",
"java.util",
"javax.ws"
] | com.google.common; java.io; java.util; javax.ws; | 918,293 |
@Override
protected void loadStatistics() {
statisticMap = Maps.newHashMap();
for (HLocale locale : getActiveLocales()) {
statisticMap.putAll(versionGroupServiceImpl.getLocaleStatistic(
getSlug(), locale.getLocaleId()));
}
overallStatistic = new WordStatistic();
for (Map.Entry<VersionLocaleKey, WordStatistic> entry : statisticMap
.entrySet()) {
overallStatistic.add(entry.getValue());
}
overallStatistic.setRemainingHours(StatisticsUtil
.getRemainingHours(overallStatistic));
} | void function() { statisticMap = Maps.newHashMap(); for (HLocale locale : getActiveLocales()) { statisticMap.putAll(versionGroupServiceImpl.getLocaleStatistic( getSlug(), locale.getLocaleId())); } overallStatistic = new WordStatistic(); for (Map.Entry<VersionLocaleKey, WordStatistic> entry : statisticMap .entrySet()) { overallStatistic.add(entry.getValue()); } overallStatistic.setRemainingHours(StatisticsUtil .getRemainingHours(overallStatistic)); } | /**
* Load up statistics for all project versions in all active locales in the
* group.
*/ | Load up statistics for all project versions in all active locales in the group | loadStatistics | {
"repo_name": "itsazzad/zanata-server",
"path": "zanata-war/src/main/java/org/zanata/action/VersionGroupHomeAction.java",
"license": "gpl-2.0",
"size": 20424
} | [
"com.google.common.collect.Maps",
"java.util.Map",
"org.zanata.model.HLocale",
"org.zanata.service.VersionLocaleKey",
"org.zanata.ui.model.statistic.WordStatistic",
"org.zanata.util.StatisticsUtil"
] | import com.google.common.collect.Maps; import java.util.Map; import org.zanata.model.HLocale; import org.zanata.service.VersionLocaleKey; import org.zanata.ui.model.statistic.WordStatistic; import org.zanata.util.StatisticsUtil; | import com.google.common.collect.*; import java.util.*; import org.zanata.model.*; import org.zanata.service.*; import org.zanata.ui.model.statistic.*; import org.zanata.util.*; | [
"com.google.common",
"java.util",
"org.zanata.model",
"org.zanata.service",
"org.zanata.ui",
"org.zanata.util"
] | com.google.common; java.util; org.zanata.model; org.zanata.service; org.zanata.ui; org.zanata.util; | 13,960 |
@Override
public void close() {
final Object[] toclose;
synchronized (components) {
toclose = components.toArray();
components.clear();
}
// Close all components
Stream.of(toclose).filter(component -> component instanceof VfsComponent)
.forEach(component -> ((VfsComponent) component).close());
} | void function() { final Object[] toclose; synchronized (components) { toclose = components.toArray(); components.clear(); } Stream.of(toclose).filter(component -> component instanceof VfsComponent) .forEach(component -> ((VfsComponent) component).close()); } | /**
* Closes the sub-components of this component.
*/ | Closes the sub-components of this component | close | {
"repo_name": "apache/commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractVfsContainer.java",
"license": "apache-2.0",
"size": 3078
} | [
"java.util.stream.Stream"
] | import java.util.stream.Stream; | import java.util.stream.*; | [
"java.util"
] | java.util; | 82,256 |
public static Color createColorFromString( String string )
{
if ( string == null || string.trim().isEmpty() )
{
return null;
}
string = string.startsWith( COLOR_PREFIX ) ? string.substring( 1 ) : string;
return new Color( Integer.parseInt( string, COLOR_RADIX ) );
} | static Color function( String string ) { if ( string == null string.trim().isEmpty() ) { return null; } string = string.startsWith( COLOR_PREFIX ) ? string.substring( 1 ) : string; return new Color( Integer.parseInt( string, COLOR_RADIX ) ); } | /**
* Creates a java.awt.Color from a dhis style color string, e.g. '#ff3200'
* is an orange color.
*
* @param string the color in string, e.g. '#ff3200'
* @return the Color, or null if string is null or empty.
*/ | Creates a java.awt.Color from a dhis style color string, e.g. '#ff3200' is an orange color | createColorFromString | {
"repo_name": "troyel/dhis2-core",
"path": "dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/mapgeneration/MapUtils.java",
"license": "bsd-3-clause",
"size": 10881
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,123,186 |
@WebMethod
@WebResult(name = "rval", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201509")
@RequestWrapper(localName = "query", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201509", className = "com.google.api.ads.adwords.jaxws.v201509.cm.BatchJobServiceInterfacequery")
@ResponseWrapper(localName = "queryResponse", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201509", className = "com.google.api.ads.adwords.jaxws.v201509.cm.BatchJobServiceInterfacequeryResponse")
public BatchJobPage query(
@WebParam(name = "query", targetNamespace = "https://adwords.google.com/api/adwords/cm/v201509")
String query)
throws ApiException_Exception
; | @WebResult(name = "rval", targetNamespace = STRquerySTRhttps: @ResponseWrapper(localName = "queryResponseSTRhttps: BatchJobPage function( @WebParam(name = "querySTRhttps: String query) throws ApiException_Exception ; | /**
*
* Returns the list of {@code BatchJob}s that match the query.
*
* @param query The SQL-like AWQL query string.
* @return The list of selected jobs.
* @throws ApiException if problems occur while parsing the query or fetching
* batchjob information.
*
*
* @param query
* @return
* returns com.google.api.ads.adwords.jaxws.v201509.cm.BatchJobPage
* @throws ApiException_Exception
*/ | Returns the list of BatchJobs that match the query | query | {
"repo_name": "gawkermedia/googleads-java-lib",
"path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201509/cm/BatchJobServiceInterface.java",
"license": "apache-2.0",
"size": 5360
} | [
"javax.jws.WebParam",
"javax.jws.WebResult",
"javax.xml.ws.ResponseWrapper"
] | import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper; | import javax.jws.*; import javax.xml.ws.*; | [
"javax.jws",
"javax.xml"
] | javax.jws; javax.xml; | 1,425,787 |
public Set<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return ObjectUtils.getAll( getCategoryCombos(), DataElementCategoryCombo::getOptionCombos );
} | Set<DataElementCategoryOptionCombo> function() { return ObjectUtils.getAll( getCategoryCombos(), DataElementCategoryCombo::getOptionCombos ); } | /**
* Returns the category option combinations of the resolved category
* combinations of this data element. The returned set is immutable, will
* never be null and will contain at least one item.
*/ | Returns the category option combinations of the resolved category combinations of this data element. The returned set is immutable, will never be null and will contain at least one item | getCategoryOptionCombos | {
"repo_name": "vmluan/dhis2-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java",
"license": "bsd-3-clause",
"size": 25206
} | [
"java.util.Set",
"org.hisp.dhis.util.ObjectUtils"
] | import java.util.Set; import org.hisp.dhis.util.ObjectUtils; | import java.util.*; import org.hisp.dhis.util.*; | [
"java.util",
"org.hisp.dhis"
] | java.util; org.hisp.dhis; | 1,192,051 |
public static void handleAlterTableForAvro(HiveConf conf, String serializationLib, Map<String, String> parameters) {
if (AvroSerDe.class.getName().equals(serializationLib)) {
String literalPropName = AvroTableProperties.SCHEMA_LITERAL.getPropName();
String urlPropName = AvroTableProperties.SCHEMA_URL.getPropName();
if (parameters.containsKey(literalPropName) || parameters.containsKey(urlPropName)) {
throw new RuntimeException("Not allowed to alter schema of Avro stored table having external schema." +
" Consider removing "+AvroTableProperties.SCHEMA_LITERAL.getPropName() + " or " +
AvroTableProperties.SCHEMA_URL.getPropName() + " from table properties.");
}
}
} | static void function(HiveConf conf, String serializationLib, Map<String, String> parameters) { if (AvroSerDe.class.getName().equals(serializationLib)) { String literalPropName = AvroTableProperties.SCHEMA_LITERAL.getPropName(); String urlPropName = AvroTableProperties.SCHEMA_URL.getPropName(); if (parameters.containsKey(literalPropName) parameters.containsKey(urlPropName)) { throw new RuntimeException(STR + STR+AvroTableProperties.SCHEMA_LITERAL.getPropName() + STR + AvroTableProperties.SCHEMA_URL.getPropName() + STR); } } } | /**
* Called on specific alter table events, removes schema url and schema literal from given tblproperties
* After the change, HMS solely will be responsible for handling the schema
*
* @param conf
* @param serializationLib
* @param parameters
*/ | Called on specific alter table events, removes schema url and schema literal from given tblproperties After the change, HMS solely will be responsible for handling the schema | handleAlterTableForAvro | {
"repo_name": "alanfgates/hive",
"path": "serde/src/java/org/apache/hadoop/hive/serde2/avro/AvroSerdeUtils.java",
"license": "apache-2.0",
"size": 13133
} | [
"java.net.URL",
"java.util.Map",
"org.apache.hadoop.hive.conf.HiveConf"
] | import java.net.URL; import java.util.Map; import org.apache.hadoop.hive.conf.HiveConf; | import java.net.*; import java.util.*; import org.apache.hadoop.hive.conf.*; | [
"java.net",
"java.util",
"org.apache.hadoop"
] | java.net; java.util; org.apache.hadoop; | 2,267,346 |
public static long getGCD(Collection<Long> collection) {
boolean first = true;
long currentGCD = 1;
Iterator<Long> i = collection.iterator();
while (i.hasNext()) {
long value = i.next();
if (first) {
currentGCD = value;
first = false;
} else {
currentGCD = getGCD(currentGCD, value);
}
}
return currentGCD;
}
| static long function(Collection<Long> collection) { boolean first = true; long currentGCD = 1; Iterator<Long> i = collection.iterator(); while (i.hasNext()) { long value = i.next(); if (first) { currentGCD = value; first = false; } else { currentGCD = getGCD(currentGCD, value); } } return currentGCD; } | /**
* Returns the greatest common divisor (GCD) of the given pair of values.
*/ | Returns the greatest common divisor (GCD) of the given pair of values | getGCD | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/tools/math/MathFunctions.java",
"license": "agpl-3.0",
"size": 11044
} | [
"java.util.Collection",
"java.util.Iterator"
] | import java.util.Collection; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,902,749 |
public void write(HoodieRecord record, Optional<IndexedRecord> insertValue) {
// NO_OP
} | void function(HoodieRecord record, Optional<IndexedRecord> insertValue) { } | /**
* Perform the actual writing of the given record into the backing file.
*/ | Perform the actual writing of the given record into the backing file | write | {
"repo_name": "vinothchandar/hoodie",
"path": "hoodie-client/src/main/java/com/uber/hoodie/io/HoodieIOHandle.java",
"license": "apache-2.0",
"size": 5811
} | [
"com.uber.hoodie.common.model.HoodieRecord",
"java.util.Optional",
"org.apache.avro.generic.IndexedRecord"
] | import com.uber.hoodie.common.model.HoodieRecord; import java.util.Optional; import org.apache.avro.generic.IndexedRecord; | import com.uber.hoodie.common.model.*; import java.util.*; import org.apache.avro.generic.*; | [
"com.uber.hoodie",
"java.util",
"org.apache.avro"
] | com.uber.hoodie; java.util; org.apache.avro; | 2,108,427 |
private void attemptRegistration() {
m_username.setError(null);
m_passwordView.setError(null);
String username = m_username.getText().toString();
String password = m_passwordView.getText().toString();
String passwordCheck = m_passwordCheckView.getText().toString();
boolean cancel = false;
View focusView = null;
if(!PasswordValidator.isPasswordValid(password)) {
m_passwordView.setError(getString(R.string.error_invalid_password));
focusView = m_passwordView;
cancel = true;
}
if(!password.equals(passwordCheck)) {
m_passwordCheckView.setError(getString(R.string.error_invalid_password_check));
focusView = m_passwordCheckView;
cancel = true;
}
if(TextUtils.isEmpty(username)) {
m_username.setError(getString(R.string.error_field_required));
focusView = m_username;
cancel = true;
} else if(!UsernameValidator.isUsernameValid(username)) {
m_username.setError(getString(R.string.error_invalid_username));
focusView = m_username;
cancel = true;
}
if(cancel) {
focusView.requestFocus();
} else {
try {
KeyValueDB.setUsername(m_context, username);
SaltHandler.setSalt(m_context);
KeyValueDB.setVerificationPasswordHash(m_context, LoginHashCreator.getLoginHash(m_context, password));
showProgress(true);
Intent intent = new Intent();
intent.setClassName(m_context, PACKAGE_NAME + "." + NOTES_ACTIVITY);
intent.putExtra(LoginActivity.KEY_PASSWORD, password);
startActivity(intent);
finish();
} catch (Exception e) {
Toast.makeText(getApplicationContext(), getString(R.string.error_cannot_save) + ". ", Toast.LENGTH_SHORT).show();
}
}
} | void function() { m_username.setError(null); m_passwordView.setError(null); String username = m_username.getText().toString(); String password = m_passwordView.getText().toString(); String passwordCheck = m_passwordCheckView.getText().toString(); boolean cancel = false; View focusView = null; if(!PasswordValidator.isPasswordValid(password)) { m_passwordView.setError(getString(R.string.error_invalid_password)); focusView = m_passwordView; cancel = true; } if(!password.equals(passwordCheck)) { m_passwordCheckView.setError(getString(R.string.error_invalid_password_check)); focusView = m_passwordCheckView; cancel = true; } if(TextUtils.isEmpty(username)) { m_username.setError(getString(R.string.error_field_required)); focusView = m_username; cancel = true; } else if(!UsernameValidator.isUsernameValid(username)) { m_username.setError(getString(R.string.error_invalid_username)); focusView = m_username; cancel = true; } if(cancel) { focusView.requestFocus(); } else { try { KeyValueDB.setUsername(m_context, username); SaltHandler.setSalt(m_context); KeyValueDB.setVerificationPasswordHash(m_context, LoginHashCreator.getLoginHash(m_context, password)); showProgress(true); Intent intent = new Intent(); intent.setClassName(m_context, PACKAGE_NAME + "." + NOTES_ACTIVITY); intent.putExtra(LoginActivity.KEY_PASSWORD, password); startActivity(intent); finish(); } catch (Exception e) { Toast.makeText(getApplicationContext(), getString(R.string.error_cannot_save) + STR, Toast.LENGTH_SHORT).show(); } } } | /**
* Attempts to sign in with the login form.
* If there are form errors, the errors are presented
* and no actual login attempt is made.
*/ | Attempts to sign in with the login form. If there are form errors, the errors are presented and no actual login attempt is made | attemptRegistration | {
"repo_name": "YoeriNijs/NoteBuddy",
"path": "app/src/main/java/nl/yoerinijs/nb/activities/SetupActivity.java",
"license": "gpl-3.0",
"size": 6285
} | [
"android.content.Intent",
"android.text.TextUtils",
"android.view.View",
"android.widget.Toast",
"nl.yoerinijs.nb.security.LoginHashCreator",
"nl.yoerinijs.nb.security.SaltHandler",
"nl.yoerinijs.nb.storage.KeyValueDB",
"nl.yoerinijs.nb.validators.PasswordValidator",
"nl.yoerinijs.nb.validators.UsernameValidator"
] | import android.content.Intent; import android.text.TextUtils; import android.view.View; import android.widget.Toast; import nl.yoerinijs.nb.security.LoginHashCreator; import nl.yoerinijs.nb.security.SaltHandler; import nl.yoerinijs.nb.storage.KeyValueDB; import nl.yoerinijs.nb.validators.PasswordValidator; import nl.yoerinijs.nb.validators.UsernameValidator; | import android.content.*; import android.text.*; import android.view.*; import android.widget.*; import nl.yoerinijs.nb.security.*; import nl.yoerinijs.nb.storage.*; import nl.yoerinijs.nb.validators.*; | [
"android.content",
"android.text",
"android.view",
"android.widget",
"nl.yoerinijs.nb"
] | android.content; android.text; android.view; android.widget; nl.yoerinijs.nb; | 731,228 |
public void revertOnClick(View view) {
mBaseFragment.revertOnClick(view);
} | void function(View view) { mBaseFragment.revertOnClick(view); } | /**
* hand over onClick events, defined in layout from Activity to Fragment
*/ | hand over onClick events, defined in layout from Activity to Fragment | revertOnClick | {
"repo_name": "DavisNT/ad-away",
"path": "AdAway/src/main/java/org/adaway/ui/BaseActivity.java",
"license": "gpl-3.0",
"size": 11421
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 479,722 |
private void createValidAndRemovedDataRestrictions(
AuditStrategy auditStrategy, String versionsMiddleEntityName,
QueryBuilder remQb, MiddleComponentData... componentData) {
final Parameters disjoint = remQb.getRootParameters().addSubParameters( "or" );
// Restrictions to match all valid rows.
final Parameters valid = disjoint.addSubParameters( "and" );
// Restrictions to match all rows deleted at exactly given revision.
final Parameters removed = disjoint.addSubParameters( "and" );
createValidDataRestrictions( auditStrategy, versionsMiddleEntityName, remQb, valid, componentData );
// ee.revision = :revision
removed.addWhereWithNamedParam( verEntCfg.getRevisionNumberPath(), "=", REVISION_PARAMETER );
// ee.revision_type = DEL
removed.addWhereWithNamedParam( getRevisionTypePath(), "=", DEL_REVISION_TYPE_PARAMETER );
} | void function( AuditStrategy auditStrategy, String versionsMiddleEntityName, QueryBuilder remQb, MiddleComponentData... componentData) { final Parameters disjoint = remQb.getRootParameters().addSubParameters( "or" ); final Parameters valid = disjoint.addSubParameters( "and" ); final Parameters removed = disjoint.addSubParameters( "and" ); createValidDataRestrictions( auditStrategy, versionsMiddleEntityName, remQb, valid, componentData ); removed.addWhereWithNamedParam( verEntCfg.getRevisionNumberPath(), "=", REVISION_PARAMETER ); removed.addWhereWithNamedParam( getRevisionTypePath(), "=", DEL_REVISION_TYPE_PARAMETER ); } | /**
* Create query restrictions used to retrieve actual data and deletions that took place at exactly given revision.
*/ | Create query restrictions used to retrieve actual data and deletions that took place at exactly given revision | createValidAndRemovedDataRestrictions | {
"repo_name": "1fechner/FeatureExtractor",
"path": "sources/FeatureExtractor/lib/hibernate-release-5.1.0.Final/project/hibernate-envers/src/main/java/org/hibernate/envers/internal/entities/mapper/relation/query/TwoEntityOneAuditedQueryGenerator.java",
"license": "lgpl-2.1",
"size": 6662
} | [
"org.hibernate.envers.internal.entities.mapper.relation.MiddleComponentData",
"org.hibernate.envers.internal.tools.query.Parameters",
"org.hibernate.envers.internal.tools.query.QueryBuilder",
"org.hibernate.envers.strategy.AuditStrategy"
] | import org.hibernate.envers.internal.entities.mapper.relation.MiddleComponentData; import org.hibernate.envers.internal.tools.query.Parameters; import org.hibernate.envers.internal.tools.query.QueryBuilder; import org.hibernate.envers.strategy.AuditStrategy; | import org.hibernate.envers.internal.entities.mapper.relation.*; import org.hibernate.envers.internal.tools.query.*; import org.hibernate.envers.strategy.*; | [
"org.hibernate.envers"
] | org.hibernate.envers; | 1,481,779 |
protected void hideTabs() {
if (getPageCount() <= 1) {
setPageText(0, "");
if (getContainer() instanceof CTabFolder) {
((CTabFolder)getContainer()).setTabHeight(1);
Point point = getContainer().getSize();
getContainer().setSize(point.x, point.y + 6);
}
}
} | void function() { if (getPageCount() <= 1) { setPageText(0, ""); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(1); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y + 6); } } } | /**
* If there is just one page in the multi-page editor part,
* this hides the single tab at the bottom.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | If there is just one page in the multi-page editor part, this hides the single tab at the bottom. | hideTabs | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.editor/src/net/opengis/citygml/building/presentation/BuildingEditor.java",
"license": "apache-2.0",
"size": 56379
} | [
"org.eclipse.swt.custom.CTabFolder",
"org.eclipse.swt.graphics.Point"
] | import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.graphics.Point; | import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 382,394 |
public final java.awt.Color getBackgroundColor()
{
// don't worry - we've remembered it.
return _backgroundColor;
}
| final java.awt.Color function() { return _backgroundColor; } | /**
* get the current background colour
*/ | get the current background colour | getBackgroundColor | {
"repo_name": "alastrina123/debrief",
"path": "org.mwc.cmap.core/src/org/mwc/cmap/core/ui_support/swt/SWTCanvasAdapter.java",
"license": "epl-1.0",
"size": 38274
} | [
"org.eclipse.swt.graphics.Color"
] | import org.eclipse.swt.graphics.Color; | import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,191,313 |
public void startDrag(View v, Bitmap bmp, DragSource source, ItemInfo dragInfo,
Rect viewImageBounds, float initialDragViewScale, DragOptions options) {
int[] loc = mCoordinatesTemp;
mLauncher.getDragLayer().getLocationInDragLayer(v, loc);
int dragLayerX = loc[0] + viewImageBounds.left
+ (int) ((initialDragViewScale * bmp.getWidth() - bmp.getWidth()) / 2);
int dragLayerY = loc[1] + viewImageBounds.top
+ (int) ((initialDragViewScale * bmp.getHeight() - bmp.getHeight()) / 2);
startDrag(bmp, dragLayerX, dragLayerY, source, dragInfo, null,
null, initialDragViewScale, options);
} | void function(View v, Bitmap bmp, DragSource source, ItemInfo dragInfo, Rect viewImageBounds, float initialDragViewScale, DragOptions options) { int[] loc = mCoordinatesTemp; mLauncher.getDragLayer().getLocationInDragLayer(v, loc); int dragLayerX = loc[0] + viewImageBounds.left + (int) ((initialDragViewScale * bmp.getWidth() - bmp.getWidth()) / 2); int dragLayerY = loc[1] + viewImageBounds.top + (int) ((initialDragViewScale * bmp.getHeight() - bmp.getHeight()) / 2); startDrag(bmp, dragLayerX, dragLayerY, source, dragInfo, null, null, initialDragViewScale, options); } | /**
* Starts a drag.
*
* @param v The view that is being dragged
* @param bmp The bitmap that represents the view being dragged
* @param source An object representing where the drag originated
* @param dragInfo The data associated with the object that is being dragged
* @param viewImageBounds the position of the image inside the view
*/ | Starts a drag | startDrag | {
"repo_name": "YAJATapps/FlickLauncher",
"path": "src/com/android/launcher3/dragndrop/DragController.java",
"license": "apache-2.0",
"size": 30418
} | [
"android.graphics.Bitmap",
"android.graphics.Rect",
"android.view.View",
"com.android.launcher3.DragSource",
"com.android.launcher3.ItemInfo"
] | import android.graphics.Bitmap; import android.graphics.Rect; import android.view.View; import com.android.launcher3.DragSource; import com.android.launcher3.ItemInfo; | import android.graphics.*; import android.view.*; import com.android.launcher3.*; | [
"android.graphics",
"android.view",
"com.android.launcher3"
] | android.graphics; android.view; com.android.launcher3; | 501,391 |
DBSTypedObject getValueType(); | DBSTypedObject getValueType(); | /**
* Value type
* @return meta data
*/ | Value type | getValueType | {
"repo_name": "AndrewKhitrin/dbeaver",
"path": "plugins/org.jkiss.dbeaver.ui.editors.data/src/org/jkiss/dbeaver/ui/data/IValueController.java",
"license": "apache-2.0",
"size": 3400
} | [
"org.jkiss.dbeaver.model.struct.DBSTypedObject"
] | import org.jkiss.dbeaver.model.struct.DBSTypedObject; | import org.jkiss.dbeaver.model.struct.*; | [
"org.jkiss.dbeaver"
] | org.jkiss.dbeaver; | 2,718,662 |
public WriteConcern withWTimeout(final long wTimeout, final TimeUnit timeUnit) {
notNull("timeUnit", timeUnit);
long newWTimeOutMS = TimeUnit.MILLISECONDS.convert(wTimeout, timeUnit);
isTrueArgument("wTimeout >= 0", wTimeout >= 0);
isTrueArgument("wTimeout <= " + Integer.MAX_VALUE + " ms", newWTimeOutMS <= Integer.MAX_VALUE);
return new WriteConcern(w, (int) newWTimeOutMS, journal);
} | WriteConcern function(final long wTimeout, final TimeUnit timeUnit) { notNull(STR, timeUnit); long newWTimeOutMS = TimeUnit.MILLISECONDS.convert(wTimeout, timeUnit); isTrueArgument(STR, wTimeout >= 0); isTrueArgument(STR + Integer.MAX_VALUE + STR, newWTimeOutMS <= Integer.MAX_VALUE); return new WriteConcern(w, (int) newWTimeOutMS, journal); } | /**
* Constructs a new WriteConcern from the current one and the specified wTimeout in the given time unit.
*
* @param wTimeout the wTimeout, which must be >= 0 and <= Integer.MAX_VALUE after conversion to milliseconds
* @param timeUnit the non-null time unit to apply to wTimeout
* @return the WriteConcern with the given wTimeout
* @since 3.2
* @mongodb.driver.manual reference/write-concern/#wtimeout wtimeout option
*/ | Constructs a new WriteConcern from the current one and the specified wTimeout in the given time unit | withWTimeout | {
"repo_name": "rozza/mongo-java-driver",
"path": "driver-core/src/main/com/mongodb/WriteConcern.java",
"license": "apache-2.0",
"size": 15191
} | [
"com.mongodb.assertions.Assertions",
"java.util.concurrent.TimeUnit"
] | import com.mongodb.assertions.Assertions; import java.util.concurrent.TimeUnit; | import com.mongodb.assertions.*; import java.util.concurrent.*; | [
"com.mongodb.assertions",
"java.util"
] | com.mongodb.assertions; java.util; | 2,009,006 |
private void parseCNTQRYobjects(DRDAStatement stmt) throws DRDAProtocolException, SQLException
{
int codePoint;
do
{
correlationID = reader.readDssHeader();
while (reader.moreDssData())
{
codePoint = reader.readLengthAndCodePoint( false );
switch(codePoint)
{
// optional
case CodePoint.OUTOVR:
parseOUTOVR(stmt);
break;
default:
invalidCodePoint(codePoint);
}
}
} while (reader.isChainedWithSameID());
} | void function(DRDAStatement stmt) throws DRDAProtocolException, SQLException { int codePoint; do { correlationID = reader.readDssHeader(); while (reader.moreDssData()) { codePoint = reader.readLengthAndCodePoint( false ); switch(codePoint) { case CodePoint.OUTOVR: parseOUTOVR(stmt); break; default: invalidCodePoint(codePoint); } } } while (reader.isChainedWithSameID()); } | /**
* Parse CNTQRY objects
* Instance Variables
* OUTOVR - Output Override Descriptor - optional
*
* @param stmt DRDA statement we are working on
* @exception DRDAProtocolException
*/ | Parse CNTQRY objects Instance Variables OUTOVR - Output Override Descriptor - optional | parseCNTQRYobjects | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfirexd/core/src/drda/java/com/pivotal/gemfirexd/internal/impl/drda/DRDAConnThread.java",
"license": "apache-2.0",
"size": 357866
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,617,870 |
public Properties getConfiguration()
{
return this.configuration;
} | Properties function() { return this.configuration; } | /**
* Get Import Configuration
*
* @return configuration
*/ | Get Import Configuration | getConfiguration | {
"repo_name": "Alfresco/alfresco-repository",
"path": "src/main/java/org/alfresco/repo/importer/ImporterBootstrap.java",
"license": "lgpl-3.0",
"size": 24087
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 1,816,689 |
@Override
public void tightUnmarshal(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException {
super.tightUnmarshal(wireFormat, o, dataIn, bs);
XATransactionId info = (XATransactionId) o;
info.setFormatId(dataIn.readInt());
info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs));
info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs));
} | void function(OpenWireFormat wireFormat, Object o, DataInput dataIn, BooleanStream bs) throws IOException { super.tightUnmarshal(wireFormat, o, dataIn, bs); XATransactionId info = (XATransactionId) o; info.setFormatId(dataIn.readInt()); info.setGlobalTransactionId(tightUnmarshalByteArray(dataIn, bs)); info.setBranchQualifier(tightUnmarshalByteArray(dataIn, bs)); } | /**
* Un-marshal an object instance from the data input stream
*
* @param o
* the object to un-marshal
* @param dataIn
* the data input stream to build the object from
* @throws IOException
*/ | Un-marshal an object instance from the data input stream | tightUnmarshal | {
"repo_name": "apache/activemq-openwire",
"path": "openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v4/XATransactionIdMarshaller.java",
"license": "apache-2.0",
"size": 4725
} | [
"java.io.DataInput",
"java.io.IOException",
"org.apache.activemq.openwire.codec.BooleanStream",
"org.apache.activemq.openwire.codec.OpenWireFormat",
"org.apache.activemq.openwire.commands.XATransactionId"
] | import java.io.DataInput; import java.io.IOException; import org.apache.activemq.openwire.codec.BooleanStream; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.XATransactionId; | import java.io.*; import org.apache.activemq.openwire.codec.*; import org.apache.activemq.openwire.commands.*; | [
"java.io",
"org.apache.activemq"
] | java.io; org.apache.activemq; | 1,525,772 |
void refreshStoreFiles() throws IOException; | void refreshStoreFiles() throws IOException; | /**
* Checks the underlying store files, and opens the files that have not been opened, and removes
* the store file readers for store files no longer available. Mainly used by secondary region
* replicas to keep up to date with the primary region files.
* @throws IOException
*/ | Checks the underlying store files, and opens the files that have not been opened, and removes the store file readers for store files no longer available. Mainly used by secondary region replicas to keep up to date with the primary region files | refreshStoreFiles | {
"repo_name": "HubSpot/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java",
"license": "apache-2.0",
"size": 8320
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,571,622 |
public static String computeHash(Path file) throws IOException {
if (!Files.isRegularFile(file)) {
return null;
}
long size = Files.size(file);
long chunkSizeForFile = Math.min(HASH_CHUNK_SIZE, size);
try (FileChannel fileChannel = FileChannel.open(file)) {
long head = computeHashForChunk(fileChannel.map(MapMode.READ_ONLY, 0, chunkSizeForFile));
long tail = computeHashForChunk(fileChannel.map(MapMode.READ_ONLY, Math.max(size - HASH_CHUNK_SIZE, 0), chunkSizeForFile));
return String.format("%016x", size + head + tail);
}
} | static String function(Path file) throws IOException { if (!Files.isRegularFile(file)) { return null; } long size = Files.size(file); long chunkSizeForFile = Math.min(HASH_CHUNK_SIZE, size); try (FileChannel fileChannel = FileChannel.open(file)) { long head = computeHashForChunk(fileChannel.map(MapMode.READ_ONLY, 0, chunkSizeForFile)); long tail = computeHashForChunk(fileChannel.map(MapMode.READ_ONLY, Math.max(size - HASH_CHUNK_SIZE, 0), chunkSizeForFile)); return String.format("%016x", size + head + tail); } } | /**
* Calculates the <a href=
* "http://trac.opensubtitles.org/projects/opensubtitles/wiki/HashSourceCodes"
* >OpenSubtitles hash</a> for the specified {@link Path}.
*
* @param file the {@link Path} for which to calculate the hash.
* @return The calculated OpenSubtitles hash or {@code null}.
* @throws IOException If an I/O error occurs during the operation.
*/ | Calculates the OpenSubtitles hash for the specified <code>Path</code> | computeHash | {
"repo_name": "UniversalMediaServer/UniversalMediaServer",
"path": "src/main/java/net/pms/util/OpenSubtitle.java",
"license": "gpl-2.0",
"size": 140641
} | [
"java.io.IOException",
"java.nio.channels.FileChannel",
"java.nio.file.Files",
"java.nio.file.Path"
] | import java.io.IOException; import java.nio.channels.FileChannel; import java.nio.file.Files; import java.nio.file.Path; | import java.io.*; import java.nio.channels.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,475,299 |
// - XML methods ---------------------------------------------------------
// -----------------------------------------------------------------------
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
String buffer;
try {
if(!isInAssociation) {
if(qName.equals(ELEMENT_ASSOCIATION)) {
// Makes sure the required attributes are present.
if((buffer = attributes.getValue(ATTRIBUTE_COMMAND)) == null)
return;
isInAssociation = true;
builder.startAssociation(buffer);
}
}
else {
if(qName.equals(ELEMENT_MASK)) {
String caseSensitive;
if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null)
return;
if((caseSensitive = attributes.getValue(ATTRIBUTE_CASE_SENSITIVE)) != null)
builder.setMask(buffer, caseSensitive.equals(VALUE_TRUE));
else
builder.setMask(buffer, true);
}
else if(qName.equals(ELEMENT_IS_HIDDEN)) {
if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null)
return;
builder.setIsHidden(buffer.equals(VALUE_TRUE));
}
else if(qName.equals(ELEMENT_IS_SYMLINK)) {
if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null)
return;
builder.setIsSymlink(buffer.equals(VALUE_TRUE));
}
else if(qName.equals(ELEMENT_IS_READABLE)) {
if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null)
return;
builder.setIsReadable(buffer.equals(VALUE_TRUE));
}
else if(qName.equals(ELEMENT_IS_WRITABLE)) {
if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null)
return;
builder.setIsWritable(buffer.equals(VALUE_TRUE));
}
else if(qName.equals(ELEMENT_IS_EXECUTABLE)) {
if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null)
return;
builder.setIsExecutable(buffer.equals(VALUE_TRUE));
}
}
}
catch(CommandException e) {throw new SAXException(e);}
} | void function(String uri, String localName, String qName, Attributes attributes) throws SAXException { String buffer; try { if(!isInAssociation) { if(qName.equals(ELEMENT_ASSOCIATION)) { if((buffer = attributes.getValue(ATTRIBUTE_COMMAND)) == null) return; isInAssociation = true; builder.startAssociation(buffer); } } else { if(qName.equals(ELEMENT_MASK)) { String caseSensitive; if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null) return; if((caseSensitive = attributes.getValue(ATTRIBUTE_CASE_SENSITIVE)) != null) builder.setMask(buffer, caseSensitive.equals(VALUE_TRUE)); else builder.setMask(buffer, true); } else if(qName.equals(ELEMENT_IS_HIDDEN)) { if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null) return; builder.setIsHidden(buffer.equals(VALUE_TRUE)); } else if(qName.equals(ELEMENT_IS_SYMLINK)) { if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null) return; builder.setIsSymlink(buffer.equals(VALUE_TRUE)); } else if(qName.equals(ELEMENT_IS_READABLE)) { if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null) return; builder.setIsReadable(buffer.equals(VALUE_TRUE)); } else if(qName.equals(ELEMENT_IS_WRITABLE)) { if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null) return; builder.setIsWritable(buffer.equals(VALUE_TRUE)); } else if(qName.equals(ELEMENT_IS_EXECUTABLE)) { if((buffer = attributes.getValue(ATTRIBUTE_VALUE)) == null) return; builder.setIsExecutable(buffer.equals(VALUE_TRUE)); } } } catch(CommandException e) {throw new SAXException(e);} } | /**
* This method is public as an implementation side effect and should not be called directly.
*/ | This method is public as an implementation side effect and should not be called directly | startElement | {
"repo_name": "jorgevasquezp/mucommander",
"path": "src/main/com/mucommander/command/AssociationReader.java",
"license": "gpl-3.0",
"size": 7275
} | [
"org.xml.sax.Attributes",
"org.xml.sax.SAXException"
] | import org.xml.sax.Attributes; import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,496,405 |
private void runSimulationPlayer()
{
int nbCardInBoard = Statistics.NUMBER_CARDS_FLOP;
do
{
for(Player player:players)
{
if (!player.isFolded())
{
Statistics.getFlopTurnRiverValues(player, player.getPocket(), futureBoard, getNbPlayers(), nbCardInBoard);
}
}
} while(++nbCardInBoard <= Statistics.NUMBER_CARDS_RIVER);
}
| void function() { int nbCardInBoard = Statistics.NUMBER_CARDS_FLOP; do { for(Player player:players) { if (!player.isFolded()) { Statistics.getFlopTurnRiverValues(player, player.getPocket(), futureBoard, getNbPlayers(), nbCardInBoard); } } } while(++nbCardInBoard <= Statistics.NUMBER_CARDS_RIVER); } | /**
* Run the simulation FLOP, TURN, RIVER for all the player who aren't fold
*/ | Run the simulation FLOP, TURN, RIVER for all the player who aren't fold | runSimulationPlayer | {
"repo_name": "awph/PokerFace",
"path": "PokerFace/src/ch/hearc/pokerface/gameengine/gamecore/GameEngine.java",
"license": "mit",
"size": 25734
} | [
"ch.hearc.pokerface.gameengine.player.Player",
"ch.hearc.pokerface.gameengine.statistics.Statistics"
] | import ch.hearc.pokerface.gameengine.player.Player; import ch.hearc.pokerface.gameengine.statistics.Statistics; | import ch.hearc.pokerface.gameengine.player.*; import ch.hearc.pokerface.gameengine.statistics.*; | [
"ch.hearc.pokerface"
] | ch.hearc.pokerface; | 2,623,544 |
public int start() {
// If already starting or running, then just return
if ((this.status == ProximitySensorListener.RUNNING) || (this.status == ProximitySensorListener.STARTING)) {
return this.status;
}
// Get proximity sensor from sensor manager
@SuppressWarnings("deprecation")
List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_PROXIMITY);
if (this.pmWakeLock != null && !this.pmWakeLock.isHeld()) {
this.pmWakeLock.acquire();
}
// If found, then register as listener
if (list != null && list.size() > 0) {
this.mSensor = list.get(0);
this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL);
this.lastAccessTime = System.currentTimeMillis();
this.setStatus(ProximitySensorListener.STARTING);
}
// If error, then set status to error
else {
this.setStatus(ProximitySensorListener.ERROR_FAILED_TO_START);
}
return this.status;
} | int function() { if ((this.status == ProximitySensorListener.RUNNING) (this.status == ProximitySensorListener.STARTING)) { return this.status; } @SuppressWarnings(STR) List<Sensor> list = this.sensorManager.getSensorList(Sensor.TYPE_PROXIMITY); if (this.pmWakeLock != null && !this.pmWakeLock.isHeld()) { this.pmWakeLock.acquire(); } if (list != null && list.size() > 0) { this.mSensor = list.get(0); this.sensorManager.registerListener(this, this.mSensor, SensorManager.SENSOR_DELAY_NORMAL); this.lastAccessTime = System.currentTimeMillis(); this.setStatus(ProximitySensorListener.STARTING); } else { this.setStatus(ProximitySensorListener.ERROR_FAILED_TO_START); } return this.status; } | /**
* Start listening for compass sensor.
*
* @return status of listener
*/ | Start listening for compass sensor | start | {
"repo_name": "awoken-well/cordova-plugin-proximity",
"path": "src/android/ProximitySensorListener.java",
"license": "apache-2.0",
"size": 9351
} | [
"android.hardware.Sensor",
"android.hardware.SensorManager",
"java.util.List"
] | import android.hardware.Sensor; import android.hardware.SensorManager; import java.util.List; | import android.hardware.*; import java.util.*; | [
"android.hardware",
"java.util"
] | android.hardware; java.util; | 1,683,001 |
public Collection<T> lowerDescendants( BitSet key );
// These methods assume that a node is known, by value or key, and will navigate the precomputed structure | Collection<T> function( BitSet key ); | /**
* Returns all elements whose code is a descendant of key
* @param key
* @return
*/ | Returns all elements whose code is a descendant of key | lowerDescendants | {
"repo_name": "Buble1981/MyDroolsFork",
"path": "drools-core/src/main/java/org/drools/core/util/AbstractCodedHierarchy.java",
"license": "apache-2.0",
"size": 2465
} | [
"java.util.BitSet",
"java.util.Collection"
] | import java.util.BitSet; import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,387,592 |
public void readPacketData(PacketBuffer buf) throws IOException
{
this.status = (C16PacketClientStatus.EnumState)buf.readEnumValue(C16PacketClientStatus.EnumState.class);
} | void function(PacketBuffer buf) throws IOException { this.status = (C16PacketClientStatus.EnumState)buf.readEnumValue(C16PacketClientStatus.EnumState.class); } | /**
* Reads the raw packet data from the data stream.
*/ | Reads the raw packet data from the data stream | readPacketData | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/network/play/client/C16PacketClientStatus.java",
"license": "mit",
"size": 1390
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 775,214 |
protected void combineMethods(Map<String, Object> root, ClassDoc currentClassDoc)
{
Map<String, List<MethodDoc>> methodsByName = new HashMap<String, List<MethodDoc>>();
Map<String, List<MethodDoc>> staticMethodsByName = new HashMap<String, List<MethodDoc>>();
combineMethods2(methodsByName, staticMethodsByName, currentClassDoc, false);
List<MethodDoc> methodDocs = new ArrayList<MethodDoc>();
for (List<MethodDoc> l : methodsByName.values()) {
methodDocs.addAll(l);
}
Collections.sort(methodDocs, NameComparator.instance);
List<MethodDoc> staticMethodDocs = new ArrayList<MethodDoc>();
for (List<MethodDoc> l : staticMethodsByName.values()) {
staticMethodDocs.addAll(l);
}
Collections.sort(staticMethodDocs, NameComparator.instance);
root.put("methods", methodDocs);
root.put("staticMethods", staticMethodDocs);
} | void function(Map<String, Object> root, ClassDoc currentClassDoc) { Map<String, List<MethodDoc>> methodsByName = new HashMap<String, List<MethodDoc>>(); Map<String, List<MethodDoc>> staticMethodsByName = new HashMap<String, List<MethodDoc>>(); combineMethods2(methodsByName, staticMethodsByName, currentClassDoc, false); List<MethodDoc> methodDocs = new ArrayList<MethodDoc>(); for (List<MethodDoc> l : methodsByName.values()) { methodDocs.addAll(l); } Collections.sort(methodDocs, NameComparator.instance); List<MethodDoc> staticMethodDocs = new ArrayList<MethodDoc>(); for (List<MethodDoc> l : staticMethodsByName.values()) { staticMethodDocs.addAll(l); } Collections.sort(staticMethodDocs, NameComparator.instance); root.put(STR, methodDocs); root.put(STR, staticMethodDocs); } | /**
* Combines the methods from a class with those from its super classes (except Object).
*
* @param classDoc
* , the sub-class which has all of its methods combined into a list. Not null.
*
* @return A list of MethodDocs sorted by their name.
*
* Methods that are overridden should NOT be duplicated. Will be empty if the class, nor its super classes
* (excluding Object) have methods.
* @priority 3
*/ | Combines the methods from a class with those from its super classes (except Object) | combineMethods | {
"repo_name": "nickthecoder/prioritydoc",
"path": "src/main/java/uk/co/nickthecoder/prioritydoc/Generator.java",
"license": "gpl-3.0",
"size": 25267
} | [
"com.sun.javadoc.ClassDoc",
"com.sun.javadoc.MethodDoc",
"java.util.ArrayList",
"java.util.Collections",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import com.sun.javadoc.ClassDoc; import com.sun.javadoc.MethodDoc; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; | import com.sun.javadoc.*; import java.util.*; | [
"com.sun.javadoc",
"java.util"
] | com.sun.javadoc; java.util; | 2,223,404 |
final String convertTransform(TransformStackElement transformElement){
StringBuffer transformString = new StringBuffer();
double[] transformParameters = transformElement.getTransformParameters();
switch(transformElement.getType().toInt()){
case TransformType.TRANSFORM_TRANSLATE:
if(!transformElement.isIdentity()) {
transformString.append(TRANSFORM_TRANSLATE);
transformString.append(OPEN_PARENTHESIS);
transformString.append(doubleString(transformParameters[0]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[1]));
transformString.append(CLOSE_PARENTHESIS);
}
break;
case TransformType.TRANSFORM_ROTATE:
if(!transformElement.isIdentity()) {
transformString.append(TRANSFORM_ROTATE);
transformString.append(OPEN_PARENTHESIS);
transformString.append(doubleString(radiansToDegrees*transformParameters[0]));
transformString.append(CLOSE_PARENTHESIS);
}
break;
case TransformType.TRANSFORM_SCALE:
if(!transformElement.isIdentity()) {
transformString.append(TRANSFORM_SCALE);
transformString.append(OPEN_PARENTHESIS);
transformString.append(doubleString(transformParameters[0]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[1]));
transformString.append(CLOSE_PARENTHESIS);
}
break;
case TransformType.TRANSFORM_SHEAR:
if(!transformElement.isIdentity()) {
transformString.append(TRANSFORM_MATRIX);
transformString.append(OPEN_PARENTHESIS);
transformString.append(1);
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[1]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[0]));
transformString.append(COMMA);
transformString.append(1);
transformString.append(COMMA);
transformString.append(0);
transformString.append(COMMA);
transformString.append(0);
transformString.append(CLOSE_PARENTHESIS);
}
break;
case TransformType.TRANSFORM_GENERAL:
if(!transformElement.isIdentity()) {
transformString.append(TRANSFORM_MATRIX);
transformString.append(OPEN_PARENTHESIS);
transformString.append(doubleString(transformParameters[0]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[1]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[2]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[3]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[4]));
transformString.append(COMMA);
transformString.append(doubleString(transformParameters[5]));
transformString.append(CLOSE_PARENTHESIS);
}
break;
default:
// This should never happen. If it does, there is a
// serious error.
throw new RuntimeException();
}
return transformString.toString();
} | final String convertTransform(TransformStackElement transformElement){ StringBuffer transformString = new StringBuffer(); double[] transformParameters = transformElement.getTransformParameters(); switch(transformElement.getType().toInt()){ case TransformType.TRANSFORM_TRANSLATE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_TRANSLATE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_ROTATE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_ROTATE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(radiansToDegrees*transformParameters[0])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_SCALE: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_SCALE); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_SHEAR: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_MATRIX); transformString.append(OPEN_PARENTHESIS); transformString.append(1); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(1); transformString.append(COMMA); transformString.append(0); transformString.append(COMMA); transformString.append(0); transformString.append(CLOSE_PARENTHESIS); } break; case TransformType.TRANSFORM_GENERAL: if(!transformElement.isIdentity()) { transformString.append(TRANSFORM_MATRIX); transformString.append(OPEN_PARENTHESIS); transformString.append(doubleString(transformParameters[0])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[1])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[2])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[3])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[4])); transformString.append(COMMA); transformString.append(doubleString(transformParameters[5])); transformString.append(CLOSE_PARENTHESIS); } break; default: throw new RuntimeException(); } return transformString.toString(); } | /**
* Converts an AffineTransform to an SVG transform string
*/ | Converts an AffineTransform to an SVG transform string | convertTransform | {
"repo_name": "apache/batik",
"path": "batik-svggen/src/main/java/org/apache/batik/svggen/SVGTransform.java",
"license": "apache-2.0",
"size": 10848
} | [
"org.apache.batik.ext.awt.g2d.TransformStackElement",
"org.apache.batik.ext.awt.g2d.TransformType"
] | import org.apache.batik.ext.awt.g2d.TransformStackElement; import org.apache.batik.ext.awt.g2d.TransformType; | import org.apache.batik.ext.awt.g2d.*; | [
"org.apache.batik"
] | org.apache.batik; | 616,456 |
public static OutputBuffer getOutput(Process process) throws IOException {
ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream();
ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream();
StreamPumper outPumper = new StreamPumper(process.getInputStream(),
stdoutBuffer);
StreamPumper errPumper = new StreamPumper(process.getErrorStream(),
stderrBuffer);
Future<Void> outTask = outPumper.process();
Future<Void> errTask = errPumper.process();
try {
process.waitFor();
outTask.get();
errTask.get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return null;
} catch (ExecutionException e) {
throw new IOException(e);
}
return new OutputBuffer(stdoutBuffer.toString(),
stderrBuffer.toString());
} | static OutputBuffer function(Process process) throws IOException { ByteArrayOutputStream stderrBuffer = new ByteArrayOutputStream(); ByteArrayOutputStream stdoutBuffer = new ByteArrayOutputStream(); StreamPumper outPumper = new StreamPumper(process.getInputStream(), stdoutBuffer); StreamPumper errPumper = new StreamPumper(process.getErrorStream(), stderrBuffer); Future<Void> outTask = outPumper.process(); Future<Void> errTask = errPumper.process(); try { process.waitFor(); outTask.get(); errTask.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } catch (ExecutionException e) { throw new IOException(e); } return new OutputBuffer(stdoutBuffer.toString(), stderrBuffer.toString()); } | /**
* Pumps stdout and stderr the running process into a String.
*
* @param process
* Process to pump.
* @return Output from process.
* @throws IOException
* If an I/O error occurs.
*/ | Pumps stdout and stderr the running process into a String | getOutput | {
"repo_name": "isaacl/openjdk-jdk",
"path": "test/lib/testlibrary/jdk/testlibrary/ProcessTools.java",
"license": "gpl-2.0",
"size": 14035
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.util.concurrent.ExecutionException",
"java.util.concurrent.Future"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; | import java.io.*; import java.util.concurrent.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 991,750 |
public EventBean getUnderlyingFullOrDelta()
{
return underlyingFullOrDelta;
}
| EventBean function() { return underlyingFullOrDelta; } | /**
* Returns wrapped event.
* @return wrapped event
*/ | Returns wrapped event | getUnderlyingFullOrDelta | {
"repo_name": "mobile-event-processing/Asper",
"path": "source/src/com/espertech/esper/event/vaevent/RevisionEventBeanDeclared.java",
"license": "gpl-2.0",
"size": 5311
} | [
"com.espertech.esper.client.EventBean"
] | import com.espertech.esper.client.EventBean; | import com.espertech.esper.client.*; | [
"com.espertech.esper"
] | com.espertech.esper; | 2,257,758 |
public static int stringWidth(JComponent c, FontMetrics fm, String string) {
return fm.stringWidth(string);
} | static int function(JComponent c, FontMetrics fm, String string) { return fm.stringWidth(string); } | /**
* Returns the width of the passed in String.
*
* @param c JComponent that will display the string, may be null
* @param fm FontMetrics used to measure the String width
* @param string String to get the width of
* @return the int
*/ | Returns the width of the passed in String | stringWidth | {
"repo_name": "huanghongxun/beautyeye",
"path": "beautyeye/src/org/jb2011/lnf/beautyeye/utils/MySwingUtilities2.java",
"license": "apache-2.0",
"size": 6778
} | [
"java.awt.FontMetrics",
"javax.swing.JComponent"
] | import java.awt.FontMetrics; import javax.swing.JComponent; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 148,763 |
public void setDefaultValue(Expression defaultValue) {
this.defaultValue = defaultValue;
}
| void function(Expression defaultValue) { this.defaultValue = defaultValue; } | /**
* Sets the default value to be used if the value exprsesion results
* in a null value or blank String
*/ | Sets the default value to be used if the value exprsesion results in a null value or blank String | setDefaultValue | {
"repo_name": "hudson3-plugins/commons-jelly",
"path": "src/java/org/apache/commons/jelly/tags/core/SetTag.java",
"license": "apache-2.0",
"size": 6904
} | [
"org.apache.commons.jelly.expression.Expression"
] | import org.apache.commons.jelly.expression.Expression; | import org.apache.commons.jelly.expression.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,875,043 |
public static ArrayValue localeconv(Env env)
{
ArrayValueImpl array = new ArrayValueImpl();
QuercusLocale money = env.getLocaleInfo().getMonetary();
Locale locale = money.getLocale();
DecimalFormatSymbols decimal = new DecimalFormatSymbols(locale);
Currency currency = NumberFormat.getInstance(locale).getCurrency();
array.put(env.createString("decimal_point"),
env.createString(decimal.getDecimalSeparator()));
array.put(env.createString("thousands_sep"),
env.createString(decimal.getGroupingSeparator()));
//array.put("grouping", "");
array.put(env.createString("int_curr_symbol"),
env.createString(decimal.getInternationalCurrencySymbol()));
array.put(env.createString("currency_symbol"),
env.createString(decimal.getCurrencySymbol()));
array.put(env.createString("mon_decimal_point"),
env.createString(decimal.getMonetaryDecimalSeparator()));
array.put(env.createString("mon_thousands_sep"),
env.createString(decimal.getGroupingSeparator()));
//array.put("mon_grouping", "");
array.put(env.createString("positive_sign"), env.getEmptyString());
array.put(env.createString("negative_sign"),
env.createString(decimal.getMinusSign()));
array.put(env.createString("int_frac_digits"),
LongValue.create(currency.getDefaultFractionDigits()));
array.put(env.createString("frac_digits"),
LongValue.create(currency.getDefaultFractionDigits()));
//array.put("p_cs_precedes", "");
//array.put("p_sep_by_space", "");
//array.put("n_cs_precedes", "");
//array.put("n_sep_by_space", "");
//array.put("p_sign_posn", "");
//array.put("n_sign_posn", "");
return array;
} | static ArrayValue function(Env env) { ArrayValueImpl array = new ArrayValueImpl(); QuercusLocale money = env.getLocaleInfo().getMonetary(); Locale locale = money.getLocale(); DecimalFormatSymbols decimal = new DecimalFormatSymbols(locale); Currency currency = NumberFormat.getInstance(locale).getCurrency(); array.put(env.createString(STR), env.createString(decimal.getDecimalSeparator())); array.put(env.createString(STR), env.createString(decimal.getGroupingSeparator())); array.put(env.createString(STR), env.createString(decimal.getInternationalCurrencySymbol())); array.put(env.createString(STR), env.createString(decimal.getCurrencySymbol())); array.put(env.createString(STR), env.createString(decimal.getMonetaryDecimalSeparator())); array.put(env.createString(STR), env.createString(decimal.getGroupingSeparator())); array.put(env.createString(STR), env.getEmptyString()); array.put(env.createString(STR), env.createString(decimal.getMinusSign())); array.put(env.createString(STR), LongValue.create(currency.getDefaultFractionDigits())); array.put(env.createString(STR), LongValue.create(currency.getDefaultFractionDigits())); return array; } | /**
* Gets locale-specific symbols.
* XXX: locale charset
*/ | Gets locale-specific symbols | localeconv | {
"repo_name": "smba/oak",
"path": "quercus/src/main/java/com/caucho/quercus/lib/string/StringModule.java",
"license": "lgpl-3.0",
"size": 155187
} | [
"com.caucho.quercus.env.ArrayValue",
"com.caucho.quercus.env.ArrayValueImpl",
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.LongValue",
"com.caucho.quercus.env.QuercusLocale",
"java.text.DecimalFormatSymbols",
"java.text.NumberFormat",
"java.util.Currency",
"java.util.Locale"
] | import com.caucho.quercus.env.ArrayValue; import com.caucho.quercus.env.ArrayValueImpl; import com.caucho.quercus.env.Env; import com.caucho.quercus.env.LongValue; import com.caucho.quercus.env.QuercusLocale; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.Currency; import java.util.Locale; | import com.caucho.quercus.env.*; import java.text.*; import java.util.*; | [
"com.caucho.quercus",
"java.text",
"java.util"
] | com.caucho.quercus; java.text; java.util; | 1,022,214 |
protected final void publicApiOnly() {
visibility = Visibility.PUBLIC;
} | final void function() { visibility = Visibility.PUBLIC; } | /**
* Restricts the sanity tests for public API only. By default, package-private API are also
* covered.
*/ | Restricts the sanity tests for public API only. By default, package-private API are also covered | publicApiOnly | {
"repo_name": "DavesMan/guava",
"path": "guava-testlib/src/com/google/common/testing/AbstractPackageSanityTests.java",
"license": "apache-2.0",
"size": 17754
} | [
"com.google.common.testing.NullPointerTester"
] | import com.google.common.testing.NullPointerTester; | import com.google.common.testing.*; | [
"com.google.common"
] | com.google.common; | 2,906,321 |
public static void clog(Level level, String message) {
ColossalChests._instance.getLoggerHelper().log(level, message);
} | static void function(Level level, String message) { ColossalChests._instance.getLoggerHelper().log(level, message); } | /**
* Log a new message of the given level for this mod.
* @param level The level in which the message must be shown.
* @param message The message to show.
*/ | Log a new message of the given level for this mod | clog | {
"repo_name": "CyclopsMC/ColossalChests",
"path": "src/main/java/org/cyclops/colossalchests/ColossalChests.java",
"license": "mit",
"size": 4512
} | [
"org.apache.logging.log4j.Level"
] | import org.apache.logging.log4j.Level; | import org.apache.logging.log4j.*; | [
"org.apache.logging"
] | org.apache.logging; | 2,246,858 |
protected Context getContextForHoverMenu() {
return this;
}
/**
* Subclasses can use this hook method to return a customized {@link Navigator} to be used
* throughout the entire Hover menu. This {@link Navigator} will be used for every tab in the
* Hover menu, so only supply a {@code Navigator} if you truly want every screen to display it.
*
* If you want only a portion of the screens in the Hover menu to look different, then consider
* using composition of {@link NavigatorContent} to achieve the desired effect. For example,
* if you want a {@code Toolbar} to appear on one or more screens, consider placing your content
* within a {@link ToolbarNavigatorContent}, and then add the {@code ToolbarNavigatorContent} | Context function() { return this; } /** * Subclasses can use this hook method to return a customized {@link Navigator} to be used * throughout the entire Hover menu. This {@link Navigator} will be used for every tab in the * Hover menu, so only supply a {@code Navigator} if you truly want every screen to display it. * * If you want only a portion of the screens in the Hover menu to look different, then consider * using composition of {@link NavigatorContent} to achieve the desired effect. For example, * if you want a {@code Toolbar} to appear on one or more screens, consider placing your content * within a {@link ToolbarNavigatorContent}, and then add the {@code ToolbarNavigatorContent} | /**
* Hook for subclasses to return a custom Context to be used in the creation of the {@code HoverMenu}.
* For example, subclasses might choose to provide a ContextThemeWrapper.
*
* @return context for HoverMenu initialization
*/ | Hook for subclasses to return a custom Context to be used in the creation of the HoverMenu. For example, subclasses might choose to provide a ContextThemeWrapper | getContextForHoverMenu | {
"repo_name": "gauravrishi168/gaurav",
"path": "hover/src/main/java/io/mattcarroll/hover/defaulthovermenu/window/HoverMenuService.java",
"license": "apache-2.0",
"size": 5390
} | [
"android.content.Context",
"io.mattcarroll.hover.Navigator"
] | import android.content.Context; import io.mattcarroll.hover.Navigator; | import android.content.*; import io.mattcarroll.hover.*; | [
"android.content",
"io.mattcarroll.hover"
] | android.content; io.mattcarroll.hover; | 282,141 |
@Override
IHeatedObjectCapability setType(@Nonnull IHeatedObjectType type); | IHeatedObjectCapability setType(@Nonnull IHeatedObjectType type); | /**
* Method to set the HeatedObjectType.
*
* @param type The new Type of this Object.
* @return The instance this method was called on.
*/ | Method to set the HeatedObjectType | setType | {
"repo_name": "SmithsGaming/Armory",
"path": "src/api/com/smithsmodding/armory/api/common/capability/IHeatedObjectCapability.java",
"license": "lgpl-3.0",
"size": 7916
} | [
"com.smithsmodding.armory.api.common.heatable.IHeatedObjectType",
"javax.annotation.Nonnull"
] | import com.smithsmodding.armory.api.common.heatable.IHeatedObjectType; import javax.annotation.Nonnull; | import com.smithsmodding.armory.api.common.heatable.*; import javax.annotation.*; | [
"com.smithsmodding.armory",
"javax.annotation"
] | com.smithsmodding.armory; javax.annotation; | 852,342 |
public static void main(String[] args) {
if (args.length != 1) {
System.err.println("Usage: HTML uri (file or url)");
return;
}
try {
HTML html = new HTML(args[0]);
List img_src_list = html.getImageSrcs(false);
System.out.println("<im src");
Iterator img_src_iterator = img_src_list.iterator();
while (img_src_iterator.hasNext()) {
System.out.println((String) img_src_iterator.next());
}
List a_href_list = html.getAnchorHRefs(false);
System.out.println("<a href");
Iterator a_href_iterator = a_href_list.iterator();
while (a_href_iterator.hasNext()) {
System.out.println((String) a_href_iterator.next());
}
List link_href_list = html.getLinkHRefs(false);
System.out.println("<link href");
Iterator link_href_iterator = link_href_list.iterator();
while (link_href_iterator.hasNext()) {
System.out.println((String) link_href_iterator.next());
}
} catch (Exception e) {
System.err.println(".main(): " + e);
}
} | static void function(String[] args) { if (args.length != 1) { System.err.println(STR); return; } try { HTML html = new HTML(args[0]); List img_src_list = html.getImageSrcs(false); System.out.println(STR); Iterator img_src_iterator = img_src_list.iterator(); while (img_src_iterator.hasNext()) { System.out.println((String) img_src_iterator.next()); } List a_href_list = html.getAnchorHRefs(false); System.out.println(STR); Iterator a_href_iterator = a_href_list.iterator(); while (a_href_iterator.hasNext()) { System.out.println((String) a_href_iterator.next()); } List link_href_list = html.getLinkHRefs(false); System.out.println(STR); Iterator link_href_iterator = link_href_list.iterator(); while (link_href_iterator.hasNext()) { System.out.println((String) link_href_iterator.next()); } } catch (Exception e) { System.err.println(STR + e); } } | /**
* DOCUMENT ME!
*
* @param args DOCUMENT ME!
*/ | DOCUMENT ME | main | {
"repo_name": "apache/lenya",
"path": "src/java/org/apache/lenya/util/HTML.java",
"license": "apache-2.0",
"size": 4242
} | [
"java.util.Iterator",
"java.util.List"
] | import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,248,310 |
@Override
public boolean equals(@Nullable Object obj) {
if (obj == this) {
return true;
} else if (obj instanceof BaseRpc) {
BaseRpc en = (BaseRpc) obj;
return new EqualsBuilder()
.append(id, en.id)
.isEquals();
} else {
return false;
}
} | boolean function(@Nullable Object obj) { if (obj == this) { return true; } else if (obj instanceof BaseRpc) { BaseRpc en = (BaseRpc) obj; return new EqualsBuilder() .append(id, en.id) .isEquals(); } else { return false; } } | /**
* Two entities are equal if their key values are equal.
*/ | Two entities are equal if their key values are equal | equals | {
"repo_name": "OpenWiseSolutions/openhub-framework",
"path": "web/src/main/java/org/openhubframework/openhub/admin/web/common/rpc/BaseRpc.java",
"license": "apache-2.0",
"size": 2974
} | [
"javax.annotation.Nullable",
"org.apache.commons.lang3.builder.EqualsBuilder"
] | import javax.annotation.Nullable; import org.apache.commons.lang3.builder.EqualsBuilder; | import javax.annotation.*; import org.apache.commons.lang3.builder.*; | [
"javax.annotation",
"org.apache.commons"
] | javax.annotation; org.apache.commons; | 1,096,450 |
@Message(id = 138, value = "Namespace with prefix %s already registered with schema URI %s")
String namespaceAlreadyRegistered(String prefix, String uri); | @Message(id = 138, value = STR) String namespaceAlreadyRegistered(String prefix, String uri); | /**
* A message indicating a namespace with the prefix, represented by the {@code prefix} parameter, is already
* registered with the schema URI, represented by the {@code uri} parameter.
*
* @param prefix the namespace prefix.
* @param uri the schema URI.
*
* @return the message.
*/ | A message indicating a namespace with the prefix, represented by the prefix parameter, is already registered with the schema URI, represented by the uri parameter | namespaceAlreadyRegistered | {
"repo_name": "aloubyansky/wildfly-core",
"path": "controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java",
"license": "lgpl-2.1",
"size": 164970
} | [
"org.jboss.logging.annotations.Message"
] | import org.jboss.logging.annotations.Message; | import org.jboss.logging.annotations.*; | [
"org.jboss.logging"
] | org.jboss.logging; | 79,128 |
@Test
public void testGetLocalInetAddressMustBeAPAddress() {
if (!FtpService.isEnabledWifiHotspot(
InstrumentationRegistry.getInstrumentation().getTargetContext()))
fail("Please enable Wi-Fi hotspot on your device to run this test!");
assertEquals(
"192.168.43.1",
FtpService.getLocalInetAddress(
InstrumentationRegistry.getInstrumentation().getTargetContext())
.getHostAddress());
} | void function() { if (!FtpService.isEnabledWifiHotspot( InstrumentationRegistry.getInstrumentation().getTargetContext())) fail(STR); assertEquals( STR, FtpService.getLocalInetAddress( InstrumentationRegistry.getInstrumentation().getTargetContext()) .getHostAddress()); } | /**
* To test IP address returned by {@link FtpService#getLocalInetAddress(Context)} must be
* 192.168.43.1.
*
* <p><b>Remember to turn on Wi-Fi AP when running this test on <u>real</u> devices.</b>
*/ | To test IP address returned by <code>FtpService#getLocalInetAddress(Context)</code> must be 192.168.43.1. Remember to turn on Wi-Fi AP when running this test on real devices | testGetLocalInetAddressMustBeAPAddress | {
"repo_name": "arpitkh96/AmazeFileManager",
"path": "app/src/androidTest/java/com/amaze/filemanager/asynchronous/services/ftp/FtpServiceStaticMethodsTest.java",
"license": "gpl-3.0",
"size": 3012
} | [
"androidx.test.platform.app.InstrumentationRegistry",
"org.junit.Assert"
] | import androidx.test.platform.app.InstrumentationRegistry; import org.junit.Assert; | import androidx.test.platform.app.*; import org.junit.*; | [
"androidx.test",
"org.junit"
] | androidx.test; org.junit; | 1,654,262 |
@Test
public void testBranch() {
Branch branch = new Branch("foo", "foo/bar");
assertFalse(branch.isDefault());
Branch branch2 = new Branch();
assertTrue(branch2.isDefault());
assertNotEquals(branch, branch2);
assertEquals("master", branch2.getFullName());
} | void function() { Branch branch = new Branch("foo", STR); assertFalse(branch.isDefault()); Branch branch2 = new Branch(); assertTrue(branch2.isDefault()); assertNotEquals(branch, branch2); assertEquals(STR, branch2.getFullName()); } | /**
* Tests creation of {@link Branch}.
*/ | Tests creation of <code>Branch</code> | testBranch | {
"repo_name": "ControlSystemStudio/cs-studio",
"path": "applications/saverestore/saverestore-plugins/org.csstudio.saverestore.test/src/org/csstudio/saverestore/EntitiesTest.java",
"license": "epl-1.0",
"size": 7643
} | [
"org.csstudio.saverestore.data.Branch",
"org.junit.Assert"
] | import org.csstudio.saverestore.data.Branch; import org.junit.Assert; | import org.csstudio.saverestore.data.*; import org.junit.*; | [
"org.csstudio.saverestore",
"org.junit"
] | org.csstudio.saverestore; org.junit; | 2,067,761 |
public Self addRequestHandler(final GenericRequestHandler<Input, Output> handler) {
requestHandlers.add(handler);
return getThis();
} | Self function(final GenericRequestHandler<Input, Output> handler) { requestHandlers.add(handler); return getThis(); } | /**
* Add a request handler to Skill config.
* @param handler request handler.
* @return {@link AbstractSkillBuilder}.
*/ | Add a request handler to Skill config | addRequestHandler | {
"repo_name": "amzn/alexa-skills-kit-java",
"path": "ask-sdk-runtime/src/com/amazon/ask/builder/impl/AbstractSkillBuilder.java",
"license": "apache-2.0",
"size": 8461
} | [
"com.amazon.ask.request.handler.GenericRequestHandler"
] | import com.amazon.ask.request.handler.GenericRequestHandler; | import com.amazon.ask.request.handler.*; | [
"com.amazon.ask"
] | com.amazon.ask; | 1,820,973 |
public synchronized int numDocs() throws IOException {
int count;
if (docWriter != null)
count = docWriter.getNumDocsInRAM();
else
count = 0;
for (int i = 0; i < segmentInfos.size(); i++) {
final SegmentInfo info = segmentInfos.info(i);
count += info.docCount - info.getDelCount();
}
return count;
} | synchronized int function() throws IOException { int count; if (docWriter != null) count = docWriter.getNumDocsInRAM(); else count = 0; for (int i = 0; i < segmentInfos.size(); i++) { final SegmentInfo info = segmentInfos.info(i); count += info.docCount - info.getDelCount(); } return count; } | /** Returns total number of docs in this index, including
* docs not yet flushed (still in the RAM buffer), and
* including deletions. <b>NOTE:</b> buffered deletions
* are not counted. If you really need these to be
* counted you should call {@link #commit()} first.
* @see #numDocs */ | Returns total number of docs in this index, including docs not yet flushed (still in the RAM buffer), and are not counted. If you really need these to be counted you should call <code>#commit()</code> first | numDocs | {
"repo_name": "sluk3r/lucene-3.0.2-src-study",
"path": "src/java/org/apache/lucene/index/IndexWriter.java",
"license": "apache-2.0",
"size": 171970
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 599,675 |
Collection<ScheduledBlockUpdate> getScheduledUpdates(int x, int y, int z); | Collection<ScheduledBlockUpdate> getScheduledUpdates(int x, int y, int z); | /**
* Gets a list of {@link ScheduledBlockUpdate}s on this block.
*
* @param x The X position
* @param y The Y position
* @param z The Z position
* @return A list of ScheduledBlockUpdates on this block
*/ | Gets a list of <code>ScheduledBlockUpdate</code>s on this block | getScheduledUpdates | {
"repo_name": "SpongeHistory/SpongeAPI-History",
"path": "src/main/java/org/spongepowered/api/world/extent/Extent.java",
"license": "mit",
"size": 18726
} | [
"java.util.Collection",
"org.spongepowered.api.block.ScheduledBlockUpdate"
] | import java.util.Collection; import org.spongepowered.api.block.ScheduledBlockUpdate; | import java.util.*; import org.spongepowered.api.block.*; | [
"java.util",
"org.spongepowered.api"
] | java.util; org.spongepowered.api; | 2,542,868 |
public Mat gray();
} | Mat function(); } | /**
* This method returns single channel gray scale Mat with frame
*/ | This method returns single channel gray scale Mat with frame | gray | {
"repo_name": "Lauszus/FaceRecognitionApp",
"path": "app/src/main/java/com/lauszus/facerecognitionapp/CameraBridgeViewBase.java",
"license": "gpl-2.0",
"size": 28183
} | [
"org.opencv.core.Mat"
] | import org.opencv.core.Mat; | import org.opencv.core.*; | [
"org.opencv.core"
] | org.opencv.core; | 2,344,853 |
public AccountingPeriod getAccountingPeriod() {
return accountingPeriod;
}
| AccountingPeriod function() { return accountingPeriod; } | /**
* Gets the accountingPeriod attribute.
*
* @return Returns the accountingPeriod.
*/ | Gets the accountingPeriod attribute | getAccountingPeriod | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/gl/businessobject/CurrentAccountBalance.java",
"license": "agpl-3.0",
"size": 10302
} | [
"org.kuali.kfs.coa.businessobject.AccountingPeriod"
] | import org.kuali.kfs.coa.businessobject.AccountingPeriod; | import org.kuali.kfs.coa.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,363,116 |
ByteBuffer encode(ByteBuffer audioPkt, ByteBuffer buf); | ByteBuffer encode(ByteBuffer audioPkt, ByteBuffer buf); | /**
* Encodes audio sample data in from the provided 'audioPkt'. The encoder is
* expected to know the bytes per sample, channel count and endian of the
* provided sample data to be able to correctly decode the bytes of provided
* samples.
*
* @param audioPkt Raw bytes containing sample data.
* @param buf Buffer to use as a storage for the output audio frame.
* @return Encoded audio frame.
*/ | Encodes audio sample data in from the provided 'audioPkt'. The encoder is expected to know the bytes per sample, channel count and endian of the provided sample data to be able to correctly decode the bytes of provided samples | encode | {
"repo_name": "jcodec/jcodec",
"path": "src/main/java/org/jcodec/common/AudioEncoder.java",
"license": "bsd-2-clause",
"size": 750
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,467,028 |
protected void doPreCollection() throws IOException {
} | void function() throws IOException { } | /**
* Can be overridden by aggregator implementation to be called back when the collection phase starts.
*/ | Can be overridden by aggregator implementation to be called back when the collection phase starts | doPreCollection | {
"repo_name": "HonzaKral/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/search/aggregations/AggregatorBase.java",
"license": "apache-2.0",
"size": 10196
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,442,819 |
public void checkBaseUrl(final String baseUrl) throws BreinInvalidConfigurationException {
if (!BreinUtil.isValidUrl(baseUrl)) {
final String msg = "BreinConfig issue. Value for BaseUrl is not valid. Value is: "
+ baseUrl;
if (LOG.isDebugEnabled()) {
LOG.debug(msg);
}
throw new BreinInvalidConfigurationException(msg);
}
} | void function(final String baseUrl) throws BreinInvalidConfigurationException { if (!BreinUtil.isValidUrl(baseUrl)) { final String msg = STR + baseUrl; if (LOG.isDebugEnabled()) { LOG.debug(msg); } throw new BreinInvalidConfigurationException(msg); } } | /**
* checks if the url is valid. If not a BreinInvalidConfigurationException will
* be thrown.
*
* @param baseUrl url to check
*/ | checks if the url is valid. If not a BreinInvalidConfigurationException will be thrown | checkBaseUrl | {
"repo_name": "Breinify/brein-api-library-java",
"path": "src/com/brein/domain/BreinConfig.java",
"license": "mit",
"size": 8137
} | [
"com.brein.api.BreinInvalidConfigurationException",
"com.brein.util.BreinUtil"
] | import com.brein.api.BreinInvalidConfigurationException; import com.brein.util.BreinUtil; | import com.brein.api.*; import com.brein.util.*; | [
"com.brein.api",
"com.brein.util"
] | com.brein.api; com.brein.util; | 2,740,006 |
public static Image getInstance(Properties attributes)
throws BadElementException, MalformedURLException, IOException {
String value = (String) attributes.remove(ElementTags.URL);
if (value == null)
throw new MalformedURLException("The URL of the image is missing.");
Image image = Image.getInstance(value);
int align = 0;
if ((value = (String) attributes.remove(ElementTags.ALIGN)) != null) {
if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(value))
align |= Image.LEFT;
else if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(value))
align |= Image.RIGHT;
else if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(value))
align |= Image.MIDDLE;
}
if ((value = (String) attributes.remove(ElementTags.UNDERLYING)) != null) {
if (new Boolean(value).booleanValue())
align |= Image.UNDERLYING;
}
if ((value = (String) attributes.remove(ElementTags.TEXTWRAP)) != null) {
if (new Boolean(value).booleanValue())
align |= Image.TEXTWRAP;
}
image.setAlignment(align);
if ((value = (String) attributes.remove(ElementTags.ALT)) != null) {
image.setAlt(value);
}
String x;
String y;
if (((x = (String) attributes.remove(ElementTags.ABSOLUTEX)) != null)
&& ((y = (String) attributes.remove(ElementTags.ABSOLUTEY)) != null)) {
image.setAbsolutePosition(Float.valueOf(x + "f").floatValue(),
Float.valueOf(y + "f").floatValue());
}
if ((value = (String) attributes.remove(ElementTags.PLAINWIDTH)) != null) {
image.scaleAbsoluteWidth(Float.valueOf(value + "f").floatValue());
}
if ((value = (String) attributes.remove(ElementTags.PLAINHEIGHT)) != null) {
image.scaleAbsoluteHeight(Float.valueOf(value + "f").floatValue());
}
if ((value = (String) attributes.remove(ElementTags.ROTATION)) != null) {
image.setRotation(Float.valueOf(value + "f").floatValue());
}
if (attributes.size() > 0)
image.setMarkupAttributes(attributes);
return image;
}
// methods to set information | static Image function(Properties attributes) throws BadElementException, MalformedURLException, IOException { String value = (String) attributes.remove(ElementTags.URL); if (value == null) throw new MalformedURLException(STR); Image image = Image.getInstance(value); int align = 0; if ((value = (String) attributes.remove(ElementTags.ALIGN)) != null) { if (ElementTags.ALIGN_LEFT.equalsIgnoreCase(value)) align = Image.LEFT; else if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(value)) align = Image.RIGHT; else if (ElementTags.ALIGN_MIDDLE.equalsIgnoreCase(value)) align = Image.MIDDLE; } if ((value = (String) attributes.remove(ElementTags.UNDERLYING)) != null) { if (new Boolean(value).booleanValue()) align = Image.UNDERLYING; } if ((value = (String) attributes.remove(ElementTags.TEXTWRAP)) != null) { if (new Boolean(value).booleanValue()) align = Image.TEXTWRAP; } image.setAlignment(align); if ((value = (String) attributes.remove(ElementTags.ALT)) != null) { image.setAlt(value); } String x; String y; if (((x = (String) attributes.remove(ElementTags.ABSOLUTEX)) != null) && ((y = (String) attributes.remove(ElementTags.ABSOLUTEY)) != null)) { image.setAbsolutePosition(Float.valueOf(x + "f").floatValue(), Float.valueOf(y + "f").floatValue()); } if ((value = (String) attributes.remove(ElementTags.PLAINWIDTH)) != null) { image.scaleAbsoluteWidth(Float.valueOf(value + "f").floatValue()); } if ((value = (String) attributes.remove(ElementTags.PLAINHEIGHT)) != null) { image.scaleAbsoluteHeight(Float.valueOf(value + "f").floatValue()); } if ((value = (String) attributes.remove(ElementTags.ROTATION)) != null) { image.setRotation(Float.valueOf(value + "f").floatValue()); } if (attributes.size() > 0) image.setMarkupAttributes(attributes); return image; } | /**
* Returns an <CODE>Image</CODE> that has been constructed taking in
* account the value of some <VAR>attributes </VAR>.
*
* @param attributes
* Some attributes
* @return an <CODE>Image</CODE>
* @throws BadElementException
* @throws MalformedURLException
* @throws IOException
*/ | Returns an <code>Image</code> that has been constructed taking in account the value of some attributes | getInstance | {
"repo_name": "MesquiteProject/MesquiteArchive",
"path": "trunk/Mesquite Project/LibrarySource/com/lowagie/text/Image.java",
"license": "lgpl-3.0",
"size": 46598
} | [
"java.io.IOException",
"java.net.MalformedURLException",
"java.util.Properties"
] | import java.io.IOException; import java.net.MalformedURLException; import java.util.Properties; | import java.io.*; import java.net.*; import java.util.*; | [
"java.io",
"java.net",
"java.util"
] | java.io; java.net; java.util; | 374,312 |
public static Integer getEmulatorPort(String serialNumber) {
Matcher m = sEmulatorRegexp.matcher(serialNumber);
if (m.matches()) {
// get the port number. This is the console port.
int port;
try {
port = Integer.parseInt(m.group(1));
if (port > 0) {
return port;
}
} catch (NumberFormatException e) {
// looks like we failed to get the port number. This is a bit strange since
// it's coming from a regexp that only accept digit, but we handle the case
// and return null.
}
}
return null;
} | static Integer function(String serialNumber) { Matcher m = sEmulatorRegexp.matcher(serialNumber); if (m.matches()) { int port; try { port = Integer.parseInt(m.group(1)); if (port > 0) { return port; } } catch (NumberFormatException e) { } } return null; } | /**
* Return port of emulator given its serial number.
*
* @param serialNumber the emulator's serial number
* @return the integer port or <code>null</code> if it could not be determined
*/ | Return port of emulator given its serial number | getEmulatorPort | {
"repo_name": "lrscp/ControlAndroidDeviceFromPC",
"path": "src/com/android/ddmlib/EmulatorConsole.java",
"license": "apache-2.0",
"size": 25424
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,758,160 |
public long insert(String table, ContentValues values); | long function(String table, ContentValues values); | /**
* Method representing SQL INSERT (INSERT INTO table (val1, val2,...))
* @param table representing the table from the query.
* @param values representing the values of the query.
* @return The row number from the entry created by the insert-query is returned as long. -1 is returned if there was an error.
*/ | Method representing SQL INSERT (INSERT INTO table (val1, val2,...)) | insert | {
"repo_name": "FBrand/MobileComputing2017",
"path": "AppDBConnection/DBConnection.java",
"license": "gpl-3.0",
"size": 2506
} | [
"android.content.ContentValues"
] | import android.content.ContentValues; | import android.content.*; | [
"android.content"
] | android.content; | 2,292,081 |
public static BlockLocation[] locatedBlocks2Locations(LocatedBlocks blocks) {
if (blocks == null) {
return new BlockLocation[0];
}
int nrBlocks = blocks.locatedBlockCount();
BlockLocation[] blkLocations = new BlockLocation[nrBlocks];
int idx = 0;
for (LocatedBlock blk : blocks.getLocatedBlocks()) {
assert idx < nrBlocks : "Incorrect index";
DatanodeInfo[] locations = blk.getLocations();
String[] hosts = new String[locations.length];
String[] names = new String[locations.length];
String[] racks = new String[locations.length];
for (int hCnt = 0; hCnt < locations.length; hCnt++) {
hosts[hCnt] = locations[hCnt].getHostName();
names[hCnt] = locations[hCnt].getName();
NodeBase node = new NodeBase(names[hCnt],
locations[hCnt].getNetworkLocation());
racks[hCnt] = node.toString();
}
blkLocations[idx] = new BlockLocation(names, hosts, racks,
blk.getStartOffset(),
blk.getBlockSize());
idx++;
}
return blkLocations;
} | static BlockLocation[] function(LocatedBlocks blocks) { if (blocks == null) { return new BlockLocation[0]; } int nrBlocks = blocks.locatedBlockCount(); BlockLocation[] blkLocations = new BlockLocation[nrBlocks]; int idx = 0; for (LocatedBlock blk : blocks.getLocatedBlocks()) { assert idx < nrBlocks : STR; DatanodeInfo[] locations = blk.getLocations(); String[] hosts = new String[locations.length]; String[] names = new String[locations.length]; String[] racks = new String[locations.length]; for (int hCnt = 0; hCnt < locations.length; hCnt++) { hosts[hCnt] = locations[hCnt].getHostName(); names[hCnt] = locations[hCnt].getName(); NodeBase node = new NodeBase(names[hCnt], locations[hCnt].getNetworkLocation()); racks[hCnt] = node.toString(); } blkLocations[idx] = new BlockLocation(names, hosts, racks, blk.getStartOffset(), blk.getBlockSize()); idx++; } return blkLocations; } | /**
* Convert a LocatedBlocks to BlockLocations[]
* @param blocks a LocatedBlocks
* @return an array of BlockLocations
*/ | Convert a LocatedBlocks to BlockLocations[] | locatedBlocks2Locations | {
"repo_name": "Seagate/hadoop-on-lustre",
"path": "src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java",
"license": "apache-2.0",
"size": 6134
} | [
"org.apache.hadoop.fs.BlockLocation",
"org.apache.hadoop.hdfs.protocol.DatanodeInfo",
"org.apache.hadoop.hdfs.protocol.LocatedBlock",
"org.apache.hadoop.hdfs.protocol.LocatedBlocks",
"org.apache.hadoop.net.NodeBase"
] | import org.apache.hadoop.fs.BlockLocation; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.apache.hadoop.hdfs.protocol.LocatedBlock; import org.apache.hadoop.hdfs.protocol.LocatedBlocks; import org.apache.hadoop.net.NodeBase; | import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.net.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 529,262 |
@Override
public void waitForChecked() throws WidgetException
{
waitForChecked(getGUIDriver().getMaxRequestTimeout());
} | void function() throws WidgetException { waitForChecked(getGUIDriver().getMaxRequestTimeout()); } | /**
* Waits for element at locator to be checked within period of
* maxRequestTimeout
*
* @throws WidgetException
*/ | Waits for element at locator to be checked within period of maxRequestTimeout | waitForChecked | {
"repo_name": "knappk/JTAF-ExtWebDriver",
"path": "src/main/java/org/finra/jtaf/ewd/widget/element/html/CheckBox.java",
"license": "apache-2.0",
"size": 8467
} | [
"org.finra.jtaf.ewd.widget.WidgetException"
] | import org.finra.jtaf.ewd.widget.WidgetException; | import org.finra.jtaf.ewd.widget.*; | [
"org.finra.jtaf"
] | org.finra.jtaf; | 2,765,354 |
public int getNumTableColumns(List<DetailedBudgetColumn> columns) {
int i = 4;
if (columns.size() > 1) {
i += getNumSubtotalsColumns() * columns.size();
}
if (subtotalsForParentCategories) i++;
return i;
} | int function(List<DetailedBudgetColumn> columns) { int i = 4; if (columns.size() > 1) { i += getNumSubtotalsColumns() * columns.size(); } if (subtotalsForParentCategories) i++; return i; } | /**
* Total number of columns for report row
* @param columns
* @return
*/ | Total number of columns for report row | getNumTableColumns | {
"repo_name": "divegeek/moneydance-detailedbudget",
"path": "src/com/moneydance/modules/features/detailedBudget/DetailedBudgetWindow.java",
"license": "bsd-3-clause",
"size": 36396
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,384,628 |
@Test
public void testCloseWithStream() throws Exception {
IStreamDecoder decoder = new TestStreamDecoder(testData);
Assert.assertNull(decoder.getInputStream());
InputStream stream = ResourceUtil.getResourceAsStream("test.bson");
decoder.setInputStream(stream);
Assert.assertEquals(stream, decoder.getInputStream());
decoder.close();
Assert.assertTrue(stream.available() == 0);
Assert.assertNull(decoder.getInputStream());
} | void function() throws Exception { IStreamDecoder decoder = new TestStreamDecoder(testData); Assert.assertNull(decoder.getInputStream()); InputStream stream = ResourceUtil.getResourceAsStream(STR); decoder.setInputStream(stream); Assert.assertEquals(stream, decoder.getInputStream()); decoder.close(); Assert.assertTrue(stream.available() == 0); Assert.assertNull(decoder.getInputStream()); } | /**
* Test that the stream is closeable.
*
* @throws Exception Should not throw an exception.
*/ | Test that the stream is closeable | testCloseWithStream | {
"repo_name": "krotscheck/data-file-reader",
"path": "data-file-reader-base/src/test/java/net/krotscheck/dfr/stream/AbstractStreamDecoderTest.java",
"license": "apache-2.0",
"size": 4540
} | [
"java.io.InputStream",
"net.krotscheck.test.dfr.TestStreamDecoder",
"net.krotscheck.util.ResourceUtil",
"org.junit.Assert"
] | import java.io.InputStream; import net.krotscheck.test.dfr.TestStreamDecoder; import net.krotscheck.util.ResourceUtil; import org.junit.Assert; | import java.io.*; import net.krotscheck.test.dfr.*; import net.krotscheck.util.*; import org.junit.*; | [
"java.io",
"net.krotscheck.test",
"net.krotscheck.util",
"org.junit"
] | java.io; net.krotscheck.test; net.krotscheck.util; org.junit; | 2,357,417 |
public AccumT mergeAccumulators(K key, Iterable<AccumT> accumulators, PipelineOptions options,
SideInputReader sideInputReader, Collection<? extends BoundedWindow> windows); | AccumT function(K key, Iterable<AccumT> accumulators, PipelineOptions options, SideInputReader sideInputReader, Collection<? extends BoundedWindow> windows); | /**
* Forwards the call to a {@link PerKeyCombineFn} to merge accumulators.
*
* <p>It constructs a {@code CombineWithContext.Context} from
* {@link PipelineOptions} and {@link SideInputReader} if it is required.
*/ | Forwards the call to a <code>PerKeyCombineFn</code> to merge accumulators. It constructs a CombineWithContext.Context from <code>PipelineOptions</code> and <code>SideInputReader</code> if it is required | mergeAccumulators | {
"repo_name": "joshualitt/DataflowJavaSDK",
"path": "sdk/src/main/java/com/google/cloud/dataflow/sdk/util/PerKeyCombineFnRunner.java",
"license": "apache-2.0",
"size": 5963
} | [
"com.google.cloud.dataflow.sdk.options.PipelineOptions",
"com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow",
"java.util.Collection"
] | import com.google.cloud.dataflow.sdk.options.PipelineOptions; import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow; import java.util.Collection; | import com.google.cloud.dataflow.sdk.options.*; import com.google.cloud.dataflow.sdk.transforms.windowing.*; import java.util.*; | [
"com.google.cloud",
"java.util"
] | com.google.cloud; java.util; | 737,294 |
public JsonWriter name(String name) throws IOException {
if (name == null) {
throw new NullPointerException("name == null");
}
if (deferredName != null) {
throw new IllegalStateException();
}
if (stack.isEmpty()) {
throw new IllegalStateException("JsonWriter is closed.");
}
deferredName = name;
return this;
} | JsonWriter function(String name) throws IOException { if (name == null) { throw new NullPointerException(STR); } if (deferredName != null) { throw new IllegalStateException(); } if (stack.isEmpty()) { throw new IllegalStateException(STR); } deferredName = name; return this; } | /**
* Encodes the property name.
*
* @param name the name of the forthcoming value. May not be null.
* @return this writer.
*/ | Encodes the property name | name | {
"repo_name": "freefair/advanced-bugsnag-android",
"path": "src/main/java/com/bugsnag/android/JsonWriter.java",
"license": "mit",
"size": 19644
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,787,534 |
default public T saveOrUpdate(T entity) throws IllegalArgumentException, NotImplementedYetException {
if (entity == null) throw new IllegalArgumentException("Entity Passed to Persist is Null");
if (entity.getId() == 0)
save(entity);
else
update(entity);
return entity;
} | default T function(T entity) throws IllegalArgumentException, NotImplementedYetException { if (entity == null) throw new IllegalArgumentException(STR); if (entity.getId() == 0) save(entity); else update(entity); return entity; } | /**
* Save Or Update Currenty Entity Based on Id
*
* @param entity
* Entity Passed to Persist or Update
* @return Managed Entity
* @throws IllegalArgumentException
* if Entity is Null
* @throws NotImplementedYetException
* if Methods is Not Implemented Yet
*/ | Save Or Update Currenty Entity Based on Id | saveOrUpdate | {
"repo_name": "frmichetti/workix",
"path": "src/main/java/br/com/codecode/workix/cdi/dao/Crud.java",
"license": "gpl-3.0",
"size": 1763
} | [
"br.com.codecode.workix.core.exceptions.NotImplementedYetException"
] | import br.com.codecode.workix.core.exceptions.NotImplementedYetException; | import br.com.codecode.workix.core.exceptions.*; | [
"br.com.codecode"
] | br.com.codecode; | 199,588 |
public static void doRebalance() {
ResourceManager resMan = cache.getResourceManager();
boolean heapEviction = (resMan.getEvictionHeapPercentage() > 0);
RebalanceFactory factory = resMan.createRebalanceFactory();
try {
RebalanceResults simulateResults = null;
if (!heapEviction) {
LogWriterUtils.getLogWriter().info("Calling rebalance simulate");
RebalanceOperation simulateOp = factory.simulate();
simulateResults = simulateOp.getResults();
}
LogWriterUtils.getLogWriter().info("Starting rebalancing");
RebalanceOperation rebalanceOp = factory.start();
RebalanceResults rebalanceResults = rebalanceOp.getResults();
} catch (InterruptedException e) {
Assert.fail("Interrupted", e);
}
} | static void function() { ResourceManager resMan = cache.getResourceManager(); boolean heapEviction = (resMan.getEvictionHeapPercentage() > 0); RebalanceFactory factory = resMan.createRebalanceFactory(); try { RebalanceResults simulateResults = null; if (!heapEviction) { LogWriterUtils.getLogWriter().info(STR); RebalanceOperation simulateOp = factory.simulate(); simulateResults = simulateOp.getResults(); } LogWriterUtils.getLogWriter().info(STR); RebalanceOperation rebalanceOp = factory.start(); RebalanceResults rebalanceResults = rebalanceOp.getResults(); } catch (InterruptedException e) { Assert.fail(STR, e); } } | /**
* Do a rebalance and verify balance was improved. If evictionPercentage > 0 (the default) then we
* have heapLRU and this can cause simulate and rebalance results to differ if eviction kicks in
* between. (See BUG 44899).
*/ | Do a rebalance and verify balance was improved. If evictionPercentage > 0 (the default) then we have heapLRU and this can cause simulate and rebalance results to differ if eviction kicks in between. (See BUG 44899) | doRebalance | {
"repo_name": "smgoller/geode",
"path": "geode-dunit/src/main/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java",
"license": "apache-2.0",
"size": 65940
} | [
"org.apache.geode.cache.control.RebalanceFactory",
"org.apache.geode.cache.control.RebalanceOperation",
"org.apache.geode.cache.control.RebalanceResults",
"org.apache.geode.cache.control.ResourceManager",
"org.apache.geode.test.dunit.Assert",
"org.apache.geode.test.dunit.LogWriterUtils",
"org.junit.Assert"
] | import org.apache.geode.cache.control.RebalanceFactory; import org.apache.geode.cache.control.RebalanceOperation; import org.apache.geode.cache.control.RebalanceResults; import org.apache.geode.cache.control.ResourceManager; import org.apache.geode.test.dunit.Assert; import org.apache.geode.test.dunit.LogWriterUtils; import org.junit.Assert; | import org.apache.geode.cache.control.*; import org.apache.geode.test.dunit.*; import org.junit.*; | [
"org.apache.geode",
"org.junit"
] | org.apache.geode; org.junit; | 850,902 |
ImmutableSet<String> stripTypes =
ImmutableSet.of(
"goog.debug.DebugWindow",
"goog.debug.FancyWindow",
"goog.debug.Formatter",
"goog.debug.HtmlFormatter",
"goog.debug.TextFormatter",
"goog.debug.Logger",
"goog.debug.LogManager",
"goog.debug.LogRecord",
"goog.net.BrowserChannel.LogSaver",
"goog.log",
"GA_GoogleDebugger");
ImmutableSet<String> stripNameSuffixes =
ImmutableSet.of(
"logger", "logger_", "debugWindow", "debugWindow_", "logFormatter_", "logBuffer_");
ImmutableSet<String> stripNamePrefixes = ImmutableSet.of("trace");
return new StripCode(compiler, stripTypes, stripNameSuffixes, stripNamePrefixes, false);
} | ImmutableSet<String> stripTypes = ImmutableSet.of( STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR); ImmutableSet<String> stripNameSuffixes = ImmutableSet.of( STR, STR, STR, STR, STR, STR); ImmutableSet<String> stripNamePrefixes = ImmutableSet.of("trace"); return new StripCode(compiler, stripTypes, stripNameSuffixes, stripNamePrefixes, false); } | /**
* Creates an instance for removing logging code.
*
* @param compiler The Compiler
* @return A new {@link StripCode} instance
*/ | Creates an instance for removing logging code | getStripCodeInstance | {
"repo_name": "GoogleChromeLabs/chromeos_smart_card_connector",
"path": "third_party/closure-compiler/src/test/com/google/javascript/jscomp/StripCodeTest.java",
"license": "apache-2.0",
"size": 41087
} | [
"com.google.common.collect.ImmutableSet"
] | import com.google.common.collect.ImmutableSet; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 1,301,146 |
private void checkNameConstraints(byte[] data)
{
if (data != null)
{
try
{
ByteArrayInputStream inStream = new ByteArrayInputStream(data);
ASN1InputStream derInStream = new ASN1InputStream(inStream);
ASN1Object derObject = derInStream.readObject();
if (!(derObject instanceof ASN1Sequence))
{
throw new IllegalArgumentException(
"nameConstraints parameter decoding error");
}
}
catch (IOException ex)
{
throw new IllegalArgumentException(
"nameConstraints parameter decoding error: " + ex);
}
}
} | void function(byte[] data) { if (data != null) { try { ByteArrayInputStream inStream = new ByteArrayInputStream(data); ASN1InputStream derInStream = new ASN1InputStream(inStream); ASN1Object derObject = derInStream.readObject(); if (!(derObject instanceof ASN1Sequence)) { throw new IllegalArgumentException( STR); } } catch (IOException ex) { throw new IllegalArgumentException( STR + ex); } } } | /**
* Check given DER encoded nameConstraints for correct decoding. Currently
* only basic DER decoding test.<br />
* <br />
* <b>TODO: implement more testing.</b>
*
* @param data
* the DER encoded nameConstrains to be checked or
* <code>null</code>
* @exception IllegalArgumentException
* if the check failed.
*/ | Check given DER encoded nameConstraints for correct decoding. Currently only basic DER decoding test. | checkNameConstraints | {
"repo_name": "GaloisInc/hacrypto",
"path": "src/Java/BouncyCastle/BouncyCastle-1.50/core/src/main/jdk1.1/java/security/cert/TrustAnchor.java",
"license": "bsd-3-clause",
"size": 11396
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"org.bouncycastle.asn1.ASN1InputStream",
"org.bouncycastle.asn1.ASN1Object",
"org.bouncycastle.asn1.ASN1Sequence"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import org.bouncycastle.asn1.ASN1InputStream; import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1Sequence; | import java.io.*; import org.bouncycastle.asn1.*; | [
"java.io",
"org.bouncycastle.asn1"
] | java.io; org.bouncycastle.asn1; | 2,429,261 |
void generateRaXml(Definition def, String outputDir)
{
if (!def.isUseAnnotation())
{
try
{
outputDir = outputDir + File.separatorChar + "src" + File.separatorChar +
"main" + File.separatorChar + "resources";
FileWriter rafw = Utils.createFile("ra.xml", outputDir + File.separatorChar + "META-INF");
RaXmlGen raGen = getRaXmlGen(def);
raGen.generate(def, rafw);
rafw.close();
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
} | void generateRaXml(Definition def, String outputDir) { if (!def.isUseAnnotation()) { try { outputDir = outputDir + File.separatorChar + "src" + File.separatorChar + "main" + File.separatorChar + STR; FileWriter rafw = Utils.createFile(STR, outputDir + File.separatorChar + STR); RaXmlGen raGen = getRaXmlGen(def); raGen.generate(def, rafw); rafw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } } } | /**
* generate ra.xml
* @param def Definition
* @param outputDir output directory
*/ | generate ra.xml | generateRaXml | {
"repo_name": "ironjacamar/ironjacamar",
"path": "codegenerator/src/main/java/org/jboss/jca/codegenerator/BaseProfile.java",
"license": "lgpl-2.1",
"size": 19006
} | [
"java.io.File",
"java.io.FileWriter",
"java.io.IOException",
"org.jboss.jca.codegenerator.xml.RaXmlGen"
] | import java.io.File; import java.io.FileWriter; import java.io.IOException; import org.jboss.jca.codegenerator.xml.RaXmlGen; | import java.io.*; import org.jboss.jca.codegenerator.xml.*; | [
"java.io",
"org.jboss.jca"
] | java.io; org.jboss.jca; | 554,082 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.