method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public Displayable getDisplayable()
{
if(displayable != null)
return displayable;
displayable = constructDisplayable();
return displayable;
}
| Displayable function() { if(displayable != null) return displayable; displayable = constructDisplayable(); return displayable; } | /**
* Get a (possibly cached) Displayable for this menu.
* @return A Displayable that represents this menu, either cached
* or freshly constructed with constructDisplayable
*/ | Get a (possibly cached) Displayable for this menu | getDisplayable | {
"repo_name": "henryk/xbmc_control",
"path": "src/ch/ploetzli/xbmc/j2me/SubMenu.java",
"license": "gpl-2.0",
"size": 6048
} | [
"javax.microedition.lcdui.Displayable"
] | import javax.microedition.lcdui.Displayable; | import javax.microedition.lcdui.*; | [
"javax.microedition"
] | javax.microedition; | 1,524,705 |
@Override
@SuppressWarnings("unchecked")
public void put(int index, Object value) {
switch (index) {
case 0:
this.tableName = (String)value;
break;
case 1:
this.viewName = (String)value;
break;
case 2:
this.isString = (Boolean)value;
break;
case 3:
this.value = (Double)value;
break;
case 4:
this.valueStr = (String)value;
break;
case 5:
this.columnName = (String)value;
break;
case 6:
this.options = (Map<String, String>)value;
break;
default:
throw new IndexOutOfBoundsException("Invalid index specified.");
}
} | @SuppressWarnings(STR) void function(int index, Object value) { switch (index) { case 0: this.tableName = (String)value; break; case 1: this.viewName = (String)value; break; case 2: this.isString = (Boolean)value; break; case 3: this.value = (Double)value; break; case 4: this.valueStr = (String)value; break; case 5: this.columnName = (String)value; break; case 6: this.options = (Map<String, String>)value; break; default: throw new IndexOutOfBoundsException(STR); } } | /**
* This method supports the Avro framework and is not intended to be called
* directly by the user.
*
* @param index the position of the field to set
* @param value the value to set
*
* @throws IndexOutOfBoundsException
*
*/ | This method supports the Avro framework and is not intended to be called directly by the user | put | {
"repo_name": "GPUdb/gpudb-api-java",
"path": "api/src/main/java/com/gpudb/protocol/FilterByValueRequest.java",
"license": "mit",
"size": 18189
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,284,092 |
public TierDto load(String org, String envName, String name) throws APIException {
try {
Tier tier = tierManager.load(name, "", envName);
return tier.toDto();
} catch (EntityNotFoundException e) {
throw new APIException(e);
}
} | TierDto function(String org, String envName, String name) throws APIException { try { Tier tier = tierManager.load(name, "", envName); return tier.toDto(); } catch (EntityNotFoundException e) { throw new APIException(e); } } | /**
* Find a specific tier described by its name from the environment belongs.
*
* @param org
* The organization which contains the environment.
* @param envName
* The name id of the environment.
* @param name
* The name of the tier to be found.
* @return The detailed information about the tier.
* @throws APIException
* Exception if the tier is not found.
*/ | Find a specific tier described by its name from the environment belongs | load | {
"repo_name": "Fiware/cloud.PaaS",
"path": "rest-api/src/main/java/com/telefonica/euro_iaas/paasmanager/rest/resources/AbstractTierResourceImpl.java",
"license": "apache-2.0",
"size": 11135
} | [
"com.telefonica.euro_iaas.paasmanager.model.Tier",
"com.telefonica.euro_iaas.paasmanager.model.dto.TierDto",
"com.telefonica.euro_iaas.paasmanager.rest.exception.APIException",
"com.telefonica.fiware.commons.dao.EntityNotFoundException"
] | import com.telefonica.euro_iaas.paasmanager.model.Tier; import com.telefonica.euro_iaas.paasmanager.model.dto.TierDto; import com.telefonica.euro_iaas.paasmanager.rest.exception.APIException; import com.telefonica.fiware.commons.dao.EntityNotFoundException; | import com.telefonica.euro_iaas.paasmanager.model.*; import com.telefonica.euro_iaas.paasmanager.model.dto.*; import com.telefonica.euro_iaas.paasmanager.rest.exception.*; import com.telefonica.fiware.commons.dao.*; | [
"com.telefonica.euro_iaas",
"com.telefonica.fiware"
] | com.telefonica.euro_iaas; com.telefonica.fiware; | 1,535,001 |
@Nullable @Optional @Input
List<String> getJvmArgs(); | @Nullable @Optional List<String> getJvmArgs(); | /**
* Returns the extra arguments to use to launch the JVM for the process. Does not include system properties and the
* minimum/maximum heap size.
*
* @return The arguments. Returns an empty list if there are no arguments.
*/ | Returns the extra arguments to use to launch the JVM for the process. Does not include system properties and the minimum/maximum heap size | getJvmArgs | {
"repo_name": "lsmaira/gradle",
"path": "subprojects/core-api/src/main/java/org/gradle/process/JavaForkOptions.java",
"license": "apache-2.0",
"size": 8888
} | [
"java.util.List",
"javax.annotation.Nullable",
"org.gradle.api.tasks.Optional"
] | import java.util.List; import javax.annotation.Nullable; import org.gradle.api.tasks.Optional; | import java.util.*; import javax.annotation.*; import org.gradle.api.tasks.*; | [
"java.util",
"javax.annotation",
"org.gradle.api"
] | java.util; javax.annotation; org.gradle.api; | 2,250,392 |
@SmallTest
@Feature({"Gestures"})
public void testTouchMoveCoalescing() throws Exception {
final long downTime = SystemClock.uptimeMillis();
final long eventTime = SystemClock.uptimeMillis();
mGestureHandler.hasTouchEventHandlers(true);
MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime);
assertTrue(mGestureHandler.onTouchEvent(event));
mGestureHandler.confirmTouchEvent(ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED);
assertEquals(TouchPoint.TOUCH_EVENT_TYPE_START, mMockMotionEventDelegate.mLastTouchAction);
event = MotionEvent.obtain(
downTime, eventTime + 5, MotionEvent.ACTION_MOVE,
FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0);
assertTrue(mGestureHandler.onTouchEvent(event));
assertFalse("Should not have a pending LONG_PRESS", mLongPressDetector.hasPendingMessage());
assertEquals("Initial move events should offered to javascript and added to the queue",
1, mGestureHandler.getNumberOfPendingMotionEventsForTesting());
assertEquals(TouchPoint.TOUCH_EVENT_TYPE_MOVE, mMockMotionEventDelegate.mLastTouchAction);
event = MotionEvent.obtain(
downTime, eventTime + 10, MotionEvent.ACTION_MOVE,
FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0);
assertTrue(mGestureHandler.onTouchEvent(event));
assertEquals("Move events already sent to javascript should not be coalesced",
2, mGestureHandler.getNumberOfPendingMotionEventsForTesting());
event = MotionEvent.obtain(
downTime, eventTime + 15, MotionEvent.ACTION_MOVE,
FAKE_COORD_X * 15, FAKE_COORD_Y * 15, 0);
assertTrue(mGestureHandler.onTouchEvent(event));
assertEquals("Similar pending move events should be coalesced",
2, mGestureHandler.getNumberOfPendingMotionEventsForTesting());
PointerProperties pp1 = new PointerProperties();
pp1.id = 0;
pp1.toolType = MotionEvent.TOOL_TYPE_FINGER;
PointerProperties pp2 = new PointerProperties();
pp2.id = 1;
pp2.toolType = MotionEvent.TOOL_TYPE_FINGER;
PointerProperties[] properties = new PointerProperties[] { pp1, pp2 };
PointerCoords pc1 = new PointerCoords();
pc1.x = FAKE_COORD_X * 10;
pc1.y = FAKE_COORD_Y * 10;
pc1.pressure = 1;
pc1.size = 1;
PointerCoords pc2 = new PointerCoords();
pc2.x = FAKE_COORD_X * 15;
pc2.y = FAKE_COORD_Y * 15;
pc2.pressure = 1;
pc2.size = 1;
PointerCoords[] coords = new PointerCoords[] { pc1, pc2 };
event = MotionEvent.obtain(
downTime, eventTime + 20, MotionEvent.ACTION_MOVE,
2, properties, coords, 0, 0, 1.0f, 1.0f, 0, 0, 0, 0);
assertTrue(mGestureHandler.onTouchEvent(event));
assertEquals("Move events with different pointer counts should not be coalesced",
3, mGestureHandler.getNumberOfPendingMotionEventsForTesting());
event = MotionEvent.obtain(
downTime, eventTime + 25, MotionEvent.ACTION_MOVE,
2, properties, coords, 0, 0, 1.0f, 1.0f, 0, 0, 0, 0);
assertTrue(mGestureHandler.onTouchEvent(event));
assertEquals("Move events with similar pointer counts should be coalesced",
3, mGestureHandler.getNumberOfPendingMotionEventsForTesting());
event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime);
assertTrue(mGestureHandler.onTouchEvent(event));
assertEquals("Move events should not be coalesced with other events",
4, mGestureHandler.getNumberOfPendingMotionEventsForTesting());
} | @Feature({STR}) void function() throws Exception { final long downTime = SystemClock.uptimeMillis(); final long eventTime = SystemClock.uptimeMillis(); mGestureHandler.hasTouchEventHandlers(true); MotionEvent event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); mGestureHandler.confirmTouchEvent(ContentViewGestureHandler.INPUT_EVENT_ACK_STATE_CONSUMED); assertEquals(TouchPoint.TOUCH_EVENT_TYPE_START, mMockMotionEventDelegate.mLastTouchAction); event = MotionEvent.obtain( downTime, eventTime + 5, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 5, FAKE_COORD_Y * 5, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertFalse(STR, mLongPressDetector.hasPendingMessage()); assertEquals(STR, 1, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); assertEquals(TouchPoint.TOUCH_EVENT_TYPE_MOVE, mMockMotionEventDelegate.mLastTouchAction); event = MotionEvent.obtain( downTime, eventTime + 10, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 10, FAKE_COORD_Y * 10, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(STR, 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 15, MotionEvent.ACTION_MOVE, FAKE_COORD_X * 15, FAKE_COORD_Y * 15, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(STR, 2, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); PointerProperties pp1 = new PointerProperties(); pp1.id = 0; pp1.toolType = MotionEvent.TOOL_TYPE_FINGER; PointerProperties pp2 = new PointerProperties(); pp2.id = 1; pp2.toolType = MotionEvent.TOOL_TYPE_FINGER; PointerProperties[] properties = new PointerProperties[] { pp1, pp2 }; PointerCoords pc1 = new PointerCoords(); pc1.x = FAKE_COORD_X * 10; pc1.y = FAKE_COORD_Y * 10; pc1.pressure = 1; pc1.size = 1; PointerCoords pc2 = new PointerCoords(); pc2.x = FAKE_COORD_X * 15; pc2.y = FAKE_COORD_Y * 15; pc2.pressure = 1; pc2.size = 1; PointerCoords[] coords = new PointerCoords[] { pc1, pc2 }; event = MotionEvent.obtain( downTime, eventTime + 20, MotionEvent.ACTION_MOVE, 2, properties, coords, 0, 0, 1.0f, 1.0f, 0, 0, 0, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(STR, 3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = MotionEvent.obtain( downTime, eventTime + 25, MotionEvent.ACTION_MOVE, 2, properties, coords, 0, 0, 1.0f, 1.0f, 0, 0, 0, 0); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(STR, 3, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); event = motionEvent(MotionEvent.ACTION_DOWN, downTime, downTime); assertTrue(mGestureHandler.onTouchEvent(event)); assertEquals(STR, 4, mGestureHandler.getNumberOfPendingMotionEventsForTesting()); } | /**
* Verify that touch move events are properly coalesced.
* @throws Exception
*/ | Verify that touch move events are properly coalesced | testTouchMoveCoalescing | {
"repo_name": "qtekfun/htcDesire820Kernel",
"path": "external/chromium_org/content/public/android/javatests/src/org/chromium/content/browser/ContentViewGestureHandlerTest.java",
"license": "gpl-2.0",
"size": 109438
} | [
"android.os.SystemClock",
"android.view.MotionEvent",
"org.chromium.base.test.util.Feature"
] | import android.os.SystemClock; import android.view.MotionEvent; import org.chromium.base.test.util.Feature; | import android.os.*; import android.view.*; import org.chromium.base.test.util.*; | [
"android.os",
"android.view",
"org.chromium.base"
] | android.os; android.view; org.chromium.base; | 1,275,260 |
boolean exists( Path path ) throws IOException; | boolean exists( Path path ) throws IOException; | /**
* Does the path reference an object?
*
* @param path Path
* @return {@code true} if the path points to an object
* @throws IOException Error communicating with the file system
*/ | Does the path reference an object | exists | {
"repo_name": "mkambol/pentaho-hadoop-shims",
"path": "common-fragment-V1/src/main/java/org/pentaho/hadoop/shim/api/internal/fs/FileSystem.java",
"license": "apache-2.0",
"size": 2670
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,712,342 |
public void elementDecl(String name, String model) throws SAXException
{
return;
}
| void function(String name, String model) throws SAXException { return; } | /**
* Does nothing.
* @see org.xml.sax.ext.DeclHandler#elementDecl(String, String)
*/ | Does nothing | elementDecl | {
"repo_name": "srnsw/xena",
"path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xml/serializer/ToHTMLSAXHandler.java",
"license": "gpl-3.0",
"size": 23281
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,122,632 |
private static void randomizeFetchSourceContextParams(Consumer<FetchSourceContext> consumer, Map<String, String> expectedParams) {
if (randomBoolean()) {
if (randomBoolean()) {
boolean fetchSource = randomBoolean();
consumer.accept(new FetchSourceContext(fetchSource));
if (fetchSource == false) {
expectedParams.put("_source", "false");
}
} else {
int numIncludes = randomIntBetween(0, 5);
String[] includes = new String[numIncludes];
String includesParam = randomFields(includes);
if (numIncludes > 0) {
expectedParams.put("_source_include", includesParam);
}
int numExcludes = randomIntBetween(0, 5);
String[] excludes = new String[numExcludes];
String excludesParam = randomFields(excludes);
if (numExcludes > 0) {
expectedParams.put("_source_exclude", excludesParam);
}
consumer.accept(new FetchSourceContext(true, includes, excludes));
}
}
} | static void function(Consumer<FetchSourceContext> consumer, Map<String, String> expectedParams) { if (randomBoolean()) { if (randomBoolean()) { boolean fetchSource = randomBoolean(); consumer.accept(new FetchSourceContext(fetchSource)); if (fetchSource == false) { expectedParams.put(STR, "false"); } } else { int numIncludes = randomIntBetween(0, 5); String[] includes = new String[numIncludes]; String includesParam = randomFields(includes); if (numIncludes > 0) { expectedParams.put(STR, includesParam); } int numExcludes = randomIntBetween(0, 5); String[] excludes = new String[numExcludes]; String excludesParam = randomFields(excludes); if (numExcludes > 0) { expectedParams.put(STR, excludesParam); } consumer.accept(new FetchSourceContext(true, includes, excludes)); } } } | /**
* Randomize the {@link FetchSourceContext} request parameters.
*/ | Randomize the <code>FetchSourceContext</code> request parameters | randomizeFetchSourceContextParams | {
"repo_name": "scottsom/elasticsearch",
"path": "client/rest-high-level/src/test/java/org/elasticsearch/client/RequestTests.java",
"license": "apache-2.0",
"size": 69387
} | [
"java.util.Map",
"java.util.function.Consumer",
"org.elasticsearch.search.fetch.subphase.FetchSourceContext"
] | import java.util.Map; import java.util.function.Consumer; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; | import java.util.*; import java.util.function.*; import org.elasticsearch.search.fetch.subphase.*; | [
"java.util",
"org.elasticsearch.search"
] | java.util; org.elasticsearch.search; | 1,545,246 |
private String deploySourceVDB(String sourceVDBName, String modelName, String dataSourceName, String jndiName, String translator) throws DataVirtUiException {
try {
// Get VDB with the supplied name.
// -- If it already exists, return its status
VDBMetaData sourceVdb = clientAccessor.getClient().getVDB(sourceVDBName,1);
if(sourceVdb!=null) {
String sourceVdbStatus = getVDBStatusMessage(sourceVDBName);
if(!sourceVdbStatus.equals(Constants.SUCCESS)) {
return sourceVdbStatus;
}
return sourceVdbStatus;
}
// Deployment name for vdb must end in '-vdb.xml'.
String deploymentName = sourceVDBName + Constants.DYNAMIC_VDB_SUFFIX;
// Create a new Source VDB to deploy
sourceVdb = vdbHelper.createVdb(sourceVDBName,1,new Properties());
// Create source model - same name as dataSource. Use model name for source mapping - will be unique
ModelMetaData model = vdbHelper.createSourceModel(modelName, modelName, jndiName, translator);
// Adding the SourceModel to the VDB
sourceVdb.addModel(model);
// If it exists, undeploy it
byte[] vdbBytes = vdbHelper.getVdbByteArray(sourceVdb);
// Deploy the VDB
clientAccessor.getClient().deploy(deploymentName, new ByteArrayInputStream(vdbBytes));
// Wait for VDB to finish loading
waitForVDBLoad(sourceVDBName, 1, Constants.VDB_LOADING_TIMEOUT_SECS);
// Get deployed VDB and return status
String vdbStatus = getVDBStatusMessage(sourceVDBName);
if(!vdbStatus.equals(Constants.SUCCESS)) {
return vdbStatus;
}
return Constants.SUCCESS;
} catch (Exception e) {
throw new DataVirtUiException(e.getMessage());
}
} | String function(String sourceVDBName, String modelName, String dataSourceName, String jndiName, String translator) throws DataVirtUiException { try { VDBMetaData sourceVdb = clientAccessor.getClient().getVDB(sourceVDBName,1); if(sourceVdb!=null) { String sourceVdbStatus = getVDBStatusMessage(sourceVDBName); if(!sourceVdbStatus.equals(Constants.SUCCESS)) { return sourceVdbStatus; } return sourceVdbStatus; } String deploymentName = sourceVDBName + Constants.DYNAMIC_VDB_SUFFIX; sourceVdb = vdbHelper.createVdb(sourceVDBName,1,new Properties()); ModelMetaData model = vdbHelper.createSourceModel(modelName, modelName, jndiName, translator); sourceVdb.addModel(model); byte[] vdbBytes = vdbHelper.getVdbByteArray(sourceVdb); clientAccessor.getClient().deploy(deploymentName, new ByteArrayInputStream(vdbBytes)); waitForVDBLoad(sourceVDBName, 1, Constants.VDB_LOADING_TIMEOUT_SECS); String vdbStatus = getVDBStatusMessage(sourceVDBName); if(!vdbStatus.equals(Constants.SUCCESS)) { return vdbStatus; } return Constants.SUCCESS; } catch (Exception e) { throw new DataVirtUiException(e.getMessage()); } } | /**
* Deploys a SourceVDB for the specified dataSource, if it doesnt already exist
* @param sourceVDBName the name of the source VDB
* @param modelName the name of the model
* @param dataSourceName the name of the datasource
* @param jndiName the JNDI name of the datasource
* @param translator the name of the translator
*/ | Deploys a SourceVDB for the specified dataSource, if it doesnt already exist | deploySourceVDB | {
"repo_name": "mdrillin/teiid-authoring",
"path": "teiid-authoring-webapp/src/main/java/org/teiid/authoring/backend/server/services/TeiidService.java",
"license": "apache-2.0",
"size": 45986
} | [
"java.io.ByteArrayInputStream",
"java.util.Properties",
"org.teiid.adminapi.impl.ModelMetaData",
"org.teiid.adminapi.impl.VDBMetaData",
"org.teiid.authoring.share.Constants",
"org.teiid.authoring.share.exceptions.DataVirtUiException"
] | import java.io.ByteArrayInputStream; import java.util.Properties; import org.teiid.adminapi.impl.ModelMetaData; import org.teiid.adminapi.impl.VDBMetaData; import org.teiid.authoring.share.Constants; import org.teiid.authoring.share.exceptions.DataVirtUiException; | import java.io.*; import java.util.*; import org.teiid.adminapi.impl.*; import org.teiid.authoring.share.*; import org.teiid.authoring.share.exceptions.*; | [
"java.io",
"java.util",
"org.teiid.adminapi",
"org.teiid.authoring"
] | java.io; java.util; org.teiid.adminapi; org.teiid.authoring; | 1,198,497 |
public double DistanceFrom(Point2D.Double point) {
return lanes.get(0).GetPoint(0).distance(point);
}
| double function(Point2D.Double point) { return lanes.get(0).GetPoint(0).distance(point); } | /**
* Calculates the distance from the specified point
* @param point
* @return
*/ | Calculates the distance from the specified point | DistanceFrom | {
"repo_name": "rudhir-upretee/Sumo_With_Netsim",
"path": "tools/contributed/trafficmodeler/src/roadnetwork/Edge.java",
"license": "gpl-3.0",
"size": 10631
} | [
"java.awt.geom.Point2D"
] | import java.awt.geom.Point2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,069,536 |
private TridasObject getNewHierarchy(ReplaceHierarchyEvent event)
{
log.debug("Searching webservice for new hierarchy");
// create an entity for reading
WSIEntity entity = new WSIEntity();
entity.setId(event.newParent.getIdentifier().getValue());
if(event.newParent instanceof TridasMeasurementSeries)
{
entity.setType(EntityType.MEASUREMENT_SERIES);
}
else if(event.newParent instanceof TridasRadius)
{
entity.setType(EntityType.RADIUS);
}
else if(event.newParent instanceof TridasSample)
{
entity.setType(EntityType.SAMPLE);
}
else if(event.newParent instanceof TridasElement)
{
entity.setType(EntityType.ELEMENT);
}
else
{
log.error("Unsupported new parent type");
return null;
}
// associate a resource
EntityResource<TridasObject> rsrc = new EntityResource<TridasObject>(entity,
TellervoRequestType.READ, TridasObject.class);
log.debug("Searching webservice for new hierarchy - 2");
// we want it comprehensive
// (because we're asking for a sample and getting back an object->series tree)
rsrc.setProperty(TellervoResourceProperties.ENTITY_REQUEST_FORMAT, TellervoRequestFormat.COMPREHENSIVE);
log.debug("Searching webservice for new hierarchy - 3");
TellervoResourceAccessDialog accdialog = new TellervoResourceAccessDialog(event.parentDialog, rsrc);
log.debug("Searching webservice for new hierarchy - 4");
rsrc.query();
log.debug("Searching webservice for new hierarchy - 5");
accdialog.setVisible(true);
log.debug("Searching webservice for new hierarchy - 6");
TridasObject newHierarchy;
if(accdialog.isSuccessful())
{
log.debug("Searching webservice for new hierarchy - 7");
newHierarchy = rsrc.getAssociatedResult();
}
else
{
log.error("Error loading: " + accdialog.getFailException().getLocalizedMessage());
return null;
}
log.debug("Searching webservice for new hierarchy - 8");
log.debug("New hierarchy found successfully");
return newHierarchy;
} | TridasObject function(ReplaceHierarchyEvent event) { log.debug(STR); WSIEntity entity = new WSIEntity(); entity.setId(event.newParent.getIdentifier().getValue()); if(event.newParent instanceof TridasMeasurementSeries) { entity.setType(EntityType.MEASUREMENT_SERIES); } else if(event.newParent instanceof TridasRadius) { entity.setType(EntityType.RADIUS); } else if(event.newParent instanceof TridasSample) { entity.setType(EntityType.SAMPLE); } else if(event.newParent instanceof TridasElement) { entity.setType(EntityType.ELEMENT); } else { log.error(STR); return null; } EntityResource<TridasObject> rsrc = new EntityResource<TridasObject>(entity, TellervoRequestType.READ, TridasObject.class); log.debug(STR); rsrc.setProperty(TellervoResourceProperties.ENTITY_REQUEST_FORMAT, TellervoRequestFormat.COMPREHENSIVE); log.debug(STR); TellervoResourceAccessDialog accdialog = new TellervoResourceAccessDialog(event.parentDialog, rsrc); log.debug(STR); rsrc.query(); log.debug(STR); accdialog.setVisible(true); log.debug(STR); TridasObject newHierarchy; if(accdialog.isSuccessful()) { log.debug(STR); newHierarchy = rsrc.getAssociatedResult(); } else { log.error(STR + accdialog.getFailException().getLocalizedMessage()); return null; } log.debug(STR); log.debug(STR); return newHierarchy; } | /**
* Get a TridasObject populated with children all the way down to Radius or
* Series. This represents the new hierarchy that we want to use.
*
* @param event
* @return
*/ | Get a TridasObject populated with children all the way down to Radius or Series. This represents the new hierarchy that we want to use | getNewHierarchy | {
"repo_name": "petebrew/tellervo",
"path": "src/main/java/org/tellervo/desktop/io/command/ReplaceHierarchyCommand.java",
"license": "gpl-3.0",
"size": 8415
} | [
"org.tellervo.desktop.io.control.ReplaceHierarchyEvent",
"org.tellervo.desktop.wsi.tellervo.TellervoResourceAccessDialog",
"org.tellervo.desktop.wsi.tellervo.TellervoResourceProperties",
"org.tellervo.desktop.wsi.tellervo.resources.EntityResource",
"org.tellervo.schema.EntityType",
"org.tellervo.schema.TellervoRequestFormat",
"org.tellervo.schema.TellervoRequestType",
"org.tellervo.schema.WSIEntity",
"org.tridas.schema.TridasElement",
"org.tridas.schema.TridasMeasurementSeries",
"org.tridas.schema.TridasObject",
"org.tridas.schema.TridasRadius",
"org.tridas.schema.TridasSample"
] | import org.tellervo.desktop.io.control.ReplaceHierarchyEvent; import org.tellervo.desktop.wsi.tellervo.TellervoResourceAccessDialog; import org.tellervo.desktop.wsi.tellervo.TellervoResourceProperties; import org.tellervo.desktop.wsi.tellervo.resources.EntityResource; import org.tellervo.schema.EntityType; import org.tellervo.schema.TellervoRequestFormat; import org.tellervo.schema.TellervoRequestType; import org.tellervo.schema.WSIEntity; import org.tridas.schema.TridasElement; import org.tridas.schema.TridasMeasurementSeries; import org.tridas.schema.TridasObject; import org.tridas.schema.TridasRadius; import org.tridas.schema.TridasSample; | import org.tellervo.desktop.io.control.*; import org.tellervo.desktop.wsi.tellervo.*; import org.tellervo.desktop.wsi.tellervo.resources.*; import org.tellervo.schema.*; import org.tridas.schema.*; | [
"org.tellervo.desktop",
"org.tellervo.schema",
"org.tridas.schema"
] | org.tellervo.desktop; org.tellervo.schema; org.tridas.schema; | 633,287 |
protected boolean isSessionLocallyTransacted(Session session) {
if (!super.isSessionLocallyTransacted(session)) {
return false;
}
JmsResourceHolder resourceHolder =
(JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory());
return (resourceHolder == null || resourceHolder instanceof LocallyExposedJmsResourceHolder ||
!resourceHolder.containsSession(session));
} | boolean function(Session session) { if (!super.isSessionLocallyTransacted(session)) { return false; } JmsResourceHolder resourceHolder = (JmsResourceHolder) TransactionSynchronizationManager.getResource(getConnectionFactory()); return (resourceHolder == null resourceHolder instanceof LocallyExposedJmsResourceHolder !resourceHolder.containsSession(session)); } | /**
* This implementation checks whether the Session is externally synchronized.
* In this case, the Session is not locally transacted, despite the listener
* container's "sessionTransacted" flag being set to "true".
* @see org.springframework.jms.connection.JmsResourceHolder
*/ | This implementation checks whether the Session is externally synchronized. In this case, the Session is not locally transacted, despite the listener container's "sessionTransacted" flag being set to "true" | isSessionLocallyTransacted | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "src/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java",
"license": "apache-2.0",
"size": 19910
} | [
"javax.jms.Session",
"org.springframework.jms.connection.JmsResourceHolder",
"org.springframework.transaction.support.TransactionSynchronizationManager"
] | import javax.jms.Session; import org.springframework.jms.connection.JmsResourceHolder; import org.springframework.transaction.support.TransactionSynchronizationManager; | import javax.jms.*; import org.springframework.jms.connection.*; import org.springframework.transaction.support.*; | [
"javax.jms",
"org.springframework.jms",
"org.springframework.transaction"
] | javax.jms; org.springframework.jms; org.springframework.transaction; | 2,019,761 |
public static TextField<JFormattedTextField> formatted(Format format) {
return new TextField<>(new JFormattedTextField(format));
} | static TextField<JFormattedTextField> function(Format format) { return new TextField<>(new JFormattedTextField(format)); } | /**
* Create a {@link JFormattedTextField} using the specified format.
* @return a {@code TextField} for further configuration
*/ | Create a <code>JFormattedTextField</code> using the specified format | formatted | {
"repo_name": "jonestimd/swing-extensions",
"path": "src/main/java/io/github/jonestimd/swing/component/TextField.java",
"license": "mit",
"size": 7648
} | [
"java.text.Format",
"javax.swing.JFormattedTextField"
] | import java.text.Format; import javax.swing.JFormattedTextField; | import java.text.*; import javax.swing.*; | [
"java.text",
"javax.swing"
] | java.text; javax.swing; | 1,731,250 |
@Override
public IBlockState getFallBlockType(IBlockState myState)
{
return TFCBlocks.Rubble.getDefaultState().withProperty(BlockRubble.META_PROPERTY, myState.getValue(META_PROPERTY));
} | IBlockState function(IBlockState myState) { return TFCBlocks.Rubble.getDefaultState().withProperty(BlockRubble.META_PROPERTY, myState.getValue(META_PROPERTY)); } | /*******************************************************************************
* 1. Content
*******************************************************************************/ | 1. Content | getFallBlockType | {
"repo_name": "CHeuberger/TFC2",
"path": "src/Common/com/bioxx/tfc2/blocks/BlockStoneBrick.java",
"license": "gpl-3.0",
"size": 2309
} | [
"com.bioxx.tfc2.TFCBlocks",
"com.bioxx.tfc2.blocks.terrain.BlockRubble",
"net.minecraft.block.state.IBlockState"
] | import com.bioxx.tfc2.TFCBlocks; import com.bioxx.tfc2.blocks.terrain.BlockRubble; import net.minecraft.block.state.IBlockState; | import com.bioxx.tfc2.*; import com.bioxx.tfc2.blocks.terrain.*; import net.minecraft.block.state.*; | [
"com.bioxx.tfc2",
"net.minecraft.block"
] | com.bioxx.tfc2; net.minecraft.block; | 1,345,376 |
private static int resultToCause(int rc) {
switch (rc) {
case Activity.RESULT_OK:
case Intents.RESULT_SMS_HANDLED:
// Cause code is ignored on success.
return 0;
case Intents.RESULT_SMS_OUT_OF_MEMORY:
return CommandsInterface.GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED;
case Intents.RESULT_SMS_GENERIC_ERROR:
default:
return CommandsInterface.GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR;
}
} | static int function(int rc) { switch (rc) { case Activity.RESULT_OK: case Intents.RESULT_SMS_HANDLED: return 0; case Intents.RESULT_SMS_OUT_OF_MEMORY: return CommandsInterface.GSM_SMS_FAIL_CAUSE_MEMORY_CAPACITY_EXCEEDED; case Intents.RESULT_SMS_GENERIC_ERROR: default: return CommandsInterface.GSM_SMS_FAIL_CAUSE_UNSPECIFIED_ERROR; } } | /**
* Convert Android result code to 3GPP SMS failure cause.
* @param rc the Android SMS intent result value
* @return 0 for success, or a 3GPP SMS failure cause value
*/ | Convert Android result code to 3GPP SMS failure cause | resultToCause | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/internal/telephony/gsm/GsmInboundSmsHandler.java",
"license": "apache-2.0",
"size": 6942
} | [
"android.app.Activity",
"android.provider.Telephony",
"com.android.internal.telephony.CommandsInterface"
] | import android.app.Activity; import android.provider.Telephony; import com.android.internal.telephony.CommandsInterface; | import android.app.*; import android.provider.*; import com.android.internal.telephony.*; | [
"android.app",
"android.provider",
"com.android.internal"
] | android.app; android.provider; com.android.internal; | 2,159,268 |
EClass getText(); | EClass getText(); | /**
* Returns the meta object for class '{@link fr.obeo.dsl.game.Text <em>Text</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Text</em>'.
* @see fr.obeo.dsl.game.Text
* @generated
*/ | Returns the meta object for class '<code>fr.obeo.dsl.game.Text Text</code>'. | getText | {
"repo_name": "Obeo/Game-Designer",
"path": "plugins/fr.obeo.dsl.game/src-gen/fr/obeo/dsl/game/GamePackage.java",
"license": "epl-1.0",
"size": 149639
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,371,719 |
public T caseHandler(Handler object) {
return null;
} | T function(Handler object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Handler</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Handler</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Handler'. This implementation returns null; returning a non-null result will terminate the switch. | caseHandler | {
"repo_name": "markus1978/clickwatch",
"path": "core/de.hub.clickwatch.core/src/de/hub/clickwatch/model/util/ClickWatchModelSwitch.java",
"license": "apache-2.0",
"size": 11352
} | [
"de.hub.clickwatch.model.Handler"
] | import de.hub.clickwatch.model.Handler; | import de.hub.clickwatch.model.*; | [
"de.hub.clickwatch"
] | de.hub.clickwatch; | 56,586 |
public static void populateSpecialFieldMenu(JMenu menu, SpecialField field, JabRefFrame frame) {
menu.setText(field.getMenuString());
menu.setIcon(((IconTheme.FontBasedIcon) field.getRepresentingIcon()).createSmallIcon());
for (SpecialFieldValue val : field.getValues()) {
menu.add(val.getMenuAction(frame));
}
} | static void function(JMenu menu, SpecialField field, JabRefFrame frame) { menu.setText(field.getMenuString()); menu.setIcon(((IconTheme.FontBasedIcon) field.getRepresentingIcon()).createSmallIcon()); for (SpecialFieldValue val : field.getValues()) { menu.add(val.getMenuAction(frame)); } } | /**
* Remove all types from the menu.
* Then cycle through all available values, and add them.
*/ | Remove all types from the menu. Then cycle through all available values, and add them | populateSpecialFieldMenu | {
"repo_name": "mairdl/jabref",
"path": "src/main/java/net/sf/jabref/gui/menus/RightClickMenu.java",
"license": "mit",
"size": 13612
} | [
"javax.swing.JMenu",
"net.sf.jabref.gui.IconTheme",
"net.sf.jabref.gui.JabRefFrame",
"net.sf.jabref.specialfields.SpecialField",
"net.sf.jabref.specialfields.SpecialFieldValue"
] | import javax.swing.JMenu; import net.sf.jabref.gui.IconTheme; import net.sf.jabref.gui.JabRefFrame; import net.sf.jabref.specialfields.SpecialField; import net.sf.jabref.specialfields.SpecialFieldValue; | import javax.swing.*; import net.sf.jabref.gui.*; import net.sf.jabref.specialfields.*; | [
"javax.swing",
"net.sf.jabref"
] | javax.swing; net.sf.jabref; | 229,777 |
private static void compareEmployees(Employee e1, Employee e2) {
assertEquals("The employees' first names don't match!", e1.getFirstName(), e2.getFirstName());
assertEquals("The employees' last names don't match!", e1.getLastName(), e2.getLastName());
assertEquals("The employees' birthdates don't match!", e1.getBirthDate(), e2.getBirthDate());
assertEquals("The employees' genders don't match!", e1.getGender(), e2.getGender());
assertEquals("The employees' job titles don't match!", e1.getJobTitle(), e2.getJobTitle());
assertEquals("The employees' salaries don't match!", e1.getSalary(), e2.getSalary(),
getEpsilon(Float.TYPE).floatValue());
} | static void function(Employee e1, Employee e2) { assertEquals(STR, e1.getFirstName(), e2.getFirstName()); assertEquals(STR, e1.getLastName(), e2.getLastName()); assertEquals(STR, e1.getBirthDate(), e2.getBirthDate()); assertEquals(STR, e1.getGender(), e2.getGender()); assertEquals(STR, e1.getJobTitle(), e2.getJobTitle()); assertEquals(STR, e1.getSalary(), e2.getSalary(), getEpsilon(Float.TYPE).floatValue()); } | /**
* Compares two persons via assertions.
*
* @param e1
* @param e2
*/ | Compares two persons via assertions | compareEmployees | {
"repo_name": "gammalgris/jmul",
"path": "Utilities/Persistence-Tests/src/test/jmul/persistence/scenarios/scenario007/Scenario007SerializationTest.java",
"license": "gpl-3.0",
"size": 6471
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 849,688 |
@Nonnull
public static String spoiler(@Nonnull String input)
{
String sanitized = MarkdownSanitizer.escape(input, ~MarkdownSanitizer.SPOILER);
return "||" + sanitized + "||";
} | static String function(@Nonnull String input) { String sanitized = MarkdownSanitizer.escape(input, ~MarkdownSanitizer.SPOILER); return " " + sanitized + " "; } | /**
* Escapes already existing spoiler regions in the input
* and applies spoiler formatting to the entire string.
* <br>The resulting string will be {@code "||" + escaped(input) + "||"}.
*
* @param input
* The input to spoiler
*
* @return The resulting output
*/ | Escapes already existing spoiler regions in the input and applies spoiler formatting to the entire string. The resulting string will be "||" + escaped(input) + "||" | spoiler | {
"repo_name": "DV8FromTheWorld/JDA",
"path": "src/main/java/net/dv8tion/jda/api/utils/MarkdownUtil.java",
"license": "apache-2.0",
"size": 6806
} | [
"javax.annotation.Nonnull"
] | import javax.annotation.Nonnull; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,183,188 |
public static InternalSession getSession()
{
InternalSession session = SESSION.get();
if (session == null)
{
throw new IllegalStateException("session == null"); //$NON-NLS-1$
}
return session;
} | static InternalSession function() { InternalSession session = SESSION.get(); if (session == null) { throw new IllegalStateException(STR); } return session; } | /**
* Returns the session associated with the current thread.
*
* @return Never <code>null</code>.
* @throws IllegalStateException
* if no session is associated with the current thread.
* @since 3.0
*/ | Returns the session associated with the current thread | getSession | {
"repo_name": "IHTSDO/snow-owl",
"path": "dependencies/org.eclipse.emf.cdo.server/src/org/eclipse/emf/cdo/server/StoreThreadLocal.java",
"license": "apache-2.0",
"size": 3254
} | [
"org.eclipse.emf.cdo.spi.server.InternalSession"
] | import org.eclipse.emf.cdo.spi.server.InternalSession; | import org.eclipse.emf.cdo.spi.server.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,815,353 |
public long write(OutputStream out, Iterator<DiffEntry> changes) throws IOException {
final ObjectDatabase objectDatabase = repository.objectDatabase();
out = new CountingOutputStream(out);
// avoids sending the same metadata object multiple times
Set<ObjectId> writtenMetadataIds = new HashSet<ObjectId>();
// buffer to avoid ObjectId cloning its internal state for each object
byte[] oidbuffer = new byte[ObjectId.NUM_BYTES];
long objectCount = 0;
while (changes.hasNext()) {
DiffEntry diff = changes.next();
if (diff.isDelete()) {
out.write(CHUNK_TYPE.DIFF_ENTRY.value());
} else {
// its a change or an addition, new object is guaranteed to be present
NodeRef newObject = diff.getNewObject();
ObjectId metadataId = newObject.getMetadataId();
if (writtenMetadataIds.contains(metadataId)) {
out.write(CHUNK_TYPE.OBJECT_AND_DIFF_ENTRY.value());
} else {
out.write(CHUNK_TYPE.METADATA_OBJECT_AND_DIFF_ENTRY.value());
RevObject metadata = objectDatabase.get(metadataId);
writeObjectId(metadataId, out, oidbuffer);
serializer.write(metadata, out);
writtenMetadataIds.add(metadataId);
objectCount++;
}
ObjectId objectId = newObject.objectId();
writeObjectId(objectId, out, oidbuffer);
RevObject object = objectDatabase.get(objectId);
serializer.write(object, out);
objectCount++;
}
DataOutput dataOut = new DataOutputStream(out);
FormatCommonV1.writeDiff(diff, dataOut);
}
// signal the end of changes
out.write(CHUNK_TYPE.FILTER_FLAG.value());
final boolean filtersApplied = changes instanceof FilteredDiffIterator
&& ((FilteredDiffIterator) changes).wasFiltered();
out.write(filtersApplied ? 1 : 0);
LOGGER.info(String.format("Written %,d bytes to remote accounting for %,d objects.",
((CountingOutputStream) out).getCount(), objectCount));
return objectCount;
} | long function(OutputStream out, Iterator<DiffEntry> changes) throws IOException { final ObjectDatabase objectDatabase = repository.objectDatabase(); out = new CountingOutputStream(out); Set<ObjectId> writtenMetadataIds = new HashSet<ObjectId>(); byte[] oidbuffer = new byte[ObjectId.NUM_BYTES]; long objectCount = 0; while (changes.hasNext()) { DiffEntry diff = changes.next(); if (diff.isDelete()) { out.write(CHUNK_TYPE.DIFF_ENTRY.value()); } else { NodeRef newObject = diff.getNewObject(); ObjectId metadataId = newObject.getMetadataId(); if (writtenMetadataIds.contains(metadataId)) { out.write(CHUNK_TYPE.OBJECT_AND_DIFF_ENTRY.value()); } else { out.write(CHUNK_TYPE.METADATA_OBJECT_AND_DIFF_ENTRY.value()); RevObject metadata = objectDatabase.get(metadataId); writeObjectId(metadataId, out, oidbuffer); serializer.write(metadata, out); writtenMetadataIds.add(metadataId); objectCount++; } ObjectId objectId = newObject.objectId(); writeObjectId(objectId, out, oidbuffer); RevObject object = objectDatabase.get(objectId); serializer.write(object, out); objectCount++; } DataOutput dataOut = new DataOutputStream(out); FormatCommonV1.writeDiff(diff, dataOut); } out.write(CHUNK_TYPE.FILTER_FLAG.value()); final boolean filtersApplied = changes instanceof FilteredDiffIterator && ((FilteredDiffIterator) changes).wasFiltered(); out.write(filtersApplied ? 1 : 0); LOGGER.info(String.format(STR, ((CountingOutputStream) out).getCount(), objectCount)); return objectCount; } | /**
* Writes the set of changes to the provided output stream.
*
* @param out the stream to write to
* @param changes the changes to write
* @throws IOException
* @return the number of objects written
*/ | Writes the set of changes to the provided output stream | write | {
"repo_name": "smesdaghi/geogig",
"path": "src/core/src/main/java/org/locationtech/geogig/remote/BinaryPackedChanges.java",
"license": "bsd-3-clause",
"size": 11376
} | [
"com.google.common.io.CountingOutputStream",
"java.io.DataOutput",
"java.io.DataOutputStream",
"java.io.IOException",
"java.io.OutputStream",
"java.util.HashSet",
"java.util.Iterator",
"java.util.Set",
"org.locationtech.geogig.api.NodeRef",
"org.locationtech.geogig.api.ObjectId",
"org.locationtech.geogig.api.RevObject",
"org.locationtech.geogig.api.plumbing.diff.DiffEntry",
"org.locationtech.geogig.storage.ObjectDatabase",
"org.locationtech.geogig.storage.datastream.FormatCommonV1"
] | import com.google.common.io.CountingOutputStream; import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.locationtech.geogig.api.NodeRef; import org.locationtech.geogig.api.ObjectId; import org.locationtech.geogig.api.RevObject; import org.locationtech.geogig.api.plumbing.diff.DiffEntry; import org.locationtech.geogig.storage.ObjectDatabase; import org.locationtech.geogig.storage.datastream.FormatCommonV1; | import com.google.common.io.*; import java.io.*; import java.util.*; import org.locationtech.geogig.api.*; import org.locationtech.geogig.api.plumbing.diff.*; import org.locationtech.geogig.storage.*; import org.locationtech.geogig.storage.datastream.*; | [
"com.google.common",
"java.io",
"java.util",
"org.locationtech.geogig"
] | com.google.common; java.io; java.util; org.locationtech.geogig; | 2,461,080 |
public void addToMenu(int menuID, JMenuItem entry)
{
if (menuID < 0 || menus.length <= menuID)
throw new IllegalArgumentException("Invalid menu id: "+menuID+".");
if (entry == null)
throw new NullPointerException("No entry");
menus[menuID].add(entry);
Iterator<JMenu> i;
JMenu menu;
if (menuID == WINDOW_MENU) {
i = windowMenus.iterator();
while (i.hasNext()) {
menu = i.next();
if (entry instanceof JMenu)
menu.add(copyItemsFromMenu((JMenu) entry));
else
menu.add(copyItem(entry));
}
} else if (menuID == HELP_MENU) {
i = helpMenus.iterator();
while (i.hasNext()) {
menu = i.next();
if (entry instanceof JMenu)
menu.add(copyItemsFromMenu((JMenu) entry));
else
menu.add(copyItem(entry));
}
}
} | void function(int menuID, JMenuItem entry) { if (menuID < 0 menus.length <= menuID) throw new IllegalArgumentException(STR+menuID+"."); if (entry == null) throw new NullPointerException(STR); menus[menuID].add(entry); Iterator<JMenu> i; JMenu menu; if (menuID == WINDOW_MENU) { i = windowMenus.iterator(); while (i.hasNext()) { menu = i.next(); if (entry instanceof JMenu) menu.add(copyItemsFromMenu((JMenu) entry)); else menu.add(copyItem(entry)); } } else if (menuID == HELP_MENU) { i = helpMenus.iterator(); while (i.hasNext()) { menu = i.next(); if (entry instanceof JMenu) menu.add(copyItemsFromMenu((JMenu) entry)); else menu.add(copyItem(entry)); } } } | /**
* Implemented as specified by {@link TaskBar}.
* @see TaskBar#addToMenu(int, JMenuItem)
*/ | Implemented as specified by <code>TaskBar</code> | addToMenu | {
"repo_name": "jballanc/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/ui/TaskBarView.java",
"license": "gpl-2.0",
"size": 21196
} | [
"java.util.Iterator",
"javax.swing.JMenu",
"javax.swing.JMenuItem"
] | import java.util.Iterator; import javax.swing.JMenu; import javax.swing.JMenuItem; | import java.util.*; import javax.swing.*; | [
"java.util",
"javax.swing"
] | java.util; javax.swing; | 1,391,744 |
if (profile != null)
return profile;
// initialize all profiles that will be following another user
List<Profile> profiles = new ArrayList<>();
// whether the database needs to be reset and have these profiles be recreated
boolean needToReset = false;
for (int i = 0; i < 15; ++i){
Profile profile = new Profile("vfutest" + i);
Map<String, String> map = new HashMap<>();
map.put("name", profile.getName());
Pair<Profile, Boolean> result = ElasticSearchUtilities.getObject(Profile.TYPE_ID, Profile.class, map);
assertTrue("database error", result.second);
if (result.first != null) {
profile = result.first;
if (i == 2){
profiles.get(1).addFollowRequest(profiles.get(0));
Thread.sleep(200);
profiles.get(1).acceptFollowRequest(profiles.get(0));
}
} else {
assertTrue("database error", profile.save());
needToReset = true;
}
profiles.add(profile);
}
if (needToReset) {
Thread.sleep(1000);
// remove existing follows from previous runs
for (int i = 0; i < profiles.size(); ++i) {
Map<String, String> map = new HashMap<>();
map.put("followerId", profiles.get(i).getId());
ElasticSearchUtilities.delete(Follow.TYPE_ID, Follow.class, map);
map.clear();
map.put("followeeId", profiles.get(i).getId());
ElasticSearchUtilities.delete(Follow.TYPE_ID, Follow.class, map);
}
// for all profiles, generate 3 habits for the test
for (int i = 0; i < profiles.size(); ++i) {
for (int x = 0; x < 3; ++x) {
String habitName = new StringBuilder(profiles.get(i).getId()).reverse().toString();
profiles.get(i).addHabit(new Habit(habitName, "", new Date(), new ArrayList<Integer>(), "xyz"));
if (x == 1) {
profiles.get(i).getHabits().get(x).addHabitEvent(new HabitEvent("xyz"));
}
}
}
// make the first profile follow all the other ones
for (int i = 1; i < profiles.size(); ++i) {
profiles.get(i).addFollowRequest(profiles.get(0));
Thread.sleep(200);
profiles.get(i).acceptFollowRequest(profiles.get(0));
}
// save all profiles due to how follow information is stored
// necessary for added habits and events to be visible when followed profiles are requested
for (int i = 0; i < profiles.size(); ++i)
assertTrue("database error", profiles.get(i).save());
Thread.sleep(1000);
}
profile = profiles.get(0);
return profile;
} | if (profile != null) return profile; List<Profile> profiles = new ArrayList<>(); boolean needToReset = false; for (int i = 0; i < 15; ++i){ Profile profile = new Profile(STR + i); Map<String, String> map = new HashMap<>(); map.put("name", profile.getName()); Pair<Profile, Boolean> result = ElasticSearchUtilities.getObject(Profile.TYPE_ID, Profile.class, map); assertTrue(STR, result.second); if (result.first != null) { profile = result.first; if (i == 2){ profiles.get(1).addFollowRequest(profiles.get(0)); Thread.sleep(200); profiles.get(1).acceptFollowRequest(profiles.get(0)); } } else { assertTrue(STR, profile.save()); needToReset = true; } profiles.add(profile); } if (needToReset) { Thread.sleep(1000); for (int i = 0; i < profiles.size(); ++i) { Map<String, String> map = new HashMap<>(); map.put(STR, profiles.get(i).getId()); ElasticSearchUtilities.delete(Follow.TYPE_ID, Follow.class, map); map.clear(); map.put(STR, profiles.get(i).getId()); ElasticSearchUtilities.delete(Follow.TYPE_ID, Follow.class, map); } for (int i = 0; i < profiles.size(); ++i) { for (int x = 0; x < 3; ++x) { String habitName = new StringBuilder(profiles.get(i).getId()).reverse().toString(); profiles.get(i).addHabit(new Habit(habitName, STRxyzSTRxyz")); } } } for (int i = 1; i < profiles.size(); ++i) { profiles.get(i).addFollowRequest(profiles.get(0)); Thread.sleep(200); profiles.get(i).acceptFollowRequest(profiles.get(0)); } for (int i = 0; i < profiles.size(); ++i) assertTrue(STR, profiles.get(i).save()); Thread.sleep(1000); } profile = profiles.get(0); return profile; } | /**
* initialize all necessary profiles if they have not been yet
* @return the profile that is following all the other profiles
* @throws InterruptedException
*/ | initialize all necessary profiles if they have not been yet | init | {
"repo_name": "CMPUT301F17T15/CIA",
"path": "app/src/androidTest/java/com/cmput301/cia/intent/ViewFollowedUsersIntentTests.java",
"license": "mit",
"size": 10846
} | [
"android.util.Pair",
"com.cmput301.cia.models.Follow",
"com.cmput301.cia.models.Habit",
"com.cmput301.cia.models.Profile",
"com.cmput301.cia.utilities.ElasticSearchUtilities",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import android.util.Pair; import com.cmput301.cia.models.Follow; import com.cmput301.cia.models.Habit; import com.cmput301.cia.models.Profile; import com.cmput301.cia.utilities.ElasticSearchUtilities; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; | import android.util.*; import com.cmput301.cia.models.*; import com.cmput301.cia.utilities.*; import java.util.*; | [
"android.util",
"com.cmput301.cia",
"java.util"
] | android.util; com.cmput301.cia; java.util; | 120,921 |
public static IElementDefn getElementDefn( String elementName )
{
IElementDefn defn = getMetaDataDictionary( ).getElement( elementName );
if ( defn == null )
{
defn = getMetaDataDictionary( ).getExtension( elementName );
}
return defn;
} | static IElementDefn function( String elementName ) { IElementDefn defn = getMetaDataDictionary( ).getElement( elementName ); if ( defn == null ) { defn = getMetaDataDictionary( ).getExtension( elementName ); } return defn; } | /**
* Gets the definition for the element with the specified name
*
* @param elementName
* the name of the element
*
* @return Returns the definition, or null if the element is not defined.
*/ | Gets the definition for the element with the specified name | getElementDefn | {
"repo_name": "sguan-actuate/birt",
"path": "UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/DEUtil.java",
"license": "epl-1.0",
"size": 91152
} | [
"org.eclipse.birt.report.model.api.metadata.IElementDefn"
] | import org.eclipse.birt.report.model.api.metadata.IElementDefn; | import org.eclipse.birt.report.model.api.metadata.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 1,870,388 |
private Uri whichContentStore() {
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else {
return android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI;
}
} | Uri function() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else { return android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI; } } | /**
* Determine if we are storing the images in internal or external storage
* @return Uri
*/ | Determine if we are storing the images in internal or external storage | whichContentStore | {
"repo_name": "agurlazar/prototype-v.0",
"path": "plugins/cordova-plugin-camera/src/android/CameraLauncher.java",
"license": "apache-2.0",
"size": 42997
} | [
"android.net.Uri",
"android.os.Environment",
"android.provider.MediaStore"
] | import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; | import android.net.*; import android.os.*; import android.provider.*; | [
"android.net",
"android.os",
"android.provider"
] | android.net; android.os; android.provider; | 2,055,823 |
private boolean isInternalSymbol(long funcDecl) {
switch (Z3_decl_kind.fromInt(Native.getDeclKind(z3context, funcDecl))) {
case Z3_OP_SELECT:
case Z3_OP_ARRAY_EXT:
return true;
default:
return Z3_IRRELEVANT_MODEL_TERM_PATTERN
.matcher(z3creator.symbolToString(Native.getDeclName(z3context, funcDecl)))
.matches();
}
} | boolean function(long funcDecl) { switch (Z3_decl_kind.fromInt(Native.getDeclKind(z3context, funcDecl))) { case Z3_OP_SELECT: case Z3_OP_ARRAY_EXT: return true; default: return Z3_IRRELEVANT_MODEL_TERM_PATTERN .matcher(z3creator.symbolToString(Native.getDeclName(z3context, funcDecl))) .matches(); } } | /**
* The symbol "!" is part of temporary symbols used for quantified formulas or aliases. This
* method is only a heuristic, because the user can also create a symbol containing "!".
*/ | The symbol "!" is part of temporary symbols used for quantified formulas or aliases. This method is only a heuristic, because the user can also create a symbol containing "!" | isInternalSymbol | {
"repo_name": "sosy-lab/java-smt",
"path": "src/org/sosy_lab/java_smt/solvers/z3/Z3Model.java",
"license": "apache-2.0",
"size": 14611
} | [
"com.microsoft.z3.Native"
] | import com.microsoft.z3.Native; | import com.microsoft.z3.*; | [
"com.microsoft.z3"
] | com.microsoft.z3; | 2,113,825 |
@Override
public void setActiveEditor(IEditorPart part) {
super.setActiveEditor(part);
activeEditorPart = part;
// Switch to the new selection provider.
//
if (selectionProvider != null) {
selectionProvider.removeSelectionChangedListener(this);
}
if (part == null) {
selectionProvider = null;
}
else {
selectionProvider = part.getSite().getSelectionProvider();
selectionProvider.addSelectionChangedListener(this);
// Fake a selection changed event to update the menus.
//
if (selectionProvider.getSelection() != null) {
selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection()));
}
}
} | void function(IEditorPart part) { super.setActiveEditor(part); activeEditorPart = part; selectionProvider.removeSelectionChangedListener(this); } if (part == null) { selectionProvider = null; } else { selectionProvider = part.getSite().getSelectionProvider(); selectionProvider.addSelectionChangedListener(this); selectionChanged(new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection())); } } } | /**
* When the active editor changes, this remembers the change and registers with it as a selection provider.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | When the active editor changes, this remembers the change and registers with it as a selection provider. | setActiveEditor | {
"repo_name": "KAMP-Research/KAMP",
"path": "bundles/Toometa/toometa.glossary.editor/src/glossary/presentation/GlossaryActionBarContributor.java",
"license": "apache-2.0",
"size": 13957
} | [
"org.eclipse.jface.viewers.SelectionChangedEvent",
"org.eclipse.ui.IEditorPart"
] | import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.ui.IEditorPart; | import org.eclipse.jface.viewers.*; import org.eclipse.ui.*; | [
"org.eclipse.jface",
"org.eclipse.ui"
] | org.eclipse.jface; org.eclipse.ui; | 873,032 |
void onRenderedFirstFrame(Surface surface); | void onRenderedFirstFrame(Surface surface); | /**
* Called when a frame is rendered for the first time since setting the surface, and when a frame
* is rendered for the first time since the renderer was reset.
*
* @param surface The {@link Surface} to which a first frame has been rendered, or {@code null} if
* the renderer renders to something that isn't a {@link Surface}.
*/ | Called when a frame is rendered for the first time since setting the surface, and when a frame is rendered for the first time since the renderer was reset | onRenderedFirstFrame | {
"repo_name": "profosure/porogram",
"path": "TMessagesProj/src/main/java/com/porogram/profosure1/messenger/exoplayer2/video/VideoRendererEventListener.java",
"license": "gpl-2.0",
"size": 8215
} | [
"android.view.Surface"
] | import android.view.Surface; | import android.view.*; | [
"android.view"
] | android.view; | 215,228 |
public static Long getNodePropertySize(final Node node)
throws RepositoryException {
Long size = 0L;
for (final PropertyIterator i = node.getProperties(); i.hasNext();) {
final Property p = i.nextProperty();
if (p.isMultiple()) {
for (final Value v : p.getValues()) {
size += v.getBinary().getSize();
}
} else {
size += p.getBinary().getSize();
}
}
return size;
} | static Long function(final Node node) throws RepositoryException { Long size = 0L; for (final PropertyIterator i = node.getProperties(); i.hasNext();) { final Property p = i.nextProperty(); if (p.isMultiple()) { for (final Value v : p.getValues()) { size += v.getBinary().getSize(); } } else { size += p.getBinary().getSize(); } } return size; } | /**
* Get the total size of a Node's properties
*
* @param node the node
* @return size in bytes
* @throws RepositoryException if repository exception occurred
*/ | Get the total size of a Node's properties | getNodePropertySize | {
"repo_name": "ruebot/fcrepo4",
"path": "fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ServiceHelpers.java",
"license": "apache-2.0",
"size": 6499
} | [
"javax.jcr.Node",
"javax.jcr.Property",
"javax.jcr.PropertyIterator",
"javax.jcr.RepositoryException",
"javax.jcr.Value"
] | import javax.jcr.Node; import javax.jcr.Property; import javax.jcr.PropertyIterator; import javax.jcr.RepositoryException; import javax.jcr.Value; | import javax.jcr.*; | [
"javax.jcr"
] | javax.jcr; | 2,728,477 |
protected String doIt() throws Exception
{
String[] tables = new String[] {"AD_Window_Access", "AD_Process_Access", "AD_Form_Access",
"AD_Workflow_Access", "AD_Task_Access", "AD_Document_Action_Access",
X_AD_Role_Included.Table_Name,
};
String[] keycolumns = new String[] {"AD_Window_ID", "AD_Process_ID", "AD_Form_ID",
"AD_Workflow_ID", "AD_Task_ID", "C_DocType_ID, AD_Ref_List_ID",
X_AD_Role_Included.COLUMNNAME_Included_Role_ID,
};
int action = 0;
for ( int i = 0; i < tables.length; i++ )
{
String table = tables[i];
String keycolumn = keycolumns[i];
String sql = "DELETE FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_To;
int no = DB.executeUpdateEx(sql, get_TrxName());
addLog(action++, null, BigDecimal.valueOf(no), "Old records deleted from " + table );
final boolean column_IsReadWrite =
!table.equals("AD_Document_Action_Access")
&& !table.equals(X_AD_Role_Included.Table_Name);
final boolean column_SeqNo = table.equals(X_AD_Role_Included.Table_Name);
sql = "INSERT INTO " + table
+ " (AD_Client_ID, AD_Org_ID, Created, CreatedBy, Updated, UpdatedBy, "
+ "AD_Role_ID, " + keycolumn +", isActive";
if (column_SeqNo)
sql += ", SeqNo ";
if (column_IsReadWrite)
sql += ", isReadWrite) ";
else
sql += ") ";
sql += "SELECT " + m_AD_Client_ID
+ ", "+ m_AD_Org_ID
+ ", getdate(), "+ Env.getAD_User_ID(Env.getCtx())
+ ", getdate(), "+ Env.getAD_User_ID(Env.getCtx())
+ ", " + m_AD_Role_ID_To
+ ", " + keycolumn
+ ", IsActive ";
if (column_SeqNo)
sql += ", SeqNo ";
if (column_IsReadWrite)
sql += ", isReadWrite ";
sql += "FROM " + table + " WHERE AD_Role_ID = " + m_AD_Role_ID_From;
no = DB.executeUpdateEx (sql, get_TrxName());
addLog(action++, null, new BigDecimal(no), "New records inserted into " + table );
}
return "Role copied";
} // doIt | String function() throws Exception { String[] tables = new String[] {STR, STR, STR, STR, STR, STR, X_AD_Role_Included.Table_Name, }; String[] keycolumns = new String[] {STR, STR, STR, STR, STR, STR, X_AD_Role_Included.COLUMNNAME_Included_Role_ID, }; int action = 0; for ( int i = 0; i < tables.length; i++ ) { String table = tables[i]; String keycolumn = keycolumns[i]; String sql = STR + table + STR + m_AD_Role_ID_To; int no = DB.executeUpdateEx(sql, get_TrxName()); addLog(action++, null, BigDecimal.valueOf(no), STR + table ); final boolean column_IsReadWrite = !table.equals(STR) && !table.equals(X_AD_Role_Included.Table_Name); final boolean column_SeqNo = table.equals(X_AD_Role_Included.Table_Name); sql = STR + table + STR + STR + keycolumn +STR; if (column_SeqNo) sql += STR; if (column_IsReadWrite) sql += STR; else sql += STR; sql += STR + m_AD_Client_ID + STR+ m_AD_Org_ID + STR+ Env.getAD_User_ID(Env.getCtx()) + STR+ Env.getAD_User_ID(Env.getCtx()) + STR + m_AD_Role_ID_To + STR + keycolumn + STR; if (column_SeqNo) sql += STR; if (column_IsReadWrite) sql += STR; sql += STR + table + STR + m_AD_Role_ID_From; no = DB.executeUpdateEx (sql, get_TrxName()); addLog(action++, null, new BigDecimal(no), STR + table ); } return STR; } | /**
* Copy the role access records
* @return info
* @throws Exception
*/ | Copy the role access records | doIt | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-legacy/org/compiere/process/CopyRole.java",
"license": "gpl-2.0",
"size": 4661
} | [
"java.math.BigDecimal",
"org.compiere.util.DB",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.DB; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 2,741,753 |
private void assignDoubleNullsNoRepeatingNoSelection(int keyIndex, int index, int size,
DoubleColumnVector columnVector) {
for(int r = 0; r < size; ++r) {
if (!columnVector.isNull[r]) {
vectorHashKeyWrappers[r].assignDouble(index, columnVector.vector[r]);
} else {
vectorHashKeyWrappers[r].assignNullDouble(keyIndex, index);
}
}
} | void function(int keyIndex, int index, int size, DoubleColumnVector columnVector) { for(int r = 0; r < size; ++r) { if (!columnVector.isNull[r]) { vectorHashKeyWrappers[r].assignDouble(index, columnVector.vector[r]); } else { vectorHashKeyWrappers[r].assignNullDouble(keyIndex, index); } } } | /**
* Helper method to assign values from a vector column into the key wrapper.
* Optimized for Double type, possible nulls, repeat values.
*/ | Helper method to assign values from a vector column into the key wrapper. Optimized for Double type, possible nulls, repeat values | assignDoubleNullsNoRepeatingNoSelection | {
"repo_name": "sankarh/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/exec/vector/wrapper/VectorHashKeyWrapperBatch.java",
"license": "apache-2.0",
"size": 41372
} | [
"org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector"
] | import org.apache.hadoop.hive.ql.exec.vector.DoubleColumnVector; | import org.apache.hadoop.hive.ql.exec.vector.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 912,105 |
public boolean hasTitle(org.ontoware.rdf2go.model.node.Node value) {
return Base.hasValue(this.model, this.getResource(), TITLE, value);
} | boolean function(org.ontoware.rdf2go.model.node.Node value) { return Base.hasValue(this.model, this.getResource(), TITLE, value); } | /**
* Check if org.ontoware.rdfreactor.generator.java.JProperty@5bbe2ed3 has
* the given value (maybe among other values).
*
* @param value
* the value to be checked
* @return true if this property contains (maybe among other) the given
* value
*
* [Generated from RDFReactor template rule #get0has-value-dynamic]
*/ | Check if org.ontoware.rdfreactor.generator.java.JProperty@5bbe2ed3 has the given value (maybe among other values) | hasTitle | {
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-sioc/src/main/java/org/rdfs/sioc/Thing.java",
"license": "mit",
"size": 317844
} | [
"org.ontoware.rdfreactor.runtime.Base"
] | import org.ontoware.rdfreactor.runtime.Base; | import org.ontoware.rdfreactor.runtime.*; | [
"org.ontoware.rdfreactor"
] | org.ontoware.rdfreactor; | 1,084,061 |
protected void showTabs() {
if (getPageCount() > 1) {
setPageText(0, getString("_UI_SelectionPage_label"));
if (getContainer() instanceof CTabFolder) {
((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
Point point = getContainer().getSize();
getContainer().setSize(point.x, point.y - 6);
}
}
} | void function() { if (getPageCount() > 1) { setPageText(0, getString(STR)); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y - 6); } } } | /**
* If there is more than one page in the multi-page editor part,
* this shows the tabs at the bottom.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | If there is more than one page in the multi-page editor part, this shows the tabs at the bottom. | showTabs | {
"repo_name": "aciancone/klapersuite",
"path": "klapersuite.metamodel.klaper.editor/src/klaper/probability/presentation/ProbabilityEditor.java",
"license": "epl-1.0",
"size": 54031
} | [
"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; | 742,190 |
public Dimension getMaximumSize(JComponent a) {
Dimension returnValue =
((ComponentUI) (uis.elementAt(0))).getMaximumSize(a);
for (int i = 1; i < uis.size(); i++) {
((ComponentUI) (uis.elementAt(i))).getMaximumSize(a);
}
return returnValue;
} | Dimension function(JComponent a) { Dimension returnValue = ((ComponentUI) (uis.elementAt(0))).getMaximumSize(a); for (int i = 1; i < uis.size(); i++) { ((ComponentUI) (uis.elementAt(i))).getMaximumSize(a); } return returnValue; } | /**
* Invokes the <code>getMaximumSize</code> method on each UI handled by this object.
*
* @return the value obtained from the first UI, which is
* the UI obtained from the default <code>LookAndFeel</code>
*/ | Invokes the <code>getMaximumSize</code> method on each UI handled by this object | getMaximumSize | {
"repo_name": "isaacl/openjdk-jdk",
"path": "src/share/classes/javax/swing/plaf/multi/MultiLabelUI.java",
"license": "gpl-2.0",
"size": 7557
} | [
"java.awt.Dimension",
"javax.swing.JComponent",
"javax.swing.plaf.ComponentUI"
] | import java.awt.Dimension; import javax.swing.JComponent; import javax.swing.plaf.ComponentUI; | import java.awt.*; import javax.swing.*; import javax.swing.plaf.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,055,812 |
Promise<InfoResponse> info(Path project, String target, String revision, boolean children, @Nullable Credentials credentials); | Promise<InfoResponse> info(Path project, String target, String revision, boolean children, @Nullable Credentials credentials); | /**
* Retrieves the information about repository item.
*
* @param project
* relative path to the project in local workspace
* @param target
* target to operate
* @param revision
* revision, use HEAD to specify latest revision
* @param credentials
* {@link Credentials} object that contains user name and password for authentication
*/ | Retrieves the information about repository item | info | {
"repo_name": "snjeza/che",
"path": "plugins/plugin-svn/che-plugin-svn-ext-ide/src/main/java/org/eclipse/che/plugin/svn/ide/SubversionClientService.java",
"license": "epl-1.0",
"size": 13709
} | [
"org.eclipse.che.api.promises.client.Promise",
"org.eclipse.che.commons.annotation.Nullable",
"org.eclipse.che.ide.api.user.Credentials",
"org.eclipse.che.ide.resource.Path",
"org.eclipse.che.plugin.svn.shared.InfoResponse"
] | import org.eclipse.che.api.promises.client.Promise; import org.eclipse.che.commons.annotation.Nullable; import org.eclipse.che.ide.api.user.Credentials; import org.eclipse.che.ide.resource.Path; import org.eclipse.che.plugin.svn.shared.InfoResponse; | import org.eclipse.che.api.promises.client.*; import org.eclipse.che.commons.annotation.*; import org.eclipse.che.ide.api.user.*; import org.eclipse.che.ide.resource.*; import org.eclipse.che.plugin.svn.shared.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 1,215,231 |
private final String getDateTime() {
final SimpleDateFormat gmtFormat =
new SimpleDateFormat("E, d MMM yyyy HH:mm:ss 'GMT'", Locale.US);
gmtFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
return gmtFormat.format(new Date());
} | final String function() { final SimpleDateFormat gmtFormat = new SimpleDateFormat(STR, Locale.US); gmtFormat.setTimeZone(TimeZone.getTimeZone("GMT")); return gmtFormat.format(new Date()); } | /**
* Get formatted date/time timestamp for http response header.
*
* @return example: Thu, 02 Jan 2014 16:34:42 GMT
*/ | Get formatted date/time timestamp for http response header | getDateTime | {
"repo_name": "PoiXson/NanoHTTPlib",
"path": "core/src/main/java/com/poixson/nanosocket/NanoHTTPserver.java",
"license": "bsd-3-clause",
"size": 26264
} | [
"java.text.SimpleDateFormat",
"java.util.Date",
"java.util.Locale",
"java.util.TimeZone"
] | import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; | import java.text.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 774,742 |
boolean isCompatible(String version) {
// Versions are compatible if they have the same major version no
int currentMajorVersion = NumberUtils.toInt(schemaVersion.substring(0, schemaVersion.indexOf('.')));
int givenMajorVersion = NumberUtils.toInt(version.substring(0, version.indexOf('.')));
return currentMajorVersion == givenMajorVersion;
} | boolean isCompatible(String version) { int currentMajorVersion = NumberUtils.toInt(schemaVersion.substring(0, schemaVersion.indexOf('.'))); int givenMajorVersion = NumberUtils.toInt(version.substring(0, version.indexOf('.'))); return currentMajorVersion == givenMajorVersion; } | /**
* Is the current Index instance compatible with the given version number
*
* @param version The version number to compare the current Index against
*
* @return true if the current major version number is equal to the given
* major version number, otherwise false
*/ | Is the current Index instance compatible with the given version number | isCompatible | {
"repo_name": "eugene7646/autopsy",
"path": "KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Index.java",
"license": "apache-2.0",
"size": 4930
} | [
"org.apache.commons.lang.math.NumberUtils"
] | import org.apache.commons.lang.math.NumberUtils; | import org.apache.commons.lang.math.*; | [
"org.apache.commons"
] | org.apache.commons; | 545,401 |
int port = System.getenv("PORT") != null
? Integer.parseInt(System.getenv("PORT")) : DEFAULT_PORT;
Spark.port(port);
Spark.before(CorsUtil::headers);
Spark.options("
Spark.after(
(req, res) -> {
res.type("application/json");
});
Spark.after(
(req, res) -> {
log.info(AuditUtil.format(req, res));
});
Spark.get(
"/status",
(req, res) -> {
Map<String, String> map = new HashMap<String, String>();
map.put("status", "ok");
return new Gson().toJson(map);
});
Spark.post(
"/talk",
(req, res) -> {
Message user = null;
Message bot = null;
try {
user = new Gson().fromJson(req.body(), Message.class);
} catch (JsonSyntaxException e) {
e.printStackTrace();
}
bot = Logic.talk(user);
return new Gson().toJson(bot);
});
} | int port = System.getenv("PORT") != null ? Integer.parseInt(System.getenv("PORT")) : DEFAULT_PORT; Spark.port(port); Spark.before(CorsUtil::headers); Spark.options(STRapplication/jsonSTR/statusSTRstatusSTRokSTR/talk", (req, res) -> { Message user = null; Message bot = null; try { user = new Gson().fromJson(req.body(), Message.class); } catch (JsonSyntaxException e) { e.printStackTrace(); } bot = Logic.talk(user); return new Gson().toJson(bot); }); } | /**
* The entry point of the APIs.
* This method activates and runs the server.
* @param args
* Unused arguments.
*/ | The entry point of the APIs. This method activates and runs the server | main | {
"repo_name": "curiosone-bot/curiosone-core",
"path": "src/main/java/com/github/bot/curiosone/api/Main.java",
"license": "mit",
"size": 2275
} | [
"com.github.bot.curiosone.core.workflow.Logic",
"com.github.bot.curiosone.core.workflow.Message",
"com.google.gson.Gson",
"com.google.gson.JsonSyntaxException"
] | import com.github.bot.curiosone.core.workflow.Logic; import com.github.bot.curiosone.core.workflow.Message; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; | import com.github.bot.curiosone.core.workflow.*; import com.google.gson.*; | [
"com.github.bot",
"com.google.gson"
] | com.github.bot; com.google.gson; | 2,054,232 |
private void insertMusicPath(String path) {
final Directory directory = new Directory(path);
insertDirectory(directory);
} | void function(String path) { final Directory directory = new Directory(path); insertDirectory(directory); } | /**
* Inserts the given path as a default music directory into the DB.
*
* @param path The path to insert into the DB.
*/ | Inserts the given path as a default music directory into the DB | insertMusicPath | {
"repo_name": "larsdroid/Player",
"path": "app/src/main/java/org/willemsens/player/persistence/MusicDao.java",
"license": "mit",
"size": 16507
} | [
"org.willemsens.player.persistence.entities.Directory"
] | import org.willemsens.player.persistence.entities.Directory; | import org.willemsens.player.persistence.entities.*; | [
"org.willemsens.player"
] | org.willemsens.player; | 379,055 |
protected AvailableImplementations createAvailableImplementations() {
AvailableImplementations available = new AvailableImplementationsImpl();
available.register(
DiscountingInterestRateSwapFn.class,
DiscountingInterestRateSwapCalculatorFactory.class,
DiscountingFXForwardYieldCurveNodeSensitivitiesFn.class,
DiscountingFXForwardSpotPnLSeriesFn.class,
DiscountingFXForwardYCNSPnLSeriesFn.class,
DiscountingFXForwardPVFn.class,
DefaultFXReturnSeriesFn.class,
DefaultCurrencyPairsFn.class,
DefaultEquityPresentValueFn.class,
FXForwardSecurityConverter.class,
ConfigDBInstrumentExposuresProvider.class,
DefaultCurveSpecificationMarketDataFn.class,
DefaultFXMatrixFn.class,
DefaultCurveDefinitionFn.class,
CurveDefinitionCurveLabellingFn.class,
DefaultDiscountingMulticurveBundleFn.class,
DefaultDiscountingMulticurveBundleResolverFn.class,
DefaultCurveSpecificationFn.class,
ConfigDBCurveConstructionConfigurationSource.class,
DefaultFixingsFn.class,
FXForwardDiscountingCalculatorFn.class,
ExposureFunctionsDiscountingMulticurveCombinerFn.class,
DefaultMarketDataFn.class,
DefaultHistoricalMarketDataFn.class,
DefaultCurveNodeConverterFn.class,
DefaultInterestRateSwapConverterFn.class,
DefaultHistoricalPnLFXConverterFn.class);
return available;
} | AvailableImplementations function() { AvailableImplementations available = new AvailableImplementationsImpl(); available.register( DiscountingInterestRateSwapFn.class, DiscountingInterestRateSwapCalculatorFactory.class, DiscountingFXForwardYieldCurveNodeSensitivitiesFn.class, DiscountingFXForwardSpotPnLSeriesFn.class, DiscountingFXForwardYCNSPnLSeriesFn.class, DiscountingFXForwardPVFn.class, DefaultFXReturnSeriesFn.class, DefaultCurrencyPairsFn.class, DefaultEquityPresentValueFn.class, FXForwardSecurityConverter.class, ConfigDBInstrumentExposuresProvider.class, DefaultCurveSpecificationMarketDataFn.class, DefaultFXMatrixFn.class, DefaultCurveDefinitionFn.class, CurveDefinitionCurveLabellingFn.class, DefaultDiscountingMulticurveBundleFn.class, DefaultDiscountingMulticurveBundleResolverFn.class, DefaultCurveSpecificationFn.class, ConfigDBCurveConstructionConfigurationSource.class, DefaultFixingsFn.class, FXForwardDiscountingCalculatorFn.class, ExposureFunctionsDiscountingMulticurveCombinerFn.class, DefaultMarketDataFn.class, DefaultHistoricalMarketDataFn.class, DefaultCurveNodeConverterFn.class, DefaultInterestRateSwapConverterFn.class, DefaultHistoricalPnLFXConverterFn.class); return available; } | /**
* Create the available implementations.
*
* @return the available implementations, not null
*/ | Create the available implementations | createAvailableImplementations | {
"repo_name": "jeorme/OG-Platform",
"path": "sesame/sesame-component/src/test/java/com/opengamma/sesame/component/RecordingDataTest.java",
"license": "apache-2.0",
"size": 20398
} | [
"com.opengamma.financial.analytics.conversion.FXForwardSecurityConverter",
"com.opengamma.financial.analytics.curve.ConfigDBCurveConstructionConfigurationSource",
"com.opengamma.financial.analytics.curve.exposure.ConfigDBInstrumentExposuresProvider",
"com.opengamma.sesame.CurveDefinitionCurveLabellingFn",
"com.opengamma.sesame.DefaultCurrencyPairsFn",
"com.opengamma.sesame.DefaultCurveDefinitionFn",
"com.opengamma.sesame.DefaultCurveNodeConverterFn",
"com.opengamma.sesame.DefaultCurveSpecificationFn",
"com.opengamma.sesame.DefaultCurveSpecificationMarketDataFn",
"com.opengamma.sesame.DefaultDiscountingMulticurveBundleFn",
"com.opengamma.sesame.DefaultDiscountingMulticurveBundleResolverFn",
"com.opengamma.sesame.DefaultFXMatrixFn",
"com.opengamma.sesame.DefaultFXReturnSeriesFn",
"com.opengamma.sesame.DefaultFixingsFn",
"com.opengamma.sesame.ExposureFunctionsDiscountingMulticurveCombinerFn",
"com.opengamma.sesame.equity.DefaultEquityPresentValueFn",
"com.opengamma.sesame.function.AvailableImplementations",
"com.opengamma.sesame.function.AvailableImplementationsImpl",
"com.opengamma.sesame.fxforward.DiscountingFXForwardPVFn",
"com.opengamma.sesame.fxforward.DiscountingFXForwardSpotPnLSeriesFn",
"com.opengamma.sesame.fxforward.DiscountingFXForwardYCNSPnLSeriesFn",
"com.opengamma.sesame.fxforward.DiscountingFXForwardYieldCurveNodeSensitivitiesFn",
"com.opengamma.sesame.fxforward.FXForwardDiscountingCalculatorFn",
"com.opengamma.sesame.irs.DefaultInterestRateSwapConverterFn",
"com.opengamma.sesame.irs.DiscountingInterestRateSwapCalculatorFactory",
"com.opengamma.sesame.irs.DiscountingInterestRateSwapFn",
"com.opengamma.sesame.marketdata.DefaultHistoricalMarketDataFn",
"com.opengamma.sesame.marketdata.DefaultMarketDataFn",
"com.opengamma.sesame.pnl.DefaultHistoricalPnLFXConverterFn"
] | import com.opengamma.financial.analytics.conversion.FXForwardSecurityConverter; import com.opengamma.financial.analytics.curve.ConfigDBCurveConstructionConfigurationSource; import com.opengamma.financial.analytics.curve.exposure.ConfigDBInstrumentExposuresProvider; import com.opengamma.sesame.CurveDefinitionCurveLabellingFn; import com.opengamma.sesame.DefaultCurrencyPairsFn; import com.opengamma.sesame.DefaultCurveDefinitionFn; import com.opengamma.sesame.DefaultCurveNodeConverterFn; import com.opengamma.sesame.DefaultCurveSpecificationFn; import com.opengamma.sesame.DefaultCurveSpecificationMarketDataFn; import com.opengamma.sesame.DefaultDiscountingMulticurveBundleFn; import com.opengamma.sesame.DefaultDiscountingMulticurveBundleResolverFn; import com.opengamma.sesame.DefaultFXMatrixFn; import com.opengamma.sesame.DefaultFXReturnSeriesFn; import com.opengamma.sesame.DefaultFixingsFn; import com.opengamma.sesame.ExposureFunctionsDiscountingMulticurveCombinerFn; import com.opengamma.sesame.equity.DefaultEquityPresentValueFn; import com.opengamma.sesame.function.AvailableImplementations; import com.opengamma.sesame.function.AvailableImplementationsImpl; import com.opengamma.sesame.fxforward.DiscountingFXForwardPVFn; import com.opengamma.sesame.fxforward.DiscountingFXForwardSpotPnLSeriesFn; import com.opengamma.sesame.fxforward.DiscountingFXForwardYCNSPnLSeriesFn; import com.opengamma.sesame.fxforward.DiscountingFXForwardYieldCurveNodeSensitivitiesFn; import com.opengamma.sesame.fxforward.FXForwardDiscountingCalculatorFn; import com.opengamma.sesame.irs.DefaultInterestRateSwapConverterFn; import com.opengamma.sesame.irs.DiscountingInterestRateSwapCalculatorFactory; import com.opengamma.sesame.irs.DiscountingInterestRateSwapFn; import com.opengamma.sesame.marketdata.DefaultHistoricalMarketDataFn; import com.opengamma.sesame.marketdata.DefaultMarketDataFn; import com.opengamma.sesame.pnl.DefaultHistoricalPnLFXConverterFn; | import com.opengamma.financial.analytics.conversion.*; import com.opengamma.financial.analytics.curve.*; import com.opengamma.financial.analytics.curve.exposure.*; import com.opengamma.sesame.*; import com.opengamma.sesame.equity.*; import com.opengamma.sesame.function.*; import com.opengamma.sesame.fxforward.*; import com.opengamma.sesame.irs.*; import com.opengamma.sesame.marketdata.*; import com.opengamma.sesame.pnl.*; | [
"com.opengamma.financial",
"com.opengamma.sesame"
] | com.opengamma.financial; com.opengamma.sesame; | 1,798,086 |
Table override = c.getAnnotation(Table.class);
if (override != null && override.value().length() <= 0) throw new IllegalArgumentException(c + " has a Table annotation with an empty name");
return (override == null) ? c.getSimpleName() : override.value();
}
/**
* Returns the name of the column associated with field {@code f}.
* Column name defaults to the name of the field, but may be customized with the {@link Column} annotation.
* @param f field to get column name for
* @return name of column matching {@code f} | Table override = c.getAnnotation(Table.class); if (override != null && override.value().length() <= 0) throw new IllegalArgumentException(c + STR); return (override == null) ? c.getSimpleName() : override.value(); } /** * Returns the name of the column associated with field {@code f}. * Column name defaults to the name of the field, but may be customized with the {@link Column} annotation. * @param f field to get column name for * @return name of column matching {@code f} | /**
* Returns the name of the table associated with class {@code c}.
* Table name defaults to the name of the class, but may be customized with the {@link Table} annotation.
* @param c class to get table name for
* @return name of table matching {@code c}
* @see Table
*/ | Returns the name of the table associated with class c. Table name defaults to the name of the class, but may be customized with the <code>Table</code> annotation | getName | {
"repo_name": "kkorolyov/SQLOb",
"path": "src/main/java/dev/kkorolyov/sqlob/util/PersistenceHelper.java",
"license": "bsd-3-clause",
"size": 2941
} | [
"dev.kkorolyov.sqlob.annotation.Column",
"dev.kkorolyov.sqlob.annotation.Table"
] | import dev.kkorolyov.sqlob.annotation.Column; import dev.kkorolyov.sqlob.annotation.Table; | import dev.kkorolyov.sqlob.annotation.*; | [
"dev.kkorolyov.sqlob"
] | dev.kkorolyov.sqlob; | 1,031,120 |
public Event newEvent(String event, String resource, boolean modify)
{
return new BaseEvent(event, resource, modify, NotificationService.NOTI_OPTIONAL, null);
} | Event function(String event, String resource, boolean modify) { return new BaseEvent(event, resource, modify, NotificationService.NOTI_OPTIONAL, null); } | /**
* Construct a Event object.
*
* @param event
* The Event id.
* @param resource
* The resource reference.
* @param modify
* Set to true if this event caused a resource modification, false if it was just an access.
* @return A new Event object that can be used with this service.
*/ | Construct a Event object | newEvent | {
"repo_name": "OpenCollabZA/sakai",
"path": "kernel/kernel-impl/src/main/java/org/sakaiproject/event/impl/BaseEventTrackingService.java",
"license": "apache-2.0",
"size": 23732
} | [
"org.sakaiproject.event.api.Event",
"org.sakaiproject.event.api.NotificationService"
] | import org.sakaiproject.event.api.Event; import org.sakaiproject.event.api.NotificationService; | import org.sakaiproject.event.api.*; | [
"org.sakaiproject.event"
] | org.sakaiproject.event; | 344,531 |
public void testSet() {
final ListIterator<E> it = makeObject();
if (!supportsSet()) {
// check for UnsupportedOperationException if not supported
try {
it.set(addSetValue());
} catch (final UnsupportedOperationException ex) {}
return;
}
// should throw IllegalStateException before next() called
try {
it.set(addSetValue());
fail();
} catch (final IllegalStateException ex) {}
// set after next should be fine
it.next();
it.set(addSetValue());
// repeated set calls should be fine
it.set(addSetValue());
} | void function() { final ListIterator<E> it = makeObject(); if (!supportsSet()) { try { it.set(addSetValue()); } catch (final UnsupportedOperationException ex) {} return; } try { it.set(addSetValue()); fail(); } catch (final IllegalStateException ex) {} it.next(); it.set(addSetValue()); it.set(addSetValue()); } | /**
* Test set behaviour.
*/ | Test set behaviour | testSet | {
"repo_name": "MuShiiii/commons-collections",
"path": "src/test/java/org/apache/commons/collections4/iterators/AbstractListIteratorTest.java",
"license": "apache-2.0",
"size": 8008
} | [
"java.util.ListIterator"
] | import java.util.ListIterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,719,044 |
public void testContentModelElement004() {
dtd = new DTDGetter("TestContentModelSemantic");
ContentModel cm2 = new ContentModel('*', new ContentModel());
BitSet bs1 = new BitSet(128);
bs1.set(1);
BitSet bs2 = new BitSet(7);
AttributeList al = new AttributeList("bigC", -2147483648, -1,
"value", new Vector(), new AttributeList(null));
Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2,
al);
cm = new ContentModel(el);
assertNotNull(cm);
assertEquals(el, cm.content);
assertEquals(cm2, el.content);
assertEquals(el, cm.content);
assertEquals(0, cm.type);
assertNull(cm.next);
}
| void function() { dtd = new DTDGetter(STR); ContentModel cm2 = new ContentModel('*', new ContentModel()); BitSet bs1 = new BitSet(128); bs1.set(1); BitSet bs2 = new BitSet(7); AttributeList al = new AttributeList("bigC", -2147483648, -1, "value", new Vector(), new AttributeList(null)); Element el = dtd.defineElement("", '*', true, false, cm2, bs1, bs2, al); cm = new ContentModel(el); assertNotNull(cm); assertEquals(el, cm.content); assertEquals(cm2, el.content); assertEquals(el, cm.content); assertEquals(0, cm.type); assertNull(cm.next); } | /**
* Test method for
* 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)'*
* ContentModel(Element( "",',',false,false,('*',new
* ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new
* Vector(),new AttributeList(null)) . It checks if an instance is created,
* content is equal to el ,type is 0 and next is null.
*/ | Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.ContentModel(Element)' ContentModel(Element( "",',',false,false,('*',new ContentModel()),BitSet(128).set(1),BitSet(7),AttributeList("bigC",-2147483648,-1,"value",new Vector(),new AttributeList(null)) . It checks if an instance is created, content is equal to el ,type is 0 and next is null | testContentModelElement004 | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelCompatilityTest.java",
"license": "gpl-2.0",
"size": 153261
} | [
"java.util.BitSet",
"java.util.Vector",
"javax.swing.text.html.parser.AttributeList",
"javax.swing.text.html.parser.ContentModel",
"javax.swing.text.html.parser.Element",
"javax.swing.text.parser.utils.DTDGetter"
] | import java.util.BitSet; import java.util.Vector; import javax.swing.text.html.parser.AttributeList; import javax.swing.text.html.parser.ContentModel; import javax.swing.text.html.parser.Element; import javax.swing.text.parser.utils.DTDGetter; | import java.util.*; import javax.swing.text.html.parser.*; import javax.swing.text.parser.utils.*; | [
"java.util",
"javax.swing"
] | java.util; javax.swing; | 2,386,959 |
void fireActionPerformed()
{
fireActionPerformed(new ActionEvent(this, ticks++, "Timer"));
} | void fireActionPerformed() { fireActionPerformed(new ActionEvent(this, ticks++, "Timer")); } | /**
* Fire the action event, named "Timer" and having the numeric
* identifier, equal to the numer of events that have been
* already fired before.
*/ | Fire the action event, named "Timer" and having the numeric identifier, equal to the numer of events that have been already fired before | fireActionPerformed | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/Timer.java",
"license": "gpl-2.0",
"size": 12727
} | [
"java.awt.event.ActionEvent"
] | import java.awt.event.ActionEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 128,073 |
public void doTestTableScanners() throws Exception {
// Setup
ThriftServerRunner.HBaseHandler handler =
new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration());
handler.createTable(tableAname, getColumnDescriptors());
// Apply timestamped Mutations to rowA
long time1 = System.currentTimeMillis();
handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null);
// Sleep to assure that 'time1' and 'time2' will be different even with a
// coarse grained system timer.
Thread.sleep(1000);
// Apply timestamped BatchMutations for rowA and rowB
long time2 = System.currentTimeMillis();
handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null);
time1 += 1;
// Test a scanner on all rows and all columns, no timestamp
int scanner1 = handler.scannerOpen(tableAname, rowAname, getColumnList(true, true), null);
TRowResult rowResult1a = handler.scannerGet(scanner1).get(0);
assertEquals(rowResult1a.row, rowAname);
// This used to be '1'. I don't know why when we are asking for two columns
// and when the mutations above would seem to add two columns to the row.
// -- St.Ack 05/12/2009
assertEquals(rowResult1a.columns.size(), 1);
assertEquals(rowResult1a.columns.get(columnBname).value, valueCname);
TRowResult rowResult1b = handler.scannerGet(scanner1).get(0);
assertEquals(rowResult1b.row, rowBname);
assertEquals(rowResult1b.columns.size(), 2);
assertEquals(rowResult1b.columns.get(columnAname).value, valueCname);
assertEquals(rowResult1b.columns.get(columnBname).value, valueDname);
closeScanner(scanner1, handler);
// Test a scanner on all rows and all columns, with timestamp
int scanner2 = handler.scannerOpenTs(tableAname, rowAname, getColumnList(true, true), time1, null);
TRowResult rowResult2a = handler.scannerGet(scanner2).get(0);
assertEquals(rowResult2a.columns.size(), 1);
// column A deleted, does not exist.
//assertTrue(Bytes.equals(rowResult2a.columns.get(columnAname).value, valueAname));
assertEquals(rowResult2a.columns.get(columnBname).value, valueBname);
closeScanner(scanner2, handler);
// Test a scanner on the first row and first column only, no timestamp
int scanner3 = handler.scannerOpenWithStop(tableAname, rowAname, rowBname,
getColumnList(true, false), null);
closeScanner(scanner3, handler);
// Test a scanner on the first row and second column only, with timestamp
int scanner4 = handler.scannerOpenWithStopTs(tableAname, rowAname, rowBname,
getColumnList(false, true), time1, null);
TRowResult rowResult4a = handler.scannerGet(scanner4).get(0);
assertEquals(rowResult4a.columns.size(), 1);
assertEquals(rowResult4a.columns.get(columnBname).value, valueBname);
// Test scanner using a TScan object once with sortColumns False and once with sortColumns true
TScan scanNoSortColumns = new TScan();
scanNoSortColumns.setStartRow(rowAname);
scanNoSortColumns.setStopRow(rowBname);
int scanner5 = handler.scannerOpenWithScan(tableAname , scanNoSortColumns, null);
TRowResult rowResult5 = handler.scannerGet(scanner5).get(0);
assertEquals(rowResult5.columns.size(), 1);
assertEquals(rowResult5.columns.get(columnBname).value, valueCname);
TScan scanSortColumns = new TScan();
scanSortColumns.setStartRow(rowAname);
scanSortColumns.setStopRow(rowBname);
scanSortColumns = scanSortColumns.setSortColumns(true);
int scanner6 = handler.scannerOpenWithScan(tableAname ,scanSortColumns, null);
TRowResult rowResult6 = handler.scannerGet(scanner6).get(0);
assertEquals(rowResult6.sortedColumns.size(), 1);
assertEquals(rowResult6.sortedColumns.get(0).getCell().value, valueCname);
List<Mutation> rowBmutations = new ArrayList<Mutation>();
for (int i = 0; i < 20; i++) {
rowBmutations.add(new Mutation(false, asByteBuffer("columnA:" + i), valueCname, true));
}
ByteBuffer rowC = asByteBuffer("rowC");
handler.mutateRow(tableAname, rowC, rowBmutations, null);
TScan scanSortMultiColumns = new TScan();
scanSortMultiColumns.setStartRow(rowC);
scanSortMultiColumns = scanSortMultiColumns.setSortColumns(true);
int scanner7 = handler.scannerOpenWithScan(tableAname, scanSortMultiColumns, null);
TRowResult rowResult7 = handler.scannerGet(scanner7).get(0);
ByteBuffer smallerColumn = asByteBuffer("columnA:");
for (int i = 0; i < 20; i++) {
ByteBuffer currentColumn = rowResult7.sortedColumns.get(i).columnName;
assertTrue(Bytes.compareTo(smallerColumn.array(), currentColumn.array()) < 0);
smallerColumn = currentColumn;
}
TScan reversedScan = new TScan();
reversedScan.setReversed(true);
reversedScan.setStartRow(rowBname);
reversedScan.setStopRow(rowAname);
int scanner8 = handler.scannerOpenWithScan(tableAname , reversedScan, null);
List<TRowResult> results = handler.scannerGet(scanner8);
handler.scannerClose(scanner8);
assertEquals(results.size(), 1);
assertEquals(ByteBuffer.wrap(results.get(0).getRow()), rowBname);
// Teardown
handler.disableTable(tableAname);
handler.deleteTable(tableAname);
} | void function() throws Exception { ThriftServerRunner.HBaseHandler handler = new ThriftServerRunner.HBaseHandler(UTIL.getConfiguration()); handler.createTable(tableAname, getColumnDescriptors()); long time1 = System.currentTimeMillis(); handler.mutateRowTs(tableAname, rowAname, getMutations(), time1, null); Thread.sleep(1000); long time2 = System.currentTimeMillis(); handler.mutateRowsTs(tableAname, getBatchMutations(), time2, null); time1 += 1; int scanner1 = handler.scannerOpen(tableAname, rowAname, getColumnList(true, true), null); TRowResult rowResult1a = handler.scannerGet(scanner1).get(0); assertEquals(rowResult1a.row, rowAname); assertEquals(rowResult1a.columns.size(), 1); assertEquals(rowResult1a.columns.get(columnBname).value, valueCname); TRowResult rowResult1b = handler.scannerGet(scanner1).get(0); assertEquals(rowResult1b.row, rowBname); assertEquals(rowResult1b.columns.size(), 2); assertEquals(rowResult1b.columns.get(columnAname).value, valueCname); assertEquals(rowResult1b.columns.get(columnBname).value, valueDname); closeScanner(scanner1, handler); int scanner2 = handler.scannerOpenTs(tableAname, rowAname, getColumnList(true, true), time1, null); TRowResult rowResult2a = handler.scannerGet(scanner2).get(0); assertEquals(rowResult2a.columns.size(), 1); assertEquals(rowResult2a.columns.get(columnBname).value, valueBname); closeScanner(scanner2, handler); int scanner3 = handler.scannerOpenWithStop(tableAname, rowAname, rowBname, getColumnList(true, false), null); closeScanner(scanner3, handler); int scanner4 = handler.scannerOpenWithStopTs(tableAname, rowAname, rowBname, getColumnList(false, true), time1, null); TRowResult rowResult4a = handler.scannerGet(scanner4).get(0); assertEquals(rowResult4a.columns.size(), 1); assertEquals(rowResult4a.columns.get(columnBname).value, valueBname); TScan scanNoSortColumns = new TScan(); scanNoSortColumns.setStartRow(rowAname); scanNoSortColumns.setStopRow(rowBname); int scanner5 = handler.scannerOpenWithScan(tableAname , scanNoSortColumns, null); TRowResult rowResult5 = handler.scannerGet(scanner5).get(0); assertEquals(rowResult5.columns.size(), 1); assertEquals(rowResult5.columns.get(columnBname).value, valueCname); TScan scanSortColumns = new TScan(); scanSortColumns.setStartRow(rowAname); scanSortColumns.setStopRow(rowBname); scanSortColumns = scanSortColumns.setSortColumns(true); int scanner6 = handler.scannerOpenWithScan(tableAname ,scanSortColumns, null); TRowResult rowResult6 = handler.scannerGet(scanner6).get(0); assertEquals(rowResult6.sortedColumns.size(), 1); assertEquals(rowResult6.sortedColumns.get(0).getCell().value, valueCname); List<Mutation> rowBmutations = new ArrayList<Mutation>(); for (int i = 0; i < 20; i++) { rowBmutations.add(new Mutation(false, asByteBuffer(STR + i), valueCname, true)); } ByteBuffer rowC = asByteBuffer("rowC"); handler.mutateRow(tableAname, rowC, rowBmutations, null); TScan scanSortMultiColumns = new TScan(); scanSortMultiColumns.setStartRow(rowC); scanSortMultiColumns = scanSortMultiColumns.setSortColumns(true); int scanner7 = handler.scannerOpenWithScan(tableAname, scanSortMultiColumns, null); TRowResult rowResult7 = handler.scannerGet(scanner7).get(0); ByteBuffer smallerColumn = asByteBuffer(STR); for (int i = 0; i < 20; i++) { ByteBuffer currentColumn = rowResult7.sortedColumns.get(i).columnName; assertTrue(Bytes.compareTo(smallerColumn.array(), currentColumn.array()) < 0); smallerColumn = currentColumn; } TScan reversedScan = new TScan(); reversedScan.setReversed(true); reversedScan.setStartRow(rowBname); reversedScan.setStopRow(rowAname); int scanner8 = handler.scannerOpenWithScan(tableAname , reversedScan, null); List<TRowResult> results = handler.scannerGet(scanner8); handler.scannerClose(scanner8); assertEquals(results.size(), 1); assertEquals(ByteBuffer.wrap(results.get(0).getRow()), rowBname); handler.disableTable(tableAname); handler.deleteTable(tableAname); } | /**
* Tests the four different scanner-opening methods (with and without
* a stoprow, with and without a timestamp).
*
* @throws Exception
*/ | Tests the four different scanner-opening methods (with and without a stoprow, with and without a timestamp) | doTestTableScanners | {
"repo_name": "intel-hadoop/hbase-rhino",
"path": "hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftServer.java",
"license": "apache-2.0",
"size": 31989
} | [
"java.nio.ByteBuffer",
"java.util.ArrayList",
"java.util.List",
"org.apache.hadoop.hbase.thrift.ThriftServerRunner",
"org.apache.hadoop.hbase.thrift.generated.Mutation",
"org.apache.hadoop.hbase.thrift.generated.TRowResult",
"org.apache.hadoop.hbase.thrift.generated.TScan",
"org.apache.hadoop.hbase.util.Bytes",
"org.junit.Assert"
] | import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hbase.thrift.ThriftServerRunner; import org.apache.hadoop.hbase.thrift.generated.Mutation; import org.apache.hadoop.hbase.thrift.generated.TRowResult; import org.apache.hadoop.hbase.thrift.generated.TScan; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert; | import java.nio.*; import java.util.*; import org.apache.hadoop.hbase.thrift.*; import org.apache.hadoop.hbase.thrift.generated.*; import org.apache.hadoop.hbase.util.*; import org.junit.*; | [
"java.nio",
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.nio; java.util; org.apache.hadoop; org.junit; | 21,919 |
public void drawResultBitmap(Bitmap barcode) {
resultBitmap = barcode;
invalidate();
} | void function(Bitmap barcode) { resultBitmap = barcode; invalidate(); } | /**
* Draw a bitmap with the result points highlighted instead of the live
* scanning display.
*
* @param barcode
* An image of the decoded barcode.
*/ | Draw a bitmap with the result points highlighted instead of the live scanning display | drawResultBitmap | {
"repo_name": "lab702-flyme/sweo_android",
"path": "app/src/main/java/view/ViewfinderView.java",
"license": "apache-2.0",
"size": 8017
} | [
"android.graphics.Bitmap"
] | import android.graphics.Bitmap; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 934,046 |
public void getColumns(List<String> columns) {
if (_children == null || _children.isEmpty()) {
if (_expressionType == ExpressionType.IDENTIFIER) {
columns.add(_expression);
}
return;
}
for (TransformExpressionTree child : _children) {
child.getColumns(columns);
}
} | void function(List<String> columns) { if (_children == null _children.isEmpty()) { if (_expressionType == ExpressionType.IDENTIFIER) { columns.add(_expression); } return; } for (TransformExpressionTree child : _children) { child.getColumns(columns); } } | /**
* Returns a list of columns from the leaf nodes of the tree.
* Caller passes a list where columns are stored and returned.
*
* @param columns Output columns
*/ | Returns a list of columns from the leaf nodes of the tree. Caller passes a list where columns are stored and returned | getColumns | {
"repo_name": "sajavadi/pinot",
"path": "pinot-common/src/main/java/com/linkedin/pinot/common/request/transform/TransformExpressionTree.java",
"license": "apache-2.0",
"size": 5021
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,507,859 |
@Override
public Long getUserActiveTeamId() {
final Team team = this.getUserActiveTeam();
if (team == null) {
return null;
}
return team.getId();
} | Long function() { final Team team = this.getUserActiveTeam(); if (team == null) { return null; } return team.getId(); } | /**
* Method that return the active team of the current connected user
*
* @return Team the active team id
*/ | Method that return the active team of the current connected user | getUserActiveTeamId | {
"repo_name": "ama-axelor/axelor-business-suite",
"path": "axelor-base/src/main/java/com/axelor/apps/base/service/user/UserServiceImpl.java",
"license": "agpl-3.0",
"size": 10336
} | [
"com.axelor.team.db.Team"
] | import com.axelor.team.db.Team; | import com.axelor.team.db.*; | [
"com.axelor.team"
] | com.axelor.team; | 1,344,121 |
public void testFieldsCannotBeSetToNull() {
SimpleQueryStringBuilder qb = createTestQueryBuilder();
try {
qb.fields(null);
fail("Expected NullPointerException");
} catch (NullPointerException e) {
assertThat(e.getMessage(), is("fields cannot be null"));
}
} | void function() { SimpleQueryStringBuilder qb = createTestQueryBuilder(); try { qb.fields(null); fail(STR); } catch (NullPointerException e) { assertThat(e.getMessage(), is(STR)); } } | /**
* The following should fail fast - never silently set the map containing
* fields and weights to null but refuse to accept null instead.
* */ | The following should fail fast - never silently set the map containing fields and weights to null but refuse to accept null instead | testFieldsCannotBeSetToNull | {
"repo_name": "socialrank/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/index/query/SimpleQueryStringBuilderTests.java",
"license": "apache-2.0",
"size": 16903
} | [
"org.hamcrest.Matchers"
] | import org.hamcrest.Matchers; | import org.hamcrest.*; | [
"org.hamcrest"
] | org.hamcrest; | 2,685,195 |
protected void checkExpandedCustomNodes() {
TreeItemIdNode custom = getCustomTree();
if (custom == null) {
return;
}
// Get the expanded rows
Set<String> expanded = getExpandedRows();
// Process Top Level
for (TreeItemIdNode node : custom.getChildren()) {
processCheckExpandedCustomNodes(node, expanded);
}
}
/**
* {@inheritDoc}
| void function() { TreeItemIdNode custom = getCustomTree(); if (custom == null) { return; } Set<String> expanded = getExpandedRows(); for (TreeItemIdNode node : custom.getChildren()) { processCheckExpandedCustomNodes(node, expanded); } } /** * {@inheritDoc} | /**
* Check if custom nodes that are expanded need their child nodes added from the model.
*/ | Check if custom nodes that are expanded need their child nodes added from the model | checkExpandedCustomNodes | {
"repo_name": "Joshua-Barclay/wcomponents",
"path": "wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTree.java",
"license": "gpl-3.0",
"size": 39637
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,073,678 |
public KualiDecimal getFinancialDocumentFiveDollarAmount() {
return financialDocumentFiveDollarAmount;
} | KualiDecimal function() { return financialDocumentFiveDollarAmount; } | /**
* Gets the financialDocumentFiveDollarAmount attribute.
* @return Returns the financialDocumentFiveDollarAmount.
*/ | Gets the financialDocumentFiveDollarAmount attribute | getFinancialDocumentFiveDollarAmount | {
"repo_name": "ua-eas/kfs-devops-automation-fork",
"path": "kfs-core/src/main/java/org/kuali/kfs/fp/document/CashManagementDocument.java",
"license": "agpl-3.0",
"size": 30786
} | [
"org.kuali.rice.core.api.util.type.KualiDecimal"
] | import org.kuali.rice.core.api.util.type.KualiDecimal; | import org.kuali.rice.core.api.util.type.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 1,501,659 |
public static int[] calcSortOrder(final int[] arr1, final int[] arr2, int length) {
if (arr1.length < length || arr2.length < length)
throw new IllegalArgumentException("Arrays must not be shorter than given length");
IndirectComparator comp = (indexA, indexB) -> {
final int arr1cmp = Integer.compare(arr1[indexA], arr1[indexB]);
return arr1cmp != 0 ? arr1cmp : Integer.compare(arr2[indexA], arr2[indexB]);
};
return IndirectSort.mergesort(0, length, comp);
} | static int[] function(final int[] arr1, final int[] arr2, int length) { if (arr1.length < length arr2.length < length) throw new IllegalArgumentException(STR); IndirectComparator comp = (indexA, indexB) -> { final int arr1cmp = Integer.compare(arr1[indexA], arr1[indexB]); return arr1cmp != 0 ? arr1cmp : Integer.compare(arr2[indexA], arr2[indexB]); }; return IndirectSort.mergesort(0, length, comp); } | /**
* This method calculates the sort order of the first {@param length} element-pairs given by two arrays.
* The order is chosen such that it sorts the element-pairs first by the first and second by the second array.
* The input arrays are not manipulated by this method.
*
* @param length must not be larger than either of the two input array lengths.
* @return an array x of length {@param length}. e.g. if this method returns x = {2, 0, 1} it means that that
* the element-pair with index 2 comes first in the order and so on
*/ | This method calculates the sort order of the first length element-pairs given by two arrays. The order is chosen such that it sorts the element-pairs first by the first and second by the second array. The input arrays are not manipulated by this method | calcSortOrder | {
"repo_name": "routexl/graphhopper",
"path": "core/src/main/java/com/graphhopper/util/ArrayUtil.java",
"license": "apache-2.0",
"size": 9194
} | [
"com.carrotsearch.hppc.sorting.IndirectComparator",
"com.carrotsearch.hppc.sorting.IndirectSort"
] | import com.carrotsearch.hppc.sorting.IndirectComparator; import com.carrotsearch.hppc.sorting.IndirectSort; | import com.carrotsearch.hppc.sorting.*; | [
"com.carrotsearch.hppc"
] | com.carrotsearch.hppc; | 486,487 |
public static int[] deserialize(final InputStream inputStream) throws IOException {
final byte[] sizeAr = new byte[INT_SIZE];
inputStream.read(sizeAr);
int size = ByteBuffer.wrap(sizeAr).asIntBuffer().get();
final byte[] imageAr = new byte[size];
// Wait until we've received all bytes required for an image
while (inputStream.available() < size) {
;
}
inputStream.read(imageAr);
final BufferedImage im = ImageIO.read(new ByteArrayInputStream(imageAr));
final BufferedImage image = new BufferedImage(im.getWidth(), im.getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
g.drawImage(im, 0, 0, null);
g.dispose();
return ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
} | static int[] function(final InputStream inputStream) throws IOException { final byte[] sizeAr = new byte[INT_SIZE]; inputStream.read(sizeAr); int size = ByteBuffer.wrap(sizeAr).asIntBuffer().get(); final byte[] imageAr = new byte[size]; while (inputStream.available() < size) { ; } inputStream.read(imageAr); final BufferedImage im = ImageIO.read(new ByteArrayInputStream(imageAr)); final BufferedImage image = new BufferedImage(im.getWidth(), im.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g = image.createGraphics(); g.drawImage(im, 0, 0, null); g.dispose(); return ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); } | /**
* Deserialize a message over the socket into full blown image data.
*
* @param inputStream
* @return
*/ | Deserialize a message over the socket into full blown image data | deserialize | {
"repo_name": "rap2363/WhiteRaven",
"path": "src/main/java/web/transport/ImageMessage.java",
"license": "mit",
"size": 3111
} | [
"java.awt.Graphics2D",
"java.awt.image.BufferedImage",
"java.awt.image.DataBufferInt",
"java.io.ByteArrayInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.nio.ByteBuffer",
"javax.imageio.ImageIO"
] | import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.awt.image.DataBufferInt; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; import javax.imageio.ImageIO; | import java.awt.*; import java.awt.image.*; import java.io.*; import java.nio.*; import javax.imageio.*; | [
"java.awt",
"java.io",
"java.nio",
"javax.imageio"
] | java.awt; java.io; java.nio; javax.imageio; | 1,044,064 |
public Set<String> getAggregatedTypes() {
return aggregatedTypes;
} | Set<String> function() { return aggregatedTypes; } | /**
* Contains the types that aggregating annotation processors registered themselves for.
* These types need to be reprocessed no matter what source changes are made to ensure that the generated types contain all relevant information.
*/ | Contains the types that aggregating annotation processors registered themselves for. These types need to be reprocessed no matter what source changes are made to ensure that the generated types contain all relevant information | getAggregatedTypes | {
"repo_name": "gradle/gradle",
"path": "subprojects/language-java/src/main/java/org/gradle/api/internal/tasks/compile/incremental/processing/AnnotationProcessingResult.java",
"license": "apache-2.0",
"size": 4623
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,256,083 |
public static void dropTestSequences(Database database, String... sequenceNames) {
for (String sequenceName : sequenceNames) {
try {
String correctCaseSequenceName = database.toCorrectCaseIdentifier(sequenceName);
database.dropSequence(database.getDefaultSchemaName(), correctCaseSequenceName);
} catch (DbMaintainException e) {
// Ignored
}
}
}
| static void function(Database database, String... sequenceNames) { for (String sequenceName : sequenceNames) { try { String correctCaseSequenceName = database.toCorrectCaseIdentifier(sequenceName); database.dropSequence(database.getDefaultSchemaName(), correctCaseSequenceName); } catch (DbMaintainException e) { } } } | /**
* Drops the test sequence
*
* @param database The database, not null
* @param sequenceNames The sequences to drop
*/ | Drops the test sequence | dropTestSequences | {
"repo_name": "intouchfollowup/dbmaintain",
"path": "dbmaintain/src/test/java/org/dbmaintain/util/SQLTestUtils.java",
"license": "apache-2.0",
"size": 10960
} | [
"org.dbmaintain.database.Database"
] | import org.dbmaintain.database.Database; | import org.dbmaintain.database.*; | [
"org.dbmaintain.database"
] | org.dbmaintain.database; | 2,044,453 |
Observable<ServiceResponse<LocalDate>> getUnderflowDateWithServiceResponseAsync(); | Observable<ServiceResponse<LocalDate>> getUnderflowDateWithServiceResponseAsync(); | /**
* Get underflow date value.
*
* @return the observable to the LocalDate object
*/ | Get underflow date value | getUnderflowDateWithServiceResponseAsync | {
"repo_name": "yugangw-msft/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydate/Dates.java",
"license": "mit",
"size": 7371
} | [
"com.microsoft.rest.ServiceResponse",
"org.joda.time.LocalDate"
] | import com.microsoft.rest.ServiceResponse; import org.joda.time.LocalDate; | import com.microsoft.rest.*; import org.joda.time.*; | [
"com.microsoft.rest",
"org.joda.time"
] | com.microsoft.rest; org.joda.time; | 2,841,933 |
Request deleteLiveLogJob(final String sessionId, final String jobId, AsyncCallback<Boolean> callback); | Request deleteLiveLogJob(final String sessionId, final String jobId, AsyncCallback<Boolean> callback); | /**
* Clean the remote live log object
* @param sessionId current session id
* @param jobId id of the job for which live logs should be cleaned
*/ | Clean the remote live log object | deleteLiveLogJob | {
"repo_name": "ow2-proactive/scheduling-portal",
"path": "scheduler-portal/src/main/java/org/ow2/proactive_grid_cloud_portal/scheduler/client/SchedulerServiceAsync.java",
"license": "agpl-3.0",
"size": 20554
} | [
"com.google.gwt.http.client.Request",
"com.google.gwt.user.client.rpc.AsyncCallback"
] | import com.google.gwt.http.client.Request; import com.google.gwt.user.client.rpc.AsyncCallback; | import com.google.gwt.http.client.*; import com.google.gwt.user.client.rpc.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,342,621 |
LOGGER.error("Error: {}", e.getMessage(), e);
return new ErrorBuilder()
.status(Status.FORBIDDEN)
.simpleMessage(e.getMessage())
.detailMessage(ExceptionUtils.getStackTrace(e))
.build();
}
/**
* Create an {@link uk.gov.gchq.gaffer.core.exception.Error} object from a
* {@link uk.gov.gchq.gaffer.core.exception.GafferCheckedException}.
*
* @param gex the exception object
* @return a newly constructed {@link uk.gov.gchq.gaffer.core.exception.Error} | LOGGER.error(STR, e.getMessage(), e); return new ErrorBuilder() .status(Status.FORBIDDEN) .simpleMessage(e.getMessage()) .detailMessage(ExceptionUtils.getStackTrace(e)) .build(); } /** * Create an {@link uk.gov.gchq.gaffer.core.exception.Error} object from a * {@link uk.gov.gchq.gaffer.core.exception.GafferCheckedException}. * * @param gex the exception object * @return a newly constructed {@link uk.gov.gchq.gaffer.core.exception.Error} | /**
* Create an {@link uk.gov.gchq.gaffer.core.exception.Error} object from an
* {@link UnauthorisedException}.
*
* @param e the exception object
* @return a newly constructed {@link uk.gov.gchq.gaffer.core.exception.Error}
*/ | Create an <code>uk.gov.gchq.gaffer.core.exception.Error</code> object from an <code>UnauthorisedException</code> | from | {
"repo_name": "GovernmentCommunicationsHeadquarters/Gaffer",
"path": "core/exception/src/main/java/uk/gov/gchq/gaffer/core/exception/ErrorFactory.java",
"license": "apache-2.0",
"size": 4227
} | [
"org.apache.commons.lang3.exception.ExceptionUtils",
"uk.gov.gchq.gaffer.core.exception.Error"
] | import org.apache.commons.lang3.exception.ExceptionUtils; import uk.gov.gchq.gaffer.core.exception.Error; | import org.apache.commons.lang3.exception.*; import uk.gov.gchq.gaffer.core.exception.*; | [
"org.apache.commons",
"uk.gov.gchq"
] | org.apache.commons; uk.gov.gchq; | 1,826,321 |
public boolean writeDeliveryToFedora(DeliveryTitleInfo deli, boolean force) throws JAXBException {
ByteArrayOutputStream os = MarshallerFunctions.marshallDeliveryTitleInfo(deli);
return writeToCurrentItemInFedora(deli.getDeliveryName(), deli.getNewspaperTitle(), os.toByteArray(), force);
} | boolean function(DeliveryTitleInfo deli, boolean force) throws JAXBException { ByteArrayOutputStream os = MarshallerFunctions.marshallDeliveryTitleInfo(deli); return writeToCurrentItemInFedora(deli.getDeliveryName(), deli.getNewspaperTitle(), os.toByteArray(), force); } | /**
* Write the delivery to the title-object in fedora
*
* @param deli
* @return
*
* @throws JAXBException
*/ | Write the delivery to the title-object in fedora | writeDeliveryToFedora | {
"repo_name": "statsbiblioteket/digital-pligtaflevering-aviser-tools",
"path": "tools/dpa-manualcontrol/src/main/java/org/statsbiblioteket/digital_pligtaflevering_aviser/ui/datamodel/serializers/DeliveryFedoraCommunication.java",
"license": "apache-2.0",
"size": 14786
} | [
"java.io.ByteArrayOutputStream",
"javax.xml.bind.JAXBException",
"org.statsbiblioteket.digital_pligtaflevering_aviser.ui.datamodel.DeliveryTitleInfo"
] | import java.io.ByteArrayOutputStream; import javax.xml.bind.JAXBException; import org.statsbiblioteket.digital_pligtaflevering_aviser.ui.datamodel.DeliveryTitleInfo; | import java.io.*; import javax.xml.bind.*; import org.statsbiblioteket.digital_pligtaflevering_aviser.ui.datamodel.*; | [
"java.io",
"javax.xml",
"org.statsbiblioteket.digital_pligtaflevering_aviser"
] | java.io; javax.xml; org.statsbiblioteket.digital_pligtaflevering_aviser; | 155,595 |
private Set<int[]> extractPositions(Set<Object> value) {
final Set<int[]> res = new LinkedHashSet<int[]>();
for (Object object : value) {
res.add((int[])object);
}
return res;
} | Set<int[]> function(Set<Object> value) { final Set<int[]> res = new LinkedHashSet<int[]>(); for (Object object : value) { res.add((int[])object); } return res; } | /**
* Casts the given {@link Set} of {@link Object} which are indead int[].
*
* @param value
* the {@link Set} of {@link Object} which are indead int[]
* @return the {@link Set} of int[]
*/ | Casts the given <code>Set</code> of <code>Object</code> which are indead int[] | extractPositions | {
"repo_name": "ModelWriter/Source",
"path": "plugins/eu.modelwriter.semantic/src/eu/modelwriter/semantic/internal/SemanticAnnotator.java",
"license": "epl-1.0",
"size": 14708
} | [
"java.util.LinkedHashSet",
"java.util.Set"
] | import java.util.LinkedHashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 41,548 |
private void addNestedFieldExamples() {
add(new WHeading(HeadingLevel.H2, "Label nesting which is technically OK"));
WPanel errorLayoutPanel = new WPanel();
errorLayoutPanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.LARGE));
errorLayoutPanel.setMargin(new Margin(null, null, Size.XL, null));
add(errorLayoutPanel);
errorLayoutPanel.add(new ExplanatoryText("This example shows WLabels with a single nested simple form control WTextField."
+ " This is not a contravention of the HTML specification but you should not do it."));
WLabel outerLabel = new WLabel("Label with nested WTextField and not 'for' anything");
errorLayoutPanel.add(outerLabel);
outerLabel.add(new WTextField());
WTextField innerField = new WTextField();
outerLabel = new WLabel("Label 'for' nested WTextField", innerField);
errorLayoutPanel.add(outerLabel);
outerLabel.add(innerField);
} | void function() { add(new WHeading(HeadingLevel.H2, STR)); WPanel errorLayoutPanel = new WPanel(); errorLayoutPanel.setLayout(new FlowLayout(FlowLayout.VERTICAL, Size.LARGE)); errorLayoutPanel.setMargin(new Margin(null, null, Size.XL, null)); add(errorLayoutPanel); errorLayoutPanel.add(new ExplanatoryText(STR + STR)); WLabel outerLabel = new WLabel(STR); errorLayoutPanel.add(outerLabel); outerLabel.add(new WTextField()); WTextField innerField = new WTextField(); outerLabel = new WLabel(STR, innerField); errorLayoutPanel.add(outerLabel); outerLabel.add(innerField); } | /**
* Examples showing WLabel with a nested input control WComponent.
* This is VERY dangerous as only a very few WComponents are valid for this scenario. If you go down this route: stop!!
* These are really here for framework testing, not as examples as to how to do things.
*/ | Examples showing WLabel with a nested input control WComponent. This is VERY dangerous as only a very few WComponents are valid for this scenario. If you go down this route: stop!! These are really here for framework testing, not as examples as to how to do things | addNestedFieldExamples | {
"repo_name": "marksreeves/wcomponents",
"path": "wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WLabelExample.java",
"license": "gpl-3.0",
"size": 13936
} | [
"com.github.bordertech.wcomponents.HeadingLevel",
"com.github.bordertech.wcomponents.Margin",
"com.github.bordertech.wcomponents.Size",
"com.github.bordertech.wcomponents.WHeading",
"com.github.bordertech.wcomponents.WLabel",
"com.github.bordertech.wcomponents.WPanel",
"com.github.bordertech.wcomponents.WTextField",
"com.github.bordertech.wcomponents.examples.common.ExplanatoryText",
"com.github.bordertech.wcomponents.layout.FlowLayout"
] | import com.github.bordertech.wcomponents.HeadingLevel; import com.github.bordertech.wcomponents.Margin; import com.github.bordertech.wcomponents.Size; import com.github.bordertech.wcomponents.WHeading; import com.github.bordertech.wcomponents.WLabel; import com.github.bordertech.wcomponents.WPanel; import com.github.bordertech.wcomponents.WTextField; import com.github.bordertech.wcomponents.examples.common.ExplanatoryText; import com.github.bordertech.wcomponents.layout.FlowLayout; | import com.github.bordertech.wcomponents.*; import com.github.bordertech.wcomponents.examples.common.*; import com.github.bordertech.wcomponents.layout.*; | [
"com.github.bordertech"
] | com.github.bordertech; | 757,823 |
public void publish(final String channel, final String message) {
publish(Collections.singleton(channel), Collections.singletonList(message));
} | void function(final String channel, final String message) { publish(Collections.singleton(channel), Collections.singletonList(message)); } | /**
* Sugar method for publishing a single message to a single channel.
* @param channel to publish to.
* @param message sent to channel.
*/ | Sugar method for publishing a single message to a single channel | publish | {
"repo_name": "lithiumtech/rdbi",
"path": "rdbi-recipes/src/main/java/com/lithium/dbi/rdbi/recipes/channel/ChannelPublisher.java",
"license": "apache-2.0",
"size": 4583
} | [
"java.util.Collections"
] | import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 2,750,908 |
public void start() {
reactorMain.execute(() -> {
try {
LOGGER.info("Reactor started, waiting for events...");
eventLoop();
} catch (IOException e) {
LOGGER.error("exception in event loop", e);
}
});
} | void function() { reactorMain.execute(() -> { try { LOGGER.info(STR); eventLoop(); } catch (IOException e) { LOGGER.error(STR, e); } }); } | /**
* Starts the reactor event loop in a new thread.
*/ | Starts the reactor event loop in a new thread | start | {
"repo_name": "italoag/java-design-patterns",
"path": "reactor/src/main/java/com/iluwatar/reactor/framework/NioReactor.java",
"license": "mit",
"size": 9422
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,540,056 |
public MinecraftServer getServer()
{
return player.getServer();
}
};
minecraftserver.getFunctionManager().execute(functionobject, icommandsender);
}
} | MinecraftServer function() { return player.getServer(); } }; minecraftserver.getFunctionManager().execute(functionobject, icommandsender); } } | /**
* Get the Minecraft server instance
*/ | Get the Minecraft server instance | getServer | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/advancements/AdvancementRewards.java",
"license": "gpl-3.0",
"size": 9408
} | [
"net.minecraft.server.MinecraftServer"
] | import net.minecraft.server.MinecraftServer; | import net.minecraft.server.*; | [
"net.minecraft.server"
] | net.minecraft.server; | 894,117 |
private Member getConstructorOrMethod(String name, boolean searchSuperTypes,
boolean publicOnly, Class<?>[] parameterTypes) throws NoSuchMethodException {
if (searchSuperTypes && !publicOnly) {
throw new AssertionError(); // can't lookup non-public members recursively
}
if (name == null) {
throw new NullPointerException("name == null");
}
if (parameterTypes == null) {
parameterTypes = EmptyArray.CLASS;
}
for (Class<?> c : parameterTypes) {
if (c == null) {
throw new NoSuchMethodException("parameter type is null");
}
}
Member result = searchSuperTypes
? getPublicConstructorOrMethodRecursive(name, parameterTypes)
: Class.getDeclaredConstructorOrMethod(this, name, parameterTypes);
if (result == null || publicOnly && (result.getModifiers() & Modifier.PUBLIC) == 0) {
throw new NoSuchMethodException(name + " " + Arrays.toString(parameterTypes));
}
return result;
} | Member function(String name, boolean searchSuperTypes, boolean publicOnly, Class<?>[] parameterTypes) throws NoSuchMethodException { if (searchSuperTypes && !publicOnly) { throw new AssertionError(); } if (name == null) { throw new NullPointerException(STR); } if (parameterTypes == null) { parameterTypes = EmptyArray.CLASS; } for (Class<?> c : parameterTypes) { if (c == null) { throw new NoSuchMethodException(STR); } } Member result = searchSuperTypes ? getPublicConstructorOrMethodRecursive(name, parameterTypes) : Class.getDeclaredConstructorOrMethod(this, name, parameterTypes); if (result == null publicOnly && (result.getModifiers() & Modifier.PUBLIC) == 0) { throw new NoSuchMethodException(name + " " + Arrays.toString(parameterTypes)); } return result; } | /**
* Returns a constructor or method with the given name. Use "<init>" to return a constructor.
*/ | Returns a constructor or method with the given name. Use "" to return a constructor | getConstructorOrMethod | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/java/lang/Class.java",
"license": "apache-2.0",
"size": 51633
} | [
"java.lang.reflect.Member",
"java.lang.reflect.Modifier",
"java.util.Arrays"
] | import java.lang.reflect.Member; import java.lang.reflect.Modifier; import java.util.Arrays; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,725,822 |
final OrderedCurrencyPair test = OrderedCurrencyPair.of(Currency.GBP, Currency.USD);
assertEquals(Currency.GBP, test.getFirstCurrency());
assertEquals(Currency.USD, test.getSecondCurrency());
assertEquals("OrderedCurrencyPair{firstCurrency=GBP, secondCurrency=USD}", test.toString());
} | final OrderedCurrencyPair test = OrderedCurrencyPair.of(Currency.GBP, Currency.USD); assertEquals(Currency.GBP, test.getFirstCurrency()); assertEquals(Currency.USD, test.getSecondCurrency()); assertEquals(STR, test.toString()); } | /**
* Tests construction from two currencies.
*/ | Tests construction from two currencies | testOfCurrencyCurrencyOrder1 | {
"repo_name": "McLeodMoores/starling",
"path": "projects/util/src/test/java/com/opengamma/util/money/OrderedCurrencyPairTest.java",
"license": "apache-2.0",
"size": 6265
} | [
"org.testng.Assert"
] | import org.testng.Assert; | import org.testng.*; | [
"org.testng"
] | org.testng; | 2,532,237 |
public static String getMessageJSON(Exception exception, String endClass) {
// START BUILD JSON
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JSONObject jsonobj_error = new JSONObject(); // {}
JSONObject jsonobj_error_data = new JSONObject(); // {}
JSONArray jsonarray_element = new JSONArray();
for (StackTraceElement element : exception.getStackTrace()) {
JSONObject errMessage = new JSONObject();
errMessage.put("class", element.getClassName());
errMessage.put("method", element.getMethodName());
errMessage.put("line", element.getLineNumber());
jsonarray_element.add(errMessage);
//jsonarray_element.add(element.getClassName() + " / " + element.getMethodName() + "() / " + element.getLineNumber());
if (element.getClassName().equals(endClass)) {
break;
}
}
// get error code
String code = "";
String userMessage = "";
if (exception.toString().contains("NullPointerException")) {
code = "1";
userMessage = "some value is not available";
} else if (exception.toString().contains("ValidateJSONObjectException")) {
code = "2";
String[] ex = exception.toString().split(": ");
userMessage = "validate JSON object exception: " + ex[1];
}
// output
jsonobj_error.put("errors", jsonobj_error_data);
jsonobj_error_data.put("internalMessage", exception.toString());
jsonobj_error_data.put("userMessage", userMessage);
jsonobj_error_data.put("code", code);
jsonobj_error_data.put("developerInfo", jsonarray_element);
// OUTPUT AS pretty print JSON
return gson.toJson(jsonobj_error);
}
| static String function(Exception exception, String endClass) { Gson gson = new GsonBuilder().setPrettyPrinting().create(); JSONObject jsonobj_error = new JSONObject(); JSONObject jsonobj_error_data = new JSONObject(); JSONArray jsonarray_element = new JSONArray(); for (StackTraceElement element : exception.getStackTrace()) { JSONObject errMessage = new JSONObject(); errMessage.put("class", element.getClassName()); errMessage.put(STR, element.getMethodName()); errMessage.put("line", element.getLineNumber()); jsonarray_element.add(errMessage); if (element.getClassName().equals(endClass)) { break; } } String code = STRSTRNullPointerExceptionSTR1STRsome value is not availableSTRValidateJSONObjectExceptionSTR2STR: STRvalidate JSON object exception: STRerrorsSTRinternalMessageSTRuserMessageSTRcodeSTRdeveloperInfo", jsonarray_element); return gson.toJson(jsonobj_error); } | /**
* JSON ERROR MESSAGE for catch exceptions
*
* @param exception
* @param endClass
* @return error message JSON
*/ | JSON ERROR MESSAGE for catch exceptions | getMessageJSON | {
"repo_name": "mainzed/labelingsystem-server",
"path": "api/src/main/java/exceptions/Logging.java",
"license": "mit",
"size": 4227
} | [
"com.google.gson.Gson",
"com.google.gson.GsonBuilder",
"org.json.simple.JSONArray",
"org.json.simple.JSONObject"
] | import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.json.simple.JSONArray; import org.json.simple.JSONObject; | import com.google.gson.*; import org.json.simple.*; | [
"com.google.gson",
"org.json.simple"
] | com.google.gson; org.json.simple; | 505,602 |
public void testRequestClasspathContainerUpdate() throws CoreException {
IJavaProject testProject = getTestProject();
IClasspathContainer classpathContainer = JavaCore.getClasspathContainer(
defaultRuntimePath, testProject);
final List<IClasspathEntry> newClasspathEntries = new ArrayList<IClasspathEntry>();
IClasspathEntry[] classpathEntries = classpathContainer.getClasspathEntries();
for (IClasspathEntry classpathEntry : classpathEntries) {
if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
IClasspathAttribute[] extraAttributes = classpathEntry.getExtraAttributes();
List<IClasspathAttribute> newAttributes = new ArrayList<IClasspathAttribute>();
for (IClasspathAttribute extraAttribute : extraAttributes) {
String attributeName = extraAttribute.getName();
if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attributeName)) {
String attributeValue = extraAttribute.getValue() + "modified";
extraAttribute = JavaCore.newClasspathAttribute(attributeName,
attributeValue);
}
newAttributes.add(extraAttribute);
}
IPath sourceAttachmentPath = new Path("/sourceAttachmentPath");
IPath sourceAttachmentRootPath = new Path("sourceAttachmentRootPath");
classpathEntry = JavaCore.newLibraryEntry(classpathEntry.getPath(),
sourceAttachmentPath, sourceAttachmentRootPath,
classpathEntry.getAccessRules(),
newAttributes.toArray(new IClasspathAttribute[0]),
classpathEntry.isExported());
}
newClasspathEntries.add(classpathEntry);
} | void function() throws CoreException { IJavaProject testProject = getTestProject(); IClasspathContainer classpathContainer = JavaCore.getClasspathContainer( defaultRuntimePath, testProject); final List<IClasspathEntry> newClasspathEntries = new ArrayList<IClasspathEntry>(); IClasspathEntry[] classpathEntries = classpathContainer.getClasspathEntries(); for (IClasspathEntry classpathEntry : classpathEntries) { if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) { IClasspathAttribute[] extraAttributes = classpathEntry.getExtraAttributes(); List<IClasspathAttribute> newAttributes = new ArrayList<IClasspathAttribute>(); for (IClasspathAttribute extraAttribute : extraAttributes) { String attributeName = extraAttribute.getName(); if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attributeName)) { String attributeValue = extraAttribute.getValue() + STR; extraAttribute = JavaCore.newClasspathAttribute(attributeName, attributeValue); } newAttributes.add(extraAttribute); } IPath sourceAttachmentPath = new Path(STR); IPath sourceAttachmentRootPath = new Path(STR); classpathEntry = JavaCore.newLibraryEntry(classpathEntry.getPath(), sourceAttachmentPath, sourceAttachmentRootPath, classpathEntry.getAccessRules(), newAttributes.toArray(new IClasspathAttribute[0]), classpathEntry.isExported()); } newClasspathEntries.add(classpathEntry); } | /**
* TODO: We need to revisit this test. Since we don't allow container updates
* right now, it is not clear that the test is sufficiently strong.
*/ | right now, it is not clear that the test is sufficiently strong | testRequestClasspathContainerUpdate | {
"repo_name": "briandealwis/gwt-eclipse-plugin",
"path": "plugins/com.gwtplugins.gwt.eclipse.core.test/src/com/google/gwt/eclipse/core/runtime/GWTRuntimeContainerInitializerTest.java",
"license": "epl-1.0",
"size": 7692
} | [
"java.util.ArrayList",
"java.util.List",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.IPath",
"org.eclipse.core.runtime.Path",
"org.eclipse.jdt.core.IClasspathAttribute",
"org.eclipse.jdt.core.IClasspathContainer",
"org.eclipse.jdt.core.IClasspathEntry",
"org.eclipse.jdt.core.IJavaProject",
"org.eclipse.jdt.core.JavaCore"
] | import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.IClasspathAttribute; import org.eclipse.jdt.core.IClasspathContainer; import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaCore; | import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; | [
"java.util",
"org.eclipse.core",
"org.eclipse.jdt"
] | java.util; org.eclipse.core; org.eclipse.jdt; | 964,461 |
private static void fillVMAddresses(HotSpotVMConfigStore config) {
for (VMField vmField : config.getFields().values()) {
if (vmField.value != null && vmField.value instanceof Long) {
final long address = (Long) vmField.value;
String value = vmField.name;
if (address != 0) {
vmAddresses.put(address, value);
}
}
}
for (Entry<String, Long> vmAddress : config.getAddresses().entrySet()) {
final long address = vmAddress.getValue();
String value = vmAddress.getKey();
String old = vmAddresses.put(address, value);
if (old != null) {
throw new InternalError("already in map: address: " + address + ", current: " + value + ", old: " + old);
}
}
} | static void function(HotSpotVMConfigStore config) { for (VMField vmField : config.getFields().values()) { if (vmField.value != null && vmField.value instanceof Long) { final long address = (Long) vmField.value; String value = vmField.name; if (address != 0) { vmAddresses.put(address, value); } } } for (Entry<String, Long> vmAddress : config.getAddresses().entrySet()) { final long address = vmAddress.getValue(); String value = vmAddress.getKey(); String old = vmAddresses.put(address, value); if (old != null) { throw new InternalError(STR + address + STR + value + STR + old); } } } | /**
* Returns a value-name map of all {@link VMField} fields.
*/ | Returns a value-name map of all <code>VMField</code> fields | fillVMAddresses | {
"repo_name": "md-5/jdk10",
"path": "src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/DataBuilder.java",
"license": "gpl-2.0",
"size": 9240
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 584,382 |
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<VirtualHubInner> listByResourceGroup(String resourceGroupName); | @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<VirtualHubInner> listByResourceGroup(String resourceGroupName); | /**
* Lists all the VirtualHubs in a resource group.
*
* @param resourceGroupName The resource group name of the VirtualHub.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to list VirtualHubs.
*/ | Lists all the VirtualHubs in a resource group | listByResourceGroup | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VirtualHubsClient.java",
"license": "mit",
"size": 30840
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedIterable",
"com.azure.resourcemanager.network.fluent.models.VirtualHubInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.network.fluent.models.VirtualHubInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,573,412 |
private boolean contains(BratBaseRelation r1, BratBaseRelation r2,
BratDocument doc1, BratDocument doc2) {
for (String role1 : r1.getArguments().keySet()) {
String argId1 = r1.getArgId(role1);
checkArgument(
argId1.length() > 0 && argId1.charAt(0) == 'T',
"Does not support recursive matching: %d",
r1);
if (!r2.containsRole(role1)) {
return false;
}
String argId2 = r2.getArgId(role1);
checkArgument(
argId2.length() > 0 && argId2.charAt(0) == 'T',
"Does not support recursive matching: %d",
r2);
if (!entityEquator.equate(
(BratEntity) doc1.getAnnotation(argId1),
(BratEntity) doc2.getAnnotation(argId2))) {
return false;
}
}
return true;
} | boolean function(BratBaseRelation r1, BratBaseRelation r2, BratDocument doc1, BratDocument doc2) { for (String role1 : r1.getArguments().keySet()) { String argId1 = r1.getArgId(role1); checkArgument( argId1.length() > 0 && argId1.charAt(0) == 'T', STR, r1); if (!r2.containsRole(role1)) { return false; } String argId2 = r2.getArgId(role1); checkArgument( argId2.length() > 0 && argId2.charAt(0) == 'T', STR, r2); if (!entityEquator.equate( (BratEntity) doc1.getAnnotation(argId1), (BratEntity) doc2.getAnnotation(argId2))) { return false; } } return true; } | /**
* for every role:arg in r1, r2 contains role:arg
*/ | for every role:arg in r1, r2 contains role:arg | contains | {
"repo_name": "yfpeng/pengyifan-brat",
"path": "src/main/java/com/pengyifan/brat/util/BratMerge.java",
"license": "bsd-3-clause",
"size": 10076
} | [
"com.google.common.base.Preconditions",
"com.pengyifan.brat.BratBaseRelation",
"com.pengyifan.brat.BratDocument",
"com.pengyifan.brat.BratEntity"
] | import com.google.common.base.Preconditions; import com.pengyifan.brat.BratBaseRelation; import com.pengyifan.brat.BratDocument; import com.pengyifan.brat.BratEntity; | import com.google.common.base.*; import com.pengyifan.brat.*; | [
"com.google.common",
"com.pengyifan.brat"
] | com.google.common; com.pengyifan.brat; | 1,945,609 |
public synchronized void mark(final int limit) {
try {
in.mark(limit);
} catch (IOException ioe) {
throw new RuntimeException(ioe.getMessage());
}
} | synchronized void function(final int limit) { try { in.mark(limit); } catch (IOException ioe) { throw new RuntimeException(ioe.getMessage()); } } | /**
* Marks the read limit of the Reader.
*
* @param limit the maximum limit of bytes that can be read before the
* mark position becomes invalid
*/ | Marks the read limit of the Reader | mark | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/drools-master/drools-core/src/main/java/org/drools/core/io/impl/ReaderInputStream.java",
"license": "mit",
"size": 5939
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,777,567 |
private void smartPut(HashMap<URI, Model> map, URI key, Statement s) {
if (map.containsKey(key))
map.get(key).add(s);
else {
Model m = new LinkedHashModel();
m.add(s);
map.put(key, m);
}
} | void function(HashMap<URI, Model> map, URI key, Statement s) { if (map.containsKey(key)) map.get(key).add(s); else { Model m = new LinkedHashModel(); m.add(s); map.put(key, m); } } | /**
* quick function to support multiple statements linked to one md5sum
*
* @param map
* @param key
* @param s
*/ | quick function to support multiple statements linked to one md5sum | smartPut | {
"repo_name": "nvdk/ods-lodms-plugins",
"path": "lodms-ods-transformers/web-translator/src/main/java/com/tenforce/lodms/transformers/translators/TranslationCache.java",
"license": "gpl-2.0",
"size": 7443
} | [
"java.util.HashMap",
"org.openrdf.model.Model",
"org.openrdf.model.Statement",
"org.openrdf.model.impl.LinkedHashModel"
] | import java.util.HashMap; import org.openrdf.model.Model; import org.openrdf.model.Statement; import org.openrdf.model.impl.LinkedHashModel; | import java.util.*; import org.openrdf.model.*; import org.openrdf.model.impl.*; | [
"java.util",
"org.openrdf.model"
] | java.util; org.openrdf.model; | 1,147,845 |
public static Option provision(final InputStream... streams) {
validateNotNull(streams, "streams");
final UrlProvisionOption[] options = new UrlProvisionOption[streams.length];
int i = 0;
for (InputStream stream : streams) {
options[i++] = streamBundle(stream);
}
return provision(options);
} | static Option function(final InputStream... streams) { validateNotNull(streams, STR); final UrlProvisionOption[] options = new UrlProvisionOption[streams.length]; int i = 0; for (InputStream stream : streams) { options[i++] = streamBundle(stream); } return provision(options); } | /**
* Creates a composite option of {@link ProvisionOption}s. This is handy when bundles are built
* on the fly via TinyBundles.
*
* @param streams
* provision sources
*
* @return composite option of provision options
*
* @throws IllegalArgumentException
* - If a problem occured while flushing streams
*/ | Creates a composite option of <code>ProvisionOption</code>s. This is handy when bundles are built on the fly via TinyBundles | provision | {
"repo_name": "ops4j/org.ops4j.pax.exam2",
"path": "core/pax-exam/src/main/java/org/ops4j/pax/exam/CoreOptions.java",
"license": "apache-2.0",
"size": 30795
} | [
"java.io.InputStream",
"org.ops4j.lang.NullArgumentException",
"org.ops4j.pax.exam.options.UrlProvisionOption"
] | import java.io.InputStream; import org.ops4j.lang.NullArgumentException; import org.ops4j.pax.exam.options.UrlProvisionOption; | import java.io.*; import org.ops4j.lang.*; import org.ops4j.pax.exam.options.*; | [
"java.io",
"org.ops4j.lang",
"org.ops4j.pax"
] | java.io; org.ops4j.lang; org.ops4j.pax; | 158,171 |
public static AdminClient createAdminClient(String[] dirServiceAddresses, UserCredentials userCredentials,
SSLOptions sslOptions, Options options) {
return createAdminClient(defaultType, dirServiceAddresses, userCredentials, sslOptions, options);
} | static AdminClient function(String[] dirServiceAddresses, UserCredentials userCredentials, SSLOptions sslOptions, Options options) { return createAdminClient(defaultType, dirServiceAddresses, userCredentials, sslOptions, options); } | /**
* Returns an instance of a admin client with multiple DIR Addresses.
*
* @param dirServiceAddresses
* Addresses of the DIR services (Format: ip-addr:port, e.g. localhost:32638)
* @param userCredentials
* Name and Groups of the user.
* @param sslOptions
* NULL if no SSL is used.
* @param options
* Has to contain loglevel string and logfile path.
*
*/ | Returns an instance of a admin client with multiple DIR Addresses | createAdminClient | {
"repo_name": "rbaerzib/xtreemfs",
"path": "java/servers/src/org/xtreemfs/common/libxtreemfs/ClientFactory.java",
"license": "bsd-3-clause",
"size": 7788
} | [
"org.xtreemfs.foundation.SSLOptions",
"org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC"
] | import org.xtreemfs.foundation.SSLOptions; import org.xtreemfs.foundation.pbrpc.generatedinterfaces.RPC; | import org.xtreemfs.foundation.*; import org.xtreemfs.foundation.pbrpc.generatedinterfaces.*; | [
"org.xtreemfs.foundation"
] | org.xtreemfs.foundation; | 1,572,918 |
public void assign(Task task) {
LOG.info("New task received.");
if (this.task != null) {
try {
LOG.error("Worker already busy with another task");
taskManager.fail(this.task, new TaskCompletionFailedException("The worker was assigned a new task before it could finish its previous task"));
} catch (TaskContextException e) {
throw new IllegalStateException();
}
}
this.task = task;
} | void function(Task task) { LOG.info(STR); if (this.task != null) { try { LOG.error(STR); taskManager.fail(this.task, new TaskCompletionFailedException(STR)); } catch (TaskContextException e) { throw new IllegalStateException(); } } this.task = task; } | /**
* Assigns a new task to the worker thread
* @param task the task to be carried out
*/ | Assigns a new task to the worker thread | assign | {
"repo_name": "agileapes/couteau",
"path": "couteau-concurrency/src/main/java/com/mmnaseri/couteau/concurrency/worker/TaskWorker.java",
"license": "mit",
"size": 7015
} | [
"com.mmnaseri.couteau.concurrency.error.TaskCompletionFailedException",
"com.mmnaseri.couteau.concurrency.error.TaskContextException",
"com.mmnaseri.couteau.concurrency.task.Task"
] | import com.mmnaseri.couteau.concurrency.error.TaskCompletionFailedException; import com.mmnaseri.couteau.concurrency.error.TaskContextException; import com.mmnaseri.couteau.concurrency.task.Task; | import com.mmnaseri.couteau.concurrency.error.*; import com.mmnaseri.couteau.concurrency.task.*; | [
"com.mmnaseri.couteau"
] | com.mmnaseri.couteau; | 120,920 |
void invalidate(String bpid, Block invalidBlks[]) throws IOException; | void invalidate(String bpid, Block invalidBlks[]) throws IOException; | /**
* Invalidates the specified blocks
* @param bpid Block pool Id
* @param invalidBlks - the blocks to be invalidated
* @throws IOException
*/ | Invalidates the specified blocks | invalidate | {
"repo_name": "WIgor/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java",
"license": "apache-2.0",
"size": 21835
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.Block"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.Block; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,554,217 |
public static ExpectedCondition<Boolean> urlMatches(final String regex) {
return new ExpectedCondition<Boolean>() {
private String currentUrl;
private Pattern pattern;
private Matcher matcher; | static ExpectedCondition<Boolean> function(final String regex) { return new ExpectedCondition<Boolean>() { private String currentUrl; private Pattern pattern; private Matcher matcher; | /**
* Expectation for the URL to match a specific regular expression
*
* @param regex the regular expression that the URL should match
* @return <code>true</code> if the URL matches the specified regular expression
*/ | Expectation for the URL to match a specific regular expression | urlMatches | {
"repo_name": "dibagga/selenium",
"path": "java/client/src/org/openqa/selenium/support/ui/ExpectedConditions.java",
"license": "apache-2.0",
"size": 50698
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 535,241 |
public void setValue(int v) {
setTypedValue(v, AdjustmentEvent.TRACK);
} | void function(int v) { setTypedValue(v, AdjustmentEvent.TRACK); } | /**
* Sets the value of this scrollbar to the specified value.
* <p>
* If the value supplied is less than the current minimum or
* greater than the current maximum, then one of those values is
* substituted, as appropriate.
*
* @param v the new value of the scrollbar
*/ | Sets the value of this scrollbar to the specified value. If the value supplied is less than the current minimum or greater than the current maximum, then one of those values is substituted, as appropriate | setValue | {
"repo_name": "isaacl/openjdk-jdk",
"path": "src/share/classes/java/awt/ScrollPaneAdjustable.java",
"license": "gpl-2.0",
"size": 14924
} | [
"java.awt.event.AdjustmentEvent"
] | import java.awt.event.AdjustmentEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 546,953 |
@RequestMapping(value = "/template/{id:[\\d]+}/delete", method = { RequestMethod.GET })
@ResponseBody
public IRestResponse deleteTemplate(@PathVariable final long id, HttpServletRequest request)
throws UnsupportedEncodingException {
logger.info("Request received. URL: '/lider/report/template/{}/delete'", id);
IRestResponse restResponse = reportProcessor.deleteTemplate(id);
logger.debug("Completed processing request, returning result: {}", restResponse.toJson());
return restResponse;
} | @RequestMapping(value = STR, method = { RequestMethod.GET }) IRestResponse function(@PathVariable final long id, HttpServletRequest request) throws UnsupportedEncodingException { logger.info(STR, id); IRestResponse restResponse = reportProcessor.deleteTemplate(id); logger.debug(STR, restResponse.toJson()); return restResponse; } | /**
* Delete template specified by id.
*
* @param id
* @param request
* @return
* @throws UnsupportedEncodingException
*/ | Delete template specified by id | deleteTemplate | {
"repo_name": "Pardus-LiderAhenk/lider",
"path": "lider-web/src/main/java/tr/org/liderahenk/web/controller/ReportController.java",
"license": "lgpl-3.0",
"size": 12551
} | [
"java.io.UnsupportedEncodingException",
"javax.servlet.http.HttpServletRequest",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"tr.org.liderahenk.lider.core.api.rest.responses.IRestResponse"
] | import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import tr.org.liderahenk.lider.core.api.rest.responses.IRestResponse; | import java.io.*; import javax.servlet.http.*; import org.springframework.web.bind.annotation.*; import tr.org.liderahenk.lider.core.api.rest.responses.*; | [
"java.io",
"javax.servlet",
"org.springframework.web",
"tr.org.liderahenk"
] | java.io; javax.servlet; org.springframework.web; tr.org.liderahenk; | 678,038 |
@Override
public void processingInstruction(String target, String data) throws SAXException {
writeText4Links();
write("<?");
write(target);
write(' ');
write(data);
write("?>");
if (elementLevel < 1) {
write('\n');
}
super.processingInstruction(target, data);
}
// //////////////////////////////////////////////////////////////////
// Internal methods.
// ////////////////////////////////////////////////////////////////// | void function(String target, String data) throws SAXException { writeText4Links(); write("<?"); write(target); write(' '); write(data); write("?>"); if (elementLevel < 1) { write('\n'); } super.processingInstruction(target, data); } | /**
* Write a processing instruction.
* <p>
* Pass the event on down the filter chain for further processing.
*
* @param target The PI target.
* @param data The PI data.
* @throws org.xml.sax.SAXException If there is an error writing the PI, or if a handler
* further down the filter chain raises an exception.
* @see org.xml.sax.ContentHandler#processingInstruction
*/ | Write a processing instruction. Pass the event on down the filter chain for further processing | processingInstruction | {
"repo_name": "1gravity/Android-RTEditor",
"path": "RTEditor/src/main/java/com/onegravity/rteditor/converter/tagsoup/HTMLWriter.java",
"license": "apache-2.0",
"size": 41140
} | [
"org.xml.sax.SAXException"
] | import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,641,707 |
void addProject(Project project) throws ExecutionException, InterruptedException; | void addProject(Project project) throws ExecutionException, InterruptedException; | /**
* Add project to event service.
*
* @param project project to add
* @throws ExecutionException error pushing project to event server
* @throws InterruptedException event thread was interrupted
*/ | Add project to event service | addProject | {
"repo_name": "clebi/projecter-spark",
"path": "src/main/java/org/clebi/projecterspark/services/events/ProjectEventService.java",
"license": "apache-2.0",
"size": 1121
} | [
"java.util.concurrent.ExecutionException",
"org.clebi.projecterspark.models.Project"
] | import java.util.concurrent.ExecutionException; import org.clebi.projecterspark.models.Project; | import java.util.concurrent.*; import org.clebi.projecterspark.models.*; | [
"java.util",
"org.clebi.projecterspark"
] | java.util; org.clebi.projecterspark; | 2,881,609 |
void filter( Text prefix, Text body, Text suffix, BlockType type );
| void filter( Text prefix, Text body, Text suffix, BlockType type ); | /** Replace the contents of the body parameter with the filtered version. The output is the contents of the body
* parameter. That is, the body will hold the filtered input.
*
* @param prefix empty with TEXT blocks. Holds the surrounding markup (e.g. the <listing> tag or backquote) for code.
* Note that the replacement text is specified on return by the {@code body} object. If you don't transfer
* the prefix or suffix to the body within your filter, they are effectively removed from the output.
* @param body (OUTPUT) the entire text in a TEXT block or the body of the code block in the case of code.
* On exit, the contents of this object will replace the prefix-body-suffix set in the input.
* @param suffix empty with TEXT blocks. Holds the surrounding markup (e.g. the </listing> tag or backquote) for code.
* Note that the replacement text is specified on return by the {@code body} object. If you don't transfer
* the prefix or suffix to the body within your filter, they are effectively removed from the output.
*/ | Replace the contents of the body parameter with the filtered version. The output is the contents of the body parameter. That is, the body will hold the filtered input | filter | {
"repo_name": "aholub/hml",
"path": "Hml/src/com/holub/hml/Filter.java",
"license": "bsd-3-clause",
"size": 3588
} | [
"com.holub.text.Text"
] | import com.holub.text.Text; | import com.holub.text.*; | [
"com.holub.text"
] | com.holub.text; | 1,704,703 |
public GeneralNames getDataLocations()
{
return data.getDataLocations();
} | GeneralNames function() { return data.getDataLocations(); } | /**
* Get data locations, where the copy of request Data can be obtained.
* Note: the exact meaning of field is up to applications.
* Note: this field can be set by DVCS.
*
* @return
*/ | Get data locations, where the copy of request Data can be obtained. Note: the exact meaning of field is up to applications. Note: this field can be set by DVCS | getDataLocations | {
"repo_name": "sake/bouncycastle-java",
"path": "src/org/bouncycastle/dvcs/DVCSRequestInfo.java",
"license": "mit",
"size": 6296
} | [
"org.bouncycastle.asn1.x509.GeneralNames"
] | import org.bouncycastle.asn1.x509.GeneralNames; | import org.bouncycastle.asn1.x509.*; | [
"org.bouncycastle.asn1"
] | org.bouncycastle.asn1; | 420,583 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
newChildDescriptors.add
(createChildParameter
(org_eclipse_smarthome_schemas_thing_description_v1__0SimplifiedPackage.Literals.OPTIONS_TYPE__OPTIONS,
org_eclipse_smarthome_schemas_thing_description_v1__0SimplifiedFactory.eINSTANCE.createOptionType()));
} | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add (createChildParameter (org_eclipse_smarthome_schemas_thing_description_v1__0SimplifiedPackage.Literals.OPTIONS_TYPE__OPTIONS, org_eclipse_smarthome_schemas_thing_description_v1__0SimplifiedFactory.eINSTANCE.createOptionType())); } | /**
* 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": "patrickneubauer/XMLIntellEdit",
"path": "xmlintelledit/classes.edit/src/org_eclipse_smarthome_schemas_thing_description_v1__0Simplified/provider/OptionsTypeItemProvider.java",
"license": "mit",
"size": 5452
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,063,630 |
@Test
public void testT1RV6D3_T1LV10D1() {
test_id = getTestId("T1RV6D3", "T1LV10D1", "142");
String src = selectTRVD("T1RV6D3");
String dest = selectTLVD("T1LV10D1");
String result = ".";
try {
result = TRVD_TLVD_Action(src, dest);
} catch (RecognitionException e) {
e.printStackTrace();
} catch (TokenStreamException e) {
e.printStackTrace();
}
assertTrue(ReturnFailureBridge4,
checkResult_ReturnFailureBridge4(src, dest, result));
GraphicalEditor editor = getActiveEditor();
if (editor != null) {
validateOrGenerateResults(editor, generateResults);
}
}
| void function() { test_id = getTestId(STR, STR, "142"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ReturnFailureBridge4, checkResult_ReturnFailureBridge4(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } } | /**
* Perform the test for the given matrix column (T1RV6D3) and row
* (T1LV10D1).
*
*/ | Perform the test for the given matrix column (T1RV6D3) and row (T1LV10D1) | testT1RV6D3_T1LV10D1 | {
"repo_name": "jason-rhodes/bridgepoint",
"path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_12_Generics.java",
"license": "apache-2.0",
"size": 155634
} | [
"org.xtuml.bp.ui.graphics.editor.GraphicalEditor"
] | import org.xtuml.bp.ui.graphics.editor.GraphicalEditor; | import org.xtuml.bp.ui.graphics.editor.*; | [
"org.xtuml.bp"
] | org.xtuml.bp; | 1,489,450 |
public EventJournal onEventStopped(LogEvent event); | EventJournal function(LogEvent event); | /**
* Callback hook triggered when a journal event is stopped.
* @param event
* @return
*/ | Callback hook triggered when a journal event is stopped | onEventStopped | {
"repo_name": "davidonlaptop/logshaper",
"path": "src/main/java/net/davidlauzon/logshaper/journal/EventJournal.java",
"license": "apache-2.0",
"size": 2675
} | [
"net.davidlauzon.logshaper.event.LogEvent"
] | import net.davidlauzon.logshaper.event.LogEvent; | import net.davidlauzon.logshaper.event.*; | [
"net.davidlauzon.logshaper"
] | net.davidlauzon.logshaper; | 2,221,924 |
public static Arc2D computeArc(double x0, double y0,
double rx, double ry,
double angle,
boolean largeArcFlag,
boolean sweepFlag,
double x, double y) {
//
// Elliptical arc implementation based on the SVG specification notes
//
// Compute the half distance between the current and the final point
double dx2 = (x0 - x) / 2.0;
double dy2 = (y0 - y) / 2.0;
// Convert angle from degrees to radians
angle = Math.toRadians(angle % 360.0);
double cosAngle = Math.cos(angle);
double sinAngle = Math.sin(angle);
//
// Step 1 : Compute (x1, y1)
//
double x1 = (cosAngle * dx2 + sinAngle * dy2);
double y1 = (-sinAngle * dx2 + cosAngle * dy2);
// Ensure radii are large enough
rx = Math.abs(rx);
ry = Math.abs(ry);
double Prx = rx * rx;
double Pry = ry * ry;
double Px1 = x1 * x1;
double Py1 = y1 * y1;
// check that radii are large enough
double radiiCheck = Px1/Prx + Py1/Pry;
if (radiiCheck > 0.99999) { // don't cut it too close
double radiiScale = Math.sqrt(radiiCheck) * 1.00001;
rx = radiiScale * rx;
ry = radiiScale * ry;
Prx = rx * rx;
Pry = ry * ry;
}
//
// Step 2 : Compute (cx1, cy1)
//
double sign = (largeArcFlag == sweepFlag) ? -1 : 1;
double sq = ((Prx*Pry)-(Prx*Py1)-(Pry*Px1)) / ((Prx*Py1)+(Pry*Px1));
sq = (sq < 0) ? 0 : sq;
double coef = (sign * Math.sqrt(sq));
double cx1 = coef * ((rx * y1) / ry);
double cy1 = coef * -((ry * x1) / rx);
//
// Step 3 : Compute (cx, cy) from (cx1, cy1)
//
double sx2 = (x0 + x) / 2.0;
double sy2 = (y0 + y) / 2.0;
double cx = sx2 + (cosAngle * cx1 - sinAngle * cy1);
double cy = sy2 + (sinAngle * cx1 + cosAngle * cy1);
//
// Step 4 : Compute the angleStart (angle1) and the angleExtent (dangle)
//
double ux = (x1 - cx1) / rx;
double uy = (y1 - cy1) / ry;
double vx = (-x1 - cx1) / rx;
double vy = (-y1 - cy1) / ry;
double p, n;
// Compute the angle start
n = Math.sqrt((ux * ux) + (uy * uy));
p = ux; // (1 * ux) + (0 * uy)
sign = (uy < 0) ? -1.0 : 1.0;
double angleStart = Math.toDegrees(sign * Math.acos(p / n));
// Compute the angle extent
n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy));
p = ux * vx + uy * vy;
sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0;
double angleExtent = Math.toDegrees(sign * Math.acos(p / n));
if(!sweepFlag && angleExtent > 0) {
angleExtent -= 360f;
} else if (sweepFlag && angleExtent < 0) {
angleExtent += 360f;
}
angleExtent %= 360f;
angleStart %= 360f;
//
// We can now build the resulting Arc2D in double precision
//
Arc2D.Double arc = new Arc2D.Double();
arc.x = cx - rx;
arc.y = cy - ry;
arc.width = rx * 2.0;
arc.height = ry * 2.0;
arc.start = -angleStart;
arc.extent = -angleExtent;
return arc;
} | static Arc2D function(double x0, double y0, double rx, double ry, double angle, boolean largeArcFlag, boolean sweepFlag, double x, double y) { double dx2 = (x0 - x) / 2.0; double dy2 = (y0 - y) / 2.0; angle = Math.toRadians(angle % 360.0); double cosAngle = Math.cos(angle); double sinAngle = Math.sin(angle); double y1 = (-sinAngle * dx2 + cosAngle * dy2); rx = Math.abs(rx); ry = Math.abs(ry); double Prx = rx * rx; double Pry = ry * ry; double Px1 = x1 * x1; double Py1 = y1 * y1; double radiiCheck = Px1/Prx + Py1/Pry; if (radiiCheck > 0.99999) { double radiiScale = Math.sqrt(radiiCheck) * 1.00001; rx = radiiScale * rx; ry = radiiScale * ry; Prx = rx * rx; Pry = ry * ry; } double sq = ((Prx*Pry)-(Prx*Py1)-(Pry*Px1)) / ((Prx*Py1)+(Pry*Px1)); sq = (sq < 0) ? 0 : sq; double coef = (sign * Math.sqrt(sq)); double cx1 = coef * ((rx * y1) / ry); double cy1 = coef * -((ry * x1) / rx); double sy2 = (y0 + y) / 2.0; double cx = sx2 + (cosAngle * cx1 - sinAngle * cy1); double cy = sy2 + (sinAngle * cx1 + cosAngle * cy1); double uy = (y1 - cy1) / ry; double vx = (-x1 - cx1) / rx; double vy = (-y1 - cy1) / ry; double p, n; n = Math.sqrt((ux * ux) + (uy * uy)); p = ux; sign = (uy < 0) ? -1.0 : 1.0; double angleStart = Math.toDegrees(sign * Math.acos(p / n)); n = Math.sqrt((ux * ux + uy * uy) * (vx * vx + vy * vy)); p = ux * vx + uy * vy; sign = (ux * vy - uy * vx < 0) ? -1.0 : 1.0; double angleExtent = Math.toDegrees(sign * Math.acos(p / n)); if(!sweepFlag && angleExtent > 0) { angleExtent -= 360f; } else if (sweepFlag && angleExtent < 0) { angleExtent += 360f; } angleExtent %= 360f; angleStart %= 360f; arc.x = cx - rx; arc.y = cy - ry; arc.width = rx * 2.0; arc.height = ry * 2.0; arc.start = -angleStart; arc.extent = -angleExtent; return arc; } | /**
* This constructs an unrotated Arc2D from the SVG specification of an
* Elliptical arc. To get the final arc you need to apply a rotation
* transform such as:
*
* AffineTransform.getRotateInstance
* (angle, arc.getX()+arc.getWidth()/2, arc.getY()+arc.getHeight()/2);
*/ | This constructs an unrotated Arc2D from the SVG specification of an Elliptical arc. To get the final arc you need to apply a rotation transform such as: AffineTransform.getRotateInstance (angle, arc.getX()+arc.getWidth()/2, arc.getY()+arc.getHeight()/2) | computeArc | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/ext/awt/geom/ExtendedGeneralPath.java",
"license": "apache-2.0",
"size": 24122
} | [
"java.awt.geom.Arc2D"
] | import java.awt.geom.Arc2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,009,090 |
public TimeZone getTimeZone() {
return timeZone;
} | TimeZone function() { return timeZone; } | /**
* Returns the time zone of the date.
*
* @return the time zone
*/ | Returns the time zone of the date | getTimeZone | {
"repo_name": "jdahlstrom/vaadin.react",
"path": "client/src/main/java/com/vaadin/client/renderers/DateRenderer.java",
"license": "apache-2.0",
"size": 3125
} | [
"com.google.gwt.i18n.client.TimeZone"
] | import com.google.gwt.i18n.client.TimeZone; | import com.google.gwt.i18n.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,745,952 |
public void setNonStrokingColor(int g) throws IOException
{
if (isOutside255Interval(g))
{
throw new IllegalArgumentException("Parameter must be within 0..255, but is " + g);
}
setNonStrokingColor(g / 255f);
} | void function(int g) throws IOException { if (isOutside255Interval(g)) { throw new IllegalArgumentException(STR + g); } setNonStrokingColor(g / 255f); } | /**
* Set the non-stroking color in the DeviceGray color space. Range is 0..255.
*
* @param g The gray value.
* @throws IOException If an IO error occurs while writing to the stream.
* @throws IllegalArgumentException If the parameter is invalid.
*/ | Set the non-stroking color in the DeviceGray color space. Range is 0..255 | setNonStrokingColor | {
"repo_name": "benmccann/pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/PDPageContentStream.java",
"license": "apache-2.0",
"size": 73640
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,370,683 |
//
// Network actions.
//
// Start of user code Network_Kind_Up_action
@Override
public void up()
{
LOGGER.debug("Action up() called on " + this);
// Network State Machine.
switch(getOcciNetworkState().getValue()) {
case NetworkStatus.INACTIVE_VALUE:
LOGGER.debug("Fire transition(state=inactive, action=\"up\")...");
// TODO Implement transition(state=inactive, action="up")
if(true){
setOcciNetworkState(NetworkStatus.ACTIVE);
}
else
if(true){
setOcciNetworkState(NetworkStatus.ERROR);
}
break;
default:
break;
}
}
// End of user code | void function() { LOGGER.debug(STR + this); switch(getOcciNetworkState().getValue()) { case NetworkStatus.INACTIVE_VALUE: LOGGER.debug(STRup\")..."); if(true){ setOcciNetworkState(NetworkStatus.ACTIVE); } else if(true){ setOcciNetworkState(NetworkStatus.ERROR); } break; default: break; } } | /**
* Implement OCCI action:
* - scheme: http://schemas.ogf.org/occi/infrastructure/network/action#
* - term: up
* - title:
*/ | Implement OCCI action: - scheme: HREF - term: up - title: | up | {
"repo_name": "occiware/OCCI-Studio",
"path": "plugins/org.eclipse.cmf.occi.infrastructure.connector.dummy/src-gen/org/eclipse/cmf/occi/infrastructure/connector/dummy/NetworkConnector.java",
"license": "epl-1.0",
"size": 4045
} | [
"org.eclipse.cmf.occi.infrastructure.NetworkStatus"
] | import org.eclipse.cmf.occi.infrastructure.NetworkStatus; | import org.eclipse.cmf.occi.infrastructure.*; | [
"org.eclipse.cmf"
] | org.eclipse.cmf; | 905,371 |
EAttribute getContents_Contents(); | EAttribute getContents_Contents(); | /**
* Returns the meta object for the attribute '{@link io.opensemantics.semiotics.model.assessment.Contents#getContents <em>Contents</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Contents</em>'.
* @see io.opensemantics.semiotics.model.assessment.Contents#getContents()
* @see #getContents()
* @generated
*/ | Returns the meta object for the attribute '<code>io.opensemantics.semiotics.model.assessment.Contents#getContents Contents</code>'. | getContents_Contents | {
"repo_name": "CoastalHacking/semiotics-main",
"path": "bundles/io.opensemantics.semiotics.model.assessment/src-gen/io/opensemantics/semiotics/model/assessment/AssessmentPackage.java",
"license": "apache-2.0",
"size": 151116
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,795,314 |
@Override
public void startDoc(final int docID, final int termDocFreq)
throws IOException {
if (docID < 0) {
throw new CorruptIndexException("docs out of order (" + docID + ") (docOut: " + docOut + ")");
}
if (docWriter.isFull()) {
if ((++blockCount % blockSkipInterval) == 0) {
skipWriter.setSkipData(docWriter.getFirstDocId());
skipWriter.bufferSkip(blockCount);
}
docWriter.flush();
nodWriter.flush(); // flush node block to synchronise it with doc block
posWriter.flush(); // flush pos block to synchronise it with doc block
}
docWriter.write(docID);
// reset current node for delta computation
nodWriter.resetCurrentNode();
// reset payload hash to sentinel value
lastNodeHash = Long.MAX_VALUE;
}
private long lastNodeHash = Long.MAX_VALUE;
private final VIntPayloadCodec sirenPayload = new VIntPayloadCodec();
private int nodeFreqInDoc = 0;
private int termFreqInNode = 0; | void function(final int docID, final int termDocFreq) throws IOException { if (docID < 0) { throw new CorruptIndexException(STR + docID + STR + docOut + ")"); } if (docWriter.isFull()) { if ((++blockCount % blockSkipInterval) == 0) { skipWriter.setSkipData(docWriter.getFirstDocId()); skipWriter.bufferSkip(blockCount); } docWriter.flush(); nodWriter.flush(); posWriter.flush(); } docWriter.write(docID); nodWriter.resetCurrentNode(); lastNodeHash = Long.MAX_VALUE; } private long lastNodeHash = Long.MAX_VALUE; private final VIntPayloadCodec sirenPayload = new VIntPayloadCodec(); private int nodeFreqInDoc = 0; private int termFreqInNode = 0; | /**
* Adds a new doc in this term. If this returns null
* then we just skip consuming positions.
* <p>
* {@code termDocFreq} parameter is ignored as term frequency in document is
* not used.
*/ | Adds a new doc in this term. If this returns null then we just skip consuming positions. termDocFreq parameter is ignored as term frequency in document is not used | startDoc | {
"repo_name": "rdelbru/SIREn",
"path": "siren-core/src/main/java/org/sindice/siren/index/codecs/siren10/Siren10PostingsWriter.java",
"license": "apache-2.0",
"size": 16252
} | [
"java.io.IOException",
"org.apache.lucene.index.CorruptIndexException",
"org.sindice.siren.analysis.filter.VIntPayloadCodec"
] | import java.io.IOException; import org.apache.lucene.index.CorruptIndexException; import org.sindice.siren.analysis.filter.VIntPayloadCodec; | import java.io.*; import org.apache.lucene.index.*; import org.sindice.siren.analysis.filter.*; | [
"java.io",
"org.apache.lucene",
"org.sindice.siren"
] | java.io; org.apache.lucene; org.sindice.siren; | 2,863,813 |
// http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?db=livelists&id=JN556047&style=raw
// ERROR 1 Unknown database [livelists].
public String lookupGenbankIds(List<String> genbankId) throws IOException {
StringBuilder sb = new StringBuilder();
sb.append("http://www.ebi.ac.uk/Tools/dbfetch/dbfetch?id=");
for (int i = 0; i < genbankId.size(); i++) {
if (i > 0) sb.append(",");
sb.append(genbankId.get(i));
}
setOutputFormat("&retmode=xml");
urlString = sb.toString();
return getResponse(url);
} | String function(List<String> genbankId) throws IOException { StringBuilder sb = new StringBuilder(); sb.append(STR,STR&retmode=xml"); urlString = sb.toString(); return getResponse(url); } | /** lookup Genbank/ENAIds.
*
* seems to work at EBI. retrieves whole entry
*
* @param genbankId
* @return
* @throws IOException
*/ | lookup Genbank/ENAIds. seems to work at EBI. retrieves whole entry | lookupGenbankIds | {
"repo_name": "petermr/ami-plugin",
"path": "src/main/java/org/xmlcml/ami2/lookups/ENALookup.java",
"license": "apache-2.0",
"size": 1487
} | [
"java.io.IOException",
"java.util.List"
] | import java.io.IOException; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 655,438 |
private void writeQRYDSC(DRDAStatement stmt, boolean FDODSConly)
throws DRDAProtocolException, SQLException
{
ResultSet rs = null;
ResultSetMetaData rsmeta = null;
ParameterMetaData pmeta = null;
if (!stmt.needsToSendParamData)
rs = stmt.getResultSet();
if (rs == null) // this is a CallableStatement, use parameter meta data
pmeta = stmt.getParameterMetaData();
else
rsmeta = rs.getMetaData();
int numCols = (rsmeta != null ? rsmeta.getColumnCount() : pmeta.getParameterCount());
int numGroups = 1;
int colStart = 1;
int colEnd = numCols;
int blksize = stmt.getBlksize() > 0 ? stmt.getBlksize() : CodePoint.QRYBLKSZ_MAX;
if (this.trace) {
trace("numCols = " + numCols);
}
// check for remaining space in current query block
// Need to mod with blksize so remaining doesn't go negative. 4868
int remaining = blksize - (writer.getDSSLength() % blksize) - (3 +
FdocaConstants.SQLCADTA_SQLDTARD_RLO_SIZE);
// calcuate how may columns can be sent in the current query block
int firstcols = remaining/FdocaConstants.SQLDTAGRP_COL_DSC_SIZE;
// check if it doesn't all fit into the first block and
// under FdocaConstants.MAX_VARS_IN_NGDA
if (firstcols < numCols || numCols > FdocaConstants.MAX_VARS_IN_NGDA)
{
// we are limited to FdocaConstants.MAX_VARS_IN_NGDA
if (firstcols > FdocaConstants.MAX_VARS_IN_NGDA)
{
if (this.trace)
SanityManager.ASSERT(numCols > FdocaConstants.MAX_VARS_IN_NGDA,
"Number of columns " + numCols +
" is less than MAX_VARS_IN_NGDA");
numGroups = numCols/FdocaConstants.MAX_VARS_IN_NGDA;
// some left over
if (FdocaConstants.MAX_VARS_IN_NGDA * numGroups < numCols)
numGroups++;
colEnd = FdocaConstants.MAX_VARS_IN_NGDA;
}
else
{
colEnd = firstcols;
numGroups += (numCols-firstcols)/FdocaConstants.MAX_VARS_IN_NGDA;
if (FdocaConstants.MAX_VARS_IN_NGDA * numGroups < numCols)
numGroups++;
}
}
if (! FDODSConly)
{
writer.createDssObject();
writer.startDdm(CodePoint.QRYDSC);
}
for (int i = 0; i < numGroups; i++)
{
writeSQLDTAGRP(stmt, rsmeta, pmeta, colStart, colEnd,
(i == 0 ? true : false),
!FDODSConly );
// Neeraj: If it is the last iteration then don't modify colStart and colEnd.
// This is because there is a bug in derby where some data is not sent when
// the num of columns is greater than 84 and the remaining space in the current
// query block cannot fit all the remainder of (numCols % FdocaConstants.MAX_VARS_IN_NGDA)
// Probably will contribute this to derby.
if (i != numGroups - 1) {
colStart = colEnd + 1;
// 4868 - Limit range to MAX_VARS_IN_NGDA (used to have extra col)
colEnd = colEnd + FdocaConstants.MAX_VARS_IN_NGDA;
if (colEnd > numCols) {
colEnd = numCols;
}
}
}
// GemStone changes BEGIN
// Some more left to be sent
if (colEnd < numCols) {
int left = numCols - colEnd;
if (this.trace) {
trace("number of columns still not sent = " + left);
}
int remainder = left % FdocaConstants.MAX_VARS_IN_NGDA;
int remainingGroups = 0;
if (remainder == 0) {
remainingGroups = left / FdocaConstants.MAX_VARS_IN_NGDA;
}
else {
remainingGroups = (left / FdocaConstants.MAX_VARS_IN_NGDA) + 1;
}
colStart = colEnd + 1;
colEnd = colStart + FdocaConstants.MAX_VARS_IN_NGDA;
if (colEnd > numCols) {
colEnd = numCols;
}
for (int i = 0; i < remainingGroups; i++)
{
writeSQLDTAGRP(stmt, rsmeta, pmeta, colStart, colEnd,
false,
!FDODSConly );
colStart = colEnd + 1;
// 4868 - Limit range to MAX_VARS_IN_NGDA (used to have extra col)
colEnd = colEnd + FdocaConstants.MAX_VARS_IN_NGDA;
if (colEnd > numCols)
colEnd = numCols;
}
}
// GemStone changes END
writer.writeBytes(FdocaConstants.SQLCADTA_SQLDTARD_RLO);
if (! FDODSConly)
writer.endDdmAndDss();
} | void function(DRDAStatement stmt, boolean FDODSConly) throws DRDAProtocolException, SQLException { ResultSet rs = null; ResultSetMetaData rsmeta = null; ParameterMetaData pmeta = null; if (!stmt.needsToSendParamData) rs = stmt.getResultSet(); if (rs == null) pmeta = stmt.getParameterMetaData(); else rsmeta = rs.getMetaData(); int numCols = (rsmeta != null ? rsmeta.getColumnCount() : pmeta.getParameterCount()); int numGroups = 1; int colStart = 1; int colEnd = numCols; int blksize = stmt.getBlksize() > 0 ? stmt.getBlksize() : CodePoint.QRYBLKSZ_MAX; if (this.trace) { trace(STR + numCols); } int remaining = blksize - (writer.getDSSLength() % blksize) - (3 + FdocaConstants.SQLCADTA_SQLDTARD_RLO_SIZE); int firstcols = remaining/FdocaConstants.SQLDTAGRP_COL_DSC_SIZE; if (firstcols < numCols numCols > FdocaConstants.MAX_VARS_IN_NGDA) { if (firstcols > FdocaConstants.MAX_VARS_IN_NGDA) { if (this.trace) SanityManager.ASSERT(numCols > FdocaConstants.MAX_VARS_IN_NGDA, STR + numCols + STR); numGroups = numCols/FdocaConstants.MAX_VARS_IN_NGDA; if (FdocaConstants.MAX_VARS_IN_NGDA * numGroups < numCols) numGroups++; colEnd = FdocaConstants.MAX_VARS_IN_NGDA; } else { colEnd = firstcols; numGroups += (numCols-firstcols)/FdocaConstants.MAX_VARS_IN_NGDA; if (FdocaConstants.MAX_VARS_IN_NGDA * numGroups < numCols) numGroups++; } } if (! FDODSConly) { writer.createDssObject(); writer.startDdm(CodePoint.QRYDSC); } for (int i = 0; i < numGroups; i++) { writeSQLDTAGRP(stmt, rsmeta, pmeta, colStart, colEnd, (i == 0 ? true : false), !FDODSConly ); if (i != numGroups - 1) { colStart = colEnd + 1; colEnd = colEnd + FdocaConstants.MAX_VARS_IN_NGDA; if (colEnd > numCols) { colEnd = numCols; } } } if (colEnd < numCols) { int left = numCols - colEnd; if (this.trace) { trace(STR + left); } int remainder = left % FdocaConstants.MAX_VARS_IN_NGDA; int remainingGroups = 0; if (remainder == 0) { remainingGroups = left / FdocaConstants.MAX_VARS_IN_NGDA; } else { remainingGroups = (left / FdocaConstants.MAX_VARS_IN_NGDA) + 1; } colStart = colEnd + 1; colEnd = colStart + FdocaConstants.MAX_VARS_IN_NGDA; if (colEnd > numCols) { colEnd = numCols; } for (int i = 0; i < remainingGroups; i++) { writeSQLDTAGRP(stmt, rsmeta, pmeta, colStart, colEnd, false, !FDODSConly ); colStart = colEnd + 1; colEnd = colEnd + FdocaConstants.MAX_VARS_IN_NGDA; if (colEnd > numCols) colEnd = numCols; } } writer.writeBytes(FdocaConstants.SQLCADTA_SQLDTARD_RLO); if (! FDODSConly) writer.endDdmAndDss(); } | /**
* Write QRYDSC - Query Answer Set Description
*
* @param stmt DRDAStatement we are working on
* @param FDODSConly simply the FDODSC, without the wrap
*
* Instance Variables
* SQLDTAGRP - required
*
* Only 84 columns can be sent in a single QRYDSC. If there are more columns
* they must be sent in subsequent QRYDSC.
* If the QRYDSC will not fit into the current block, as many columns as can
* fit are sent and then the remaining are sent in the following blocks.
*
* @throws DRDAProtocolException
* @throws SQLException
*/ | Write QRYDSC - Query Answer Set Description | writeQRYDSC | {
"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
} | [
"com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager",
"java.sql.ParameterMetaData",
"java.sql.ResultSet",
"java.sql.ResultSetMetaData",
"java.sql.SQLException"
] | import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager; import java.sql.ParameterMetaData; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; | import com.pivotal.gemfirexd.internal.iapi.services.sanity.*; import java.sql.*; | [
"com.pivotal.gemfirexd",
"java.sql"
] | com.pivotal.gemfirexd; java.sql; | 2,617,895 |
public static Logger getLogger(final String logName) {
LogManager manager = LogManager.getLogManager();
Logger loggerToModify = manager.getLogger(logName);
return loggerToModify;
} | static Logger function(final String logName) { LogManager manager = LogManager.getLogManager(); Logger loggerToModify = manager.getLogger(logName); return loggerToModify; } | /**
* Gets a logger from the LogManager.
*
* @param logName
* name of the logger
* @return The Logger object
* @since org.openntf.domino 1.0.0
*/ | Gets a logger from the LogManager | getLogger | {
"repo_name": "OpenNTF/org.openntf.domino",
"path": "domino/core/src/main/java/org/openntf/domino/logging/LogUtils.java",
"license": "apache-2.0",
"size": 10312
} | [
"java.util.logging.LogManager",
"java.util.logging.Logger"
] | import java.util.logging.LogManager; import java.util.logging.Logger; | import java.util.logging.*; | [
"java.util"
] | java.util; | 1,680,558 |
public int getRelationship(AffineTransform lhsTransform, Shape rhs,
AffineTransform at) {
// MAKE SURE ANY CHANGES YOU MAKE IN THIS METHOD YOU MAKE TO THE
// OTHER GETRELATIONSHIP METHOD
PathIterator rhsi = rhs.getPathIterator(at);
Rectangle2D rhsBounds;
if (rhs instanceof AreaXIterator) {
AreaXIterator axi = (AreaXIterator) rhs;
rhsBounds = axi.curves.bounds;
}
try {
rhsBounds = ShapeBounds.getBounds(rhs, at);
if (lhsTransform == null || lhsTransform.isIdentity()) {
if (rhsBounds.intersects(bounds) == false)
return AreaX.RELATIONSHIP_NONE;
}
} catch (EmptyPathException e) {
return AreaX.RELATIONSHIP_NONE;
}
double[] coords = new double[6];
int relationship = -1; // -1 = unknown
double moveX = 0;
double moveY = 0;
double lastX = 0;
double lastY = 0;
boolean closed = false;
AreaXIterator axi = new AreaXIterator();
while (rhsi.isDone() == false) {
int i = rhsi.currentSegment(coords);
if (i == PathIterator.SEG_CLOSE) {
if (lastX != moveX && lastY != moveY) {
if (intersectsLine(lastX, lastY, moveX, moveY, axi,
lhsTransform))
return AreaX.RELATIONSHIP_COMPLEX;
}
closed = true;
}
if (i == PathIterator.SEG_MOVETO && lastX != moveX
&& lastY != moveY && closed == false) {
if (intersectsLine(lastX, lastY, moveX, moveY, axi,
lhsTransform))
return AreaX.RELATIONSHIP_COMPLEX;
}
if (i == PathIterator.SEG_MOVETO) {
lastX = moveX = coords[0];
lastY = moveY = coords[1];
boolean contains = contains(moveX, moveY);
int newRelationship = contains ? AreaX.RELATIONSHIP_LHS_CONTAINS
: AreaX.RELATIONSHIP_NONE;
if (relationship == -1) {
relationship = newRelationship;
} else if (relationship != newRelationship) {
return AreaX.RELATIONSHIP_COMPLEX;
}
closed = false;
} else if (i == PathIterator.SEG_LINETO) {
if (intersectsLine(lastX, lastY, coords[0], coords[1], axi,
lhsTransform))
return AreaX.RELATIONSHIP_COMPLEX;
lastX = coords[0];
lastY = coords[1];
} else if (i == PathIterator.SEG_QUADTO) {
if (intersectsQuad(lastX, lastY, coords[0], coords[1],
coords[2], coords[3], axi, lhsTransform))
return AreaX.RELATIONSHIP_COMPLEX;
lastX = coords[2];
lastY = coords[3];
} else if (i == PathIterator.SEG_CUBICTO) {
if (intersectsCubic(lastX, lastY, coords[0], coords[1],
coords[2], coords[3], coords[4], coords[5], axi,
lhsTransform))
return AreaX.RELATIONSHIP_COMPLEX;
lastX = coords[4];
lastY = coords[5];
}
rhsi.next();
}
if (moveX != lastX || moveY != lastY) {
if (intersectsLine(lastX, lastY, moveX, moveY, axi, lhsTransform))
return AreaX.RELATIONSHIP_COMPLEX;
}
if (relationship == AreaX.RELATIONSHIP_NONE) {
// at this point we know the LHS doesn't contain the RHS, and that
// they don't intersect.
// this could be RHS_CONTAINS, too? Or Complex?
if (elementCount == 0)
return AreaX.RELATIONSHIP_NONE;
relationship = -1; // start over
for (int a = 0; a < elementCount; a++) {
if (elementData[a] instanceof Order0X) {
int newRelationship;
if (rhs.contains(elementData[a].getX0(),
elementData[a].getY0())) {
newRelationship = AreaX.RELATIONSHIP_RHS_CONTAINS;
} else {
newRelationship = AreaX.RELATIONSHIP_NONE;
}
if (relationship == -1) {
relationship = newRelationship;
} else if (relationship != newRelationship) {
return AreaX.RELATIONSHIP_COMPLEX;
}
}
}
}
return relationship;
} | int function(AffineTransform lhsTransform, Shape rhs, AffineTransform at) { PathIterator rhsi = rhs.getPathIterator(at); Rectangle2D rhsBounds; if (rhs instanceof AreaXIterator) { AreaXIterator axi = (AreaXIterator) rhs; rhsBounds = axi.curves.bounds; } try { rhsBounds = ShapeBounds.getBounds(rhs, at); if (lhsTransform == null lhsTransform.isIdentity()) { if (rhsBounds.intersects(bounds) == false) return AreaX.RELATIONSHIP_NONE; } } catch (EmptyPathException e) { return AreaX.RELATIONSHIP_NONE; } double[] coords = new double[6]; int relationship = -1; double moveX = 0; double moveY = 0; double lastX = 0; double lastY = 0; boolean closed = false; AreaXIterator axi = new AreaXIterator(); while (rhsi.isDone() == false) { int i = rhsi.currentSegment(coords); if (i == PathIterator.SEG_CLOSE) { if (lastX != moveX && lastY != moveY) { if (intersectsLine(lastX, lastY, moveX, moveY, axi, lhsTransform)) return AreaX.RELATIONSHIP_COMPLEX; } closed = true; } if (i == PathIterator.SEG_MOVETO && lastX != moveX && lastY != moveY && closed == false) { if (intersectsLine(lastX, lastY, moveX, moveY, axi, lhsTransform)) return AreaX.RELATIONSHIP_COMPLEX; } if (i == PathIterator.SEG_MOVETO) { lastX = moveX = coords[0]; lastY = moveY = coords[1]; boolean contains = contains(moveX, moveY); int newRelationship = contains ? AreaX.RELATIONSHIP_LHS_CONTAINS : AreaX.RELATIONSHIP_NONE; if (relationship == -1) { relationship = newRelationship; } else if (relationship != newRelationship) { return AreaX.RELATIONSHIP_COMPLEX; } closed = false; } else if (i == PathIterator.SEG_LINETO) { if (intersectsLine(lastX, lastY, coords[0], coords[1], axi, lhsTransform)) return AreaX.RELATIONSHIP_COMPLEX; lastX = coords[0]; lastY = coords[1]; } else if (i == PathIterator.SEG_QUADTO) { if (intersectsQuad(lastX, lastY, coords[0], coords[1], coords[2], coords[3], axi, lhsTransform)) return AreaX.RELATIONSHIP_COMPLEX; lastX = coords[2]; lastY = coords[3]; } else if (i == PathIterator.SEG_CUBICTO) { if (intersectsCubic(lastX, lastY, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5], axi, lhsTransform)) return AreaX.RELATIONSHIP_COMPLEX; lastX = coords[4]; lastY = coords[5]; } rhsi.next(); } if (moveX != lastX moveY != lastY) { if (intersectsLine(lastX, lastY, moveX, moveY, axi, lhsTransform)) return AreaX.RELATIONSHIP_COMPLEX; } if (relationship == AreaX.RELATIONSHIP_NONE) { if (elementCount == 0) return AreaX.RELATIONSHIP_NONE; relationship = -1; for (int a = 0; a < elementCount; a++) { if (elementData[a] instanceof Order0X) { int newRelationship; if (rhs.contains(elementData[a].getX0(), elementData[a].getY0())) { newRelationship = AreaX.RELATIONSHIP_RHS_CONTAINS; } else { newRelationship = AreaX.RELATIONSHIP_NONE; } if (relationship == -1) { relationship = newRelationship; } else if (relationship != newRelationship) { return AreaX.RELATIONSHIP_COMPLEX; } } } } return relationship; } | /**
* Studies this object (the LHS) and the argument (the RHS) to determine the
* relationship.
*
* @param lhsTransform
* an optional AffineTransform to apply to this operand.
* @param rhs
* a shape to iterate over.
* @param at
* an optional AffineTransform to apply to the rhs operand.
* @return one of the RELATIONSHIP constants.
*/ | Studies this object (the LHS) and the argument (the RHS) to determine the relationship | getRelationship | {
"repo_name": "mickleness/pumpernickel",
"path": "src/main/java/com/pump/geom/area/AreaXBody.java",
"license": "mit",
"size": 35257
} | [
"com.pump.geom.AreaX",
"com.pump.geom.EmptyPathException",
"com.pump.geom.ShapeBounds",
"java.awt.Shape",
"java.awt.geom.AffineTransform",
"java.awt.geom.PathIterator",
"java.awt.geom.Rectangle2D"
] | import com.pump.geom.AreaX; import com.pump.geom.EmptyPathException; import com.pump.geom.ShapeBounds; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; | import com.pump.geom.*; import java.awt.*; import java.awt.geom.*; | [
"com.pump.geom",
"java.awt"
] | com.pump.geom; java.awt; | 1,206,305 |
public List<T> getAllValues() {
return this.capturingMatcher.getAllValues();
}
| List<T> function() { return this.capturingMatcher.getAllValues(); } | /**
* Returns all captured values. Use it in case the verified method was called multiple times.
* <p>
* Example:
* <pre class="code"><code class="java">
* ArgumentCaptor<Person> peopleCaptor = ArgumentCaptor.forClass(Person.class);
* verify(mock, times(2)).doSomething(peopleCaptor.capture());
*
* List<Person> capturedPeople = peopleCaptor.getAllValues();
* assertEquals("John", capturedPeople.get(0).getName());
* assertEquals("Jane", capturedPeople.get(1).getName());
* </code></pre>
* See more examples in javadoc for {@link ArgumentCaptor} class.
*
* @return captured argument value
*/ | Returns all captured values. Use it in case the verified method was called multiple times. Example: ArgumentCaptor<Person> peopleCaptor = ArgumentCaptor.forClass(Person.class); verify(mock, times(2)).doSomething(peopleCaptor.capture()); List<Person> capturedPeople = peopleCaptor.getAllValues(); assertEquals("John", capturedPeople.get(0).getName()); assertEquals("Jane", capturedPeople.get(1).getName()); </code></code> See more examples in javadoc for <code>ArgumentCaptor</code> class | getAllValues | {
"repo_name": "android-ia/platform_external_mockito",
"path": "src/org/mockito/ArgumentCaptor.java",
"license": "mit",
"size": 7851
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,055,167 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.