method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public JSONObject toJSON()throws Exception
{
JSONObject jsonObject = new JSONObject();
if(accountId != null && !accountId.equals(""))
{
jsonObject.put("account_id", accountId);
}
if(paidThroughAccountId != null && !paidThroughAccountId.equals(""))
{
jsonObject.put("paid_through_account_id", paidThroughAccountId);
}
if(date != null && !date.equals(""))
{
jsonObject.put("date", date);
}
if((Double)amount != null)
{
jsonObject.put("amount", amount);
}
if(taxId != null && !taxId.equals(""))
{
jsonObject.put("tax_id", taxId);
}
if((Boolean)isInclusiveTax != null)
{
jsonObject.put("is_inclusive_tax", isInclusiveTax);
}
if((Boolean)isBillable != null)
{
jsonObject.put("is_billable", isBillable);
}
if(referenceNumber != null && !referenceNumber.equals(""))
{
jsonObject.put("reference_number", referenceNumber);
}
if(description != null && !description.equals(""))
{
jsonObject.put("description", description);
}
if(customerId != null && !customerId.equals(""))
{
jsonObject.put("customer_id", customerId);
}
if(vendorId != null && !vendorId.equals(""))
{
jsonObject.put("vendor_id", vendorId);
}
if(currencyId != null && !currencyId.equals(""))
{
jsonObject.put("currency_id", currencyId);
}
if((Double)exchangeRate != null && exchangeRate > 0)
{
jsonObject.put("exchange_rate", exchangeRate);
}
if(projectId != null && !projectId.equals(""))
{
jsonObject.put("project_id", projectId);
}
return jsonObject;
}
| JSONObject function()throws Exception { JSONObject jsonObject = new JSONObject(); if(accountId != null && !accountId.equals(STRaccount_id", accountId); } if(paidThroughAccountId != null && !paidThroughAccountId.equals(STRpaid_through_account_id", paidThroughAccountId); } if(date != null && !date.equals(STRdateSTRamount", amount); } if(taxId != null && !taxId.equals(STRtax_idSTRis_inclusive_taxSTRis_billable", isBillable); } if(referenceNumber != null && !referenceNumber.equals(STRreference_number", referenceNumber); } if(description != null && !description.equals(STRdescription", description); } if(customerId != null && !customerId.equals(STRcustomer_id", customerId); } if(vendorId != null && !vendorId.equals(STRvendor_id", vendorId); } if(currencyId != null && !currencyId.equals(STRcurrency_idSTRexchange_rate", exchangeRate); } if(projectId != null && !projectId.equals(STRproject_id", projectId); } return jsonObject; } | /**
* Convert Expense object into JSONObject.
* @return Returns a JSONObject.
*/ | Convert Expense object into JSONObject | toJSON | {
"repo_name": "zoho/books-java-wrappers",
"path": "source/com/zoho/books/model/Expense.java",
"license": "mit",
"size": 21553
} | [
"org.json.JSONObject"
] | import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 2,556,887 |
public Color getColor(); | Color function(); | /** get the color of the object
*
* @return a color
*/ | get the color of the object | getColor | {
"repo_name": "andreasprlic/spice-3d",
"path": "src/org/biojava/spice/manypanel/drawable/Drawable.java",
"license": "lgpl-2.1",
"size": 1347
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,338,313 |
protected AutoDeploymentStrategy getAutoDeploymentStrategy(final String mode) {
AutoDeploymentStrategy result = new DefaultAutoDeploymentStrategy();
for (final AutoDeploymentStrategy strategy : deploymentStrategies) {
if (strategy.handlesMode(mode)) {
result = strategy;
break;
}
}
return result;
} | AutoDeploymentStrategy function(final String mode) { AutoDeploymentStrategy result = new DefaultAutoDeploymentStrategy(); for (final AutoDeploymentStrategy strategy : deploymentStrategies) { if (strategy.handlesMode(mode)) { result = strategy; break; } } return result; } | /**
* Gets the {@link AutoDeploymentStrategy} for the provided mode. This method may be overridden to implement custom deployment strategies if required, but implementors should take care not to
* return <code>null</code>.
*
* @param mode
* the mode to get the strategy for
* @return the deployment strategy to use for the mode. Never <code>null</code>
*/ | Gets the <code>AutoDeploymentStrategy</code> for the provided mode. This method may be overridden to implement custom deployment strategies if required, but implementors should take care not to return <code>null</code> | getAutoDeploymentStrategy | {
"repo_name": "robsoncardosoti/flowable-engine",
"path": "modules/flowable-dmn-spring/src/main/java/org/flowable/dmn/spring/SpringDmnEngineConfiguration.java",
"license": "apache-2.0",
"size": 6840
} | [
"org.flowable.dmn.spring.autodeployment.AutoDeploymentStrategy",
"org.flowable.dmn.spring.autodeployment.DefaultAutoDeploymentStrategy"
] | import org.flowable.dmn.spring.autodeployment.AutoDeploymentStrategy; import org.flowable.dmn.spring.autodeployment.DefaultAutoDeploymentStrategy; | import org.flowable.dmn.spring.autodeployment.*; | [
"org.flowable.dmn"
] | org.flowable.dmn; | 2,350,487 |
public String storeMessage(String messageId, String correlationId, Date receivedDate, String comments, String label, Serializable message) throws SenderException;
| String function(String messageId, String correlationId, Date receivedDate, String comments, String label, Serializable message) throws SenderException; | /**
* Store the message, returns new messageId.
*
* The messageId should be unique.
*/ | Store the message, returns new messageId. The messageId should be unique | storeMessage | {
"repo_name": "smhoekstra/iaf",
"path": "JavaSource/nl/nn/adapterframework/core/ITransactionalStorage.java",
"license": "apache-2.0",
"size": 2476
} | [
"java.io.Serializable",
"java.util.Date"
] | import java.io.Serializable; import java.util.Date; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,894,122 |
public final Class<?> getScope()
{
return WicketObjects.resolveClass(scopeName);
} | final Class<?> function() { return WicketObjects.resolveClass(scopeName); } | /**
* Gets the scoping class, used for class loading and to determine the package.
*
* @return the scoping class
*/ | Gets the scoping class, used for class loading and to determine the package | getScope | {
"repo_name": "zwsong/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/request/resource/PackageResource.java",
"license": "apache-2.0",
"size": 18115
} | [
"org.apache.wicket.core.util.lang.WicketObjects"
] | import org.apache.wicket.core.util.lang.WicketObjects; | import org.apache.wicket.core.util.lang.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,827,677 |
public void resetPoints() {
for (int j = 0; j < NUM_SEGMENTS; j++) {
int idx = j - 5;
float jCosVal = FloatMath.cos(DEGREES_TO_RADIANS * (float) (idx * 15));
float jCosValInv = FloatMath.cos(DEGREES_TO_RADIANS * (float) (90 - idx * 15));
for (int i = 0; i < POINTS_PER_SEGMENT; i++) {
float sinVal = FloatMath.sin(DEGREES_TO_RADIANS * (float) (i * (360 / POINTS_PER_SEGMENT)));
float cosVal = FloatMath.cos(DEGREES_TO_RADIANS * (float) (i * (360 / POINTS_PER_SEGMENT)));
mVertices.get(i + (POINTS_PER_SEGMENT * j)).set(sinVal * jCosVal * 1, -cosVal * jCosVal * 1, jCosValInv * 1);
}
}
} | void function() { for (int j = 0; j < NUM_SEGMENTS; j++) { int idx = j - 5; float jCosVal = FloatMath.cos(DEGREES_TO_RADIANS * (float) (idx * 15)); float jCosValInv = FloatMath.cos(DEGREES_TO_RADIANS * (float) (90 - idx * 15)); for (int i = 0; i < POINTS_PER_SEGMENT; i++) { float sinVal = FloatMath.sin(DEGREES_TO_RADIANS * (float) (i * (360 / POINTS_PER_SEGMENT))); float cosVal = FloatMath.cos(DEGREES_TO_RADIANS * (float) (i * (360 / POINTS_PER_SEGMENT))); mVertices.get(i + (POINTS_PER_SEGMENT * j)).set(sinVal * jCosVal * 1, -cosVal * jCosVal * 1, jCosValInv * 1); } } } | /**
* reset all points to their original positions on the sphere
*/ | reset all points to their original positions on the sphere | resetPoints | {
"repo_name": "ratana/rotation-vector-compass",
"path": "RotationVectorCompass/src/com/adamratana/rotationvectorcompass/drawing/CompassComponent.java",
"license": "apache-2.0",
"size": 8320
} | [
"android.util.FloatMath"
] | import android.util.FloatMath; | import android.util.*; | [
"android.util"
] | android.util; | 1,676,302 |
public StringProperty getName() {
return this.name;
}
| StringProperty function() { return this.name; } | /**
* The system variable name
*
* @return the StringProperty.
*/ | The system variable name | getName | {
"repo_name": "NABUCCO/org.nabucco.framework.base",
"path": "org.nabucco.framework.base.facade.datatype/src/main/gen/org/nabucco/framework/base/facade/datatype/extension/schema/setup/SystemVariableExtension.java",
"license": "epl-1.0",
"size": 9218
} | [
"org.nabucco.framework.base.facade.datatype.extension.property.StringProperty"
] | import org.nabucco.framework.base.facade.datatype.extension.property.StringProperty; | import org.nabucco.framework.base.facade.datatype.extension.property.*; | [
"org.nabucco.framework"
] | org.nabucco.framework; | 165,615 |
public static void unregisterEvents(EventListener listener){
listeners.remove(listener);
} | static void function(EventListener listener){ listeners.remove(listener); } | /**
* Unregisters an listener
*
* @param listener EventListener to unregister
*/ | Unregisters an listener | unregisterEvents | {
"repo_name": "FriwiDev/RedstoneLamp",
"path": "src/main/java/net/redstonelamp/event/java/JavaEventSystem.java",
"license": "lgpl-3.0",
"size": 2048
} | [
"net.redstonelamp.event.EventListener"
] | import net.redstonelamp.event.EventListener; | import net.redstonelamp.event.*; | [
"net.redstonelamp.event"
] | net.redstonelamp.event; | 1,797,610 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(Sensorcontrol.class)) {
case CloudmonitoringPackage.SENSORCONTROL__MONITOR_STATE:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(Sensorcontrol.class)) { case CloudmonitoringPackage.SENSORCONTROL__MONITOR_STATE: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "occiware/Multi-Cloud-Studio",
"path": "plugins/org.eclipse.cmf.occi.multicloud.monitoring.edit/src-gen/cloudmonitoring/provider/SensorcontrolItemProvider.java",
"license": "epl-1.0",
"size": 4775
} | [
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification"
] | import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; | import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,039,771 |
private void processBlock(DatabaseMapGenerator databaseMapGenerator)
throws UnsupportedEncodingException {
if (this.debugFile) {
// get and check the block signature
this.blockSignature = new String(this.readBuffer, this.bufferPosition,
SIGNATURE_LENGTH_BLOCK, CHARSET_UTF8);
this.bufferPosition += SIGNATURE_LENGTH_BLOCK;
if (!this.blockSignature.startsWith("###TileStart")) {
Logger.debug("invalid block signature: " + this.blockSignature);
return;
}
}
// calculate the offset in the block entries table and move the pointer
this.blockEntriesTableOffset = (this.queryZoomLevel - this.mapFileParameters.zoomLevelMin) * 4;
this.bufferPosition += this.blockEntriesTableOffset;
// get the amount of way and nodes on the current zoomLevel level
this.nodesOnZoomLevel = readShort();
this.waysOnZoomLevel = readShort();
// move the pointer to the end of the block entries table
this.bufferPosition += this.mapFileParameters.blockEntriesTableSize
- this.blockEntriesTableOffset - 4;
// get the relative offset to the first stored way in the block
this.firstWayOffset = readVariableByteEncodedUnsignedInt();
if (this.firstWayOffset < 0) {
Logger.debug("invalid first way offset: " + this.firstWayOffset);
if (this.debugFile) {
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
// add the current buffer position to the relative first way offset
this.firstWayOffset += this.bufferPosition;
if (this.firstWayOffset > this.readBuffer.length) {
Logger.debug("invalid first way offset: " + this.firstWayOffset);
if (this.debugFile) {
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
// get the nodes
for (this.elementCounter = this.nodesOnZoomLevel; this.elementCounter != 0; --this.elementCounter) {
if (this.debugFile) {
// get and check the node signature
this.nodeSignature = new String(this.readBuffer, this.bufferPosition,
SIGNATURE_LENGTH_NODE, CHARSET_UTF8);
this.bufferPosition += SIGNATURE_LENGTH_NODE;
if (!this.nodeSignature.startsWith("***POIStart")) {
Logger.debug("invalid node signature: " + this.nodeSignature);
Logger.debug("block signature: " + this.blockSignature);
return;
}
}
// get the node latitude offset (VBE-S)
this.nodeLatitude = this.tileLatitude + readVariableByteEncodedSignedInt();
// get the node longitude offset (VBE-S)
this.nodeLongitude = this.tileLongitude + readVariableByteEncodedSignedInt();
// get the special byte that encodes multiple fields
this.nodeSpecialByte = readByte();
// bit 1-4 of the special byte represent the node layer
this.nodeLayer = (byte) ((this.nodeSpecialByte & NODE_LAYER_BITMASK) >>> NODE_LAYER_SHIFT);
// bit 5-8 of the special byte represent the number of tag IDs
this.nodeNumberOfTags = (byte) (this.nodeSpecialByte & NODE_NUMBER_OF_TAGS_BITMASK);
// reset the node tag array
System.arraycopy(this.defaultTagIds, 0, this.nodeTagIds, 0, this.nodeTagIds.length);
// get the node tag IDs (VBE-U)
for (this.tempByte = this.nodeNumberOfTags; this.tempByte != 0; --this.tempByte) {
this.nodeTagId = readVariableByteEncodedUnsignedInt();
if (this.nodeTagId < 0 || this.nodeTagId >= this.nodeTagIds.length) {
Logger.debug("invalid node tag ID: " + this.nodeTagId);
if (this.debugFile) {
Logger.debug("node signature: " + this.nodeSignature);
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
this.nodeTagIds[this.nodeTagId] = true;
}
// get the feature byte
this.nodeFeatureByte = readByte();
// bit 1-3 of the node feature byte enable optional features
this.nodeFeatureName = (this.nodeFeatureByte & NODE_FEATURE_BITMASK_NAME) != 0;
this.nodeFeatureElevation = (this.nodeFeatureByte & NODE_FEATURE_BITMASK_ELEVATION) != 0;
this.nodeFeatureHouseNumber = (this.nodeFeatureByte & NODE_FEATURE_BITMASK_HOUSE_NUMBER) != 0;
// check if the node has a name
if (this.nodeFeatureName) {
this.nodeName = readUTF8EncodedString(true);
} else {
// no node name
this.nodeName = null;
}
// check if the node has an elevation
if (this.nodeFeatureElevation) {
// get the node elevation (VBE-S)
this.nodeElevation = Integer.toString(readVariableByteEncodedSignedInt());
} else {
// no elevation
this.nodeElevation = null;
}
// check if the node has a house number
if (this.nodeFeatureHouseNumber) {
this.nodeHouseNumber = readUTF8EncodedString(true);
} else {
// no house number
this.nodeHouseNumber = null;
}
// render the node
databaseMapGenerator.renderPointOfInterest(this.nodeLayer, this.nodeLatitude,
this.nodeLongitude, this.nodeName, this.nodeHouseNumber,
this.nodeElevation, this.nodeTagIds);
}
// finished reading nodes, check if the current buffer position is valid
if (this.bufferPosition > this.firstWayOffset) {
Logger.debug("invalid buffer position: " + this.bufferPosition + " - "
+ this.firstWayOffset);
if (this.debugFile) {
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
// move the pointer to the first way
this.bufferPosition = this.firstWayOffset;
// get the ways
for (this.elementCounter = this.waysOnZoomLevel; this.elementCounter != 0; --this.elementCounter) {
if (this.debugFile) {
// get and check the way signature
this.waySignature = new String(this.readBuffer, this.bufferPosition,
SIGNATURE_LENGTH_WAY, CHARSET_UTF8);
this.bufferPosition += SIGNATURE_LENGTH_WAY;
if (!this.waySignature.startsWith("---WayStart")) {
Logger.debug("invalid way signature: " + this.waySignature);
Logger.debug("block signature: " + this.blockSignature);
return;
}
}
// get the size of the way (VBE-U)
this.waySize = readVariableByteEncodedUnsignedInt();
if (this.waySize < 0) {
Logger.debug("invalid way size: " + this.waySize);
if (this.debugFile) {
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
if (this.useTileBitmask) {
// get the way tile bitmask (2 bytes)
this.wayTileBitmask = readShort();
// check if the way is inside the requested tile
if ((this.queryTileBitmask & this.wayTileBitmask) == 0) {
// skip the rest of the way and continue with the next way
this.bufferPosition += this.waySize - 2;
continue;
}
} else {
// ignore the way tile bitmask (2 bytes)
this.bufferPosition += 2;
}
// get the first special byte that encodes multiple fields
this.waySpecialByte1 = readByte();
// bit 1-4 of the first special byte represent the way layer
this.wayLayer = (byte) ((this.waySpecialByte1 & WAY_LAYER_BITMASK) >>> WAY_LAYER_SHIFT);
// bit 5-8 of the first special byte represent the number of tag IDs
this.wayNumberOfTags = (byte) (this.waySpecialByte1 & WAY_NUMBER_OF_TAGS_BITMASK);
// get the second special byte that encodes multiple fields
this.waySpecialByte2 = readByte();
// bit 1-3 of the second special byte represent the number of relevant tags
this.wayNumberOfRelevantTags = (byte) ((this.waySpecialByte2 & WAY_RELEVANT_TAGS_BITMASK) >>> WAY_RELEVANT_TAGS_SHIFT);
// get the way tag bitmap
this.wayTagBitmap = readByte();
// reset the way tag array
System.arraycopy(this.defaultTagIds, 0, this.wayTagIds, 0, this.wayTagIds.length);
// get the way tag IDs (VBE-U)
for (this.tempByte = this.wayNumberOfTags; this.tempByte != 0; --this.tempByte) {
this.wayTagId = readVariableByteEncodedUnsignedInt();
if (this.wayTagId < 0 || this.wayTagId >= this.wayTagIds.length) {
Logger.debug("invalid way tag ID: " + this.wayTagId);
if (this.debugFile) {
Logger.debug("way signature: " + this.waySignature);
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
this.wayTagIds[this.wayTagId] = true;
}
// get and check the number of way nodes (VBE-U)
this.wayNumberOfWayNodes = readVariableByteEncodedUnsignedInt();
if (this.wayNumberOfWayNodes < 1
|| this.wayNumberOfWayNodes > MAXIMUM_WAY_NODES_SEQUENCE_LENGTH) {
Logger.debug("invalid number of way nodes: " + this.wayNumberOfWayNodes);
if (this.debugFile) {
Logger.debug("way signature: " + this.waySignature);
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
// each way node consists of latitude and longitude fields
this.wayNodesSequenceLength = this.wayNumberOfWayNodes * 2;
// make sure that the array for the way nodes is large enough
if (this.wayNodesSequenceLength > this.wayNodesSequence.length) {
this.wayNodesSequence = new int[this.wayNodesSequenceLength];
}
// get the first way node latitude offset (VBE-S)
this.wayNodeLatitude = this.tileLatitude + readVariableByteEncodedSignedInt();
// get the first way node longitude offset (VBE-S)
this.wayNodeLongitude = this.tileLongitude + readVariableByteEncodedSignedInt();
// store the first way node
this.wayNodesSequence[1] = this.wayNodeLatitude;
this.wayNodesSequence[0] = this.wayNodeLongitude;
// get the remaining way nodes offsets
for (this.tempInt = 2; this.tempInt < this.wayNodesSequenceLength; this.tempInt += 2) {
// get the way node latitude offset (VBE-S)
this.wayNodeLatitude = readVariableByteEncodedSignedInt();
// get the way node longitude offset (VBE-S)
this.wayNodeLongitude = readVariableByteEncodedSignedInt();
// calculate the way node coordinates
this.wayNodesSequence[this.tempInt] = this.wayNodesSequence[this.tempInt - 2]
+ this.wayNodeLongitude;
this.wayNodesSequence[this.tempInt + 1] = this.wayNodesSequence[this.tempInt - 1]
+ this.wayNodeLatitude;
}
// get the feature byte
this.wayFeatureByte = readByte();
// bit 1-4 of the way feature byte enable optional features
this.wayFeatureName = (this.wayFeatureByte & WAY_FEATURE_BITMASK_NAME) != 0;
this.wayFeatureRef = (this.wayFeatureByte & WAY_FEATURE_BITMASK_REF) != 0;
this.wayFeatureLabelPosition = (this.wayFeatureByte & WAY_FEATURE_BITMASK_LABEL_POSITION) != 0;
this.wayFeatureMultipolygon = (this.wayFeatureByte & WAY_FEATURE_BITMASK_MULTIPOLYGON) != 0;
// check if the way has a name
if (this.wayFeatureName) {
this.wayName = readUTF8EncodedString(this.queryReadWayNames);
} else {
// no way name
this.wayName = null;
}
// check if the way has a reference
if (this.wayFeatureRef) {
this.wayRef = readUTF8EncodedString(this.queryReadWayNames);
} else {
// no reference
this.wayRef = null;
}
// check if the way has a label position
if (this.wayFeatureLabelPosition) {
if (this.queryReadWayNames) {
this.wayLabelPosition = new int[2];
// get the label position latitude offset (VBE-S)
this.wayLabelPosition[1] = this.wayNodesSequence[1]
+ readVariableByteEncodedSignedInt();
// get the label position longitude offset (VBE-S)
this.wayLabelPosition[0] = this.wayNodesSequence[0]
+ readVariableByteEncodedSignedInt();
} else {
// skip the label position latitude and longitude offsets (VBE-S)
readVariableByteEncodedSignedInt();
readVariableByteEncodedSignedInt();
this.wayLabelPosition = null;
}
} else {
// no label position
this.wayLabelPosition = null;
}
// check if the way represents a multipolygon
if (this.wayFeatureMultipolygon) {
// get the amount of inner ways (VBE-U)
this.wayNumberOfInnerWays = readVariableByteEncodedUnsignedInt();
if (this.wayNumberOfInnerWays > 0
&& this.wayNumberOfInnerWays < MAXIMUM_NUMBER_OF_INNER_WAYS) {
// create a two-dimensional array for the coordinates of the inner ways
this.wayInnerWays = new int[this.wayNumberOfInnerWays][];
// for each inner way
for (this.innerWayNumber = this.wayNumberOfInnerWays - 1; this.innerWayNumber >= 0; --this.innerWayNumber) {
// get and check the number of inner way nodes (VBE-U)
this.innerWayNumberOfWayNodes = readVariableByteEncodedUnsignedInt();
if (this.innerWayNumberOfWayNodes < 1
|| this.innerWayNumberOfWayNodes > MAXIMUM_WAY_NODES_SEQUENCE_LENGTH) {
Logger.debug("invalid inner way number of way nodes: "
+ this.innerWayNumberOfWayNodes);
if (this.debugFile) {
Logger.debug("way signature: " + this.waySignature);
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
// each inner way node consists of a latitude and a longitude field
this.innerWayNodesSequenceLength = this.innerWayNumberOfWayNodes * 2;
// create an array for the inner way coordinates
this.innerWay = new int[this.innerWayNodesSequenceLength];
// get the first inner way node latitude offset (VBE-S)
this.wayNodeLatitude = this.wayNodesSequence[1]
+ readVariableByteEncodedSignedInt();
// get the first inner way node longitude offset (VBE-S)
this.wayNodeLongitude = this.wayNodesSequence[0]
+ readVariableByteEncodedSignedInt();
// store the first inner way node
this.innerWay[1] = this.wayNodeLatitude;
this.innerWay[0] = this.wayNodeLongitude;
// get and store the remaining inner way nodes offsets
for (this.tempInt = 2; this.tempInt < this.innerWayNodesSequenceLength; this.tempInt += 2) {
// get the inner way node latitude offset (VBE-S)
this.wayNodeLatitude = readVariableByteEncodedSignedInt();
// get the inner way node longitude offset (VBE-S)
this.wayNodeLongitude = readVariableByteEncodedSignedInt();
// calculate the inner way node coordinates
this.innerWay[this.tempInt] = this.innerWay[this.tempInt - 2]
+ this.wayNodeLongitude;
this.innerWay[this.tempInt + 1] = this.innerWay[this.tempInt - 1]
+ this.wayNodeLatitude;
}
// store the inner way
this.wayInnerWays[this.innerWayNumber] = this.innerWay;
}
} else {
Logger.debug("invalid way number of inner ways: " + this.wayNumberOfInnerWays);
if (this.debugFile) {
Logger.debug("way signature: " + this.waySignature);
Logger.debug("block signature: " + this.blockSignature);
}
return;
}
} else {
// no multipolygon
this.wayInnerWays = null;
}
// render the way
databaseMapGenerator.renderWay(this.wayLayer, this.wayNumberOfRelevantTags,
this.wayName, this.wayRef, this.wayLabelPosition, this.wayTagIds,
this.wayTagBitmap, this.wayNodesSequenceLength, this.wayNodesSequence,
this.wayInnerWays);
}
} | void function(DatabaseMapGenerator databaseMapGenerator) throws UnsupportedEncodingException { if (this.debugFile) { this.blockSignature = new String(this.readBuffer, this.bufferPosition, SIGNATURE_LENGTH_BLOCK, CHARSET_UTF8); this.bufferPosition += SIGNATURE_LENGTH_BLOCK; if (!this.blockSignature.startsWith(STR)) { Logger.debug(STR + this.blockSignature); return; } } this.blockEntriesTableOffset = (this.queryZoomLevel - this.mapFileParameters.zoomLevelMin) * 4; this.bufferPosition += this.blockEntriesTableOffset; this.nodesOnZoomLevel = readShort(); this.waysOnZoomLevel = readShort(); this.bufferPosition += this.mapFileParameters.blockEntriesTableSize - this.blockEntriesTableOffset - 4; this.firstWayOffset = readVariableByteEncodedUnsignedInt(); if (this.firstWayOffset < 0) { Logger.debug(STR + this.firstWayOffset); if (this.debugFile) { Logger.debug(STR + this.blockSignature); } return; } this.firstWayOffset += this.bufferPosition; if (this.firstWayOffset > this.readBuffer.length) { Logger.debug(STR + this.firstWayOffset); if (this.debugFile) { Logger.debug(STR + this.blockSignature); } return; } for (this.elementCounter = this.nodesOnZoomLevel; this.elementCounter != 0; --this.elementCounter) { if (this.debugFile) { this.nodeSignature = new String(this.readBuffer, this.bufferPosition, SIGNATURE_LENGTH_NODE, CHARSET_UTF8); this.bufferPosition += SIGNATURE_LENGTH_NODE; if (!this.nodeSignature.startsWith(STR)) { Logger.debug(STR + this.nodeSignature); Logger.debug(STR + this.blockSignature); return; } } this.nodeLatitude = this.tileLatitude + readVariableByteEncodedSignedInt(); this.nodeLongitude = this.tileLongitude + readVariableByteEncodedSignedInt(); this.nodeSpecialByte = readByte(); this.nodeLayer = (byte) ((this.nodeSpecialByte & NODE_LAYER_BITMASK) >>> NODE_LAYER_SHIFT); this.nodeNumberOfTags = (byte) (this.nodeSpecialByte & NODE_NUMBER_OF_TAGS_BITMASK); System.arraycopy(this.defaultTagIds, 0, this.nodeTagIds, 0, this.nodeTagIds.length); for (this.tempByte = this.nodeNumberOfTags; this.tempByte != 0; --this.tempByte) { this.nodeTagId = readVariableByteEncodedUnsignedInt(); if (this.nodeTagId < 0 this.nodeTagId >= this.nodeTagIds.length) { Logger.debug(STR + this.nodeTagId); if (this.debugFile) { Logger.debug(STR + this.nodeSignature); Logger.debug(STR + this.blockSignature); } return; } this.nodeTagIds[this.nodeTagId] = true; } this.nodeFeatureByte = readByte(); this.nodeFeatureName = (this.nodeFeatureByte & NODE_FEATURE_BITMASK_NAME) != 0; this.nodeFeatureElevation = (this.nodeFeatureByte & NODE_FEATURE_BITMASK_ELEVATION) != 0; this.nodeFeatureHouseNumber = (this.nodeFeatureByte & NODE_FEATURE_BITMASK_HOUSE_NUMBER) != 0; if (this.nodeFeatureName) { this.nodeName = readUTF8EncodedString(true); } else { this.nodeName = null; } if (this.nodeFeatureElevation) { this.nodeElevation = Integer.toString(readVariableByteEncodedSignedInt()); } else { this.nodeElevation = null; } if (this.nodeFeatureHouseNumber) { this.nodeHouseNumber = readUTF8EncodedString(true); } else { this.nodeHouseNumber = null; } databaseMapGenerator.renderPointOfInterest(this.nodeLayer, this.nodeLatitude, this.nodeLongitude, this.nodeName, this.nodeHouseNumber, this.nodeElevation, this.nodeTagIds); } if (this.bufferPosition > this.firstWayOffset) { Logger.debug(STR + this.bufferPosition + STR + this.firstWayOffset); if (this.debugFile) { Logger.debug(STR + this.blockSignature); } return; } this.bufferPosition = this.firstWayOffset; for (this.elementCounter = this.waysOnZoomLevel; this.elementCounter != 0; --this.elementCounter) { if (this.debugFile) { this.waySignature = new String(this.readBuffer, this.bufferPosition, SIGNATURE_LENGTH_WAY, CHARSET_UTF8); this.bufferPosition += SIGNATURE_LENGTH_WAY; if (!this.waySignature.startsWith(STR)) { Logger.debug(STR + this.waySignature); Logger.debug(STR + this.blockSignature); return; } } this.waySize = readVariableByteEncodedUnsignedInt(); if (this.waySize < 0) { Logger.debug(STR + this.waySize); if (this.debugFile) { Logger.debug(STR + this.blockSignature); } return; } if (this.useTileBitmask) { this.wayTileBitmask = readShort(); if ((this.queryTileBitmask & this.wayTileBitmask) == 0) { this.bufferPosition += this.waySize - 2; continue; } } else { this.bufferPosition += 2; } this.waySpecialByte1 = readByte(); this.wayLayer = (byte) ((this.waySpecialByte1 & WAY_LAYER_BITMASK) >>> WAY_LAYER_SHIFT); this.wayNumberOfTags = (byte) (this.waySpecialByte1 & WAY_NUMBER_OF_TAGS_BITMASK); this.waySpecialByte2 = readByte(); this.wayNumberOfRelevantTags = (byte) ((this.waySpecialByte2 & WAY_RELEVANT_TAGS_BITMASK) >>> WAY_RELEVANT_TAGS_SHIFT); this.wayTagBitmap = readByte(); System.arraycopy(this.defaultTagIds, 0, this.wayTagIds, 0, this.wayTagIds.length); for (this.tempByte = this.wayNumberOfTags; this.tempByte != 0; --this.tempByte) { this.wayTagId = readVariableByteEncodedUnsignedInt(); if (this.wayTagId < 0 this.wayTagId >= this.wayTagIds.length) { Logger.debug(STR + this.wayTagId); if (this.debugFile) { Logger.debug(STR + this.waySignature); Logger.debug(STR + this.blockSignature); } return; } this.wayTagIds[this.wayTagId] = true; } this.wayNumberOfWayNodes = readVariableByteEncodedUnsignedInt(); if (this.wayNumberOfWayNodes < 1 this.wayNumberOfWayNodes > MAXIMUM_WAY_NODES_SEQUENCE_LENGTH) { Logger.debug(STR + this.wayNumberOfWayNodes); if (this.debugFile) { Logger.debug(STR + this.waySignature); Logger.debug(STR + this.blockSignature); } return; } this.wayNodesSequenceLength = this.wayNumberOfWayNodes * 2; if (this.wayNodesSequenceLength > this.wayNodesSequence.length) { this.wayNodesSequence = new int[this.wayNodesSequenceLength]; } this.wayNodeLatitude = this.tileLatitude + readVariableByteEncodedSignedInt(); this.wayNodeLongitude = this.tileLongitude + readVariableByteEncodedSignedInt(); this.wayNodesSequence[1] = this.wayNodeLatitude; this.wayNodesSequence[0] = this.wayNodeLongitude; for (this.tempInt = 2; this.tempInt < this.wayNodesSequenceLength; this.tempInt += 2) { this.wayNodeLatitude = readVariableByteEncodedSignedInt(); this.wayNodeLongitude = readVariableByteEncodedSignedInt(); this.wayNodesSequence[this.tempInt] = this.wayNodesSequence[this.tempInt - 2] + this.wayNodeLongitude; this.wayNodesSequence[this.tempInt + 1] = this.wayNodesSequence[this.tempInt - 1] + this.wayNodeLatitude; } this.wayFeatureByte = readByte(); this.wayFeatureName = (this.wayFeatureByte & WAY_FEATURE_BITMASK_NAME) != 0; this.wayFeatureRef = (this.wayFeatureByte & WAY_FEATURE_BITMASK_REF) != 0; this.wayFeatureLabelPosition = (this.wayFeatureByte & WAY_FEATURE_BITMASK_LABEL_POSITION) != 0; this.wayFeatureMultipolygon = (this.wayFeatureByte & WAY_FEATURE_BITMASK_MULTIPOLYGON) != 0; if (this.wayFeatureName) { this.wayName = readUTF8EncodedString(this.queryReadWayNames); } else { this.wayName = null; } if (this.wayFeatureRef) { this.wayRef = readUTF8EncodedString(this.queryReadWayNames); } else { this.wayRef = null; } if (this.wayFeatureLabelPosition) { if (this.queryReadWayNames) { this.wayLabelPosition = new int[2]; this.wayLabelPosition[1] = this.wayNodesSequence[1] + readVariableByteEncodedSignedInt(); this.wayLabelPosition[0] = this.wayNodesSequence[0] + readVariableByteEncodedSignedInt(); } else { readVariableByteEncodedSignedInt(); readVariableByteEncodedSignedInt(); this.wayLabelPosition = null; } } else { this.wayLabelPosition = null; } if (this.wayFeatureMultipolygon) { this.wayNumberOfInnerWays = readVariableByteEncodedUnsignedInt(); if (this.wayNumberOfInnerWays > 0 && this.wayNumberOfInnerWays < MAXIMUM_NUMBER_OF_INNER_WAYS) { this.wayInnerWays = new int[this.wayNumberOfInnerWays][]; for (this.innerWayNumber = this.wayNumberOfInnerWays - 1; this.innerWayNumber >= 0; --this.innerWayNumber) { this.innerWayNumberOfWayNodes = readVariableByteEncodedUnsignedInt(); if (this.innerWayNumberOfWayNodes < 1 this.innerWayNumberOfWayNodes > MAXIMUM_WAY_NODES_SEQUENCE_LENGTH) { Logger.debug(STR + this.innerWayNumberOfWayNodes); if (this.debugFile) { Logger.debug(STR + this.waySignature); Logger.debug(STR + this.blockSignature); } return; } this.innerWayNodesSequenceLength = this.innerWayNumberOfWayNodes * 2; this.innerWay = new int[this.innerWayNodesSequenceLength]; this.wayNodeLatitude = this.wayNodesSequence[1] + readVariableByteEncodedSignedInt(); this.wayNodeLongitude = this.wayNodesSequence[0] + readVariableByteEncodedSignedInt(); this.innerWay[1] = this.wayNodeLatitude; this.innerWay[0] = this.wayNodeLongitude; for (this.tempInt = 2; this.tempInt < this.innerWayNodesSequenceLength; this.tempInt += 2) { this.wayNodeLatitude = readVariableByteEncodedSignedInt(); this.wayNodeLongitude = readVariableByteEncodedSignedInt(); this.innerWay[this.tempInt] = this.innerWay[this.tempInt - 2] + this.wayNodeLongitude; this.innerWay[this.tempInt + 1] = this.innerWay[this.tempInt - 1] + this.wayNodeLatitude; } this.wayInnerWays[this.innerWayNumber] = this.innerWay; } } else { Logger.debug(STR + this.wayNumberOfInnerWays); if (this.debugFile) { Logger.debug(STR + this.waySignature); Logger.debug(STR + this.blockSignature); } return; } } else { this.wayInnerWays = null; } databaseMapGenerator.renderWay(this.wayLayer, this.wayNumberOfRelevantTags, this.wayName, this.wayRef, this.wayLabelPosition, this.wayTagIds, this.wayTagBitmap, this.wayNodesSequenceLength, this.wayNodesSequence, this.wayInnerWays); } } | /**
* Reads a single block and calls the render functions on all map elements.
*
* @param databaseMapGenerator
* the DatabaseMapGenerator callback which handles the extracted map elements.
* @throws UnsupportedEncodingException
* if string decoding fails.
*/ | Reads a single block and calls the render functions on all map elements | processBlock | {
"repo_name": "JakeWharton/Android-MapForgeFragment",
"path": "library-common/src/com/jakewharton/android/mapsforge_fragment/MapDatabase.java",
"license": "lgpl-3.0",
"size": 55982
} | [
"java.io.UnsupportedEncodingException"
] | import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 1,207,252 |
@Override
public Object readMap(AbstractHessianInput in) throws IOException {
Object value = null;
while (!in.isEnd()) {
String key = in.readString();
if (key.equals("value"))
value = readStreamValue(in);
else
in.readObject();
}
in.readMapEnd();
return value;
} | Object function(AbstractHessianInput in) throws IOException { Object value = null; while (!in.isEnd()) { String key = in.readString(); if (key.equals("value")) value = readStreamValue(in); else in.readObject(); } in.readMapEnd(); return value; } | /**
* Reads the Hessian 1.0 style map.
*/ | Reads the Hessian 1.0 style map | readMap | {
"repo_name": "sdgdsffdsfff/rsf",
"path": "rsf-core/src/main/java/net/hasor/libs/com/caucho/hessian/io/AbstractStreamDeserializer.java",
"license": "apache-2.0",
"size": 3470
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 53,957 |
public PaginatedTenantInfoBean retrievePaginatedTenants(int pageNumber) throws Exception {
List<TenantInfoBean> tenantList = getAllTenants();
// Pagination
PaginatedTenantInfoBean paginatedTenantInfoBean = new PaginatedTenantInfoBean();
DataPaginator.doPaging(pageNumber, tenantList, paginatedTenantInfoBean);
return paginatedTenantInfoBean;
} | PaginatedTenantInfoBean function(int pageNumber) throws Exception { List<TenantInfoBean> tenantList = getAllTenants(); PaginatedTenantInfoBean paginatedTenantInfoBean = new PaginatedTenantInfoBean(); DataPaginator.doPaging(pageNumber, tenantList, paginatedTenantInfoBean); return paginatedTenantInfoBean; } | /**
* Method to retrieve all the tenants paginated
*
* @param pageNumber Number of the page.
* @return PaginatedTenantInfoBean
* @throws Exception if failed to getTenantManager;
*/ | Method to retrieve all the tenants paginated | retrievePaginatedTenants | {
"repo_name": "arunasujith/carbon-multitenancy",
"path": "components/tenant-mgt/org.wso2.carbon.tenant.mgt/src/main/java/org/wso2/carbon/tenant/mgt/services/TenantMgtAdminService.java",
"license": "apache-2.0",
"size": 23525
} | [
"java.util.List",
"org.wso2.carbon.stratos.common.beans.TenantInfoBean",
"org.wso2.carbon.tenant.mgt.beans.PaginatedTenantInfoBean",
"org.wso2.carbon.utils.DataPaginator"
] | import java.util.List; import org.wso2.carbon.stratos.common.beans.TenantInfoBean; import org.wso2.carbon.tenant.mgt.beans.PaginatedTenantInfoBean; import org.wso2.carbon.utils.DataPaginator; | import java.util.*; import org.wso2.carbon.stratos.common.beans.*; import org.wso2.carbon.tenant.mgt.beans.*; import org.wso2.carbon.utils.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 1,785,644 |
@Test public void getFileNameMap_queryParameter() {
checkFileNameMap(null, "example.txt?key=value");
checkFileNameMap(null, "example.txt?key=value#fragment");
} | @Test void function() { checkFileNameMap(null, STR); checkFileNameMap(null, STR); } | /**
* Checks that fragments are NOT stripped and therefore break recognition
* of file type.
* This matches RI behavior, but it'd be reasonable to change behavior here.
*/ | Checks that fragments are NOT stripped and therefore break recognition of file type. This matches RI behavior, but it'd be reasonable to change behavior here | getFileNameMap_queryParameter | {
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/libcore/luni/src/test/java/libcore/java/net/URLConnectionTest.java",
"license": "gpl-2.0",
"size": 173039
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 600,163 |
public void downloadFile(URL exportUrl, String filepath) throws IOException, MalformedURLException, ServiceException {
if (exportUrl == null || filepath == null) {
throw new IllegalArgumentException("null passed in for required parameters");
}
MediaContent mc = new MediaContent();
mc.setUri(exportUrl.toString());
MediaSource ms = service.getMedia(mc);
InputStream inStream = null;
FileOutputStream outStream = null;
try {
inStream = ms.getInputStream();
outStream = new FileOutputStream(filepath);
int c;
while ((c = inStream.read()) != -1) {
outStream.write(c);
}
} finally {
if (inStream != null) {
inStream.close();
}
if (outStream != null) {
outStream.flush();
outStream.close();
}
}
} | void function(URL exportUrl, String filepath) throws IOException, MalformedURLException, ServiceException { if (exportUrl == null filepath == null) { throw new IllegalArgumentException(STR); } MediaContent mc = new MediaContent(); mc.setUri(exportUrl.toString()); MediaSource ms = service.getMedia(mc); InputStream inStream = null; FileOutputStream outStream = null; try { inStream = ms.getInputStream(); outStream = new FileOutputStream(filepath); int c; while ((c = inStream.read()) != -1) { outStream.write(c); } } finally { if (inStream != null) { inStream.close(); } if (outStream != null) { outStream.flush(); outStream.close(); } } } | /**
* Downloads a file.
*
* @param exportUrl the full url of the export link to download the file from.
* @param filepath path and name of the object to be saved as.
*
* @throws IOException
* @throws MalformedURLException
* @throws ServiceException
*/ | Downloads a file | downloadFile | {
"repo_name": "mbshopM/openconcerto",
"path": "Modules/Module Google Docs/src/org/openconcerto/modules/google/docs/GoogleDocsUtils.java",
"license": "gpl-3.0",
"size": 43386
} | [
"com.google.gdata.data.MediaContent",
"com.google.gdata.data.media.MediaSource",
"com.google.gdata.util.ServiceException",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.InputStream",
"java.net.MalformedURLException"
] | import com.google.gdata.data.MediaContent; import com.google.gdata.data.media.MediaSource; import com.google.gdata.util.ServiceException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; | import com.google.gdata.data.*; import com.google.gdata.data.media.*; import com.google.gdata.util.*; import java.io.*; import java.net.*; | [
"com.google.gdata",
"java.io",
"java.net"
] | com.google.gdata; java.io; java.net; | 1,443,867 |
public void join(Player player) {
join(player, true);
} | void function(Player player) { join(player, true); } | /**
* Handles players joining and leaving the game
* @param player
*/ | Handles players joining and leaving the game | join | {
"repo_name": "ebaldino/beaconz",
"path": "src/main/java/com/wasteofplastic/beaconz/Game.java",
"license": "mit",
"size": 17333
} | [
"org.bukkit.entity.Player"
] | import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 239,771 |
private ILogicalOperator visitAggregateOperator(ILogicalOperator op) throws AlgebricksException {
visitSingleInputOperator(op);
if (correlatedKeyVars.isEmpty()) {
return op;
}
GroupByOperator gbyOp = new GroupByOperator();
// Creates a copy of correlatedKeyVars, to fix the ConcurrentModificationException in ASTERIXDB-1581.
List<LogicalVariable> copyOfCorrelatedKeyVars = new ArrayList<>(correlatedKeyVars);
for (LogicalVariable keyVar : copyOfCorrelatedKeyVars) {
// This limits the visitor can only be applied to a nested logical
// plan inside a Subplan operator,
// where the keyVarsToEnforce forms a candidate key which can
// uniquely identify a tuple out of the nested-tuple-source.
LogicalVariable newVar = context.newVar();
gbyOp.getGroupByList()
.add(new Pair<>(newVar, new MutableObject<>(new VariableReferenceExpression(keyVar))));
updateInputToOutputVarMapping(keyVar, newVar, false);
}
ILogicalOperator inputOp = op.getInputs().get(0).getValue();
gbyOp.getInputs().add(new MutableObject<>(inputOp));
NestedTupleSourceOperator nts = new NestedTupleSourceOperator(new MutableObject<>(gbyOp));
op.getInputs().clear();
op.getInputs().add(new MutableObject<>(nts));
ILogicalPlan nestedPlan = new ALogicalPlanImpl();
nestedPlan.getRoots().add(new MutableObject<>(op));
gbyOp.getNestedPlans().add(nestedPlan);
OperatorManipulationUtil.computeTypeEnvironmentBottomUp(gbyOp, context);
return op;
} | ILogicalOperator function(ILogicalOperator op) throws AlgebricksException { visitSingleInputOperator(op); if (correlatedKeyVars.isEmpty()) { return op; } GroupByOperator gbyOp = new GroupByOperator(); List<LogicalVariable> copyOfCorrelatedKeyVars = new ArrayList<>(correlatedKeyVars); for (LogicalVariable keyVar : copyOfCorrelatedKeyVars) { LogicalVariable newVar = context.newVar(); gbyOp.getGroupByList() .add(new Pair<>(newVar, new MutableObject<>(new VariableReferenceExpression(keyVar)))); updateInputToOutputVarMapping(keyVar, newVar, false); } ILogicalOperator inputOp = op.getInputs().get(0).getValue(); gbyOp.getInputs().add(new MutableObject<>(inputOp)); NestedTupleSourceOperator nts = new NestedTupleSourceOperator(new MutableObject<>(gbyOp)); op.getInputs().clear(); op.getInputs().add(new MutableObject<>(nts)); ILogicalPlan nestedPlan = new ALogicalPlanImpl(); nestedPlan.getRoots().add(new MutableObject<>(op)); gbyOp.getNestedPlans().add(nestedPlan); OperatorManipulationUtil.computeTypeEnvironmentBottomUp(gbyOp, context); return op; } | /**
* Wraps an AggregateOperator or RunningAggregateOperator with a group-by
* operator where the group-by keys are variables in keyVarsToEnforce. Note
* that the function here prevents this visitor being used to rewrite
* arbitrary query plans. Instead, it could only be used for rewriting a
* nested plan within a subplan operator.
*
* @param op
* the logical operator for aggregate or running aggregate.
* @return the wrapped group-by operator if {@code keyVarsToEnforce} is not
* empty, and {@code op} otherwise.
* @throws AlgebricksException
*/ | Wraps an AggregateOperator or RunningAggregateOperator with a group-by operator where the group-by keys are variables in keyVarsToEnforce. Note that the function here prevents this visitor being used to rewrite arbitrary query plans. Instead, it could only be used for rewriting a nested plan within a subplan operator | visitAggregateOperator | {
"repo_name": "ty1er/incubator-asterixdb",
"path": "asterixdb/asterix-algebra/src/main/java/org/apache/asterix/optimizer/rules/subplan/InlineAllNtsInSubplanVisitor.java",
"license": "apache-2.0",
"size": 35902
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.commons.lang3.mutable.MutableObject",
"org.apache.hyracks.algebricks.common.exceptions.AlgebricksException",
"org.apache.hyracks.algebricks.common.utils.Pair",
"org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator",
"org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan",
"org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable",
"org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression",
"org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator",
"org.apache.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator",
"org.apache.hyracks.algebricks.core.algebra.plan.ALogicalPlanImpl",
"org.apache.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil"
] | import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.mutable.MutableObject; import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.algebricks.common.utils.Pair; import org.apache.hyracks.algebricks.core.algebra.base.ILogicalOperator; import org.apache.hyracks.algebricks.core.algebra.base.ILogicalPlan; import org.apache.hyracks.algebricks.core.algebra.base.LogicalVariable; import org.apache.hyracks.algebricks.core.algebra.expressions.VariableReferenceExpression; import org.apache.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator; import org.apache.hyracks.algebricks.core.algebra.operators.logical.NestedTupleSourceOperator; import org.apache.hyracks.algebricks.core.algebra.plan.ALogicalPlanImpl; import org.apache.hyracks.algebricks.core.algebra.util.OperatorManipulationUtil; | import java.util.*; import org.apache.commons.lang3.mutable.*; import org.apache.hyracks.algebricks.common.exceptions.*; import org.apache.hyracks.algebricks.common.utils.*; import org.apache.hyracks.algebricks.core.algebra.base.*; import org.apache.hyracks.algebricks.core.algebra.expressions.*; import org.apache.hyracks.algebricks.core.algebra.operators.logical.*; import org.apache.hyracks.algebricks.core.algebra.plan.*; import org.apache.hyracks.algebricks.core.algebra.util.*; | [
"java.util",
"org.apache.commons",
"org.apache.hyracks"
] | java.util; org.apache.commons; org.apache.hyracks; | 81,559 |
public void addToAppsStore(File file) throws AndroidSdkException {
AndroidApp app = null;
try {
app = selendroidApkBuilder.resignApp(file);
} catch (ShellCommandException e) {
throw new SessionNotCreatedException(
"An error occurred while resigning the app '" + file.getName()
+ "'. ", e);
}
String appId = null;
try {
appId = app.getAppId();
} catch (AndroidSdkException e) {
log.info("Ignoring app because an error occurred reading the app details: "
+ file.getAbsolutePath());
log.info(e.getMessage());
}
if (appId != null && !appsStore.containsKey(appId)) {
appsStore.put(appId, app);
log.info("App " + appId
+ " has been added to selendroid standalone server.");
}
} | void function(File file) throws AndroidSdkException { AndroidApp app = null; try { app = selendroidApkBuilder.resignApp(file); } catch (ShellCommandException e) { throw new SessionNotCreatedException( STR + file.getName() + STR, e); } String appId = null; try { appId = app.getAppId(); } catch (AndroidSdkException e) { log.info(STR + file.getAbsolutePath()); log.info(e.getMessage()); } if (appId != null && !appsStore.containsKey(appId)) { appsStore.put(appId, app); log.info(STR + appId + STR); } } | /**
* This function will sign an android app and add it to the App Store. The function is made public because it also be
* invoked by the Folder Monitor each time a new application dropped into this folder.
*
* @param file
* - The file to be added to the app store
* @throws AndroidSdkException
*/ | This function will sign an android app and add it to the App Store. The function is made public because it also be invoked by the Folder Monitor each time a new application dropped into this folder | addToAppsStore | {
"repo_name": "mach6/selendroid",
"path": "selendroid-standalone/src/main/java/io/selendroid/standalone/server/model/SelendroidStandaloneDriver.java",
"license": "apache-2.0",
"size": 23941
} | [
"io.selendroid.server.common.exceptions.SessionNotCreatedException",
"io.selendroid.standalone.android.AndroidApp",
"io.selendroid.standalone.exceptions.AndroidSdkException",
"io.selendroid.standalone.exceptions.ShellCommandException",
"java.io.File"
] | import io.selendroid.server.common.exceptions.SessionNotCreatedException; import io.selendroid.standalone.android.AndroidApp; import io.selendroid.standalone.exceptions.AndroidSdkException; import io.selendroid.standalone.exceptions.ShellCommandException; import java.io.File; | import io.selendroid.server.common.exceptions.*; import io.selendroid.standalone.android.*; import io.selendroid.standalone.exceptions.*; import java.io.*; | [
"io.selendroid.server",
"io.selendroid.standalone",
"java.io"
] | io.selendroid.server; io.selendroid.standalone; java.io; | 1,034,135 |
public void addAttribute(QName name, String value)
throws JspParseException
{
if (TYPE.equals(name))
_type = value;
else if (BINDING.equals(name)) {
_binding = value;
}
else
super.addAttribute(name, value);
} | void function(QName name, String value) throws JspParseException { if (TYPE.equals(name)) _type = value; else if (BINDING.equals(name)) { _binding = value; } else super.addAttribute(name, value); } | /**
* Adds an attribute.
*/ | Adds an attribute | addAttribute | {
"repo_name": "dlitz/resin",
"path": "modules/resin/src/com/caucho/jsp/java/JsfPhaseListener.java",
"license": "gpl-2.0",
"size": 3577
} | [
"com.caucho.jsp.JspParseException",
"com.caucho.xml.QName"
] | import com.caucho.jsp.JspParseException; import com.caucho.xml.QName; | import com.caucho.jsp.*; import com.caucho.xml.*; | [
"com.caucho.jsp",
"com.caucho.xml"
] | com.caucho.jsp; com.caucho.xml; | 2,244,836 |
void retrieveFollowsForCurrentUser(@NonNull final TGRequestCallback<TGUsersList> callback); | void retrieveFollowsForCurrentUser(@NonNull final TGRequestCallback<TGUsersList> callback); | /**
* Get list of users current user follows
*
* @param callback
*/ | Get list of users current user follows | retrieveFollowsForCurrentUser | {
"repo_name": "tapglue/android_sdk",
"path": "v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/managers/TGUserManager.java",
"license": "apache-2.0",
"size": 6745
} | [
"android.support.annotation.NonNull",
"com.tapglue.model.TGUsersList",
"com.tapglue.networking.requests.TGRequestCallback"
] | import android.support.annotation.NonNull; import com.tapglue.model.TGUsersList; import com.tapglue.networking.requests.TGRequestCallback; | import android.support.annotation.*; import com.tapglue.model.*; import com.tapglue.networking.requests.*; | [
"android.support",
"com.tapglue.model",
"com.tapglue.networking"
] | android.support; com.tapglue.model; com.tapglue.networking; | 529,047 |
@Override
public String getCreatedResourceUuid(String mediationPolicyPath) {
try {
Resource resource = registry.get(mediationPolicyPath);
return resource.getUUID();
} catch (RegistryException e) {
log.error("error occurred while getting created mediation policy uuid", e);
}
return null;
} | String function(String mediationPolicyPath) { try { Resource resource = registry.get(mediationPolicyPath); return resource.getUUID(); } catch (RegistryException e) { log.error(STR, e); } return null; } | /**
* Returns the uuid of the updated/created mediation policy
*
* @param mediationPolicyPath path to the registry resource
* @return uuid of the given registry resource or null
*/ | Returns the uuid of the updated/created mediation policy | getCreatedResourceUuid | {
"repo_name": "harsha89/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AbstractAPIManager.java",
"license": "apache-2.0",
"size": 173001
} | [
"org.wso2.carbon.registry.core.Resource",
"org.wso2.carbon.registry.core.exceptions.RegistryException"
] | import org.wso2.carbon.registry.core.Resource; import org.wso2.carbon.registry.core.exceptions.RegistryException; | import org.wso2.carbon.registry.core.*; import org.wso2.carbon.registry.core.exceptions.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 255,554 |
protected Element findAndReplaceSimpleLists(Counter counter, Element parent, java.util.Collection list,
String parentName, String childName)
{
boolean shouldExist = (list != null) && (list.size() > 0);
Element element = updateElement(counter, parent, parentName, shouldExist);
if (shouldExist)
{
Iterator it = list.iterator();
Iterator elIt = element.getChildren(childName, element.getNamespace()).iterator();
if (!elIt.hasNext())
{
elIt = null;
}
Counter innerCount = new Counter(counter.getDepth() + 1);
while (it.hasNext())
{
String value = (String) it.next();
Element el;
if ((elIt != null) && elIt.hasNext())
{
el = (Element) elIt.next();
if (!elIt.hasNext())
{
elIt = null;
}
}
else
{
el = factory.element(childName, element.getNamespace());
insertAtPreferredLocation(element, el, innerCount);
}
el.setText(value);
innerCount.increaseCount();
}
if (elIt != null)
{
while (elIt.hasNext())
{
elIt.next();
elIt.remove();
}
}
}
return element;
} // -- Element findAndReplaceSimpleLists(Counter, Element,
// java.util.Collection, String,
// String) | Element function(Counter counter, Element parent, java.util.Collection list, String parentName, String childName) { boolean shouldExist = (list != null) && (list.size() > 0); Element element = updateElement(counter, parent, parentName, shouldExist); if (shouldExist) { Iterator it = list.iterator(); Iterator elIt = element.getChildren(childName, element.getNamespace()).iterator(); if (!elIt.hasNext()) { elIt = null; } Counter innerCount = new Counter(counter.getDepth() + 1); while (it.hasNext()) { String value = (String) it.next(); Element el; if ((elIt != null) && elIt.hasNext()) { el = (Element) elIt.next(); if (!elIt.hasNext()) { elIt = null; } } else { el = factory.element(childName, element.getNamespace()); insertAtPreferredLocation(element, el, innerCount); } el.setText(value); innerCount.increaseCount(); } if (elIt != null) { while (elIt.hasNext()) { elIt.next(); elIt.remove(); } } } return element; } | /**
* Method findAndReplaceSimpleLists.
*
* @param counter
* @param childName
* @param parentName
* @param list
* @param parent
*/ | Method findAndReplaceSimpleLists | findAndReplaceSimpleLists | {
"repo_name": "jerr/jbossforge-core",
"path": "maven/impl/src/main/java/org/jboss/forge/addon/maven/util/MavenJDOMWriter.java",
"license": "epl-1.0",
"size": 84577
} | [
"java.util.Collection",
"java.util.Iterator",
"org.jdom.Element"
] | import java.util.Collection; import java.util.Iterator; import org.jdom.Element; | import java.util.*; import org.jdom.*; | [
"java.util",
"org.jdom"
] | java.util; org.jdom; | 1,669,297 |
public static MozuClient<com.mozu.api.contracts.location.LocationUsageCollection> getLocationUsagesClient() throws Exception
{
return getLocationUsagesClient( null);
} | static MozuClient<com.mozu.api.contracts.location.LocationUsageCollection> function() throws Exception { return getLocationUsagesClient( null); } | /**
* Retrieves the configured site location usages for the location usage code specified in the request.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.location.LocationUsageCollection> mozuClient=GetLocationUsagesClient();
* client.setBaseAddress(url);
* client.executeRequest();
* LocationUsageCollection locationUsageCollection = client.Result();
* </code></pre></p>
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.location.LocationUsageCollection>
* @see com.mozu.api.contracts.location.LocationUsageCollection
*/ | Retrieves the configured site location usages for the location usage code specified in the request. <code><code> MozuClient mozuClient=GetLocationUsagesClient(); client.setBaseAddress(url); client.executeRequest(); LocationUsageCollection locationUsageCollection = client.Result(); </code></code> | getLocationUsagesClient | {
"repo_name": "eileenzhuang1/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/settings/LocationUsageClient.java",
"license": "mit",
"size": 8127
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 2,787,442 |
public IPenalty getById(Long id);
| IPenalty function(Long id); | /**
* Returns penalty from database by its id
* @return existent penalty or null
*/ | Returns penalty from database by its id | getById | {
"repo_name": "modaclouds/modaclouds-sla-core",
"path": "sla-repository/src/main/java/eu/atos/sla/dao/IPenaltyDAO.java",
"license": "apache-2.0",
"size": 2409
} | [
"eu.atos.sla.datamodel.ICompensation"
] | import eu.atos.sla.datamodel.ICompensation; | import eu.atos.sla.datamodel.*; | [
"eu.atos.sla"
] | eu.atos.sla; | 766,810 |
static String asId(String text) {
String[] parts = text.split("[-\\s]");
List<String> sanitized = new ArrayList<>();
for (String part : parts) {
if (part != null) {
String s = part.replaceAll("\\s+", "");
s = s.replaceAll("[^a-zA-Z0-9-_]", "");
s = s.replace('_', '-');
if (s.length() != 0) {
sanitized.add(s);
}
}
}
if (sanitized.isEmpty()) {
return null;
} else {
return sanitized.stream()
.filter(s -> s != null && s.trim().length() != 0)
.map(String::toLowerCase)
.collect(joining("-"));
}
} | static String asId(String text) { String[] parts = text.split(STR); List<String> sanitized = new ArrayList<>(); for (String part : parts) { if (part != null) { String s = part.replaceAll("\\s+", STR[^a-zA-Z0-9-_]STRSTR-")); } } | /**
* Turns a label which can contain whitespace and upper/lower case characters into an all lowercase id separated by
* "-".
*/ | Turns a label which can contain whitespace and upper/lower case characters into an all lowercase id separated by "-" | asId | {
"repo_name": "hal/hal.next",
"path": "resources/src/main/java/org/jboss/hal/resources/Ids.java",
"license": "apache-2.0",
"size": 60861
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,321,089 |
void writeEndObject(JsonGenerator gen, int nrOfEntries)
throws IOException, JsonGenerationException; | void writeEndObject(JsonGenerator gen, int nrOfEntries) throws IOException, JsonGenerationException; | /**
* Method called after an Object value has been completely output
* (minus closing curly bracket).
*<p>
* Default handling (without pretty-printing) will output
* the closing curly bracket.
* Pretty-printer is
* to output a curly bracket as well, but can surround that
* with other (white-space) decoration.
*
* @param nrOfEntries Number of direct members of the array that
* have been output
*/ | Method called after an Object value has been completely output (minus closing curly bracket). Default handling (without pretty-printing) will output the closing curly bracket. Pretty-printer is to output a curly bracket as well, but can surround that with other (white-space) decoration | writeEndObject | {
"repo_name": "wmarquesr/NoSQLProject",
"path": "src/com/fasterxml/jackson/core/PrettyPrinter.java",
"license": "gpl-3.0",
"size": 6366
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 249,438 |
public static ArrayList<Callable<Long>> getConv2dBackwardFilterWorkers(ConvolutionParameters params) throws DMLRuntimeException {
ArrayList<Callable<Long>> ret = new ArrayList<Callable<Long>>();
// Try to create as many tasks as threads.
// Creating more tasks will help in tail, but would have additional overhead of maintaining the intermediate
// data structures such as im2col blocks.
int k = OptimizerUtils.getConstrainedNumThreads(params.numThreads);
int taskSize = (int)(Math.ceil((double)params.N / k));
boolean isEmptyDenseInput = (!params.input1.isInSparseFormat() && params.input1.denseBlock == null) ||
(!params.input2.isInSparseFormat() && params.input2.denseBlock == null);
for(int i = 0; i*taskSize < params.N; i++) {
if(LibMatrixDNN.isEligibleForConv2dBackwardFilterSparseDense(params))
ret.add(new LibMatrixDNNConv2dBackwardFilterHelper.SparseNativeConv2dBackwardFilterDense(i*taskSize, Math.min((i+1)*taskSize, params.N), params));
else if(!isEmptyDenseInput)
ret.add(new LibMatrixDNNConv2dBackwardFilterHelper.Conv2dBackwardFilter(i*taskSize, Math.min((i+1)*taskSize, params.N), params));
else
throw new DMLRuntimeException("Unsupported operator");
}
return ret;
}
| static ArrayList<Callable<Long>> function(ConvolutionParameters params) throws DMLRuntimeException { ArrayList<Callable<Long>> ret = new ArrayList<Callable<Long>>(); int k = OptimizerUtils.getConstrainedNumThreads(params.numThreads); int taskSize = (int)(Math.ceil((double)params.N / k)); boolean isEmptyDenseInput = (!params.input1.isInSparseFormat() && params.input1.denseBlock == null) (!params.input2.isInSparseFormat() && params.input2.denseBlock == null); for(int i = 0; i*taskSize < params.N; i++) { if(LibMatrixDNN.isEligibleForConv2dBackwardFilterSparseDense(params)) ret.add(new LibMatrixDNNConv2dBackwardFilterHelper.SparseNativeConv2dBackwardFilterDense(i*taskSize, Math.min((i+1)*taskSize, params.N), params)); else if(!isEmptyDenseInput) ret.add(new LibMatrixDNNConv2dBackwardFilterHelper.Conv2dBackwardFilter(i*taskSize, Math.min((i+1)*taskSize, params.N), params)); else throw new DMLRuntimeException(STR); } return ret; } | /**
* Factory method that returns list of callable tasks for performing conv2d backward filter
*
* @param params convolution parameters
* @return list of callable tasks for performing conv2d backward filter
* @throws DMLRuntimeException if error occurs
*/ | Factory method that returns list of callable tasks for performing conv2d backward filter | getConv2dBackwardFilterWorkers | {
"repo_name": "iyounus/incubator-systemml",
"path": "src/main/java/org/apache/sysml/runtime/matrix/data/LibMatrixDNNHelper.java",
"license": "apache-2.0",
"size": 22680
} | [
"java.util.ArrayList",
"java.util.concurrent.Callable",
"org.apache.sysml.hops.OptimizerUtils",
"org.apache.sysml.runtime.DMLRuntimeException"
] | import java.util.ArrayList; import java.util.concurrent.Callable; import org.apache.sysml.hops.OptimizerUtils; import org.apache.sysml.runtime.DMLRuntimeException; | import java.util.*; import java.util.concurrent.*; import org.apache.sysml.hops.*; import org.apache.sysml.runtime.*; | [
"java.util",
"org.apache.sysml"
] | java.util; org.apache.sysml; | 1,795,445 |
public String getTypeName()
{
if (SanityManager.DEBUG)
SanityManager.THROWASSERT("Not implemented!.");
return(null);
} | String function() { if (SanityManager.DEBUG) SanityManager.THROWASSERT(STR); return(null); } | /**
* Get the SQL name of the datatype
*
* @return The SQL name of the datatype
*
* @see org.apache.derby.iapi.types.DataValueDescriptor#getTypeName
*/ | Get the SQL name of the datatype | getTypeName | {
"repo_name": "lpxz/grail-derby104",
"path": "java/engine/org/apache/derby/impl/store/access/conglomerate/GenericConglomerate.java",
"license": "apache-2.0",
"size": 7069
} | [
"org.apache.derby.iapi.services.sanity.SanityManager"
] | import org.apache.derby.iapi.services.sanity.SanityManager; | import org.apache.derby.iapi.services.sanity.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,744,999 |
private void previewButtonActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_previewButtonActionPerformed
UNISoNController.getInstance().getDatabase().notifyObservers();
}// GEN-LAST:event_previewButtonActionPerformed | void function(final java.awt.event.ActionEvent evt) { UNISoNController.getInstance().getDatabase().notifyObservers(); } | /**
* Preview button action performed.
*
* @param evt
* the evt
*/ | Preview button action performed | previewButtonActionPerformed | {
"repo_name": "leonarduk/unison",
"path": "src/main/java/uk/co/sleonard/unison/gui/generated/PajekPanel.java",
"license": "apache-2.0",
"size": 21963
} | [
"uk.co.sleonard.unison.UNISoNController"
] | import uk.co.sleonard.unison.UNISoNController; | import uk.co.sleonard.unison.*; | [
"uk.co.sleonard"
] | uk.co.sleonard; | 2,201,353 |
@Test
public void setBucket_CannedACL_AuthenticatedRead() throws Exception {
testInfo(this.getClass().getSimpleName() + " - setBucket_CannedACL_AuthenticatedRead");
try {
createBucket(bucketName);
print("Setting canned ACL " + CannedAccessControlList.AuthenticatedRead + " for bucket " + bucketName);
s3.setBucketAcl(bucketName, CannedAccessControlList.AuthenticatedRead);
verifyBucketACL(bucketName, CannedAccessControlList.AuthenticatedRead);
} catch (AmazonServiceException ase) {
printException(ase);
assertThat(false, "Failed to run setBucket_CannedACL_AuthenticatedRead");
}
} | void function() throws Exception { testInfo(this.getClass().getSimpleName() + STR); try { createBucket(bucketName); print(STR + CannedAccessControlList.AuthenticatedRead + STR + bucketName); s3.setBucketAcl(bucketName, CannedAccessControlList.AuthenticatedRead); verifyBucketACL(bucketName, CannedAccessControlList.AuthenticatedRead); } catch (AmazonServiceException ase) { printException(ase); assertThat(false, STR); } } | /**
* </p>Test for <code>authenticated-read</code> canned ACL</p>
*
* </p>Canned ACL applies to bucket and object</p>
*
* </p>Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access.</p>
*/ | Test for <code>authenticated-read</code> canned ACL Canned ACL applies to bucket and object Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access | setBucket_CannedACL_AuthenticatedRead | {
"repo_name": "nagyistoce/eutester",
"path": "eutester4j/com/eucalyptus/tests/awssdk/S3BucketCannedACLTests.java",
"license": "bsd-2-clause",
"size": 27496
} | [
"com.amazonaws.AmazonServiceException",
"com.amazonaws.services.s3.model.CannedAccessControlList",
"com.eucalyptus.tests.awssdk.Eutester4j"
] | import com.amazonaws.AmazonServiceException; import com.amazonaws.services.s3.model.CannedAccessControlList; import com.eucalyptus.tests.awssdk.Eutester4j; | import com.amazonaws.*; import com.amazonaws.services.s3.model.*; import com.eucalyptus.tests.awssdk.*; | [
"com.amazonaws",
"com.amazonaws.services",
"com.eucalyptus.tests"
] | com.amazonaws; com.amazonaws.services; com.eucalyptus.tests; | 2,060,325 |
public OvhItem cart_cartId_emailpro_options_POST(String cartId, String duration, Long itemId, String planCode, String pricingMode, Long quantity) throws IOException {
String qPath = "/order/cart/{cartId}/emailpro/options";
StringBuilder sb = path(qPath, cartId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "duration", duration);
addBody(o, "itemId", itemId);
addBody(o, "planCode", planCode);
addBody(o, "pricingMode", pricingMode);
addBody(o, "quantity", quantity);
String resp = execN(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhItem.class);
} | OvhItem function(String cartId, String duration, Long itemId, String planCode, String pricingMode, Long quantity) throws IOException { String qPath = STR; StringBuilder sb = path(qPath, cartId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, STR, duration); addBody(o, STR, itemId); addBody(o, STR, planCode); addBody(o, STR, pricingMode); addBody(o, STR, quantity); String resp = execN(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhItem.class); } | /**
* Post a new EmailPro option in your cart
*
* REST: POST /order/cart/{cartId}/emailpro/options
* @param cartId [required] Cart identifier
* @param itemId [required] Cart item to be linked
* @param planCode [required] Identifier of a EmailPro option offer
* @param duration [required] Duration selected for the purchase of the product
* @param pricingMode [required] Pricing mode selected for the purchase of the product
* @param quantity [required] Quantity of product desired
*/ | Post a new EmailPro option in your cart | cart_cartId_emailpro_options_POST | {
"repo_name": "UrielCh/ovh-java-sdk",
"path": "ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java",
"license": "bsd-3-clause",
"size": 511080
} | [
"java.io.IOException",
"java.util.HashMap",
"net.minidev.ovh.api.order.cart.OvhItem"
] | import java.io.IOException; import java.util.HashMap; import net.minidev.ovh.api.order.cart.OvhItem; | import java.io.*; import java.util.*; import net.minidev.ovh.api.order.cart.*; | [
"java.io",
"java.util",
"net.minidev.ovh"
] | java.io; java.util; net.minidev.ovh; | 1,423,419 |
List<String> getDocumentListing(String collection)
throws EXistException, PermissionDeniedException, URISyntaxException; | List<String> getDocumentListing(String collection) throws EXistException, PermissionDeniedException, URISyntaxException; | /**
* Get a list of all documents contained in the collection.
*
* @param collection the collection to use.
* @return list of document paths
* @throws org.exist.EXistException
* @throws org.exist.security.PermissionDeniedException
* @throws java.net.URISyntaxException
*/ | Get a list of all documents contained in the collection | getDocumentListing | {
"repo_name": "RemiKoutcherawy/exist",
"path": "exist-core/src/main/java/org/exist/xmlrpc/RpcAPI.java",
"license": "lgpl-2.1",
"size": 39647
} | [
"java.net.URISyntaxException",
"java.util.List",
"org.exist.EXistException",
"org.exist.security.PermissionDeniedException"
] | import java.net.URISyntaxException; import java.util.List; import org.exist.EXistException; import org.exist.security.PermissionDeniedException; | import java.net.*; import java.util.*; import org.exist.*; import org.exist.security.*; | [
"java.net",
"java.util",
"org.exist",
"org.exist.security"
] | java.net; java.util; org.exist; org.exist.security; | 1,627,051 |
public default GraphTraversal<S, Object> id() {
return this.asAdmin().addStep(new IdStep<>(this.asAdmin()));
} | default GraphTraversal<S, Object> function() { return this.asAdmin().addStep(new IdStep<>(this.asAdmin())); } | /**
* Map the {@link Element} to its {@link Element#id}.
*
* @return the traversal with an appended {@link IdStep}.
*/ | Map the <code>Element</code> to its <code>Element#id</code> | id | {
"repo_name": "gdelafosse/incubator-tinkerpop",
"path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java",
"license": "apache-2.0",
"size": 58503
} | [
"org.apache.tinkerpop.gremlin.process.traversal.step.map.IdStep"
] | import org.apache.tinkerpop.gremlin.process.traversal.step.map.IdStep; | import org.apache.tinkerpop.gremlin.process.traversal.step.map.*; | [
"org.apache.tinkerpop"
] | org.apache.tinkerpop; | 1,909,345 |
public static native void prompt(String msg, PromptCallback callback) ; | static native void function(String msg, PromptCallback callback) ; | /**
* Displays a request for information in a modal dialog box, along with the
* standard 'OK' and 'Cancel' buttons.
*
* @param msg the message to be displayed.
* @param callback the callback handler.
*/ | Displays a request for information in a modal dialog box, along with the standard 'OK' and 'Cancel' buttons | prompt | {
"repo_name": "Sage-Bionetworks/gwtbootstrap3-extras",
"path": "src/main/java/org/gwtbootstrap3/extras/bootbox/client/Bootbox.java",
"license": "apache-2.0",
"size": 2656
} | [
"org.gwtbootstrap3.extras.bootbox.client.callback.PromptCallback"
] | import org.gwtbootstrap3.extras.bootbox.client.callback.PromptCallback; | import org.gwtbootstrap3.extras.bootbox.client.callback.*; | [
"org.gwtbootstrap3.extras"
] | org.gwtbootstrap3.extras; | 797,043 |
protected final void put(Map varnames_to_vars, term_t term) {
Prolog.put_float(term, value);
}
//==================================================================/
// Converting Prolog terms to JPL Terms
//==================================================================/ | final void function(Map varnames_to_vars, term_t term) { Prolog.put_float(term, value); } | /**
* To convert a JPL Float to a Prolog term, we put its value field into the
* term_t as a float.
*
* @param varnames_to_vars A Map from variable names to Prolog variables.
* @param term A (previously created) term_t which is to be
* set to a Prolog float corresponding to this Float's value
*/ | To convert a JPL Float to a Prolog term, we put its value field into the term_t as a float | put | {
"repo_name": "lamby/pkg-swi-prolog",
"path": "packages/jpl/src/java/jpl/Float.java",
"license": "lgpl-2.1",
"size": 8725
} | [
"java.util.Map",
"jpl.fli.Prolog"
] | import java.util.Map; import jpl.fli.Prolog; | import java.util.*; import jpl.fli.*; | [
"java.util",
"jpl.fli"
] | java.util; jpl.fli; | 1,365,611 |
RealMatrix computeJacobian(final double[] params); | RealMatrix computeJacobian(final double[] params); | /**
* Compute the Jacobian.
*
* @param params Point.
* @return the Jacobian at the given point.
*/ | Compute the Jacobian | computeJacobian | {
"repo_name": "venkateshamurthy/java-quantiles",
"path": "src/main/java/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.java",
"license": "apache-2.0",
"size": 1538
} | [
"org.apache.commons.math3.linear.RealMatrix"
] | import org.apache.commons.math3.linear.RealMatrix; | import org.apache.commons.math3.linear.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,123,261 |
@Test
public void testAlterPartitionWithEnvironmentCtx() throws Exception {
EnvironmentContext context = new EnvironmentContext();
context.setProperties(new HashMap<String, String>(){
{
put("TestKey", "TestValue");
}
});
List<List<String>> testValues = createTable4PartColsParts(client);
List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
Partition partition = oldParts.get(3);
assertPartitionUnchanged(partition, testValues.get(3), PARTCOL_SCHEMA);
makeTestChangesOnPartition(partition);
client.alter_partition(DB_NAME, TABLE_NAME, partition, context);
List<Partition> newParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1);
partition = newParts.get(3);
assertPartitionChanged(partition, testValues.get(3), PARTCOL_SCHEMA);
assertPartitionsHaveCorrectValues(newParts, testValues);
client.alter_partition(DB_NAME, TABLE_NAME, partition, new EnvironmentContext());
client.alter_partition(DB_NAME, TABLE_NAME, partition, null);
} | void function() throws Exception { EnvironmentContext context = new EnvironmentContext(); context.setProperties(new HashMap<String, String>(){ { put(STR, STR); } }); List<List<String>> testValues = createTable4PartColsParts(client); List<Partition> oldParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1); Partition partition = oldParts.get(3); assertPartitionUnchanged(partition, testValues.get(3), PARTCOL_SCHEMA); makeTestChangesOnPartition(partition); client.alter_partition(DB_NAME, TABLE_NAME, partition, context); List<Partition> newParts = client.listPartitions(DB_NAME, TABLE_NAME, (short)-1); partition = newParts.get(3); assertPartitionChanged(partition, testValues.get(3), PARTCOL_SCHEMA); assertPartitionsHaveCorrectValues(newParts, testValues); client.alter_partition(DB_NAME, TABLE_NAME, partition, new EnvironmentContext()); client.alter_partition(DB_NAME, TABLE_NAME, partition, null); } | /**
* Testing alter_partition(String,String,Partition,EnvironmentContext) ->
* alter_partition_with_environment_context(String,String,Partition,EnvironmentContext).
*/ | Testing alter_partition(String,String,Partition,EnvironmentContext) -> alter_partition_with_environment_context(String,String,Partition,EnvironmentContext) | testAlterPartitionWithEnvironmentCtx | {
"repo_name": "alanfgates/hive",
"path": "standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestAlterPartitions.java",
"license": "apache-2.0",
"size": 49864
} | [
"java.util.HashMap",
"java.util.List",
"org.apache.hadoop.hive.metastore.api.EnvironmentContext",
"org.apache.hadoop.hive.metastore.api.Partition"
] | import java.util.HashMap; import java.util.List; import org.apache.hadoop.hive.metastore.api.EnvironmentContext; import org.apache.hadoop.hive.metastore.api.Partition; | import java.util.*; import org.apache.hadoop.hive.metastore.api.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 239,630 |
EAttribute getMNSynchStatement_Min(); | EAttribute getMNSynchStatement_Min(); | /**
* Returns the meta object for the attribute list '{@link com.rockwellcollins.atc.agree.agree.MNSynchStatement#getMin <em>Min</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute list '<em>Min</em>'.
* @see com.rockwellcollins.atc.agree.agree.MNSynchStatement#getMin()
* @see #getMNSynchStatement()
* @generated
*/ | Returns the meta object for the attribute list '<code>com.rockwellcollins.atc.agree.agree.MNSynchStatement#getMin Min</code>'. | getMNSynchStatement_Min | {
"repo_name": "smaccm/smaccm",
"path": "fm-workbench/agree/com.rockwellcollins.atc.agree/src-gen/com/rockwellcollins/atc/agree/agree/AgreePackage.java",
"license": "bsd-3-clause",
"size": 292940
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,185,912 |
public void enable(int id)
{
LOGGER.info("Enabling timer #{}", id);
ensureUpdated();
Timer timer = timers.get(id);
setState(timer, timer.getState() | Timer.ACTIVE);
} | void function(int id) { LOGGER.info(STR, id); ensureUpdated(); Timer timer = timers.get(id); setState(timer, timer.getState() Timer.ACTIVE); } | /**
* Enable a timer.
*
* @param id The ID of the timer
*/ | Enable a timer | enable | {
"repo_name": "StefanTT/vdr-controller",
"path": "src/main/java/com/github/stefantt/vdrcontroller/repository/TimerRepository.java",
"license": "gpl-3.0",
"size": 2884
} | [
"org.hampelratte.svdrp.responses.highlevel.Timer"
] | import org.hampelratte.svdrp.responses.highlevel.Timer; | import org.hampelratte.svdrp.responses.highlevel.*; | [
"org.hampelratte.svdrp"
] | org.hampelratte.svdrp; | 2,699,277 |
public DataSetMetadata findMetadata(final DataNode dataNode) {
for (DataSetMetadata each : metadataList) {
if (contains(new InlineExpressionParser(each.getDataNodes()).splitAndEvaluate(), dataNode)) {
return each;
}
}
throw new IllegalArgumentException(String.format("Cannot find data node: %s", dataNode.toString()));
} | DataSetMetadata function(final DataNode dataNode) { for (DataSetMetadata each : metadataList) { if (contains(new InlineExpressionParser(each.getDataNodes()).splitAndEvaluate(), dataNode)) { return each; } } throw new IllegalArgumentException(String.format(STR, dataNode.toString())); } | /**
* Find data set meta data via data node.
*
* @param dataNode data node
* @return data set meta data belong to current data node
*/ | Find data set meta data via data node | findMetadata | {
"repo_name": "dangdangdotcom/sharding-jdbc",
"path": "sharding-jdbc/sharding-jdbc-core/src/test/java/io/shardingsphere/dbtest/cases/dataset/DataSet.java",
"license": "apache-2.0",
"size": 3416
} | [
"io.shardingsphere.core.rule.DataNode",
"io.shardingsphere.core.util.InlineExpressionParser",
"io.shardingsphere.dbtest.cases.dataset.metadata.DataSetMetadata"
] | import io.shardingsphere.core.rule.DataNode; import io.shardingsphere.core.util.InlineExpressionParser; import io.shardingsphere.dbtest.cases.dataset.metadata.DataSetMetadata; | import io.shardingsphere.core.rule.*; import io.shardingsphere.core.util.*; import io.shardingsphere.dbtest.cases.dataset.metadata.*; | [
"io.shardingsphere.core",
"io.shardingsphere.dbtest"
] | io.shardingsphere.core; io.shardingsphere.dbtest; | 2,485,615 |
public void addSequence(String sequence) throws AxisFault {
SequenceAdminServiceClient client = new SequenceAdminServiceClient();
if (sequence != null && !sequence.isEmpty()) {
OMElement element = null;
try {
element = AXIOMUtil.stringToOM(sequence);
client.addSequence(element);
} catch (XMLStreamException e) {
log.error("Exception occurred while converting String to an OM.", e);
}
}
} | void function(String sequence) throws AxisFault { SequenceAdminServiceClient client = new SequenceAdminServiceClient(); if (sequence != null && !sequence.isEmpty()) { OMElement element = null; try { element = AXIOMUtil.stringToOM(sequence); client.addSequence(element); } catch (XMLStreamException e) { log.error(STR, e); } } } | /**
* Deploy the sequence to the gateway
*
* @param sequence - The sequence element , which to be deployed in synapse
* @throws AxisFault
*/ | Deploy the sequence to the gateway | addSequence | {
"repo_name": "charithag/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/service/APIGatewayAdmin.java",
"license": "apache-2.0",
"size": 14601
} | [
"javax.xml.stream.XMLStreamException",
"org.apache.axiom.om.OMElement",
"org.apache.axiom.om.impl.llom.util.AXIOMUtil",
"org.apache.axis2.AxisFault",
"org.wso2.carbon.apimgt.gateway.utils.SequenceAdminServiceClient"
] | import javax.xml.stream.XMLStreamException; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.impl.llom.util.AXIOMUtil; import org.apache.axis2.AxisFault; import org.wso2.carbon.apimgt.gateway.utils.SequenceAdminServiceClient; | import javax.xml.stream.*; import org.apache.axiom.om.*; import org.apache.axiom.om.impl.llom.util.*; import org.apache.axis2.*; import org.wso2.carbon.apimgt.gateway.utils.*; | [
"javax.xml",
"org.apache.axiom",
"org.apache.axis2",
"org.wso2.carbon"
] | javax.xml; org.apache.axiom; org.apache.axis2; org.wso2.carbon; | 2,499,631 |
static boolean isFunction(Node n) {
return n.getType() == Token.FUNCTION;
} | static boolean isFunction(Node n) { return n.getType() == Token.FUNCTION; } | /**
* Is this a FUNCTION node?
*/ | Is this a FUNCTION node | isFunction | {
"repo_name": "nuxleus/closure-compiler",
"path": "src/com/google/javascript/jscomp/NodeUtil.java",
"license": "apache-2.0",
"size": 89782
} | [
"com.google.javascript.rhino.Node",
"com.google.javascript.rhino.Token"
] | import com.google.javascript.rhino.Node; import com.google.javascript.rhino.Token; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 193,534 |
public static void assertServiceEvent(String message, int eventTypeMask, Class clazz, long timeout, TimeUnit timeUnit) {
assertServiceEvent(message, eventTypeMask, clazz, false, timeout, timeUnit);
} | static void function(String message, int eventTypeMask, Class clazz, long timeout, TimeUnit timeUnit) { assertServiceEvent(message, eventTypeMask, clazz, false, timeout, timeUnit); } | /**
* Asserts that ServiceEvent with class filter will be fired within given timeout. If it not as expected
* {@link AssertionError} is thrown with the given message
*
* @param message message
* @param eventTypeMask ServiceEvent type mask
* @param clazz service class
* @param timeout time interval to wait. If zero, the method will wait indefinitely.
* @param timeUnit time unit for the time interval
* @since 1.1
*/ | Asserts that ServiceEvent with class filter will be fired within given timeout. If it not as expected <code>AssertionError</code> is thrown with the given message | assertServiceEvent | {
"repo_name": "dpishchukhin/org.knowhowlab.osgi.testing",
"path": "org.knowhowlab.osgi.testing.assertions/src/main/java/org/knowhowlab/osgi/testing/assertions/ServiceAssert.java",
"license": "apache-2.0",
"size": 42585
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,203,904 |
public Node get(int index) {
Node n = null;
// check node at $index
if (this.list.size() > index) {
n = (Node) this.list.get(index);
if (n != null && n.getIndex() == index) {
return n;
}
}
// check nodes around $index in both directions
Node n2;
int i;
for (i = index; i < this.list.size(); i++) {
n2 = (Node) this.list.get(i);
if (n2 != null && n2.getIndex() == index) {
return n2;
}
}
for (i = Math.min(this.list.size() - 1, index); i >= 0; i--) {
n2 = (Node) this.list.get(i);
if (n2 != null && n2.getIndex() == index) {
return n2;
}
}
return null;
}
| Node function(int index) { Node n = null; if (this.list.size() > index) { n = (Node) this.list.get(index); if (n != null && n.getIndex() == index) { return n; } } Node n2; int i; for (i = index; i < this.list.size(); i++) { n2 = (Node) this.list.get(i); if (n2 != null && n2.getIndex() == index) { return n2; } } for (i = Math.min(this.list.size() - 1, index); i >= 0; i--) { n2 = (Node) this.list.get(i); if (n2 != null && n2.getIndex() == index) { return n2; } } return null; } | /**
* In a linked list, a node with index i must not be stored at position i,
* so search deeper for it
*/ | In a linked list, a node with index i must not be stored at position i, so search deeper for it | get | {
"repo_name": "Rwilmes/DNA",
"path": "src/dna/graph/datastructures/DLinkedList.java",
"license": "gpl-3.0",
"size": 4164
} | [
"dna.graph.nodes.Node"
] | import dna.graph.nodes.Node; | import dna.graph.nodes.*; | [
"dna.graph.nodes"
] | dna.graph.nodes; | 894,627 |
public void setLegaltrademarks(final String value) throws BuildException {
if (isReference()) {
throw tooManyAttributes();
}
this.legalTrademarks = value;
} | void function(final String value) throws BuildException { if (isReference()) { throw tooManyAttributes(); } this.legalTrademarks = value; } | /**
* Sets legal trademark.
*
* @param value
* new value
* @throws BuildException
* if specified with refid
*/ | Sets legal trademark | setLegaltrademarks | {
"repo_name": "manu4linux/nar-maven-plugin",
"path": "src/main/java/com/github/maven_nar/cpptasks/VersionInfo.java",
"license": "apache-2.0",
"size": 17793
} | [
"org.apache.tools.ant.BuildException"
] | import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.*; | [
"org.apache.tools"
] | org.apache.tools; | 2,036,545 |
public void handleMessage(String fromPort, Msg msg) {
synchronized (m_lastMsgReceived) {
m_lastMsgReceived = System.currentTimeMillis();
}
synchronized(m_features) {
// first update all features that are
// not status features
for (DeviceFeature f : m_features.values()) {
if (!f.isStatusFeature()) {
if (f.handleMessage(msg, fromPort)) {
// handled a reply to a query,
// mark it as processed
logger.trace("handled reply of direct: {}", f);
setFeatureQueried(null);
break;
}
}
}
// then update all the status features,
// e.g. when the device was last updated
for (DeviceFeature f : m_features.values()) {
if (f.isStatusFeature()) {
f.handleMessage(msg, fromPort);
}
}
}
} | void function(String fromPort, Msg msg) { synchronized (m_lastMsgReceived) { m_lastMsgReceived = System.currentTimeMillis(); } synchronized(m_features) { for (DeviceFeature f : m_features.values()) { if (!f.isStatusFeature()) { if (f.handleMessage(msg, fromPort)) { logger.trace(STR, f); setFeatureQueried(null); break; } } } for (DeviceFeature f : m_features.values()) { if (f.isStatusFeature()) { f.handleMessage(msg, fromPort); } } } } | /**
* Handle incoming message for this device by forwarding
* it to all features that this device supports
* @param fromPort port from which the message come in
* @param msg the incoming message
*/ | Handle incoming message for this device by forwarding it to all features that this device supports | handleMessage | {
"repo_name": "magcode/openhab",
"path": "bundles/binding/org.openhab.binding.insteonplm/src/main/java/org/openhab/binding/insteonplm/internal/device/InsteonDevice.java",
"license": "epl-1.0",
"size": 16840
} | [
"org.openhab.binding.insteonplm.internal.message.Msg"
] | import org.openhab.binding.insteonplm.internal.message.Msg; | import org.openhab.binding.insteonplm.internal.message.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 1,575,388 |
public Map.Entry<ArtifactDescriptor, PluginClass> findPlugin(Id.Namespace namespace, Id.Artifact artifactId,
String pluginType, String pluginName,
PluginSelector selector)
throws IOException, PluginNotExistsException, ArtifactNotFoundException {
SortedMap<ArtifactDescriptor, PluginClass> pluginClasses = artifactStore.getPluginClasses(
namespace, artifactId, pluginType, pluginName);
SortedMap<ArtifactId, PluginClass> artifactIds = Maps.newTreeMap();
for (Map.Entry<ArtifactDescriptor, PluginClass> pluginClassEntry : pluginClasses.entrySet()) {
artifactIds.put(pluginClassEntry.getKey().getArtifactId(), pluginClassEntry.getValue());
}
Map.Entry<ArtifactId, PluginClass> chosenArtifact = selector.select(artifactIds);
if (chosenArtifact == null) {
throw new PluginNotExistsException(artifactId, pluginType, pluginName);
}
for (Map.Entry<ArtifactDescriptor, PluginClass> pluginClassEntry : pluginClasses.entrySet()) {
if (pluginClassEntry.getKey().getArtifactId().compareTo(chosenArtifact.getKey()) == 0) {
return pluginClassEntry;
}
}
throw new PluginNotExistsException(artifactId, pluginType, pluginName);
} | Map.Entry<ArtifactDescriptor, PluginClass> function(Id.Namespace namespace, Id.Artifact artifactId, String pluginType, String pluginName, PluginSelector selector) throws IOException, PluginNotExistsException, ArtifactNotFoundException { SortedMap<ArtifactDescriptor, PluginClass> pluginClasses = artifactStore.getPluginClasses( namespace, artifactId, pluginType, pluginName); SortedMap<ArtifactId, PluginClass> artifactIds = Maps.newTreeMap(); for (Map.Entry<ArtifactDescriptor, PluginClass> pluginClassEntry : pluginClasses.entrySet()) { artifactIds.put(pluginClassEntry.getKey().getArtifactId(), pluginClassEntry.getValue()); } Map.Entry<ArtifactId, PluginClass> chosenArtifact = selector.select(artifactIds); if (chosenArtifact == null) { throw new PluginNotExistsException(artifactId, pluginType, pluginName); } for (Map.Entry<ArtifactDescriptor, PluginClass> pluginClassEntry : pluginClasses.entrySet()) { if (pluginClassEntry.getKey().getArtifactId().compareTo(chosenArtifact.getKey()) == 0) { return pluginClassEntry; } } throw new PluginNotExistsException(artifactId, pluginType, pluginName); } | /**
* Returns a {@link Map.Entry} representing the plugin information for the plugin being requested.
*
* @param namespace the namespace to get plugins from
* @param artifactId the id of the artifact to get plugins for
* @param pluginType plugin type name
* @param pluginName plugin name
* @param selector for selecting which plugin to use
* @return the entry found
* @throws IOException if there was an exception reading plugin metadata from the artifact store
* @throws ArtifactNotFoundException if the given artifact does not exist
* @throws PluginNotExistsException if no plugins of the given type and name are available to the given artifact
*/ | Returns a <code>Map.Entry</code> representing the plugin information for the plugin being requested | findPlugin | {
"repo_name": "chtyim/cdap",
"path": "cdap-app-fabric/src/main/java/co/cask/cdap/internal/app/runtime/artifact/ArtifactRepository.java",
"license": "apache-2.0",
"size": 38522
} | [
"co.cask.cdap.api.artifact.ArtifactId",
"co.cask.cdap.api.plugin.PluginClass",
"co.cask.cdap.api.plugin.PluginSelector",
"co.cask.cdap.common.ArtifactNotFoundException",
"co.cask.cdap.internal.app.runtime.plugin.PluginNotExistsException",
"co.cask.cdap.proto.Id",
"com.google.common.collect.Maps",
"java.io.IOException",
"java.util.Map",
"java.util.SortedMap"
] | import co.cask.cdap.api.artifact.ArtifactId; import co.cask.cdap.api.plugin.PluginClass; import co.cask.cdap.api.plugin.PluginSelector; import co.cask.cdap.common.ArtifactNotFoundException; import co.cask.cdap.internal.app.runtime.plugin.PluginNotExistsException; import co.cask.cdap.proto.Id; import com.google.common.collect.Maps; import java.io.IOException; import java.util.Map; import java.util.SortedMap; | import co.cask.cdap.api.artifact.*; import co.cask.cdap.api.plugin.*; import co.cask.cdap.common.*; import co.cask.cdap.internal.app.runtime.plugin.*; import co.cask.cdap.proto.*; import com.google.common.collect.*; import java.io.*; import java.util.*; | [
"co.cask.cdap",
"com.google.common",
"java.io",
"java.util"
] | co.cask.cdap; com.google.common; java.io; java.util; | 1,860,278 |
default Future<Transform> getUnitToRootTransformation(final UnitConfig unitConfigTarget) {
try {
return getUnitTransformation(unitConfigTarget, getRootLocationConfig());
} catch (CouldNotPerformException ex) {
return FutureProcessor.canceledFuture(Transform.class, new NotAvailableException("UnitTransformation", ex));
}
} | default Future<Transform> getUnitToRootTransformation(final UnitConfig unitConfigTarget) { try { return getUnitTransformation(unitConfigTarget, getRootLocationConfig()); } catch (CouldNotPerformException ex) { return FutureProcessor.canceledFuture(Transform.class, new NotAvailableException(STR, ex)); } } | /**
* Method returns the transformation which leads from the given unit to the root location.
*
* @param unitConfigTarget the unit where the transformation leads to.
*
* @return a transformation future
*/ | Method returns the transformation which leads from the given unit to the root location | getUnitToRootTransformation | {
"repo_name": "DivineCooperation/bco.registry",
"path": "unit-registry/lib/src/main/java/org/openbase/bco/registry/unit/lib/provider/UnitTransformationProviderRegistry.java",
"license": "gpl-3.0",
"size": 14983
} | [
"java.util.concurrent.Future",
"org.openbase.jul.exception.CouldNotPerformException",
"org.openbase.jul.exception.NotAvailableException",
"org.openbase.jul.schedule.FutureProcessor",
"org.openbase.rct.Transform",
"org.openbase.type.domotic.unit.UnitConfigType"
] | import java.util.concurrent.Future; import org.openbase.jul.exception.CouldNotPerformException; import org.openbase.jul.exception.NotAvailableException; import org.openbase.jul.schedule.FutureProcessor; import org.openbase.rct.Transform; import org.openbase.type.domotic.unit.UnitConfigType; | import java.util.concurrent.*; import org.openbase.jul.exception.*; import org.openbase.jul.schedule.*; import org.openbase.rct.*; import org.openbase.type.domotic.unit.*; | [
"java.util",
"org.openbase.jul",
"org.openbase.rct",
"org.openbase.type"
] | java.util; org.openbase.jul; org.openbase.rct; org.openbase.type; | 2,499,061 |
public XLog getLog() {
return LOG;
} | XLog function() { return LOG; } | /**
* Get XLog log
*
* @return XLog
*/ | Get XLog log | getLog | {
"repo_name": "sunmeng007/oozie",
"path": "core/src/main/java/org/apache/oozie/command/XCommand.java",
"license": "apache-2.0",
"size": 15529
} | [
"org.apache.oozie.util.XLog"
] | import org.apache.oozie.util.XLog; | import org.apache.oozie.util.*; | [
"org.apache.oozie"
] | org.apache.oozie; | 887,175 |
public Date getBillingDate() {
return billingDate;
} | Date function() { return billingDate; } | /**
* Gets the billingDate attribute.
*
* @return Returns the billingDate
*/ | Gets the billingDate attribute | getBillingDate | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/ar/document/CustomerInvoiceDocument.java",
"license": "apache-2.0",
"size": 76460
} | [
"java.sql.Date"
] | import java.sql.Date; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,754,840 |
public DocumentResponse PostPresentationMerge (String name, String storage, String folder, PresentationsMergeRequest body) {
Object postBody = body;
// verify required params are set
if(name == null || body == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/slides/{name}/merge/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "POST", queryParams, postBody, headerParams, formParams, contentType);
return (DocumentResponse) ApiInvoker.deserialize(response, "", DocumentResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
} | DocumentResponse function (String name, String storage, String folder, PresentationsMergeRequest body) { Object postBody = body; if(name == null body == null ) { throw new ApiException(400, STR); } String resourcePath = STR; resourcePath = resourcePath.replaceAll("\\*", STR&STR&STR/?STR?STRtoFormat={toFormat}STRformat={format}STR{STRnameSTR}STR[&?]name.*?(?=& \\? $)STRSTR{STRstorageSTR}STR[&?]storage.*?(?=& \\? $)STRSTR{STRfolderSTR}STR[&?]folder.*?(?=& \\? $)STRSTRapplication/jsonSTRapplication/jsonSTRPOSTSTRSTR"); } else { throw ex; } } } | /**
* PostPresentationMerge
* Merge presentations.
* @param name String Original presentation name.
* @param storage String The storage.
* @param folder String The folder.
* @param body PresentationsMergeRequest with a list of presentations to merge.
* @return DocumentResponse
*/ | PostPresentationMerge Merge presentations | PostPresentationMerge | {
"repo_name": "aspose-slides/Aspose.Slides-for-Cloud",
"path": "SDKs/Aspose.Slides-Cloud-SDK-for-Java/src/main/java/com/aspose/slides/api/SlidesApi.java",
"license": "mit",
"size": 134781
} | [
"com.aspose.slides.client.ApiException",
"com.aspose.slides.model.DocumentResponse",
"com.aspose.slides.model.PresentationsMergeRequest"
] | import com.aspose.slides.client.ApiException; import com.aspose.slides.model.DocumentResponse; import com.aspose.slides.model.PresentationsMergeRequest; | import com.aspose.slides.client.*; import com.aspose.slides.model.*; | [
"com.aspose.slides"
] | com.aspose.slides; | 1,700,327 |
private void onActiveDatabaseChanged(Optional<BibDatabaseContext> newDatabase) {
if (newDatabase.isPresent()) {
GroupNodeViewModel newRoot = newDatabase
.map(BibDatabaseContext::getMetaData)
.flatMap(MetaData::getGroups)
.map(root -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, root))
.orElse(GroupNodeViewModel.getAllEntriesGroup(newDatabase.get(), stateManager, taskExecutor));
rootGroup.setValue(newRoot);
this.selectedGroups.setAll(
stateManager.getSelectedGroup(newDatabase.get()).stream()
.map(selectedGroup -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, selectedGroup))
.collect(Collectors.toList()));
}
currentDatabase = newDatabase;
} | void function(Optional<BibDatabaseContext> newDatabase) { if (newDatabase.isPresent()) { GroupNodeViewModel newRoot = newDatabase .map(BibDatabaseContext::getMetaData) .flatMap(MetaData::getGroups) .map(root -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, root)) .orElse(GroupNodeViewModel.getAllEntriesGroup(newDatabase.get(), stateManager, taskExecutor)); rootGroup.setValue(newRoot); this.selectedGroups.setAll( stateManager.getSelectedGroup(newDatabase.get()).stream() .map(selectedGroup -> new GroupNodeViewModel(newDatabase.get(), stateManager, taskExecutor, selectedGroup)) .collect(Collectors.toList())); } currentDatabase = newDatabase; } | /**
* Gets invoked if the user changes the active database.
* We need to get the new group tree and update the view
*/ | Gets invoked if the user changes the active database. We need to get the new group tree and update the view | onActiveDatabaseChanged | {
"repo_name": "shitikanth/jabref",
"path": "src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java",
"license": "mit",
"size": 14385
} | [
"java.util.Optional",
"java.util.stream.Collectors",
"org.jabref.model.database.BibDatabaseContext",
"org.jabref.model.metadata.MetaData"
] | import java.util.Optional; import java.util.stream.Collectors; import org.jabref.model.database.BibDatabaseContext; import org.jabref.model.metadata.MetaData; | import java.util.*; import java.util.stream.*; import org.jabref.model.database.*; import org.jabref.model.metadata.*; | [
"java.util",
"org.jabref.model"
] | java.util; org.jabref.model; | 1,749,572 |
protected void addSourcePropertyPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_EnrichMediator_sourceProperty_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_EnrichMediator_sourceProperty_feature", "_UI_EnrichMediator_type"),
MediatorsPackage.Literals.ENRICH_MEDIATOR__SOURCE_PROPERTY,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
getString("_UI_SourcePropertyCategory"),
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), MediatorsPackage.Literals.ENRICH_MEDIATOR__SOURCE_PROPERTY, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, getString(STR), null)); } | /**
* This adds a property descriptor for the Source Property feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Source Property feature. | addSourcePropertyPropertyDescriptor | {
"repo_name": "chanakaudaya/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.esb.edit/src/org/wso2/developerstudio/eclipse/esb/mediators/provider/EnrichMediatorItemProvider.java",
"license": "apache-2.0",
"size": 15144
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.wso2.developerstudio.eclipse.esb.mediators.MediatorsPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.esb.mediators.MediatorsPackage; | import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.esb.mediators.*; | [
"org.eclipse.emf",
"org.wso2.developerstudio"
] | org.eclipse.emf; org.wso2.developerstudio; | 1,251,538 |
public void attemptLogin() {
if (loginTask != null) {
log.wtf("Login being attempted again even though the button isn't enabled?!");
return;
}
// Reset errors.
emailView.setError(null);
passwordView.setError(null);
// Store values at the time of the login attempt.
final String email = emailView.getText().toString();
final String password = passwordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
passwordView.setError(getString(R.string.error_invalid_password));
focusView = passwordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(email)) {
emailView.setError(getString(R.string.error_field_required));
focusView = emailView;
cancel = true;
} else if (!isEmailValid(email)) {
emailView.setError(getString(R.string.error_invalid_email));
focusView = emailView;
cancel = true;
} | void function() { if (loginTask != null) { log.wtf(STR); return; } emailView.setError(null); passwordView.setError(null); final String email = emailView.getText().toString(); final String password = passwordView.getText().toString(); boolean cancel = false; View focusView = null; if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) { passwordView.setError(getString(R.string.error_invalid_password)); focusView = passwordView; cancel = true; } if (TextUtils.isEmpty(email)) { emailView.setError(getString(R.string.error_field_required)); focusView = emailView; cancel = true; } else if (!isEmailValid(email)) { emailView.setError(getString(R.string.error_invalid_email)); focusView = emailView; cancel = true; } | /**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/ | Attempts to sign in or register the account specified by the login form. If there are form errors (invalid email, missing fields, etc.), the errors are presented and no actual login attempt is made | attemptLogin | {
"repo_name": "yaneexy/spark-setup-android",
"path": "devicesetup/src/main/java/io/particle/android/sdk/accountsetup/LoginActivity.java",
"license": "apache-2.0",
"size": 8542
} | [
"android.text.TextUtils",
"android.view.View"
] | import android.text.TextUtils; import android.view.View; | import android.text.*; import android.view.*; | [
"android.text",
"android.view"
] | android.text; android.view; | 857,429 |
@Override
public ScheduleExpression getSchedule() throws IllegalStateException,
NoSuchObjectLocalException, EJBException
{
checkStatus();
if (_timerTask.getCronExpression() != null) {
CronExpression cronExpression = _timerTask.getCronExpression();
Date start = null;
Date end = null;
return new ScheduleExpression().second(cronExpression.getSecond())
.minute(cronExpression.getMinute()).hour(cronExpression.getHour())
.dayOfWeek(cronExpression.getDayOfWeek()).dayOfMonth(
cronExpression.getDayOfMonth()).month(cronExpression.getMonth())
.year(cronExpression.getYear()).start(start).end(end);
} else {
throw new IllegalStateException(
"This timer was not created by a schedule expression.");
}
}
| ScheduleExpression function() throws IllegalStateException, NoSuchObjectLocalException, EJBException { checkStatus(); if (_timerTask.getCronExpression() != null) { CronExpression cronExpression = _timerTask.getCronExpression(); Date start = null; Date end = null; return new ScheduleExpression().second(cronExpression.getSecond()) .minute(cronExpression.getMinute()).hour(cronExpression.getHour()) .dayOfWeek(cronExpression.getDayOfWeek()).dayOfMonth( cronExpression.getDayOfMonth()).month(cronExpression.getMonth()) .year(cronExpression.getYear()).start(start).end(end); } else { throw new IllegalStateException( STR); } } | /**
* Get the schedule expression corresponding to this timer.
*
* @return Schedule expression corresponding to this timer.
* @throws IllegalStateException
* If this method is invoked while the instance is in a state that
* does not allow access to this method. Also thrown if invoked on a
* timer that was created with one of the non-ScheduleExpression
* TimerService.createTimer APIs.
* @throws NoSuchObjectLocalException
* If invoked on a timer that has expired or has been canceled.
* @throws EJBException
* If this method could not complete due to a system-level failure.
*/ | Get the schedule expression corresponding to this timer | getSchedule | {
"repo_name": "headius/quercus",
"path": "src/main/java/com/caucho/config/timer/EjbTimer.java",
"license": "gpl-2.0",
"size": 10430
} | [
"java.util.Date",
"javax.ejb.EJBException",
"javax.ejb.NoSuchObjectLocalException",
"javax.ejb.ScheduleExpression"
] | import java.util.Date; import javax.ejb.EJBException; import javax.ejb.NoSuchObjectLocalException; import javax.ejb.ScheduleExpression; | import java.util.*; import javax.ejb.*; | [
"java.util",
"javax.ejb"
] | java.util; javax.ejb; | 399,239 |
void dumpSessions(PrintWriter pwriter); | void dumpSessions(PrintWriter pwriter); | /**
* Text dump of session information, suitable for debugging.
* @param pwriter the output writer
*/ | Text dump of session information, suitable for debugging | dumpSessions | {
"repo_name": "intel-hadoop/zookeeper-rhino",
"path": "src/java/main/org/apache/zookeeper/server/SessionTracker.java",
"license": "apache-2.0",
"size": 4209
} | [
"java.io.PrintWriter"
] | import java.io.PrintWriter; | import java.io.*; | [
"java.io"
] | java.io; | 2,520,042 |
@Test(expectedExceptions = IllegalArgumentException.class)
public void testTradeIdNotNull() {
PartyTradeIdentifier.builder().party(CTPTY).build();
} | @Test(expectedExceptions = IllegalArgumentException.class) void function() { PartyTradeIdentifier.builder().party(CTPTY).build(); } | /**
* Tests that the trade id must be set.
*/ | Tests that the trade id must be set | testTradeIdNotNull | {
"repo_name": "McLeodMoores/starling",
"path": "projects/starling-client/src/test/java/com/mcleodmoores/starling/client/fpml5_8/PartyTradeIdentifierTest.java",
"license": "apache-2.0",
"size": 2081
} | [
"com.mcleodmoores.starling.client.portfolio.fpml5_8.PartyTradeIdentifier",
"org.testng.annotations.Test"
] | import com.mcleodmoores.starling.client.portfolio.fpml5_8.PartyTradeIdentifier; import org.testng.annotations.Test; | import com.mcleodmoores.starling.client.portfolio.fpml5_8.*; import org.testng.annotations.*; | [
"com.mcleodmoores.starling",
"org.testng.annotations"
] | com.mcleodmoores.starling; org.testng.annotations; | 1,976,691 |
static int scanAllModules(PrintStream out) {
ModulePathValidator validator = new ModulePathValidator(out);
// upgrade module path
String value = System.getProperty("jdk.module.upgrade.path");
if (value != null) {
Stream.of(value.split(File.pathSeparator))
.map(Path::of)
.forEach(validator::scan);
}
// system modules
ModuleFinder.ofSystem().findAll().stream()
.sorted(Comparator.comparing(ModuleReference::descriptor))
.forEach(validator::process);
// application module path
value = System.getProperty("jdk.module.path");
if (value != null) {
Stream.of(value.split(File.pathSeparator))
.map(Path::of)
.forEach(validator::scan);
}
return validator.errorCount;
} | static int scanAllModules(PrintStream out) { ModulePathValidator validator = new ModulePathValidator(out); String value = System.getProperty(STR); if (value != null) { Stream.of(value.split(File.pathSeparator)) .map(Path::of) .forEach(validator::scan); } ModuleFinder.ofSystem().findAll().stream() .sorted(Comparator.comparing(ModuleReference::descriptor)) .forEach(validator::process); value = System.getProperty(STR); if (value != null) { Stream.of(value.split(File.pathSeparator)) .map(Path::of) .forEach(validator::scan); } return validator.errorCount; } | /**
* Scans and the validates all modules on the module path. The module path
* comprises the upgrade module path, system modules, and the application
* module path.
*
* @param out the print stream for output messages
* @return the number of errors found
*/ | Scans and the validates all modules on the module path. The module path comprises the upgrade module path, system modules, and the application module path | scanAllModules | {
"repo_name": "md-5/jdk10",
"path": "src/java.base/share/classes/jdk/internal/module/ModulePathValidator.java",
"license": "gpl-2.0",
"size": 8974
} | [
"java.io.File",
"java.io.PrintStream",
"java.lang.module.ModuleFinder",
"java.lang.module.ModuleReference",
"java.nio.file.Path",
"java.util.Comparator",
"java.util.stream.Stream"
] | import java.io.File; import java.io.PrintStream; import java.lang.module.ModuleFinder; import java.lang.module.ModuleReference; import java.nio.file.Path; import java.util.Comparator; import java.util.stream.Stream; | import java.io.*; import java.lang.module.*; import java.nio.file.*; import java.util.*; import java.util.stream.*; | [
"java.io",
"java.lang",
"java.nio",
"java.util"
] | java.io; java.lang; java.nio; java.util; | 2,518,279 |
void deleteDirectory(Container container, StoredObject storedObject, StopRequester stopRequester, SwiftCallback callback);
| void deleteDirectory(Container container, StoredObject storedObject, StopRequester stopRequester, SwiftCallback callback); | /**
* deletes a directory stored object.
* @param container the container holding the object directory.
* @param storedObject the object.
* @param stopRequester to stop the task.
* @param callback the callback to call.
*/ | deletes a directory stored object | deleteDirectory | {
"repo_name": "webs86/swift-explorer",
"path": "src/main/java/org/swiftexplorer/swift/operations/SwiftOperations.java",
"license": "apache-2.0",
"size": 15340
} | [
"org.javaswift.joss.model.Container",
"org.javaswift.joss.model.StoredObject"
] | import org.javaswift.joss.model.Container; import org.javaswift.joss.model.StoredObject; | import org.javaswift.joss.model.*; | [
"org.javaswift.joss"
] | org.javaswift.joss; | 1,087,933 |
private void initComponents() {
GridBagConstraints gridBagConstraints, gridBagConstraintsMain;
jlAddressReplyTo = new JLabel(JMeterUtils.getResString("smtp_replyto")); // $NON-NLS-1$
jlAddressFrom = new JLabel(JMeterUtils.getResString("smtp_from")); // $NON-NLS-1$
jlAddressTo = new JLabel(JMeterUtils.getResString("smtp_to")); // $NON-NLS-1$
jlAddressToCC = new JLabel(JMeterUtils.getResString("smtp_cc")); // $NON-NLS-1$
jlAddressToBCC = new JLabel(JMeterUtils.getResString("smtp_bcc")); // $NON-NLS-1$
jlMailServerPort = new JLabel(JMeterUtils.getResString("smtp_server_port")); // $NON-NLS-1$
jlMailServer = new JLabel(JMeterUtils.getResString("smtp_server")); // $NON-NLS-1$
jlMailServerTimeout = new JLabel(JMeterUtils.getResString("smtp_server_timeout")); // $NON-NLS-1$
jlMailServerConnectionTimeout = new JLabel(JMeterUtils.getResString("smtp_server_connection_timeout")); // $NON-NLS-1$
jlAttachFile = new JLabel(JMeterUtils.getResString("smtp_attach_file")); // $NON-NLS-1$
jlDutPortStandard = new JLabel(JMeterUtils.getResString("smtp_default_port")); // $NON-NLS-1$
jlUsername = new JLabel(JMeterUtils.getResString("smtp_username")); // $NON-NLS-1$
jlPassword = new JLabel(JMeterUtils.getResString("smtp_password")); // $NON-NLS-1$
jlSubject = new JLabel(JMeterUtils.getResString("smtp_subject")); // $NON-NLS-1$
jlMessage = new JLabel(JMeterUtils.getResString("smtp_message")); // $NON-NLS-1$
tfMailServer = new JTextField(30);
tfMailServerPort = new JTextField(6);
tfMailServerTimeout = new JTextField(6);
tfMailServerConnectionTimeout = new JTextField(6);
tfMailFrom = new JTextField(25);
tfMailReplyTo = new JTextField(25);
tfMailTo = new JTextField(25);
tfMailToCC = new JTextField(25);
tfMailToBCC = new JTextField(25);
tfAuthUsername = new JTextField(20);
tfAuthPassword = new JPasswordField(20);
tfSubject = new JTextField(20);
tfAttachment = new JTextField(30);
tfEmlMessage = new JTextField(30);
taMessage = new JTextArea(5, 20);
cbPlainBody = new JCheckBox(JMeterUtils.getResString("smtp_plainbody")); // $NON-NLS-1$ | void function() { GridBagConstraints gridBagConstraints, gridBagConstraintsMain; jlAddressReplyTo = new JLabel(JMeterUtils.getResString(STR)); jlAddressFrom = new JLabel(JMeterUtils.getResString(STR)); jlAddressTo = new JLabel(JMeterUtils.getResString(STR)); jlAddressToCC = new JLabel(JMeterUtils.getResString(STR)); jlAddressToBCC = new JLabel(JMeterUtils.getResString(STR)); jlMailServerPort = new JLabel(JMeterUtils.getResString(STR)); jlMailServer = new JLabel(JMeterUtils.getResString(STR)); jlMailServerTimeout = new JLabel(JMeterUtils.getResString(STR)); jlMailServerConnectionTimeout = new JLabel(JMeterUtils.getResString(STR)); jlAttachFile = new JLabel(JMeterUtils.getResString(STR)); jlDutPortStandard = new JLabel(JMeterUtils.getResString(STR)); jlUsername = new JLabel(JMeterUtils.getResString(STR)); jlPassword = new JLabel(JMeterUtils.getResString(STR)); jlSubject = new JLabel(JMeterUtils.getResString(STR)); jlMessage = new JLabel(JMeterUtils.getResString(STR)); tfMailServer = new JTextField(30); tfMailServerPort = new JTextField(6); tfMailServerTimeout = new JTextField(6); tfMailServerConnectionTimeout = new JTextField(6); tfMailFrom = new JTextField(25); tfMailReplyTo = new JTextField(25); tfMailTo = new JTextField(25); tfMailToCC = new JTextField(25); tfMailToBCC = new JTextField(25); tfAuthUsername = new JTextField(20); tfAuthPassword = new JPasswordField(20); tfSubject = new JTextField(20); tfAttachment = new JTextField(30); tfEmlMessage = new JTextField(30); taMessage = new JTextArea(5, 20); cbPlainBody = new JCheckBox(JMeterUtils.getResString(STR)); | /**
* Main method of class, builds all gui-components for SMTP-sampler.
*/ | Main method of class, builds all gui-components for SMTP-sampler | initComponents | {
"repo_name": "llllewicki/jmeter-diff",
"path": "src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/gui/SmtpPanel.java",
"license": "apache-2.0",
"size": 40293
} | [
"java.awt.GridBagConstraints",
"javax.swing.JCheckBox",
"javax.swing.JLabel",
"javax.swing.JPasswordField",
"javax.swing.JTextArea",
"javax.swing.JTextField",
"org.apache.jmeter.util.JMeterUtils"
] | import java.awt.GridBagConstraints; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPasswordField; import javax.swing.JTextArea; import javax.swing.JTextField; import org.apache.jmeter.util.JMeterUtils; | import java.awt.*; import javax.swing.*; import org.apache.jmeter.util.*; | [
"java.awt",
"javax.swing",
"org.apache.jmeter"
] | java.awt; javax.swing; org.apache.jmeter; | 2,898,667 |
public static TaskStackBuilder create(Context context) {
return new TaskStackBuilder(context);
} | static TaskStackBuilder function(Context context) { return new TaskStackBuilder(context); } | /**
* Return a new TaskStackBuilder for launching a fresh task stack consisting
* of a series of activities.
*
* @param context The context that will launch the new task stack or generate a PendingIntent
* @return A new TaskStackBuilder
*/ | Return a new TaskStackBuilder for launching a fresh task stack consisting of a series of activities | create | {
"repo_name": "masconsult/android-recipes-app",
"path": "vendors/android-support-v7-appcompat/libs-src/android-support-v4/android/support/v4/app/TaskStackBuilder.java",
"license": "apache-2.0",
"size": 16623
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 2,855,979 |
public Image getNormalImg()
{
return (Image) UIManager.get(LuckMenuUIBundle.ARROW_NORMAL_IMG);
}
| Image function() { return (Image) UIManager.get(LuckMenuUIBundle.ARROW_NORMAL_IMG); } | /**
* Gets the selected image
*
* @return <code>Image</code>
*/ | Gets the selected image | getNormalImg | {
"repo_name": "freeseawind/littleluck",
"path": "src_all/src_littleluck/src/main/java/freeseawind/lf/basic/menu/LuckArrowIcon.java",
"license": "apache-2.0",
"size": 1529
} | [
"java.awt.Image",
"javax.swing.UIManager"
] | import java.awt.Image; import javax.swing.UIManager; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,971,673 |
private String statusToString(final ApiResponse response) { return ((ApiResponseElement) response).getValue(); } | private String statusToString(final ApiResponse response) { return ((ApiResponseElement) response).getValue(); } | /**
* Converts the ZAP API status response to an integer.
*
* @param response
* of type ApiResponse: the ZAP API response code.
* @return the integer status of the ApiResponse.
*/ | Converts the ZAP API status response to an integer | statusToInt | {
"repo_name": "tlenaic/zap-plugin",
"path": "src/main/java/org/jenkinsci/plugins/zap/ZAPDriver.java",
"license": "mit",
"size": 157200
} | [
"org.zaproxy.clientapi.core.ApiResponse",
"org.zaproxy.clientapi.core.ApiResponseElement"
] | import org.zaproxy.clientapi.core.ApiResponse; import org.zaproxy.clientapi.core.ApiResponseElement; | import org.zaproxy.clientapi.core.*; | [
"org.zaproxy.clientapi"
] | org.zaproxy.clientapi; | 1,796,128 |
public int writeToFile(JDBCSequentialFile file, byte[] data) throws SQLException {
synchronized (connection) {
connection.setAutoCommit(false);
appendToLargeObject.setLong(1, file.getId());
int bytesWritten = 0;
try (ResultSet rs = appendToLargeObject.executeQuery()) {
if (rs.next()) {
Blob blob = rs.getBlob(1);
if (blob == null) {
blob = connection.createBlob();
}
bytesWritten = blob.setBytes(blob.length() + 1, data);
rs.updateBlob(1, blob);
rs.updateRow();
}
connection.commit();
return bytesWritten;
} catch (SQLException e) {
connection.rollback();
throw e;
}
}
} | int function(JDBCSequentialFile file, byte[] data) throws SQLException { synchronized (connection) { connection.setAutoCommit(false); appendToLargeObject.setLong(1, file.getId()); int bytesWritten = 0; try (ResultSet rs = appendToLargeObject.executeQuery()) { if (rs.next()) { Blob blob = rs.getBlob(1); if (blob == null) { blob = connection.createBlob(); } bytesWritten = blob.setBytes(blob.length() + 1, data); rs.updateBlob(1, blob); rs.updateRow(); } connection.commit(); return bytesWritten; } catch (SQLException e) { connection.rollback(); throw e; } } } | /**
* Persists data to this files associated database mapping.
*
* @param file
* @param data
* @return
* @throws SQLException
*/ | Persists data to this files associated database mapping | writeToFile | {
"repo_name": "bennetelli/activemq-artemis",
"path": "artemis-jdbc-store/src/main/java/org/apache/activemq/artemis/jdbc/store/file/JDBCSequentialFileFactoryDriver.java",
"license": "apache-2.0",
"size": 11598
} | [
"java.sql.Blob",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.Blob; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 478,643 |
protected TexturePaint getSnapshot(final double width, final double height) {
if(!latestSnapshot) {
// Need to update snapshot.
snapshotImage = (BufferedImage) createImage(DEF_SNAPSHOT_SIZE, DEF_SNAPSHOT_SIZE, true);
latestSnapshot = true;
}
// Handle non-square images
// Get the height and width of the image
int imageWidth = snapshotImage.getWidth();
int imageHeight = snapshotImage.getHeight();
double ratio = (double)imageHeight / (double) imageWidth;
int adjustedWidth = (int)((double)width/ratio)+1;
final Rectangle2D rect = new Rectangle2D.Double(-adjustedWidth / 2, -height / 2, adjustedWidth, height);
final TexturePaint texturePaint = new TexturePaint(snapshotImage, rect);
return texturePaint;
} | TexturePaint function(final double width, final double height) { if(!latestSnapshot) { snapshotImage = (BufferedImage) createImage(DEF_SNAPSHOT_SIZE, DEF_SNAPSHOT_SIZE, true); latestSnapshot = true; } int imageWidth = snapshotImage.getWidth(); int imageHeight = snapshotImage.getHeight(); double ratio = (double)imageHeight / (double) imageWidth; int adjustedWidth = (int)((double)width/ratio)+1; final Rectangle2D rect = new Rectangle2D.Double(-adjustedWidth / 2, -height / 2, adjustedWidth, height); final TexturePaint texturePaint = new TexturePaint(snapshotImage, rect); return texturePaint; } | /**
* Returns the current snapshot image of this view.
*
* <p>
* No unnecessary image object will be created if networks in the current
* session does not contain any nested network, i.e., should not have
* performance/memory issue.
*
* @return Image of this view. It is always up-to-date.
*/ | Returns the current snapshot image of this view. No unnecessary image object will be created if networks in the current session does not contain any nested network, i.e., should not have performance/memory issue | getSnapshot | {
"repo_name": "cytoscape/cytoscape-impl",
"path": "ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DRenderingEngine.java",
"license": "lgpl-2.1",
"size": 27872
} | [
"java.awt.TexturePaint",
"java.awt.geom.Rectangle2D",
"java.awt.image.BufferedImage"
] | import java.awt.TexturePaint; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; | import java.awt.*; import java.awt.geom.*; import java.awt.image.*; | [
"java.awt"
] | java.awt; | 1,356,258 |
@Generated
@Selector("setLinearAttenuation:")
public native void setLinearAttenuation(float value);
/**
* { 0.0, 0.0, 0.0, 1.0 } | @Selector(STR) native void function(float value); /** * { 0.0, 0.0, 0.0, 1.0 } | /**
* 1.0, 0.0, 0.0
*/ | 1.0, 0.0, 0.0 | setLinearAttenuation | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/glkit/GLKEffectPropertyLight.java",
"license": "apache-2.0",
"size": 9845
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 666,366 |
@Override
public Configuracao findByPrimaryKey(Serializable primaryKey)
throws NoSuchModelException, SystemException {
return findByPrimaryKey(((Long) primaryKey).longValue());
} | Configuracao function(Serializable primaryKey) throws NoSuchModelException, SystemException { return findByPrimaryKey(((Long) primaryKey).longValue()); } | /**
* Returns the configuracao with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
*
* @param primaryKey the primary key of the configuracao
* @return the configuracao
* @throws com.liferay.portal.NoSuchModelException if a configuracao with the primary key could not be found
* @throws SystemException if a system exception occurred
*/ | Returns the configuracao with the primary key or throws a <code>com.liferay.portal.NoSuchModelException</code> if it could not be found | findByPrimaryKey | {
"repo_name": "camaradosdeputadosoficial/edemocracia",
"path": "cd-priorizacao-portlet/src/main/java/br/gov/camara/edemocracia/portlets/priorizacao/service/persistence/ConfiguracaoPersistenceImpl.java",
"license": "lgpl-2.1",
"size": 33905
} | [
"br.gov.camara.edemocracia.portlets.priorizacao.model.Configuracao",
"com.liferay.portal.NoSuchModelException",
"com.liferay.portal.kernel.exception.SystemException",
"java.io.Serializable"
] | import br.gov.camara.edemocracia.portlets.priorizacao.model.Configuracao; import com.liferay.portal.NoSuchModelException; import com.liferay.portal.kernel.exception.SystemException; import java.io.Serializable; | import br.gov.camara.edemocracia.portlets.priorizacao.model.*; import com.liferay.portal.*; import com.liferay.portal.kernel.exception.*; import java.io.*; | [
"br.gov.camara",
"com.liferay.portal",
"java.io"
] | br.gov.camara; com.liferay.portal; java.io; | 498,346 |
public long length() throws IOException; | long function() throws IOException; | /**
* Gets the length of this file.
*
* @return the number of bytes this file.
*
* @exception IOException - if an I/O error occurs.
*/ | Gets the length of this file | length | {
"repo_name": "lpxz/grail-derby104",
"path": "java/engine/org/apache/derby/io/StorageRandomAccessFile.java",
"license": "apache-2.0",
"size": 5545
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,623,735 |
public static DatabaseErrorDialog newInstance(int dialogType) {
DatabaseErrorDialog f = new DatabaseErrorDialog();
Bundle args = new Bundle();
args.putInt("dialogType", dialogType);
f.setArguments(args);
return f;
} | static DatabaseErrorDialog function(int dialogType) { DatabaseErrorDialog f = new DatabaseErrorDialog(); Bundle args = new Bundle(); args.putInt(STR, dialogType); f.setArguments(args); return f; } | /**
* A set of dialogs which deal with problems with the database when it can't load
*
* @param dialogType An integer which specifies which of the sub-dialogs to show
*/ | A set of dialogs which deal with problems with the database when it can't load | newInstance | {
"repo_name": "masoud2v/Anki-Android",
"path": "src/com/ichi2/anki/dialogs/DatabaseErrorDialog.java",
"license": "gpl-3.0",
"size": 18286
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 1,810,143 |
public Object getConflictValue(int index) throws SQLException; | Object function(int index) throws SQLException; | /**
* Retrieves the value in the designated column in the current row of this
* <code>SyncResolver</code> object, which is the value in the data source
* that caused a conflict.
*
* @param index an <code>int</code> designating the column in this row of this
* <code>SyncResolver</code> object from which to retrieve the value
* causing a conflict
* @return the value of the designated column in the current row of this
* <code>SyncResolver</code> object
* @throws SQLException if a database access error occurs
*/ | Retrieves the value in the designated column in the current row of this <code>SyncResolver</code> object, which is the value in the data source that caused a conflict | getConflictValue | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/share/classes/javax/sql/rowset/spi/SyncResolver.java",
"license": "mit",
"size": 18691
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,949,107 |
void showTables(DataOutputStream out, List<String> tables)
throws HiveException; | void showTables(DataOutputStream out, List<String> tables) throws HiveException; | /**
* Show a list of tables.
*/ | Show a list of tables | showTables | {
"repo_name": "vineetgarg02/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/metadata/formatting/MetaDataFormatter.java",
"license": "apache-2.0",
"size": 4146
} | [
"java.io.DataOutputStream",
"java.util.List",
"org.apache.hadoop.hive.ql.metadata.HiveException"
] | import java.io.DataOutputStream; import java.util.List; import org.apache.hadoop.hive.ql.metadata.HiveException; | import java.io.*; import java.util.*; import org.apache.hadoop.hive.ql.metadata.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 2,454,181 |
private void extendBatch(long nowMsSinceEpoch, List<String> ackIds) throws IOException {
int extensionSec = (ackTimeoutMs * ACK_EXTENSION_PCT) / (100 * 1000);
pubsubClient.get().modifyAckDeadline(subscription, ackIds, extensionSec);
numExtendedDeadlines.add(nowMsSinceEpoch, ackIds.size());
} | void function(long nowMsSinceEpoch, List<String> ackIds) throws IOException { int extensionSec = (ackTimeoutMs * ACK_EXTENSION_PCT) / (100 * 1000); pubsubClient.get().modifyAckDeadline(subscription, ackIds, extensionSec); numExtendedDeadlines.add(nowMsSinceEpoch, ackIds.size()); } | /**
* BLOCKING
* Extend the processing deadline for messages from Pubsub with the given {@code ackIds}.
* Does not retain {@code ackIds}.
*/ | BLOCKING Extend the processing deadline for messages from Pubsub with the given ackIds. Does not retain ackIds | extendBatch | {
"repo_name": "vikkyrk/incubator-beam",
"path": "sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/pubsub/PubsubUnboundedSource.java",
"license": "apache-2.0",
"size": 53814
} | [
"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; | 528,006 |
public static void assertXMLNotEqual(String err, String control, String test)
throws SAXException, IOException {
Diff diff = new Diff(control, test);
assertXMLEqual(err, diff, false);
} | static void function(String err, String control, String test) throws SAXException, IOException { Diff diff = new Diff(control, test); assertXMLEqual(err, diff, false); } | /**
* Assert that two XML documents are NOT similar
* @param err Message to be displayed on assertion failure
* @param control XML to be compared against
* @param test XML to be tested
* @throws SAXException
* @throws IOException
*/ | Assert that two XML documents are NOT similar | assertXMLNotEqual | {
"repo_name": "xmlunit/xmlunit",
"path": "xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java",
"license": "apache-2.0",
"size": 47140
} | [
"java.io.IOException",
"org.xml.sax.SAXException"
] | import java.io.IOException; import org.xml.sax.SAXException; | import java.io.*; import org.xml.sax.*; | [
"java.io",
"org.xml.sax"
] | java.io; org.xml.sax; | 314,437 |
ServiceCall<Void> getEmptyAsync(String accountName, final ServiceCallback<Void> serviceCallback); | ServiceCall<Void> getEmptyAsync(String accountName, final ServiceCallback<Void> serviceCallback); | /**
* Get a 200 to test a valid base uri.
*
* @param accountName Account Name
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceCall} object
*/ | Get a 200 to test a valid base uri | getEmptyAsync | {
"repo_name": "haocs/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/custombaseuri/Paths.java",
"license": "mit",
"size": 1812
} | [
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] | import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,367,508 |
applyUpdates();
final Set<PluginMetaData> metadata = findAllPlugins(manager);
// Deal with plugins that had errors
metadata.stream().filter(PluginMetaData::hasErrors).forEach(this::reportErrors);
metadata.removeIf(PluginMetaData::hasErrors);
final Set<PluginMetaData> newPlugins = getValidPlugins(metadata);
knownPlugins.clear();
knownPlugins.addAll(newPlugins);
return newPlugins;
} | applyUpdates(); final Set<PluginMetaData> metadata = findAllPlugins(manager); metadata.stream().filter(PluginMetaData::hasErrors).forEach(this::reportErrors); metadata.removeIf(PluginMetaData::hasErrors); final Set<PluginMetaData> newPlugins = getValidPlugins(metadata); knownPlugins.clear(); knownPlugins.addAll(newPlugins); return newPlugins; } | /**
* Finds all plugin files on disk, loads their metadata, and validates them.
*
* @param manager The plugin manager to pass to new metadata instances.
* @return Collection of valid plugins.
*/ | Finds all plugin files on disk, loads their metadata, and validates them | refresh | {
"repo_name": "csmith/DMDirc",
"path": "src/main/java/com/dmdirc/plugins/PluginFileHandler.java",
"license": "mit",
"size": 8529
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,262,937 |
public void initCommentMediators(ReferencesTableSettings settings); | void function(ReferencesTableSettings settings); | /**
* Init the commentMediators
* @param current the current value
* @param containgFeature the feature where to navigate if necessary
* @param feature the feature to manage
*/ | Init the commentMediators | initCommentMediators | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src-gen/org/wso2/developerstudio/eclipse/gmf/esb/parts/URLRewriteMediatorOutputConnectorPropertiesEditionPart.java",
"license": "apache-2.0",
"size": 1755
} | [
"org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings"
] | import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.ReferencesTableSettings; | import org.eclipse.emf.eef.runtime.ui.widgets.referencestable.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 517,482 |
public void addSpaceCreationMembership(MembershipEntry membership) throws Exception {
if(membership == null) {
throw new IllegalArgumentException("Cannot add null membership");
}
if(!spacesAdministrationStorage.settingsEntityExists()) {
createSettingsEntityWithDefaultValues();
}
spacesAdministrationStorage.addSpaceCreationMembership(membership);
} | void function(MembershipEntry membership) throws Exception { if(membership == null) { throw new IllegalArgumentException(STR); } if(!spacesAdministrationStorage.settingsEntityExists()) { createSettingsEntityWithDefaultValues(); } spacesAdministrationStorage.addSpaceCreationMembership(membership); } | /**
* Add a new membership
* @param membership Membership to add
* @throws Exception
*/ | Add a new membership | addSpaceCreationMembership | {
"repo_name": "trangvh/spaces-administration",
"path": "services/src/main/java/org/exoplatform/addons/spacesadministration/SpacesAdministrationService.java",
"license": "lgpl-3.0",
"size": 5506
} | [
"org.exoplatform.services.security.MembershipEntry"
] | import org.exoplatform.services.security.MembershipEntry; | import org.exoplatform.services.security.*; | [
"org.exoplatform.services"
] | org.exoplatform.services; | 1,715,353 |
@UiThreadTest
@MediumTest
@Feature({"Android-AppBase"})
public void testNetworkChangeNotifierRSSIEventUpdatesMaxBandwidthForWiFi()
throws InterruptedException {
NetworkChangeNotifier notifier = NetworkChangeNotifier.getInstance();
mConnectivityDelegate.setNetworkType(ConnectivityManager.TYPE_WIFI);
mWifiDelegate.setLinkSpeedInMbps(42);
Intent intent = new Intent(WifiManager.RSSI_CHANGED_ACTION);
mReceiver.onReceive(getInstrumentation().getTargetContext(), intent);
assertEquals(42.0, notifier.getCurrentMaxBandwidthInMbps());
// Changing the link speed has no effect until the intent fires.
mWifiDelegate.setLinkSpeedInMbps(80);
assertEquals(42.0, notifier.getCurrentMaxBandwidthInMbps());
// Fire the intent.
mReceiver.onReceive(getInstrumentation().getTargetContext(), intent);
assertEquals(80.0, notifier.getCurrentMaxBandwidthInMbps());
// Firing a network type change intent also causes max bandwidth to update.
mWifiDelegate.setLinkSpeedInMbps(20);
intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
mReceiver.onReceive(getInstrumentation().getTargetContext(), intent);
assertEquals(20.0, notifier.getCurrentMaxBandwidthInMbps());
} | @Feature({STR}) void function() throws InterruptedException { NetworkChangeNotifier notifier = NetworkChangeNotifier.getInstance(); mConnectivityDelegate.setNetworkType(ConnectivityManager.TYPE_WIFI); mWifiDelegate.setLinkSpeedInMbps(42); Intent intent = new Intent(WifiManager.RSSI_CHANGED_ACTION); mReceiver.onReceive(getInstrumentation().getTargetContext(), intent); assertEquals(42.0, notifier.getCurrentMaxBandwidthInMbps()); mWifiDelegate.setLinkSpeedInMbps(80); assertEquals(42.0, notifier.getCurrentMaxBandwidthInMbps()); mReceiver.onReceive(getInstrumentation().getTargetContext(), intent); assertEquals(80.0, notifier.getCurrentMaxBandwidthInMbps()); mWifiDelegate.setLinkSpeedInMbps(20); intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION); mReceiver.onReceive(getInstrumentation().getTargetContext(), intent); assertEquals(20.0, notifier.getCurrentMaxBandwidthInMbps()); } | /**
* Tests that changing the RSSI_CHANGED_ACTION intent updates MaxBandwidth.
*/ | Tests that changing the RSSI_CHANGED_ACTION intent updates MaxBandwidth | testNetworkChangeNotifierRSSIEventUpdatesMaxBandwidthForWiFi | {
"repo_name": "Chilledheart/chromium",
"path": "net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java",
"license": "bsd-3-clause",
"size": 15332
} | [
"android.content.Intent",
"android.net.ConnectivityManager",
"android.net.wifi.WifiManager",
"org.chromium.base.test.util.Feature"
] | import android.content.Intent; import android.net.ConnectivityManager; import android.net.wifi.WifiManager; import org.chromium.base.test.util.Feature; | import android.content.*; import android.net.*; import android.net.wifi.*; import org.chromium.base.test.util.*; | [
"android.content",
"android.net",
"org.chromium.base"
] | android.content; android.net; org.chromium.base; | 966,554 |
StageContext ctx = new StageContext(o);
try {
for (Stage stage : getStages()) {
stage.process(ctx);
// Output of previous stage is input to next stage
ctx = StageContext.next(ctx);
}
return Futures.immediateFuture((T) ctx.getUpStream());
} catch (Throwable th) {
return Futures.immediateFailedFuture(th);
} finally {
Stage finalStage = getFinalStage();
if (finalStage != null) {
try {
finalStage.process(ctx);
} catch (Throwable t) {
LOG.warn("Exception thrown when executing final stage {}", finalStage, t);
}
}
}
} | StageContext ctx = new StageContext(o); try { for (Stage stage : getStages()) { stage.process(ctx); ctx = StageContext.next(ctx); } return Futures.immediateFuture((T) ctx.getUpStream()); } catch (Throwable th) { return Futures.immediateFailedFuture(th); } finally { Stage finalStage = getFinalStage(); if (finalStage != null) { try { finalStage.process(ctx); } catch (Throwable t) { LOG.warn(STR, finalStage, t); } } } } | /**
* Executes a pipeline in synchronous mode.
* <p>
* Waits for the results of previous to be available to move to next
* stage of processing.
* </p>
*
* @param o argument to run the pipeline.
*/ | Executes a pipeline in synchronous mode. Waits for the results of previous to be available to move to next stage of processing. | execute | {
"repo_name": "caskdata/cdap",
"path": "cdap-app-fabric/src/main/java/co/cask/cdap/internal/pipeline/SynchronousPipeline.java",
"license": "apache-2.0",
"size": 2309
} | [
"co.cask.cdap.pipeline.Stage",
"com.google.common.util.concurrent.Futures"
] | import co.cask.cdap.pipeline.Stage; import com.google.common.util.concurrent.Futures; | import co.cask.cdap.pipeline.*; import com.google.common.util.concurrent.*; | [
"co.cask.cdap",
"com.google.common"
] | co.cask.cdap; com.google.common; | 2,245,390 |
public RequestHandle get(Context context, String url, RequestParams params, ResponseHandlerInterface responseHandler) {
return sendRequest(httpClient, httpContext, new HttpGet(getUrlWithQueryString(isUrlEncodingEnabled, url, params)), null, responseHandler, context);
} | RequestHandle function(Context context, String url, RequestParams params, ResponseHandlerInterface responseHandler) { return sendRequest(httpClient, httpContext, new HttpGet(getUrlWithQueryString(isUrlEncodingEnabled, url, params)), null, responseHandler, context); } | /**
* Perform a HTTP GET request and track the Android Context which initiated the request.
*
* @param context the Android Context which initiated the request.
* @param url the URL to send the request to.
* @param params additional GET parameters to send with the request.
* @param responseHandler the response handler instance that should handle the response.
* @return RequestHandle of future request process
*/ | Perform a HTTP GET request and track the Android Context which initiated the request | get | {
"repo_name": "JerryMissTom/sealtalk-android",
"path": "seal/src/main/java/cn/rongcloud/im/server/network/http/AsyncHttpClient.java",
"license": "mit",
"size": 44445
} | [
"android.content.Context",
"org.apache.http.client.methods.HttpGet"
] | import android.content.Context; import org.apache.http.client.methods.HttpGet; | import android.content.*; import org.apache.http.client.methods.*; | [
"android.content",
"org.apache.http"
] | android.content; org.apache.http; | 965,837 |
default void setNotifier(Vector3i pos, @Nullable UUID uuid) {
setNotifier(pos.getX(), pos.getY(), pos.getZ(), uuid);
} | default void setNotifier(Vector3i pos, @Nullable UUID uuid) { setNotifier(pos.getX(), pos.getY(), pos.getZ(), uuid); } | /**
* Sets the {@link UUID} of the user who last notified the
* {@link BlockSnapshot} located at passed block position.
*
* @param pos The block position where the user data should be applied
* @param uuid The {@link UUID} to set as notifier
*/ | Sets the <code>UUID</code> of the user who last notified the <code>BlockSnapshot</code> located at passed block position | setNotifier | {
"repo_name": "JBYoshi/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/extent/Extent.java",
"license": "mit",
"size": 22806
} | [
"com.flowpowered.math.vector.Vector3i",
"javax.annotation.Nullable"
] | import com.flowpowered.math.vector.Vector3i; import javax.annotation.Nullable; | import com.flowpowered.math.vector.*; import javax.annotation.*; | [
"com.flowpowered.math",
"javax.annotation"
] | com.flowpowered.math; javax.annotation; | 1,985,232 |
public static Session getLastSession() {
SessionDao dao = Db.getInstance().getDaoSession().getSessionDao();
List<Session> sessions = dao.queryBuilder().orderDesc(
SessionDao.Properties.Start).limit(1).list();
if (sessions != null && !sessions.isEmpty()) {
return sessions.get(0);
}
return null;
} | static Session function() { SessionDao dao = Db.getInstance().getDaoSession().getSessionDao(); List<Session> sessions = dao.queryBuilder().orderDesc( SessionDao.Properties.Start).limit(1).list(); if (sessions != null && !sessions.isEmpty()) { return sessions.get(0); } return null; } | /**
* Retrieve the last session stored in the database.
*
* @return Last session
*/ | Retrieve the last session stored in the database | getLastSession | {
"repo_name": "Alkisum/CloudRun",
"path": "app/src/main/java/com/alkisum/android/cloudrun/utils/Sessions.java",
"license": "mit",
"size": 11872
} | [
"com.alkisum.android.cloudrun.database.Db",
"com.alkisum.android.cloudrun.model.Session",
"com.alkisum.android.cloudrun.model.SessionDao",
"java.util.List"
] | import com.alkisum.android.cloudrun.database.Db; import com.alkisum.android.cloudrun.model.Session; import com.alkisum.android.cloudrun.model.SessionDao; import java.util.List; | import com.alkisum.android.cloudrun.database.*; import com.alkisum.android.cloudrun.model.*; import java.util.*; | [
"com.alkisum.android",
"java.util"
] | com.alkisum.android; java.util; | 609,378 |
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
public static String checkNotEmpty(@Nullable String string) {
if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) {
throw new IllegalArgumentException();
}
return string;
} | @SuppressWarnings({STR, STR}) @EnsuresNonNull({"#1"}) static String function(@Nullable String string) { if (ExoPlayerLibraryInfo.ASSERTIONS_ENABLED && TextUtils.isEmpty(string)) { throw new IllegalArgumentException(); } return string; } | /**
* Throws {@link IllegalArgumentException} if {@code string} is null or zero length.
*
* @param string The string to check.
* @return The non-null, non-empty string that was validated.
* @throws IllegalArgumentException If {@code string} is null or 0-length.
*/ | Throws <code>IllegalArgumentException</code> if string is null or zero length | checkNotEmpty | {
"repo_name": "google/ExoPlayer",
"path": "library/common/src/main/java/com/google/android/exoplayer2/util/Assertions.java",
"license": "apache-2.0",
"size": 8464
} | [
"android.text.TextUtils",
"androidx.annotation.Nullable",
"com.google.android.exoplayer2.ExoPlayerLibraryInfo",
"org.checkerframework.checker.nullness.qual.EnsuresNonNull"
] | import android.text.TextUtils; import androidx.annotation.Nullable; import com.google.android.exoplayer2.ExoPlayerLibraryInfo; import org.checkerframework.checker.nullness.qual.EnsuresNonNull; | import android.text.*; import androidx.annotation.*; import com.google.android.exoplayer2.*; import org.checkerframework.checker.nullness.qual.*; | [
"android.text",
"androidx.annotation",
"com.google.android",
"org.checkerframework.checker"
] | android.text; androidx.annotation; com.google.android; org.checkerframework.checker; | 2,062,697 |
public AllHLAPI getContainerAllHLAPI() {
if (item.getContainerAll() == null)
return null;
return new AllHLAPI(item.getContainerAll());
} | AllHLAPI function() { if (item.getContainerAll() == null) return null; return new AllHLAPI(item.getContainerAll()); } | /**
* This accessor automatically encapsulate an element of the current object.
* WARNING : this creates a new object in memory.
*
* @return : null if the element is null
*/ | This accessor automatically encapsulate an element of the current object. WARNING : this creates a new object in memory | getContainerAllHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/terms/hlapi/MultisetSortHLAPI.java",
"license": "epl-1.0",
"size": 16242
} | [
"fr.lip6.move.pnml.pthlpng.multisets.hlapi.AllHLAPI"
] | import fr.lip6.move.pnml.pthlpng.multisets.hlapi.AllHLAPI; | import fr.lip6.move.pnml.pthlpng.multisets.hlapi.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 2,645,457 |
private Drawable getDrawableFromColor(int color) {
GradientDrawable tempDrawable = new GradientDrawable();
tempDrawable.setCornerRadius(this.getRadius());
tempDrawable.setColor(color);
return tempDrawable;
}
| Drawable function(int color) { GradientDrawable tempDrawable = new GradientDrawable(); tempDrawable.setCornerRadius(this.getRadius()); tempDrawable.setColor(color); return tempDrawable; } | /**
* use for get drawable from color
*
* @param color
* @return
*/ | use for get drawable from color | getDrawableFromColor | {
"repo_name": "hanks-zyh/Set",
"path": "src/com/zyh/testtouch/Configuration.java",
"license": "apache-2.0",
"size": 11805
} | [
"android.graphics.drawable.Drawable",
"android.graphics.drawable.GradientDrawable"
] | import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; | import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 2,311,587 |
public void loadSalesOrders(String data) throws IllegalArgumentException, ParserException, MalformedURLException
{
List<SalesOrder> semanticData = SalesOrders(data);
setSalesOrders(semanticData);
} | void function(String data) throws IllegalArgumentException, ParserException, MalformedURLException { List<SalesOrder> semanticData = SalesOrders(data); setSalesOrders(semanticData); } | /**
* SalesOrders Load method
*
* loads the navigation property entries into the entityType
* @throws ParserException
* @throws IllegalArgumentException
* @throws MalformedURLException
*
*/ | SalesOrders Load method loads the navigation property entries into the entityType | loadSalesOrders | {
"repo_name": "liangyaohua/SalesOrder",
"path": "src/com/capgemini/SalesOrder/zgwsample_srv/v0/entitytypes/BusinessPartner.java",
"license": "gpl-2.0",
"size": 17063
} | [
"com.sap.mobile.lib.parser.ParserException",
"java.net.MalformedURLException",
"java.util.List"
] | import com.sap.mobile.lib.parser.ParserException; import java.net.MalformedURLException; import java.util.List; | import com.sap.mobile.lib.parser.*; import java.net.*; import java.util.*; | [
"com.sap.mobile",
"java.net",
"java.util"
] | com.sap.mobile; java.net; java.util; | 1,708,195 |
public int read(byte[] buf, int off, int len) throws IOException {
if (len == 0)
return 0;
if (in == null)
throw new XZIOException("Stream closed");
if (exception != null)
throw exception;
int size;
try {
size = in.read(buf, off, len);
} catch (IOException e) {
exception = e;
throw e;
}
if (size == -1)
return -1;
delta.decode(buf, off, size);
return size;
} | int function(byte[] buf, int off, int len) throws IOException { if (len == 0) return 0; if (in == null) throw new XZIOException(STR); if (exception != null) throw exception; int size; try { size = in.read(buf, off, len); } catch (IOException e) { exception = e; throw e; } if (size == -1) return -1; delta.decode(buf, off, size); return size; } | /**
* Decode into an array of bytes.
* <p>
* This calls <code>in.read(buf, off, len)</code> and defilters the
* returned data.
*
* @param buf target buffer for decoded data
* @param off start offset in <code>buf</code>
* @param len maximum number of bytes to read
*
* @return number of bytes read, or <code>-1</code> to indicate
* the end of the input stream <code>in</code>
*
* @throws XZIOException if the stream has been closed
*
* @throws IOException may be thrown by underlaying input
* stream <code>in</code>
*/ | Decode into an array of bytes. This calls <code>in.read(buf, off, len)</code> and defilters the returned data | read | {
"repo_name": "itsgreco/VirtueRS3",
"path": "src/org/virtue/cache/utility/tukaani/DeltaInputStream.java",
"license": "mit",
"size": 4188
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,726,246 |
User validateLogin(String username, String password) ;
| User validateLogin(String username, String password) ; | /**
* Validates the user login.
*
* @param username The username
* @param password The password
* @return The user object if the provided information was corret, <code>null</code> if the information was invalid
*/ | Validates the user login | validateLogin | {
"repo_name": "linda1890/jforum2",
"path": "src/main/java/net/jforum/dao/UserDAO.java",
"license": "bsd-3-clause",
"size": 13518
} | [
"net.jforum.entities.User"
] | import net.jforum.entities.User; | import net.jforum.entities.*; | [
"net.jforum.entities"
] | net.jforum.entities; | 1,474,340 |
public AppComponent getDaggerComponent() {
if (mDaggerComponent == null) {
mDaggerComponent = DaggerAppComponent.builder()
.appModule(new AppModule(false))
.build();
}
return mDaggerComponent;
} | AppComponent function() { if (mDaggerComponent == null) { mDaggerComponent = DaggerAppComponent.builder() .appModule(new AppModule(false)) .build(); } return mDaggerComponent; } | /**
* Allows to inject dependencies into classes
*/ | Allows to inject dependencies into classes | getDaggerComponent | {
"repo_name": "olivierg13/EspressoMockitoDaggerLeakCanary",
"path": "app/src/main/java/com/og/emdlc/application/EmdlcApplication.java",
"license": "mit",
"size": 1351
} | [
"com.og.emdlc.dagger.AppComponent",
"com.og.emdlc.dagger.AppModule",
"com.og.emdlc.dagger.DaggerAppComponent"
] | import com.og.emdlc.dagger.AppComponent; import com.og.emdlc.dagger.AppModule; import com.og.emdlc.dagger.DaggerAppComponent; | import com.og.emdlc.dagger.*; | [
"com.og.emdlc"
] | com.og.emdlc; | 1,169,423 |
private static Map<CacheKey, WrapDynaClass> getClassesCache() {
return CLASSLOADER_CACHE.get();
} | static Map<CacheKey, WrapDynaClass> function() { return CLASSLOADER_CACHE.get(); } | /**
* Returns the cache for the already created class instances. For each
* combination of bean class and {@code PropertyUtilsBean} instance an
* entry is created in the cache.
* @return the cache for already created {@code WrapDynaClass} instances
*/ | Returns the cache for the already created class instances. For each combination of bean class and PropertyUtilsBean instance an entry is created in the cache | getClassesCache | {
"repo_name": "mohanaraosv/commons-beanutils",
"path": "src/main/java/org/apache/commons/beanutils/WrapDynaClass.java",
"license": "apache-2.0",
"size": 18567
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 348,274 |
public static boolean delete(String fileNameWithFullPath){
File file = new File(fileNameWithFullPath);
return file.delete();
} | static boolean function(String fileNameWithFullPath){ File file = new File(fileNameWithFullPath); return file.delete(); } | /**
* Deletes a File from an url.
*/ | Deletes a File from an url | delete | {
"repo_name": "idega/platform2",
"path": "src/com/idega/util/FileUtil.java",
"license": "gpl-3.0",
"size": 24559
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,169,530 |
public Callsite getCallsiteForAstNode(Node callsiteNode) {
Preconditions.checkArgument(callsiteNode.isCall() ||
callsiteNode.isNew());
return callsitesByNode.get(callsiteNode);
} | Callsite function(Node callsiteNode) { Preconditions.checkArgument(callsiteNode.isCall() callsiteNode.isNew()); return callsitesByNode.get(callsiteNode); } | /**
* Returns the call graph Callsite object corresponding to the provided
* AST Token.CALL or Token.NEW node, or null if no such object exists.
*/ | Returns the call graph Callsite object corresponding to the provided AST Token.CALL or Token.NEW node, or null if no such object exists | getCallsiteForAstNode | {
"repo_name": "jhiswin/idiil-closure-compiler",
"path": "src/com/google/javascript/jscomp/CallGraph.java",
"license": "apache-2.0",
"size": 23914
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.rhino.Node"
] | import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; | import com.google.common.base.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 2,510,281 |
private MultiValueMap<String, String> buildAuthorization(final String user, final String token) {
final StringBuilder sbAuth = new StringBuilder();
sbAuth.append(user).append(":").append(token);
final StringBuilder sb = new StringBuilder();
sb.append("Basic ").append(new String(Base64.encodeBase64(sbAuth.toString().getBytes())));
final MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Authorization", sb.toString());
return headers;
} | MultiValueMap<String, String> function(final String user, final String token) { final StringBuilder sbAuth = new StringBuilder(); sbAuth.append(user).append(":").append(token); final StringBuilder sb = new StringBuilder(); sb.append(STR).append(new String(Base64.encodeBase64(sbAuth.toString().getBytes()))); final MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>(); headers.add(STR, sb.toString()); return headers; } | /**
* Generate headers for authorization.
* @param user is the user
* @param token is the token
* @return the headers
*/ | Generate headers for authorization | buildAuthorization | {
"repo_name": "my3D-Team/light-controller",
"path": "src/main/java/com/capgemini/services/JenkinsService.java",
"license": "mit",
"size": 6919
} | [
"org.apache.tomcat.util.codec.binary.Base64",
"org.springframework.util.LinkedMultiValueMap",
"org.springframework.util.MultiValueMap"
] | import org.apache.tomcat.util.codec.binary.Base64; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; | import org.apache.tomcat.util.codec.binary.*; import org.springframework.util.*; | [
"org.apache.tomcat",
"org.springframework.util"
] | org.apache.tomcat; org.springframework.util; | 2,643,224 |
public Set<JpaAction> getActions() {
return Collections.unmodifiableSet(actions);
} | Set<JpaAction> function() { return Collections.unmodifiableSet(actions); } | /**
* Provides a read-only copy of this notification's actions.
*/ | Provides a read-only copy of this notification's actions | getActions | {
"repo_name": "is-apps/NotificationPortlet",
"path": "notification-portlet-webapp/src/main/java/org/jasig/portlet/notice/service/jpa/JpaEntry.java",
"license": "apache-2.0",
"size": 6002
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,518,891 |
public void setProcessSource(FLyrRasterSE lyr) {
if(process != null)
process.setSourceLayer(lyr);
}
| void function(FLyrRasterSE lyr) { if(process != null) process.setSourceLayer(lyr); } | /**
* Asigna la capa fuente para el proceso
* @param lyr
*/ | Asigna la capa fuente para el proceso | setProcessSource | {
"repo_name": "iCarto/siga",
"path": "extRasterTools-SE/src/org/gvsig/rastertools/vectorizacion/filter/GrayConversionListener.java",
"license": "gpl-3.0",
"size": 10061
} | [
"org.gvsig.fmap.raster.layers.FLyrRasterSE"
] | import org.gvsig.fmap.raster.layers.FLyrRasterSE; | import org.gvsig.fmap.raster.layers.*; | [
"org.gvsig.fmap"
] | org.gvsig.fmap; | 720,324 |
public Map<TileName, TileData> newScnMap(String path) {
TerraSyncDirectoryTypes[] types = { TerraSyncDirectoryTypes.TERRAIN, TerraSyncDirectoryTypes.OBJECTS,
TerraSyncDirectoryTypes.BUILDINGS };
Pattern patt = Pattern.compile("([ew])(\\p{Digit}{3})([ns])(\\p{Digit}{2})");
Map<TileName, TileData> map = new HashMap<>(180 * 90);
for (TerraSyncDirectoryTypes terraSyncDirectoryType : types) {
File d = new File(path + File.separator + terraSyncDirectoryType.getDirname());
File[] list = d.listFiles();
if (list != null) {
// list of 10x10 dirs
for (File f : list) {
Matcher m = patt.matcher(f.getName());
if (m.matches()) {
// now look inside this dir
buildScnMap(f, map, terraSyncDirectoryType);
}
}
}
}
return map;
}
| Map<TileName, TileData> function(String path) { TerraSyncDirectoryTypes[] types = { TerraSyncDirectoryTypes.TERRAIN, TerraSyncDirectoryTypes.OBJECTS, TerraSyncDirectoryTypes.BUILDINGS }; Pattern patt = Pattern.compile(STR); Map<TileName, TileData> map = new HashMap<>(180 * 90); for (TerraSyncDirectoryTypes terraSyncDirectoryType : types) { File d = new File(path + File.separator + terraSyncDirectoryType.getDirname()); File[] list = d.listFiles(); if (list != null) { for (File f : list) { Matcher m = patt.matcher(f.getName()); if (m.matches()) { buildScnMap(f, map, terraSyncDirectoryType); } } } } return map; } | /**
* builds a HashMap of /Terrain and /Objects
*/ | builds a HashMap of /Terrain and /Objects | newScnMap | {
"repo_name": "Portree-Kid/terramaster",
"path": "src/main/java/org/flightgear/terramaster/HTTPTerraSync.java",
"license": "gpl-2.0",
"size": 25480
} | [
"java.io.File",
"java.util.HashMap",
"java.util.Map",
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.io.File; import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.io.*; import java.util.*; import java.util.regex.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 556,718 |
public EReference getTender_Cheque() {
return (EReference)getTender().getEStructuralFeatures().get(5);
} | EReference function() { return (EReference)getTender().getEStructuralFeatures().get(5); } | /**
* Returns the meta object for the reference '{@link CIM15.IEC61968.PaymentMetering.Tender#getCheque <em>Cheque</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Cheque</em>'.
* @see CIM15.IEC61968.PaymentMetering.Tender#getCheque()
* @see #getTender()
* @generated
*/ | Returns the meta object for the reference '<code>CIM15.IEC61968.PaymentMetering.Tender#getCheque Cheque</code>'. | getTender_Cheque | {
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61968/PaymentMetering/PaymentMeteringPackage.java",
"license": "apache-2.0",
"size": 290630
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,148,486 |
public static CellEditor createCustomPropertyEditor(Composite composite,
Object propertyContainer, IItemPropertyDescriptor propertyDescriptor) {
Object feature = propertyDescriptor.getFeature(propertyContainer);
if (feature instanceof EStructuralFeature) {
EStructuralFeature efeat = (EStructuralFeature) feature;
Class<?> instanceClass = efeat.getEType().getInstanceClass();
CustomPropertyEditorBuilder builder = customPropertyEditorBuildersMap
.get(instanceClass);
if (null != builder) {
return builder.build(composite, propertyContainer,
propertyDescriptor);
}
}
return null;
} | static CellEditor function(Composite composite, Object propertyContainer, IItemPropertyDescriptor propertyDescriptor) { Object feature = propertyDescriptor.getFeature(propertyContainer); if (feature instanceof EStructuralFeature) { EStructuralFeature efeat = (EStructuralFeature) feature; Class<?> instanceClass = efeat.getEType().getInstanceClass(); CustomPropertyEditorBuilder builder = customPropertyEditorBuildersMap .get(instanceClass); if (null != builder) { return builder.build(composite, propertyContainer, propertyDescriptor); } } return null; } | /**
* Attempts to create a custom property editor for the specified property.
*
* @param composite
* container UI widget.
* @param propertyContainer
* property container object.
* @param propertyDescriptor
* property descriptor.
* @return a {@link CellEditor} which fires up a custom property editor or
* null if no such custom editor is defined.
*/ | Attempts to create a custom property editor for the specified property | createCustomPropertyEditor | {
"repo_name": "chanakaudaya/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.esb.editor/src/org/wso2/developerstudio/eclipse/esb/presentation/custom/CustomPropertyEditorFactory.java",
"license": "apache-2.0",
"size": 5371
} | [
"org.eclipse.emf.ecore.EStructuralFeature",
"org.eclipse.emf.edit.provider.IItemPropertyDescriptor",
"org.eclipse.jface.viewers.CellEditor",
"org.eclipse.swt.widgets.Composite"
] | import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; import org.eclipse.jface.viewers.CellEditor; import org.eclipse.swt.widgets.Composite; | import org.eclipse.emf.ecore.*; import org.eclipse.emf.edit.provider.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.emf",
"org.eclipse.jface",
"org.eclipse.swt"
] | org.eclipse.emf; org.eclipse.jface; org.eclipse.swt; | 1,225,029 |
@Deprecated
private void checkBrowseAuthority(DestinationHandler destination,
String destinationName,
SecurityContext secContext,
boolean system)
throws SINotAuthorizedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"checkBrowseAuthority",
new Object[] { destination,
destinationName,
secContext,
Boolean.valueOf(system) });
// Check authority to browse a destination
if (!destination.isTemporary() && !system)
{
boolean allowed = true;
boolean failingOpisIdentityAdopter = false;
// Perform the alternate user check first. If an alternateUser was set then we
// need to determine whether the connected subject has the authority to perform
// alternate user checks.
if (secContext.isAlternateUserBased())
{
if (!destination.checkDestinationAccess(secContext,
OperationType.IDENTITY_ADOPTER))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
SibTr.debug(tc, "checkBrowseAuthority", "not authorized to perform alternate user checks on this destination");
allowed = false;
failingOpisIdentityAdopter = true;
}
}
if (allowed) // ok so far
{
// Check if its the default exc dest
if (destinationName.startsWith(SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX))
{
//If its a def exc dest see if we have access to the prefix.
if (!_messageProcessor.
getAccessChecker().
checkDestinationAccess(secContext,
null, // home bus
SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX,
OperationType.RECEIVE))
{
allowed = false;
}
}
else
{
if (!destination.checkDestinationAccess(secContext,
OperationType.BROWSE))
{
allowed = false;
}
}
}
if (!allowed)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkBrowseAuthority", "not authorized to browse this destination");
// Get the username
String userName = secContext.getUserName(failingOpisIdentityAdopter);
OperationType operationType =
failingOpisIdentityAdopter ? OperationType.IDENTITY_ADOPTER :
OperationType.BROWSE;
// Build the message for the Exception and the Notification
String nlsMessage =
nls.getFormattedMessage("USER_NOT_AUTH_BROWSE_ERROR_CWSIP0304",
new Object[] { destination.getName(),
userName },
null);
// Fire a Notification if Eventing is enabled
_accessChecker.
fireDestinationAccessNotAuthorizedEvent(destination.getName(),
userName,
operationType,
nlsMessage);
// Thrown if user denied access to destination
throw new SINotAuthorizedException(nlsMessage);
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "checkBrowseAuthority");
} | void function(DestinationHandler destination, String destinationName, SecurityContext secContext, boolean system) throws SINotAuthorizedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry( tc, STR, new Object[] { destination, destinationName, secContext, Boolean.valueOf(system) }); if (!destination.isTemporary() && !system) { boolean allowed = true; boolean failingOpisIdentityAdopter = false; if (secContext.isAlternateUserBased()) { if (!destination.checkDestinationAccess(secContext, OperationType.IDENTITY_ADOPTER)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, STR, STR); allowed = false; failingOpisIdentityAdopter = true; } } if (allowed) { if (destinationName.startsWith(SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX)) { if (!_messageProcessor. getAccessChecker(). checkDestinationAccess(secContext, null, SIMPConstants.SYSTEM_DEFAULT_EXCEPTION_DESTINATION_PREFIX, OperationType.RECEIVE)) { allowed = false; } } else { if (!destination.checkDestinationAccess(secContext, OperationType.BROWSE)) { allowed = false; } } } if (!allowed) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, STR, STR); String userName = secContext.getUserName(failingOpisIdentityAdopter); OperationType operationType = failingOpisIdentityAdopter ? OperationType.IDENTITY_ADOPTER : OperationType.BROWSE; String nlsMessage = nls.getFormattedMessage(STR, new Object[] { destination.getName(), userName }, null); _accessChecker. fireDestinationAccessNotAuthorizedEvent(destination.getName(), userName, operationType, nlsMessage); throw new SINotAuthorizedException(nlsMessage); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, STR); } | /**
* Checks the authority of a consumer to consume from a destination
*
*/ | Checks the authority of a consumer to consume from a destination | checkBrowseAuthority | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/ConnectionImpl.java",
"license": "epl-1.0",
"size": 384319
} | [
"com.ibm.websphere.ras.TraceComponent",
"com.ibm.ws.sib.processor.SIMPConstants",
"com.ibm.ws.sib.processor.impl.interfaces.DestinationHandler",
"com.ibm.ws.sib.security.auth.OperationType",
"com.ibm.ws.sib.utils.ras.SibTr",
"com.ibm.wsspi.sib.core.exception.SINotAuthorizedException"
] | import com.ibm.websphere.ras.TraceComponent; import com.ibm.ws.sib.processor.SIMPConstants; import com.ibm.ws.sib.processor.impl.interfaces.DestinationHandler; import com.ibm.ws.sib.security.auth.OperationType; import com.ibm.ws.sib.utils.ras.SibTr; import com.ibm.wsspi.sib.core.exception.SINotAuthorizedException; | import com.ibm.websphere.ras.*; import com.ibm.ws.sib.processor.*; import com.ibm.ws.sib.processor.impl.interfaces.*; import com.ibm.ws.sib.security.auth.*; import com.ibm.ws.sib.utils.ras.*; import com.ibm.wsspi.sib.core.exception.*; | [
"com.ibm.websphere",
"com.ibm.ws",
"com.ibm.wsspi"
] | com.ibm.websphere; com.ibm.ws; com.ibm.wsspi; | 183,431 |
protected void read() throws Exception {
InputStream is = socket.getInputStream();
while (is.available() > 0) {
byte[] bytes = new byte[1024 * 1024];
int read = is.read(bytes);
byte[] actuallyRead = new byte[read];
System.arraycopy(bytes, 0, actuallyRead, 0, read);
pushInput(actuallyRead);
}
} | void function() throws Exception { InputStream is = socket.getInputStream(); while (is.available() > 0) { byte[] bytes = new byte[1024 * 1024]; int read = is.read(bytes); byte[] actuallyRead = new byte[read]; System.arraycopy(bytes, 0, actuallyRead, 0, read); pushInput(actuallyRead); } } | /**
* listen for a complete message.
*/ | listen for a complete message | read | {
"repo_name": "freynaud/ios-driver",
"path": "server/src/main/java/org/uiautomation/ios/wkrdp/internal/SimulatorProtocolImpl.java",
"license": "apache-2.0",
"size": 5196
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,715,635 |
public Color getColorLog(double value) {
int izV;
double minZtmp = this.minZ;
double maxZtmp = this.maxZ;
if (this.minZ <= 0.0) {
// negatives = true;
this.maxZ = maxZtmp - minZtmp + 1;
this.minZ = 1;
value = value - minZtmp + 1;
}
double minZlog = Math.log(this.minZ) / log10;
double maxZlog = Math.log(this.maxZ) / log10;
value = Math.log(value) / log10;
// value = Math.pow(10,value);
if (this.stepped) {
int numSteps = this.tickValues.length;
int steps = 256 / (numSteps - 1);
izV = steps * (int) (numSteps * (value - minZlog)
/ (maxZlog - minZlog)) + 2;
// izV = steps*numSteps*(int)((value/minZ)/(maxZlog-minZlog)) + 2;
}
else {
izV = (int) (253 * (value - minZlog) / (maxZlog - minZlog)) + 2;
}
izV = Math.min(izV, 255);
izV = Math.max(izV, 2);
this.minZ = minZtmp;
this.maxZ = maxZtmp;
return getColor(izV);
}
| Color function(double value) { int izV; double minZtmp = this.minZ; double maxZtmp = this.maxZ; if (this.minZ <= 0.0) { this.maxZ = maxZtmp - minZtmp + 1; this.minZ = 1; value = value - minZtmp + 1; } double minZlog = Math.log(this.minZ) / log10; double maxZlog = Math.log(this.maxZ) / log10; value = Math.log(value) / log10; if (this.stepped) { int numSteps = this.tickValues.length; int steps = 256 / (numSteps - 1); izV = steps * (int) (numSteps * (value - minZlog) / (maxZlog - minZlog)) + 2; } else { izV = (int) (253 * (value - minZlog) / (maxZlog - minZlog)) + 2; } izV = Math.min(izV, 255); izV = Math.max(izV, 2); this.minZ = minZtmp; this.maxZ = maxZtmp; return getColor(izV); } | /**
* Returns Color by mapping a given value to a common log palette.
*
* @param value the value.
*
* @return The color.
*/ | Returns Color by mapping a given value to a common log palette | getColorLog | {
"repo_name": "sebkur/JFreeChart",
"path": "src/main/java/org/jfree/chart/plot/ColorPalette.java",
"license": "lgpl-3.0",
"size": 12788
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,338,552 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.