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
|
---|---|---|---|---|---|---|---|---|---|---|---|
@ApiModelProperty(example = "null", required = true, value = "Yesterday's total number of kills against enemy factions")
public Integer getYesterday() {
return yesterday;
} | @ApiModelProperty(example = "null", required = true, value = STR) Integer function() { return yesterday; } | /**
* Yesterday's total number of kills against enemy factions
*
* @return yesterday
**/ | Yesterday's total number of kills against enemy factions | getYesterday | {
"repo_name": "GoldenGnu/eve-esi",
"path": "src/main/java/net/troja/eve/esi/model/FactionWarfareStatsKills.java",
"license": "apache-2.0",
"size": 4013
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 631,585 |
public void consumeAsync(List<Purchase> purchases, OnConsumeMultiFinishedListener listener) {
checkNotDisposed();
checkSetupDone("consume");
consumeAsyncInternal(purchases, null, listener);
} | void function(List<Purchase> purchases, OnConsumeMultiFinishedListener listener) { checkNotDisposed(); checkSetupDone(STR); consumeAsyncInternal(purchases, null, listener); } | /**
* Same as {@link consumeAsync}, but for multiple items at once.
* @param purchases The list of PurchaseInfo objects representing the purchases to consume.
* @param listener The listener to notify when the consumption operation finishes.
*/ | Same as <code>consumeAsync</code>, but for multiple items at once | consumeAsync | {
"repo_name": "dunkfordyce/cordova-ios-storekit",
"path": "src/android/com/kuya/cordova/plugin/util/IabHelper.java",
"license": "mit",
"size": 44352
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,024,773 |
protected Service getServiceFrom(final Map<String, Object> model) {
return (Service) model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_SERVICE);
} | Service function(final Map<String, Object> model) { return (Service) model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_SERVICE); } | /**
* Gets validated service from the model.
*
* @param model the model
* @return the validated service from
*/ | Gets validated service from the model | getServiceFrom | {
"repo_name": "philliprower/cas",
"path": "core/cas-server-core-web-api/src/main/java/org/apereo/cas/services/web/view/AbstractCasView.java",
"license": "apache-2.0",
"size": 10513
} | [
"java.util.Map",
"org.apereo.cas.CasViewConstants",
"org.apereo.cas.authentication.principal.Service"
] | import java.util.Map; import org.apereo.cas.CasViewConstants; import org.apereo.cas.authentication.principal.Service; | import java.util.*; import org.apereo.cas.*; import org.apereo.cas.authentication.principal.*; | [
"java.util",
"org.apereo.cas"
] | java.util; org.apereo.cas; | 219,615 |
public boolean getRotateYUp() {
if ( rotateYUp == null ) {
rotateYUp = (SFBool)getField( "rotateYUp" );
}
return( rotateYUp.getValue( ) );
} | boolean function() { if ( rotateYUp == null ) { rotateYUp = (SFBool)getField( STR ); } return( rotateYUp.getValue( ) ); } | /** Return the rotateYUp boolean value.
* @return The rotateYUp boolean value. */ | Return the rotateYUp boolean value | getRotateYUp | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/sai/external/node/geospatial/SAIGeoOrigin.java",
"license": "gpl-2.0",
"size": 3459
} | [
"org.web3d.x3d.sai.SFBool"
] | import org.web3d.x3d.sai.SFBool; | import org.web3d.x3d.sai.*; | [
"org.web3d.x3d"
] | org.web3d.x3d; | 2,467,984 |
public float readFloat() throws IOException {
return Float.intBitsToFloat(readInt());
} | float function() throws IOException { return Float.intBitsToFloat(readInt()); } | /**
* Reads a little-endian IEEE754 32-bit float.
*
* @throws IOException if past end of input or error in underlying stream
*/ | Reads a little-endian IEEE754 32-bit float | readFloat | {
"repo_name": "google/s2-geometry-library-java",
"path": "src/com/google/common/geometry/LittleEndianInput.java",
"license": "apache-2.0",
"size": 3654
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,798,044 |
public void updateTemplate(String field, String value) {
HttpSession session = WebContextFactory.get().getSession();
boolean isNewTemplate = (session.getAttribute(Constants.NEW_TEMPLATE) != null)
? true : false;
TemplateQuery templateQuery = (TemplateQuery) SessionMethods.getQuery(session);
if (!isNewTemplate && session.getAttribute(Constants.PREV_TEMPLATE_NAME) == null) {
session.setAttribute(Constants.PREV_TEMPLATE_NAME, templateQuery.getName());
}
try {
PropertyUtils.setSimpleProperty(templateQuery, field, value);
} catch (Exception ex) {
ex.printStackTrace();
}
} | void function(String field, String value) { HttpSession session = WebContextFactory.get().getSession(); boolean isNewTemplate = (session.getAttribute(Constants.NEW_TEMPLATE) != null) ? true : false; TemplateQuery templateQuery = (TemplateQuery) SessionMethods.getQuery(session); if (!isNewTemplate && session.getAttribute(Constants.PREV_TEMPLATE_NAME) == null) { session.setAttribute(Constants.PREV_TEMPLATE_NAME, templateQuery.getName()); } try { PropertyUtils.setSimpleProperty(templateQuery, field, value); } catch (Exception ex) { ex.printStackTrace(); } } | /**
* Update with the value given in input the field of the previous template
* saved into the session
* @param field the field to update
* @param value the value
*/ | Update with the value given in input the field of the previous template saved into the session | updateTemplate | {
"repo_name": "joshkh/intermine",
"path": "intermine/web/main/src/org/intermine/dwr/AjaxServices.java",
"license": "lgpl-2.1",
"size": 62567
} | [
"javax.servlet.http.HttpSession",
"org.apache.commons.beanutils.PropertyUtils",
"org.directwebremoting.WebContextFactory",
"org.intermine.template.TemplateQuery",
"org.intermine.web.logic.Constants",
"org.intermine.web.logic.session.SessionMethods"
] | import javax.servlet.http.HttpSession; import org.apache.commons.beanutils.PropertyUtils; import org.directwebremoting.WebContextFactory; import org.intermine.template.TemplateQuery; import org.intermine.web.logic.Constants; import org.intermine.web.logic.session.SessionMethods; | import javax.servlet.http.*; import org.apache.commons.beanutils.*; import org.directwebremoting.*; import org.intermine.template.*; import org.intermine.web.logic.*; import org.intermine.web.logic.session.*; | [
"javax.servlet",
"org.apache.commons",
"org.directwebremoting",
"org.intermine.template",
"org.intermine.web"
] | javax.servlet; org.apache.commons; org.directwebremoting; org.intermine.template; org.intermine.web; | 1,519,842 |
public void doScriptText(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
_doScript(req, rsp, "_scriptText.jelly");
} | void function(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException { _doScript(req, rsp, STR); } | /**
* Run arbitrary Groovy script and return result as plain text.
*/ | Run arbitrary Groovy script and return result as plain text | doScriptText | {
"repo_name": "rsandell/jenkins",
"path": "core/src/main/java/hudson/model/Computer.java",
"license": "mit",
"size": 67103
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"org.kohsuke.stapler.StaplerRequest",
"org.kohsuke.stapler.StaplerResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; | import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*; | [
"java.io",
"javax.servlet",
"org.kohsuke.stapler"
] | java.io; javax.servlet; org.kohsuke.stapler; | 1,298,343 |
public PageResourceNotificationUserTypeResource getUserNotificationInfoList(String userId, Integer size, Integer page, String order) throws ApiException {
Object localVarPostBody = null;
// verify the required parameter 'userId' is set
if (userId == null) {
throw new ApiException(400, "Missing the required parameter 'userId' when calling getUserNotificationInfoList");
}
// create path and map variables
String localVarPath = "/users/{user_id}/notifications/types"
.replaceAll("\\{" + "user_id" + "\\}", apiClient.escapeString(userId.toString()));
// query params
List<Pair> localVarQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
localVarQueryParams.addAll(apiClient.parameterToPairs("", "size", size));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "page", page));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "order", order));
final String[] localVarAccepts = {
"application/json"
};
final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);
final String[] localVarContentTypes = {
};
final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);
String[] localVarAuthNames = new String[] { "oauth2_client_credentials_grant", "oauth2_password_grant" };
GenericType<PageResourceNotificationUserTypeResource> localVarReturnType = new GenericType<PageResourceNotificationUserTypeResource>() {};
return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
} | PageResourceNotificationUserTypeResource function(String userId, Integer size, Integer page, String order) throws ApiException { Object localVarPostBody = null; if (userId == null) { throw new ApiException(400, STR); } String localVarPath = STR .replaceAll("\\{" + STR + "\\}", apiClient.escapeString(userId.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); localVarQueryParams.addAll(apiClient.parameterToPairs(STRsize", size)); localVarQueryParams.addAll(apiClient.parameterToPairs(STRpage", page)); localVarQueryParams.addAll(apiClient.parameterToPairs(STRorderSTRapplication/jsonSTRoauth2_client_credentials_grantSTRoauth2_password_grantSTRGET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); } | /**
* View a user's notification settings
* <b>Permissions Needed:</b> NOTIFICATIONS_ADMIN or self
* @param userId The id of the subscriber or 'me' (required)
* @param size The number of objects returned per page (optional, default to 25)
* @param page The number of the page returned, starting with 1 (optional, default to 1)
* @param order A comma separated list of sorting requirements in priority order, each entry matching PROPERTY_NAME:[ASC|DESC] (optional, default to id:ASC)
* @return PageResourceNotificationUserTypeResource
* @throws ApiException if fails to make API call
*/ | View a user's notification settings <b>Permissions Needed:</b> NOTIFICATIONS_ADMIN or self | getUserNotificationInfoList | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/api/NotificationsApi.java",
"license": "apache-2.0",
"size": 23667
} | [
"com.knetikcloud.client.ApiException",
"com.knetikcloud.client.Pair",
"com.knetikcloud.model.PageResourceNotificationUserTypeResource",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import com.knetikcloud.client.ApiException; import com.knetikcloud.client.Pair; import com.knetikcloud.model.PageResourceNotificationUserTypeResource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; | import com.knetikcloud.client.*; import com.knetikcloud.model.*; import java.util.*; | [
"com.knetikcloud.client",
"com.knetikcloud.model",
"java.util"
] | com.knetikcloud.client; com.knetikcloud.model; java.util; | 2,332,564 |
public Number getVersion() {
return (Number) getAttributeInternal(VERSION);
} | Number function() { return (Number) getAttributeInternal(VERSION); } | /**
* Gets the attribute value for VERSION using the alias name Version
*/ | Gets the attribute value for VERSION using the alias name Version | getVersion | {
"repo_name": "CBIIT/cadsr-util",
"path": "cadsrutil/src/java/gov/nih/nci/ncicb/cadsr/common/persistence/bc4j/FormValidValuesViewRowImpl.java",
"license": "bsd-3-clause",
"size": 10480
} | [
"oracle.jbo.domain.Number"
] | import oracle.jbo.domain.Number; | import oracle.jbo.domain.*; | [
"oracle.jbo.domain"
] | oracle.jbo.domain; | 2,060,673 |
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException
| IllegalAccessException | UnsupportedLookAndFeelException e1) {
//honestly, if this doesnt work, whatever we'll use default. should fail silently.
}
try {
// ResourceManager.get().registerResourceType(Tileset.class);
// ResourceManager.get().registerResourceType(TilesetHandle.class);
TilesetLoadDialog dialog = new TilesetLoadDialog();
TilesetManager manager = new TilesetManager();
TilesetGroupNode root = new TilesetGroupNode("Tilesets");
TilesetHandle h = new BasicTilesetHandle("Pipes", "images/Pipes.png", 64, 64);
root.addNode(new TilesetTileNode(h));
TilesetGroupNode group = new TilesetGroupNode("group");
h = new BasicTilesetHandle("Boxes", "images/testboxes.png", 64, 64);
group.addNode(new TilesetTileNode(h));
root.addNode(group);
manager.setRoot(root);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dialog.showDialog(manager);
recursivePrint(manager.getRoot(), 0);
} catch (Exception e) {
e.printStackTrace();
}
}
public TilesetLoadDialog() {
setModal(true);
setBounds(100, 100, 609, 563);
getContentPane().setLayout(new BorderLayout());
tilesetLoadPanel = new TilesetLoadPanel();
getContentPane().add(tilesetLoadPanel, BorderLayout.CENTER);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.setActionCommand("OK");
okButton.addActionListener(this);
buttonPane.add(okButton);
}
{
JButton cancelButton = new JButton("Cancel");
cancelButton.setActionCommand("Cancel");
cancelButton.addActionListener(this);
buttonPane.add(cancelButton);
}
}
}
| static void function(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException InstantiationException IllegalAccessException UnsupportedLookAndFeelException e1) { } try { TilesetLoadDialog dialog = new TilesetLoadDialog(); TilesetManager manager = new TilesetManager(); TilesetGroupNode root = new TilesetGroupNode(STR); TilesetHandle h = new BasicTilesetHandle("Pipes", STR, 64, 64); root.addNode(new TilesetTileNode(h)); TilesetGroupNode group = new TilesetGroupNode("group"); h = new BasicTilesetHandle("Boxes", STR, 64, 64); group.addNode(new TilesetTileNode(h)); root.addNode(group); manager.setRoot(root); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.showDialog(manager); recursivePrint(manager.getRoot(), 0); } catch (Exception e) { e.printStackTrace(); } } public TilesetLoadDialog() { setModal(true); setBounds(100, 100, 609, 563); getContentPane().setLayout(new BorderLayout()); tilesetLoadPanel = new TilesetLoadPanel(); getContentPane().add(tilesetLoadPanel, BorderLayout.CENTER); { JPanel buttonPane = new JPanel(); buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); getContentPane().add(buttonPane, BorderLayout.SOUTH); { JButton okButton = new JButton("OK"); okButton.setActionCommand("OK"); okButton.addActionListener(this); buttonPane.add(okButton); } { JButton cancelButton = new JButton(STR); cancelButton.setActionCommand(STR); cancelButton.addActionListener(this); buttonPane.add(cancelButton); } } } | /**
* Launch the application.
*/ | Launch the application | main | {
"repo_name": "clearlyspam23/JAnGLE",
"path": "src/main/java/com/clearlyspam23/GLE/basic/layers/tile/gui/TilesetLoadDialog.java",
"license": "mit",
"size": 3991
} | [
"com.clearlyspam23.GLE",
"java.awt.BorderLayout",
"java.awt.FlowLayout",
"javax.swing.JButton",
"javax.swing.JDialog",
"javax.swing.JPanel",
"javax.swing.UIManager",
"javax.swing.UnsupportedLookAndFeelException"
] | import com.clearlyspam23.GLE; import java.awt.BorderLayout; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; | import com.clearlyspam23.*; import java.awt.*; import javax.swing.*; | [
"com.clearlyspam23",
"java.awt",
"javax.swing"
] | com.clearlyspam23; java.awt; javax.swing; | 675,027 |
public void setZoom(TouchImageView img) {
PointF center = img.getScrollPosition();
setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType());
} | void function(TouchImageView img) { PointF center = img.getScrollPosition(); setZoom(img.getCurrentZoom(), center.x, center.y, img.getScaleType()); } | /**
* Set zoom parameters equal to another TouchImageView. Including scale, position,
* and ScaleType.
*
* @param img the img
*/ | Set zoom parameters equal to another TouchImageView. Including scale, position, and ScaleType | setZoom | {
"repo_name": "lanhuaguizha/Christian",
"path": "app/src/main/kotlin/ren/qinc/markdowneditors/lib/TouchImageView.java",
"license": "gpl-3.0",
"size": 42833
} | [
"android.graphics.PointF"
] | import android.graphics.PointF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,765,696 |
public CacheService getCacheService() {
return cacheService;
} | CacheService function() { return cacheService; } | /**
* Returns the cache layer
*
* @return cacheService
*/ | Returns the cache layer | getCacheService | {
"repo_name": "afilias-technologies/deviceatlas-cloud-java",
"path": "deviceatlas-cloud-java-client/src/main/java/com/deviceatlas/cloud/deviceidentification/client/Client.java",
"license": "mit",
"size": 27594
} | [
"com.deviceatlas.cloud.deviceidentification.service.CacheService"
] | import com.deviceatlas.cloud.deviceidentification.service.CacheService; | import com.deviceatlas.cloud.deviceidentification.service.*; | [
"com.deviceatlas.cloud"
] | com.deviceatlas.cloud; | 2,308,147 |
IFile getFile(String path, IFile.Flags flags) throws IOException; | IFile getFile(String path, IFile.Flags flags) throws IOException; | /**
* Retrieve an IFile with the specified flags.
*
* @param flags IFile.READONLY, IFile.READWRITE, IFile.READVOLATILE, IFile.NOCACHE
*
* @since 1.0
*/ | Retrieve an IFile with the specified flags | getFile | {
"repo_name": "joval/jSAF",
"path": "src/jsaf/intf/io/IFilesystem.java",
"license": "lgpl-2.1",
"size": 9487
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,257,061 |
@Test public void testProject() {
final String sql = "select \"product_name\", 0 as zero\n"
+ "from \"foodmart\"\n"
+ "order by \"product_name\"";
final String explain = "PLAN=EnumerableInterpreter\n"
+ " BindableSort(sort0=[$0], dir0=[ASC])\n"
+ " DruidQuery(table=[[foodmart, foodmart]], "
+ "intervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], projects=[[$3, 0]])";
sql(sql)
.limit(2)
.returnsUnordered("product_name=ADJ Rosy Sunglasses; ZERO=0",
"product_name=ADJ Rosy Sunglasses; ZERO=0")
.explainContains(explain);
} | @Test void function() { final String sql = STRproduct_name\STR + STRfoodmart\"\n" + STRproduct_name\STRPLAN=EnumerableInterpreter\nSTR BindableSort(sort0=[$0], dir0=[ASC])\nSTR DruidQuery(table=[[foodmart, foodmart]], STRintervals=[[1900-01-09T00:00:00.000Z/2992-01-10T00:00:00.000Z]], projects=[[$3, 0]])STRproduct_name=ADJ Rosy Sunglasses; ZERO=0STRproduct_name=ADJ Rosy Sunglasses; ZERO=0") .explainContains(explain); } | /** Tests that projections of columns are pushed into the DruidQuery, and
* projections of expressions that Druid cannot handle (in this case, a
* literal 0) stay up. */ | Tests that projections of columns are pushed into the DruidQuery, and projections of expressions that Druid cannot handle (in this case, a | testProject | {
"repo_name": "dindin5258/calcite",
"path": "druid/src/test/java/org/apache/calcite/test/DruidAdapterIT.java",
"license": "apache-2.0",
"size": 236571
} | [
"org.apache.calcite.adapter.druid.DruidQuery",
"org.junit.Test"
] | import org.apache.calcite.adapter.druid.DruidQuery; import org.junit.Test; | import org.apache.calcite.adapter.druid.*; import org.junit.*; | [
"org.apache.calcite",
"org.junit"
] | org.apache.calcite; org.junit; | 2,774,276 |
public void addMessageType(Message mes) {
if (!hexPar.addConvertMessageListener(this, mes)) {
// Id is already Used by another AmType
String str = JOptionPane.showInputDialog(null, "You can choose a differen AMType id for this Template : "
+ mes.getClass().getName() + "\n enter new ID: ", "AMTYPE already used by Template", 1);
while (!hexPar.AMTypeFree(Integer.parseInt(str))) {
str = JOptionPane.showInputDialog(null, "You can choose a differen AMType id for this Template : "
+ mes.getClass().getName() + "\n enter new ID: ", "AMTYPE already used by Template", 1);
}
hexPar.addConvertMessageListener(this, mes, Integer.parseInt(str));
} else {
hexPar.addConvertMessageListener(this, mes);
}
}
| void function(Message mes) { if (!hexPar.addConvertMessageListener(this, mes)) { String str = JOptionPane.showInputDialog(null, STR + mes.getClass().getName() + STR, STR, 1); while (!hexPar.AMTypeFree(Integer.parseInt(str))) { str = JOptionPane.showInputDialog(null, STR + mes.getClass().getName() + STR, STR, 1); } hexPar.addConvertMessageListener(this, mes, Integer.parseInt(str)); } else { hexPar.addConvertMessageListener(this, mes); } } | /**
* adds a message Template to the hexParser, if the AmType Id is already
* used, we ask for a new One
*/ | adds a message Template to the hexParser, if the AmType Id is already used, we ask for a new One | addMessageType | {
"repo_name": "wsntools/iris",
"path": "iris/src/main/java/com/wsntools/iris/packageDecode/parser/PackageDecoder.java",
"license": "mpl-2.0",
"size": 6390
} | [
"javax.swing.JOptionPane",
"net.tinyos.message.Message"
] | import javax.swing.JOptionPane; import net.tinyos.message.Message; | import javax.swing.*; import net.tinyos.message.*; | [
"javax.swing",
"net.tinyos.message"
] | javax.swing; net.tinyos.message; | 729,401 |
public static void pullInClinicalStatement(
Object source,
Object target,
String subjectPersonId,
String focalPersonId,
FactLists factLists
) throws ImproperUsageException, DataFormatException, InvalidDataException {
String _METHODNAME = "pullIn(): ";
if (source == null) {
String errStr = _METHODNAME + "improper usage: source supplied is null";
logger.error(errStr);
throw new ImproperUsageException(errStr);
}
if (target == null) {
String errStr = _METHODNAME + "improper usage: target supplied is null";
logger.error(errStr);
throw new ImproperUsageException(errStr);
}
if ("AdverseEvent".equals(source.getClass().getSimpleName())) {
AdverseEventMapper.pullIn((org.opencds.vmr.v1_0.schema.AdverseEvent)source, (AdverseEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("DeniedAdverseEvent".equals(source.getClass().getSimpleName())) {
DeniedAdverseEventMapper.pullIn((org.opencds.vmr.v1_0.schema.DeniedAdverseEvent)source, (DeniedAdverseEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("AppointmentProposal".equals(source.getClass().getSimpleName())) {
AppointmentProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.AppointmentProposal)source, (AppointmentProposal)target, subjectPersonId, focalPersonId, factLists);
} else if ("AppointmentRequest".equals(source.getClass().getSimpleName())) {
AppointmentRequestMapper.pullIn((org.opencds.vmr.v1_0.schema.AppointmentRequest)source, (AppointmentRequest)target, subjectPersonId, focalPersonId, factLists);
} else if ("EncounterEvent".equals(source.getClass().getSimpleName())) {
EncounterEventMapper.pullIn((org.opencds.vmr.v1_0.schema.EncounterEvent)source, (EncounterEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("MissedAppointment".equals(source.getClass().getSimpleName())) {
MissedAppointmentMapper.pullIn((org.opencds.vmr.v1_0.schema.MissedAppointment)source, (MissedAppointment)target, subjectPersonId, focalPersonId, factLists);
} else if ("ScheduledAppointment".equals(source.getClass().getSimpleName())) {
ScheduledAppointmentMapper.pullIn((org.opencds.vmr.v1_0.schema.ScheduledAppointment)source, (ScheduledAppointment)target, subjectPersonId, focalPersonId, factLists);
} else if ("Goal".equals(source.getClass().getSimpleName())) {
GoalMapper.pullIn((org.opencds.vmr.v1_0.schema.Goal)source, (Goal)target, subjectPersonId, focalPersonId, factLists);
} else if ("GoalProposal".equals(source.getClass().getSimpleName())) {
GoalProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.GoalProposal)source, (GoalProposal)target, subjectPersonId, focalPersonId, factLists);
} else if ("ObservationOrder".equals(source.getClass().getSimpleName())) {
ObservationOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.ObservationOrder)source, (ObservationOrder)target, subjectPersonId, focalPersonId, factLists);
} else if ("ObservationProposal".equals(source.getClass().getSimpleName())) {
ObservationProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.ObservationProposal)source, (ObservationProposal)target, subjectPersonId, focalPersonId, factLists);
} else if ("ObservationResult".equals(source.getClass().getSimpleName())) {
ObservationResultMapper.pullIn((org.opencds.vmr.v1_0.schema.ObservationResult)source, (ObservationResult)target, subjectPersonId, focalPersonId, factLists);
} else if ("UnconductedObservation".equals(source.getClass().getSimpleName())) {
UnconductedObservationMapper.pullIn((org.opencds.vmr.v1_0.schema.UnconductedObservation)source, (UnconductedObservation)target, subjectPersonId, focalPersonId, factLists);
} else if ("DeniedProblem".equals(source.getClass().getSimpleName())) {
DeniedProblemMapper.pullIn((org.opencds.vmr.v1_0.schema.DeniedProblem)source, (DeniedProblem)target, subjectPersonId, focalPersonId, factLists);
} else if ("Problem".equals(source.getClass().getSimpleName())) {
ProblemMapper.pullIn((org.opencds.vmr.v1_0.schema.Problem)source, (Problem)target, subjectPersonId, focalPersonId, factLists);
} else if ("ProcedureEvent".equals(source.getClass().getSimpleName())) {
ProcedureEventMapper.pullIn((org.opencds.vmr.v1_0.schema.ProcedureEvent)source, (ProcedureEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("ProcedureOrder".equals(source.getClass().getSimpleName())) {
ProcedureOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.ProcedureOrder)source, (ProcedureOrder)target, subjectPersonId, focalPersonId, factLists);
} else if ("ProcedureProposal".equals(source.getClass().getSimpleName())) {
ProcedureProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.ProcedureProposal)source, (ProcedureProposal)target, subjectPersonId, focalPersonId, factLists);
} else if ("ScheduledProcedure".equals(source.getClass().getSimpleName())) {
ScheduledProcedureMapper.pullIn((org.opencds.vmr.v1_0.schema.ScheduledProcedure)source, (ScheduledProcedure)target, subjectPersonId, focalPersonId, factLists);
} else if ("UndeliveredProcedure".equals(source.getClass().getSimpleName())) {
UndeliveredProcedureMapper.pullIn((org.opencds.vmr.v1_0.schema.UndeliveredProcedure)source, (UndeliveredProcedure)target, subjectPersonId, focalPersonId, factLists);
} else if ("SubstanceAdministrationEvent".equals(source.getClass().getSimpleName())) {
SubstanceAdministrationEventMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceAdministrationEvent)source, (SubstanceAdministrationEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("SubstanceAdministrationOrder".equals(source.getClass().getSimpleName())) {
SubstanceAdministrationOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceAdministrationOrder)source, (SubstanceAdministrationOrder)target, subjectPersonId, focalPersonId, factLists);
} else if ("SubstanceAdministrationProposal".equals(source.getClass().getSimpleName())) {
SubstanceAdministrationProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceAdministrationProposal)source, (SubstanceAdministrationProposal)target, subjectPersonId, focalPersonId, factLists);
} else if ("SubstanceDispensationEvent".equals(source.getClass().getSimpleName())) {
SubstanceDispensationEventMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceDispensationEvent)source, (SubstanceDispensationEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("UndeliveredSubstanceAdministration".equals(source.getClass().getSimpleName())) {
UndeliveredSubstanceAdministrationMapper.pullIn((org.opencds.vmr.v1_0.schema.UndeliveredSubstanceAdministration)source, (UndeliveredSubstanceAdministration)target, subjectPersonId, focalPersonId, factLists);
} else if ("SupplyEvent".equals(source.getClass().getSimpleName())) {
SupplyEventMapper.pullIn((org.opencds.vmr.v1_0.schema.SupplyEvent)source, (SupplyEvent)target, subjectPersonId, focalPersonId, factLists);
} else if ("SupplyOrder".equals(source.getClass().getSimpleName())) {
SupplyOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.SupplyOrder)source, (SupplyOrder)target, subjectPersonId, focalPersonId, factLists);
} else if ("SupplyProposal".equals(source.getClass().getSimpleName())) {
SupplyProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.SupplyProposal)source, (SupplyProposal)target, subjectPersonId, focalPersonId, factLists);
} else if ("UndeliveredSupply".equals(source.getClass().getSimpleName())) {
UndeliveredSupplyMapper.pullIn((org.opencds.vmr.v1_0.schema.UndeliveredSupply)source, (UndeliveredSupply)target, subjectPersonId, focalPersonId, factLists);
} else {
throw new ImproperUsageException("OneObjectMapper failed to pullInRelatedClinicalStatement for: " + source.getClass().getSimpleName());
}
}
| static void function( Object source, Object target, String subjectPersonId, String focalPersonId, FactLists factLists ) throws ImproperUsageException, DataFormatException, InvalidDataException { String _METHODNAME = STR; if (source == null) { String errStr = _METHODNAME + STR; logger.error(errStr); throw new ImproperUsageException(errStr); } if (target == null) { String errStr = _METHODNAME + STR; logger.error(errStr); throw new ImproperUsageException(errStr); } if (STR.equals(source.getClass().getSimpleName())) { AdverseEventMapper.pullIn((org.opencds.vmr.v1_0.schema.AdverseEvent)source, (AdverseEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { DeniedAdverseEventMapper.pullIn((org.opencds.vmr.v1_0.schema.DeniedAdverseEvent)source, (DeniedAdverseEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { AppointmentProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.AppointmentProposal)source, (AppointmentProposal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { AppointmentRequestMapper.pullIn((org.opencds.vmr.v1_0.schema.AppointmentRequest)source, (AppointmentRequest)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { EncounterEventMapper.pullIn((org.opencds.vmr.v1_0.schema.EncounterEvent)source, (EncounterEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { MissedAppointmentMapper.pullIn((org.opencds.vmr.v1_0.schema.MissedAppointment)source, (MissedAppointment)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ScheduledAppointmentMapper.pullIn((org.opencds.vmr.v1_0.schema.ScheduledAppointment)source, (ScheduledAppointment)target, subjectPersonId, focalPersonId, factLists); } else if ("Goal".equals(source.getClass().getSimpleName())) { GoalMapper.pullIn((org.opencds.vmr.v1_0.schema.Goal)source, (Goal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { GoalProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.GoalProposal)source, (GoalProposal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ObservationOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.ObservationOrder)source, (ObservationOrder)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ObservationProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.ObservationProposal)source, (ObservationProposal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ObservationResultMapper.pullIn((org.opencds.vmr.v1_0.schema.ObservationResult)source, (ObservationResult)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { UnconductedObservationMapper.pullIn((org.opencds.vmr.v1_0.schema.UnconductedObservation)source, (UnconductedObservation)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { DeniedProblemMapper.pullIn((org.opencds.vmr.v1_0.schema.DeniedProblem)source, (DeniedProblem)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ProblemMapper.pullIn((org.opencds.vmr.v1_0.schema.Problem)source, (Problem)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ProcedureEventMapper.pullIn((org.opencds.vmr.v1_0.schema.ProcedureEvent)source, (ProcedureEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ProcedureOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.ProcedureOrder)source, (ProcedureOrder)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ProcedureProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.ProcedureProposal)source, (ProcedureProposal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { ScheduledProcedureMapper.pullIn((org.opencds.vmr.v1_0.schema.ScheduledProcedure)source, (ScheduledProcedure)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { UndeliveredProcedureMapper.pullIn((org.opencds.vmr.v1_0.schema.UndeliveredProcedure)source, (UndeliveredProcedure)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SubstanceAdministrationEventMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceAdministrationEvent)source, (SubstanceAdministrationEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SubstanceAdministrationOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceAdministrationOrder)source, (SubstanceAdministrationOrder)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SubstanceAdministrationProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceAdministrationProposal)source, (SubstanceAdministrationProposal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SubstanceDispensationEventMapper.pullIn((org.opencds.vmr.v1_0.schema.SubstanceDispensationEvent)source, (SubstanceDispensationEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { UndeliveredSubstanceAdministrationMapper.pullIn((org.opencds.vmr.v1_0.schema.UndeliveredSubstanceAdministration)source, (UndeliveredSubstanceAdministration)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SupplyEventMapper.pullIn((org.opencds.vmr.v1_0.schema.SupplyEvent)source, (SupplyEvent)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SupplyOrderMapper.pullIn((org.opencds.vmr.v1_0.schema.SupplyOrder)source, (SupplyOrder)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { SupplyProposalMapper.pullIn((org.opencds.vmr.v1_0.schema.SupplyProposal)source, (SupplyProposal)target, subjectPersonId, focalPersonId, factLists); } else if (STR.equals(source.getClass().getSimpleName())) { UndeliveredSupplyMapper.pullIn((org.opencds.vmr.v1_0.schema.UndeliveredSupply)source, (UndeliveredSupply)target, subjectPersonId, focalPersonId, factLists); } else { throw new ImproperUsageException(STR + source.getClass().getSimpleName()); } } | /**
* Populate internal vMR object from corresponding external vMR object;
*
* @param source external vMR object (an extension of the schema ClinicalStatement class)
* @param target internal vMR object to be populated (a descendent of ClinicalStatement)
* @param subjectPersonId
* @param focalPersonId
* @param factLists
* @throws ImproperUsageException
* @throws DataFormatException
* @throws InvalidDataException
*/ | Populate internal vMR object from corresponding external vMR object | pullInClinicalStatement | {
"repo_name": "TonyWang-UMU/TFG-TWang",
"path": "opencds-parent/opencds-vmr-1_0/opencds-vmr-1_0-mappings/src/main/java/org/opencds/vmr/v1_0/mappings/mappers/OneObjectMapper.java",
"license": "apache-2.0",
"size": 69426
} | [
"org.opencds.common.exceptions.DataFormatException",
"org.opencds.common.exceptions.ImproperUsageException",
"org.opencds.common.exceptions.InvalidDataException",
"org.opencds.vmr.v1_0.internal.AdverseEvent",
"org.opencds.vmr.v1_0.internal.AppointmentProposal",
"org.opencds.vmr.v1_0.internal.AppointmentRequest",
"org.opencds.vmr.v1_0.internal.DeniedAdverseEvent",
"org.opencds.vmr.v1_0.internal.DeniedProblem",
"org.opencds.vmr.v1_0.internal.EncounterEvent",
"org.opencds.vmr.v1_0.internal.Goal",
"org.opencds.vmr.v1_0.internal.GoalProposal",
"org.opencds.vmr.v1_0.internal.MissedAppointment",
"org.opencds.vmr.v1_0.internal.ObservationOrder",
"org.opencds.vmr.v1_0.internal.ObservationProposal",
"org.opencds.vmr.v1_0.internal.ObservationResult",
"org.opencds.vmr.v1_0.internal.Problem",
"org.opencds.vmr.v1_0.internal.ProcedureEvent",
"org.opencds.vmr.v1_0.internal.ProcedureOrder",
"org.opencds.vmr.v1_0.internal.ProcedureProposal",
"org.opencds.vmr.v1_0.internal.ScheduledAppointment",
"org.opencds.vmr.v1_0.internal.ScheduledProcedure",
"org.opencds.vmr.v1_0.internal.SubstanceAdministrationEvent",
"org.opencds.vmr.v1_0.internal.SubstanceAdministrationOrder",
"org.opencds.vmr.v1_0.internal.SubstanceAdministrationProposal",
"org.opencds.vmr.v1_0.internal.SubstanceDispensationEvent",
"org.opencds.vmr.v1_0.internal.SupplyEvent",
"org.opencds.vmr.v1_0.internal.SupplyOrder",
"org.opencds.vmr.v1_0.internal.SupplyProposal",
"org.opencds.vmr.v1_0.internal.UnconductedObservation",
"org.opencds.vmr.v1_0.internal.UndeliveredProcedure",
"org.opencds.vmr.v1_0.internal.UndeliveredSubstanceAdministration",
"org.opencds.vmr.v1_0.internal.UndeliveredSupply",
"org.opencds.vmr.v1_0.mappings.in.FactLists"
] | import org.opencds.common.exceptions.DataFormatException; import org.opencds.common.exceptions.ImproperUsageException; import org.opencds.common.exceptions.InvalidDataException; import org.opencds.vmr.v1_0.internal.AdverseEvent; import org.opencds.vmr.v1_0.internal.AppointmentProposal; import org.opencds.vmr.v1_0.internal.AppointmentRequest; import org.opencds.vmr.v1_0.internal.DeniedAdverseEvent; import org.opencds.vmr.v1_0.internal.DeniedProblem; import org.opencds.vmr.v1_0.internal.EncounterEvent; import org.opencds.vmr.v1_0.internal.Goal; import org.opencds.vmr.v1_0.internal.GoalProposal; import org.opencds.vmr.v1_0.internal.MissedAppointment; import org.opencds.vmr.v1_0.internal.ObservationOrder; import org.opencds.vmr.v1_0.internal.ObservationProposal; import org.opencds.vmr.v1_0.internal.ObservationResult; import org.opencds.vmr.v1_0.internal.Problem; import org.opencds.vmr.v1_0.internal.ProcedureEvent; import org.opencds.vmr.v1_0.internal.ProcedureOrder; import org.opencds.vmr.v1_0.internal.ProcedureProposal; import org.opencds.vmr.v1_0.internal.ScheduledAppointment; import org.opencds.vmr.v1_0.internal.ScheduledProcedure; import org.opencds.vmr.v1_0.internal.SubstanceAdministrationEvent; import org.opencds.vmr.v1_0.internal.SubstanceAdministrationOrder; import org.opencds.vmr.v1_0.internal.SubstanceAdministrationProposal; import org.opencds.vmr.v1_0.internal.SubstanceDispensationEvent; import org.opencds.vmr.v1_0.internal.SupplyEvent; import org.opencds.vmr.v1_0.internal.SupplyOrder; import org.opencds.vmr.v1_0.internal.SupplyProposal; import org.opencds.vmr.v1_0.internal.UnconductedObservation; import org.opencds.vmr.v1_0.internal.UndeliveredProcedure; import org.opencds.vmr.v1_0.internal.UndeliveredSubstanceAdministration; import org.opencds.vmr.v1_0.internal.UndeliveredSupply; import org.opencds.vmr.v1_0.mappings.in.FactLists; | import org.opencds.common.exceptions.*; import org.opencds.vmr.v1_0.internal.*; import org.opencds.vmr.v1_0.mappings.in.*; | [
"org.opencds.common",
"org.opencds.vmr"
] | org.opencds.common; org.opencds.vmr; | 1,883,559 |
public ConcurrentHashMap<String,ArrayList> getMemoryGroups() {
return(memoryGroups);
} | ConcurrentHashMap<String,ArrayList> function() { return(memoryGroups); } | /**
* Returns the full HashMap which for every memory group Name it is associated a list of codeletGroups
*
* @return the HashMap with all pairs (groupname,list of codeletGroups belonging to groupname)
*/ | Returns the full HashMap which for every memory group Name it is associated a list of codeletGroups | getMemoryGroups | {
"repo_name": "rgudwin/cst",
"path": "src/main/java/br/unicamp/cst/core/entities/Mind.java",
"license": "lgpl-3.0",
"size": 8252
} | [
"java.util.ArrayList",
"java.util.concurrent.ConcurrentHashMap"
] | import java.util.ArrayList; import java.util.concurrent.ConcurrentHashMap; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,278,232 |
public boolean pause() {
resetSyncParams();
if (stopTimestampUs == C.TIME_UNSET) {
// The audio track is going to be paused, so reset the timestamp poller to ensure it doesn't
// supply an advancing position.
Assertions.checkNotNull(audioTimestampPoller).reset();
return true;
}
// We've handled the end of the stream already, so there's no need to pause the track.
return false;
} | boolean function() { resetSyncParams(); if (stopTimestampUs == C.TIME_UNSET) { Assertions.checkNotNull(audioTimestampPoller).reset(); return true; } return false; } | /**
* Pauses the audio track position tracker, returning whether the audio track needs to be paused
* to cause playback to pause. If {@code false} is returned the audio track will pause without
* further interaction, as the end of stream has been handled.
*/ | Pauses the audio track position tracker, returning whether the audio track needs to be paused to cause playback to pause. If false is returned the audio track will pause without further interaction, as the end of stream has been handled | pause | {
"repo_name": "tkpb/Telegram",
"path": "TMessagesProj/src/main/java/com/google/android/exoplayer2/audio/AudioTrackPositionTracker.java",
"license": "gpl-2.0",
"size": 24065
} | [
"com.google.android.exoplayer2.util.Assertions"
] | import com.google.android.exoplayer2.util.Assertions; | import com.google.android.exoplayer2.util.*; | [
"com.google.android"
] | com.google.android; | 750,172 |
private void blockAndCheckIfStopped(ZooKeeperNodeTracker tracker)
throws IOException, InterruptedException {
while (tracker.blockUntilAvailable(this.msgInterval, false) == null) {
if (this.stopped) {
throw new IOException("Received the shutdown message while waiting.");
}
}
} | void function(ZooKeeperNodeTracker tracker) throws IOException, InterruptedException { while (tracker.blockUntilAvailable(this.msgInterval, false) == null) { if (this.stopped) { throw new IOException(STR); } } } | /**
* Utilty method to wait indefinitely on a znode availability while checking
* if the region server is shut down
* @param tracker znode tracker to use
* @throws IOException any IO exception, plus if the RS is stopped
* @throws InterruptedException
*/ | Utilty method to wait indefinitely on a znode availability while checking if the region server is shut down | blockAndCheckIfStopped | {
"repo_name": "matteobertozzi/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java",
"license": "apache-2.0",
"size": 151789
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker"
] | import java.io.IOException; import org.apache.hadoop.hbase.zookeeper.ZooKeeperNodeTracker; | import java.io.*; import org.apache.hadoop.hbase.zookeeper.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,571,666 |
public void setConstraint(Constraint<?, T> constraint) {
iConstraint = constraint;
} | void function(Constraint<?, T> constraint) { iConstraint = constraint; } | /** Sets constraint
* @param constraint a constraint
**/ | Sets constraint | setConstraint | {
"repo_name": "UniTime/cpsolver",
"path": "src/org/cpsolver/ifs/extension/AssignedValueSet.java",
"license": "lgpl-3.0",
"size": 8347
} | [
"org.cpsolver.ifs.model.Constraint"
] | import org.cpsolver.ifs.model.Constraint; | import org.cpsolver.ifs.model.*; | [
"org.cpsolver.ifs"
] | org.cpsolver.ifs; | 1,475,091 |
void insertRow(int row)
{
// Adjust any merged cells
SheetRangeImpl sr = null;
Iterator i = ranges.iterator();
while (i.hasNext())
{
sr = (SheetRangeImpl) i.next();
sr.insertRow(row);
}
} | void insertRow(int row) { SheetRangeImpl sr = null; Iterator i = ranges.iterator(); while (i.hasNext()) { sr = (SheetRangeImpl) i.next(); sr.insertRow(row); } } | /**
* Used to adjust the merged cells following a row insertion
*/ | Used to adjust the merged cells following a row insertion | insertRow | {
"repo_name": "miraculix0815/jexcelapi",
"path": "src/jxl/write/biff/MergedCells.java",
"license": "lgpl-3.0",
"size": 7807
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,779,942 |
@ApiModelProperty(example = "/subscriptions?limit=1&offset=0&apiId=01234567-0123-0123-0123-012345678901&groupId=", value = "Link to the previous subset of resources qualified. Empty if current subset is the first subset returned. ")
public String getPrevious() {
return previous;
} | @ApiModelProperty(example = STR, value = STR) String function() { return previous; } | /**
* Link to the previous subset of resources qualified. Empty if current subset is the first subset returned.
* @return previous
**/ | Link to the previous subset of resources qualified. Empty if current subset is the first subset returned | getPrevious | {
"repo_name": "abimarank/product-apim",
"path": "integration-tests/src/main/java/org/wso2/carbon/apimgt/rest/integration/tests/model/SubscriptionList.java",
"license": "apache-2.0",
"size": 4883
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,426,622 |
@Source("com/google/appinventor/images/lists.png")
ImageResource lists(); | @Source(STR) ImageResource lists(); | /**
* Built in drawer item: lists
*/ | Built in drawer item: lists | lists | {
"repo_name": "jisqyv/appinventor-sources",
"path": "appinventor/appengine/src/com/google/appinventor/client/Images.java",
"license": "apache-2.0",
"size": 19490
} | [
"com.google.gwt.resources.client.ImageResource"
] | import com.google.gwt.resources.client.ImageResource; | import com.google.gwt.resources.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,697,645 |
public static HRegion openHRegion(final HRegionInfo info,
final TableDescriptor htd, final WAL wal, final Configuration conf,
final RegionServerServices rsServices,
final CancelableProgressable reporter)
throws IOException {
return openHRegion(FSUtils.getRootDir(conf), info, htd, wal, conf, rsServices, reporter);
} | static HRegion function(final HRegionInfo info, final TableDescriptor htd, final WAL wal, final Configuration conf, final RegionServerServices rsServices, final CancelableProgressable reporter) throws IOException { return openHRegion(FSUtils.getRootDir(conf), info, htd, wal, conf, rsServices, reporter); } | /**
* Open a Region.
* @param info Info for region to be opened
* @param htd the table descriptor
* @param wal WAL for region to use. This method will call
* WAL#setSequenceNumber(long) passing the result of the call to
* HRegion#getMinSequenceId() to ensure the wal id is properly kept
* up. HRegionStore does this every time it opens a new region.
* @param conf The Configuration object to use.
* @param rsServices An interface we can request flushes against.
* @param reporter An interface we can report progress against.
* @return new HRegion
*
* @throws IOException
*/ | Open a Region | openHRegion | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 328407
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.client.TableDescriptor",
"org.apache.hadoop.hbase.util.CancelableProgressable",
"org.apache.hadoop.hbase.util.FSUtils"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.hadoop.hbase.util.CancelableProgressable; import org.apache.hadoop.hbase.util.FSUtils; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,503,274 |
public static LocalStreamEnvironment createLocalEnvironment(int parallelism, Configuration configuration) {
LocalStreamEnvironment currentEnvironment = new LocalStreamEnvironment(configuration);
currentEnvironment.setParallelism(parallelism);
return currentEnvironment;
} | static LocalStreamEnvironment function(int parallelism, Configuration configuration) { LocalStreamEnvironment currentEnvironment = new LocalStreamEnvironment(configuration); currentEnvironment.setParallelism(parallelism); return currentEnvironment; } | /**
* Creates a {@link LocalStreamEnvironment}. The local execution environment
* will run the program in a multi-threaded fashion in the same JVM as the
* environment was created in. It will use the parallelism specified in the
* parameter.
*
* @param parallelism
* The parallelism for the local environment.
* @param configuration
* Pass a custom configuration into the cluster
* @return A local execution environment with the specified parallelism.
*/ | Creates a <code>LocalStreamEnvironment</code>. The local execution environment will run the program in a multi-threaded fashion in the same JVM as the environment was created in. It will use the parallelism specified in the parameter | createLocalEnvironment | {
"repo_name": "zimmermatt/flink",
"path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java",
"license": "apache-2.0",
"size": 79024
} | [
"org.apache.flink.configuration.Configuration"
] | import org.apache.flink.configuration.Configuration; | import org.apache.flink.configuration.*; | [
"org.apache.flink"
] | org.apache.flink; | 528,522 |
void setTerminalSize(int columns, int rows) throws IOException; | void setTerminalSize(int columns, int rows) throws IOException; | /**
* Attempts to resize the terminal through dtterm extensions "CSI 8 ; rows ; columns ; t". This isn't widely
* supported, which is why the method is not exposed through the common Terminal interface.
* @param columns New size (columns)
* @param rows New size (rows)
* @throws java.io.IOException If the was an underlying I/O error
*/ | Attempts to resize the terminal through dtterm extensions "CSI 8 ; rows ; columns ; t". This isn't widely supported, which is why the method is not exposed through the common Terminal interface | setTerminalSize | {
"repo_name": "mabe02/lanterna",
"path": "src/main/java/com/googlecode/lanterna/terminal/ExtendedTerminal.java",
"license": "lgpl-3.0",
"size": 4447
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,713,933 |
public Section getSectionForPosition(int position) {
int currentPos = 0;
for (Map.Entry<String, Section> entry : sections.entrySet()) {
Section section = entry.getValue();
// ignore invisible sections
if (!section.isVisible()) continue;
int sectionTotal = section.getSectionItemsTotal();
// check if position is in this section
if (position >= currentPos && position <= (currentPos + sectionTotal - 1)) {
return section;
}
currentPos += sectionTotal;
}
throw new IndexOutOfBoundsException("Invalid position");
} | Section function(int position) { int currentPos = 0; for (Map.Entry<String, Section> entry : sections.entrySet()) { Section section = entry.getValue(); if (!section.isVisible()) continue; int sectionTotal = section.getSectionItemsTotal(); if (position >= currentPos && position <= (currentPos + sectionTotal - 1)) { return section; } currentPos += sectionTotal; } throw new IndexOutOfBoundsException(STR); } | /**
* Returns the Section object for a position in the adapter
* @param position position in the adapter
* @return Section object for that position
*/ | Returns the Section object for a position in the adapter | getSectionForPosition | {
"repo_name": "apowell656/SectionedRecyclerViewAdapter",
"path": "library/src/main/java/io/github/luizgrp/sectionedrecyclerviewadapter/SectionedRecyclerViewAdapter.java",
"license": "mit",
"size": 12251
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 919,095 |
public void applyUpdatesOnRecovery(
@Nullable WALIterator it,
IgniteBiPredicate<WALPointer, WALRecord> recPredicate,
IgnitePredicate<DataEntry> entryPredicate
) throws IgniteCheckedException {
if (it == null)
return;
cctx.walState().runWithOutWAL(() -> {
while (it.hasNext()) {
IgniteBiTuple<WALPointer, WALRecord> next = it.next();
WALRecord rec = next.get2();
if (!recPredicate.apply(next.get1(), rec))
break;
switch (rec.type()) {
case MVCC_DATA_RECORD:
case DATA_RECORD:
checkpointReadLock();
try {
DataRecord dataRec = (DataRecord)rec;
for (DataEntry dataEntry : dataRec.writeEntries()) {
if (entryPredicate.apply(dataEntry)) {
checkpointReadLock();
try {
int cacheId = dataEntry.cacheId();
GridCacheContext cacheCtx = cctx.cacheContext(cacheId);
if (cacheCtx != null)
applyUpdate(cacheCtx, dataEntry);
else if (log != null)
log.warning("Cache is not started. Updates cannot be applied " +
"[cacheId=" + cacheId + ']');
}
finally {
checkpointReadUnlock();
}
}
}
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
finally {
checkpointReadUnlock();
}
break;
case MVCC_TX_RECORD:
checkpointReadLock();
try {
MvccTxRecord txRecord = (MvccTxRecord)rec;
byte txState = convertToTxState(txRecord.state());
cctx.coordinators().updateState(txRecord.mvccVersion(), txState, true);
}
finally {
checkpointReadUnlock();
}
break;
default:
// Skip other records.
}
}
});
} | void function( @Nullable WALIterator it, IgniteBiPredicate<WALPointer, WALRecord> recPredicate, IgnitePredicate<DataEntry> entryPredicate ) throws IgniteCheckedException { if (it == null) return; cctx.walState().runWithOutWAL(() -> { while (it.hasNext()) { IgniteBiTuple<WALPointer, WALRecord> next = it.next(); WALRecord rec = next.get2(); if (!recPredicate.apply(next.get1(), rec)) break; switch (rec.type()) { case MVCC_DATA_RECORD: case DATA_RECORD: checkpointReadLock(); try { DataRecord dataRec = (DataRecord)rec; for (DataEntry dataEntry : dataRec.writeEntries()) { if (entryPredicate.apply(dataEntry)) { checkpointReadLock(); try { int cacheId = dataEntry.cacheId(); GridCacheContext cacheCtx = cctx.cacheContext(cacheId); if (cacheCtx != null) applyUpdate(cacheCtx, dataEntry); else if (log != null) log.warning(STR + STR + cacheId + ']'); } finally { checkpointReadUnlock(); } } } } catch (IgniteCheckedException e) { throw new IgniteException(e); } finally { checkpointReadUnlock(); } break; case MVCC_TX_RECORD: checkpointReadLock(); try { MvccTxRecord txRecord = (MvccTxRecord)rec; byte txState = convertToTxState(txRecord.state()); cctx.coordinators().updateState(txRecord.mvccVersion(), txState, true); } finally { checkpointReadUnlock(); } break; default: } } }); } | /**
* Apply update from some iterator and with specific filters.
*
* @param it WalIterator.
* @param recPredicate Wal record filter.
* @param entryPredicate Entry filter.
*/ | Apply update from some iterator and with specific filters | applyUpdatesOnRecovery | {
"repo_name": "ilantukh/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java",
"license": "apache-2.0",
"size": 208144
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.IgniteException",
"org.apache.ignite.internal.pagemem.wal.WALIterator",
"org.apache.ignite.internal.pagemem.wal.WALPointer",
"org.apache.ignite.internal.pagemem.wal.record.DataEntry",
"org.apache.ignite.internal.pagemem.wal.record.DataRecord",
"org.apache.ignite.internal.pagemem.wal.record.MvccTxRecord",
"org.apache.ignite.internal.pagemem.wal.record.WALRecord",
"org.apache.ignite.internal.processors.cache.GridCacheContext",
"org.apache.ignite.lang.IgniteBiPredicate",
"org.apache.ignite.lang.IgniteBiTuple",
"org.apache.ignite.lang.IgnitePredicate",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteException; import org.apache.ignite.internal.pagemem.wal.WALIterator; import org.apache.ignite.internal.pagemem.wal.WALPointer; import org.apache.ignite.internal.pagemem.wal.record.DataEntry; import org.apache.ignite.internal.pagemem.wal.record.DataRecord; import org.apache.ignite.internal.pagemem.wal.record.MvccTxRecord; import org.apache.ignite.internal.pagemem.wal.record.WALRecord; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.lang.IgniteBiPredicate; import org.apache.ignite.lang.IgniteBiTuple; import org.apache.ignite.lang.IgnitePredicate; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.*; import org.apache.ignite.internal.pagemem.wal.*; import org.apache.ignite.internal.pagemem.wal.record.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 1,961,129 |
Promise<Void> start(String id, StartActionDto action); | Promise<Void> start(String id, StartActionDto action); | /**
* Starts debug session when connection is established. Some debug server might not required this
* step.
*
* @param id debug session id
* @param action the start action parameters
*/ | Starts debug session when connection is established. Some debug server might not required this step | start | {
"repo_name": "sudaraka94/che",
"path": "ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/debug/DebuggerServiceClient.java",
"license": "epl-1.0",
"size": 4500
} | [
"org.eclipse.che.api.debug.shared.dto.action.StartActionDto",
"org.eclipse.che.api.promises.client.Promise"
] | import org.eclipse.che.api.debug.shared.dto.action.StartActionDto; import org.eclipse.che.api.promises.client.Promise; | import org.eclipse.che.api.debug.shared.dto.action.*; import org.eclipse.che.api.promises.client.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 2,907,173 |
void setWarningLevel(CompilerOptions options,
String name, CheckLevel level) {
DiagnosticGroup group = forName(name);
Preconditions.checkNotNull(group, "No warning class for name: %s", name);
options.setWarningLevel(group, level);
} | void setWarningLevel(CompilerOptions options, String name, CheckLevel level) { DiagnosticGroup group = forName(name); Preconditions.checkNotNull(group, STR, name); options.setWarningLevel(group, level); } | /**
* Adds warning levels by name.
*/ | Adds warning levels by name | setWarningLevel | {
"repo_name": "thurday/closure-compiler",
"path": "src/com/google/javascript/jscomp/DiagnosticGroups.java",
"license": "apache-2.0",
"size": 21507
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 241,400 |
public InputStream retrieve() throws IOException, SQLException,
AuthorizeException
{
// Maybe should return AuthorizeException??
AuthorizeManager.authorizeAction(bContext, this, Constants.READ);
return BitstreamStorageManager.retrieve(bContext, bRow
.getIntColumn("bitstream_id"));
} | InputStream function() throws IOException, SQLException, AuthorizeException { AuthorizeManager.authorizeAction(bContext, this, Constants.READ); return BitstreamStorageManager.retrieve(bContext, bRow .getIntColumn(STR)); } | /**
* Retrieve the contents of the bitstream
*
* @return a stream from which the bitstream can be read.
* @throws IOException
* @throws SQLException
* @throws AuthorizeException
*/ | Retrieve the contents of the bitstream | retrieve | {
"repo_name": "jamie-dryad/dryad-repo",
"path": "dspace-api/src/main/java/org/dspace/content/Bitstream.java",
"license": "bsd-3-clause",
"size": 21323
} | [
"java.io.IOException",
"java.io.InputStream",
"java.sql.SQLException",
"org.dspace.authorize.AuthorizeException",
"org.dspace.authorize.AuthorizeManager",
"org.dspace.core.Constants",
"org.dspace.storage.bitstore.BitstreamStorageManager"
] | import java.io.IOException; import java.io.InputStream; import java.sql.SQLException; import org.dspace.authorize.AuthorizeException; import org.dspace.authorize.AuthorizeManager; import org.dspace.core.Constants; import org.dspace.storage.bitstore.BitstreamStorageManager; | import java.io.*; import java.sql.*; import org.dspace.authorize.*; import org.dspace.core.*; import org.dspace.storage.bitstore.*; | [
"java.io",
"java.sql",
"org.dspace.authorize",
"org.dspace.core",
"org.dspace.storage"
] | java.io; java.sql; org.dspace.authorize; org.dspace.core; org.dspace.storage; | 1,010,705 |
@Test
public void getUrlEncodedWithPercent() throws Exception {
String unencoded = "/%";
final AtomicReference<String> path = new AtomicReference<String>();
handler = new RequestHandler() { | void function() throws Exception { String unencoded = "/%"; final AtomicReference<String> path = new AtomicReference<String>(); handler = new RequestHandler() { | /**
* Make a GET request with a URL that needs encoding
*
* @throws Exception
*/ | Make a GET request with a URL that needs encoding | getUrlEncodedWithPercent | {
"repo_name": "jiripetrlik/droolsjbpm-integration",
"path": "kie-remote/kie-remote-common/src/test/java/org/kie/remote/common/rest/KieRemoteHttpRequestTest.java",
"license": "apache-2.0",
"size": 77298
} | [
"java.util.concurrent.atomic.AtomicReference"
] | import java.util.concurrent.atomic.AtomicReference; | import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 1,765,875 |
public List<DescriptorMathTree> getMeasures() {
return Collections.unmodifiableList(measures);
} | List<DescriptorMathTree> function() { return Collections.unmodifiableList(measures); } | /**
* Gets a list of the defined measures.
*
* @return a list of the defined measures
*/ | Gets a list of the defined measures | getMeasures | {
"repo_name": "pmeisen/dis-timeintervaldataanalyzer",
"path": "src/net/meisen/dissertation/impl/parser/query/select/SelectQuery.java",
"license": "bsd-3-clause",
"size": 11838
} | [
"java.util.Collections",
"java.util.List",
"net.meisen.dissertation.impl.parser.query.select.measures.DescriptorMathTree"
] | import java.util.Collections; import java.util.List; import net.meisen.dissertation.impl.parser.query.select.measures.DescriptorMathTree; | import java.util.*; import net.meisen.dissertation.impl.parser.query.select.measures.*; | [
"java.util",
"net.meisen.dissertation"
] | java.util; net.meisen.dissertation; | 1,047,934 |
public void saveStick(File target) throws IOException {
ZipOutputStream zos = null;
try {
zos = new ZipOutputStream(new FileOutputStream(target));
LinkedList<String> stack = new LinkedList<String>();
zip(zos, path, stack);
} finally {
if(zos != null){
try {
zos.closeEntry();
zos.close();
} catch (IOException e) {}
}
}
} | void function(File target) throws IOException { ZipOutputStream zos = null; try { zos = new ZipOutputStream(new FileOutputStream(target)); LinkedList<String> stack = new LinkedList<String>(); zip(zos, path, stack); } finally { if(zos != null){ try { zos.closeEntry(); zos.close(); } catch (IOException e) {} } } } | /**
* saves the whole stick to zip file
* @param target the zip file to write to
* @throws IOException
*/ | saves the whole stick to zip file | saveStick | {
"repo_name": "Martin-Dames/Tingeltangel",
"path": "core/src/main/java/tingeltangel/core/BookiiStick.java",
"license": "gpl-2.0",
"size": 24165
} | [
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.util.LinkedList",
"java.util.zip.ZipOutputStream"
] | import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.LinkedList; import java.util.zip.ZipOutputStream; | import java.io.*; import java.util.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,485,076 |
public void deletePreviousConsent(Interview interview, String consentName); | void function(Interview interview, String consentName); | /**
* Marks the previous {@link Consent} of a specific interview (if exist) as deleted.
* @param interview Interview for which the consent will be retrieve.
*/ | Marks the previous <code>Consent</code> of a specific interview (if exist) as deleted | deletePreviousConsent | {
"repo_name": "obiba/onyx",
"path": "onyx-modules/onyx-marble/onyx-marble-core/src/main/java/org/obiba/onyx/marble/core/service/ConsentService.java",
"license": "gpl-3.0",
"size": 1982
} | [
"org.obiba.onyx.core.domain.participant.Interview"
] | import org.obiba.onyx.core.domain.participant.Interview; | import org.obiba.onyx.core.domain.participant.*; | [
"org.obiba.onyx"
] | org.obiba.onyx; | 330,175 |
@Override public void exitQuery(@NotNull LuceneSqlParser.QueryContext ctx) { } | @Override public void exitQuery(@NotNull LuceneSqlParser.QueryContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | enterQuery | {
"repo_name": "bbejeck/nosql-jdbc-driver",
"path": "src/main/java/bbejeck/nosql/antlr/generated/LuceneSqlBaseListener.java",
"license": "apache-2.0",
"size": 18266
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,893,667 |
public static Iterator<String[]> parseCsvDelimitedReader(final Reader reader)
throws IOException {
return parseDelimitedReader(reader, ',', DEFAULT_QUOTE);
} | static Iterator<String[]> function(final Reader reader) throws IOException { return parseDelimitedReader(reader, ',', DEFAULT_QUOTE); } | /**
* Return an Iterator over a comma/tab delimited file. Iterator.next() splits the current line
* and returns a String[] of the bits, stripped of all quotes.
* Lines beginning with # are ignored.
* @param reader the Reader to read from
* @return an Iterator over the lines of the Reader
* @throws IOException if there is an error while reading from the Reader
*/ | Return an Iterator over a comma/tab delimited file. Iterator.next() splits the current line and returns a String[] of the bits, stripped of all quotes. Lines beginning with # are ignored | parseCsvDelimitedReader | {
"repo_name": "joshkh/intermine",
"path": "intermine/objectstore/main/src/org/intermine/util/FormattedTextParser.java",
"license": "lgpl-2.1",
"size": 4958
} | [
"java.io.IOException",
"java.io.Reader",
"java.util.Iterator"
] | import java.io.IOException; import java.io.Reader; import java.util.Iterator; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,819,511 |
@ServiceMethod(returns = ReturnType.SINGLE)
DeploymentExtendedInner createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters); | @ServiceMethod(returns = ReturnType.SINGLE) DeploymentExtendedInner createOrUpdateAtTenantScope(String deploymentName, ScopedDeployment parameters); | /**
* You can provide the template and parameters directly in the request or link to JSON files.
*
* @param deploymentName The name of the deployment.
* @param parameters Additional parameters supplied to the operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return deployment information.
*/ | You can provide the template and parameters directly in the request or link to JSON files | createOrUpdateAtTenantScope | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-resources/src/main/java/com/azure/resourcemanager/resources/fluent/DeploymentsClient.java",
"license": "mit",
"size": 218889
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.resources.fluent.models.DeploymentExtendedInner",
"com.azure.resourcemanager.resources.models.ScopedDeployment"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.resources.fluent.models.DeploymentExtendedInner; import com.azure.resourcemanager.resources.models.ScopedDeployment; | import com.azure.core.annotation.*; import com.azure.resourcemanager.resources.fluent.models.*; import com.azure.resourcemanager.resources.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 217,442 |
void setCorrelationExpression(NamespacedProperty value); | void setCorrelationExpression(NamespacedProperty value); | /**
* Sets the value of the '{@link org.wso2.developerstudio.eclipse.esb.mediators.AggregateMediator#getCorrelationExpression <em>Correlation Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>Correlation Expression</em>' containment reference.
* @see #getCorrelationExpression()
* @generated
*/ | Sets the value of the '<code>org.wso2.developerstudio.eclipse.esb.mediators.AggregateMediator#getCorrelationExpression Correlation Expression</code>' containment reference. | setCorrelationExpression | {
"repo_name": "thiliniish/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.esb/src/org/wso2/developerstudio/eclipse/esb/mediators/AggregateMediator.java",
"license": "apache-2.0",
"size": 8128
} | [
"org.wso2.developerstudio.eclipse.esb.NamespacedProperty"
] | import org.wso2.developerstudio.eclipse.esb.NamespacedProperty; | import org.wso2.developerstudio.eclipse.esb.*; | [
"org.wso2.developerstudio"
] | org.wso2.developerstudio; | 851,242 |
@SuppressWarnings({"deprecation", // test of deprecated function
"EqualsIncompatibleType"})
@Test
public void testPAssertEqualsSingletonUnsupported() throws Exception {
thrown.expect(UnsupportedOperationException.class);
thrown.expectMessage("isEqualTo");
PCollection<Integer> pcollection = pipeline.apply(Create.of(42));
PAssert.thatSingleton(pcollection).equals(42);
} | @SuppressWarnings({STR, STR}) void function() throws Exception { thrown.expect(UnsupportedOperationException.class); thrown.expectMessage(STR); PCollection<Integer> pcollection = pipeline.apply(Create.of(42)); PAssert.thatSingleton(pcollection).equals(42); } | /**
* Test that we throw an error at pipeline construction time when the user mistakenly uses
* {@code PAssert.thatSingleton().equals()} instead of the test method {@code .isEqualTo}.
*/ | Test that we throw an error at pipeline construction time when the user mistakenly uses PAssert.thatSingleton().equals() instead of the test method .isEqualTo | testPAssertEqualsSingletonUnsupported | {
"repo_name": "tgroh/incubator-beam",
"path": "sdks/java/core/src/test/java/org/apache/beam/sdk/testing/PAssertTest.java",
"license": "apache-2.0",
"size": 21285
} | [
"org.apache.beam.sdk.transforms.Create",
"org.apache.beam.sdk.values.PCollection"
] | import org.apache.beam.sdk.transforms.Create; import org.apache.beam.sdk.values.PCollection; | import org.apache.beam.sdk.transforms.*; import org.apache.beam.sdk.values.*; | [
"org.apache.beam"
] | org.apache.beam; | 1,911,436 |
@Override
public void freeTemporaryResources(boolean isErrorOccurred)
throws IOException {
closeFile(getConstructorImplTempFileHandle(), true);
super.freeTemporaryResources(isErrorOccurred);
} | void function(boolean isErrorOccurred) throws IOException { closeFile(getConstructorImplTempFileHandle(), true); super.freeTemporaryResources(isErrorOccurred); } | /**
* Removes all temporary file handles.
*
* @param isErrorOccurred when translator fails to generate java files we
* need to close all open file handles include temporary files
* and java files.
* @throws IOException when failed to delete the temporary files
*/ | Removes all temporary file handles | freeTemporaryResources | {
"repo_name": "VinodKumarS-Huawei/ietf96yang",
"path": "utils/yangutils/plugin/src/main/java/org/onosproject/yangutils/translator/tojava/TempJavaBeanFragmentFiles.java",
"license": "apache-2.0",
"size": 4293
} | [
"java.io.IOException",
"org.onosproject.yangutils.utils.io.impl.FileSystemUtil"
] | import java.io.IOException; import org.onosproject.yangutils.utils.io.impl.FileSystemUtil; | import java.io.*; import org.onosproject.yangutils.utils.io.impl.*; | [
"java.io",
"org.onosproject.yangutils"
] | java.io; org.onosproject.yangutils; | 707,067 |
public void test(TestHarness harness)
{
// map of declared fields which should exists
Map<String, String> testedDeclaredFields = null;
// map of declared fields for (Open)JDK6
Map<String, String> testedDeclaredFields_jdk6 = new HashMap<String, String>();
// map of declared fields for (Open)JDK7
Map<String, String> testedDeclaredFields_jdk7 = new HashMap<String, String>();
// map for fields declared in (Open)JDK6
// --- empty ---
// map for fields declared in (Open)JDK7
testedDeclaredFields_jdk7.put("private static final long java.lang.StackOverflowError.serialVersionUID", "serialVersionUID");
// create instance of a class StackOverflowError
final Object o = new StackOverflowError("StackOverflowError");
// get a runtime class of an object "o"
final Class c = o.getClass();
// get the right map containing declared field signatures
testedDeclaredFields = getJavaVersion() < 7 ? testedDeclaredFields_jdk6 : testedDeclaredFields_jdk7;
// get all declared fields for this class
java.lang.reflect.Field[] declaredFields = c.getDeclaredFields();
// expected number of declared fields
final int expectedNumberOfDeclaredFields = testedDeclaredFields.size();
// basic check for a number of declared fields
harness.check(declaredFields.length, expectedNumberOfDeclaredFields);
// check if all fields exist
for (java.lang.reflect.Field declaredField: declaredFields) {
String fieldName = declaredField.getName();
String fieldString = declaredField.toString();
harness.check(testedDeclaredFields.containsKey(fieldString));
harness.check(testedDeclaredFields.get(fieldString), fieldName);
}
} | void function(TestHarness harness) { Map<String, String> testedDeclaredFields = null; Map<String, String> testedDeclaredFields_jdk6 = new HashMap<String, String>(); Map<String, String> testedDeclaredFields_jdk7 = new HashMap<String, String>(); testedDeclaredFields_jdk7.put(STR, STR); final Object o = new StackOverflowError(STR); final Class c = o.getClass(); testedDeclaredFields = getJavaVersion() < 7 ? testedDeclaredFields_jdk6 : testedDeclaredFields_jdk7; java.lang.reflect.Field[] declaredFields = c.getDeclaredFields(); final int expectedNumberOfDeclaredFields = testedDeclaredFields.size(); harness.check(declaredFields.length, expectedNumberOfDeclaredFields); for (java.lang.reflect.Field declaredField: declaredFields) { String fieldName = declaredField.getName(); String fieldString = declaredField.toString(); harness.check(testedDeclaredFields.containsKey(fieldString)); harness.check(testedDeclaredFields.get(fieldString), fieldName); } } | /**
* Runs the test using the specified harness.
*
* @param harness the test harness (<code>null</code> not permitted).
*/ | Runs the test using the specified harness | test | {
"repo_name": "niloc132/mauve-gwt",
"path": "src/main/java/gnu/testlet/java/lang/StackOverflowError/classInfo/getDeclaredFields.java",
"license": "gpl-2.0",
"size": 3655
} | [
"gnu.testlet.TestHarness",
"java.lang.StackOverflowError",
"java.util.HashMap",
"java.util.Map"
] | import gnu.testlet.TestHarness; import java.lang.StackOverflowError; import java.util.HashMap; import java.util.Map; | import gnu.testlet.*; import java.lang.*; import java.util.*; | [
"gnu.testlet",
"java.lang",
"java.util"
] | gnu.testlet; java.lang; java.util; | 1,638,026 |
public static void plotNodeValueLists(SeriesData[] seriesData,
String dstDir, PlotType type, PlotStyle style,
NodeValueListOrderBy sortBy, NodeValueListOrder sortOrder)
throws IOException, InterruptedException {
Log.info("plotting nodevaluelists sorted by " + sortBy.toString()
+ " in " + sortOrder.toString() + " order");
for (AggregatedMetric m : seriesData[0].getAggregation().getBatches()[0]
.getMetrics().getList()) {
for (AggregatedNodeValueList n : m.getNodeValues().getList()) {
Plotting.plotNodeValueList(seriesData, dstDir, type, style,
m.getName(), n.getName(), sortBy, sortOrder);
}
}
} | static void function(SeriesData[] seriesData, String dstDir, PlotType type, PlotStyle style, NodeValueListOrderBy sortBy, NodeValueListOrder sortOrder) throws IOException, InterruptedException { Log.info(STR + sortBy.toString() + STR + sortOrder.toString() + STR); for (AggregatedMetric m : seriesData[0].getAggregation().getBatches()[0] .getMetrics().getList()) { for (AggregatedNodeValueList n : m.getNodeValues().getList()) { Plotting.plotNodeValueList(seriesData, dstDir, type, style, m.getName(), n.getName(), sortBy, sortOrder); } } } | /**
* Plots NodeValueLists by calling Plotting.plotNodeValueList for each list.
*
* @param seriesData
* SeriesData which will be plotted
* @param dstDir
* Destination directory
* @param type
* PlotType
* @param style
* PlotStyle
* @param sortBy
* Argument the NodeValueList will be sorted by
* @param sortOrder
* Sorting order
* @throws IOException
* thrown by the writer in Plot.writeScript or in Execute.exec
* @throws InterruptedException
* thrown in Execute.exec
*/ | Plots NodeValueLists by calling Plotting.plotNodeValueList for each list | plotNodeValueLists | {
"repo_name": "Rwilmes/DNA3",
"path": "src/dna/plot/Plotting.java",
"license": "gpl-3.0",
"size": 23921
} | [
"dna.plot.Gnuplot",
"dna.plot.data.PlotData",
"dna.series.aggdata.AggregatedMetric",
"dna.series.aggdata.AggregatedNodeValueList",
"dna.series.data.SeriesData",
"dna.util.Log",
"java.io.IOException"
] | import dna.plot.Gnuplot; import dna.plot.data.PlotData; import dna.series.aggdata.AggregatedMetric; import dna.series.aggdata.AggregatedNodeValueList; import dna.series.data.SeriesData; import dna.util.Log; import java.io.IOException; | import dna.plot.*; import dna.plot.data.*; import dna.series.aggdata.*; import dna.series.data.*; import dna.util.*; import java.io.*; | [
"dna.plot",
"dna.plot.data",
"dna.series.aggdata",
"dna.series.data",
"dna.util",
"java.io"
] | dna.plot; dna.plot.data; dna.series.aggdata; dna.series.data; dna.util; java.io; | 1,034,924 |
private String queuePeekOrFail(String workspaceId) throws ServerException {
try (@SuppressWarnings("unused")
Unlocker u = stripedLocks.readLock(workspaceId)) {
ensurePreDestroyIsNotExecuted();
EnvironmentHolder environmentHolder = environments.get(workspaceId);
if (environmentHolder == null || environmentHolder.startQueue == null) {
throw new ServerException(
"Workspace "
+ workspaceId
+ " start interrupted. Workspace was stopped before all its machines were started");
}
return environmentHolder.startQueue.peek();
}
} | String function(String workspaceId) throws ServerException { try (@SuppressWarnings(STR) Unlocker u = stripedLocks.readLock(workspaceId)) { ensurePreDestroyIsNotExecuted(); EnvironmentHolder environmentHolder = environments.get(workspaceId); if (environmentHolder == null environmentHolder.startQueue == null) { throw new ServerException( STR + workspaceId + STR); } return environmentHolder.startQueue.peek(); } } | /**
* Gets head config from the queue associated with the given {@code workspaceId}.
*
* <p>Note that this method won't actually poll the queue.
*
* <p>Fails if environment start was interrupted by stop(queue doesn't exist).
*
* @return machine config which is in the queue head, or null if there are no machine configs left
* @throws ServerException if queue doesn't exist which means that {@link #stop(String)} executed
* before all the machines started
* @throws ServerException if pre destroy has been invoked before peek config retrieved
*/ | Gets head config from the queue associated with the given workspaceId. Note that this method won't actually poll the queue. Fails if environment start was interrupted by stop(queue doesn't exist) | queuePeekOrFail | {
"repo_name": "TypeFox/che",
"path": "wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/environment/server/CheEnvironmentEngine.java",
"license": "epl-1.0",
"size": 57062
} | [
"org.eclipse.che.api.core.ServerException",
"org.eclipse.che.commons.lang.concurrent.Unlocker"
] | import org.eclipse.che.api.core.ServerException; import org.eclipse.che.commons.lang.concurrent.Unlocker; | import org.eclipse.che.api.core.*; import org.eclipse.che.commons.lang.concurrent.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 622,884 |
void cleanupQuery(Session session); | void cleanupQuery(Session session); | /**
* Cleanup after a query. This is the very last notification after the query finishes, regardless if it succeeds or fails.
* An exception thrown in this method will not affect the result of the query.
*/ | Cleanup after a query. This is the very last notification after the query finishes, regardless if it succeeds or fails. An exception thrown in this method will not affect the result of the query | cleanupQuery | {
"repo_name": "electrum/presto",
"path": "core/trino-main/src/main/java/io/trino/metadata/Metadata.java",
"license": "apache-2.0",
"size": 24596
} | [
"io.trino.Session"
] | import io.trino.Session; | import io.trino.*; | [
"io.trino"
] | io.trino; | 1,347,027 |
private void addPeriod(DynamicsPeriod period, CList<DynamicsPeriod> target) {
//add at correct position
int pos = 0;
while (pos < target.size() && target.get(pos).startTime.compareTo(period.startTime) < 0)
pos++;
//add at this position, but only if the following (if any) period does not overlap
if (pos + 1 < target.size() && target.get(pos + 1).startTime.compareTo(period.endTime) < 0)
throw new IllegalArgumentException("periods overlap");
target.add(pos, period);
} | void function(DynamicsPeriod period, CList<DynamicsPeriod> target) { int pos = 0; while (pos < target.size() && target.get(pos).startTime.compareTo(period.startTime) < 0) pos++; if (pos + 1 < target.size() && target.get(pos + 1).startTime.compareTo(period.endTime) < 0) throw new IllegalArgumentException(STR); target.add(pos, period); } | /**
* Adds the given period into the given list. When there are collisions,
* an {@link IllegalArgumentException} is thrown.
*/ | Adds the given period into the given list. When there are collisions, an <code>IllegalArgumentException</code> is thrown | addPeriod | {
"repo_name": "Xenoage/Zong",
"path": "midi-out/src/com/xenoage/zong/io/midi/out/dynamics/DynamicsPeriodsBuilder.java",
"license": "agpl-3.0",
"size": 3240
} | [
"com.xenoage.utils.collections.CList"
] | import com.xenoage.utils.collections.CList; | import com.xenoage.utils.collections.*; | [
"com.xenoage.utils"
] | com.xenoage.utils; | 1,633,714 |
@Test
public void testOnDestroy() {
poolClass.close();
assertEquals(5, hookClass.destroy);
}
| void function() { poolClass.close(); assertEquals(5, hookClass.destroy); } | /**
* Test method for {@link com.jolbox.bonecp.hooks.AbstractConnectionHook#onDestroy(com.jolbox.bonecp.ConnectionHandle)}.
*/ | Test method for <code>com.jolbox.bonecp.hooks.AbstractConnectionHook#onDestroy(com.jolbox.bonecp.ConnectionHandle)</code> | testOnDestroy | {
"repo_name": "liuxing521a/itas-core",
"path": "utils/src/test/java/com/jolbox/bonecp/hooks/TestConnectionHook.java",
"license": "apache-2.0",
"size": 6451
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 35,578 |
public static List<org.wso2.carbon.identity.application.common.model.idp.xsd.Property> getPropertySetStartsWith(
org.wso2.carbon.identity.application.common.model.idp.xsd.Property[] properties,
String startWith) {
List<org.wso2.carbon.identity.application.common.model.idp.xsd.Property> propertySet = new ArrayList<>();
for (org.wso2.carbon.identity.application.common.model.idp.xsd.Property property : properties) {
if (property.getName().startsWith(startWith)) {
propertySet.add(property);
}
}
return propertySet;
} | static List<org.wso2.carbon.identity.application.common.model.idp.xsd.Property> function( org.wso2.carbon.identity.application.common.model.idp.xsd.Property[] properties, String startWith) { List<org.wso2.carbon.identity.application.common.model.idp.xsd.Property> propertySet = new ArrayList<>(); for (org.wso2.carbon.identity.application.common.model.idp.xsd.Property property : properties) { if (property.getName().startsWith(startWith)) { propertySet.add(property); } } return propertySet; } | /**
* This is used in front end. Property is the type of stub generated property
*
* @param properties properties list to iterate
* @param startWith the peoperty list startswith the given name
* @return
*/ | This is used in front end. Property is the type of stub generated property | getPropertySetStartsWith | {
"repo_name": "hpmtissera/carbon-identity",
"path": "components/idp-mgt/org.wso2.carbon.idp.mgt.ui/src/main/java/org/wso2/carbon/idp/mgt/ui/util/IdPManagementUIUtil.java",
"license": "apache-2.0",
"size": 73141
} | [
"java.util.ArrayList",
"java.util.List",
"org.wso2.carbon.identity.application.common.model.idp.xsd.Property"
] | import java.util.ArrayList; import java.util.List; import org.wso2.carbon.identity.application.common.model.idp.xsd.Property; | import java.util.*; import org.wso2.carbon.identity.application.common.model.idp.xsd.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 223,794 |
public List<RAFFileEntry> getFileEntries() {
return fileEntries;
} | List<RAFFileEntry> function() { return fileEntries; } | /**
* Retrieve the list of file entries in this archive.
* @return
*/ | Retrieve the list of file entries in this archive | getFileEntries | {
"repo_name": "jonathanedgecombe/raf-library",
"path": "src/com/jonathanedgecombe/raf/RAFFile.java",
"license": "isc",
"size": 3784
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,531,289 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<IoTSecurityAggregatedRecommendationInner>> listSinglePageAsync(
String resourceGroupName, String solutionName, Integer top, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (solutionName == null) {
return Mono.error(new IllegalArgumentException("Parameter solutionName is required and cannot be null."));
}
final String apiVersion = "2019-08-01";
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(
this.client.getEndpoint(),
apiVersion,
this.client.getSubscriptionId(),
resourceGroupName,
solutionName,
top,
accept,
context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<IoTSecurityAggregatedRecommendationInner>> function( String resourceGroupName, String solutionName, Integer top, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (solutionName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String apiVersion = STR; final String accept = STR; context = this.client.mergeContext(context); return service .list( this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), resourceGroupName, solutionName, top, accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } | /**
* Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case
* insensitive.
* @param solutionName The name of the IoT Security solution.
* @param top Number of results to retrieve.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return list of IoT Security solution aggregated recommendations.
*/ | Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution | listSinglePageAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/security/azure-resourcemanager-security/src/main/java/com/azure/resourcemanager/security/implementation/IotSecuritySolutionsAnalyticsRecommendationsClientImpl.java",
"license": "mit",
"size": 29503
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedResponse",
"com.azure.core.http.rest.PagedResponseBase",
"com.azure.core.util.Context",
"com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.security.fluent.models.IoTSecurityAggregatedRecommendationInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.security.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,436,612 |
public List<RemoteTenant> getTenants(int offset, int limit); | List<RemoteTenant> function(int offset, int limit); | /**
* Get a list of all tenants for a given offset and limit,
*
* @param offset
* @param limit
* @return
*/ | Get a list of all tenants for a given offset and limit | getTenants | {
"repo_name": "ferronrsmith/easyrec",
"path": "easyrec-web/src/main/java/org/easyrec/store/dao/web/RemoteTenantDAO.java",
"license": "gpl-3.0",
"size": 5087
} | [
"java.util.List",
"org.easyrec.model.core.web.RemoteTenant"
] | import java.util.List; import org.easyrec.model.core.web.RemoteTenant; | import java.util.*; import org.easyrec.model.core.web.*; | [
"java.util",
"org.easyrec.model"
] | java.util; org.easyrec.model; | 460,309 |
protected void init() {
messageDamper = new OFMessageDamper(OFMESSAGE_DAMPER_CAPACITY,
EnumSet.of(OFType.FLOW_MOD),
OFMESSAGE_DAMPER_TIMEOUT);
} | void function() { messageDamper = new OFMessageDamper(OFMESSAGE_DAMPER_CAPACITY, EnumSet.of(OFType.FLOW_MOD), OFMESSAGE_DAMPER_TIMEOUT); } | /**
* init data structures
*
*/ | init data structures | init | {
"repo_name": "yeasy/lazyctrl",
"path": "ccm/floodlight-lc/src/main/java/net/floodlightcontroller/routing/ForwardingBase.java",
"license": "apache-2.0",
"size": 26654
} | [
"java.util.EnumSet",
"net.floodlightcontroller.util.OFMessageDamper",
"org.openflow.protocol.OFType"
] | import java.util.EnumSet; import net.floodlightcontroller.util.OFMessageDamper; import org.openflow.protocol.OFType; | import java.util.*; import net.floodlightcontroller.util.*; import org.openflow.protocol.*; | [
"java.util",
"net.floodlightcontroller.util",
"org.openflow.protocol"
] | java.util; net.floodlightcontroller.util; org.openflow.protocol; | 934,005 |
public void printUsage(PrintWriter pw, int width, String app,
Options options) {
// initialise the string buffer
StringBuffer buff = new StringBuffer(defaultSyntaxPrefix).append(app)
.append(" ");
// create a list for processed option groups
final Collection processedGroups = new ArrayList();
// temp variable
Option option;
List optList = new ArrayList(options.getOptions());
Collections.sort(optList, new OptionComparator());
// iterate over the options
for (Iterator i = optList.iterator(); i.hasNext();) {
// get the next Option
option = (Option) i.next();
// check if the option is part of an OptionGroup
OptionGroup group = options.getOptionGroup(option);
// if the option is part of a group
if (group != null) {
// and if the group has not already been processed
if (!processedGroups.contains(group)) {
// add the group to the processed list
processedGroups.add(group);
// add the usage clause
appendOptionGroup(buff, group);
}
// otherwise the option was displayed in the group
// previously so ignore it.
}
// if the Option is not part of an OptionGroup
else {
appendOption(buff, option, option.isRequired());
}
if (i.hasNext()) {
buff.append(" ");
}
}
// call printWrapped
printWrapped(pw, width, buff.toString().indexOf(' ') + 1,
buff.toString());
} | void function(PrintWriter pw, int width, String app, Options options) { StringBuffer buff = new StringBuffer(defaultSyntaxPrefix).append(app) .append(" "); final Collection processedGroups = new ArrayList(); Option option; List optList = new ArrayList(options.getOptions()); Collections.sort(optList, new OptionComparator()); for (Iterator i = optList.iterator(); i.hasNext();) { option = (Option) i.next(); OptionGroup group = options.getOptionGroup(option); if (group != null) { if (!processedGroups.contains(group)) { processedGroups.add(group); appendOptionGroup(buff, group); } } else { appendOption(buff, option, option.isRequired()); } if (i.hasNext()) { buff.append(" "); } } printWrapped(pw, width, buff.toString().indexOf(' ') + 1, buff.toString()); } | /**
* <p>
* Prints the usage statement for the specified application.
* </p>
*
* @param pw
* The PrintWriter to print the usage statement
* @param width
* The number of characters to display per line
* @param app
* The application name
* @param options
* The command line Options
*
*/ | Prints the usage statement for the specified application. | printUsage | {
"repo_name": "janlindblom/sdedit",
"path": "src/org/apache/commons/cli/HelpFormatter.java",
"license": "bsd-2-clause",
"size": 27350
} | [
"java.io.PrintWriter",
"java.util.ArrayList",
"java.util.Collection",
"java.util.Collections",
"java.util.Iterator",
"java.util.List"
] | import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,006,545 |
public void writeElementValue(XmlNamespace xmlNamespace, String localName,
Object value) throws XMLStreamException,
ServiceXmlSerializationException {
this.writeElementValue(xmlNamespace, localName, localName, value);
} | void function(XmlNamespace xmlNamespace, String localName, Object value) throws XMLStreamException, ServiceXmlSerializationException { this.writeElementValue(xmlNamespace, localName, localName, value); } | /**
* Writes the element value.
*
* @param xmlNamespace The XML namespace.
* @param localName The local name of the element.
* @param value The value.
* @throws javax.xml.stream.XMLStreamException the xML stream exception
* @throws microsoft.exchange.webservices.data.exception.ServiceXmlSerializationException the service xml serialization exception
*/ | Writes the element value | writeElementValue | {
"repo_name": "relateiq/ews-java-api",
"path": "src/main/java/microsoft/exchange/webservices/data/core/EwsServiceXmlWriter.java",
"license": "mit",
"size": 19735
} | [
"javax.xml.stream.XMLStreamException"
] | import javax.xml.stream.XMLStreamException; | import javax.xml.stream.*; | [
"javax.xml"
] | javax.xml; | 1,818,795 |
private static Page retrieveLoginPage(boolean spInitiated) {
// start login attempt with target SP
try {
// create a URI of the start page (which also checks the validity of the string as URI)
URL loginURL;
if (spInitiated) {
// login from the SP's start page
loginURL = idpConfig.getIdPInitURL();
Page retrievedPage = browser.getPage(loginURL);
// interact with the login page in order to get logged in
ArrayList<Interaction> interactions = idpConfig.getPreResponseInteractions();
// execute all interactions
for(Interaction interaction : interactions){
if(retrievedPage instanceof HtmlPage){
// cast the Page to an HtmlPage so we can interact with it
HtmlPage loginPage = (HtmlPage) retrievedPage;
logger.trace("Login page");
logger.trace(loginPage.getWebResponse().getContentAsString());
// cast the interaction to the correct class
if(interaction instanceof FormInteraction) {
FormInteraction formInteraction = (FormInteraction) interaction;
retrievedPage = formInteraction.executeOnPage(loginPage);
logger.trace("Login page (after form submit)");
logger.trace(loginPage.getWebResponse().getContentAsString());
}
else if(interaction instanceof LinkInteraction) {
LinkInteraction linkInteraction = (LinkInteraction) interaction;
retrievedPage = linkInteraction.executeOnPage(loginPage);
logger.trace("Login page (after link click)");
logger.trace(retrievedPage.getWebResponse().getContentAsString());
}
else {
retrievedPage = interaction.executeOnPage(loginPage);
logger.trace("Login page (after element click)");
logger.trace(retrievedPage.getWebResponse().getContentAsString());
}
}
else{
logger.error("The login page is not an HTML page, so it's not possible to interact with it");
logger.trace("Retrieved page:");
logger.trace(retrievedPage.getWebResponse().getContentAsString());
break;
}
}
return retrievedPage;
}
else {
// login from the IdP's page
return browser.getPage(testsuite.getMockSPURL());
}
// return the retrieved page
} catch (FailingHttpStatusCodeException e) {
logger.error("The login page did not return a valid HTTP status code");
} catch (MalformedURLException e) {
logger.error("THe login page's URL is not valid");
} catch (IOException e) {
logger.error("The login page could not be accessed due to an I/O error");
} catch (ElementNotFoundException e){
logger.error("The interaction link lookup could not find the specified element");
}
return null;
}
| static Page function(boolean spInitiated) { try { URL loginURL; if (spInitiated) { loginURL = idpConfig.getIdPInitURL(); Page retrievedPage = browser.getPage(loginURL); ArrayList<Interaction> interactions = idpConfig.getPreResponseInteractions(); for(Interaction interaction : interactions){ if(retrievedPage instanceof HtmlPage){ HtmlPage loginPage = (HtmlPage) retrievedPage; logger.trace(STR); logger.trace(loginPage.getWebResponse().getContentAsString()); if(interaction instanceof FormInteraction) { FormInteraction formInteraction = (FormInteraction) interaction; retrievedPage = formInteraction.executeOnPage(loginPage); logger.trace(STR); logger.trace(loginPage.getWebResponse().getContentAsString()); } else if(interaction instanceof LinkInteraction) { LinkInteraction linkInteraction = (LinkInteraction) interaction; retrievedPage = linkInteraction.executeOnPage(loginPage); logger.trace(STR); logger.trace(retrievedPage.getWebResponse().getContentAsString()); } else { retrievedPage = interaction.executeOnPage(loginPage); logger.trace(STR); logger.trace(retrievedPage.getWebResponse().getContentAsString()); } } else{ logger.error(STR); logger.trace(STR); logger.trace(retrievedPage.getWebResponse().getContentAsString()); break; } } return retrievedPage; } else { return browser.getPage(testsuite.getMockSPURL()); } } catch (FailingHttpStatusCodeException e) { logger.error(STR); } catch (MalformedURLException e) { logger.error(STR); } catch (IOException e) { logger.error(STR); } catch (ElementNotFoundException e){ logger.error(STR); } return null; } | /**
* TODO: check if this is still needed
*
* Retrieves the login page from the SP, thereby sending the SP's AuthnRequest to
* the mock IdP.
*
* @return the login page, or null if the login page could not be retrieved
*/ | Retrieves the login page from the SP, thereby sending the SP's AuthnRequest to the mock IdP | retrieveLoginPage | {
"repo_name": "rmokiem-topdesk/SAML2WebSSOTest-IdP",
"path": "src/main/java/saml2webssotest/idp/IdPTestRunner.java",
"license": "lgpl-3.0",
"size": 17122
} | [
"com.gargoylesoftware.htmlunit.ElementNotFoundException",
"com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException",
"com.gargoylesoftware.htmlunit.Page",
"com.gargoylesoftware.htmlunit.html.HtmlPage",
"java.io.IOException",
"java.net.MalformedURLException",
"java.util.ArrayList"
] | import com.gargoylesoftware.htmlunit.ElementNotFoundException; import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException; import com.gargoylesoftware.htmlunit.Page; import com.gargoylesoftware.htmlunit.html.HtmlPage; import java.io.IOException; import java.net.MalformedURLException; import java.util.ArrayList; | import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.*; import java.io.*; import java.net.*; import java.util.*; | [
"com.gargoylesoftware.htmlunit",
"java.io",
"java.net",
"java.util"
] | com.gargoylesoftware.htmlunit; java.io; java.net; java.util; | 840,969 |
@NotNull
public Customer getLoggedCustomer(@NotNull Customer defaultValue); | Customer function(@NotNull Customer defaultValue); | /** Get an immutable logged Customer from session of returns the default Value
* @return */ | Get an immutable logged Customer from session of returns the default Value | getLoggedCustomer | {
"repo_name": "pponec/ujorm",
"path": "samples/wicket/src/main/java/org/ujorm/hotels/service/SessionService.java",
"license": "apache-2.0",
"size": 1405
} | [
"org.jetbrains.annotations.NotNull",
"org.ujorm.hotels.entity.Customer"
] | import org.jetbrains.annotations.NotNull; import org.ujorm.hotels.entity.Customer; | import org.jetbrains.annotations.*; import org.ujorm.hotels.entity.*; | [
"org.jetbrains.annotations",
"org.ujorm.hotels"
] | org.jetbrains.annotations; org.ujorm.hotels; | 269,053 |
public okhttp3.Call getAPIVersionsCall(final ApiCallback _callback) throws ApiException {
Object localVarPostBody = null;
// create path and map variables
String localVarPath = "/apis/";
List<Pair> localVarQueryParams = new ArrayList<Pair>();
List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Map<String, String> localVarCookieParams = new HashMap<String, String>();
Map<String, Object> localVarFormParams = new HashMap<String, Object>();
final String[] localVarAccepts = {
"application/json", "application/yaml", "application/vnd.kubernetes.protobuf"
};
final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
if (localVarAccept != null) {
localVarHeaderParams.put("Accept", localVarAccept);
}
final String[] localVarContentTypes = {};
final String localVarContentType =
localVarApiClient.selectHeaderContentType(localVarContentTypes);
localVarHeaderParams.put("Content-Type", localVarContentType);
String[] localVarAuthNames = new String[] {"BearerToken"};
return localVarApiClient.buildCall(
localVarPath,
"GET",
localVarQueryParams,
localVarCollectionQueryParams,
localVarPostBody,
localVarHeaderParams,
localVarCookieParams,
localVarFormParams,
localVarAuthNames,
_callback);
} | okhttp3.Call function(final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; String localVarPath = STR; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { STR, STR, STR }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put(STR, localVarAccept); } final String[] localVarContentTypes = {}; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put(STR, localVarContentType); String[] localVarAuthNames = new String[] {STR}; return localVarApiClient.buildCall( localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } | /**
* Build call for getAPIVersions
*
* @param _callback Callback for upload/download progress
* @return Call to execute
* @throws ApiException If fail to serialize the request body object
* @http.response.details
* <table summary="Response Details" border="1">
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
* </table>
*/ | Build call for getAPIVersions | getAPIVersionsCall | {
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/apis/ApisApi.java",
"license": "apache-2.0",
"size": 6225
} | [
"io.kubernetes.client.openapi.ApiCallback",
"io.kubernetes.client.openapi.ApiException",
"io.kubernetes.client.openapi.Pair",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import io.kubernetes.client.openapi.ApiCallback; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.Pair; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; | import io.kubernetes.client.openapi.*; import java.util.*; | [
"io.kubernetes.client",
"java.util"
] | io.kubernetes.client; java.util; | 2,523,625 |
return Optional.ofNullable(this.memory);
}
public static class Builder extends ConfigDTO.Builder<Builder> {
private final CommandStatus bStatus;
private final String bExecutable;
private final long bCheckDelay;
private Integer bMemory;
public Builder(
@JsonProperty("name")
final String name,
@JsonProperty("user")
final String user,
@JsonProperty("version")
final String version,
@JsonProperty("status")
final CommandStatus status,
@JsonProperty("executable")
final String executable,
@JsonProperty("checkDelay")
final long checkDelay
) {
super(name, user, version);
if (status != null) {
this.bStatus = status;
} else {
this.bStatus = CommandStatus.INACTIVE;
}
this.bExecutable = executable;
this.bCheckDelay = checkDelay;
} | return Optional.ofNullable(this.memory); } public static class Builder extends ConfigDTO.Builder<Builder> { private final CommandStatus bStatus; private final String bExecutable; private final long bCheckDelay; private Integer bMemory; public Builder( @JsonProperty("name") final String name, @JsonProperty("user") final String user, @JsonProperty(STR) final String version, @JsonProperty(STR) final CommandStatus status, @JsonProperty(STR) final String executable, @JsonProperty(STR) final long checkDelay ) { super(name, user, version); if (status != null) { this.bStatus = status; } else { this.bStatus = CommandStatus.INACTIVE; } this.bExecutable = executable; this.bCheckDelay = checkDelay; } | /**
* Get the default amount of memory (in MB) to use for jobs which use this command.
*
* @return Optional of the amount of memory as it could be null if none set
*/ | Get the default amount of memory (in MB) to use for jobs which use this command | getMemory | {
"repo_name": "ajoymajumdar/genie",
"path": "genie-common/src/main/java/com/netflix/genie/common/dto/Command.java",
"license": "apache-2.0",
"size": 5024
} | [
"com.fasterxml.jackson.annotation.JsonProperty",
"java.util.Optional"
] | import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Optional; | import com.fasterxml.jackson.annotation.*; import java.util.*; | [
"com.fasterxml.jackson",
"java.util"
] | com.fasterxml.jackson; java.util; | 2,379,062 |
public void logError(String msg, Throwable error) throws RemoteException;
| void function(String msg, Throwable error) throws RemoteException; | /**
* Convenience method to send an errorlogmessage to the logmanager. This method prints a stacktrace from
* the parameter error and adds it to the logmessage. The level of the logmessage is set to ERROR_LEVEL.
*
* @param msg a msg of the error.
* @param error an error to be logged.
*
* @see com.teletalk.jserver.log.LogManager
*/ | Convenience method to send an errorlogmessage to the logmanager. This method prints a stacktrace from the parameter error and adds it to the logmessage. The level of the logmessage is set to ERROR_LEVEL | logError | {
"repo_name": "tolo/JServer",
"path": "src/java/com/teletalk/jserver/rmi/remote/RemoteSubComponent.java",
"license": "apache-2.0",
"size": 14573
} | [
"java.rmi.RemoteException"
] | import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
] | java.rmi; | 459,262 |
public static BufferedImage rasterToBufferedImage(
Raster raster,
ImageTypeSpecifier imageType)
{
if (imageType == null)
{
if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE)
imageType = ImageTypeSpecifier.createGrayscale(8,
DataBuffer.TYPE_BYTE, false);
else
throw new IllegalArgumentException(
"unable to dynamically determine the imageType");
}
// create a new buffered image, for display
BufferedImage bufImage = imageType.createBufferedImage(raster
.getWidth(), raster.getHeight());
if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_USHORT
&& bufImage.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE)
{
// convert short pixels to bytes
short[] shortData = ((DataBufferUShort) raster.getDataBuffer())
.getData();
byte[] byteData = ((DataBufferByte) bufImage.getWritableTile(0, 0)
.getDataBuffer()).getData();
ImageIOUtils.shortToByteBuffer(shortData, byteData, 1, raster
.getNumBands());
}
else if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_FLOAT
&& bufImage.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE)
{
// convert float pixels to bytes
float[] floatData = ((DataBufferFloat) raster.getDataBuffer())
.getData();
byte[] byteData = ((DataBufferByte) bufImage.getWritableTile(0, 0)
.getDataBuffer()).getData();
ImageIOUtils.floatToByteBuffer(floatData, byteData, 1, raster
.getNumBands());
}
else if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_DOUBLE
&& bufImage.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE)
{
// convert double pixels to bytes
double[] doubleData = ((DataBufferDouble) raster.getDataBuffer())
.getData();
byte[] byteData = ((DataBufferByte) bufImage.getWritableTile(0, 0)
.getDataBuffer()).getData();
ImageIOUtils.doubleToByteBuffer(doubleData, byteData, 1, raster
.getNumBands());
}
else if ((raster.getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE && bufImage
.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE)
|| (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_USHORT && bufImage
.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_USHORT)
|| (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_SHORT && bufImage
.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_SHORT))
{
bufImage.setData(raster);
}
else
{
throw new UnsupportedOperationException(
"Unable to convert raster type to bufferedImage type: "
+ raster.getDataBuffer().getDataType()
+ " ==> "
+ bufImage.getRaster().getDataBuffer()
.getDataType());
}
return bufImage;
} | static BufferedImage function( Raster raster, ImageTypeSpecifier imageType) { if (imageType == null) { if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE) imageType = ImageTypeSpecifier.createGrayscale(8, DataBuffer.TYPE_BYTE, false); else throw new IllegalArgumentException( STR); } BufferedImage bufImage = imageType.createBufferedImage(raster .getWidth(), raster.getHeight()); if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_USHORT && bufImage.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE) { short[] shortData = ((DataBufferUShort) raster.getDataBuffer()) .getData(); byte[] byteData = ((DataBufferByte) bufImage.getWritableTile(0, 0) .getDataBuffer()).getData(); ImageIOUtils.shortToByteBuffer(shortData, byteData, 1, raster .getNumBands()); } else if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_FLOAT && bufImage.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE) { float[] floatData = ((DataBufferFloat) raster.getDataBuffer()) .getData(); byte[] byteData = ((DataBufferByte) bufImage.getWritableTile(0, 0) .getDataBuffer()).getData(); ImageIOUtils.floatToByteBuffer(floatData, byteData, 1, raster .getNumBands()); } else if (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_DOUBLE && bufImage.getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE) { double[] doubleData = ((DataBufferDouble) raster.getDataBuffer()) .getData(); byte[] byteData = ((DataBufferByte) bufImage.getWritableTile(0, 0) .getDataBuffer()).getData(); ImageIOUtils.doubleToByteBuffer(doubleData, byteData, 1, raster .getNumBands()); } else if ((raster.getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE && bufImage .getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_BYTE) (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_USHORT && bufImage .getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_USHORT) (raster.getDataBuffer().getDataType() == DataBuffer.TYPE_SHORT && bufImage .getRaster().getDataBuffer().getDataType() == DataBuffer.TYPE_SHORT)) { bufImage.setData(raster); } else { throw new UnsupportedOperationException( STR + raster.getDataBuffer().getDataType() + STR + bufImage.getRaster().getDataBuffer() .getDataType()); } return bufImage; } | /**
* Utility method for creating a BufferedImage from a source raster
* Currently only Float->Byte and Byte->Byte are supported. Will throw an
* {@link UnsupportedOperationException} if the conversion is not supported.
*
* @param raster
* @param imageType
* @return
*/ | Utility method for creating a BufferedImage from a source raster Currently only Float->Byte and Byte->Byte are supported. Will throw an <code>UnsupportedOperationException</code> if the conversion is not supported | rasterToBufferedImage | {
"repo_name": "hobu/nitro",
"path": "java/nitf.imageio/src/java/nitf/imageio/ImageIOUtils.java",
"license": "lgpl-3.0",
"size": 21348
} | [
"java.awt.image.BufferedImage",
"java.awt.image.DataBuffer",
"java.awt.image.DataBufferByte",
"java.awt.image.DataBufferDouble",
"java.awt.image.DataBufferFloat",
"java.awt.image.DataBufferUShort",
"java.awt.image.Raster",
"javax.imageio.ImageTypeSpecifier"
] | import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferDouble; import java.awt.image.DataBufferFloat; import java.awt.image.DataBufferUShort; import java.awt.image.Raster; import javax.imageio.ImageTypeSpecifier; | import java.awt.image.*; import javax.imageio.*; | [
"java.awt",
"javax.imageio"
] | java.awt; javax.imageio; | 1,775,543 |
public ItemStack getCurrentItemOrArmor(int par1)
{
if(par1==0)
if(this.inventory.currentItem==-1)
return null;
else
return this.inventory.mainInventory[this.inventory.currentItem];
return this.inventory.armorInventory[par1-1];
} | ItemStack function(int par1) { if(par1==0) if(this.inventory.currentItem==-1) return null; else return this.inventory.mainInventory[this.inventory.currentItem]; return this.inventory.armorInventory[par1-1]; } | /**
* 0 = item, 1-n is armor
*/ | 0 = item, 1-n is armor | getCurrentItemOrArmor | {
"repo_name": "nekosune/UnDeath",
"path": "src/main/java/com/nekokittygames/modjam/UnDeath/EntityPlayerZombiePigmen.java",
"license": "gpl-2.0",
"size": 12914
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 1,892,062 |
@Override
public void actionPerformed(final ActionEvent e) {
if (isFilterWindowVisible()) {
setFilterWindowVisible(false);
}
}
}
private class FilterWindowListener extends MouseAdapter implements AncestorListener,
FocusListener,
WindowFocusListener {
//~ Methods ------------------------------------------------------------ | void function(final ActionEvent e) { if (isFilterWindowVisible()) { setFilterWindowVisible(false); } } } private class FilterWindowListener extends MouseAdapter implements AncestorListener, FocusListener, WindowFocusListener { | /**
* DOCUMENT ME!
*
* @param e DOCUMENT ME!
*/ | DOCUMENT ME | actionPerformed | {
"repo_name": "cismet/cismet-gui-commons",
"path": "src/main/java/de/cismet/tools/gui/autocomplete/CompleterFilterWithWindow.java",
"license": "lgpl-3.0",
"size": 12504
} | [
"java.awt.event.ActionEvent",
"java.awt.event.FocusListener",
"java.awt.event.MouseAdapter",
"java.awt.event.WindowFocusListener",
"javax.swing.event.AncestorListener"
] | import java.awt.event.ActionEvent; import java.awt.event.FocusListener; import java.awt.event.MouseAdapter; import java.awt.event.WindowFocusListener; import javax.swing.event.AncestorListener; | import java.awt.event.*; import javax.swing.event.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,771,343 |
public boolean copy(final Plot destination, final Runnable whenDone) {
final PlotId offset = new PlotId(destination.getId().x - this.getId().x, destination.getId().y - this.getId().y);
final Location db = destination.getBottomAbs();
final Location ob = this.getBottomAbs();
final int offsetX = db.getX() - ob.getX();
final int offsetZ = db.getZ() - ob.getZ();
if (this.owner == null) {
TaskManager.runTaskLater(whenDone, 1);
return false;
}
final HashSet<Plot> plots = this.getConnectedPlots();
for (final Plot plot : plots) {
final Plot other = plot.getRelative(offset.x, offset.y);
if (other.hasOwner()) {
TaskManager.runTaskLater(whenDone, 1);
return false;
}
}
// world border
destination.updateWorldBorder();
// copy data
for (final Plot plot : plots) {
final Plot other = plot.getRelative(offset.x, offset.y);
other.create(other.owner, false);
if ((plot.getFlags() != null) && !plot.getFlags().isEmpty()) {
other.getSettings().flags = plot.getFlags();
DBFunc.setFlags(other, plot.getFlags().values());
}
if (plot.isMerged()) {
other.setMerged(plot.getMerged());
}
if ((plot.members != null) && !plot.members.isEmpty()) {
other.members = plot.members;
for (final UUID member : other.members) {
DBFunc.setMember(other, member);
}
}
if ((plot.trusted != null) && !plot.trusted.isEmpty()) {
other.trusted = plot.trusted;
for (final UUID trusted : other.trusted) {
DBFunc.setTrusted(other, trusted);
}
}
if ((plot.denied != null) && !plot.denied.isEmpty()) {
other.denied = plot.denied;
for (final UUID denied : other.denied) {
DBFunc.setDenied(other, denied);
}
}
PS.get().updatePlot(other);
} | boolean function(final Plot destination, final Runnable whenDone) { final PlotId offset = new PlotId(destination.getId().x - this.getId().x, destination.getId().y - this.getId().y); final Location db = destination.getBottomAbs(); final Location ob = this.getBottomAbs(); final int offsetX = db.getX() - ob.getX(); final int offsetZ = db.getZ() - ob.getZ(); if (this.owner == null) { TaskManager.runTaskLater(whenDone, 1); return false; } final HashSet<Plot> plots = this.getConnectedPlots(); for (final Plot plot : plots) { final Plot other = plot.getRelative(offset.x, offset.y); if (other.hasOwner()) { TaskManager.runTaskLater(whenDone, 1); return false; } } destination.updateWorldBorder(); for (final Plot plot : plots) { final Plot other = plot.getRelative(offset.x, offset.y); other.create(other.owner, false); if ((plot.getFlags() != null) && !plot.getFlags().isEmpty()) { other.getSettings().flags = plot.getFlags(); DBFunc.setFlags(other, plot.getFlags().values()); } if (plot.isMerged()) { other.setMerged(plot.getMerged()); } if ((plot.members != null) && !plot.members.isEmpty()) { other.members = plot.members; for (final UUID member : other.members) { DBFunc.setMember(other, member); } } if ((plot.trusted != null) && !plot.trusted.isEmpty()) { other.trusted = plot.trusted; for (final UUID trusted : other.trusted) { DBFunc.setTrusted(other, trusted); } } if ((plot.denied != null) && !plot.denied.isEmpty()) { other.denied = plot.denied; for (final UUID denied : other.denied) { DBFunc.setDenied(other, denied); } } PS.get().updatePlot(other); } | /**
* Copy a plot to a location, both physically and the settings
* @param destination
* @param whenDone
* @return
*/ | Copy a plot to a location, both physically and the settings | copy | {
"repo_name": "SilverCory/PlotSquared",
"path": "Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java",
"license": "gpl-3.0",
"size": 98015
} | [
"com.intellectualcrafters.plot.PS",
"com.intellectualcrafters.plot.database.DBFunc",
"com.intellectualcrafters.plot.util.TaskManager",
"java.util.HashSet"
] | import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.util.TaskManager; import java.util.HashSet; | import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.database.*; import com.intellectualcrafters.plot.util.*; import java.util.*; | [
"com.intellectualcrafters.plot",
"java.util"
] | com.intellectualcrafters.plot; java.util; | 1,262,048 |
public Grid.Column addComponentColumn(Object propertyId, ComponentGenerator<T> generator) {
return componentGridDecorator.addComponentColumn(propertyId, generator);
} | Grid.Column function(Object propertyId, ComponentGenerator<T> generator) { return componentGridDecorator.addComponentColumn(propertyId, generator); } | /**
* Add a generated component column to the ComponentGrid.
*
* @param propertyId the generated column's property-id
* @param generator the component-generator
* @return the grid for method chaining
*/ | Add a generated component column to the ComponentGrid | addComponentColumn | {
"repo_name": "datenhahn/componentrenderer",
"path": "componentrenderer/src/main/java/de/datenhahn/vaadin/componentrenderer/grid/ComponentGrid.java",
"license": "apache-2.0",
"size": 4889
} | [
"com.vaadin.v7.ui.Grid"
] | import com.vaadin.v7.ui.Grid; | import com.vaadin.v7.ui.*; | [
"com.vaadin.v7"
] | com.vaadin.v7; | 2,857,143 |
private String searchForManga(String searchTerm) throws IOException{
String url = "http://www.mangahere.com/search.php";
String encoded = URLEncoder.encode(searchTerm, "UTF-8");
url += "?name=" + encoded;
Document doc = Jsoup.connect(url).timeout(5000).get();
Elements results = doc.getElementsByClass("result_search").first().children();
results.remove(results.last());//Removes useless link from footer
for(Element e: results){
String text = e.children().last().text();
text = text.substring(text.indexOf(':')+1);
String[] names = text.split(";");
for(String s: names){
if(s.substring(1).equalsIgnoreCase(searchTerm)){
return e.select("a").first().absUrl("href");
}
}
}
return "";
} | String function(String searchTerm) throws IOException{ String url = STRUTF-8STR?name=STRresult_searchSTR;STRaSTRhrefSTR"; } | /**
* Searches for the manga name and returns the URL.
* @param searchTerm The name of the Manga
* @return The URL
* @throws IOException if something goes wrong
*/ | Searches for the manga name and returns the URL | searchForManga | {
"repo_name": "Skylion007/java-manga-reader",
"path": "src/org/skylion/mangareader/mangaengine/MangaHereAPI.java",
"license": "gpl-3.0",
"size": 15359
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 307,897 |
@Override
protected List<ColumnDescription> getColumnDescriptions(PortletExecutionAggregationDiscriminator reportColumnDiscriminator,
PortletExecutionReportForm form) {
int groupSize = form.getGroups().size();
int portletSize = form.getPortlets().size();
int executionTypeSize = form.getExecutionTypeNames().size();
String portletName = reportColumnDiscriminator.getPortletMapping().getFname();
String groupName = reportColumnDiscriminator.getAggregatedGroup().getGroupName();
String executionTypeName = reportColumnDiscriminator.getExecutionType().getName();
TitleAndCount[] items = new TitleAndCount[] {
new TitleAndCount(portletName, portletSize),
new TitleAndCount(executionTypeName, executionTypeSize),
new TitleAndCount(groupName, groupSize)
};
return titleAndColumnDescriptionStrategy.getColumnDescriptions(items, showFullColumnHeaderDescriptions(form), form);
} | List<ColumnDescription> function(PortletExecutionAggregationDiscriminator reportColumnDiscriminator, PortletExecutionReportForm form) { int groupSize = form.getGroups().size(); int portletSize = form.getPortlets().size(); int executionTypeSize = form.getExecutionTypeNames().size(); String portletName = reportColumnDiscriminator.getPortletMapping().getFname(); String groupName = reportColumnDiscriminator.getAggregatedGroup().getGroupName(); String executionTypeName = reportColumnDiscriminator.getExecutionType().getName(); TitleAndCount[] items = new TitleAndCount[] { new TitleAndCount(portletName, portletSize), new TitleAndCount(executionTypeName, executionTypeSize), new TitleAndCount(groupName, groupSize) }; return titleAndColumnDescriptionStrategy.getColumnDescriptions(items, showFullColumnHeaderDescriptions(form), form); } | /**
* Create column descriptions for the portlet report using the configured report
* labelling strategy.
*
* @param reportColumnDiscriminator
* @param form The original query form
* @return
*/ | Create column descriptions for the portlet report using the configured report labelling strategy | getColumnDescriptions | {
"repo_name": "ASU-Capstone/uPortal-Forked",
"path": "uportal-war/src/main/java/org/jasig/portal/portlets/statistics/PortletExecutionStatisticsController.java",
"license": "apache-2.0",
"size": 13128
} | [
"com.google.visualization.datasource.datatable.ColumnDescription",
"java.util.List",
"org.jasig.portal.events.aggr.portletexec.PortletExecutionAggregationDiscriminator",
"org.jasig.portal.portlets.statistics.ReportTitleAndColumnDescriptionStrategy"
] | import com.google.visualization.datasource.datatable.ColumnDescription; import java.util.List; import org.jasig.portal.events.aggr.portletexec.PortletExecutionAggregationDiscriminator; import org.jasig.portal.portlets.statistics.ReportTitleAndColumnDescriptionStrategy; | import com.google.visualization.datasource.datatable.*; import java.util.*; import org.jasig.portal.events.aggr.portletexec.*; import org.jasig.portal.portlets.statistics.*; | [
"com.google.visualization",
"java.util",
"org.jasig.portal"
] | com.google.visualization; java.util; org.jasig.portal; | 2,477,371 |
public List<String> getAllClusterNodeAddresses() {
if (AndesContext.getInstance().isClusteringEnabled()) {
return clusterAgent.getAllClusterNodeAddresses();
}
return new ArrayList<>();
} | List<String> function() { if (AndesContext.getInstance().isClusteringEnabled()) { return clusterAgent.getAllClusterNodeAddresses(); } return new ArrayList<>(); } | /**
* Gets address of all the members in the cluster. i.e address:port
*
* @return A list of address of the nodes in a cluster
*/ | Gets address of all the members in the cluster. i.e address:port | getAllClusterNodeAddresses | {
"repo_name": "ThilankaBowala/andes",
"path": "modules/andes-core/broker/src/main/java/org/wso2/andes/server/cluster/ClusterManager.java",
"license": "apache-2.0",
"size": 11017
} | [
"java.util.ArrayList",
"java.util.List",
"org.wso2.andes.kernel.AndesContext"
] | import java.util.ArrayList; import java.util.List; import org.wso2.andes.kernel.AndesContext; | import java.util.*; import org.wso2.andes.kernel.*; | [
"java.util",
"org.wso2.andes"
] | java.util; org.wso2.andes; | 284,991 |
private void generatePostamble() {
out.popIndent();
out.printil("} catch (java.lang.Throwable t) {");
out.pushIndent();
out.printil("if (!(t instanceof javax.servlet.jsp.SkipPageException)){");
out.pushIndent();
out.printil("out = _jspx_out;");
out.printil("if (out != null && out.getBufferSize() != 0)");
out.pushIndent();
out.printil("try {");
out.pushIndent();
out.printil("if (response.isCommitted()) {");
out.pushIndent();
out.printil("out.flush();");
out.popIndent();
out.printil("} else {");
out.pushIndent();
out.printil("out.clearBuffer();");
out.popIndent();
out.printil("}");
out.popIndent();
out.printil("} catch (java.io.IOException e) {}");
out.popIndent();
out.printil("if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);");
out.printil("else throw new ServletException(t);");
out.popIndent();
out.printil("}");
out.popIndent();
out.printil("} finally {");
out.pushIndent();
out.printil("_jspxFactory.releasePageContext(_jspx_page_context);");
out.popIndent();
out.printil("}");
// Close the service method
out.popIndent();
out.printil("}");
// Generated methods, helper classes, etc.
genCommonPostamble();
}
Generator(ServletWriter out, Compiler compiler) throws JasperException {
this.out = out;
methodsBuffered = new ArrayList<>();
charArrayBuffer = null;
err = compiler.getErrorDispatcher();
ctxt = compiler.getCompilationContext();
fragmentHelperClass = new FragmentHelperClass("Helper");
pageInfo = compiler.getPageInfo();
ELInterpreter elInterpreter = null;
try {
elInterpreter = ELInterpreterFactory.getELInterpreter(
compiler.getCompilationContext().getServletContext());
} catch (Exception e) {
err.jspError("jsp.error.el_interpreter_class.instantiation",
e.getMessage());
}
this.elInterpreter = elInterpreter;
if (pageInfo.getExtends(false) == null || POOL_TAGS_WITH_EXTENDS) {
isPoolingEnabled = ctxt.getOptions().isPoolingEnabled();
} else {
isPoolingEnabled = false;
}
beanInfo = pageInfo.getBeanRepository();
varInfoNames = pageInfo.getVarInfoNames();
breakAtLF = ctxt.getOptions().getMappedFile();
if (isPoolingEnabled) {
tagHandlerPoolNames = new Vector<>();
} else {
tagHandlerPoolNames = null;
}
timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
timestampFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
} | void function() { out.popIndent(); out.printil(STR); out.pushIndent(); out.printil(STR); out.pushIndent(); out.printil(STR); out.printil(STR); out.pushIndent(); out.printil(STR); out.pushIndent(); out.printil(STR); out.pushIndent(); out.printil(STR); out.popIndent(); out.printil(STR); out.pushIndent(); out.printil(STR); out.popIndent(); out.printil("}"); out.popIndent(); out.printil(STR); out.popIndent(); out.printil(STR); out.printil(STR); out.popIndent(); out.printil("}"); out.popIndent(); out.printil(STR); out.pushIndent(); out.printil(STR); out.popIndent(); out.printil("}"); out.popIndent(); out.printil("}"); genCommonPostamble(); } Generator(ServletWriter out, Compiler compiler) throws JasperException { this.out = out; methodsBuffered = new ArrayList<>(); charArrayBuffer = null; err = compiler.getErrorDispatcher(); ctxt = compiler.getCompilationContext(); fragmentHelperClass = new FragmentHelperClass(STR); pageInfo = compiler.getPageInfo(); ELInterpreter elInterpreter = null; try { elInterpreter = ELInterpreterFactory.getELInterpreter( compiler.getCompilationContext().getServletContext()); } catch (Exception e) { err.jspError(STR, e.getMessage()); } this.elInterpreter = elInterpreter; if (pageInfo.getExtends(false) == null POOL_TAGS_WITH_EXTENDS) { isPoolingEnabled = ctxt.getOptions().isPoolingEnabled(); } else { isPoolingEnabled = false; } beanInfo = pageInfo.getBeanRepository(); varInfoNames = pageInfo.getVarInfoNames(); breakAtLF = ctxt.getOptions().getMappedFile(); if (isPoolingEnabled) { tagHandlerPoolNames = new Vector<>(); } else { tagHandlerPoolNames = null; } timestampFormat = new SimpleDateFormat(STR); timestampFormat.setTimeZone(TimeZone.getTimeZone("UTC")); } | /**
* Generates the ending part of the static portion of the servlet.
*/ | Generates the ending part of the static portion of the servlet | generatePostamble | {
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.22/Generator.java",
"license": "mit",
"size": 173069
} | [
"java.text.SimpleDateFormat",
"java.util.ArrayList",
"java.util.TimeZone",
"java.util.Vector",
"org.apache.jasper.JasperException"
] | import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.TimeZone; import java.util.Vector; import org.apache.jasper.JasperException; | import java.text.*; import java.util.*; import org.apache.jasper.*; | [
"java.text",
"java.util",
"org.apache.jasper"
] | java.text; java.util; org.apache.jasper; | 600,423 |
public Document findById(String _id, QueryCondition condition, String...fieldPaths) throws StoreException; | Document function(String _id, QueryCondition condition, String...fieldPaths) throws StoreException; | /**
* Returns the Document with the given `_id` if it matches the specified condition. If a Document
* with the specified `_id` does not exist in this DocumentStore or does not satisfy the specified
* condition, {@code null} is returned. The returned Document will include only the specified fields.
*
* @param _id document id
* @param fieldPaths list of fields that should be returned in the read document
* @param condition query condition to test the document
*
* @return an OJAI Document with the specified _id
*
* @throws StoreException
*/ | Returns the Document with the given `_id` if it matches the specified condition. If a Document with the specified `_id` does not exist in this DocumentStore or does not satisfy the specified condition, null is returned. The returned Document will include only the specified fields | findById | {
"repo_name": "ojai/ojai",
"path": "java/core/src/main/java/org/ojai/store/DocumentStore.java",
"license": "apache-2.0",
"size": 43225
} | [
"org.ojai.Document",
"org.ojai.store.exceptions.StoreException"
] | import org.ojai.Document; import org.ojai.store.exceptions.StoreException; | import org.ojai.*; import org.ojai.store.exceptions.*; | [
"org.ojai",
"org.ojai.store"
] | org.ojai; org.ojai.store; | 998,650 |
public ImageView getImage(int index) {
return viewFetcher.getView(ImageView.class, index);
}
| ImageView function(int index) { return viewFetcher.getView(ImageView.class, index); } | /**
* Returns an ImageView with a given index.
*
* @param index the index of the {@link ImageView}. {@code 0} if only one is available
* @return the {@link ImageView} with a specified index or {@code null} if index is invalid
*
*/ | Returns an ImageView with a given index | getImage | {
"repo_name": "bghtrbb/robotium",
"path": "robotium-solo/src/main/java/com/jayway/android/robotium/solo/Solo.java",
"license": "apache-2.0",
"size": 58591
} | [
"android.widget.ImageView"
] | import android.widget.ImageView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 557,222 |
String from=sendMailInformation.getFromAddress();
String user=sendMailInformation.getUser();
String host=sendMailInformation.getHost();
Properties properties = new Properties();
// set host
properties.put(MAIL_SMTP_HOST, host);
// set authenticator true
properties.put(MAIL_SMTP_AUTH, true);
Session session = Session.getDefaultInstance(properties);
// debug mode
session.setDebug(DEBUG);
MimeMessage message = new MimeMessage(session);
// from address
message.setFrom(new InternetAddress(from));
// to address
List<ToAddress> toAddressList=sendMailInformation.getToAddressList();
for(ToAddress to:toAddressList){
ToAddress.Type type=to.getType();
InternetAddress address=new InternetAddress(to.getAddress());
switch(type){
case TO:
message.addRecipient(Message.RecipientType.TO, address);
break;
case BCC:
message.addRecipient(Message.RecipientType.BCC, address);
break;
case CC:
message.addRecipient(Message.RecipientType.CC, address);
break;
}
}
// set subject
message.setSubject(sendMailInformation.getSubject());
// send date
message.setSentDate(new Date());
// 向multipart对象中添加邮件的各个部分内容,包括文本内容和附件
Multipart multipart = new MimeMultipart();
// set text content
BodyPart bodyPart = new MimeBodyPart();
// bodyPart.setText(sendMailInformation.getText());
bodyPart.setContent(sendMailInformation.getContent(), "text/html;charset=UTF-8");
multipart.addBodyPart(bodyPart);
List<String> accessoryPathList=sendMailInformation.getAccessoryPathList();
for(String accessoryPath:accessoryPathList){
if(StringUtil.isNotBlank(accessoryPath)){
// add body part
BodyPart messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(accessoryPath);
// set accessories file
messageBodyPart.setDataHandler(new DataHandler(source));
// set accessories name
messageBodyPart.setFileName(MimeUtility.encodeText(source.getName()));
multipart.addBodyPart(messageBodyPart);
}
}
// set content
message.setContent(multipart);
// save mail
message.saveChanges();
// get transport
Transport transport = session.getTransport(SMTP);
// connection
transport.connect(host, user,sendMailInformation.getPassword());
// send mail
MailcapCommandMap commandMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
commandMap.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
commandMap.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
commandMap.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
commandMap.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
commandMap.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
CommandMap.setDefaultCommandMap(commandMap);
transport.sendMessage(message, message.getAllRecipients());
transport.close();
}
| String from=sendMailInformation.getFromAddress(); String user=sendMailInformation.getUser(); String host=sendMailInformation.getHost(); Properties properties = new Properties(); properties.put(MAIL_SMTP_HOST, host); properties.put(MAIL_SMTP_AUTH, true); Session session = Session.getDefaultInstance(properties); session.setDebug(DEBUG); MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); List<ToAddress> toAddressList=sendMailInformation.getToAddressList(); for(ToAddress to:toAddressList){ ToAddress.Type type=to.getType(); InternetAddress address=new InternetAddress(to.getAddress()); switch(type){ case TO: message.addRecipient(Message.RecipientType.TO, address); break; case BCC: message.addRecipient(Message.RecipientType.BCC, address); break; case CC: message.addRecipient(Message.RecipientType.CC, address); break; } } message.setSubject(sendMailInformation.getSubject()); message.setSentDate(new Date()); Multipart multipart = new MimeMultipart(); BodyPart bodyPart = new MimeBodyPart(); bodyPart.setContent(sendMailInformation.getContent(), STR); multipart.addBodyPart(bodyPart); List<String> accessoryPathList=sendMailInformation.getAccessoryPathList(); for(String accessoryPath:accessoryPathList){ if(StringUtil.isNotBlank(accessoryPath)){ BodyPart messageBodyPart = new MimeBodyPart(); DataSource source = new FileDataSource(accessoryPath); messageBodyPart.setDataHandler(new DataHandler(source)); messageBodyPart.setFileName(MimeUtility.encodeText(source.getName())); multipart.addBodyPart(messageBodyPart); } } message.setContent(multipart); message.saveChanges(); Transport transport = session.getTransport(SMTP); transport.connect(host, user,sendMailInformation.getPassword()); MailcapCommandMap commandMap = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); commandMap.addMailcap(STR); commandMap.addMailcap(STR); commandMap.addMailcap(STR); commandMap.addMailcap(STR); commandMap.addMailcap(STR); CommandMap.setDefaultCommandMap(commandMap); transport.sendMessage(message, message.getAllRecipients()); transport.close(); } | /**
* send mail
* @param sendMailInformation
* @throws Exception
*/ | send mail | send | {
"repo_name": "oneliang/common-util",
"path": "src/main/java/com/oneliang/util/mail/Mail.java",
"license": "apache-2.0",
"size": 6380
} | [
"com.oneliang.util.common.StringUtil",
"java.util.Date",
"java.util.List",
"java.util.Properties",
"javax.activation.CommandMap",
"javax.activation.DataHandler",
"javax.activation.DataSource",
"javax.activation.FileDataSource",
"javax.activation.MailcapCommandMap",
"javax.mail.BodyPart",
"javax.mail.Message",
"javax.mail.Multipart",
"javax.mail.Session",
"javax.mail.Transport",
"javax.mail.internet.InternetAddress",
"javax.mail.internet.MimeBodyPart",
"javax.mail.internet.MimeMessage",
"javax.mail.internet.MimeMultipart",
"javax.mail.internet.MimeUtility"
] | import com.oneliang.util.common.StringUtil; import java.util.Date; import java.util.List; import java.util.Properties; import javax.activation.CommandMap; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.activation.FileDataSource; import javax.activation.MailcapCommandMap; import javax.mail.BodyPart; import javax.mail.Message; import javax.mail.Multipart; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.internet.MimeUtility; | import com.oneliang.util.common.*; import java.util.*; import javax.activation.*; import javax.mail.*; import javax.mail.internet.*; | [
"com.oneliang.util",
"java.util",
"javax.activation",
"javax.mail"
] | com.oneliang.util; java.util; javax.activation; javax.mail; | 557,726 |
public String getDataType()
{
String datatype = null;
if (Property.this.getTypeName() != null)
{
datatype = Property.this.getTypeName().getName();
}
if (datatype == null || datatype.equals(DataTypeDefinition.ANY.toString()))
{
if (value != null)
{
DataTypeDefinition dataTypeDefinition = getDictionaryService().getDataType(value.getClass());
if (dataTypeDefinition != null)
{
datatype = getDictionaryService().getDataType(value.getClass()).getName().toString();
}
}
}
return datatype;
} | String function() { String datatype = null; if (Property.this.getTypeName() != null) { datatype = Property.this.getTypeName().getName(); } if (datatype == null datatype.equals(DataTypeDefinition.ANY.toString())) { if (value != null) { DataTypeDefinition dataTypeDefinition = getDictionaryService().getDataType(value.getClass()); if (dataTypeDefinition != null) { datatype = getDictionaryService().getDataType(value.getClass()).getName().toString(); } } } return datatype; } | /**
* Gets the value datatype
*
* @return the value datatype
*/ | Gets the value datatype | getDataType | {
"repo_name": "Kast0rTr0y/community-edition",
"path": "projects/remote-api/source/java/org/alfresco/repo/web/scripts/admin/NodeBrowserPost.java",
"license": "lgpl-3.0",
"size": 46014
} | [
"org.alfresco.service.cmr.dictionary.DataTypeDefinition"
] | import org.alfresco.service.cmr.dictionary.DataTypeDefinition; | import org.alfresco.service.cmr.dictionary.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 783,078 |
public void onLivingUpdate()
{
if (this.worldObj.isDaytime() && !this.worldObj.isRemote && !this.isChild())
{
float f = this.getBrightness(1.0F);
BlockPos blockpos = new BlockPos(this.posX, (double)Math.round(this.posY), this.posZ);
if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canSeeSky(blockpos))
{
boolean flag = true;
ItemStack itemstack = this.getEquipmentInSlot(4);
if (itemstack != null)
{
if (itemstack.isItemStackDamageable())
{
itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2));
if (itemstack.getItemDamage() >= itemstack.getMaxDamage())
{
this.renderBrokenItemStack(itemstack);
this.setCurrentItemOrArmor(4, (ItemStack)null);
}
}
flag = false;
}
if (flag)
{
this.setFire(8);
}
}
}
if (this.isRiding() && this.getAttackTarget() != null && this.ridingEntity instanceof EntityChicken)
{
((EntityLiving)this.ridingEntity).getNavigator().setPath(this.getNavigator().getPath(), 1.5D);
}
super.onLivingUpdate();
} | void function() { if (this.worldObj.isDaytime() && !this.worldObj.isRemote && !this.isChild()) { float f = this.getBrightness(1.0F); BlockPos blockpos = new BlockPos(this.posX, (double)Math.round(this.posY), this.posZ); if (f > 0.5F && this.rand.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.worldObj.canSeeSky(blockpos)) { boolean flag = true; ItemStack itemstack = this.getEquipmentInSlot(4); if (itemstack != null) { if (itemstack.isItemStackDamageable()) { itemstack.setItemDamage(itemstack.getItemDamage() + this.rand.nextInt(2)); if (itemstack.getItemDamage() >= itemstack.getMaxDamage()) { this.renderBrokenItemStack(itemstack); this.setCurrentItemOrArmor(4, (ItemStack)null); } } flag = false; } if (flag) { this.setFire(8); } } } if (this.isRiding() && this.getAttackTarget() != null && this.ridingEntity instanceof EntityChicken) { ((EntityLiving)this.ridingEntity).getNavigator().setPath(this.getNavigator().getPath(), 1.5D); } super.onLivingUpdate(); } | /**
* Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
* use this to react to sunlight and start to burn.
*/ | Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons use this to react to sunlight and start to burn | onLivingUpdate | {
"repo_name": "SkidJava/BaseClient",
"path": "new_1.8.8/net/minecraft/entity/monster/EntityZombie.java",
"license": "gpl-2.0",
"size": 28653
} | [
"net.minecraft.entity.EntityLiving",
"net.minecraft.entity.passive.EntityChicken",
"net.minecraft.item.ItemStack",
"net.minecraft.util.BlockPos"
] | import net.minecraft.entity.EntityLiving; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.item.ItemStack; import net.minecraft.util.BlockPos; | import net.minecraft.entity.*; import net.minecraft.entity.passive.*; import net.minecraft.item.*; import net.minecraft.util.*; | [
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.util"
] | net.minecraft.entity; net.minecraft.item; net.minecraft.util; | 2,224,390 |
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<IntegrationServiceEnvironmentSkuDefinitionInner> listAsync(
String resourceGroup, String integrationServiceEnvironmentName, Context context) {
return new PagedFlux<>(
() -> listSinglePageAsync(resourceGroup, integrationServiceEnvironmentName, context),
nextLink -> listNextSinglePageAsync(nextLink, context));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<IntegrationServiceEnvironmentSkuDefinitionInner> function( String resourceGroup, String integrationServiceEnvironmentName, Context context) { return new PagedFlux<>( () -> listSinglePageAsync(resourceGroup, integrationServiceEnvironmentName, context), nextLink -> listNextSinglePageAsync(nextLink, context)); } | /**
* Gets a list of integration service environment Skus.
*
* @param resourceGroup The resource group.
* @param integrationServiceEnvironmentName The integration service environment name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of integration service environment Skus.
*/ | Gets a list of integration service environment Skus | listAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/logic/azure-resourcemanager-logic/src/main/java/com/azure/resourcemanager/logic/implementation/IntegrationServiceEnvironmentSkusClientImpl.java",
"license": "mit",
"size": 16915
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.core.util.Context",
"com.azure.resourcemanager.logic.fluent.models.IntegrationServiceEnvironmentSkuDefinitionInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.core.util.Context; import com.azure.resourcemanager.logic.fluent.models.IntegrationServiceEnvironmentSkuDefinitionInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.logic.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,787,370 |
private Stream<String> getKeysStream() {
val cursor = client.getConnectionFactory().getConnection()
.scan(ScanOptions.scanOptions().match(getPatternTicketRedisKey())
.count(SCAN_COUNT)
.build());
return StreamSupport
.stream(Spliterators.spliteratorUnknownSize(cursor, Spliterator.ORDERED), false)
.map(key -> (String) client.getKeySerializer().deserialize(key))
.collect(Collectors.toSet())
.stream()
.onClose(() -> {
try {
cursor.close();
} catch (final IOException e) {
LOGGER.error("Could not close Redis connection", e);
}
});
} | Stream<String> function() { val cursor = client.getConnectionFactory().getConnection() .scan(ScanOptions.scanOptions().match(getPatternTicketRedisKey()) .count(SCAN_COUNT) .build()); return StreamSupport .stream(Spliterators.spliteratorUnknownSize(cursor, Spliterator.ORDERED), false) .map(key -> (String) client.getKeySerializer().deserialize(key)) .collect(Collectors.toSet()) .stream() .onClose(() -> { try { cursor.close(); } catch (final IOException e) { LOGGER.error(STR, e); } }); } | /**
* Get a stream of all CAS-related keys from Redis DB.
*
* @return stream of all CAS-related keys from Redis DB
*/ | Get a stream of all CAS-related keys from Redis DB | getKeysStream | {
"repo_name": "rrenomeron/cas",
"path": "support/cas-server-support-redis-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/RedisTicketRegistry.java",
"license": "apache-2.0",
"size": 6069
} | [
"java.io.IOException",
"java.util.Spliterator",
"java.util.Spliterators",
"java.util.stream.Collectors",
"java.util.stream.Stream",
"java.util.stream.StreamSupport",
"org.springframework.data.redis.core.ScanOptions"
] | import java.io.IOException; import java.util.Spliterator; import java.util.Spliterators; import java.util.stream.Collectors; import java.util.stream.Stream; import java.util.stream.StreamSupport; import org.springframework.data.redis.core.ScanOptions; | import java.io.*; import java.util.*; import java.util.stream.*; import org.springframework.data.redis.core.*; | [
"java.io",
"java.util",
"org.springframework.data"
] | java.io; java.util; org.springframework.data; | 2,355,393 |
void updateCount(INodesInPath iip, int numOfINodes,
QuotaCounts counts, boolean checkQuota)
throws QuotaExceededException {
assert hasWriteLock();
if (!namesystem.isImageLoaded()) {
//still initializing. do not check or update quotas.
return;
}
if (numOfINodes > iip.length()) {
numOfINodes = iip.length();
}
if (checkQuota && !skipQuotaCheck) {
verifyQuota(iip, numOfINodes, counts, null);
}
unprotectedUpdateCount(iip, numOfINodes, counts);
}
/**
* update quota of each inode and check to see if quota is exceeded.
* See {@link #updateCount(INodesInPath, int, QuotaCounts, boolean)} | void updateCount(INodesInPath iip, int numOfINodes, QuotaCounts counts, boolean checkQuota) throws QuotaExceededException { assert hasWriteLock(); if (!namesystem.isImageLoaded()) { return; } if (numOfINodes > iip.length()) { numOfINodes = iip.length(); } if (checkQuota && !skipQuotaCheck) { verifyQuota(iip, numOfINodes, counts, null); } unprotectedUpdateCount(iip, numOfINodes, counts); } /** * update quota of each inode and check to see if quota is exceeded. * See {@link #updateCount(INodesInPath, int, QuotaCounts, boolean)} | /** update count of each inode with quota
*
* @param iip inodes in a path
* @param numOfINodes the number of inodes to update starting from index 0
* @param counts the count of space/namespace/type usage to be update
* @param checkQuota if true then check if quota is exceeded
* @throws QuotaExceededException if the new count violates any quota limit
*/ | update count of each inode with quota | updateCount | {
"repo_name": "matrix-stone/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java",
"license": "apache-2.0",
"size": 57399
} | [
"org.apache.hadoop.hdfs.protocol.QuotaExceededException"
] | import org.apache.hadoop.hdfs.protocol.QuotaExceededException; | import org.apache.hadoop.hdfs.protocol.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 448,338 |
@Override
public Map<String, String> getNameMap() {
return nameMap;
} | Map<String, String> function() { return nameMap; } | /**
* Returns the name map which is unmodifiable; or null if there is none.
*/ | Returns the name map which is unmodifiable; or null if there is none | getNameMap | {
"repo_name": "flofreud/aws-sdk-java",
"path": "aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/xspec/UpdateItemExpressionSpec.java",
"license": "apache-2.0",
"size": 2650
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,389,396 |
public boolean hasAllPermissions(String... permissions) {
Subject subject = this.getSubject();
return subject == null ? false : subject.isPermittedAll(permissions);
} | boolean function(String... permissions) { Subject subject = this.getSubject(); return subject == null ? false : subject.isPermittedAll(permissions); } | /**
* Verify that the current user has all the following permissions.
*
* @param permissions
* @return
*/ | Verify that the current user has all the following permissions | hasAllPermissions | {
"repo_name": "CCAFS/ccafs-ap",
"path": "security/src/main/java/org/cgiar/ccafs/security/BaseSecurityContext.java",
"license": "gpl-3.0",
"size": 3932
} | [
"org.apache.shiro.subject.Subject"
] | import org.apache.shiro.subject.Subject; | import org.apache.shiro.subject.*; | [
"org.apache.shiro"
] | org.apache.shiro; | 1,636,035 |
public final StandardSubjectBuilder withMessage(@NullableDecl String messageToPrepend) {
return withMessage("%s", messageToPrepend);
} | final StandardSubjectBuilder function(@NullableDecl String messageToPrepend) { return withMessage("%s", messageToPrepend); } | /**
* Returns a new instance that will output the given message before the main failure message. If
* this method is called multiple times, the messages will appear in the order that they were
* specified.
*/ | Returns a new instance that will output the given message before the main failure message. If this method is called multiple times, the messages will appear in the order that they were specified | withMessage | {
"repo_name": "cgruber/truth",
"path": "core/src/main/java/com/google/common/truth/StandardSubjectBuilder.java",
"license": "apache-2.0",
"size": 8608
} | [
"org.checkerframework.checker.nullness.compatqual.NullableDecl"
] | import org.checkerframework.checker.nullness.compatqual.NullableDecl; | import org.checkerframework.checker.nullness.compatqual.*; | [
"org.checkerframework.checker"
] | org.checkerframework.checker; | 2,508,981 |
private void startRequest() throws IOException {
if (connected) {
return;
}
final UrlRequest.Builder requestBuilder = new UrlRequest.Builder(
getURL().toString(), new CronetUrlRequestCallback(), mMessageLoop, mCronetEngine);
if (doOutput) {
if (mOutputStream != null) {
requestBuilder.setUploadDataProvider(
mOutputStream.getUploadDataProvider(), mMessageLoop);
if (getRequestProperty(CONTENT_LENGTH) == null && !isChunkedUpload()) {
addRequestProperty(CONTENT_LENGTH,
Long.toString(mOutputStream.getUploadDataProvider().getLength()));
}
// Tells mOutputStream that startRequest() has been called, so
// the underlying implementation can prepare for reading if needed.
mOutputStream.setConnected();
} else {
if (getRequestProperty(CONTENT_LENGTH) == null) {
addRequestProperty(CONTENT_LENGTH, "0");
}
}
// Default Content-Type to application/x-www-form-urlencoded
if (getRequestProperty("Content-Type") == null) {
addRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
}
}
for (Pair<String, String> requestHeader : mRequestHeaders) {
requestBuilder.addHeader(requestHeader.first, requestHeader.second);
}
if (!getUseCaches()) {
requestBuilder.disableCache();
}
connected = true;
mRequest = requestBuilder.build();
// Start the request.
mRequest.start();
} | void function() throws IOException { if (connected) { return; } final UrlRequest.Builder requestBuilder = new UrlRequest.Builder( getURL().toString(), new CronetUrlRequestCallback(), mMessageLoop, mCronetEngine); if (doOutput) { if (mOutputStream != null) { requestBuilder.setUploadDataProvider( mOutputStream.getUploadDataProvider(), mMessageLoop); if (getRequestProperty(CONTENT_LENGTH) == null && !isChunkedUpload()) { addRequestProperty(CONTENT_LENGTH, Long.toString(mOutputStream.getUploadDataProvider().getLength())); } mOutputStream.setConnected(); } else { if (getRequestProperty(CONTENT_LENGTH) == null) { addRequestProperty(CONTENT_LENGTH, "0"); } } if (getRequestProperty(STR) == null) { addRequestProperty(STR, STR); } } for (Pair<String, String> requestHeader : mRequestHeaders) { requestBuilder.addHeader(requestHeader.first, requestHeader.second); } if (!getUseCaches()) { requestBuilder.disableCache(); } connected = true; mRequest = requestBuilder.build(); mRequest.start(); } | /**
* Starts the request if {@code connected} is false.
*/ | Starts the request if connected is false | startRequest | {
"repo_name": "Bysmyyr/chromium-crosswalk",
"path": "components/cronet/android/java/src/org/chromium/net/urlconnection/CronetHttpURLConnection.java",
"license": "bsd-3-clause",
"size": 19387
} | [
"android.util.Pair",
"java.io.IOException",
"org.chromium.net.UrlRequest"
] | import android.util.Pair; import java.io.IOException; import org.chromium.net.UrlRequest; | import android.util.*; import java.io.*; import org.chromium.net.*; | [
"android.util",
"java.io",
"org.chromium.net"
] | android.util; java.io; org.chromium.net; | 860,519 |
public static final byte[] serializeToBytes(final Object object) {
if (object == null)
throw new IllegalArgumentException("Object was null");
try {
return jsonMapper.writeValueAsBytes(object);
} catch (JsonProcessingException e) {
throw new JSONException(e);
}
}
| static final byte[] function(final Object object) { if (object == null) throw new IllegalArgumentException(STR); try { return jsonMapper.writeValueAsBytes(object); } catch (JsonProcessingException e) { throw new JSONException(e); } } | /**
* Serializes the given object to a JSON byte array
* @param object The object to serialize
* @return A JSON formatted byte array
* @throws IllegalArgumentException if the object was null
* @throws JSONException if the object could not be serialized
*/ | Serializes the given object to a JSON byte array | serializeToBytes | {
"repo_name": "nickman/PL-TSDB",
"path": "pltsdb-core/src/main/java/com/heliosapm/pltsdb/json/JSONOps.java",
"license": "apache-2.0",
"size": 33309
} | [
"com.fasterxml.jackson.core.JsonProcessingException"
] | import com.fasterxml.jackson.core.JsonProcessingException; | import com.fasterxml.jackson.core.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 659,588 |
public static ASN1ObjectIdentifier getOID(
String name)
{
return (ASN1ObjectIdentifier)objIds.get(Strings.toLowerCase(name));
} | static ASN1ObjectIdentifier function( String name) { return (ASN1ObjectIdentifier)objIds.get(Strings.toLowerCase(name)); } | /**
* return the object identifier signified by the passed in name. Null
* if there is no object identifier associated with name.
*
* @return the object identifier associated with name, if present.
*/ | return the object identifier signified by the passed in name. Null if there is no object identifier associated with name | getOID | {
"repo_name": "Skywalker-11/spongycastle",
"path": "core/src/main/java/org/spongycastle/asn1/anssi/ANSSINamedCurves.java",
"license": "mit",
"size": 3730
} | [
"org.spongycastle.asn1.ASN1ObjectIdentifier",
"org.spongycastle.util.Strings"
] | import org.spongycastle.asn1.ASN1ObjectIdentifier; import org.spongycastle.util.Strings; | import org.spongycastle.asn1.*; import org.spongycastle.util.*; | [
"org.spongycastle.asn1",
"org.spongycastle.util"
] | org.spongycastle.asn1; org.spongycastle.util; | 1,521,425 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
rightClickMenu = new javax.swing.JPopupMenu();
cutMenuItem = new javax.swing.JMenuItem();
copyMenuItem = new javax.swing.JMenuItem();
pasteMenuItem = new javax.swing.JMenuItem();
selectAllMenuItem = new javax.swing.JMenuItem();
sizeUnitComboBox = new javax.swing.JComboBox<String>();
sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance());
sizeCompareComboBox = new javax.swing.JComboBox<String>();
sizeCheckBox = new javax.swing.JCheckBox();
cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.cutMenuItem.text")); // NOI18N
rightClickMenu.add(cutMenuItem);
copyMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.copyMenuItem.text")); // NOI18N
rightClickMenu.add(copyMenuItem);
pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.pasteMenuItem.text")); // NOI18N
rightClickMenu.add(pasteMenuItem);
selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, "SizeSearchPanel.selectAllMenuItem.text")); // NOI18N
rightClickMenu.add(selectAllMenuItem);
sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { "Byte(s)", "KB", "MB", "GB", "TB" })); //NON-NLS | @SuppressWarnings(STR) void function() { rightClickMenu = new javax.swing.JPopupMenu(); cutMenuItem = new javax.swing.JMenuItem(); copyMenuItem = new javax.swing.JMenuItem(); pasteMenuItem = new javax.swing.JMenuItem(); selectAllMenuItem = new javax.swing.JMenuItem(); sizeUnitComboBox = new javax.swing.JComboBox<String>(); sizeTextField = new JFormattedTextField(NumberFormat.getIntegerInstance()); sizeCompareComboBox = new javax.swing.JComboBox<String>(); sizeCheckBox = new javax.swing.JCheckBox(); cutMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, STR)); rightClickMenu.add(cutMenuItem); copyMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, STR)); rightClickMenu.add(copyMenuItem); pasteMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, STR)); rightClickMenu.add(pasteMenuItem); selectAllMenuItem.setText(org.openide.util.NbBundle.getMessage(SizeSearchPanel.class, STR)); rightClickMenu.add(selectAllMenuItem); sizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel<String>(new String[] { STR, "KB", "MB", "GB", "TB" })); | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "eXcomm/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/filesearch/SizeSearchPanel.java",
"license": "apache-2.0",
"size": 7883
} | [
"java.text.NumberFormat",
"javax.swing.JCheckBox",
"javax.swing.JComboBox",
"javax.swing.JFormattedTextField",
"javax.swing.JMenuItem",
"org.openide.util.NbBundle"
] | import java.text.NumberFormat; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFormattedTextField; import javax.swing.JMenuItem; import org.openide.util.NbBundle; | import java.text.*; import javax.swing.*; import org.openide.util.*; | [
"java.text",
"javax.swing",
"org.openide.util"
] | java.text; javax.swing; org.openide.util; | 191,748 |
private void tryToGetAudioFocus() {
if (mAudioFocus != AudioFocus.FOCUS
&& mAudioManager != null
&& (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus( this,
AudioManager.STREAM_MUSIC,
AudioManager.AUDIOFOCUS_GAIN))
) {
mAudioFocus = AudioFocus.FOCUS;
}
} | void function() { if (mAudioFocus != AudioFocus.FOCUS && mAudioManager != null && (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == mAudioManager.requestAudioFocus( this, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN)) ) { mAudioFocus = AudioFocus.FOCUS; } } | /**
* Requests the audio focus to the Audio Manager
*/ | Requests the audio focus to the Audio Manager | tryToGetAudioFocus | {
"repo_name": "SmruthiManjunath/owncloud_friends",
"path": "src/com/owncloud/android/media/MediaService.java",
"license": "gpl-2.0",
"size": 26295
} | [
"android.media.AudioManager"
] | import android.media.AudioManager; | import android.media.*; | [
"android.media"
] | android.media; | 1,377,810 |
public StorageUnitNotificationRegistration updateStorageUnitNotificationRegistration(NotificationRegistrationKey notificationRegistrationKey,
StorageUnitNotificationRegistrationUpdateRequest request); | StorageUnitNotificationRegistration function(NotificationRegistrationKey notificationRegistrationKey, StorageUnitNotificationRegistrationUpdateRequest request); | /**
* Updates an existing storage unit notification by key.
*
* @param notificationRegistrationKey the storage unit notification registration key
*
* @return the storage unit notification registration that got updated
*/ | Updates an existing storage unit notification by key | updateStorageUnitNotificationRegistration | {
"repo_name": "kusid/herd",
"path": "herd-code/herd-service/src/main/java/org/finra/herd/service/StorageUnitNotificationRegistrationService.java",
"license": "apache-2.0",
"size": 3833
} | [
"org.finra.herd.model.api.xml.NotificationRegistrationKey",
"org.finra.herd.model.api.xml.StorageUnitNotificationRegistration",
"org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest"
] | import org.finra.herd.model.api.xml.NotificationRegistrationKey; import org.finra.herd.model.api.xml.StorageUnitNotificationRegistration; import org.finra.herd.model.api.xml.StorageUnitNotificationRegistrationUpdateRequest; | import org.finra.herd.model.api.xml.*; | [
"org.finra.herd"
] | org.finra.herd; | 560,491 |
public final void update(Element element) {
update(element.getAttribute("name"), element.getAttribute("address"),
Integer.parseInt(element.getAttribute("port")),
Integer.parseInt(element.getAttribute("slotsAvailable")),
Integer.parseInt(element.getAttribute("currentlyPlaying")),
Boolean.parseBoolean(element.getAttribute("slotsAvailable")),
element.getAttribute("version"),
Integer.parseInt(element.getAttribute("gameState")));
} | final void function(Element element) { update(element.getAttribute("name"), element.getAttribute(STR), Integer.parseInt(element.getAttribute("port")), Integer.parseInt(element.getAttribute(STR)), Integer.parseInt(element.getAttribute(STR)), Boolean.parseBoolean(element.getAttribute(STR)), element.getAttribute(STR), Integer.parseInt(element.getAttribute(STR))); } | /**
* Update the server info from an element.
*
* @param element The <code>Element</code> to update from.
*/ | Update the server info from an element | update | {
"repo_name": "edijman/SOEN_6431_Colonization_Game",
"path": "src/net/sf/freecol/common/ServerInfo.java",
"license": "gpl-2.0",
"size": 7394
} | [
"org.w3c.dom.Element"
] | import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,658,970 |
public void buildReport(Explanation explanation, Object stream) {
if (explanation == null) {
throw new ExplanationException("The entered explanation must not be null");
}
if (stream == null) {
throw new ExplanationException("The entered stream must not be null");
}
//Insert header into the report
insertHeader(explanation, stream);
//Get all explanation chunks
ArrayList<ExplanationChunk> chunks = explanation.getChunks();
//Transform explanation chunks and insert them into the report
for (int i = 0; i < chunks.size(); i++) {
//Get one chunk from the list
ExplanationChunk chunk = chunks.get(i);
//Get the appropriate chunk builder for this chunk
ReportChunkBuilder cbuilder = factory.getReportChunkBuilder(chunk);
//Transform chunk and insert it into the report
cbuilder.buildReportChunk(chunk, stream, insertChunkHeaders);
}
} | void function(Explanation explanation, Object stream) { if (explanation == null) { throw new ExplanationException(STR); } if (stream == null) { throw new ExplanationException(STR); } insertHeader(explanation, stream); ArrayList<ExplanationChunk> chunks = explanation.getChunks(); for (int i = 0; i < chunks.size(); i++) { ExplanationChunk chunk = chunks.get(i); ReportChunkBuilder cbuilder = factory.getReportChunkBuilder(chunk); cbuilder.buildReportChunk(chunk, stream, insertChunkHeaders); } } | /**
* Creates a report based on the provided explanation and writes it to the
* provided output stream.
*
* @param explanation the explanation that needs to be transformed into a
* report
* @param stream output stream to which the report is to be written
*
* @throws org.goodoldai.jeff.explanation.ExplanationException if any of the arguments are null
*/ | Creates a report based on the provided explanation and writes it to the provided output stream | buildReport | {
"repo_name": "bojantomic/jeff",
"path": "src/main/java/org/goodoldai/jeff/report/ReportBuilder.java",
"license": "lgpl-3.0",
"size": 6730
} | [
"java.util.ArrayList",
"org.goodoldai.jeff.explanation.Explanation",
"org.goodoldai.jeff.explanation.ExplanationChunk",
"org.goodoldai.jeff.explanation.ExplanationException"
] | import java.util.ArrayList; import org.goodoldai.jeff.explanation.Explanation; import org.goodoldai.jeff.explanation.ExplanationChunk; import org.goodoldai.jeff.explanation.ExplanationException; | import java.util.*; import org.goodoldai.jeff.explanation.*; | [
"java.util",
"org.goodoldai.jeff"
] | java.util; org.goodoldai.jeff; | 1,969,733 |
public synchronized void addTreeChangeListener(String treeName, TreeChangeListener listener) {
if (treeName == VALUE && this.hasNoListeners()) {
this.engageModels();
}
super.addTreeChangeListener(treeName, listener);
}
| synchronized void function(String treeName, TreeChangeListener listener) { if (treeName == VALUE && this.hasNoListeners()) { this.engageModels(); } super.addTreeChangeListener(treeName, listener); } | /**
* Extend to start listening to the models if necessary.
* @see org.eclipse.persistence.tools.workbench.utility.Model#addTreeChangeListener(String, TreeChangeListener)
*/ | Extend to start listening to the models if necessary | addTreeChangeListener | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "utils/eclipselink.utils.workbench/uitools/source/org/eclipse/persistence/tools/workbench/uitools/app/AspectAdapter.java",
"license": "epl-1.0",
"size": 13859
} | [
"org.eclipse.persistence.tools.workbench.utility.events.TreeChangeListener"
] | import org.eclipse.persistence.tools.workbench.utility.events.TreeChangeListener; | import org.eclipse.persistence.tools.workbench.utility.events.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 2,349,428 |
public void testSerialization() {
IntervalCategoryItemLabelGenerator g1
= new IntervalCategoryItemLabelGenerator(
"{3} - {4}", DateFormat.getInstance()
);
IntervalCategoryItemLabelGenerator g2 = null;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(g1);
out.close();
ObjectInput in = new ObjectInputStream(
new ByteArrayInputStream(buffer.toByteArray())
);
g2 = (IntervalCategoryItemLabelGenerator) in.readObject();
in.close();
}
catch (Exception e) {
System.out.println(e.toString());
}
assertEquals(g1, g2);
} | void function() { IntervalCategoryItemLabelGenerator g1 = new IntervalCategoryItemLabelGenerator( STR, DateFormat.getInstance() ); IntervalCategoryItemLabelGenerator g2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(g1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); g2 = (IntervalCategoryItemLabelGenerator) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(g1, g2); } | /**
* Serialize an instance, restore it, and check for equality.
*/ | Serialize an instance, restore it, and check for equality | testSerialization | {
"repo_name": "SpoonLabs/astor",
"path": "examples/chart_11/tests/org/jfree/chart/labels/junit/IntervalCategoryLabelGeneratorTests.java",
"license": "gpl-2.0",
"size": 5176
} | [
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.ObjectInput",
"java.io.ObjectInputStream",
"java.io.ObjectOutput",
"java.io.ObjectOutputStream",
"java.text.DateFormat",
"org.jfree.chart.labels.IntervalCategoryItemLabelGenerator"
] | import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import java.text.DateFormat; import org.jfree.chart.labels.IntervalCategoryItemLabelGenerator; | import java.io.*; import java.text.*; import org.jfree.chart.labels.*; | [
"java.io",
"java.text",
"org.jfree.chart"
] | java.io; java.text; org.jfree.chart; | 212,107 |
Observable<ServiceResponse<List<Double>>> getFloatValidAsync(); | Observable<ServiceResponse<List<Double>>> getFloatValidAsync(); | /**
* Get float array value [0, -0.01, 1.2e20].
*
* @return the observable to the List<Double> object
*/ | Get float array value [0, -0.01, 1.2e20] | getFloatValidAsync | {
"repo_name": "haocs/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodyarray/Arrays.java",
"license": "mit",
"size": 72234
} | [
"com.microsoft.rest.ServiceResponse",
"java.util.List"
] | import com.microsoft.rest.ServiceResponse; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 2,501,152 |
public static boolean isFileLocked(File file) {
boolean isLocked = false;
FileOutputStream input = null;
FileLock lock = null;
if (!file.exists()) {
return false;
}
try {
input = new FileOutputStream(file);
FileChannel fileChannel = input.getChannel();
lock = fileChannel.tryLock();
if (lock == null)
isLocked = true;
else
lock.release();
} catch (Exception e) {
if (e instanceof SecurityException)
// Can't write to file.
isLocked = true;
else if (e instanceof FileNotFoundException)
isLocked = false;
else if (e instanceof IOException)
isLocked = true;
// OverlappingFileLockException means that this JVM has it locked
// therefore it is not locked to us
else if (e instanceof OverlappingFileLockException)
isLocked = false;
// Could not get a lock for some other reason.
else
isLocked = true;
} finally {
if (input != null) {
try {
input.close();
} catch (Exception ex) {
}
}
}
return isLocked;
} | static boolean function(File file) { boolean isLocked = false; FileOutputStream input = null; FileLock lock = null; if (!file.exists()) { return false; } try { input = new FileOutputStream(file); FileChannel fileChannel = input.getChannel(); lock = fileChannel.tryLock(); if (lock == null) isLocked = true; else lock.release(); } catch (Exception e) { if (e instanceof SecurityException) isLocked = true; else if (e instanceof FileNotFoundException) isLocked = false; else if (e instanceof IOException) isLocked = true; else if (e instanceof OverlappingFileLockException) isLocked = false; else isLocked = true; } finally { if (input != null) { try { input.close(); } catch (Exception ex) { } } } return isLocked; } | /**
* Uses Java 1.4's FileLock class to test for a file lock
*
* @param file
* @return
*/ | Uses Java 1.4's FileLock class to test for a file lock | isFileLocked | {
"repo_name": "sakim/snownote",
"path": "org.eclipse.epf.richtext/src/org/eclipse/epf/common/utils/FileUtil.java",
"license": "epl-1.0",
"size": 27931
} | [
"java.io.File",
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.IOException",
"java.nio.channels.FileChannel",
"java.nio.channels.FileLock",
"java.nio.channels.OverlappingFileLockException"
] | import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.nio.channels.FileChannel; import java.nio.channels.FileLock; import java.nio.channels.OverlappingFileLockException; | import java.io.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,056,624 |
protected void emit_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
acceptNodes(transition, nodes);
}
| void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); } | /**
* Syntax:
* ('(' ')')?
*/ | Syntax: ('(' ')') | emit_XFunctionTypeRef___LeftParenthesisKeyword_0_0_RightParenthesisKeyword_0_2__q | {
"repo_name": "lunifera/lunifera-dsl",
"path": "org.lunifera.dsl.common.xtext/src-gen/org/lunifera/dsl/common/xtext/serializer/AbstractCommonGrammarSyntacticSequencer.java",
"license": "epl-1.0",
"size": 8390
} | [
"java.util.List",
"org.eclipse.emf.ecore.EObject",
"org.eclipse.xtext.nodemodel.INode",
"org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider"
] | import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider; | import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.xtext"
] | java.util; org.eclipse.emf; org.eclipse.xtext; | 733,243 |
@SuppressWarnings("unchecked")
public static List<Coche> getCoches(){
EntityManager em = factoria.createEntityManager();
// Hacemos la consulta.
Query q = em.createQuery("SELECT u FROM Coche u");
List<Coche> lc = q.getResultList();
// Cerramos el gestor.
em.close();
return lc;
} | @SuppressWarnings(STR) static List<Coche> function(){ EntityManager em = factoria.createEntityManager(); Query q = em.createQuery(STR); List<Coche> lc = q.getResultList(); em.close(); return lc; } | /**
* Obtener todos los coches de la base de datos.
*
* @return Devuelve la lista de los coches con sus atributos que
* hay en la base de datos.
* */ | Obtener todos los coches de la base de datos | getCoches | {
"repo_name": "alvaromm/CarService",
"path": "CarService/src/paquete/CocheDB.java",
"license": "gpl-2.0",
"size": 8610
} | [
"java.util.List",
"javax.persistence.EntityManager",
"javax.persistence.Query"
] | import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; | import java.util.*; import javax.persistence.*; | [
"java.util",
"javax.persistence"
] | java.util; javax.persistence; | 1,684,106 |
protected interface Sink {
void writeHeaders(Metadata metadata, @Nullable byte[] payload);
/**
* Sends an outbound frame to the remote end point.
*
* @param frame a buffer containing the chunk of data to be sent, or {@code null} if {@code
* endOfStream} with no data to send
* @param endOfStream {@code true} if this is the last frame; {@code flush} is guaranteed to be
* {@code true} if this is {@code true} | interface Sink { void function(Metadata metadata, @Nullable byte[] payload); /** * Sends an outbound frame to the remote end point. * * @param frame a buffer containing the chunk of data to be sent, or {@code null} if { * endOfStream} with no data to send * @param endOfStream {@code true} if this is the last frame; {@code flush} is guaranteed to be * {@code true} if this is {@code true} | /**
* Sends the request headers to the remote end point.
*
* @param metadata the metadata to be sent
* @param payload the payload needs to be sent in the headers if not null. Should only be used
* when sending an unary GET request
*/ | Sends the request headers to the remote end point | writeHeaders | {
"repo_name": "dapengzhang0/grpc-java",
"path": "core/src/main/java/io/grpc/internal/AbstractClientStream.java",
"license": "apache-2.0",
"size": 19093
} | [
"io.grpc.Metadata",
"javax.annotation.Nullable"
] | import io.grpc.Metadata; import javax.annotation.Nullable; | import io.grpc.*; import javax.annotation.*; | [
"io.grpc",
"javax.annotation"
] | io.grpc; javax.annotation; | 1,448,511 |
public Appender<ILoggingEvent> getAppender(String name) throws ReflectiveOperationException {
if (cache.containsKey(name)) {
return cache.get(name);
} else {
Appender<ILoggingEvent> appender = loader.load(name);
cache.put(name, appender);
return appender;
}
} | Appender<ILoggingEvent> function(String name) throws ReflectiveOperationException { if (cache.containsKey(name)) { return cache.get(name); } else { Appender<ILoggingEvent> appender = loader.load(name); cache.put(name, appender); return appender; } } | /**
* Provides the existing appender or loads the new one by appender name.
*
* @param name the name of the appender to load
* @return the loaded appender
*/ | Provides the existing appender or loads the new one by appender name | getAppender | {
"repo_name": "gnieh/logback-config",
"path": "src/main/java/org/gnieh/logback/config/ConfigAppendersCache.java",
"license": "apache-2.0",
"size": 1682
} | [
"ch.qos.logback.classic.spi.ILoggingEvent",
"ch.qos.logback.core.Appender"
] | import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.core.Appender; | import ch.qos.logback.classic.spi.*; import ch.qos.logback.core.*; | [
"ch.qos.logback"
] | ch.qos.logback; | 1,498,333 |
@Test(expected = InterruptedException.class)
public void whenClientTimeoutDetectedThenMainThreadIsInterrupted()
throws InterruptedException, IOException {
final long timeoutMillis = 100;
final long intervalMillis = timeoutMillis * 2; // Interval > timeout to trigger disconnection.
final ProjectWorkspace workspace =
TestDataHelper.createProjectWorkspaceForScenario(this, "exclusive_execution", tmp);
workspace.setUp();
// Build an NGContext connected to an NGInputStream reading from a stream that will timeout.
Thread.currentThread().setName("Test");
try (TestContext context =
new TestContext(
ImmutableMap.copyOf(System.getenv()),
TestContext.createHeartBeatStream(intervalMillis),
timeoutMillis)) {
Thread thread = Thread.currentThread();
context.addClientListener(
() -> {
Threads.interruptThread(thread);
});
Thread.sleep(1000);
fail("Should have been interrupted.");
}
} | @Test(expected = InterruptedException.class) void function() throws InterruptedException, IOException { final long timeoutMillis = 100; final long intervalMillis = timeoutMillis * 2; final ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, STR, tmp); workspace.setUp(); Thread.currentThread().setName("Test"); try (TestContext context = new TestContext( ImmutableMap.copyOf(System.getenv()), TestContext.createHeartBeatStream(intervalMillis), timeoutMillis)) { Thread thread = Thread.currentThread(); context.addClientListener( () -> { Threads.interruptThread(thread); }); Thread.sleep(1000); fail(STR); } } | /**
* Verifies that a client timeout will be detected by a Nailgun NGInputStream reading from a
* blocking heartbeat stream.
*/ | Verifies that a client timeout will be detected by a Nailgun NGInputStream reading from a blocking heartbeat stream | whenClientTimeoutDetectedThenMainThreadIsInterrupted | {
"repo_name": "marcinkwiatkowski/buck",
"path": "test/com/facebook/buck/cli/DaemonIntegrationTest.java",
"license": "apache-2.0",
"size": 25608
} | [
"com.facebook.buck.testutil.integration.ProjectWorkspace",
"com.facebook.buck.testutil.integration.TestContext",
"com.facebook.buck.testutil.integration.TestDataHelper",
"com.facebook.buck.util.Threads",
"com.google.common.collect.ImmutableMap",
"java.io.IOException",
"org.junit.Assert",
"org.junit.Test"
] | import com.facebook.buck.testutil.integration.ProjectWorkspace; import com.facebook.buck.testutil.integration.TestContext; import com.facebook.buck.testutil.integration.TestDataHelper; import com.facebook.buck.util.Threads; import com.google.common.collect.ImmutableMap; import java.io.IOException; import org.junit.Assert; import org.junit.Test; | import com.facebook.buck.testutil.integration.*; import com.facebook.buck.util.*; import com.google.common.collect.*; import java.io.*; import org.junit.*; | [
"com.facebook.buck",
"com.google.common",
"java.io",
"org.junit"
] | com.facebook.buck; com.google.common; java.io; org.junit; | 745,228 |
public Observable<ServiceResponse<Page<AuthorizationRuleInner>>> listAuthorizationRulesSinglePageAsync(final String resourceGroupName, final String namespaceName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (namespaceName == null) {
throw new IllegalArgumentException("Parameter namespaceName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<Page<AuthorizationRuleInner>>> function(final String resourceGroupName, final String namespaceName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (namespaceName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Authorization rules for a namespace.
*
ServiceResponse<PageImpl<AuthorizationRuleInner>> * @param resourceGroupName Name of the Resource group within the Azure subscription.
ServiceResponse<PageImpl<AuthorizationRuleInner>> * @param namespaceName The namespace name
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<AuthorizationRuleInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Authorization rules for a namespace | listAuthorizationRulesSinglePageAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/relay/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/NamespacesInner.java",
"license": "mit",
"size": 116946
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 862,603 |
@Override
public void setCreateDate(Date createDate) {
model.setCreateDate(createDate);
} | void function(Date createDate) { model.setCreateDate(createDate); } | /**
* Sets the create date of this clicks.
*
* @param createDate the create date of this clicks
*/ | Sets the create date of this clicks | setCreateDate | {
"repo_name": "peerkar/liferay-gsearch",
"path": "liferay-gsearch-workspace/modules/gsearch-click-tracking/gsearch-click-tracking-api/src/main/java/fi/soveltia/liferay/gsearch/click/tracking/model/ClicksWrapper.java",
"license": "lgpl-3.0",
"size": 6929
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,722,339 |
private Object extractTableFields(List<ScrapableField> fields, Element element, FIELD_TYPE type) throws PostProcessingException {
ArrayList extractedFields = new ArrayList();
Document temp_company_info = new Document();
for (int i = 0; i < fields.size(); i++) {
Document extracted_content = getSelectedElement(fields.get(i), element);
if (!extracted_content.getString("name").equals("") && extracted_content.get("value") != null && !extracted_content.get("value").toString().equals("") && extracted_content.get("value") != null) {
if (type.equals(FIELD_TYPE.COMPANY_INFO)) {
temp_company_info.append(extracted_content.getString("name"), extracted_content.get("value"));
} else {
extracted_content.append("source", source);
extractedFields.add(extracted_content);
}
}
}
if (type.equals(FIELD_TYPE.COMPANY_INFO) && !temp_company_info.isEmpty()) {
return temp_company_info;
} else if (type.equals(FIELD_TYPE.METRIC) && !extractedFields.isEmpty()) {
return extractedFields;
} else {
return new ArrayList();
}
}
| Object function(List<ScrapableField> fields, Element element, FIELD_TYPE type) throws PostProcessingException { ArrayList extractedFields = new ArrayList(); Document temp_company_info = new Document(); for (int i = 0; i < fields.size(); i++) { Document extracted_content = getSelectedElement(fields.get(i), element); if (!extracted_content.getString("name").equals(STRvalueSTRvalue").toString().equals(STRvalueSTRnameSTRvalueSTRsource", source); extractedFields.add(extracted_content); } } } if (type.equals(FIELD_TYPE.COMPANY_INFO) && !temp_company_info.isEmpty()) { return temp_company_info; } else if (type.equals(FIELD_TYPE.METRIC) && !extractedFields.isEmpty()) { return extractedFields; } else { return new ArrayList(); } } | /**
* extracts data from the specified table fields
*
* @param tableSelector: CSS table selector
* @param fields: list of table fields
* @return an ArrayList of HashMap (corresponds to the extracted table
* fields)
*/ | extracts data from the specified table fields | extractTableFields | {
"repo_name": "MKLab-ITI/easIE",
"path": "src/main/java/certh/iti/mklab/easie/extractors/TableFieldExtractor.java",
"license": "apache-2.0",
"size": 4222
} | [
"java.util.ArrayList",
"java.util.List",
"org.bson.Document",
"org.jsoup.nodes.Element"
] | import java.util.ArrayList; import java.util.List; import org.bson.Document; import org.jsoup.nodes.Element; | import java.util.*; import org.bson.*; import org.jsoup.nodes.*; | [
"java.util",
"org.bson",
"org.jsoup.nodes"
] | java.util; org.bson; org.jsoup.nodes; | 160,081 |
Future<Object> asyncCallbackRequestBody(String endpointUri, Object body, Synchronization onCompletion); | Future<Object> asyncCallbackRequestBody(String endpointUri, Object body, Synchronization onCompletion); | /**
* Sends an asynchronous body to the given endpoint.
* Uses an {@link ExchangePattern#InOut} message exchange pattern.
*
* @param endpointUri the endpoint URI to send the exchange to
* @param body the body to send
* @param onCompletion callback invoked when exchange has been completed
* @return a handle to be used to get the response in the future
*/ | Sends an asynchronous body to the given endpoint. Uses an <code>ExchangePattern#InOut</code> message exchange pattern | asyncCallbackRequestBody | {
"repo_name": "jmandawg/camel",
"path": "camel-core/src/main/java/org/apache/camel/ProducerTemplate.java",
"license": "apache-2.0",
"size": 55517
} | [
"java.util.concurrent.Future",
"org.apache.camel.spi.Synchronization"
] | import java.util.concurrent.Future; import org.apache.camel.spi.Synchronization; | import java.util.concurrent.*; import org.apache.camel.spi.*; | [
"java.util",
"org.apache.camel"
] | java.util; org.apache.camel; | 646,115 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.