method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private NSFCoverPageDocument getNSFCoverPage() { NSFCoverPageDocument nsfCoverPageDocument = NSFCoverPageDocument.Factory.newInstance(); NSFCoverPage nsfCoverPage = NSFCoverPage.Factory.newInstance(); nsfCoverPage.setFormVersion(FormVersion.v1_1.getVersion()); if (pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber() != null) { if (pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber().length() > PROGRAM_ANNOUNCEMENT_NUMBER_MAX_LENGTH) { nsfCoverPage.setFundingOpportunityNumber(pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber().substring(0, PROGRAM_ANNOUNCEMENT_NUMBER_MAX_LENGTH)); } else { nsfCoverPage.setFundingOpportunityNumber(pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber()); } } nsfCoverPage.setNSFUnitConsideration(getNSFUnitConsideration()); nsfCoverPage.setPIInfo(getPIInfo()); nsfCoverPage.setCoPIInfo(getCoPI()); nsfCoverPage.setOtherInfo(getOtherInfo()); AttachmentGroupMin1Max100DataType attachmentGroup = AttachmentGroupMin1Max100DataType.Factory.newInstance(); attachmentGroup.setAttachedFileArray(getAttachedFileDataTypes()); nsfCoverPage.setSingleCopyDocuments(attachmentGroup); nsfCoverPageDocument.setNSFCoverPage(nsfCoverPage); return nsfCoverPageDocument; }
NSFCoverPageDocument function() { NSFCoverPageDocument nsfCoverPageDocument = NSFCoverPageDocument.Factory.newInstance(); NSFCoverPage nsfCoverPage = NSFCoverPage.Factory.newInstance(); nsfCoverPage.setFormVersion(FormVersion.v1_1.getVersion()); if (pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber() != null) { if (pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber().length() > PROGRAM_ANNOUNCEMENT_NUMBER_MAX_LENGTH) { nsfCoverPage.setFundingOpportunityNumber(pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber().substring(0, PROGRAM_ANNOUNCEMENT_NUMBER_MAX_LENGTH)); } else { nsfCoverPage.setFundingOpportunityNumber(pdDoc.getDevelopmentProposal().getProgramAnnouncementNumber()); } } nsfCoverPage.setNSFUnitConsideration(getNSFUnitConsideration()); nsfCoverPage.setPIInfo(getPIInfo()); nsfCoverPage.setCoPIInfo(getCoPI()); nsfCoverPage.setOtherInfo(getOtherInfo()); AttachmentGroupMin1Max100DataType attachmentGroup = AttachmentGroupMin1Max100DataType.Factory.newInstance(); attachmentGroup.setAttachedFileArray(getAttachedFileDataTypes()); nsfCoverPage.setSingleCopyDocuments(attachmentGroup); nsfCoverPageDocument.setNSFCoverPage(nsfCoverPage); return nsfCoverPageDocument; }
/** * * This method returns NSFCoverPageDocument object based on proposal development document which contains the * NSFCoverPageDocument informations NSFUnitConsideration,FundingOpportunityNumber,PIInfo,CoPIInfo,OtherInfo,and * SingleCopyDocuments for a particular proposal * * @return nsfCoverPageDocument {@link XmlObject} of type NSFCoverPageDocument. */
This method returns NSFCoverPageDocument object based on proposal development document which contains the NSFCoverPageDocument informations NSFUnitConsideration,FundingOpportunityNumber,PIInfo,CoPIInfo,OtherInfo,and SingleCopyDocuments for a particular proposal
getNSFCoverPage
{ "repo_name": "kuali/kc-s2sgen", "path": "coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/NSFCoverPageV1_1Generator.java", "license": "agpl-3.0", "size": 17148 }
[ "gov.grants.apply.forms.nsfCoverPageV11.NSFCoverPageDocument", "gov.grants.apply.system.attachmentsV10.AttachmentGroupMin1Max100DataType", "org.kuali.coeus.s2sgen.impl.generate.FormVersion" ]
import gov.grants.apply.forms.nsfCoverPageV11.NSFCoverPageDocument; import gov.grants.apply.system.attachmentsV10.AttachmentGroupMin1Max100DataType; import org.kuali.coeus.s2sgen.impl.generate.FormVersion;
import gov.grants.apply.forms.*; import gov.grants.apply.system.*; import org.kuali.coeus.s2sgen.impl.generate.*;
[ "gov.grants.apply", "org.kuali.coeus" ]
gov.grants.apply; org.kuali.coeus;
1,892,229
@Description("The current number of created connections") public long getConnectionCreateCountTotal();
@Description(STR) long function();
/** * Returns the total number of created connections. */
Returns the total number of created connections
getConnectionCreateCountTotal
{ "repo_name": "CleverCloud/Quercus", "path": "resin/src/main/java/com/caucho/management/server/ConnectionPoolMXBean.java", "license": "gpl-2.0", "size": 4670 }
[ "com.caucho.jmx.Description" ]
import com.caucho.jmx.Description;
import com.caucho.jmx.*;
[ "com.caucho.jmx" ]
com.caucho.jmx;
2,686,737
protected void addXPropertyDescriptor(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor( ((ComposeableAdapterFactory) adapterFactory) .getRootAdapterFactory(), getResourceLocator(), getString("_UI_Point_x_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Point_x_feature", "_UI_Point_type"), DcPackage.Literals.POINT__X, true, false, false, ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add(createItemPropertyDescriptor( ((ComposeableAdapterFactory) adapterFactory) .getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), DcPackage.Literals.POINT__X, true, false, false, ItemPropertyDescriptor.REAL_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the X feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the X feature.
addXPropertyDescriptor
{ "repo_name": "adbrucker/SecureBPMN", "path": "designer/src/org.activiti.designer.model.edit/src/org/eclipse/dd/dc/provider/PointItemProvider.java", "license": "apache-2.0", "size": 5643 }
[ "org.eclipse.dd.dc.DcPackage", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.dd.dc.DcPackage; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.dd.dc.*; import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.dd", "org.eclipse.emf" ]
org.eclipse.dd; org.eclipse.emf;
727,812
private void makeTables() { // remove servers that are no longer available on any node removeUnusedServers(globalServers); removeUnusedServers(localServers); // create the new table widgets Grid table = new Grid(globalRows() + localRows(), serverCols()); // give some indication when there are no nodes if (nodes.size() == 0) { table.setText(0, 0, "No nodes are connected."); } else { table.setText(globalHeaderRow(), 0, "Global Servers"); table.setText(localHeaderRow(), 0, "Local Servers"); table.getCellFormatter().addStyleName(globalHeaderRow(), 0, "server-group"); table.getCellFormatter().addStyleName(localHeaderRow(), 0, "server-group"); } // create node controls in the column headers for (int col = 0; col < nodes.size(); col++) { table.setText(0, serverCol(col), nodes.get(col)); table.setWidget(0, serverCol(col), makeNodeControl(nodes.get(col))); table.getCellFormatter().setAlignment(0, serverCol(col), HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getCellFormatter().addStyleName(0, serverCol(col), "padded-cell"); } // add server names for the row headers for (int i = 0; i < globalServers.size(); i++) { table.setText(globalRow(i), 0, globalServers.get(i)); table.getCellFormatter().addStyleName(globalRow(i), 0, "server-name"); } for (int i = 0; i < localServers.size(); i++) { table.setText(localRow(i), 0, localServers.get(i)); table.getCellFormatter().addStyleName(localRow(i), 0, "server-name"); } // add instance controllers for available servers for (int i = 0; i < globalServers.size(); i++) { String server = globalServers.get(i); int row = globalRow(i); String version = null; boolean versionConflict = false; for (int col = 0; col < nodes.size(); col++) { String node = nodes.get(col); if (controllers.get(node).containsKey(server)) { InstanceController ic = controllers.get(node).get(server); table.setWidget(row, serverCol(col), ic); table.getCellFormatter().addStyleName(row, serverCol(col), "padded-cell"); if (version == null) { version = ic.getVersion(); } else if (!ic.getVersion().equals(version)) { versionConflict = true; } } } if (i % 2 == 0) table.getRowFormatter().addStyleName(row, "odd-row"); if (versionConflict) { table.getRowFormatter().addStyleName(row, "version-conflict"); table.setText(row, 1, "version conflict"); } else { table.setText(row, 1, version); } table.getCellFormatter().addStyleName(row, 1, "server-name"); } for (int i = 0; i < localServers.size(); i++) { String server = localServers.get(i); int row = localRow(i); String version = null; boolean versionConflict = false; for (int col = 0; col < nodes.size(); col++) { String node = nodes.get(col); if (controllers.get(node).containsKey(server)) { InstanceController ic = controllers.get(node).get(server); table.setWidget(row, serverCol(col), ic); table.getCellFormatter().addStyleName(row, serverCol(col), "padded-cell"); if (version == null) { version = ic.getVersion(); } else if (!ic.getVersion().equals(version)) { versionConflict = true; } } } if (i % 2 == 0) table.getRowFormatter().addStyleName(row, "odd-row"); if (versionConflict) { table.getRowFormatter().addStyleName(row, "version-conflict"); table.setText(row, 1, "version conflict"); } else { table.setText(row, 1, version); } table.getCellFormatter().addStyleName(row, 1, "server-name"); } // for all singleton servers, tell all instance controllers that // singletons are running somewhere so they can disable themselves for (String node : controllers.keySet()) { for (String server : controllers.get(node).keySet()) { InstanceController ic = controllers.get(node).get(server); if (ic.isLocal() || !ic.isRunning()) continue; // tell all controllers that this server is running NodeServerEvent e = new NodeServerStartedEvent(node, server, null); notifyInstanceControllers(e, InstanceStatus.STARTED); } } // add tables, removing previous tables if necessary if (this.table != null) { remove(this.table); } this.table = table; add(table); }
void function() { removeUnusedServers(globalServers); removeUnusedServers(localServers); Grid table = new Grid(globalRows() + localRows(), serverCols()); if (nodes.size() == 0) { table.setText(0, 0, STR); } else { table.setText(globalHeaderRow(), 0, STR); table.setText(localHeaderRow(), 0, STR); table.getCellFormatter().addStyleName(globalHeaderRow(), 0, STR); table.getCellFormatter().addStyleName(localHeaderRow(), 0, STR); } for (int col = 0; col < nodes.size(); col++) { table.setText(0, serverCol(col), nodes.get(col)); table.setWidget(0, serverCol(col), makeNodeControl(nodes.get(col))); table.getCellFormatter().setAlignment(0, serverCol(col), HasHorizontalAlignment.ALIGN_CENTER, HasVerticalAlignment.ALIGN_MIDDLE); table.getCellFormatter().addStyleName(0, serverCol(col), STR); } for (int i = 0; i < globalServers.size(); i++) { table.setText(globalRow(i), 0, globalServers.get(i)); table.getCellFormatter().addStyleName(globalRow(i), 0, STR); } for (int i = 0; i < localServers.size(); i++) { table.setText(localRow(i), 0, localServers.get(i)); table.getCellFormatter().addStyleName(localRow(i), 0, STR); } for (int i = 0; i < globalServers.size(); i++) { String server = globalServers.get(i); int row = globalRow(i); String version = null; boolean versionConflict = false; for (int col = 0; col < nodes.size(); col++) { String node = nodes.get(col); if (controllers.get(node).containsKey(server)) { InstanceController ic = controllers.get(node).get(server); table.setWidget(row, serverCol(col), ic); table.getCellFormatter().addStyleName(row, serverCol(col), STR); if (version == null) { version = ic.getVersion(); } else if (!ic.getVersion().equals(version)) { versionConflict = true; } } } if (i % 2 == 0) table.getRowFormatter().addStyleName(row, STR); if (versionConflict) { table.getRowFormatter().addStyleName(row, STR); table.setText(row, 1, STR); } else { table.setText(row, 1, version); } table.getCellFormatter().addStyleName(row, 1, STR); } for (int i = 0; i < localServers.size(); i++) { String server = localServers.get(i); int row = localRow(i); String version = null; boolean versionConflict = false; for (int col = 0; col < nodes.size(); col++) { String node = nodes.get(col); if (controllers.get(node).containsKey(server)) { InstanceController ic = controllers.get(node).get(server); table.setWidget(row, serverCol(col), ic); table.getCellFormatter().addStyleName(row, serverCol(col), STR); if (version == null) { version = ic.getVersion(); } else if (!ic.getVersion().equals(version)) { versionConflict = true; } } } if (i % 2 == 0) table.getRowFormatter().addStyleName(row, STR); if (versionConflict) { table.getRowFormatter().addStyleName(row, STR); table.setText(row, 1, STR); } else { table.setText(row, 1, version); } table.getCellFormatter().addStyleName(row, 1, STR); } for (String node : controllers.keySet()) { for (String server : controllers.get(node).keySet()) { InstanceController ic = controllers.get(node).get(server); if (ic.isLocal() !ic.isRunning()) continue; NodeServerEvent e = new NodeServerStartedEvent(node, server, null); notifyInstanceControllers(e, InstanceStatus.STARTED); } } if (this.table != null) { remove(this.table); } this.table = table; add(table); }
/** * Build the control panel table. * @param globalServers * @param nodes * @param info */
Build the control panel table
makeTables
{ "repo_name": "martinisgroup/jlabrad", "path": "LabradBrowser/src/org/labrad/browser/client/ControlPanel.java", "license": "gpl-2.0", "size": 16593 }
[ "com.google.gwt.user.client.ui.Grid", "com.google.gwt.user.client.ui.HasHorizontalAlignment", "com.google.gwt.user.client.ui.HasVerticalAlignment", "org.labrad.browser.client.event.NodeServerEvent", "org.labrad.browser.client.event.NodeServerStartedEvent" ]
import com.google.gwt.user.client.ui.Grid; import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HasVerticalAlignment; import org.labrad.browser.client.event.NodeServerEvent; import org.labrad.browser.client.event.NodeServerStartedEvent;
import com.google.gwt.user.client.ui.*; import org.labrad.browser.client.event.*;
[ "com.google.gwt", "org.labrad.browser" ]
com.google.gwt; org.labrad.browser;
635,676
public void getReport(int reportId) throws InterruptedException, ExecutionException, TimeoutException, IOException, StageException { int waitTime = 1000; Response response = null; while (!stop) { final AsyncInvoker asyncInvoker = getResource.request() .header(WSSE_HEADER, OmnitureAuthUtil.getHeader(username, sharedSecret)) .async(); LOG.debug("Getting report using URL {} with report ID {}", getResource.getUri().toURL().toString(), reportId); final Future<Response> responseFuture = asyncInvoker.post(Entity.json("{ \"reportID\": " + reportId + " }")); response = responseFuture.get(responseTimeoutMillis, TimeUnit.MILLISECONDS); String input = response.readEntity(String.class); ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree(input); // If the report has an error field, it means the report has not finished generating if (!root.has("error")) { boolean accepted = entityQueue.offer(input, responseTimeoutMillis, TimeUnit.MILLISECONDS); if (!accepted) { LOG.warn("Response buffer full, dropped record."); } break; } else { // Exponential backoff while making subsequent Report.Get requests if (root.get("error").textValue().equals("report_not_ready")) { waitTime *= 2; LOG.info("Report not available. Sleeping for {} seconds", waitTime / 1000); Thread.sleep(waitTime); } else { throw new StageException(Errors.OMNITURE_02, root.get("error").get("error_description").asText()); } } } response.close(); } public void stop() { stop = true; }
void function(int reportId) throws InterruptedException, ExecutionException, TimeoutException, IOException, StageException { int waitTime = 1000; Response response = null; while (!stop) { final AsyncInvoker asyncInvoker = getResource.request() .header(WSSE_HEADER, OmnitureAuthUtil.getHeader(username, sharedSecret)) .async(); LOG.debug(STR, getResource.getUri().toURL().toString(), reportId); final Future<Response> responseFuture = asyncInvoker.post(Entity.json(STRreportID\STR + reportId + STR)); response = responseFuture.get(responseTimeoutMillis, TimeUnit.MILLISECONDS); String input = response.readEntity(String.class); ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree(input); if (!root.has("error")) { boolean accepted = entityQueue.offer(input, responseTimeoutMillis, TimeUnit.MILLISECONDS); if (!accepted) { LOG.warn(STR); } break; } else { if (root.get("error").textValue().equals(STR)) { waitTime *= 2; LOG.info(STR, waitTime / 1000); Thread.sleep(waitTime); } else { throw new StageException(Errors.OMNITURE_02, root.get("error").get(STR).asText()); } } } response.close(); } public void stop() { stop = true; }
/** * Posts a request to the Omniture API to get a report back. Reports may take a while to generate, * so this will loop on the Report.Get request, and ignore any errors indicating that the report * is not yet ready. * @param reportId ID of report to get * @throws InterruptedException * @throws ExecutionException * @throws TimeoutException * @throws IOException */
Posts a request to the Omniture API to get a report back. Reports may take a while to generate, so this will loop on the Report.Get request, and ignore any errors indicating that the report is not yet ready
getReport
{ "repo_name": "kiritbasu/datacollector", "path": "basic-lib/src/main/java/com/streamsets/pipeline/stage/origin/omniture/OmniturePollingConsumer.java", "license": "apache-2.0", "size": 7306 }
[ "com.fasterxml.jackson.databind.JsonNode", "com.fasterxml.jackson.databind.ObjectMapper", "com.streamsets.pipeline.api.StageException", "java.io.IOException", "java.util.concurrent.ExecutionException", "java.util.concurrent.Future", "java.util.concurrent.TimeUnit", "java.util.concurrent.TimeoutException", "javax.ws.rs.client.AsyncInvoker", "javax.ws.rs.client.Entity", "javax.ws.rs.core.Response" ]
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.streamsets.pipeline.api.StageException; import java.io.IOException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import javax.ws.rs.client.AsyncInvoker; import javax.ws.rs.client.Entity; import javax.ws.rs.core.Response;
import com.fasterxml.jackson.databind.*; import com.streamsets.pipeline.api.*; import java.io.*; import java.util.concurrent.*; import javax.ws.rs.client.*; import javax.ws.rs.core.*;
[ "com.fasterxml.jackson", "com.streamsets.pipeline", "java.io", "java.util", "javax.ws" ]
com.fasterxml.jackson; com.streamsets.pipeline; java.io; java.util; javax.ws;
1,908,763
public CommitPolicy getDefaultTransactionCommitPolicy() { return _defaultCommitPolicy; }
CommitPolicy function() { return _defaultCommitPolicy; }
/** * This property can be configured with the configuration property * {@value #TRANSACTION_COMMIT_POLICY_NAME}. * * @return The default system commit policy. */
This property can be configured with the configuration property #TRANSACTION_COMMIT_POLICY_NAME
getDefaultTransactionCommitPolicy
{ "repo_name": "jaytaylor/persistit", "path": "src/main/java/com/persistit/Persistit.java", "license": "epl-1.0", "size": 92693 }
[ "com.persistit.Transaction" ]
import com.persistit.Transaction;
import com.persistit.*;
[ "com.persistit" ]
com.persistit;
840,498
public String getLabel( ItemStack stack );
String function( ItemStack stack );
/** * Get a string representing the label of this item. Will be called vi disk.getLabel() in lua. * @param stack The itemstack to inspect * @return The label. ie: "Dan's Programs" */
Get a string representing the label of this item. Will be called vi disk.getLabel() in lua
getLabel
{ "repo_name": "lyqyd/wirebox", "path": "src/dan200/computer/api/IMedia.java", "license": "mit", "size": 2537 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
1,768,698
private void createMediaPlayerIfNeeded() { LogHelper.d(TAG, "createMediaPlayerIfNeeded. needed? ", (mMediaPlayer==null)); if (mMediaPlayer == null) { mMediaPlayer = new MediaPlayer(); // Make sure the media player will acquire a wake-lock while // playing. If we don't do that, the CPU might go to sleep while the // song is playing, causing playback to stop. mMediaPlayer.setWakeMode(mService.getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); // we want the media player to notify us when it's ready preparing, // and when it's done playing: mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnErrorListener(this); mMediaPlayer.setOnSeekCompleteListener(this); } else { mMediaPlayer.reset(); } }
void function() { LogHelper.d(TAG, STR, (mMediaPlayer==null)); if (mMediaPlayer == null) { mMediaPlayer = new MediaPlayer(); mMediaPlayer.setWakeMode(mService.getApplicationContext(), PowerManager.PARTIAL_WAKE_LOCK); mMediaPlayer.setOnPreparedListener(this); mMediaPlayer.setOnCompletionListener(this); mMediaPlayer.setOnErrorListener(this); mMediaPlayer.setOnSeekCompleteListener(this); } else { mMediaPlayer.reset(); } }
/** * Makes sure the media player exists and has been reset. This will create * the media player if needed, or reset the existing media player if one * already exists. */
Makes sure the media player exists and has been reset. This will create the media player if needed, or reset the existing media player if one already exists
createMediaPlayerIfNeeded
{ "repo_name": "dahnovak-kim/HovakMusic", "path": "HovakMusic/app/src/main/java/com/dahnovak/hovakmusic/LocalPlayback.java", "license": "apache-2.0", "size": 18582 }
[ "android.media.MediaPlayer", "android.os.PowerManager", "com.dahnovak.hovakmusic.utils.LogHelper" ]
import android.media.MediaPlayer; import android.os.PowerManager; import com.dahnovak.hovakmusic.utils.LogHelper;
import android.media.*; import android.os.*; import com.dahnovak.hovakmusic.utils.*;
[ "android.media", "android.os", "com.dahnovak.hovakmusic" ]
android.media; android.os; com.dahnovak.hovakmusic;
1,148,715
public final JsonElement toJsonTree(T value) { try { JsonTreeWriter jsonWriter = new JsonTreeWriter(); write(jsonWriter, value); return jsonWriter.get(); } catch (IOException e) { throw new JsonIOException(e); } }
final JsonElement function(T value) { try { JsonTreeWriter jsonWriter = new JsonTreeWriter(); write(jsonWriter, value); return jsonWriter.get(); } catch (IOException e) { throw new JsonIOException(e); } }
/** * Converts {@code value} to a JSON tree. * * @param value the Java object to convert. May be null. * @return the converted JSON tree. May be {@link JsonNull}. * @since 2.2 */
Converts value to a JSON tree
toJsonTree
{ "repo_name": "JREkiwi/sagetv", "path": "third_party/GSON/java/sage/epg/sd/gson/TypeAdapter.java", "license": "apache-2.0", "size": 10867 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,207,140
Album[] getAlbumsByTracksId(int id[]) throws JSONException, WSError;
Album[] getAlbumsByTracksId(int id[]) throws JSONException, WSError;
/** * Returns an array of albums matching an array of track ids, can be combined with * <code>getTop100Listened</code> * * @param id * @return * @throws JSONException * @throws WSError */
Returns an array of albums matching an array of track ids, can be combined with <code>getTop100Listened</code>
getAlbumsByTracksId
{ "repo_name": "lihao814386741/AndroidCourse", "path": "src/com/teleca/jamendo/api/JamendoGet2Api.java", "license": "apache-2.0", "size": 8315 }
[ "org.json.JSONException" ]
import org.json.JSONException;
import org.json.*;
[ "org.json" ]
org.json;
296,636
public JsonObject putAllChain(final Map<String, Object> map){ this.putAll(map); return this; }
JsonObject function(final Map<String, Object> map){ this.putAll(map); return this; }
/** Calls putAll for the given map, but returns the JsonObject for chaining calls. * @param map represents the map to be copied into the JsonObject. * @return the JsonObject to allow chaining calls. * @see Map#putAll(Map) * @since 3.1.0 for inline instantiation. */
Calls putAll for the given map, but returns the JsonObject for chaining calls
putAllChain
{ "repo_name": "cliftonlabs/json-simple", "path": "src/main/java/com/github/cliftonlabs/json_simple/JsonObject.java", "license": "apache-2.0", "size": 27894 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
99,431
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<TenantSettingsContractInner> getAsync( String resourceGroupName, String serviceName, SettingsTypeName settingsType) { return getWithResponseAsync(resourceGroupName, serviceName, settingsType) .flatMap( (TenantSettingsGetResponse res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<TenantSettingsContractInner> function( String resourceGroupName, String serviceName, SettingsTypeName settingsType) { return getWithResponseAsync(resourceGroupName, serviceName, settingsType) .flatMap( (TenantSettingsGetResponse res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
/** * Get tenant settings. * * @param resourceGroupName The name of the resource group. * @param serviceName The name of the API Management service. * @param settingsType The identifier of the settings. * @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 tenant settings. */
Get tenant settings
getAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/TenantSettingsClientImpl.java", "license": "mit", "size": 25721 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.apimanagement.fluent.models.TenantSettingsContractInner", "com.azure.resourcemanager.apimanagement.models.SettingsTypeName", "com.azure.resourcemanager.apimanagement.models.TenantSettingsGetResponse" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.apimanagement.fluent.models.TenantSettingsContractInner; import com.azure.resourcemanager.apimanagement.models.SettingsTypeName; import com.azure.resourcemanager.apimanagement.models.TenantSettingsGetResponse;
import com.azure.core.annotation.*; import com.azure.resourcemanager.apimanagement.fluent.models.*; import com.azure.resourcemanager.apimanagement.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,672,590
public CommandGene applyMutation() throws InvalidConfigurationException { // String[] aO = {}; // aO=allowedOperations.toArray(aO); // RandomGenerator randomGen = getGPConfiguration().getRandomGenerator(); // String newOp = aO[randomGen.nextInt(aO.length)]; // StringMeasure result = new StringMeasure(newOp, getGPConfiguration(), getReturnType(), getSubReturnType(), m_mutateable); return this; }
CommandGene function() throws InvalidConfigurationException { return this; }
/** * Mutates this CommandGene. A random command out of the set of allowed similarity measures is picked. * * @return A random command out of the set of the allowed similarity measures * @throws InvalidConfigurationException when an invalid value has been passed to a Configuration object */
Mutates this CommandGene. A random command out of the set of allowed similarity measures is picked
applyMutation
{ "repo_name": "AKSW/LIMES-CORE", "path": "limes-core/src/main/java/org/aksw/limes/core/ml/algorithm/eagle/genes/DateMeasure.java", "license": "gpl-2.0", "size": 9809 }
[ "org.jgap.InvalidConfigurationException", "org.jgap.gp.CommandGene" ]
import org.jgap.InvalidConfigurationException; import org.jgap.gp.CommandGene;
import org.jgap.*; import org.jgap.gp.*;
[ "org.jgap", "org.jgap.gp" ]
org.jgap; org.jgap.gp;
1,900,170
public void writeEntityToNBT(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setBoolean("Pumpkin", this.isPumpkinEquipped()); }
void function(NBTTagCompound compound) { super.writeEntityToNBT(compound); compound.setBoolean(STR, this.isPumpkinEquipped()); }
/** * (abstract) Protected helper method to write subclass entity data to NBT. */
(abstract) Protected helper method to write subclass entity data to NBT
writeEntityToNBT
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/monster/EntitySnowman.java", "license": "gpl-3.0", "size": 7927 }
[ "net.minecraft.nbt.NBTTagCompound" ]
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.*;
[ "net.minecraft.nbt" ]
net.minecraft.nbt;
2,441,521
@Nullable public GridCacheMvccCandidate removeLock() { GridCacheMvccCandidate rmvd = null; CacheLockCandidates prev = null; CacheLockCandidates owner = null; CacheObject val; synchronized (this) { GridCacheMvcc mvcc = mvccExtras(); if (mvcc != null) { prev = mvcc.allOwners(); boolean emptyBefore = mvcc.isEmpty(); rmvd = mvcc.releaseLocal(); boolean emptyAfter = mvcc.isEmpty(); checkCallbacks(emptyBefore, emptyAfter); if (emptyAfter) mvccExtras(null); else owner = mvcc.allOwners(); } val = this.val; } if (log.isDebugEnabled()) { log.debug("Released local candidate from entry [owner=" + owner + ", prev=" + prev + ", rmvd=" + rmvd + ", entry=" + this + ']'); } if (prev != null) { for (int i = 0; i < prev.size(); i++) { GridCacheMvccCandidate cand = prev.candidate(i); checkThreadChain(cand); } } // This call must be outside of synchronization. checkOwnerChanged(prev, owner, val); return rmvd; }
@Nullable GridCacheMvccCandidate function() { GridCacheMvccCandidate rmvd = null; CacheLockCandidates prev = null; CacheLockCandidates owner = null; CacheObject val; synchronized (this) { GridCacheMvcc mvcc = mvccExtras(); if (mvcc != null) { prev = mvcc.allOwners(); boolean emptyBefore = mvcc.isEmpty(); rmvd = mvcc.releaseLocal(); boolean emptyAfter = mvcc.isEmpty(); checkCallbacks(emptyBefore, emptyAfter); if (emptyAfter) mvccExtras(null); else owner = mvcc.allOwners(); } val = this.val; } if (log.isDebugEnabled()) { log.debug(STR + owner + STR + prev + STR + rmvd + STR + this + ']'); } if (prev != null) { for (int i = 0; i < prev.size(); i++) { GridCacheMvccCandidate cand = prev.candidate(i); checkThreadChain(cand); } } checkOwnerChanged(prev, owner, val); return rmvd; }
/** * Unlocks local lock. * * @return Removed candidate, or <tt>null</tt> if thread still holds the lock. */
Unlocks local lock
removeLock
{ "repo_name": "a1vanov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java", "license": "apache-2.0", "size": 21810 }
[ "org.apache.ignite.internal.processors.cache.CacheLockCandidates", "org.apache.ignite.internal.processors.cache.CacheObject", "org.apache.ignite.internal.processors.cache.GridCacheMvcc", "org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.internal.processors.cache.CacheLockCandidates; import org.apache.ignite.internal.processors.cache.CacheObject; import org.apache.ignite.internal.processors.cache.GridCacheMvcc; import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.internal.processors.cache.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
2,513,286
public static DoubleMatrix constructDesignMatrix(final DoubleMatrix line, final DoubleMatrix pixel, final int degree) { DoubleMatrix A = new DoubleMatrix(); DoubleMatrix mul; for (int p = 0; p <= degree; p++) { for (int q = 0; q <= p; q++) { mul = pow(line, (p - q)).mul(pow(pixel, q)); if (q == 0 && p == 0) { A = mul; } else { A = DoubleMatrix.concatHorizontally(A, mul); } } } return A; }
static DoubleMatrix function(final DoubleMatrix line, final DoubleMatrix pixel, final int degree) { DoubleMatrix A = new DoubleMatrix(); DoubleMatrix mul; for (int p = 0; p <= degree; p++) { for (int q = 0; q <= p; q++) { mul = pow(line, (p - q)).mul(pow(pixel, q)); if (q == 0 && p == 0) { A = mul; } else { A = DoubleMatrix.concatHorizontally(A, mul); } } } return A; }
/** * Construct design matrix for fitting of 2d polynomial to input data - Jblas implementation. * * @param line vector of coordinates of points in azimuth direction * @param pixel vactor of coordinates of points in range direction * @param degree polynomial degree * @return Design Matrix */
Construct design matrix for fitting of 2d polynomial to input data - Jblas implementation
constructDesignMatrix
{ "repo_name": "kristotammeoja/ks", "path": "jlinda/jlinda-core/src/main/java/org/jlinda/core/coregistration/estimation/SystemOfEquations.java", "license": "gpl-3.0", "size": 15235 }
[ "org.jblas.DoubleMatrix", "org.jblas.MatrixFunctions" ]
import org.jblas.DoubleMatrix; import org.jblas.MatrixFunctions;
import org.jblas.*;
[ "org.jblas" ]
org.jblas;
2,640,564
@Generated @StructureField(order = 7, isGetter = false) public native void setNreloc(int value);
@StructureField(order = 7, isGetter = false) native void function(int value);
/** * number of relocation entries */
number of relocation entries
setNreloc
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/struct/section.java", "license": "apache-2.0", "size": 4116 }
[ "org.moe.natj.c.ann.StructureField" ]
import org.moe.natj.c.ann.StructureField;
import org.moe.natj.c.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
1,547,439
@GuardedBy("Segment.this") void drainReferenceQueues() { if (map.usesKeyReferences()) { drainKeyReferenceQueue(); } if (map.usesValueReferences()) { drainValueReferenceQueue(); } }
@GuardedBy(STR) void drainReferenceQueues() { if (map.usesKeyReferences()) { drainKeyReferenceQueue(); } if (map.usesValueReferences()) { drainValueReferenceQueue(); } }
/** * Drain the key and value reference queues, cleaning up internal entries containing garbage * collected keys or values. */
Drain the key and value reference queues, cleaning up internal entries containing garbage collected keys or values
drainReferenceQueues
{ "repo_name": "10xEngineer/My-Wallet-Android", "path": "src/com/google/common/collect/MapMakerInternalMap.java", "license": "gpl-3.0", "size": 121941 }
[ "javax.annotation.concurrent.GuardedBy" ]
import javax.annotation.concurrent.GuardedBy;
import javax.annotation.concurrent.*;
[ "javax.annotation" ]
javax.annotation;
950,224
public ArrayList<Arc> getInputArcs(Integer n) { ArrayList<Arc> col = new ArrayList<Arc>(); if (fillWithInputArcs(n, col)) return col; else return null; }
ArrayList<Arc> function(Integer n) { ArrayList<Arc> col = new ArrayList<Arc>(); if (fillWithInputArcs(n, col)) return col; else return null; }
/** * O(|number of input arcs|)) * * Return an ArrayList of directed arcs entering this node in this. * getInputArcs(n) returns all the (-,n) directed arcs of this. It returns * null if n do not belong to this. * * @return An ArrayList of directed arcs entering this node in this, null if * n does not belong to this graph, or is virtually removed. */
O(|number of input arcs|)) Return an ArrayList of directed arcs entering this node in this. getInputArcs(n) returns all the (-,n) directed arcs of this. It returns null if n do not belong to this
getInputArcs
{ "repo_name": "noormoha/DCCast", "path": "dccast/graphTheory/graph/Graph.java", "license": "mit", "size": 64339 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,258,645
@Override @Deprecated public Servlet getServlet(String name) throws ServletException { return null; }
Servlet function(String name) throws ServletException { return null; }
/** * Return a null reference for the specified servlet name. * * @param name Name of the requested servlet * * @deprecated This method has been deprecated with no replacement */
Return a null reference for the specified servlet name
getServlet
{ "repo_name": "IAMTJW/Tomcat-8.5.20", "path": "tomcat-8.5.20/java/org/apache/jasper/servlet/JspCServletContext.java", "license": "apache-2.0", "size": 18971 }
[ "javax.servlet.Servlet", "javax.servlet.ServletException" ]
import javax.servlet.Servlet; import javax.servlet.ServletException;
import javax.servlet.*;
[ "javax.servlet" ]
javax.servlet;
1,323,330
private Object[] getExpectedParams(Object[] o) { Object[] no = new Object[o.length]; for (int i = 0; i < o.length; i++) { Object obj = o[i]; if (compName.equals(obj)) { try { obj = new CompositeName(name); } catch (InvalidNameException e) { e.printStackTrace(); } } else if (compNameStr.equals(obj)) { obj = name; } no[i] = obj; } return no; }
Object[] function(Object[] o) { Object[] no = new Object[o.length]; for (int i = 0; i < o.length; i++) { Object obj = o[i]; if (compName.equals(obj)) { try { obj = new CompositeName(name); } catch (InvalidNameException e) { e.printStackTrace(); } } else if (compNameStr.equals(obj)) { obj = name; } no[i] = obj; } return no; }
/** * Replaces composite names with simple name names. * * @param o * @return */
Replaces composite names with simple name names
getExpectedParams
{ "repo_name": "freeVM/freeVM", "path": "enhanced/buildtest/tests/functional/src/test/functional/org/apache/harmony/test/func/api/javax/naming/provider/rmi/FederationSupportRefTest.java", "license": "apache-2.0", "size": 13276 }
[ "javax.naming.CompositeName", "javax.naming.InvalidNameException" ]
import javax.naming.CompositeName; import javax.naming.InvalidNameException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
1,027,815
protected String getApplicationName(EJBMethodMetaData methodMetaData) { return methodMetaData.getEJBComponentMetaData().getJ2EEName().getApplication(); }
String function(EJBMethodMetaData methodMetaData) { return methodMetaData.getEJBComponentMetaData().getJ2EEName().getApplication(); }
/** * Get the name of the application currently executing * * @return the application name */
Get the name of the application currently executing
getApplicationName
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.ejbcontainer.security/src/com/ibm/ws/ejbcontainer/security/internal/EJBSecurityCollaboratorImpl.java", "license": "epl-1.0", "size": 39724 }
[ "com.ibm.ws.ejbcontainer.EJBMethodMetaData" ]
import com.ibm.ws.ejbcontainer.EJBMethodMetaData;
import com.ibm.ws.ejbcontainer.*;
[ "com.ibm.ws" ]
com.ibm.ws;
2,249,368
@RestrictTo(Scope.LIBRARY_GROUP) @NonNull public Builder setCaptureBundle(@NonNull CaptureBundle captureBundle) { getMutableConfig().insertOption(OPTION_CAPTURE_BUNDLE, captureBundle); return this; }
@RestrictTo(Scope.LIBRARY_GROUP) Builder function(@NonNull CaptureBundle captureBundle) { getMutableConfig().insertOption(OPTION_CAPTURE_BUNDLE, captureBundle); return this; }
/** * Sets the {@link CaptureBundle}. * * @param captureBundle The requested capture bundle for extension. * @return The current Builder. * @hide */
Sets the <code>CaptureBundle</code>
setCaptureBundle
{ "repo_name": "AndroidX/androidx", "path": "camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java", "license": "apache-2.0", "size": 118170 }
[ "androidx.annotation.NonNull", "androidx.annotation.RestrictTo", "androidx.camera.core.impl.CaptureBundle" ]
import androidx.annotation.NonNull; import androidx.annotation.RestrictTo; import androidx.camera.core.impl.CaptureBundle;
import androidx.annotation.*; import androidx.camera.core.impl.*;
[ "androidx.annotation", "androidx.camera" ]
androidx.annotation; androidx.camera;
999,378
public static byte[] toBytes(String s) { try { return s.getBytes(UTF8_ENCODING); } catch (UnsupportedEncodingException e) { return null; } }
static byte[] function(String s) { try { return s.getBytes(UTF8_ENCODING); } catch (UnsupportedEncodingException e) { return null; } }
/** * Converts a string to a UTF-8 byte array. * @param s string * @return the byte array */
Converts a string to a UTF-8 byte array
toBytes
{ "repo_name": "cdapio/tigon", "path": "tigon-api/src/main/java/co/cask/tigon/api/common/Bytes.java", "license": "apache-2.0", "size": 40086 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
728,102
private static ExtractorInput createTestInput(int... data) throws IOException { byte[] bytes = new byte[data.length]; for (int i = 0; i < data.length; i++) { bytes[i] = (byte) data[i]; } DataSource dataSource = new FakeDataSource.Builder().appendReadData(bytes).build(); dataSource.open(new DataSpec(Uri.parse("http://www.google.com"))); ExtractorInput input = new DefaultExtractorInput(dataSource, 0, C.LENGTH_UNBOUNDED); return input; } private static final class TestOutput implements EbmlReaderOutput { // Element IDs private static final int ID_EBML = 0x1A45DFA3; private static final int ID_EBML_READ_VERSION = 0x42F7; private static final int ID_DOC_TYPE = 0x4282; private static final int ID_DOC_TYPE_READ_VERSION = 0x4285; private static final int ID_SEGMENT = 0x18538067; private static final int ID_DURATION = 0x4489; private static final int ID_SIMPLE_BLOCK = 0xA3; private final List<String> events = new ArrayList<>();
static ExtractorInput function(int... data) throws IOException { byte[] bytes = new byte[data.length]; for (int i = 0; i < data.length; i++) { bytes[i] = (byte) data[i]; } DataSource dataSource = new FakeDataSource.Builder().appendReadData(bytes).build(); dataSource.open(new DataSpec(Uri.parse("http: ExtractorInput input = new DefaultExtractorInput(dataSource, 0, C.LENGTH_UNBOUNDED); return input; } private static final class TestOutput implements EbmlReaderOutput { private static final int ID_EBML = 0x1A45DFA3; private static final int ID_EBML_READ_VERSION = 0x42F7; private static final int ID_DOC_TYPE = 0x4282; private static final int ID_DOC_TYPE_READ_VERSION = 0x4285; private static final int ID_SEGMENT = 0x18538067; private static final int ID_DURATION = 0x4489; private static final int ID_SIMPLE_BLOCK = 0xA3; private final List<String> events = new ArrayList<>();
/** * Helper to build an {@link ExtractorInput} from byte data. * <p> * Each argument must be able to cast to a byte value. * * @param data Zero or more integers with values between {@code 0x00} and {@code 0xFF}. * @return An {@link ExtractorInput} from which the data can be read. * @throws IOException If an error occurs creating the input. */
Helper to build an <code>ExtractorInput</code> from byte data. Each argument must be able to cast to a byte value
createTestInput
{ "repo_name": "rodrigodzf/ExoPlayer", "path": "library/src/androidTest/java/com/google/android/exoplayer/extractor/webm/DefaultEbmlReaderTest.java", "license": "apache-2.0", "size": 9102 }
[ "android.net.Uri", "com.google.android.exoplayer.extractor.DefaultExtractorInput", "com.google.android.exoplayer.extractor.ExtractorInput", "com.google.android.exoplayer.testutil.FakeDataSource", "com.google.android.exoplayer.upstream.DataSource", "com.google.android.exoplayer.upstream.DataSpec", "java.io.IOException", "java.util.ArrayList", "java.util.List" ]
import android.net.Uri; import com.google.android.exoplayer.extractor.DefaultExtractorInput; import com.google.android.exoplayer.extractor.ExtractorInput; import com.google.android.exoplayer.testutil.FakeDataSource; import com.google.android.exoplayer.upstream.DataSource; import com.google.android.exoplayer.upstream.DataSpec; import java.io.IOException; import java.util.ArrayList; import java.util.List;
import android.net.*; import com.google.android.exoplayer.extractor.*; import com.google.android.exoplayer.testutil.*; import com.google.android.exoplayer.upstream.*; import java.io.*; import java.util.*;
[ "android.net", "com.google.android", "java.io", "java.util" ]
android.net; com.google.android; java.io; java.util;
1,688,312
public static void setTranslationZ(View view, float translationZ) { IMPL.setTranslationZ(view, translationZ); }
static void function(View view, float translationZ) { IMPL.setTranslationZ(view, translationZ); }
/** * Sets the depth location of this view relative to its {@link #getElevation(View) elevation}. */
Sets the depth location of this view relative to its <code>#getElevation(View) elevation</code>
setTranslationZ
{ "repo_name": "rytina/dukecon_appsgenerator", "path": "org.applause.lang.generator.android/sdk/extras/android/support/v4/src/java/android/support/v4/view/ViewCompat.java", "license": "epl-1.0", "size": 120271 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
1,471,459
public void insert(Object object) { EntityManager entityManager = null; try { entityManager = entityManagers.poll(); entityManager.getTransaction().begin(); try { entityManager.persist(object); entityManager.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); entityManager.getTransaction().rollback(); } } finally { if(entityManager != null) entityManagers.add(entityManager); } }
void function(Object object) { EntityManager entityManager = null; try { entityManager = entityManagers.poll(); entityManager.getTransaction().begin(); try { entityManager.persist(object); entityManager.getTransaction().commit(); } catch (Exception e) { e.printStackTrace(); entityManager.getTransaction().rollback(); } } finally { if(entityManager != null) entityManagers.add(entityManager); } }
/** * Insert an entity that must not already exist within the database. Within JPA this uses the persist method * as opposed to the merge. * * @param object Object to insert */
Insert an entity that must not already exist within the database. Within JPA this uses the persist method as opposed to the merge
insert
{ "repo_name": "OnyxDevTools/onyx-database-parent", "path": "onyx-database-examples/performance-benchmarks/src/main/java/com/onyxdevtools/provider/manager/JPAPersistenceManager.java", "license": "agpl-3.0", "size": 6127 }
[ "javax.persistence.EntityManager" ]
import javax.persistence.EntityManager;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
1,245,274
private CategorialClass get(String className, String... attributes) { CategorialClass categorialClass = new CategorialClass(); EntityInterface entity = createEntity(className, attributes); categorialClass.setCategorialClassEntity(entity); return categorialClass; }
CategorialClass function(String className, String... attributes) { CategorialClass categorialClass = new CategorialClass(); EntityInterface entity = createEntity(className, attributes); categorialClass.setCategorialClassEntity(entity); return categorialClass; }
/** * Mock Method for getting object for given class name. * @param className * @param attributes * @return CategorialClass */
Mock Method for getting object for given class name
get
{ "repo_name": "NCIP/cab2b", "path": "software/cab2bWebApp/test/unit/java/edu/wustl/cab2bwebapp/bizlogic/executequery/CategoryToSpreadsheetTransformerTest.java", "license": "bsd-3-clause", "size": 13181 }
[ "edu.common.dynamicextensions.domaininterface.EntityInterface", "edu.wustl.common.querysuite.metadata.category.CategorialClass" ]
import edu.common.dynamicextensions.domaininterface.EntityInterface; import edu.wustl.common.querysuite.metadata.category.CategorialClass;
import edu.common.dynamicextensions.domaininterface.*; import edu.wustl.common.querysuite.metadata.category.*;
[ "edu.common.dynamicextensions", "edu.wustl.common" ]
edu.common.dynamicextensions; edu.wustl.common;
1,137,716
public void addFile(InputStream inputStream) { String name = "file"; fileStreams.put(normalizeDuplicateName(name), inputStream); }
void function(InputStream inputStream) { String name = "file"; fileStreams.put(normalizeDuplicateName(name), inputStream); }
/** * Adds a file to your assembly but automatically genarates the name of the file. * * @param inputStream {@link InputStream} the file to be uploaded. */
Adds a file to your assembly but automatically genarates the name of the file
addFile
{ "repo_name": "transloadit/java-sdk", "path": "src/main/java/com/transloadit/sdk/Assembly.java", "license": "mit", "size": 23922 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,046,504
public void print(String str) { if (str == null) { str = String.valueOf((Object) null); } synchronized (lock) { try { appendLocked(str, 0, str.length()); } catch (IOException e) { setError(); } } }
void function(String str) { if (str == null) { str = String.valueOf((Object) null); } synchronized (lock) { try { appendLocked(str, 0, str.length()); } catch (IOException e) { setError(); } } }
/** * Prints a string to the target. The string is converted to an array of * bytes using the encoding chosen during the construction of this writer. * The bytes are then written to the target with {@code write(int)}. * <p> * If an I/O error occurs, this writer's error flag is set to {@code true}. * * @param str * the string to print to the target. * @see #write(int) */
Prints a string to the target. The string is converted to an array of bytes using the encoding chosen during the construction of this writer. The bytes are then written to the target with write(int). If an I/O error occurs, this writer's error flag is set to true
print
{ "repo_name": "JSDemos/android-sdk-20", "path": "src/com/android/internal/util/FastPrintWriter.java", "license": "apache-2.0", "size": 20802 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,438,253
public static RelNode createProject(final RelNode child, final List<Integer> posList) { return createProject( RelFactories.DEFAULT_PROJECT_FACTORY, child, posList); }
static RelNode function(final RelNode child, final List<Integer> posList) { return createProject( RelFactories.DEFAULT_PROJECT_FACTORY, child, posList); }
/** * Creates a relational expression that projects the given fields of the * input. * * <p>Optimizes if the fields are the identity projection.</p> * * @param child Input relational expression * @param posList Source of each projected field * @return Relational expression that projects given fields */
Creates a relational expression that projects the given fields of the input. Optimizes if the fields are the identity projection
createProject
{ "repo_name": "joshelser/incubator-calcite", "path": "core/src/main/java/org/apache/calcite/plan/RelOptUtil.java", "license": "apache-2.0", "size": 122744 }
[ "java.util.List", "org.apache.calcite.rel.RelNode", "org.apache.calcite.rel.core.RelFactories" ]
import java.util.List; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.RelFactories;
import java.util.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.core.*;
[ "java.util", "org.apache.calcite" ]
java.util; org.apache.calcite;
171,032
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof ClassPathResource) { ClassPathResource otherRes = (ClassPathResource) obj; return (this.path.equals(otherRes.path) && ObjectUtils.nullSafeEquals(this.classLoader, otherRes.classLoader) && ObjectUtils.nullSafeEquals(this.clazz, otherRes.clazz)); } return false; }
boolean function(Object obj) { if (obj == this) { return true; } if (obj instanceof ClassPathResource) { ClassPathResource otherRes = (ClassPathResource) obj; return (this.path.equals(otherRes.path) && ObjectUtils.nullSafeEquals(this.classLoader, otherRes.classLoader) && ObjectUtils.nullSafeEquals(this.clazz, otherRes.clazz)); } return false; }
/** * This implementation compares the underlying class path locations. */
This implementation compares the underlying class path locations
equals
{ "repo_name": "leogoing/spring_jeesite", "path": "spring-core-4.0/org/springframework/core/io/ClassPathResource.java", "license": "apache-2.0", "size": 8760 }
[ "org.springframework.util.ObjectUtils" ]
import org.springframework.util.ObjectUtils;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
1,609,058
public Criteria function(Function function) { Assert.notNull(function, "Cannot add 'null' function to criteria."); predicates.add(new Predicate(OperationKey.FUNCTION, function)); return this; }
Criteria function(Function function) { Assert.notNull(function, STR); predicates.add(new Predicate(OperationKey.FUNCTION, function)); return this; }
/** * Creates {@link Predicate} for given {@link Function}. * * @param function must not be null * @return * @throws IllegalArgumentException if function is null * @since 1.1 */
Creates <code>Predicate</code> for given <code>Function</code>
function
{ "repo_name": "cipous/spring-data-solr", "path": "src/main/java/org/springframework/data/solr/core/query/Criteria.java", "license": "apache-2.0", "size": 19867 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
2,022,070
private int getTTLForColumn(Object columnTTLs, Attribute attribute) { Integer ttl = null; if (columnTTLs != null) { if (columnTTLs instanceof Map) { ttl = (Integer) (columnTTLs == null ? 0 : ((Map) columnTTLs).get(((AbstractAttribute) attribute) .getJPAColumnName())); } else if (columnTTLs instanceof Integer) { ttl = (Integer) columnTTLs; } } return ttl == null ? 0 : ttl; }
int function(Object columnTTLs, Attribute attribute) { Integer ttl = null; if (columnTTLs != null) { if (columnTTLs instanceof Map) { ttl = (Integer) (columnTTLs == null ? 0 : ((Map) columnTTLs).get(((AbstractAttribute) attribute) .getJPAColumnName())); } else if (columnTTLs instanceof Integer) { ttl = (Integer) columnTTLs; } } return ttl == null ? 0 : ttl; }
/** * Determined TTL for a given column. * * @param columnTTLs * the column tt ls * @param attribute * the attribute * @return the TTL for column */
Determined TTL for a given column
getTTLForColumn
{ "repo_name": "ravisund/Kundera", "path": "src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java", "license": "apache-2.0", "size": 96935 }
[ "com.impetus.kundera.metadata.model.attributes.AbstractAttribute", "java.util.Map", "javax.persistence.metamodel.Attribute" ]
import com.impetus.kundera.metadata.model.attributes.AbstractAttribute; import java.util.Map; import javax.persistence.metamodel.Attribute;
import com.impetus.kundera.metadata.model.attributes.*; import java.util.*; import javax.persistence.metamodel.*;
[ "com.impetus.kundera", "java.util", "javax.persistence" ]
com.impetus.kundera; java.util; javax.persistence;
333,181
public void setSurfaceSoftErp( float softErp ) { Ode.setSurfaceSoftErp( softErp ); }
void function( float softErp ) { Ode.setSurfaceSoftErp( softErp ); }
/** * Set default value for collision surface parameters. */
Set default value for collision surface parameters
setSurfaceSoftErp
{ "repo_name": "jogjayr/InTEL-Project", "path": "JMEPhysics/src/org/odejava/collision/Collision.java", "license": "gpl-3.0", "size": 5359 }
[ "org.odejava.ode.Ode" ]
import org.odejava.ode.Ode;
import org.odejava.ode.*;
[ "org.odejava.ode" ]
org.odejava.ode;
411,923
private static void logFSTree(Log LOG, final FileSystem fs, final Path root, String prefix) throws IOException { FileStatus[] files = FSUtils.listStatus(fs, root, null); if (files == null) return; for (FileStatus file : files) { if (file.isDir()) { LOG.debug(prefix + file.getPath().getName() + "/"); logFSTree(LOG, fs, file.getPath(), prefix + "---"); } else { LOG.debug(prefix + file.getPath().getName()); } } }
static void function(Log LOG, final FileSystem fs, final Path root, String prefix) throws IOException { FileStatus[] files = FSUtils.listStatus(fs, root, null); if (files == null) return; for (FileStatus file : files) { if (file.isDir()) { LOG.debug(prefix + file.getPath().getName() + "/"); logFSTree(LOG, fs, file.getPath(), prefix + "---"); } else { LOG.debug(prefix + file.getPath().getName()); } } }
/** * Recursive helper to log the state of the FS * * @see #logFileSystemState(FileSystem, Path, Log) */
Recursive helper to log the state of the FS
logFSTree
{ "repo_name": "lilonglai/hbase-0.96.2", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java", "license": "apache-2.0", "size": 69154 }
[ "java.io.IOException", "org.apache.commons.logging.Log", "org.apache.hadoop.fs.FileStatus", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path" ]
import java.io.IOException; import org.apache.commons.logging.Log; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;
import java.io.*; import org.apache.commons.logging.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.commons", "org.apache.hadoop" ]
java.io; org.apache.commons; org.apache.hadoop;
1,545,212
public final MetaProperty<IdWrapper> underlying() { return _underlying; }
final MetaProperty<IdWrapper> function() { return _underlying; }
/** * The meta-property for the {@code underlying} property. * @return the meta-property, not null */
The meta-property for the underlying property
underlying
{ "repo_name": "McLeodMoores/starling", "path": "projects/integration/src/main/java/com/opengamma/integration/tool/portfolio/xml/v1_0/jaxb/EquityVarianceSwapTrade.java", "license": "apache-2.0", "size": 21479 }
[ "org.joda.beans.MetaProperty" ]
import org.joda.beans.MetaProperty;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
2,416,403
default Map<String,ActivityImplementor> getActivityImplementors() throws IOException { return null; }
default Map<String,ActivityImplementor> getActivityImplementors() throws IOException { return null; }
/** * Map of implClass to implementor. */
Map of implClass to implementor
getActivityImplementors
{ "repo_name": "CenturyLinkCloud/mdw", "path": "mdw-common/src/com/centurylink/mdw/model/project/Project.java", "license": "apache-2.0", "size": 1200 }
[ "com.centurylink.mdw.model.workflow.ActivityImplementor", "java.io.IOException", "java.util.Map" ]
import com.centurylink.mdw.model.workflow.ActivityImplementor; import java.io.IOException; import java.util.Map;
import com.centurylink.mdw.model.workflow.*; import java.io.*; import java.util.*;
[ "com.centurylink.mdw", "java.io", "java.util" ]
com.centurylink.mdw; java.io; java.util;
1,372,563
public void setRequestTracingEnabled(final Boolean requestTracingEnabledValue) { this.requestTracingEnabled = requestTracingEnabledValue; } private Calendar requestTracingExpirationTime;
void function(final Boolean requestTracingEnabledValue) { this.requestTracingEnabled = requestTracingEnabledValue; } private Calendar requestTracingExpirationTime;
/** * Optional. True if request tracing is enabled; otherwise, false. * @param requestTracingEnabledValue The RequestTracingEnabled value. */
Optional. True if request tracing is enabled; otherwise, false
setRequestTracingEnabled
{ "repo_name": "southworkscom/azure-sdk-for-java", "path": "resource-management/azure-mgmt-websites/src/main/java/com/microsoft/azure/management/websites/models/WebSiteUpdateConfigurationDetails.java", "license": "apache-2.0", "size": 19422 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
847,797
public Pattern[] getNoCompressionUserAgents() { return this.noCompressionUserAgents; }
Pattern[] function() { return this.noCompressionUserAgents; }
/** * Getter for noCompressionUserAgents * * @return the noCompressionUserAgents */
Getter for noCompressionUserAgents
getNoCompressionUserAgents
{ "repo_name": "johnaoahra80/JBOSSWEB_7_5_0_FINAL", "path": "src/main/java/org/apache/coyote/http11/Http11AbstractProcessor.java", "license": "apache-2.0", "size": 26171 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,250,226
public int run(String argv[]) throws Exception { int exitCode = -1; Configuration conf = getConf(); try{ JobClient.setCommandLineConfig(conf); try { RunJar.main(argv); exitCode = 0; } catch(Throwable th) { System.err.println(StringUtils.stringifyException(th)); } } catch(RuntimeException re) { exitCode = -1; System.err.println(re.getLocalizedMessage()); } return exitCode; }
int function(String argv[]) throws Exception { int exitCode = -1; Configuration conf = getConf(); try{ JobClient.setCommandLineConfig(conf); try { RunJar.main(argv); exitCode = 0; } catch(Throwable th) { System.err.println(StringUtils.stringifyException(th)); } } catch(RuntimeException re) { exitCode = -1; System.err.println(re.getLocalizedMessage()); } return exitCode; }
/** * run method from Tool */
run method from Tool
run
{ "repo_name": "basicthinker/Quatrain-MapReduce", "path": "src/mapred/org/apache/hadoop/mapred/JobShell.java", "license": "apache-2.0", "size": 2267 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.util.RunJar", "org.apache.hadoop.util.StringUtils" ]
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.RunJar; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.conf.*; import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
265,657
Set<DocumentedTypeDTO> getControllerServiceTypes(final String serviceType, final String serviceBundleGroup, final String serviceBundleArtifact, final String serviceBundleVersion, final String bundleGroupFilter, final String bundleArtifactFilter, final String typeFilter);
Set<DocumentedTypeDTO> getControllerServiceTypes(final String serviceType, final String serviceBundleGroup, final String serviceBundleArtifact, final String serviceBundleVersion, final String bundleGroupFilter, final String bundleArtifactFilter, final String typeFilter);
/** * Returns the list of controller service types. * * @param serviceType Filters only service types that implement this type * @param serviceBundleGroup if serviceType specified, the bundle group of the serviceType * @param serviceBundleArtifact if serviceType specified, the bundle artifact of the serviceType * @param serviceBundleVersion if serviceType specified, the bundle version of the serviceType * @param bundleGroupFilter if specified, must be member of bundle group * @param bundleArtifactFilter if specified, must be member of bundle artifact * @param typeFilter if specified, type must match * @return The list of available controller types matching specified criteria */
Returns the list of controller service types
getControllerServiceTypes
{ "repo_name": "jskora/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 83710 }
[ "java.util.Set", "org.apache.nifi.web.api.dto.DocumentedTypeDTO" ]
import java.util.Set; import org.apache.nifi.web.api.dto.DocumentedTypeDTO;
import java.util.*; import org.apache.nifi.web.api.dto.*;
[ "java.util", "org.apache.nifi" ]
java.util; org.apache.nifi;
1,253,341
public static Test suite() { TestSuite suite = (TestSuite) TestConfiguration.defaultSuite(UDTTest.class); Test result = new CleanDatabaseTestSetup( suite ); return result; } /////////////////////////////////////////////////////////////////////////////////// // // TESTS // ///////////////////////////////////////////////////////////////////////////////////
static Test function() { TestSuite suite = (TestSuite) TestConfiguration.defaultSuite(UDTTest.class); Test result = new CleanDatabaseTestSetup( suite ); return result; }
/** * Construct top level suite in this JUnit test */
Construct top level suite in this JUnit test
suite
{ "repo_name": "kavin256/Derby", "path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/UDTTest.java", "license": "apache-2.0", "size": 59057 }
[ "junit.framework.Test", "junit.framework.TestSuite", "org.apache.derbyTesting.junit.CleanDatabaseTestSetup", "org.apache.derbyTesting.junit.TestConfiguration" ]
import junit.framework.Test; import junit.framework.TestSuite; import org.apache.derbyTesting.junit.CleanDatabaseTestSetup; import org.apache.derbyTesting.junit.TestConfiguration;
import junit.framework.*; import org.apache.*;
[ "junit.framework", "org.apache" ]
junit.framework; org.apache;
329,948
public boolean supportsJoin(JoinType type) { return true; }
boolean function(JoinType type) { return true; }
/** * Indicates if the dialect supports the given join type. */
Indicates if the dialect supports the given join type
supportsJoin
{ "repo_name": "dremio/dremio-oss", "path": "sabot/kernel/src/main/java/com/dremio/common/dialect/DremioSqlDialect.java", "license": "apache-2.0", "size": 17123 }
[ "org.apache.calcite.sql.JoinType" ]
import org.apache.calcite.sql.JoinType;
import org.apache.calcite.sql.*;
[ "org.apache.calcite" ]
org.apache.calcite;
54,044
protected Set<Class<?>> getRegisteredClasses() { return Collections.unmodifiableSet(converterMap.keySet()); }
Set<Class<?>> function() { return Collections.unmodifiableSet(converterMap.keySet()); }
/** * Returns a set of classes that have a converter registered. This is <b>not * the same</b> as the list of supported classes - subclasses of classes in * this set are also supported. * * @return An unmodifiable set of classes that have a converter registered. */
Returns a set of classes that have a converter registered. This is not the same as the list of supported classes - subclasses of classes in this set are also supported
getRegisteredClasses
{ "repo_name": "Darsstar/framework", "path": "server/src/main/java/com/vaadin/ui/declarative/DesignFormatter.java", "license": "apache-2.0", "size": 14176 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,624,155
public void contextualize( final Context context ) throws ContextException { try { m_baseDirectory = (File)context.get( "urn:avalon:home" ); } catch( ContextException e ) { m_baseDirectory = (File)context.get( "app.home" ); } }
void function( final Context context ) throws ContextException { try { m_baseDirectory = (File)context.get( STR ); } catch( ContextException e ) { m_baseDirectory = (File)context.get( STR ); } }
/** * Contextualization of the component by the container during * which the working home directory will be provided. * * @param context the supplied context object * @avalon.entry key="urn:avalon:home" type="java.io.File" */
Contextualization of the component by the container during which the working home directory will be provided
contextualize
{ "repo_name": "eva-xuyen/excalibur", "path": "cornerstone/store/impl/src/main/java/org/apache/avalon/cornerstone/blocks/masterstore/File_Persistent_Object_Repository.java", "license": "apache-2.0", "size": 4288 }
[ "java.io.File", "org.apache.avalon.framework.context.Context", "org.apache.avalon.framework.context.ContextException" ]
import java.io.File; import org.apache.avalon.framework.context.Context; import org.apache.avalon.framework.context.ContextException;
import java.io.*; import org.apache.avalon.framework.context.*;
[ "java.io", "org.apache.avalon" ]
java.io; org.apache.avalon;
2,835,108
public String getRootUri() { UriTemplateHandler uriTemplateHandler = this.restTemplate.getUriTemplateHandler(); if (uriTemplateHandler instanceof RootUriTemplateHandler) { return ((RootUriTemplateHandler) uriTemplateHandler).getRootUri(); } return ""; }
String function() { UriTemplateHandler uriTemplateHandler = this.restTemplate.getUriTemplateHandler(); if (uriTemplateHandler instanceof RootUriTemplateHandler) { return ((RootUriTemplateHandler) uriTemplateHandler).getRootUri(); } return ""; }
/** * Returns the root URI applied by a {@link RootUriTemplateHandler} or {@code ""} if * the root URI is not available. * @return the root URI */
Returns the root URI applied by a <code>RootUriTemplateHandler</code> or "" if the root URI is not available
getRootUri
{ "repo_name": "mdeinum/spring-boot", "path": "spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/web/client/TestRestTemplate.java", "license": "apache-2.0", "size": 44465 }
[ "org.springframework.boot.web.client.RootUriTemplateHandler", "org.springframework.web.util.UriTemplateHandler" ]
import org.springframework.boot.web.client.RootUriTemplateHandler; import org.springframework.web.util.UriTemplateHandler;
import org.springframework.boot.web.client.*; import org.springframework.web.util.*;
[ "org.springframework.boot", "org.springframework.web" ]
org.springframework.boot; org.springframework.web;
1,984,999
public Set<OWLClass> getRHSGeneralisedConcepts() { if(rhsGen == null) sortOutRHSAffectedConcepts(); return rhsGen; }
Set<OWLClass> function() { if(rhsGen == null) sortOutRHSAffectedConcepts(); return rhsGen; }
/** * Get the set of generalised concepts in ontology 2 * @return Set of generalised concepts in ontology 2 */
Get the set of generalised concepts in ontology 2
getRHSGeneralisedConcepts
{ "repo_name": "rsgoncalves/ecco", "path": "src/main/java/uk/ac/manchester/cs/diff/concept/changeset/ConceptChangeSet.java", "license": "lgpl-3.0", "size": 24670 }
[ "java.util.Set", "org.semanticweb.owlapi.model.OWLClass" ]
import java.util.Set; import org.semanticweb.owlapi.model.OWLClass;
import java.util.*; import org.semanticweb.owlapi.model.*;
[ "java.util", "org.semanticweb.owlapi" ]
java.util; org.semanticweb.owlapi;
2,599,350
private void redrawMapInternal(boolean forceRedraw) { updateLayers(); mRenderRequest = true; Gdx.graphics.requestRendering(); }
void function(boolean forceRedraw) { updateLayers(); mRenderRequest = true; Gdx.graphics.requestRendering(); }
/** * Update all Layers on Main thread. * * @param forceRedraw * also render frame FIXME (does nothing atm) */
Update all Layers on Main thread
redrawMapInternal
{ "repo_name": "opensciencemap/vtm", "path": "vtm-gdx/src/org/oscim/gdx/GdxMap.java", "license": "gpl-3.0", "size": 5200 }
[ "com.badlogic.gdx.Gdx" ]
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.*;
[ "com.badlogic.gdx" ]
com.badlogic.gdx;
356,999
@Bean public InstallerSource installerSource() throws MalformedURLException { return new InstallerSourceWebserviceDefaultImplementation(new URL(playOnLinuxContext.getProperty("webservice.apps.url"))); }
InstallerSource function() throws MalformedURLException { return new InstallerSourceWebserviceDefaultImplementation(new URL(playOnLinuxContext.getProperty(STR))); }
/** * Source data for scripts * @return the bean * @throws MalformedURLException if the URL in the config file is malformed */
Source data for scripts
installerSource
{ "repo_name": "seijikun/POL-POM-5", "path": "src/main/java/com/playonlinux/app/PlayOnLinuxConfig.java", "license": "gpl-3.0", "size": 6391 }
[ "com.playonlinux.core.scripts.InstallerSource", "com.playonlinux.core.scripts.InstallerSourceWebserviceDefaultImplementation", "java.net.MalformedURLException" ]
import com.playonlinux.core.scripts.InstallerSource; import com.playonlinux.core.scripts.InstallerSourceWebserviceDefaultImplementation; import java.net.MalformedURLException;
import com.playonlinux.core.scripts.*; import java.net.*;
[ "com.playonlinux.core", "java.net" ]
com.playonlinux.core; java.net;
2,240,484
public static HARegionQueue getHARegionQueueInstance(String regionName, InternalCache cache, HARegionQueueAttributes hrqa, final int haRgnQType, final boolean isDurable, StatisticsClock statisticsClock) throws IOException, ClassNotFoundException, CacheException, InterruptedException { Map container; if (haRgnQType == HARegionQueue.BLOCKING_HA_QUEUE) { container = new HAContainerMap(new ConcurrentHashMap<>()); } else { // Should actually be HAContainerRegion, but ok if only JUnits using this // method. container = new HashMap<>(); } return getHARegionQueueInstance(regionName, cache, hrqa, haRgnQType, isDurable, container, null, Handshake.CONFLATION_DEFAULT, false, Boolean.FALSE, statisticsClock); }
static HARegionQueue function(String regionName, InternalCache cache, HARegionQueueAttributes hrqa, final int haRgnQType, final boolean isDurable, StatisticsClock statisticsClock) throws IOException, ClassNotFoundException, CacheException, InterruptedException { Map container; if (haRgnQType == HARegionQueue.BLOCKING_HA_QUEUE) { container = new HAContainerMap(new ConcurrentHashMap<>()); } else { container = new HashMap<>(); } return getHARegionQueueInstance(regionName, cache, hrqa, haRgnQType, isDurable, container, null, Handshake.CONFLATION_DEFAULT, false, Boolean.FALSE, statisticsClock); }
/** * Creates a HARegionQueue object with default attributes. used by tests * * @return an instance of HARegionQueue * @since GemFire 5.7 */
Creates a HARegionQueue object with default attributes. used by tests
getHARegionQueueInstance
{ "repo_name": "smgoller/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java", "license": "apache-2.0", "size": 150325 }
[ "java.io.IOException", "java.util.HashMap", "java.util.Map", "java.util.concurrent.ConcurrentHashMap", "org.apache.geode.cache.CacheException", "org.apache.geode.internal.cache.InternalCache", "org.apache.geode.internal.cache.tier.sockets.Handshake", "org.apache.geode.internal.statistics.StatisticsClock" ]
import java.io.IOException; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import org.apache.geode.cache.CacheException; import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.internal.cache.tier.sockets.Handshake; import org.apache.geode.internal.statistics.StatisticsClock;
import java.io.*; import java.util.*; import java.util.concurrent.*; import org.apache.geode.cache.*; import org.apache.geode.internal.cache.*; import org.apache.geode.internal.cache.tier.sockets.*; import org.apache.geode.internal.statistics.*;
[ "java.io", "java.util", "org.apache.geode" ]
java.io; java.util; org.apache.geode;
1,851,831
protected void validateDate(String field, String errorKey, String errorMessage) { String value = controller.getPara(field); if (StrKit.isBlank(value)) { addError(errorKey, errorMessage); return ; } try { new SimpleDateFormat(getDatePattern()).parse(value.trim()); // Date temp = Date.valueOf(value); 为了兼容 64位 JDK } catch (Exception e) { addError(errorKey, errorMessage); } }
void function(String field, String errorKey, String errorMessage) { String value = controller.getPara(field); if (StrKit.isBlank(value)) { addError(errorKey, errorMessage); return ; } try { new SimpleDateFormat(getDatePattern()).parse(value.trim()); } catch (Exception e) { addError(errorKey, errorMessage); } }
/** * Validate date. Date formate: yyyy-MM-dd */
Validate date. Date formate: yyyy-MM-dd
validateDate
{ "repo_name": "cokolin/JFinal-Servlet3", "path": "src/main/java/com/jfinal/validate/Validator.java", "license": "apache-2.0", "size": 15691 }
[ "com.jfinal.kit.StrKit", "java.text.SimpleDateFormat" ]
import com.jfinal.kit.StrKit; import java.text.SimpleDateFormat;
import com.jfinal.kit.*; import java.text.*;
[ "com.jfinal.kit", "java.text" ]
com.jfinal.kit; java.text;
1,803,209
@Beta public static Event<ResourceChangedPriority> resourceChangedPriority() { return new Event<>(DOMAIN_NAME + ".resourceChangedPriority", map("requestId", ResourceChangedPriority.class)); }
static Event<ResourceChangedPriority> function() { return new Event<>(DOMAIN_NAME + STR, map(STR, ResourceChangedPriority.class)); }
/** * Fired when resource loading priority is changed (EXPERIMENTAL) * * @return ResourceChangedPriority object */
Fired when resource loading priority is changed (EXPERIMENTAL)
resourceChangedPriority
{ "repo_name": "chrisblock/selenium", "path": "java/client/src/org/openqa/selenium/devtools/network/Network.java", "license": "apache-2.0", "size": 25604 }
[ "org.openqa.selenium.devtools.ConverterFunctions", "org.openqa.selenium.devtools.Event", "org.openqa.selenium.devtools.network.model.ResourceChangedPriority" ]
import org.openqa.selenium.devtools.ConverterFunctions; import org.openqa.selenium.devtools.Event; import org.openqa.selenium.devtools.network.model.ResourceChangedPriority;
import org.openqa.selenium.devtools.*; import org.openqa.selenium.devtools.network.model.*;
[ "org.openqa.selenium" ]
org.openqa.selenium;
1,034,176
@Test public void testCustomArrayType() { Jdbi db = Jdbi.create("jdbc:hsqldb:mem:" + UUID.randomUUID()); init(db); UserId user1 = new UserId(10); UserId user2 = new UserId(12); try (Handle handle = db.open()) { handle.execute("create table groups (" + "id int primary key, " + "user_ids int array)"); assertThat( handle.createUpdate("insert into groups (id, user_ids) values (?,?)") .bind(0, 1) .bind(1, new UserId[]{user1, user2}) .execute()) .isEqualTo(1); final List<UserId> result = handle.createQuery("select user_ids from groups where id = ?") .bind(0, 1) .mapTo(new GenericType<List<UserId>>() {}) .one(); assertThat(result).containsExactly(user1, user2); } } static class UserId { private final int id; UserId(int id) { this.id = id; }
void function() { Jdbi db = Jdbi.create(STR + UUID.randomUUID()); init(db); UserId user1 = new UserId(10); UserId user2 = new UserId(12); try (Handle handle = db.open()) { handle.execute(STR + STR + STR); assertThat( handle.createUpdate(STR) .bind(0, 1) .bind(1, new UserId[]{user1, user2}) .execute()) .isEqualTo(1); final List<UserId> result = handle.createQuery(STR) .bind(0, 1) .mapTo(new GenericType<List<UserId>>() {}) .one(); assertThat(result).containsExactly(user1, user2); } } static class UserId { private final int id; UserId(int id) { this.id = id; }
/** * Test binding and mapping a custom array type; binding requires registration * of a {@link SqlArrayType} implementation, and mapping requires registration * of a regular {@link ColumnMapper} for the element * type */
Test binding and mapping a custom array type; binding requires registration of a <code>SqlArrayType</code> implementation, and mapping requires registration of a regular <code>ColumnMapper</code> for the element type
testCustomArrayType
{ "repo_name": "john9x/jdbi", "path": "core/src/test/java/org/jdbi/v3/core/array/TestCustomArrayType.java", "license": "apache-2.0", "size": 3226 }
[ "java.util.List", "java.util.UUID", "org.assertj.core.api.Assertions", "org.jdbi.v3.core.Handle", "org.jdbi.v3.core.Jdbi", "org.jdbi.v3.core.generic.GenericType" ]
import java.util.List; import java.util.UUID; import org.assertj.core.api.Assertions; import org.jdbi.v3.core.Handle; import org.jdbi.v3.core.Jdbi; import org.jdbi.v3.core.generic.GenericType;
import java.util.*; import org.assertj.core.api.*; import org.jdbi.v3.core.*; import org.jdbi.v3.core.generic.*;
[ "java.util", "org.assertj.core", "org.jdbi.v3" ]
java.util; org.assertj.core; org.jdbi.v3;
2,873,227
private JPanel createHumanConfigurationPanel() { final int speed, visionDistance; JPanel panel; JLabel speedLabel, visionDistanceLabel; final JSlider speedSlider, visionDistanceSlider; //Create the components speed = this.linkedConfiguration.getHuman().getSpeed(); visionDistance = this.linkedConfiguration.getHuman().getVisionDistance(); panel = this.createTitledPanel("HUMÀ"); speedLabel = this.createLabel("Velocitat", 15); visionDistanceLabel = this.createLabel("Capacitat de visió", 15); speedSlider = this.createMinMaxSlider(speed, MIN_HUMAN_SPEED, MAX_HUMAN_SPEED, "Baixa", "Alta");//this.createTopLabelsSlider(speed, MIN_HUMAN_SPEED, MAX_HUMAN_SPEED, new JLabel("Baixa"), new JLabel("Alta"), new JLabel("Humà")); visionDistanceSlider = this.createMinMaxSlider(visionDistance, MIN_HUMAN_VISION_DISTANCE, MAX_HUMAN_VISION_DISTANCE, "Baixa", "Alta");//this.createTopLabelsSlider(visionDistance, MIN_HUMAN_VISION_DISTANCE, MAX_HUMAN_VISION_DISTANCE, new JLabel("Baixa"), new JLabel("Alta"), new JLabel("Humà")); //Add the components to the container panel.setLayout(new GridBagLayout()); panel.add(speedLabel, this.createConstraints(0, 0)); panel.add(speedSlider, this.createConstraints(0, 1)); panel.add(visionDistanceLabel, this.createConstraints(0, 2)); panel.add(visionDistanceSlider, this.createConstraints(0, 3)); panel.add(new JLabel(), this.createConstraints(0, 4, 1, 1, 1));
JPanel function() { final int speed, visionDistance; JPanel panel; JLabel speedLabel, visionDistanceLabel; final JSlider speedSlider, visionDistanceSlider; speed = this.linkedConfiguration.getHuman().getSpeed(); visionDistance = this.linkedConfiguration.getHuman().getVisionDistance(); panel = this.createTitledPanel("HUMÀ"); speedLabel = this.createLabel(STR, 15); visionDistanceLabel = this.createLabel(STR, 15); speedSlider = this.createMinMaxSlider(speed, MIN_HUMAN_SPEED, MAX_HUMAN_SPEED, "Baixa", "Alta"); visionDistanceSlider = this.createMinMaxSlider(visionDistance, MIN_HUMAN_VISION_DISTANCE, MAX_HUMAN_VISION_DISTANCE, "Baixa", "Alta"); panel.setLayout(new GridBagLayout()); panel.add(speedLabel, this.createConstraints(0, 0)); panel.add(speedSlider, this.createConstraints(0, 1)); panel.add(visionDistanceLabel, this.createConstraints(0, 2)); panel.add(visionDistanceSlider, this.createConstraints(0, 3)); panel.add(new JLabel(), this.createConstraints(0, 4, 1, 1, 1));
/** * Returns the panel used for configuring humans' parameters. * @return the panel */
Returns the panel used for configuring humans' parameters
createHumanConfigurationPanel
{ "repo_name": "XavierCollBagur/ZombieInvasion--Prepare-yourself-", "path": "ZombieInvasion/src/GUI/Components/Specific/ConfigurationPane.java", "license": "gpl-3.0", "size": 77196 }
[ "java.awt.GridBagLayout", "javax.swing.JLabel", "javax.swing.JPanel", "javax.swing.JSlider" ]
import java.awt.GridBagLayout; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
717,737
public static byte[] listToByteArray(List<CompressionMethod> compressionMethods) { DatagramWriter writer = new DatagramWriter(); for (CompressionMethod compressionMethod : compressionMethods) { writer.write(compressionMethod.getCode(), COMPRESSION_METHOD_BITS); } return writer.toByteArray(); }
static byte[] function(List<CompressionMethod> compressionMethods) { DatagramWriter writer = new DatagramWriter(); for (CompressionMethod compressionMethod : compressionMethods) { writer.write(compressionMethod.getCode(), COMPRESSION_METHOD_BITS); } return writer.toByteArray(); }
/** * Takes a list of compression methods and creates the representing byte * stream. * * @param compressionMethods * the list of the compression methods * @return the corresponding byte array */
Takes a list of compression methods and creates the representing byte stream
listToByteArray
{ "repo_name": "Orange-OpenSource/holico", "path": "sds/Californium/src/main/java/ch/ethz/inf/vs/californium/dtls/CompressionMethod.java", "license": "bsd-3-clause", "size": 4187 }
[ "ch.ethz.inf.vs.californium.util.DatagramWriter", "java.util.List" ]
import ch.ethz.inf.vs.californium.util.DatagramWriter; import java.util.List;
import ch.ethz.inf.vs.californium.util.*; import java.util.*;
[ "ch.ethz.inf", "java.util" ]
ch.ethz.inf; java.util;
1,725,287
public Configuration createEnvConfigWithTestResourceCredential() { // create configuration Configuration configuration = createEmptyEnvironmentConfiguration(); // create environments configuration.setEnvironments(envConfigurationfactory.createEnvironments()); List<Environment> environments = configuration.getEnvironments().getEnvironment(); // add environment Environment environment = addEnvironment(environments); // add credential "test-resource-credentialidentifier" Credential credential = envConfigurationfactory.createCredential(); credential.setId(TestUtilsTestConstants.credentialIdTestResource); credential.setUser(TestUtilsTestConstants.userTestResource); credential.setPassword(TestUtilsTestConstants.passwordTestResource); environment.getCredentials().getCredential().add(credential); return configuration; }
Configuration function() { Configuration configuration = createEmptyEnvironmentConfiguration(); configuration.setEnvironments(envConfigurationfactory.createEnvironments()); List<Environment> environments = configuration.getEnvironments().getEnvironment(); Environment environment = addEnvironment(environments); Credential credential = envConfigurationfactory.createCredential(); credential.setId(TestUtilsTestConstants.credentialIdTestResource); credential.setUser(TestUtilsTestConstants.userTestResource); credential.setPassword(TestUtilsTestConstants.passwordTestResource); environment.getCredentials().getCredential().add(credential); return configuration; }
/** * Create environment configuration with a single credential. The credential is * name "test-resource-credentialidentifier" in environment "environment-1". * * @return environment configuration with a single credential. */
Create environment configuration with a single credential. The credential is name "test-resource-credentialidentifier" in environment "environment-1"
createEnvConfigWithTestResourceCredential
{ "repo_name": "athrane/pineapple", "path": "testing/pineapple-test-utils/src/main/java/com/alpha/testutils/ObjectMotherEnvironmentConfiguration.java", "license": "gpl-3.0", "size": 28704 }
[ "com.alpha.pineapple.model.configuration.Configuration", "com.alpha.pineapple.model.configuration.Credential", "com.alpha.pineapple.model.configuration.Environment", "java.util.List" ]
import com.alpha.pineapple.model.configuration.Configuration; import com.alpha.pineapple.model.configuration.Credential; import com.alpha.pineapple.model.configuration.Environment; import java.util.List;
import com.alpha.pineapple.model.configuration.*; import java.util.*;
[ "com.alpha.pineapple", "java.util" ]
com.alpha.pineapple; java.util;
192,757
protected final VariableResolver getOriginalVariableResolver() { return this.originalVariableResolver; }
final VariableResolver function() { return this.originalVariableResolver; }
/** * Return the original JSF VariableResolver that this resolver delegates to. * Used to resolve standard JSF-managed beans. */
Return the original JSF VariableResolver that this resolver delegates to. Used to resolve standard JSF-managed beans
getOriginalVariableResolver
{ "repo_name": "GIP-RECIA/esco-grouper-ui", "path": "ext/bundles/org.springframework.web/src/main/java/org/springframework/web/jsf/DelegatingVariableResolver.java", "license": "apache-2.0", "size": 6893 }
[ "javax.faces.el.VariableResolver" ]
import javax.faces.el.VariableResolver;
import javax.faces.el.*;
[ "javax.faces" ]
javax.faces;
654,629
public Collection<Award> getAwardsToClose(ProposalAwardCloseDocument c);
Collection<Award> function(ProposalAwardCloseDocument c);
/** * Get a {@link Collection} of {@link Award}s to close. This is used by the {@link CloseBatchStep}. * * @param c * @return */
Get a <code>Collection</code> of <code>Award</code>s to close. This is used by the <code>CloseBatchStep</code>
getAwardsToClose
{ "repo_name": "quikkian-ua-devops/will-financials", "path": "kfs-cg/src/main/java/org/kuali/kfs/module/cg/dataaccess/CloseDao.java", "license": "agpl-3.0", "size": 2411 }
[ "java.util.Collection", "org.kuali.kfs.module.cg.businessobject.Award", "org.kuali.kfs.module.cg.document.ProposalAwardCloseDocument" ]
import java.util.Collection; import org.kuali.kfs.module.cg.businessobject.Award; import org.kuali.kfs.module.cg.document.ProposalAwardCloseDocument;
import java.util.*; import org.kuali.kfs.module.cg.businessobject.*; import org.kuali.kfs.module.cg.document.*;
[ "java.util", "org.kuali.kfs" ]
java.util; org.kuali.kfs;
1,849,007
private void fourthStep() { int[] area_tmp = new int[2]; int largestArea = -1, x = 0, y = 0, width = 0, height = 0; linkedMatrix = new LinkedMatrix(binaryMatrix); LinkedMatrixElement current = linkedMatrix.getCurrentRoot(); for (int i = 0; i < binaryMatrix.getRow(); i++) { for (int j = 0; j < binaryMatrix.getCol(); j++) { current = current.getNextRight(); if (binaryMatrix.getMatrix()[i][j]) { area_tmp[0] = temp3[i][j] * temp2[i][j]; area_tmp[1] = temp1[i][j] * temp4[i][j]; int max = Math.max(area_tmp[0], area_tmp[1]); // logger.debug(i+","+j+" | "+area_tmp[0]+" "+area_tmp[1]+" "+max); if (max == area_tmp[0]) { temp2[i][j] = temp2[i][j]; temp1[i][j] = temp3[i][j]; } else { temp2[i][j] = temp4[i][j]; temp1[i][j] = temp1[i][j]; } // Update largest rectangle if (max > largestArea) { largestArea = max; linkedMatrix.setLargestRectangle(current); x = i; y = j; if (max == area_tmp[0]) { width = temp2[i][j]; height = temp3[i][j]; } else { width = temp4[i][j]; height = temp1[i][j]; } } } else { current = linkedMatrix.deleteZero(current); } } } if (largestArea != -1) largestOne = new SortableRectangle(x, y, width, height); }
void function() { int[] area_tmp = new int[2]; int largestArea = -1, x = 0, y = 0, width = 0, height = 0; linkedMatrix = new LinkedMatrix(binaryMatrix); LinkedMatrixElement current = linkedMatrix.getCurrentRoot(); for (int i = 0; i < binaryMatrix.getRow(); i++) { for (int j = 0; j < binaryMatrix.getCol(); j++) { current = current.getNextRight(); if (binaryMatrix.getMatrix()[i][j]) { area_tmp[0] = temp3[i][j] * temp2[i][j]; area_tmp[1] = temp1[i][j] * temp4[i][j]; int max = Math.max(area_tmp[0], area_tmp[1]); if (max == area_tmp[0]) { temp2[i][j] = temp2[i][j]; temp1[i][j] = temp3[i][j]; } else { temp2[i][j] = temp4[i][j]; temp1[i][j] = temp1[i][j]; } if (max > largestArea) { largestArea = max; linkedMatrix.setLargestRectangle(current); x = i; y = j; if (max == area_tmp[0]) { width = temp2[i][j]; height = temp3[i][j]; } else { width = temp4[i][j]; height = temp1[i][j]; } } } else { current = linkedMatrix.deleteZero(current); } } } if (largestArea != -1) largestOne = new SortableRectangle(x, y, width, height); }
/** * Replace temp1 and temp2 values with width and height for the largest * rectangle starting (top left) at the current point updated with removal * of zero in the matrix */
Replace temp1 and temp2 values with width and height for the largest rectangle starting (top left) at the current point updated with removal of zero in the matrix
fourthStep
{ "repo_name": "jsubercaze/wsrm", "path": "src/main/java/fr/tse/lt2c/satin/matrix/extraction/linkedmatrix/refactored/WSMRDecomposer.java", "license": "apache-2.0", "size": 34036 }
[ "fr.tse.lt2c.satin.matrix.beans.LinkedMatrix", "fr.tse.lt2c.satin.matrix.beans.LinkedMatrixElement", "fr.tse.lt2c.satin.matrix.beans.SortableRectangle" ]
import fr.tse.lt2c.satin.matrix.beans.LinkedMatrix; import fr.tse.lt2c.satin.matrix.beans.LinkedMatrixElement; import fr.tse.lt2c.satin.matrix.beans.SortableRectangle;
import fr.tse.lt2c.satin.matrix.beans.*;
[ "fr.tse.lt2c" ]
fr.tse.lt2c;
1,288,835
public Agent createLegacyAgent(String address, Integer port, String authToken, String agentToken, String version) throws AgentCreateException;
Agent function(String address, Integer port, String authToken, String agentToken, String version) throws AgentCreateException;
/** * Create a new Agent object. The type of the agent that is created is the * legacy 'covalent-eam' type. */
Create a new Agent object. The type of the agent that is created is the legacy 'covalent-eam' type
createLegacyAgent
{ "repo_name": "cc14514/hq6", "path": "hq-server/src/main/java/org/hyperic/hq/appdef/shared/AgentManager.java", "license": "unlicense", "size": 24936 }
[ "org.hyperic.hq.appdef.Agent" ]
import org.hyperic.hq.appdef.Agent;
import org.hyperic.hq.appdef.*;
[ "org.hyperic.hq" ]
org.hyperic.hq;
747,089
public static boolean isLogicalFontFamilyName(String fontName) { return isLogicalFontFamilyNameLC(fontName.toLowerCase(Locale.ENGLISH)); }
static boolean function(String fontName) { return isLogicalFontFamilyNameLC(fontName.toLowerCase(Locale.ENGLISH)); }
/** * Checks whether the given font family name is a valid logical font name. * The check is case insensitive. */
Checks whether the given font family name is a valid logical font name. The check is case insensitive
isLogicalFontFamilyName
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk/jdk/src/share/classes/sun/awt/FontConfiguration.java", "license": "mit", "size": 94518 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
1,444,576
@SuppressWarnings("deprecation") public static void send(Material material, Location location, float xDev, float yDev, float zDev, float speed, int amount, Player... players) { int id = material.getId(); Object packet = new WrapperPlayOutWorldParticles("iconcrack_" + id) .setLocation(location) .setDeviations(xDev, yDev, zDev) .setSpeed(speed) .setAmount(amount).get(); EntityHandler.sendPacket(players, packet); }
@SuppressWarnings(STR) static void function(Material material, Location location, float xDev, float yDev, float zDev, float speed, int amount, Player... players) { int id = material.getId(); Object packet = new WrapperPlayOutWorldParticles(STR + id) .setLocation(location) .setDeviations(xDev, yDev, zDev) .setSpeed(speed) .setAmount(amount).get(); EntityHandler.sendPacket(players, packet); }
/** * Send a Particle once, with the specified options. All players * specified and within range will be able to see the particles. * * @param material The material that should be used for the particle. * Will cause unrecognizable particles if not an item. * @param location The location that these particles should display at. * @param xDev A value representing how far the particle can vary * on the x-axis. * @param yDev A value representing how far the particle can vary * on the y-axis. * @param zDev A value representing how far the particle can vary * on the z-axis. * @param speed A value representing how fast the particle will move. * @param amount The number of particles to display. * @param players The player(s) that should see these particles. */
Send a Particle once, with the specified options. All players specified and within range will be able to see the particles
send
{ "repo_name": "ewized/CommonUtils", "path": "src/main/java/com/archeinteractive/dev/commonutils/effects/particle/ParticleEffect.java", "license": "gpl-3.0", "size": 13679 }
[ "com.archeinteractive.dev.commonutils.network.packets.WrapperPlayOutWorldParticles", "com.archeinteractive.dev.commonutils.reflection.EntityHandler", "org.bukkit.Location", "org.bukkit.Material", "org.bukkit.entity.Player" ]
import com.archeinteractive.dev.commonutils.network.packets.WrapperPlayOutWorldParticles; import com.archeinteractive.dev.commonutils.reflection.EntityHandler; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player;
import com.archeinteractive.dev.commonutils.network.packets.*; import com.archeinteractive.dev.commonutils.reflection.*; import org.bukkit.*; import org.bukkit.entity.*;
[ "com.archeinteractive.dev", "org.bukkit", "org.bukkit.entity" ]
com.archeinteractive.dev; org.bukkit; org.bukkit.entity;
1,731,560
protected void indexDirectory(File dir){ for (File f : dir.listFiles()){ if (f.isDirectory()){ indexDirectory(f); continue; } else { indexFile(f); } } }
void function(File dir){ for (File f : dir.listFiles()){ if (f.isDirectory()){ indexDirectory(f); continue; } else { indexFile(f); } } }
/** * For files, add them to the signatures pipeline. * * For directories, recurse. * */
For files, add them to the signatures pipeline. For directories, recurse
indexDirectory
{ "repo_name": "HitTheSticks/alamode", "path": "src/com/htssoft/alamode/files/RecursiveIndexer.java", "license": "bsd-2-clause", "size": 2044 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
54,090
private void leaveMethodDef(DetailAST ast) { final BigInteger bigIntegerMax = BigInteger.valueOf(max); if (currentRangeValue.compareTo(bigIntegerMax) > 0) { log(ast, MSG_KEY, currentRangeValue, bigIntegerMax); } popValue(); currentRangeValue = INITIAL_VALUE; }
void function(DetailAST ast) { final BigInteger bigIntegerMax = BigInteger.valueOf(max); if (currentRangeValue.compareTo(bigIntegerMax) > 0) { log(ast, MSG_KEY, currentRangeValue, bigIntegerMax); } popValue(); currentRangeValue = INITIAL_VALUE; }
/** * Process the end of a method definition. * @param ast the token type representing the method definition */
Process the end of a method definition
leaveMethodDef
{ "repo_name": "jonmbake/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/NPathComplexityCheck.java", "license": "lgpl-2.1", "size": 16947 }
[ "com.puppycrawl.tools.checkstyle.api.DetailAST", "java.math.BigInteger" ]
import com.puppycrawl.tools.checkstyle.api.DetailAST; import java.math.BigInteger;
import com.puppycrawl.tools.checkstyle.api.*; import java.math.*;
[ "com.puppycrawl.tools", "java.math" ]
com.puppycrawl.tools; java.math;
258,120
List<FederationSet> getFederationSets(String gitblitUrl);
List<FederationSet> getFederationSets(String gitblitUrl);
/** * Returns the list of federation sets. * * @return list of federation sets * @since 1.4.0 */
Returns the list of federation sets
getFederationSets
{ "repo_name": "mrjoel/gitblit", "path": "src/main/java/com/gitblit/manager/IFederationManager.java", "license": "apache-2.0", "size": 5565 }
[ "com.gitblit.models.FederationSet", "java.util.List" ]
import com.gitblit.models.FederationSet; import java.util.List;
import com.gitblit.models.*; import java.util.*;
[ "com.gitblit.models", "java.util" ]
com.gitblit.models; java.util;
821,501
void resetServiceMessageCount() throws IOException;
void resetServiceMessageCount() throws IOException;
/** * Resets the count of service message invocations. * * @throws IOException Throws IOException. */
Resets the count of service message invocations
resetServiceMessageCount
{ "repo_name": "designreuse/flex-blazeds", "path": "modules/core/src/flex/management/runtime/messaging/endpoints/EndpointControlMBean.java", "license": "apache-2.0", "size": 3802 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
716,830
public KVStoreView<T> max(long max) { Preconditions.checkArgument(max > 0L, "max must be positive."); this.max = max; return this; }
KVStoreView<T> function(long max) { Preconditions.checkArgument(max > 0L, STR); this.max = max; return this; }
/** * Stops iteration after a number of elements has been retrieved. */
Stops iteration after a number of elements has been retrieved
max
{ "repo_name": "aokolnychyi/spark", "path": "common/kvstore/src/main/java/org/apache/spark/kvstore/KVStoreView.java", "license": "apache-2.0", "size": 3514 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,053,849
public File getRealPath(String path) { URL repository = axisConfiguration.getRepository(); if (repository != null) { File repo = new File(repository.getFile()); return new File(repo, path); } return null; }
File function(String path) { URL repository = axisConfiguration.getRepository(); if (repository != null) { File repo = new File(repository.getFile()); return new File(repo, path); } return null; }
/** * Allows users to resolve the path relative to the root directory. * * @param path a relative path * @return a File for the given path relative to the current repository, or null if no repo */
Allows users to resolve the path relative to the root directory
getRealPath
{ "repo_name": "intalio/axis2", "path": "modules/kernel/src/org/apache/axis2/context/ConfigurationContext.java", "license": "apache-2.0", "size": 35993 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,753,644
public final HttpClientBuilder setConnectionBackoffStrategy( final ConnectionBackoffStrategy connectionBackoffStrategy) { this.connectionBackoffStrategy = connectionBackoffStrategy; return this; }
final HttpClientBuilder function( final ConnectionBackoffStrategy connectionBackoffStrategy) { this.connectionBackoffStrategy = connectionBackoffStrategy; return this; }
/** * Assigns {@link ConnectionBackoffStrategy} instance. */
Assigns <code>ConnectionBackoffStrategy</code> instance
setConnectionBackoffStrategy
{ "repo_name": "garymabin/YGOMobile", "path": "apache-async-http-HC4/src/org/apache/http/HC4/impl/client/HttpClientBuilder.java", "license": "mit", "size": 44376 }
[ "org.apache.http.HC4" ]
import org.apache.http.HC4;
import org.apache.http.*;
[ "org.apache.http" ]
org.apache.http;
473,168
private boolean register(String paramString1, String paramString2) { try { XMPP.getInstance().register(paramString1, paramString2); return true; } catch (XMPPException localXMPPException) { localXMPPException.printStackTrace(); } catch (NoResponseException e) { e.printStackTrace(); } catch (NotConnectedException e) { e.printStackTrace(); } return false; }
boolean function(String paramString1, String paramString2) { try { XMPP.getInstance().register(paramString1, paramString2); return true; } catch (XMPPException localXMPPException) { localXMPPException.printStackTrace(); } catch (NoResponseException e) { e.printStackTrace(); } catch (NotConnectedException e) { e.printStackTrace(); } return false; }
/** * Register to xmpp server * * @param paramString1 * @param paramString2 * @return */
Register to xmpp server
register
{ "repo_name": "saveendhiman/OpenfirePluginSample", "path": "XMPP_Studio/app/src/main/java/com/example/xmpp/MainActivity.java", "license": "apache-2.0", "size": 13566 }
[ "org.jivesoftware.smack.SmackException", "org.jivesoftware.smack.XMPPException" ]
import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.*;
[ "org.jivesoftware.smack" ]
org.jivesoftware.smack;
2,444,487
ServiceCall getOverflowInt32Async(final ServiceCallback<Integer> serviceCallback) throws IllegalArgumentException;
ServiceCall getOverflowInt32Async(final ServiceCallback<Integer> serviceCallback) throws IllegalArgumentException;
/** * Get overflow Int32 value. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link ServiceCall} object */
Get overflow Int32 value
getOverflowInt32Async
{ "repo_name": "BurtBiel/autorest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyinteger/IntOperations.java", "license": "mit", "size": 8349 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,692,502
public static <T extends HasFileType> Iterable<T> filter( final Iterable<T> items, final Predicate<String> predicate) { return Iterables.filter(items, typeMatchingPredicateFrom(predicate)); }
static <T extends HasFileType> Iterable<T> function( final Iterable<T> items, final Predicate<String> predicate) { return Iterables.filter(items, typeMatchingPredicateFrom(predicate)); }
/** * A filter for Iterable<? extends HasFileType> that returns only those whose FileType matches the * specified Predicate. */
A filter for Iterable that returns only those whose FileType matches the specified Predicate
filter
{ "repo_name": "aehlig/bazel", "path": "src/main/java/com/google/devtools/build/lib/util/FileType.java", "license": "apache-2.0", "size": 9312 }
[ "com.google.common.base.Predicate", "com.google.common.collect.Iterables" ]
import com.google.common.base.Predicate; import com.google.common.collect.Iterables;
import com.google.common.base.*; import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
2,734,519
protected IFigure setupContentPane(IFigure nodeShape) { if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); } return nodeShape; // use nodeShape itself as contentPane }
IFigure function(IFigure nodeShape) { if (nodeShape.getLayoutManager() == null) { ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout(); layout.setSpacing(5); nodeShape.setLayoutManager(layout); } return nodeShape; }
/** * Default implementation treats passed figure as content pane. * Respects layout one may have set for generated figure. * @param nodeShape instance of generated figure class * @generated */
Default implementation treats passed figure as content pane. Respects layout one may have set for generated figure
setupContentPane
{ "repo_name": "MetaWebDesign/Editor", "path": "Editor_MWD.diagram/src/Metawebdesign/metawebdesign/diagram/edit/parts/NavegationMenu2EditPart.java", "license": "agpl-3.0", "size": 10344 }
[ "org.eclipse.draw2d.IFigure", "org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout" ]
import org.eclipse.draw2d.IFigure; import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
import org.eclipse.draw2d.*; import org.eclipse.gmf.runtime.draw2d.ui.figures.*;
[ "org.eclipse.draw2d", "org.eclipse.gmf" ]
org.eclipse.draw2d; org.eclipse.gmf;
2,104,641
public void setQuantity(BigDecimal newQuantity) { if (quantity == null) getProductProduced(); BigDecimal previousQuantity = quantity, componentQuantity; this.quantity = newQuantity; this.quantityIsUpdated = true; this.updateCompletionDate = true; if (productionRunComponents == null) getProductionRunComponents(); for (Iterator<GenericValue> iter = productionRunComponents.iterator(); iter.hasNext();) { GenericValue component = iter.next(); componentQuantity = component.getBigDecimal("estimatedQuantity"); component.set("estimatedQuantity", componentQuantity.divide(previousQuantity, 10, RoundingMode.HALF_UP).multiply(newQuantity).doubleValue()); } }
void function(BigDecimal newQuantity) { if (quantity == null) getProductProduced(); BigDecimal previousQuantity = quantity, componentQuantity; this.quantity = newQuantity; this.quantityIsUpdated = true; this.updateCompletionDate = true; if (productionRunComponents == null) getProductionRunComponents(); for (Iterator<GenericValue> iter = productionRunComponents.iterator(); iter.hasNext();) { GenericValue component = iter.next(); componentQuantity = component.getBigDecimal(STR); component.set(STR, componentQuantity.divide(previousQuantity, 10, RoundingMode.HALF_UP).multiply(newQuantity).doubleValue()); } }
/** * set the quantity property and recalculated the productComponent quantity. * @param newQuantity the new quantity to be set **/
set the quantity property and recalculated the productComponent quantity
setQuantity
{ "repo_name": "yuri0x7c1/ofbiz-explorer", "path": "src/test/resources/apache-ofbiz-17.12.04/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRun.java", "license": "apache-2.0", "size": 19418 }
[ "java.math.BigDecimal", "java.math.RoundingMode", "java.util.Iterator", "org.apache.ofbiz.entity.GenericValue" ]
import java.math.BigDecimal; import java.math.RoundingMode; import java.util.Iterator; import org.apache.ofbiz.entity.GenericValue;
import java.math.*; import java.util.*; import org.apache.ofbiz.entity.*;
[ "java.math", "java.util", "org.apache.ofbiz" ]
java.math; java.util; org.apache.ofbiz;
1,607,165
// TODO: Customize helper method public static void startActionPostDenuncia(Context context, String idDenuncia) { Intent intent = new Intent(context, DenunciaRestService.class); intent.setAction(ACTION_POST_DENUNCIA); intent.putExtra(EXTRA_ID_DENUNCIA, idDenuncia); context.startService(intent); } public DenunciaRestService() { super("DenunciaRestService"); }
static void function(Context context, String idDenuncia) { Intent intent = new Intent(context, DenunciaRestService.class); intent.setAction(ACTION_POST_DENUNCIA); intent.putExtra(EXTRA_ID_DENUNCIA, idDenuncia); context.startService(intent); } public DenunciaRestService() { super(STR); }
/** * Starts this service to perform action Post Denuncia with the given parameters. If * the service is already performing a task this action will be queued. * * @see IntentService */
Starts this service to perform action Post Denuncia with the given parameters. If the service is already performing a task this action will be queued
startActionPostDenuncia
{ "repo_name": "krito19/DenunciaMXAndroid", "path": "app/src/main/java/com/syca/apps/gob/denunciamx/sync/DenunciaRestService.java", "license": "apache-2.0", "size": 8715 }
[ "android.content.Context", "android.content.Intent" ]
import android.content.Context; import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
2,364,836
public static String forURL(String aURLFragment) { String result = null; try { result = URLEncoder.encode(aURLFragment, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new RuntimeException("UTF-8 not supported", ex); } return result; }
static String function(String aURLFragment) { String result = null; try { result = URLEncoder.encode(aURLFragment, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new RuntimeException(STR, ex); } return result; }
/** * borrowed from http://www.javapractices.com/Topic96.cjp * * * @param aURLFragment String * @return String */
borrowed from HREF
forURL
{ "repo_name": "dearmash/Processing", "path": "libraries/controlP5/src/controlP5/ControlP5IOHandler.java", "license": "mit", "size": 8526 }
[ "java.io.UnsupportedEncodingException", "java.net.URLEncoder" ]
import java.io.UnsupportedEncodingException; import java.net.URLEncoder;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,322,165
public Builder deliveryDate(LocalDate deliveryDate) { JodaBeanUtils.notNull(deliveryDate, "deliveryDate"); this.deliveryDate = deliveryDate; return this; }
Builder function(LocalDate deliveryDate) { JodaBeanUtils.notNull(deliveryDate, STR); this.deliveryDate = deliveryDate; return this; }
/** * Sets the delivery date. * <p> * The underlying swap is delivered on this date. * @param deliveryDate the new value, not null * @return this, for chaining, not null */
Sets the delivery date. The underlying swap is delivered on this date
deliveryDate
{ "repo_name": "jmptrader/Strata", "path": "modules/product/src/main/java/com/opengamma/strata/product/dsf/ResolvedDsf.java", "license": "apache-2.0", "size": 22335 }
[ "java.time.LocalDate", "org.joda.beans.JodaBeanUtils" ]
import java.time.LocalDate; import org.joda.beans.JodaBeanUtils;
import java.time.*; import org.joda.beans.*;
[ "java.time", "org.joda.beans" ]
java.time; org.joda.beans;
2,760,176
public void setId(String Id) { if ((this._state == MODE_SIGN) && (Id != null)) { this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); IdResolver.registerElementById(this._constructionElement, Id); } }
void function(String Id) { if ((this._state == MODE_SIGN) && (Id != null)) { this._constructionElement.setAttributeNS(null, Constants._ATT_ID, Id); IdResolver.registerElementById(this._constructionElement, Id); } }
/** * Sets the <code>Id</code> Element * * @param Id */
Sets the <code>Id</code> Element
setId
{ "repo_name": "test2v/DanDelXAdES", "path": "proj/xml-security-src-1_3_0/xml-security-1_3_0/src-xades/org/apache/xml/security/xades/QualifyingProperties.java", "license": "lgpl-3.0", "size": 7819 }
[ "org.apache.xml.security.utils.IdResolver", "org.apache.xml.security.xades.Constants" ]
import org.apache.xml.security.utils.IdResolver; import org.apache.xml.security.xades.Constants;
import org.apache.xml.security.utils.*; import org.apache.xml.security.xades.*;
[ "org.apache.xml" ]
org.apache.xml;
1,096,154
public static Iterator<ResultSetMetaDataWrapper> iterator(ResultSetMetaData resultSetMetaData) { return new ResultSetMetaDataIterator(resultSetMetaData); } private static class ResultSetMetaDataIterator implements Iterator<ResultSetMetaDataWrapper> { private ResultSetMetaData target; private int index = 1; public ResultSetMetaDataIterator(ResultSetMetaData target) { this.target = target; }
static Iterator<ResultSetMetaDataWrapper> function(ResultSetMetaData resultSetMetaData) { return new ResultSetMetaDataIterator(resultSetMetaData); } private static class ResultSetMetaDataIterator implements Iterator<ResultSetMetaDataWrapper> { private ResultSetMetaData target; private int index = 1; public ResultSetMetaDataIterator(ResultSetMetaData target) { this.target = target; }
/** * Return an Iterator given a ResultSetMetaData. * * Enables Groovy collection method syntactic sugar on ResultSetMetaData. * * @param resultSetMetaData the ResultSetMetaData to iterate over * @return an iterator for the ResultSetMetaData * @since 1.7 */
Return an Iterator given a ResultSetMetaData. Enables Groovy collection method syntactic sugar on ResultSetMetaData
iterator
{ "repo_name": "Selventa/model-builder", "path": "tools/groovy/src/subprojects/groovy-sql/src/main/java/org/codehaus/groovy/runtime/SqlGroovyMethods.java", "license": "apache-2.0", "size": 4087 }
[ "groovy.sql.ResultSetMetaDataWrapper", "java.sql.ResultSetMetaData", "java.util.Iterator" ]
import groovy.sql.ResultSetMetaDataWrapper; import java.sql.ResultSetMetaData; import java.util.Iterator;
import groovy.sql.*; import java.sql.*; import java.util.*;
[ "groovy.sql", "java.sql", "java.util" ]
groovy.sql; java.sql; java.util;
2,721,266
private void makeGithubSearchQuery() { String githubQuery = mSearchBoxEditText.getText().toString(); if (TextUtils.isEmpty(githubQuery)) { mUrlDisplayTextView.setText("No query entered, nothing to search for."); return; } URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); Bundle queryBundle = new Bundle(); queryBundle.putString(SEARCH_QUERY_URL_EXTRA, githubSearchUrl.toString()); LoaderManager loaderManager = getSupportLoaderManager(); Loader<String> githubSearchLoader = loaderManager.getLoader(GITHUB_SEARCH_LOADER); if (githubSearchLoader == null) { loaderManager.initLoader(GITHUB_SEARCH_LOADER, queryBundle, this); } else { loaderManager.restartLoader(GITHUB_SEARCH_LOADER, queryBundle, this); } }
void function() { String githubQuery = mSearchBoxEditText.getText().toString(); if (TextUtils.isEmpty(githubQuery)) { mUrlDisplayTextView.setText(STR); return; } URL githubSearchUrl = NetworkUtils.buildUrl(githubQuery); mUrlDisplayTextView.setText(githubSearchUrl.toString()); Bundle queryBundle = new Bundle(); queryBundle.putString(SEARCH_QUERY_URL_EXTRA, githubSearchUrl.toString()); LoaderManager loaderManager = getSupportLoaderManager(); Loader<String> githubSearchLoader = loaderManager.getLoader(GITHUB_SEARCH_LOADER); if (githubSearchLoader == null) { loaderManager.initLoader(GITHUB_SEARCH_LOADER, queryBundle, this); } else { loaderManager.restartLoader(GITHUB_SEARCH_LOADER, queryBundle, this); } }
/** * This method retrieves the search text from the EditText, constructs the * URL (using {@link NetworkUtils}) for the github repository you'd like to find, displays * that URL in a TextView, and finally request that an AsyncTaskLoader performs the GET request. */
This method retrieves the search text from the EditText, constructs the URL (using <code>NetworkUtils</code>) for the github repository you'd like to find, displays that URL in a TextView, and finally request that an AsyncTaskLoader performs the GET request
makeGithubSearchQuery
{ "repo_name": "GinaHsu/ud851-GinaExercises", "path": "Lesson05b-Smarter-GitHub-Repo-Search/T05b.03-Exercise-PolishAsyncTask/app/src/main/java/com/example/android/asynctaskloader/MainActivity.java", "license": "apache-2.0", "size": 10816 }
[ "android.os.Bundle", "android.support.v4.app.LoaderManager", "android.support.v4.content.Loader", "android.text.TextUtils", "com.example.android.asynctaskloader.utilities.NetworkUtils" ]
import android.os.Bundle; import android.support.v4.app.LoaderManager; import android.support.v4.content.Loader; import android.text.TextUtils; import com.example.android.asynctaskloader.utilities.NetworkUtils;
import android.os.*; import android.support.v4.app.*; import android.support.v4.content.*; import android.text.*; import com.example.android.asynctaskloader.utilities.*;
[ "android.os", "android.support", "android.text", "com.example.android" ]
android.os; android.support; android.text; com.example.android;
1,997,119
@Test(expected = Profile.ConfigException.class) public void testAssetNotFound() throws Exception { final Repo repo = GithubProfileTest.repo( Joiner.on('\n').join( "assets:", " test.xml: jeff/test1#test.xmls", "merge:", " script: hello!" ) ); final String yaml = "friends:\n - jeff/test2"; repo.github() .repos() .get(new Coordinates.Simple("jeff/test1")) .contents().create( Json.createObjectBuilder() .add("path", ".rultor.yml") .add("message", "rultor config") .add("content", Base64.encodeBase64String(yaml.getBytes())) .build() ); final Profile profile = new GithubProfile(repo); profile.assets(); }
@Test(expected = Profile.ConfigException.class) void function() throws Exception { final Repo repo = GithubProfileTest.repo( Joiner.on('\n').join( STR, STR, STR, STR ) ); final String yaml = STR; repo.github() .repos() .get(new Coordinates.Simple(STR)) .contents().create( Json.createObjectBuilder() .add("path", STR) .add(STR, STR) .add(STR, Base64.encodeBase64String(yaml.getBytes())) .build() ); final Profile profile = new GithubProfile(repo); profile.assets(); }
/** * GithubProfile should throw a ConfigException if some asset file doesn't * exist. * @throws Exception In case of error. */
GithubProfile should throw a ConfigException if some asset file doesn't exist
testAssetNotFound
{ "repo_name": "dalifreire/rultor", "path": "src/test/java/com/rultor/profiles/GithubProfileTest.java", "license": "bsd-3-clause", "size": 10266 }
[ "com.google.common.base.Joiner", "com.jcabi.github.Coordinates", "com.jcabi.github.Repo", "com.rultor.spi.Profile", "javax.json.Json", "org.apache.commons.codec.binary.Base64", "org.junit.Test" ]
import com.google.common.base.Joiner; import com.jcabi.github.Coordinates; import com.jcabi.github.Repo; import com.rultor.spi.Profile; import javax.json.Json; import org.apache.commons.codec.binary.Base64; import org.junit.Test;
import com.google.common.base.*; import com.jcabi.github.*; import com.rultor.spi.*; import javax.json.*; import org.apache.commons.codec.binary.*; import org.junit.*;
[ "com.google.common", "com.jcabi.github", "com.rultor.spi", "javax.json", "org.apache.commons", "org.junit" ]
com.google.common; com.jcabi.github; com.rultor.spi; javax.json; org.apache.commons; org.junit;
134,240
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Void>> deleteWithResponseAsync( String resourceGroupName, String namespaceName, String topicName, String subscriptionName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (namespaceName == null) { return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } if (topicName == null) { return Mono.error(new IllegalArgumentException("Parameter topicName is required and cannot be null.")); } if (subscriptionName == null) { return Mono .error(new IllegalArgumentException("Parameter subscriptionName 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.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), resourceGroupName, namespaceName, topicName, subscriptionName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Void>> function( String resourceGroupName, String namespaceName, String topicName, String subscriptionName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (namespaceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (topicName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (subscriptionName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), resourceGroupName, namespaceName, topicName, subscriptionName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); }
/** * Deletes a subscription from the specified topic. * * @param resourceGroupName Name of the Resource group within the Azure subscription. * @param namespaceName The namespace name. * @param topicName The topic name. * @param subscriptionName The subscription 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 the completion. */
Deletes a subscription from the specified topic
deleteWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-servicebus/src/main/java/com/azure/resourcemanager/servicebus/implementation/SubscriptionsClientImpl.java", "license": "mit", "size": 50121 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,392,330
private static double log2(double x) { return Math.log(x) / Math.log(2); } private static class BufferMap implements Iterable<Buffer>, Serializable { private static final long serialVersionUID = 1L; private final int capacity; private final RandomGenerator randomGenerator; private int count; private final int bufferSize; private final Map<Integer,List<Buffer>> registry; private int maxLevel; BufferMap(int capacity, int bufferSize, RandomGenerator randomGenerator) { this.bufferSize = bufferSize; this.capacity = capacity; this.randomGenerator = randomGenerator; this.registry = new HashMap<>(); } BufferMap(BufferMap original) { super(); this.bufferSize = original.bufferSize; this.capacity = original.capacity; this.count = 0; this.randomGenerator = original.randomGenerator; this.registry = new HashMap<>(); Iterator<Buffer> iterator = original.iterator(); while (iterator.hasNext()) { final Buffer current = iterator.next(); // Create and register a new buffer at the same level final Buffer newCopy = create(current.getLevel()); // Consume the data final double[] data = current.getData(); for (double value : data) { newCopy.consume(value); } } }
static double function(double x) { return Math.log(x) / Math.log(2); } private static class BufferMap implements Iterable<Buffer>, Serializable { private static final long serialVersionUID = 1L; private final int capacity; private final RandomGenerator randomGenerator; private int count; private final int bufferSize; private final Map<Integer,List<Buffer>> registry; private int maxLevel; BufferMap(int capacity, int bufferSize, RandomGenerator randomGenerator) { this.bufferSize = bufferSize; this.capacity = capacity; this.randomGenerator = randomGenerator; this.registry = new HashMap<>(); } BufferMap(BufferMap original) { super(); this.bufferSize = original.bufferSize; this.capacity = original.capacity; this.count = 0; this.randomGenerator = original.randomGenerator; this.registry = new HashMap<>(); Iterator<Buffer> iterator = original.iterator(); while (iterator.hasNext()) { final Buffer current = iterator.next(); final Buffer newCopy = create(current.getLevel()); final double[] data = current.getData(); for (double value : data) { newCopy.consume(value); } } }
/** * Computes base 2 log of the argument. * * @param x input value * @return the value y such that 2^y = x */
Computes base 2 log of the argument
log2
{ "repo_name": "sdinot/hipparchus", "path": "hipparchus-stat/src/main/java/org/hipparchus/stat/descriptive/rank/RandomPercentile.java", "license": "apache-2.0", "size": 50124 }
[ "java.io.Serializable", "java.util.HashMap", "java.util.Iterator", "java.util.List", "java.util.Map", "org.hipparchus.random.RandomGenerator" ]
import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import org.hipparchus.random.RandomGenerator;
import java.io.*; import java.util.*; import org.hipparchus.random.*;
[ "java.io", "java.util", "org.hipparchus.random" ]
java.io; java.util; org.hipparchus.random;
2,055,050
public BlockStateType getState(BasicBlock block, ContextType context);
BlockStateType function(BasicBlock block, ContextType context);
/** * Returns the abstract state for entry of the given basic block and context, * where null represents none. */
Returns the abstract state for entry of the given basic block and context, where null represents none
getState
{ "repo_name": "cursem/ScriptCompressor", "path": "ScriptCompressor1.0/src/dk/brics/tajs/solver/IAnalysisLatticeElement.java", "license": "apache-2.0", "size": 2598 }
[ "dk.brics.tajs.flowgraph.BasicBlock" ]
import dk.brics.tajs.flowgraph.BasicBlock;
import dk.brics.tajs.flowgraph.*;
[ "dk.brics.tajs" ]
dk.brics.tajs;
2,778,888
@Nullable public static Object compactObject(Object obj) { if (obj == null) return null; if (obj instanceof Enum) return obj.toString(); if (obj instanceof String || obj instanceof Boolean || obj instanceof Number) return obj; if (obj instanceof Collection) { Collection col = (Collection)obj; Object[] res = new Object[col.size()]; int i = 0; for (Object elm : col) res[i++] = compactObject(elm); return res; } if (obj.getClass().isArray()) { Class<?> arrType = obj.getClass().getComponentType(); if (arrType.isPrimitive()) { if (obj instanceof boolean[]) return Arrays.toString((boolean[])obj); if (obj instanceof byte[]) return Arrays.toString((byte[])obj); if (obj instanceof short[]) return Arrays.toString((short[])obj); if (obj instanceof int[]) return Arrays.toString((int[])obj); if (obj instanceof long[]) return Arrays.toString((long[])obj); if (obj instanceof float[]) return Arrays.toString((float[])obj); if (obj instanceof double[]) return Arrays.toString((double[])obj); } Object[] arr = (Object[])obj; int iMax = arr.length - 1; StringBuilder sb = new StringBuilder("["); for (int i = 0; i <= iMax; i++) { sb.append(compactObject(arr[i])); if (i != iMax) sb.append(", "); } sb.append(']'); return sb.toString(); } return U.compact(obj.getClass().getName()); }
@Nullable static Object function(Object obj) { if (obj == null) return null; if (obj instanceof Enum) return obj.toString(); if (obj instanceof String obj instanceof Boolean obj instanceof Number) return obj; if (obj instanceof Collection) { Collection col = (Collection)obj; Object[] res = new Object[col.size()]; int i = 0; for (Object elm : col) res[i++] = compactObject(elm); return res; } if (obj.getClass().isArray()) { Class<?> arrType = obj.getClass().getComponentType(); if (arrType.isPrimitive()) { if (obj instanceof boolean[]) return Arrays.toString((boolean[])obj); if (obj instanceof byte[]) return Arrays.toString((byte[])obj); if (obj instanceof short[]) return Arrays.toString((short[])obj); if (obj instanceof int[]) return Arrays.toString((int[])obj); if (obj instanceof long[]) return Arrays.toString((long[])obj); if (obj instanceof float[]) return Arrays.toString((float[])obj); if (obj instanceof double[]) return Arrays.toString((double[])obj); } Object[] arr = (Object[])obj; int iMax = arr.length - 1; StringBuilder sb = new StringBuilder("["); for (int i = 0; i <= iMax; i++) { sb.append(compactObject(arr[i])); if (i != iMax) sb.append(STR); } sb.append(']'); return sb.toString(); } return U.compact(obj.getClass().getName()); }
/** * Returns compact class host. * * @param obj Object to compact. * @return String. */
Returns compact class host
compactObject
{ "repo_name": "chandresh-pancholi/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java", "license": "apache-2.0", "size": 40882 }
[ "java.util.Arrays", "java.util.Collection", "org.apache.ignite.internal.util.typedef.internal.U", "org.jetbrains.annotations.Nullable" ]
import java.util.Arrays; import java.util.Collection; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable;
import java.util.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*;
[ "java.util", "org.apache.ignite", "org.jetbrains.annotations" ]
java.util; org.apache.ignite; org.jetbrains.annotations;
1,386,651
public static DestinyCellCriteria starCriteria(Destiny destiny, Star star) { return new DestinyCellCriteria(destiny, star); } public static class Context { private List<Boolean> results = new ArrayList<Boolean>(); private Function<List<Boolean>, Boolean> CollectorFunction = null; private Function<List<Boolean>, Boolean> checkSkipFunction = null; public Context() { setCollectResultFunction(results -> { for (boolean result : results) { if (!result) { return false; } } return true; }); setCheckSkipFunction(results -> { for (boolean result : results) { if (!result) { return true; } } return false; }); }
static DestinyCellCriteria function(Destiny destiny, Star star) { return new DestinyCellCriteria(destiny, star); } public static class Context { private List<Boolean> results = new ArrayList<Boolean>(); private Function<List<Boolean>, Boolean> CollectorFunction = null; private Function<List<Boolean>, Boolean> checkSkipFunction = null; public Context() { setCollectResultFunction(results -> { for (boolean result : results) { if (!result) { return false; } } return true; }); setCheckSkipFunction(results -> { for (boolean result : results) { if (!result) { return true; } } return false; }); }
/** * Star criteria. * * @param destiny * the destiny * @param star * the star * @return the destiny cell criteria */
Star criteria
starCriteria
{ "repo_name": "airicyu/Fortel", "path": "fortelcore/src/main/java/com/airic/fortel/core/util/DestinyCellCriteria.java", "license": "apache-2.0", "size": 42611 }
[ "com.airic.fortel.core.model.Destiny", "com.airic.fortel.core.model.Star", "java.util.ArrayList", "java.util.List", "java.util.function.Function" ]
import com.airic.fortel.core.model.Destiny; import com.airic.fortel.core.model.Star; import java.util.ArrayList; import java.util.List; import java.util.function.Function;
import com.airic.fortel.core.model.*; import java.util.*; import java.util.function.*;
[ "com.airic.fortel", "java.util" ]
com.airic.fortel; java.util;
2,199,430
public List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty> addExtendedProperties(List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty> extendedProperties) throws Exception { MozuClient<List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty>> client = com.mozu.api.clients.commerce.carts.ExtendedPropertyClient.addExtendedPropertiesClient( extendedProperties); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); }
List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty> function(List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty> extendedProperties) throws Exception { MozuClient<List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty>> client = com.mozu.api.clients.commerce.carts.ExtendedPropertyClient.addExtendedPropertiesClient( extendedProperties); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); }
/** * carts-cartextendedproperties Post AddExtendedProperties description DOCUMENT_HERE * <p><pre><code> * ExtendedProperty extendedproperty = new ExtendedProperty(); * ExtendedProperty extendedProperty = extendedproperty.addExtendedProperties( extendedProperties); * </code></pre></p> * @param extendedProperties Mozu.CommerceRuntime.Contracts.Commerce.ExtendedProperty ApiType DOCUMENT_HERE * @return List<com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty> * @see com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty * @see com.mozu.api.contracts.commerceruntime.commerce.ExtendedProperty */
carts-cartextendedproperties Post AddExtendedProperties description DOCUMENT_HERE <code><code> ExtendedProperty extendedproperty = new ExtendedProperty(); ExtendedProperty extendedProperty = extendedproperty.addExtendedProperties( extendedProperties); </code></code>
addExtendedProperties
{ "repo_name": "johngatti/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/carts/ExtendedPropertyResource.java", "license": "mit", "size": 16409 }
[ "com.mozu.api.MozuClient", "java.util.List" ]
import com.mozu.api.MozuClient; import java.util.List;
import com.mozu.api.*; import java.util.*;
[ "com.mozu.api", "java.util" ]
com.mozu.api; java.util;
1,870,920
// Must source ∈ selectedSources? ListenableFuture<EquivalentSchedule> resolveSchedules(Iterable<Channel> channels, Interval interval, Publisher source, Set<Publisher> selectedSources);
ListenableFuture<EquivalentSchedule> resolveSchedules(Iterable<Channel> channels, Interval interval, Publisher source, Set<Publisher> selectedSources);
/** * <p>Resolve a schedule, according to a {@link Publisher}, of equivalent {@link * org.atlasapi.content.Item Item}s broadcast on the provided {@link Channel}s over the given * {@link Interval}.</p> * <p> * <p>Only Items from the selected sources are returned in the schedule.</p> * <p> * <p>The returned {@link EquivalentSchedule} must contain a (possibly empty) {@link * EquivalentChannelSchedule} for each requested {@link Channel}.</p> * * @param channels - channels for which to return schedules. * @param interval - interval over which the schedule should be resolved. * @param source - the schedule source. * @param selectedSources - the sources of which Items should be returned. * @return a {@link ListenableFuture} of the resolved schedule. */
Resolve a schedule, according to a <code>Publisher</code>, of equivalent <code>org.atlasapi.content.Item Item</code>s broadcast on the provided <code>Channel</code>s over the given <code>Interval</code>. Only Items from the selected sources are returned in the schedule. The returned <code>EquivalentSchedule</code> must contain a (possibly empty) <code>EquivalentChannelSchedule</code> for each requested <code>Channel</code>
resolveSchedules
{ "repo_name": "atlasapi/atlas-deer", "path": "atlas-core/src/main/java/org/atlasapi/schedule/EquivalentScheduleResolver.java", "license": "apache-2.0", "size": 3004 }
[ "com.google.common.util.concurrent.ListenableFuture", "java.util.Set", "org.atlasapi.channel.Channel", "org.atlasapi.media.entity.Publisher", "org.joda.time.Interval" ]
import com.google.common.util.concurrent.ListenableFuture; import java.util.Set; import org.atlasapi.channel.Channel; import org.atlasapi.media.entity.Publisher; import org.joda.time.Interval;
import com.google.common.util.concurrent.*; import java.util.*; import org.atlasapi.channel.*; import org.atlasapi.media.entity.*; import org.joda.time.*;
[ "com.google.common", "java.util", "org.atlasapi.channel", "org.atlasapi.media", "org.joda.time" ]
com.google.common; java.util; org.atlasapi.channel; org.atlasapi.media; org.joda.time;
2,336,552
public Analyzer getAnalyzer(String analyzer) throws IOException { AnalysisModule.AnalysisProvider<AnalyzerProvider> analyzerProvider = this.prebuiltAnalysis.getAnalyzerProvider(analyzer); if (analyzerProvider == null) { AnalysisModule.AnalysisProvider<AnalyzerProvider> provider = analyzers.get(analyzer); return provider == null ? null : cachedAnalyzer.computeIfAbsent(analyzer, (key) -> { try { return provider.get(environment, key).get(); } catch (IOException ex) { throw new ElasticsearchException("failed to load analyzer for name " + key, ex); }} ); } return analyzerProvider.get(environment, analyzer).get(); }
Analyzer function(String analyzer) throws IOException { AnalysisModule.AnalysisProvider<AnalyzerProvider> analyzerProvider = this.prebuiltAnalysis.getAnalyzerProvider(analyzer); if (analyzerProvider == null) { AnalysisModule.AnalysisProvider<AnalyzerProvider> provider = analyzers.get(analyzer); return provider == null ? null : cachedAnalyzer.computeIfAbsent(analyzer, (key) -> { try { return provider.get(environment, key).get(); } catch (IOException ex) { throw new ElasticsearchException(STR + key, ex); }} ); } return analyzerProvider.get(environment, analyzer).get(); }
/** * Returns a registered {@link Analyzer} provider by name or <code>null</code> if the analyzer was not registered */
Returns a registered <code>Analyzer</code> provider by name or <code>null</code> if the analyzer was not registered
getAnalyzer
{ "repo_name": "nomoa/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/analysis/AnalysisRegistry.java", "license": "apache-2.0", "size": 28359 }
[ "java.io.IOException", "org.apache.lucene.analysis.Analyzer", "org.elasticsearch.ElasticsearchException", "org.elasticsearch.indices.analysis.AnalysisModule" ]
import java.io.IOException; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.indices.analysis.AnalysisModule;
import java.io.*; import org.apache.lucene.analysis.*; import org.elasticsearch.*; import org.elasticsearch.indices.analysis.*;
[ "java.io", "org.apache.lucene", "org.elasticsearch", "org.elasticsearch.indices" ]
java.io; org.apache.lucene; org.elasticsearch; org.elasticsearch.indices;
1,167,882
@Test public void testConstructorString() throws IOException { String fileName = file.getAbsolutePath(); PlateReaderInteger plateReader = new PlateReaderInteger(fileName); assertTrue(plateReader != null); plateReader.close(); }
void function() throws IOException { String fileName = file.getAbsolutePath(); PlateReaderInteger plateReader = new PlateReaderInteger(fileName); assertTrue(plateReader != null); plateReader.close(); }
/** * Tests the reader constructor. * @throws IOException */
Tests the reader constructor
testConstructorString
{ "repo_name": "jessemull/MicroFlex", "path": "src/test/java/com/github/jessemull/microflex/io/iointeger/PlateReaderIntegerTest.java", "license": "apache-2.0", "size": 10662 }
[ "com.github.jessemull.microflex.integerflex.io.PlateReaderInteger", "java.io.IOException", "org.junit.Assert" ]
import com.github.jessemull.microflex.integerflex.io.PlateReaderInteger; import java.io.IOException; import org.junit.Assert;
import com.github.jessemull.microflex.integerflex.io.*; import java.io.*; import org.junit.*;
[ "com.github.jessemull", "java.io", "org.junit" ]
com.github.jessemull; java.io; org.junit;
264,525
public synchronized void save() throws IOException { if(BulkChange.contains(this)) { return; } long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); FingerprintStorage configuredFingerprintStorage = FingerprintStorage.get(); FingerprintStorage fileFingerprintStorage = FingerprintStorage.getFileFingerprintStorage(); // Implementations are expected to invoke SaveableListener on their own if relevant // TODO: Consider improving Saveable Listener API: https://issues.jenkins-ci.org/browse/JENKINS-62543 configuredFingerprintStorage.save(this); // In the case that external fingerprint storage is configured, there may be some fingerprints in memory that // get saved before a load call (because they are already in memory). This ensures that they get deleted from // the file fingerprint storage. // TODO: Consider improving KeyedDataStorage so it provides an API for clearing the fingerprints in memory. if (!(configuredFingerprintStorage instanceof FileFingerprintStorage) && fileFingerprintStorage.isReady()) { fileFingerprintStorage.delete(this.getHashString()); } if(logger.isLoggable(Level.FINE)) logger.fine("Saving fingerprint " + getHashString() + " took " + (System.currentTimeMillis() - start) + "ms"); }
synchronized void function() throws IOException { if(BulkChange.contains(this)) { return; } long start=0; if(logger.isLoggable(Level.FINE)) start = System.currentTimeMillis(); FingerprintStorage configuredFingerprintStorage = FingerprintStorage.get(); FingerprintStorage fileFingerprintStorage = FingerprintStorage.getFileFingerprintStorage(); configuredFingerprintStorage.save(this); if (!(configuredFingerprintStorage instanceof FileFingerprintStorage) && fileFingerprintStorage.isReady()) { fileFingerprintStorage.delete(this.getHashString()); } if(logger.isLoggable(Level.FINE)) logger.fine(STR + getHashString() + STR + (System.currentTimeMillis() - start) + "ms"); }
/** * Save the Fingerprint in the Fingerprint Storage * @throws IOException Save error */
Save the Fingerprint in the Fingerprint Storage
save
{ "repo_name": "DanielWeber/jenkins", "path": "core/src/main/java/hudson/model/Fingerprint.java", "license": "mit", "size": 51963 }
[ "java.io.IOException", "java.util.logging.Level" ]
import java.io.IOException; import java.util.logging.Level;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
717,424
private boolean isIgnoreDuplicatesPeriodExpired() { boolean expired = false; DateTime when = ignoreDuplicatesPeriodStartTime.plusSeconds(getIgnoreDuplicatesPeriod()); if (when.isBeforeNow()) { expired = true; } return expired; }
boolean function() { boolean expired = false; DateTime when = ignoreDuplicatesPeriodStartTime.plusSeconds(getIgnoreDuplicatesPeriod()); if (when.isBeforeNow()) { expired = true; } return expired; }
/** * Calculates whether or not the ignore duplicates period has expired. * @return */
Calculates whether or not the ignore duplicates period has expired
isIgnoreDuplicatesPeriodExpired
{ "repo_name": "sudduth/Aardin", "path": "Core/CoreImpl/src/main/java/org/aardin/core/service/notification/Notification.java", "license": "agpl-3.0", "size": 23851 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
715,846
@Test public void testRemoveWithIterator() throws Exception { DefaultDiskStorage storage = getStorageSupplier(1).get(); final String resourceId1 = "resource1"; final byte[] value1 = new byte[100]; value1[80] = 101; final String resourceId2 = "resource2"; final byte[] value2 = new byte[104]; value2[80] = 102; final String resourceId3 = "resource3"; final byte[] value3 = new byte[106]; value3[80] = 103; writeFileToStorage(storage, resourceId1, value1); final long time2 = 1000L; when(mClock.now()).thenReturn(time2); writeFileToStorage(storage, resourceId2, value2); when(mClock.now()).thenReturn(2000L); writeFileToStorage(storage, resourceId3, value3); List<File> files = findNewFiles(mDirectory, Collections.<File>emptySet(), true); // there should be 1 file per entry assertEquals(3, files.size()); // now delete entry2 Collection<DiskStorage.Entry> entries = storage.getEntries(); for (DiskStorage.Entry entry : entries) { if (Math.abs(entry.getTimestamp() - time2) < 500) { storage.remove(entry); } } assertFalse(storage.contains(resourceId2, null)); List<File> remaining = findNewFiles(mDirectory, Collections.<File>emptySet(), true); // 2 entries remain assertEquals(2, remaining.size()); // none of them with timestamp close to time2 List<DiskStorage.Entry> entries1 = new ArrayList<>(storage.getEntries()); assertEquals(2, entries1.size()); // first DiskStorage.Entry entry = entries1.get(0); assertFalse(Math.abs(entry.getTimestamp() - time2) < 500); // second entry = entries1.get(1); assertFalse(Math.abs(entry.getTimestamp() - time2) < 500); }
void function() throws Exception { DefaultDiskStorage storage = getStorageSupplier(1).get(); final String resourceId1 = STR; final byte[] value1 = new byte[100]; value1[80] = 101; final String resourceId2 = STR; final byte[] value2 = new byte[104]; value2[80] = 102; final String resourceId3 = STR; final byte[] value3 = new byte[106]; value3[80] = 103; writeFileToStorage(storage, resourceId1, value1); final long time2 = 1000L; when(mClock.now()).thenReturn(time2); writeFileToStorage(storage, resourceId2, value2); when(mClock.now()).thenReturn(2000L); writeFileToStorage(storage, resourceId3, value3); List<File> files = findNewFiles(mDirectory, Collections.<File>emptySet(), true); assertEquals(3, files.size()); Collection<DiskStorage.Entry> entries = storage.getEntries(); for (DiskStorage.Entry entry : entries) { if (Math.abs(entry.getTimestamp() - time2) < 500) { storage.remove(entry); } } assertFalse(storage.contains(resourceId2, null)); List<File> remaining = findNewFiles(mDirectory, Collections.<File>emptySet(), true); assertEquals(2, remaining.size()); List<DiskStorage.Entry> entries1 = new ArrayList<>(storage.getEntries()); assertEquals(2, entries1.size()); DiskStorage.Entry entry = entries1.get(0); assertFalse(Math.abs(entry.getTimestamp() - time2) < 500); entry = entries1.get(1); assertFalse(Math.abs(entry.getTimestamp() - time2) < 500); }
/** * Inserts 3 files with different dates. * Check what files are there. * Uses an iterator to remove the one in the middle. * Check that later. * @throws Exception */
Inserts 3 files with different dates. Check what files are there. Uses an iterator to remove the one in the middle. Check that later
testRemoveWithIterator
{ "repo_name": "s1rius/fresco", "path": "imagepipeline-base/src/test/java/com/facebook/cache/disk/DefaultDiskStorageTest.java", "license": "mit", "size": 22893 }
[ "java.io.File", "java.util.ArrayList", "java.util.Collection", "java.util.Collections", "java.util.List", "org.junit.Assert", "org.mockito.Mockito" ]
import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import org.junit.Assert; import org.mockito.Mockito;
import java.io.*; import java.util.*; import org.junit.*; import org.mockito.*;
[ "java.io", "java.util", "org.junit", "org.mockito" ]
java.io; java.util; org.junit; org.mockito;
1,861,029
@Override public void onClose(WebSocket conn, int code, String reason, boolean remote) { conns.remove(conn); System.out.println("Closed connection to " + conn.getRemoteSocketAddress().getAddress().getHostAddress()); }
void function(WebSocket conn, int code, String reason, boolean remote) { conns.remove(conn); System.out.println(STR + conn.getRemoteSocketAddress().getAddress().getHostAddress()); }
/** * Method handler when a connection has been closed. */
Method handler when a connection has been closed
onClose
{ "repo_name": "Screenful/screenful-gestures", "path": "server/Screenful-GestureServer/src/screenful/server/GestureServer.java", "license": "mit", "size": 6433 }
[ "org.java_websocket.WebSocket" ]
import org.java_websocket.WebSocket;
import org.java_websocket.*;
[ "org.java_websocket" ]
org.java_websocket;
2,217,209
private JButton getBtnApply() { if (btnApply == null) { btnApply = new JButton(); btnApply.setText(Constant.messages.getString("history.filter.button.apply")); btnApply.addActionListener( e -> { filter.setOpcodes(wsUiHelper.getSelectedOpcodeIntegers()); filter.setDirection(wsUiHelper.getDirection()); if (filter.isValidPattern( wsUiHelper.getPattern(), wsUiHelper.getRegexCheckbox().isSelected())) { filter.setPayloadFilter( wsUiHelper.getPattern(), wsUiHelper.getRegexCheckbox().isSelected(), wsUiHelper.getCaseIgnoreCheckbox().isSelected(), wsUiHelper.getInverseCheckbox().isSelected()); } else { // show popup View.getSingleton() .showWarningDialog( Constant.messages.getString( "websocket.invalidpattern")); wsUiHelper.getPatternTextField().requestFocusInWindow(); return; } exitResult = JOptionPane.OK_OPTION; WebSocketMessagesViewFilterDialog.this.dispose(); }); } return btnApply; }
JButton function() { if (btnApply == null) { btnApply = new JButton(); btnApply.setText(Constant.messages.getString(STR)); btnApply.addActionListener( e -> { filter.setOpcodes(wsUiHelper.getSelectedOpcodeIntegers()); filter.setDirection(wsUiHelper.getDirection()); if (filter.isValidPattern( wsUiHelper.getPattern(), wsUiHelper.getRegexCheckbox().isSelected())) { filter.setPayloadFilter( wsUiHelper.getPattern(), wsUiHelper.getRegexCheckbox().isSelected(), wsUiHelper.getCaseIgnoreCheckbox().isSelected(), wsUiHelper.getInverseCheckbox().isSelected()); } else { View.getSingleton() .showWarningDialog( Constant.messages.getString( STR)); wsUiHelper.getPatternTextField().requestFocusInWindow(); return; } exitResult = JOptionPane.OK_OPTION; WebSocketMessagesViewFilterDialog.this.dispose(); }); } return btnApply; }
/** * This method initializes btnApply * * @return javax.swing.JButton */
This method initializes btnApply
getBtnApply
{ "repo_name": "thc202/zap-extensions", "path": "addOns/websocket/src/main/java/org/zaproxy/zap/extension/websocket/ui/WebSocketMessagesViewFilterDialog.java", "license": "apache-2.0", "size": 10282 }
[ "javax.swing.JButton", "javax.swing.JOptionPane", "org.parosproxy.paros.Constant", "org.parosproxy.paros.view.View" ]
import javax.swing.JButton; import javax.swing.JOptionPane; import org.parosproxy.paros.Constant; import org.parosproxy.paros.view.View;
import javax.swing.*; import org.parosproxy.paros.*; import org.parosproxy.paros.view.*;
[ "javax.swing", "org.parosproxy.paros" ]
javax.swing; org.parosproxy.paros;
2,128,726
public void testInvokeAny3() throws Throwable { ExecutorService e = new ForkJoinPool(1); PoolCleaner cleaner = null; try { cleaner = cleaner(e); List<Callable<String>> l = new ArrayList<>(); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) {} } finally { if (cleaner != null) { cleaner.close(); } } }
void function() throws Throwable { ExecutorService e = new ForkJoinPool(1); PoolCleaner cleaner = null; try { cleaner = cleaner(e); List<Callable<String>> l = new ArrayList<>(); l.add(null); try { e.invokeAny(l); shouldThrow(); } catch (NullPointerException success) {} } finally { if (cleaner != null) { cleaner.close(); } } }
/** * invokeAny(c) throws NullPointerException if c has a single null element */
invokeAny(c) throws NullPointerException if c has a single null element
testInvokeAny3
{ "repo_name": "streamsupport/streamsupport", "path": "src/tests/java/org/openjdk/tests/tck/ForkJoinPoolTest.java", "license": "gpl-2.0", "size": 41090 }
[ "java.util.ArrayList", "java.util.List", "java.util.concurrent.Callable", "java.util.concurrent.ExecutorService" ]
import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService;
import java.util.*; import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,055,674
@Reference( name = "claimManagementService", service = org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = "unsetClaimMetadataManagementService") protected void setClaimMetadataManagementService(ClaimMetadataManagementService claimManagementService) { if (logger.isDebugEnabled()) { logger.debug("claimManagementService set in SCIMCommonComponent bundle"); } SCIMCommonComponentHolder.setClaimManagementService(claimManagementService); }
@Reference( name = STR, service = org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService.class, cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, unbind = STR) void function(ClaimMetadataManagementService claimManagementService) { if (logger.isDebugEnabled()) { logger.debug(STR); } SCIMCommonComponentHolder.setClaimManagementService(claimManagementService); }
/** * Set claim metadata management service implementation. * * @param claimManagementService ClaimManagementService */
Set claim metadata management service implementation
setClaimMetadataManagementService
{ "repo_name": "wso2-extensions/identity-inbound-provisioning-scim2", "path": "components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/internal/SCIMCommonComponent.java", "license": "apache-2.0", "size": 13540 }
[ "org.osgi.service.component.annotations.Reference", "org.osgi.service.component.annotations.ReferenceCardinality", "org.osgi.service.component.annotations.ReferencePolicy", "org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService" ]
import org.osgi.service.component.annotations.Reference; import org.osgi.service.component.annotations.ReferenceCardinality; import org.osgi.service.component.annotations.ReferencePolicy; import org.wso2.carbon.identity.claim.metadata.mgt.ClaimMetadataManagementService;
import org.osgi.service.component.annotations.*; import org.wso2.carbon.identity.claim.metadata.mgt.*;
[ "org.osgi.service", "org.wso2.carbon" ]
org.osgi.service; org.wso2.carbon;
293,440
public void setCheckedImmediately(boolean checked){ if(mButtonDrawable instanceof RadioButtonDrawable){ RadioButtonDrawable drawable = (RadioButtonDrawable)mButtonDrawable; drawable.setAnimEnable(false); setChecked(checked); drawable.setAnimEnable(true); } else setChecked(checked); }
void function(boolean checked){ if(mButtonDrawable instanceof RadioButtonDrawable){ RadioButtonDrawable drawable = (RadioButtonDrawable)mButtonDrawable; drawable.setAnimEnable(false); setChecked(checked); drawable.setAnimEnable(true); } else setChecked(checked); }
/** * Change the checked state of this button immediately without showing animation. * @param checked The checked state. */
Change the checked state of this button immediately without showing animation
setCheckedImmediately
{ "repo_name": "KouChengjian/MaterialDesignLibrary", "path": "materialdesignlib/src/com/android/material/widget/RadioButton.java", "license": "gpl-2.0", "size": 1901 }
[ "com.android.material.widget.drawable.RadioButtonDrawable" ]
import com.android.material.widget.drawable.RadioButtonDrawable;
import com.android.material.widget.drawable.*;
[ "com.android.material" ]
com.android.material;
1,239,217
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_LEGO_EV3_SENSOR_PORT, defaultValue = DEFAULT_SENSOR_PORT) @SimpleProperty public void SensorPort(String sensorPortLetter) { String functionName = "SensorPort"; setSensorPort(functionName, sensorPortLetter); }
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_LEGO_EV3_SENSOR_PORT, defaultValue = DEFAULT_SENSOR_PORT) void function(String sensorPortLetter) { String functionName = STR; setSensorPort(functionName, sensorPortLetter); }
/** * Specifies the sensor port that the sensor is connected to. * **Must be set in the Designer.** */
Specifies the sensor port that the sensor is connected to. Must be set in the Designer
SensorPort
{ "repo_name": "kkashi01/appinventor-sources", "path": "appinventor/components/src/com/google/appinventor/components/runtime/LegoMindstormsEv3Sensor.java", "license": "apache-2.0", "size": 5495 }
[ "com.google.appinventor.components.annotations.DesignerProperty", "com.google.appinventor.components.common.PropertyTypeConstants" ]
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*;
[ "com.google.appinventor" ]
com.google.appinventor;
2,604,147