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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
protected void startMbContainer() {
if (mbContainer != null
&& Server.getVersion().startsWith("8")) {
//JETTY8 only
try {
boolean b = (boolean)mbContainer.getClass().getMethod("isStarted").invoke(mbContainer);
if (b) {
mbContainer.getClass().getMethod("start").invoke(mbContainer);
// Publish the container itself for consistency with
// traditional embedded Jetty configurations.
mbContainer.getClass().getMethod("addBean", Object.class).invoke(mbContainer, mbContainer);
}
} catch (Throwable e) {
LOG.warn("Could not start Jetty MBeanContainer. Jetty JMX extensions will remain disabled.", e);
}
}
} | void function() { if (mbContainer != null && Server.getVersion().startsWith("8")) { try { boolean b = (boolean)mbContainer.getClass().getMethod(STR).invoke(mbContainer); if (b) { mbContainer.getClass().getMethod("start").invoke(mbContainer); mbContainer.getClass().getMethod(STR, Object.class).invoke(mbContainer, mbContainer); } } catch (Throwable e) { LOG.warn(STR, e); } } } | /**
* Starts {@link #mbContainer} and registers the container with itself as a managed bean
* logging an error if there is a problem starting the container.
* Does nothing if {@link #mbContainer} is {@code null}.
*/ | Starts <code>#mbContainer</code> and registers the container with itself as a managed bean logging an error if there is a problem starting the container. Does nothing if <code>#mbContainer</code> is null | startMbContainer | {
"repo_name": "josefkarasek/camel",
"path": "components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java",
"license": "apache-2.0",
"size": 56155
} | [
"org.eclipse.jetty.server.Server"
] | import org.eclipse.jetty.server.Server; | import org.eclipse.jetty.server.*; | [
"org.eclipse.jetty"
] | org.eclipse.jetty; | 334,545 |
public void sendAgentAddedToAllAgents(RequestQueue requestQueue) {
Workgroup workgroup = requestQueue.getWorkgroup();
for (AgentSession session : workgroup.getAgentSessions()) {
if (session.hasRequestedAgentInfo()) {
IQ iq = new IQ(IQ.Type.set);
iq.setFrom(workgroup.getJID());
iq.setTo(session.getJID());
Element agentStatusRequest = iq.setChildElement("agent-status-request",
"http://jabber.org/protocol/workgroup");
agentStatusRequest.add(getAgentInfo());
// Push the new agent info to the agent
workgroup.send(iq);
}
}
}
| void function(RequestQueue requestQueue) { Workgroup workgroup = requestQueue.getWorkgroup(); for (AgentSession session : workgroup.getAgentSessions()) { if (session.hasRequestedAgentInfo()) { IQ iq = new IQ(IQ.Type.set); iq.setFrom(workgroup.getJID()); iq.setTo(session.getJID()); Element agentStatusRequest = iq.setChildElement(STR, "http: agentStatusRequest.add(getAgentInfo()); workgroup.send(iq); } } } | /**
* This agent has been added to a queue so we need to inform the existing agents of the queue
* ,that previously requested agent information, of this new agent.
*
* @param requestQueue the queue where this agent has been added.
*/ | This agent has been added to a queue so we need to inform the existing agents of the queue ,that previously requested agent information, of this new agent | sendAgentAddedToAllAgents | {
"repo_name": "DaraghOKeeffe/openfire",
"path": "src/plugins/fastpath/src/java/org/jivesoftware/xmpp/workgroup/Agent.java",
"license": "gpl-2.0",
"size": 11547
} | [
"org.dom4j.Element"
] | import org.dom4j.Element; | import org.dom4j.*; | [
"org.dom4j"
] | org.dom4j; | 1,964,446 |
public void setListOfRelatedEntities(List list) {
this.listOfRelatedEntities = list;
checkStep();
} | void function(List list) { this.listOfRelatedEntities = list; checkStep(); } | /**
* Sets the list of related entities of the query
* @param list
*/ | Sets the list of related entities of the query | setListOfRelatedEntities | {
"repo_name": "idega/com.idega.block.dataquery",
"path": "src/java/com/idega/block/dataquery/data/xml/QueryHelper.java",
"license": "gpl-3.0",
"size": 30484
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,517,403 |
public int daysBetween(final Date other)
{
final DateHolder o = new DateHolder(calendar);
o.setDate(other);
return daysBetween(o);
} | int function(final Date other) { final DateHolder o = new DateHolder(calendar); o.setDate(other); return daysBetween(o); } | /**
* Stops calculation for more than 500 years.
* @param other
* @return other.days - this.days.
*/ | Stops calculation for more than 500 years | daysBetween | {
"repo_name": "FlowsenAusMonotown/projectforge",
"path": "projectforge-business/src/main/java/org/projectforge/framework/time/DateHolder.java",
"license": "gpl-3.0",
"size": 21661
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,698,718 |
public void close()
throws DatabaseException {
// Close secondary databases, then primary databases.
supplierByCityDb.close();
shipmentByPartDb.close();
shipmentBySupplierDb.close();
partDb.close();
supplierDb.close();
shipmentDb.close();
// And don't forget to close the catalog and the environment.
javaCatalog.close();
env.close();
}
private static class SupplierByCityKeyCreator
extends SerialSerialKeyCreator {
private SupplierByCityKeyCreator(ClassCatalog catalog,
Class primaryKeyClass,
Class valueClass,
Class indexKeyClass) {
super(catalog, primaryKeyClass, valueClass, indexKeyClass);
} | void function() throws DatabaseException { supplierByCityDb.close(); shipmentByPartDb.close(); shipmentBySupplierDb.close(); partDb.close(); supplierDb.close(); shipmentDb.close(); javaCatalog.close(); env.close(); } private static class SupplierByCityKeyCreator extends SerialSerialKeyCreator { private SupplierByCityKeyCreator(ClassCatalog catalog, Class primaryKeyClass, Class valueClass, Class indexKeyClass) { super(catalog, primaryKeyClass, valueClass, indexKeyClass); } | /**
* Close all stores (closing a store automatically closes its indices).
*/ | Close all stores (closing a store automatically closes its indices) | close | {
"repo_name": "zheguang/BerkeleyDB",
"path": "examples/java/src/collections/ship/index/SampleDatabase.java",
"license": "agpl-3.0",
"size": 12179
} | [
"com.sleepycat.bind.serial.ClassCatalog",
"com.sleepycat.bind.serial.SerialSerialKeyCreator",
"com.sleepycat.db.DatabaseException"
] | import com.sleepycat.bind.serial.ClassCatalog; import com.sleepycat.bind.serial.SerialSerialKeyCreator; import com.sleepycat.db.DatabaseException; | import com.sleepycat.bind.serial.*; import com.sleepycat.db.*; | [
"com.sleepycat.bind",
"com.sleepycat.db"
] | com.sleepycat.bind; com.sleepycat.db; | 58,829 |
Widget asWidget(); | Widget asWidget(); | /**
* As widget.
*
* @return the widget
*/ | As widget | asWidget | {
"repo_name": "MeasureAuthoringTool/MeasureAuthoringTool_Release",
"path": "mat/src/main/java/mat/client/CqlLibraryPresenter.java",
"license": "cc0-1.0",
"size": 49257
} | [
"com.google.gwt.user.client.ui.Widget"
] | import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,650,668 |
SocketAddress getSocketAddress(); | SocketAddress getSocketAddress(); | /**
* Get the SocketAddress of the server to which this node is connected.
*/ | Get the SocketAddress of the server to which this node is connected | getSocketAddress | {
"repo_name": "wildnez/memcached-java-client",
"path": "src/main/java/net/spy/memcached/MemcachedNode.java",
"license": "mit",
"size": 6193
} | [
"java.net.SocketAddress"
] | import java.net.SocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 366,507 |
public KineticComponent getActiveKineticComponent() {
CustomTabSheetTabComponent activeTab = getActiveTab();
if (activeTab != null) {
return (KineticComponent) getActiveTab().getContentComponent();
} else {
return null;
}
} | KineticComponent function() { CustomTabSheetTabComponent activeTab = getActiveTab(); if (activeTab != null) { return (KineticComponent) getActiveTab().getContentComponent(); } else { return null; } } | /**
* Gets the content of {@link #getActiveTab()}.
*/ | Gets the content of <code>#getActiveTab()</code> | getActiveKineticComponent | {
"repo_name": "SkyCrawl/pikater-vaadin",
"path": "src/org/pikater/web/vaadin/gui/server/ui_expeditor/expeditor/ExpEditor.java",
"license": "apache-2.0",
"size": 12643
} | [
"org.pikater.web.vaadin.gui.server.ui_expeditor.expeditor.kineticcomponent.KineticComponent"
] | import org.pikater.web.vaadin.gui.server.ui_expeditor.expeditor.kineticcomponent.KineticComponent; | import org.pikater.web.vaadin.gui.server.ui_expeditor.expeditor.kineticcomponent.*; | [
"org.pikater.web"
] | org.pikater.web; | 1,259,770 |
private FSPermissionChecker checkPermission(String path, boolean doCheckOwner,
FsAction ancestorAccess, FsAction parentAccess, FsAction access,
FsAction subAccess) throws AccessControlException {
FSPermissionChecker pc = new FSPermissionChecker(
fsOwner.getShortUserName(), supergroup);
if (!pc.isSuper) {
dir.waitForReady();
pc.checkPermission(path, dir.rootDir, doCheckOwner,
ancestorAccess, parentAccess, access, subAccess);
}
return pc;
} | FSPermissionChecker function(String path, boolean doCheckOwner, FsAction ancestorAccess, FsAction parentAccess, FsAction access, FsAction subAccess) throws AccessControlException { FSPermissionChecker pc = new FSPermissionChecker( fsOwner.getShortUserName(), supergroup); if (!pc.isSuper) { dir.waitForReady(); pc.checkPermission(path, dir.rootDir, doCheckOwner, ancestorAccess, parentAccess, access, subAccess); } return pc; } | /**
* Check whether current user have permissions to access the path.
* For more details of the parameters, see
* {@link FSPermissionChecker#checkPermission(String, INodeDirectory, boolean, FsAction, FsAction, FsAction, FsAction)}.
*/ | Check whether current user have permissions to access the path. For more details of the parameters, see <code>FSPermissionChecker#checkPermission(String, INodeDirectory, boolean, FsAction, FsAction, FsAction, FsAction)</code> | checkPermission | {
"repo_name": "wzhuo918/release-1.1.2-MDP",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 226670
} | [
"org.apache.hadoop.fs.permission.FsAction",
"org.apache.hadoop.security.AccessControlException"
] | import org.apache.hadoop.fs.permission.FsAction; import org.apache.hadoop.security.AccessControlException; | import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.security.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,605,782 |
DeliveryManager getDeliveryManger(OMElement config) throws EventBrokerConfigurationException; | DeliveryManager getDeliveryManger(OMElement config) throws EventBrokerConfigurationException; | /**
* creates and returns the delivery manager from the omElement config.
* @param config OMElement
* @return delivery manager object
* @throws EventBrokerConfigurationException
*/ | creates and returns the delivery manager from the omElement config | getDeliveryManger | {
"repo_name": "hastef88/carbon-business-messaging",
"path": "components/andes/org.wso2.carbon.andes.event.core/src/main/java/org/wso2/carbon/andes/event/core/delivery/DeliveryManagerFactory.java",
"license": "apache-2.0",
"size": 1209
} | [
"org.apache.axiom.om.OMElement",
"org.wso2.carbon.andes.event.core.exception.EventBrokerConfigurationException"
] | import org.apache.axiom.om.OMElement; import org.wso2.carbon.andes.event.core.exception.EventBrokerConfigurationException; | import org.apache.axiom.om.*; import org.wso2.carbon.andes.event.core.exception.*; | [
"org.apache.axiom",
"org.wso2.carbon"
] | org.apache.axiom; org.wso2.carbon; | 1,802,394 |
public void setBasedir(File baseDir) {
this.baseDir = baseDir;
} | void function(File baseDir) { this.baseDir = baseDir; } | /**
* This is the base directory to look in for things to tar.
* @param baseDir the base directory.
*/ | This is the base directory to look in for things to tar | setBasedir | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/antapache/src/main/org/apache/tools/ant/taskdefs/Tar.java",
"license": "gpl-2.0",
"size": 34170
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,404,345 |
protected String[] readDocument(InputStream IS) throws Exception {
return Scraper.getDocument(IS);
}
| String[] function(InputStream IS) throws Exception { return Scraper.getDocument(IS); } | /**
* Method that reads from an InputStream (FileInputStream, NetworkInputStream, ecc..) the title
* and the text of the document associated with it, using an appropriate scraper, and it returns
* them inside a vector of strings (position 0: Title, position 1: Text).
*
* @param IS The InputStream from where reading the document.
* @return The title and the text of the extracted document, inside a String vector made of two elements.
* @throws Exception
*/ | Method that reads from an InputStream (FileInputStream, NetworkInputStream, ecc..) the title and the text of the document associated with it, using an appropriate scraper, and it returns them inside a vector of strings (position 0: Title, position 1: Text) | readDocument | {
"repo_name": "divi1411/documentclassifier",
"path": "src/documentclassifier/DocumentClassifierApp.java",
"license": "gpl-3.0",
"size": 38752
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 447,906 |
public void testNoSql() throws SQLException
{
Statement s = createStatement();
assertNull("Expected NULL ResultSet", s.getGeneratedKeys());
s.close();
} | void function() throws SQLException { Statement s = createStatement(); assertNull(STR, s.getGeneratedKeys()); s.close(); } | /**
* Requests generated keys for a new statement that hasn't executed any
* SQL yet.
* Old harness Test 1.
* Expected result: a NULL ResultSet.
* @throws SQLException
*/ | Requests generated keys for a new statement that hasn't executed any SQL yet. Old harness Test 1. Expected result: a NULL ResultSet | testNoSql | {
"repo_name": "scnakandala/derby",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/AutoGenJDBC30Test.java",
"license": "apache-2.0",
"size": 52987
} | [
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 584,010 |
public Observable<ServiceResponse<Void>> deleteWithServiceResponseAsync(String resourceGroupName, String gatewayName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (gatewayName == null) {
throw new IllegalArgumentException("Parameter gatewayName is required and cannot be null.");
}
final String apiVersion = "2019-02-01";
Observable<Response<ResponseBody>> observable = service.delete(this.client.subscriptionId(), resourceGroupName, gatewayName, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType());
} | Observable<ServiceResponse<Void>> function(String resourceGroupName, String gatewayName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (gatewayName == null) { throw new IllegalArgumentException(STR); } final String apiVersion = STR; Observable<Response<ResponseBody>> observable = service.delete(this.client.subscriptionId(), resourceGroupName, gatewayName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken<Void>() { }.getType()); } | /**
* Deletes a virtual wan vpn gateway.
*
* @param resourceGroupName The resource group name of the VpnGateway.
* @param gatewayName The name of the gateway.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/ | Deletes a virtual wan vpn gateway | deleteWithServiceResponseAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_02_01/src/main/java/com/microsoft/azure/management/network/v2019_02_01/implementation/VpnGatewaysInner.java",
"license": "mit",
"size": 72237
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.rest.ServiceResponse"
] | import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; | import com.google.common.reflect.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.rest"
] | com.google.common; com.microsoft.rest; | 1,017,024 |
public SecurityRuleInner withSourceAddressPrefixes(List<String> sourceAddressPrefixes) {
this.sourceAddressPrefixes = sourceAddressPrefixes;
return this;
} | SecurityRuleInner function(List<String> sourceAddressPrefixes) { this.sourceAddressPrefixes = sourceAddressPrefixes; return this; } | /**
* Set the CIDR or source IP ranges.
*
* @param sourceAddressPrefixes the sourceAddressPrefixes value to set
* @return the SecurityRuleInner object itself.
*/ | Set the CIDR or source IP ranges | withSourceAddressPrefixes | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/SecurityRuleInner.java",
"license": "mit",
"size": 16948
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,296,299 |
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeVarIntToBuffer(this.field_149458_a);
buf.writeInt(this.field_149456_b);
buf.writeInt(this.field_149457_c);
buf.writeInt(this.field_149454_d);
buf.writeByte(this.field_149455_e);
buf.writeByte(this.field_149453_f);
buf.writeBoolean(this.field_179698_g);
} | void function(PacketBuffer buf) throws IOException { buf.writeVarIntToBuffer(this.field_149458_a); buf.writeInt(this.field_149456_b); buf.writeInt(this.field_149457_c); buf.writeInt(this.field_149454_d); buf.writeByte(this.field_149455_e); buf.writeByte(this.field_149453_f); buf.writeBoolean(this.field_179698_g); } | /**
* Writes the raw packet data to the data stream.
*/ | Writes the raw packet data to the data stream | writePacketData | {
"repo_name": "trixmot/mod1",
"path": "build/tmp/recompileMc/sources/net/minecraft/network/play/server/S18PacketEntityTeleport.java",
"license": "lgpl-2.1",
"size": 3993
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 1,116,458 |
public ServiceFuture<VerificationIPFlowResultInner> verifyIPFlowAsync(String resourceGroupName, String networkWatcherName, VerificationIPFlowParameters parameters, final ServiceCallback<VerificationIPFlowResultInner> serviceCallback) {
return ServiceFuture.fromResponse(verifyIPFlowWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters), serviceCallback);
} | ServiceFuture<VerificationIPFlowResultInner> function(String resourceGroupName, String networkWatcherName, VerificationIPFlowParameters parameters, final ServiceCallback<VerificationIPFlowResultInner> serviceCallback) { return ServiceFuture.fromResponse(verifyIPFlowWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters), serviceCallback); } | /**
* Verify IP flow from the specified VM to a location given the currently configured NSG rules.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @param parameters Parameters that define the IP flow to be verified.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Verify IP flow from the specified VM to a location given the currently configured NSG rules | verifyIPFlowAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/NetworkWatchersInner.java",
"license": "mit",
"size": 189693
} | [
"com.microsoft.azure.management.network.v2019_09_01.VerificationIPFlowParameters",
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.azure.management.network.v2019_09_01.VerificationIPFlowParameters; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.azure.management.network.v2019_09_01.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,950,644 |
private JFreeChart createTimeSeriesChart(String title, String timeAxisLabel,
String valueAxisLabel, XYDataset dataset, boolean legend, boolean tooltips, boolean urls) {
ValueAxis timeAxis = new DateAxis(timeAxisLabel);
timeAxis.setLowerMargin(0.02); // reduce the default margins
timeAxis.setUpperMargin(0.02);
NumberAxis valueAxis = new NumberAxis(valueAxisLabel);
valueAxis.setAutoRangeIncludesZero(false); // override default
XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null);
XYToolTipGenerator toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance();
XYURLGenerator urlGenerator = new StandardXYURLGenerator();
renderer = new StackedXYAreaRenderer2();
renderer.setBaseToolTipGenerator(toolTipGenerator);
renderer.setURLGenerator(urlGenerator);
plot.setRenderer(renderer);
JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
ChartFactory.getChartTheme().apply(chart);
return chart;
}
| JFreeChart function(String title, String timeAxisLabel, String valueAxisLabel, XYDataset dataset, boolean legend, boolean tooltips, boolean urls) { ValueAxis timeAxis = new DateAxis(timeAxisLabel); timeAxis.setLowerMargin(0.02); timeAxis.setUpperMargin(0.02); NumberAxis valueAxis = new NumberAxis(valueAxisLabel); valueAxis.setAutoRangeIncludesZero(false); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); XYToolTipGenerator toolTipGenerator = StandardXYToolTipGenerator.getTimeSeriesInstance(); XYURLGenerator urlGenerator = new StandardXYURLGenerator(); renderer = new StackedXYAreaRenderer2(); renderer.setBaseToolTipGenerator(toolTipGenerator); renderer.setURLGenerator(urlGenerator); plot.setRenderer(renderer); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); ChartFactory.getChartTheme().apply(chart); return chart; } | /**
* Creates and returns a time series chart. A time series chart is an {@link XYPlot} with a
* {@link DateAxis} for the x-axis and a {@link NumberAxis} for the y-axis. The default renderer
* is an {@link XYLineAndShapeRenderer}.
* <P>
* A convenient dataset to use with this chart is a
* {@link org.jfree.data.time.TimeSeriesCollection}.
*
* @param title the chart title (<code>null</code> permitted).
* @param timeAxisLabel a label for the time axis (<code>null</code> permitted).
* @param valueAxisLabel a label for the value axis (<code>null</code> permitted).
* @param dataset the dataset for the chart (<code>null</code> permitted).
* @param legend a flag specifying whether or not a legend is required.
* @param tooltips configure chart to generate tool tips?
* @param urls configure chart to generate URLs?
*
* @return A time series chart.
*/ | Creates and returns a time series chart. A time series chart is an <code>XYPlot</code> with a <code>DateAxis</code> for the x-axis and a <code>NumberAxis</code> for the y-axis. The default renderer is an <code>XYLineAndShapeRenderer</code>. A convenient dataset to use with this chart is a <code>org.jfree.data.time.TimeSeriesCollection</code> | createTimeSeriesChart | {
"repo_name": "akaplick123/LogisticVisulization",
"path": "src/main/java/de/andre/chart/ui/chartframe/OrdersFulfillmentByTimeChartFrame2.java",
"license": "gpl-3.0",
"size": 19717
} | [
"org.jfree.chart.ChartFactory",
"org.jfree.chart.JFreeChart",
"org.jfree.chart.axis.DateAxis",
"org.jfree.chart.axis.NumberAxis",
"org.jfree.chart.axis.ValueAxis",
"org.jfree.chart.labels.StandardXYToolTipGenerator",
"org.jfree.chart.labels.XYToolTipGenerator",
"org.jfree.chart.plot.XYPlot",
"org.jfree.chart.renderer.xy.StackedXYAreaRenderer2",
"org.jfree.chart.urls.StandardXYURLGenerator",
"org.jfree.chart.urls.XYURLGenerator",
"org.jfree.data.xy.XYDataset"
] | import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.DateAxis; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.labels.StandardXYToolTipGenerator; import org.jfree.chart.labels.XYToolTipGenerator; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.StackedXYAreaRenderer2; import org.jfree.chart.urls.StandardXYURLGenerator; import org.jfree.chart.urls.XYURLGenerator; import org.jfree.data.xy.XYDataset; | import org.jfree.chart.*; import org.jfree.chart.axis.*; import org.jfree.chart.labels.*; import org.jfree.chart.plot.*; import org.jfree.chart.renderer.xy.*; import org.jfree.chart.urls.*; import org.jfree.data.xy.*; | [
"org.jfree.chart",
"org.jfree.data"
] | org.jfree.chart; org.jfree.data; | 123,713 |
@Nullable public static Object[] readQueryArgs(BinaryRawReaderEx reader) {
int cnt = reader.readInt();
if (cnt > 0) {
Object[] args = new Object[cnt];
for (int i = 0; i < cnt; i++)
args[i] = reader.readObjectDetached();
return args;
}
else
return null;
} | @Nullable static Object[] function(BinaryRawReaderEx reader) { int cnt = reader.readInt(); if (cnt > 0) { Object[] args = new Object[cnt]; for (int i = 0; i < cnt; i++) args[i] = reader.readObjectDetached(); return args; } else return null; } | /**
* Read arguments for SQL query.
*
* @param reader Reader.
* @return Arguments.
*/ | Read arguments for SQL query | readQueryArgs | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java",
"license": "apache-2.0",
"size": 57640
} | [
"org.apache.ignite.internal.binary.BinaryRawReaderEx",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.internal.binary.BinaryRawReaderEx; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.internal.binary.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 2,853,318 |
public final <T extends Page> void mountPage(final String path, final Class<T> pageClass)
{
mount(new MountedMapper(path, pageClass));
} | final <T extends Page> void function(final String path, final Class<T> pageClass) { mount(new MountedMapper(path, pageClass)); } | /**
* Mounts a page class to the given path.
*
* @param <T>
* type of page
*
* @param path
* the path to mount the page class on
* @param pageClass
* the page class to be mounted
*/ | Mounts a page class to the given path | mountPage | {
"repo_name": "martin-g/wicket-osgi",
"path": "wicket-core/src/main/java/org/apache/wicket/protocol/http/WebApplication.java",
"license": "apache-2.0",
"size": 30283
} | [
"org.apache.wicket.Page",
"org.apache.wicket.core.request.mapper.MountedMapper"
] | import org.apache.wicket.Page; import org.apache.wicket.core.request.mapper.MountedMapper; | import org.apache.wicket.*; import org.apache.wicket.core.request.mapper.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 807,858 |
public Optional<Element> getElementFromItemStack(ItemStack stack){
Optional<Integer> optID = getElementIDFromItemStack(stack);
if(optID.isPresent()){
if(elements.containsKey(optID.get())){
return Optional.of(elements.get(optID.get()));
}
}
return Optional.empty();
} | Optional<Element> function(ItemStack stack){ Optional<Integer> optID = getElementIDFromItemStack(stack); if(optID.isPresent()){ if(elements.containsKey(optID.get())){ return Optional.of(elements.get(optID.get())); } } return Optional.empty(); } | /**
* Convert an ItemStack into an Element
*
* @param stack ItemStack to pull Element from
* @return Element, if it exists with that item.
*/ | Convert an ItemStack into an Element | getElementFromItemStack | {
"repo_name": "codeHusky/HuskyUI-Plugin",
"path": "src/main/java/com/codehusky/huskyui/ElementRegistry.java",
"license": "gpl-3.0",
"size": 9139
} | [
"com.codehusky.huskyui.states.element.Element",
"java.util.Optional",
"org.spongepowered.api.item.inventory.ItemStack"
] | import com.codehusky.huskyui.states.element.Element; import java.util.Optional; import org.spongepowered.api.item.inventory.ItemStack; | import com.codehusky.huskyui.states.element.*; import java.util.*; import org.spongepowered.api.item.inventory.*; | [
"com.codehusky.huskyui",
"java.util",
"org.spongepowered.api"
] | com.codehusky.huskyui; java.util; org.spongepowered.api; | 2,448,459 |
Promise<Void> chown(String path, String user, String group); | Promise<Void> chown(String path, String user, String group); | /**
* Change the ownership on the file represented by {@code path} to {@code user} and {code group}, asynchronously.
*
* @param path the path to the file
* @param user the user name
* @param group the user group
* @return a promise for completion
*/ | Change the ownership on the file represented by path to user and {code group}, asynchronously | chown | {
"repo_name": "testn/vertx-when",
"path": "vertx-when/src/main/java/com/englishtown/vertx/promises/WhenFileSystem.java",
"license": "mit",
"size": 11219
} | [
"com.englishtown.promises.Promise"
] | import com.englishtown.promises.Promise; | import com.englishtown.promises.*; | [
"com.englishtown.promises"
] | com.englishtown.promises; | 2,678,285 |
public HashMap getNamespacesToJavaPackages() {
return nsToJavaPackagesMap;
} | HashMap function() { return nsToJavaPackagesMap; } | /**
* Returns the pre loaded namespace to Java package mappings.
*
* @return HashMap of namespace to Java package mappings as as specified in the xsdconfig file.
*/ | Returns the pre loaded namespace to Java package mappings | getNamespacesToJavaPackages | {
"repo_name": "arunasujith/wso2-axis2",
"path": "modules/xmlbeans/src/org/apache/axis2/xmlbeans/XSDConfig.java",
"license": "apache-2.0",
"size": 9304
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,232,717 |
public void testDescendingSerialization() throws Exception {
NavigableSet x = dset5();
NavigableSet y = serialClone(x);
assertNotSame(x, y);
assertEquals(x.size(), y.size());
assertEquals(x.toString(), y.toString());
assertEquals(x, y);
assertEquals(y, x);
while (!x.isEmpty()) {
assertFalse(y.isEmpty());
assertEquals(x.pollFirst(), y.pollFirst());
}
assertTrue(y.isEmpty());
} | void function() throws Exception { NavigableSet x = dset5(); NavigableSet y = serialClone(x); assertNotSame(x, y); assertEquals(x.size(), y.size()); assertEquals(x.toString(), y.toString()); assertEquals(x, y); assertEquals(y, x); while (!x.isEmpty()) { assertFalse(y.isEmpty()); assertEquals(x.pollFirst(), y.pollFirst()); } assertTrue(y.isEmpty()); } | /**
* A deserialized serialized set has same elements
*/ | A deserialized serialized set has same elements | testDescendingSerialization | {
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/libcore/ojluni/src/test/java/util/concurrent/tck/TreeSubSetTest.java",
"license": "gpl-2.0",
"size": 31878
} | [
"java.util.NavigableSet"
] | import java.util.NavigableSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,730,464 |
@Test
public void toDerivativeBeforeSettle() {
final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 6, 16);
final BondFuturesOptionPremiumTransaction transactionConverted = FVU1_C120_TR_DEFINITION.toDerivative(referenceDate);
final PaymentFixed premium = FVU1_C120_TR_DEFINITION.getPremium().toDerivative(referenceDate);
final BondFuturesOptionPremiumTransaction transactionExpected = new BondFuturesOptionPremiumTransaction(FVU1_C120_SEC_DEFINITION.toDerivative(referenceDate), QUANTITY, premium);
assertEquals("Bond future option premium security definition: toDerivative", transactionExpected, transactionConverted);
} | void function() { final ZonedDateTime referenceDate = DateUtils.getUTCDate(2011, 6, 16); final BondFuturesOptionPremiumTransaction transactionConverted = FVU1_C120_TR_DEFINITION.toDerivative(referenceDate); final PaymentFixed premium = FVU1_C120_TR_DEFINITION.getPremium().toDerivative(referenceDate); final BondFuturesOptionPremiumTransaction transactionExpected = new BondFuturesOptionPremiumTransaction(FVU1_C120_SEC_DEFINITION.toDerivative(referenceDate), QUANTITY, premium); assertEquals(STR, transactionExpected, transactionConverted); } | /**
* Tests the toDerivative method.
*/ | Tests the toDerivative method | toDerivativeBeforeSettle | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/test/java/com/opengamma/analytics/financial/instrument/future/BondFuturesOptionPremiumTransactionDefinitionTest.java",
"license": "apache-2.0",
"size": 6589
} | [
"com.opengamma.analytics.financial.interestrate.future.derivative.BondFuturesOptionPremiumTransaction",
"com.opengamma.analytics.financial.interestrate.payments.derivative.PaymentFixed",
"com.opengamma.util.time.DateUtils",
"org.testng.AssertJUnit",
"org.threeten.bp.ZonedDateTime"
] | import com.opengamma.analytics.financial.interestrate.future.derivative.BondFuturesOptionPremiumTransaction; import com.opengamma.analytics.financial.interestrate.payments.derivative.PaymentFixed; import com.opengamma.util.time.DateUtils; import org.testng.AssertJUnit; import org.threeten.bp.ZonedDateTime; | import com.opengamma.analytics.financial.interestrate.future.derivative.*; import com.opengamma.analytics.financial.interestrate.payments.derivative.*; import com.opengamma.util.time.*; import org.testng.*; import org.threeten.bp.*; | [
"com.opengamma.analytics",
"com.opengamma.util",
"org.testng",
"org.threeten.bp"
] | com.opengamma.analytics; com.opengamma.util; org.testng; org.threeten.bp; | 1,768,682 |
protected void handleMergeException(Throwable exc) {
try {
// When an exception is hit during merge, IndexWriter
// removes any partial files and then allows another
// merge to run. If whatever caused the error is not
// transient then the exception will keep happening,
// so, we sleep here to avoid saturating CPU in such
// cases:
Thread.sleep(250);
} catch (InterruptedException ie) {
throw new ThreadInterruptedException(ie);
}
throw new MergePolicy.MergeException(exc, dir);
}
static boolean anyExceptions = false; | void function(Throwable exc) { try { Thread.sleep(250); } catch (InterruptedException ie) { throw new ThreadInterruptedException(ie); } throw new MergePolicy.MergeException(exc, dir); } static boolean anyExceptions = false; | /** Called when an exception is hit in a background merge
* thread */ | Called when an exception is hit in a background merge | handleMergeException | {
"repo_name": "fnp/pylucene",
"path": "lucene-java-3.5.0/lucene/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java",
"license": "apache-2.0",
"size": 18203
} | [
"org.apache.lucene.util.ThreadInterruptedException"
] | import org.apache.lucene.util.ThreadInterruptedException; | import org.apache.lucene.util.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 1,909,699 |
public static Value strrchr(Env env,
StringValue haystack,
Value needleV)
{
CharSequence needle;
if (needleV.isString())
needle = needleV.toStringValue(env);
else
needle = String.valueOf((char) needleV.toLong());
int i = haystack.lastIndexOf(needle);
if (i > 0)
return haystack.substring(i);
else
return BooleanValue.FALSE;
} | static Value function(Env env, StringValue haystack, Value needleV) { CharSequence needle; if (needleV.isString()) needle = needleV.toStringValue(env); else needle = String.valueOf((char) needleV.toLong()); int i = haystack.lastIndexOf(needle); if (i > 0) return haystack.substring(i); else return BooleanValue.FALSE; } | /**
* Finds the last instance of a substring
*
* @param haystack the string to search in
* @param needleV the string to search for
* @return the trailing match or FALSE
*/ | Finds the last instance of a substring | strrchr | {
"repo_name": "TheApacheCats/quercus",
"path": "com/caucho/quercus/lib/string/StringModule.java",
"license": "gpl-2.0",
"size": 152070
} | [
"com.caucho.quercus.env.BooleanValue",
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.StringValue",
"com.caucho.quercus.env.Value"
] | import com.caucho.quercus.env.BooleanValue; import com.caucho.quercus.env.Env; import com.caucho.quercus.env.StringValue; import com.caucho.quercus.env.Value; | import com.caucho.quercus.env.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 1,275,619 |
public Event extractEvent() throws IOException {
text.clear();
int txtLength = 0; //tracks str.getLength(), as an optimization
int newlineLength = 0; //length of terminating newline
long bytesConsumed = 0;
do {
int startPosn = bufferPosn; //starting from where we left off the last time
int ltPosn = -1;
if (bufferPosn >= bufferLength) {
// fill buffer
startPosn = bufferPosn = 0;
bufferLength = in.read(buffer);
if (bufferLength <= 0) {
break; // EOF
}
}
if (buffer[bufferPosn] == LT) {
ltPosn = bufferPosn;
}
for (; bufferPosn < bufferLength; ++bufferPosn) { //search for newline
if (ltPosn >= 0 && buffer[bufferPosn] == GT) {
startPosn = bufferPosn + 1;
}
if (buffer[bufferPosn] == LF) {
newlineLength = 1;
++bufferPosn; // at next invocation proceed from following byte
break;
}
}
int readLength = bufferPosn - startPosn;
bytesConsumed += readLength;
int appendLength = readLength - newlineLength;
if (appendLength > maxLineLength - txtLength) {
appendLength = maxLineLength - txtLength;
}
if (appendLength > 0) {
text.append(buffer, startPosn, appendLength);
txtLength += appendLength;
}
} while (newlineLength == 0 && bytesConsumed < maxBytesToConsume);
// Check for errors, else return a new event
if (bytesConsumed > (long)Integer.MAX_VALUE) {
throw new IOException("Too many bytes before newline: " + bytesConsumed);
}
if (bytesConsumed == 0 && bufferLength < 0) {
throw new EOFException();
}
if (bytesConsumed == 0) {
LOG.warn("no bytes consumed, nothing left, no EOF?!");
}
return new ByteArrayEvent(text.getBytes());
} | Event function() throws IOException { text.clear(); int txtLength = 0; int newlineLength = 0; long bytesConsumed = 0; do { int startPosn = bufferPosn; int ltPosn = -1; if (bufferPosn >= bufferLength) { startPosn = bufferPosn = 0; bufferLength = in.read(buffer); if (bufferLength <= 0) { break; } } if (buffer[bufferPosn] == LT) { ltPosn = bufferPosn; } for (; bufferPosn < bufferLength; ++bufferPosn) { if (ltPosn >= 0 && buffer[bufferPosn] == GT) { startPosn = bufferPosn + 1; } if (buffer[bufferPosn] == LF) { newlineLength = 1; ++bufferPosn; break; } } int readLength = bufferPosn - startPosn; bytesConsumed += readLength; int appendLength = readLength - newlineLength; if (appendLength > maxLineLength - txtLength) { appendLength = maxLineLength - txtLength; } if (appendLength > 0) { text.append(buffer, startPosn, appendLength); txtLength += appendLength; } } while (newlineLength == 0 && bytesConsumed < maxBytesToConsume); if (bytesConsumed > (long)Integer.MAX_VALUE) { throw new IOException(STR + bytesConsumed); } if (bytesConsumed == 0 && bufferLength < 0) { throw new EOFException(); } if (bytesConsumed == 0) { LOG.warn(STR); } return new ByteArrayEvent(text.getBytes()); } | /**
* Reads the next line of input and creates an Event
*
* @return Event from next line of input
* @throws IOException If the line length is extremely large (greater than Integer.MAX_VALUE)
* @throws EOFException When stream EOF is reached
*/ | Reads the next line of input and creates an Event | extractEvent | {
"repo_name": "chetan/sewer",
"path": "src/main/java/net/pixelcop/sewer/source/SyslogWireExtractor.java",
"license": "apache-2.0",
"size": 4107
} | [
"java.io.EOFException",
"java.io.IOException",
"net.pixelcop.sewer.ByteArrayEvent",
"net.pixelcop.sewer.Event"
] | import java.io.EOFException; import java.io.IOException; import net.pixelcop.sewer.ByteArrayEvent; import net.pixelcop.sewer.Event; | import java.io.*; import net.pixelcop.sewer.*; | [
"java.io",
"net.pixelcop.sewer"
] | java.io; net.pixelcop.sewer; | 404,500 |
public Neighbour<V, T> generateMove(Solution<V, T> solution) {
return nextNeighbourSelection().selectNeighbour(solution);
} | Neighbour<V, T> function(Solution<V, T> solution) { return nextNeighbourSelection().selectNeighbour(solution); } | /**
* Generate a random move
* @param solution current solution
* @return generated neighbour
*/ | Generate a random move | generateMove | {
"repo_name": "UniTime/cpsolver",
"path": "src/org/cpsolver/ifs/algorithms/NeighbourSearch.java",
"license": "lgpl-3.0",
"size": 15160
} | [
"org.cpsolver.ifs.model.Neighbour",
"org.cpsolver.ifs.solution.Solution"
] | import org.cpsolver.ifs.model.Neighbour; import org.cpsolver.ifs.solution.Solution; | import org.cpsolver.ifs.model.*; import org.cpsolver.ifs.solution.*; | [
"org.cpsolver.ifs"
] | org.cpsolver.ifs; | 919,723 |
public IBoundingShapeMergable merge(IBoundingShape shape) {
if (shape == null) {
return this;
}
if(shape instanceof BoundingSphere)
{
BoundingSphere sphere = (BoundingSphere) shape;
float temp_radius = sphere.getRadius();
Vector3D temp_center = sphere.getCenter().getCopy();
BoundingSphere rVal = new BoundingSphere((AbstractShape)sphere.getPeerComponent());
IBoundingShapeMergable rVal2 = merge(temp_radius, temp_center, rVal,rVal);
return rVal2;
}else if(shape instanceof OrientedBoundingBox)
{
OrientedBoundingBox box = (OrientedBoundingBox) shape;
BoundingSphere rVal = new BoundingSphere((AbstractShape)box.getPeerComponent());
BoundingSphere rVal2 =(BoundingSphere) ((BoundingSphere)this.clone()).mergeOBB(box);
return rVal2;
}else if(shape instanceof BoundsArbitraryPlanarPolygon)
{
BoundsArbitraryPlanarPolygon polygon = (BoundsArbitraryPlanarPolygon) shape;
BoundingSphere rVal = (BoundingSphere)this.clone();//TODO
return rVal;
}else if(shape instanceof BoundsZPlaneRectangle)
{
BoundsZPlaneRectangle rectangle = (BoundsZPlaneRectangle) shape;
BoundingSphere rVal = (BoundingSphere)this.clone();//TODO
return rVal;
}
else
{
return null;
}
}
| IBoundingShapeMergable function(IBoundingShape shape) { if (shape == null) { return this; } if(shape instanceof BoundingSphere) { BoundingSphere sphere = (BoundingSphere) shape; float temp_radius = sphere.getRadius(); Vector3D temp_center = sphere.getCenter().getCopy(); BoundingSphere rVal = new BoundingSphere((AbstractShape)sphere.getPeerComponent()); IBoundingShapeMergable rVal2 = merge(temp_radius, temp_center, rVal,rVal); return rVal2; }else if(shape instanceof OrientedBoundingBox) { OrientedBoundingBox box = (OrientedBoundingBox) shape; BoundingSphere rVal = new BoundingSphere((AbstractShape)box.getPeerComponent()); BoundingSphere rVal2 =(BoundingSphere) ((BoundingSphere)this.clone()).mergeOBB(box); return rVal2; }else if(shape instanceof BoundsArbitraryPlanarPolygon) { BoundsArbitraryPlanarPolygon polygon = (BoundsArbitraryPlanarPolygon) shape; BoundingSphere rVal = (BoundingSphere)this.clone(); return rVal; }else if(shape instanceof BoundsZPlaneRectangle) { BoundsZPlaneRectangle rectangle = (BoundsZPlaneRectangle) shape; BoundingSphere rVal = (BoundingSphere)this.clone(); return rVal; } else { return null; } } | /**
* <code>merge</code> combines this sphere with a second bounding sphere.
* This new sphere contains both bounding spheres and is returned.
*
* @param volume
* the sphere to combine with this sphere.
* @return a new sphere
*/ | <code>merge</code> combines this sphere with a second bounding sphere. This new sphere contains both bounding spheres and is returned | merge | {
"repo_name": "Twelve-60/mt4j",
"path": "src/org/mt4j/components/bounds/BoundingSphere.java",
"license": "gpl-2.0",
"size": 55325
} | [
"org.mt4j.components.visibleComponents.shapes.AbstractShape",
"org.mt4j.util.math.Vector3D"
] | import org.mt4j.components.visibleComponents.shapes.AbstractShape; import org.mt4j.util.math.Vector3D; | import org.mt4j.components.*; import org.mt4j.util.math.*; | [
"org.mt4j.components",
"org.mt4j.util"
] | org.mt4j.components; org.mt4j.util; | 1,991,477 |
public List<String> groupIds() {
return this.groupIds;
} | List<String> function() { return this.groupIds; } | /**
* Get the ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to.
*
* @return the groupIds value
*/ | Get the ID(s) of the group(s) obtained from the remote resource that this private endpoint should connect to | groupIds | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/PrivateLinkServiceConnection.java",
"license": "mit",
"size": 6432
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 418,442 |
public void setLastUpdateDt(Date lastUpdateDt)
{
this.lastUpdateDt = lastUpdateDt;
} | void function(Date lastUpdateDt) { this.lastUpdateDt = lastUpdateDt; } | /**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column player_wuxing_card.last_update_dt
*
* @param lastUpdateDt the value for player_wuxing_card.last_update_dt
*
* @mbggenerated Thu Jun 27 17:09:25 CST 2013
*/ | This method was generated by MyBatis Generator. This method sets the value of the database column player_wuxing_card.last_update_dt | setLastUpdateDt | {
"repo_name": "teaey/test-load",
"path": "src/main/java/cn/teaey/test/load/entity/PlayerWuxingCard.java",
"license": "apache-2.0",
"size": 23311
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,497,628 |
public static AnvilWorldAdapter load( GoMintServer server, File pathToWorld ) throws Exception {
AnvilWorldAdapter world = new AnvilWorldAdapter( server, pathToWorld );
world.loadLevelDat();
world.prepareSpawnRegion();
world.startAsyncWorker( server.getExecutorService() );
return world;
} | static AnvilWorldAdapter function( GoMintServer server, File pathToWorld ) throws Exception { AnvilWorldAdapter world = new AnvilWorldAdapter( server, pathToWorld ); world.loadLevelDat(); world.prepareSpawnRegion(); world.startAsyncWorker( server.getExecutorService() ); return world; } | /**
* Loads an anvil world given the path to the world's directory. This operation
* performs synchronously and will at least load the entire spawn region before
* completing.
*
* @param server The GoMint Server which runs this
* @param pathToWorld The path to the world's directory
* @return The anvil world adapter used to access the world
* @throws Exception Thrown in case the world could not be loaded successfully
*/ | Loads an anvil world given the path to the world's directory. This operation performs synchronously and will at least load the entire spawn region before completing | load | {
"repo_name": "Digot/GoMint",
"path": "gomint-server/src/main/java/io/gomint/server/world/anvil/AnvilWorldAdapter.java",
"license": "bsd-3-clause",
"size": 19708
} | [
"io.gomint.server.GoMintServer",
"java.io.File"
] | import io.gomint.server.GoMintServer; import java.io.File; | import io.gomint.server.*; import java.io.*; | [
"io.gomint.server",
"java.io"
] | io.gomint.server; java.io; | 2,639,139 |
int insert(MissionWithBLOBs record); | int insert(MissionWithBLOBs record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table mission
*
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table mission | insert | {
"repo_name": "Harveychn/questionnaire",
"path": "src/main/java/com/questionnaire/ssm/module/generated/mapper/MissionMapper.java",
"license": "apache-2.0",
"size": 3536
} | [
"com.questionnaire.ssm.module.generated.pojo.MissionWithBLOBs"
] | import com.questionnaire.ssm.module.generated.pojo.MissionWithBLOBs; | import com.questionnaire.ssm.module.generated.pojo.*; | [
"com.questionnaire.ssm"
] | com.questionnaire.ssm; | 1,893,007 |
public void ensureActive(String op) {
if (ctx.state().clusterState().state() != ClusterState.ACTIVE)
throw new IgniteException(String.format(
"Unable to perform %s due to cluster state [state=%s]", op, ctx.state().clusterState().state()));
} | void function(String op) { if (ctx.state().clusterState().state() != ClusterState.ACTIVE) throw new IgniteException(String.format( STR, op, ctx.state().clusterState().state())); } | /**
* Check that cluster is active.
*
* @param op Operation name.
*/ | Check that cluster is active | ensureActive | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/stat/IgniteStatisticsManagerImpl.java",
"license": "apache-2.0",
"size": 17841
} | [
"org.apache.ignite.IgniteException",
"org.apache.ignite.cluster.ClusterState"
] | import org.apache.ignite.IgniteException; import org.apache.ignite.cluster.ClusterState; | import org.apache.ignite.*; import org.apache.ignite.cluster.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,338,267 |
public int saveDeliverableFile(Map<String, Object> fileData); | int function(Map<String, Object> fileData); | /**
* This method save in the database the information of the file
* received.
*
* @param fileData - Map with the information
* @return the id of the record inserted, 0 if the record was
* updated or -1 if any error occurred.
*/ | This method save in the database the information of the file received | saveDeliverableFile | {
"repo_name": "CCAFS/ccafs-ap",
"path": "logframes/src/main/java/org/cgiar/ccafs/ap/data/dao/DeliverableFileDAO.java",
"license": "gpl-3.0",
"size": 2393
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,842,038 |
public Timestamp getStartDate ()
{
return (Timestamp)get_Value(COLUMNNAME_StartDate);
} | Timestamp function () { return (Timestamp)get_Value(COLUMNNAME_StartDate); } | /** Get Start Date.
@return First effective day (inclusive)
*/ | Get Start Date | getStartDate | {
"repo_name": "neuroidss/adempiere",
"path": "base/src/org/compiere/model/X_R_RequestAction.java",
"license": "gpl-2.0",
"size": 27528
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 871,842 |
EAttribute getSarlAssertExpression_IsStatic(); | EAttribute getSarlAssertExpression_IsStatic(); | /**
* Returns the meta object for the attribute '{@link io.sarl.lang.sarl.SarlAssertExpression#isIsStatic <em>Is Static</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Is Static</em>'.
* @see io.sarl.lang.sarl.SarlAssertExpression#isIsStatic()
* @see #getSarlAssertExpression()
* @since 0.6
* @generated
*/ | Returns the meta object for the attribute '<code>io.sarl.lang.sarl.SarlAssertExpression#isIsStatic Is Static</code>'. | getSarlAssertExpression_IsStatic | {
"repo_name": "sarl/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/sarl/SarlPackage.java",
"license": "apache-2.0",
"size": 83913
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,695,043 |
public static GeoTranslator load(InputStream words, InputStream shis, InputStream chis,
InputStream dzis, InputStream exceptions) throws IOException {
return load(words, new InputStreamReader(shis), new InputStreamReader(chis),
new InputStreamReader(dzis), new InputStreamReader(exceptions));
} | static GeoTranslator function(InputStream words, InputStream shis, InputStream chis, InputStream dzis, InputStream exceptions) throws IOException { return load(words, new InputStreamReader(shis), new InputStreamReader(chis), new InputStreamReader(dzis), new InputStreamReader(exceptions)); } | /** Creates new GeoTranslator object and load given lexicons
* @param words lexicon of georgian words (mainly used for ditiguishing თ and ტ, გ and ღ, and so on). can be optimized by giving only critical words
* @param shis lexicon of georgian words containing sh as სჰ not შ
* @param chis lexicon of georgian words containing сh as ცჰ not ჩ
* @param dzis lexicon of georgian words containing dz as დზ not ძ
* @param exceptions lexicon of user defined exceptions
* @return new GeoTranslator object
* @throws IOException
*/ | Creates new GeoTranslator object and load given lexicons | load | {
"repo_name": "Meravici/GeoTranslator",
"path": "src/app/GeoTranslator.java",
"license": "gpl-2.0",
"size": 8949
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader"
] | import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; | import java.io.*; | [
"java.io"
] | java.io; | 989,122 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<FirewallRuleInner> updateAsync(String resourceGroupName, String accountName, String firewallRuleName) {
final UpdateFirewallRuleParameters parameters = null;
return updateWithResponseAsync(resourceGroupName, accountName, firewallRuleName, parameters)
.flatMap(
(Response<FirewallRuleInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<FirewallRuleInner> function(String resourceGroupName, String accountName, String firewallRuleName) { final UpdateFirewallRuleParameters parameters = null; return updateWithResponseAsync(resourceGroupName, accountName, firewallRuleName, parameters) .flatMap( (Response<FirewallRuleInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } | /**
* Updates the specified firewall rule.
*
* @param resourceGroupName The name of the Azure resource group.
* @param accountName The name of the Data Lake Store account.
* @param firewallRuleName The name of the firewall rule to update.
* @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 data Lake Store firewall rule information.
*/ | Updates the specified firewall rule | updateAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datalakestore/azure-resourcemanager-datalakestore/src/main/java/com/azure/resourcemanager/datalakestore/implementation/FirewallRulesClientImpl.java",
"license": "mit",
"size": 55791
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.resourcemanager.datalakestore.fluent.models.FirewallRuleInner",
"com.azure.resourcemanager.datalakestore.models.UpdateFirewallRuleParameters"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.datalakestore.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.datalakestore.models.UpdateFirewallRuleParameters; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.datalakestore.fluent.models.*; import com.azure.resourcemanager.datalakestore.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,162,408 |
List<GitUser> getCommiters() throws GitException; | List<GitUser> getCommiters() throws GitException; | /**
* Gel list of commiters in current repository.
*
* @return list of commiters
* @throws GitException
*/ | Gel list of commiters in current repository | getCommiters | {
"repo_name": "stour/che",
"path": "wsagent/che-core-api-git/src/main/java/org/eclipse/che/api/git/GitConnection.java",
"license": "epl-1.0",
"size": 15881
} | [
"java.util.List",
"org.eclipse.che.api.git.shared.GitUser"
] | import java.util.List; import org.eclipse.che.api.git.shared.GitUser; | import java.util.*; import org.eclipse.che.api.git.shared.*; | [
"java.util",
"org.eclipse.che"
] | java.util; org.eclipse.che; | 601,044 |
List findByNamedQueryAndValueBean(String queryName, Object valueBean)
throws DataAccessException;
//-------------------------------------------------------------------------
// Convenience finder methods for detached criteria
//------------------------------------------------------------------------- | List findByNamedQueryAndValueBean(String queryName, Object valueBean) throws DataAccessException; | /**
* Execute a named query, binding the properties of the given bean to
* ":" named parameters in the query string.
* <p>A named query is defined in a Hibernate mapping file.
* @param queryName the name of a Hibernate query in a mapping file
* @param valueBean the values of the parameters
* @return a {@link List} containing the results of the query execution
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
* @see org.hibernate.Query#setProperties
* @see org.hibernate.Session#getNamedQuery(String)
*/ | Execute a named query, binding the properties of the given bean to ":" named parameters in the query string. A named query is defined in a Hibernate mapping file | findByNamedQueryAndValueBean | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "src/org/springframework/orm/hibernate3/HibernateOperations.java",
"license": "apache-2.0",
"size": 44752
} | [
"java.util.List",
"org.springframework.dao.DataAccessException"
] | import java.util.List; import org.springframework.dao.DataAccessException; | import java.util.*; import org.springframework.dao.*; | [
"java.util",
"org.springframework.dao"
] | java.util; org.springframework.dao; | 122,146 |
private boolean isResourceUrlSecure(Page page) {
ValueMap props = getPagePropertiesNullSafe(page);
IntegratorMode mode = getIntegratorMode(props);
if (mode.isDetectProtocol()) {
IntegratorProtocol integratorProtocol = getIntegratorProtocol(props);
if (integratorProtocol == IntegratorProtocol.HTTPS) {
return true;
}
else if (integratorProtocol == IntegratorProtocol.AUTO) {
return RequestPath.hasSelector(request, IntegratorHandler.SELECTOR_INTEGRATORTEMPLATE_SECURE);
}
}
return false;
} | boolean function(Page page) { ValueMap props = getPagePropertiesNullSafe(page); IntegratorMode mode = getIntegratorMode(props); if (mode.isDetectProtocol()) { IntegratorProtocol integratorProtocol = getIntegratorProtocol(props); if (integratorProtocol == IntegratorProtocol.HTTPS) { return true; } else if (integratorProtocol == IntegratorProtocol.AUTO) { return RequestPath.hasSelector(request, IntegratorHandler.SELECTOR_INTEGRATORTEMPLATE_SECURE); } } return false; } | /**
* Checks whether resource URLs should be rendered in secure mode or not.
* @return true if resource URLs should be rendered in secure mode
*/ | Checks whether resource URLs should be rendered in secure mode or not | isResourceUrlSecure | {
"repo_name": "cnagel/wcm-io-handler",
"path": "url/src/main/java/io/wcm/handler/url/integrator/impl/IntegratorHandlerImpl.java",
"license": "apache-2.0",
"size": 7618
} | [
"com.day.cq.wcm.api.Page",
"io.wcm.handler.url.integrator.IntegratorHandler",
"io.wcm.handler.url.integrator.IntegratorMode",
"io.wcm.handler.url.integrator.IntegratorProtocol",
"io.wcm.sling.commons.request.RequestPath",
"org.apache.sling.api.resource.ValueMap"
] | import com.day.cq.wcm.api.Page; import io.wcm.handler.url.integrator.IntegratorHandler; import io.wcm.handler.url.integrator.IntegratorMode; import io.wcm.handler.url.integrator.IntegratorProtocol; import io.wcm.sling.commons.request.RequestPath; import org.apache.sling.api.resource.ValueMap; | import com.day.cq.wcm.api.*; import io.wcm.handler.url.integrator.*; import io.wcm.sling.commons.request.*; import org.apache.sling.api.resource.*; | [
"com.day.cq",
"io.wcm.handler",
"io.wcm.sling",
"org.apache.sling"
] | com.day.cq; io.wcm.handler; io.wcm.sling; org.apache.sling; | 317,921 |
@Test void testAggregateRemove3() {
final String sql = "select empno, count(mgr) "
+ "from sales.emp group by empno, deptno\n";
sql(sql)
.withRule(CoreRules.AGGREGATE_REMOVE,
CoreRules.PROJECT_MERGE)
.check();
} | @Test void testAggregateRemove3() { final String sql = STR + STR; sql(sql) .withRule(CoreRules.AGGREGATE_REMOVE, CoreRules.PROJECT_MERGE) .check(); } | /**
* Test case for AggregateRemoveRule, should remove aggregates since
* empno is unique and all aggregate functions are splittable. Count
* aggregate function should be transformed to CASE function call
* because mgr is nullable.
*/ | Test case for AggregateRemoveRule, should remove aggregates since empno is unique and all aggregate functions are splittable. Count aggregate function should be transformed to CASE function call because mgr is nullable | testAggregateRemove3 | {
"repo_name": "datametica/calcite",
"path": "core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java",
"license": "apache-2.0",
"size": 264929
} | [
"org.apache.calcite.rel.rules.CoreRules",
"org.junit.jupiter.api.Test"
] | import org.apache.calcite.rel.rules.CoreRules; import org.junit.jupiter.api.Test; | import org.apache.calcite.rel.rules.*; import org.junit.jupiter.api.*; | [
"org.apache.calcite",
"org.junit.jupiter"
] | org.apache.calcite; org.junit.jupiter; | 166,927 |
TaskInfo updateTask(Session session, TaskId taskId, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers); | TaskInfo updateTask(Session session, TaskId taskId, Optional<PlanFragment> fragment, List<TaskSource> sources, OutputBuffers outputBuffers); | /**
* Updates the task plan, sources and output buffers. If the task does not
* already exist, is is created and then updated.
*/ | Updates the task plan, sources and output buffers. If the task does not already exist, is is created and then updated | updateTask | {
"repo_name": "RobinUS2/presto",
"path": "presto-main/src/main/java/com/facebook/presto/execution/TaskManager.java",
"license": "apache-2.0",
"size": 4652
} | [
"com.facebook.presto.OutputBuffers",
"com.facebook.presto.Session",
"com.facebook.presto.TaskSource",
"com.facebook.presto.sql.planner.PlanFragment",
"java.util.List",
"java.util.Optional"
] | import com.facebook.presto.OutputBuffers; import com.facebook.presto.Session; import com.facebook.presto.TaskSource; import com.facebook.presto.sql.planner.PlanFragment; import java.util.List; import java.util.Optional; | import com.facebook.presto.*; import com.facebook.presto.sql.planner.*; import java.util.*; | [
"com.facebook.presto",
"java.util"
] | com.facebook.presto; java.util; | 697,481 |
public ServiceFuture<DdosCustomPolicyInner> createOrUpdateAsync(String resourceGroupName, String ddosCustomPolicyName, DdosCustomPolicyInner parameters, final ServiceCallback<DdosCustomPolicyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ddosCustomPolicyName, parameters), serviceCallback);
} | ServiceFuture<DdosCustomPolicyInner> function(String resourceGroupName, String ddosCustomPolicyName, DdosCustomPolicyInner parameters, final ServiceCallback<DdosCustomPolicyInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, ddosCustomPolicyName, parameters), serviceCallback); } | /**
* Creates or updates a DDoS custom policy.
*
* @param resourceGroupName The name of the resource group.
* @param ddosCustomPolicyName The name of the DDoS custom policy.
* @param parameters Parameters supplied to the create or update operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Creates or updates a DDoS custom policy | createOrUpdateAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/DdosCustomPoliciesInner.java",
"license": "mit",
"size": 38765
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 839,411 |
public void buildDeltas() {
this.delta = new JavaElementDelta(this.javaElement);
// if building a delta on a compilation unit or below,
// it's a fine grained delta
if (this.javaElement.getElementType() >= IJavaScriptElement.JAVASCRIPT_UNIT) {
this.delta.fineGrained();
}
this.recordNewPositions(this.javaElement, 0);
this.findAdditions(this.javaElement, 0);
this.findDeletions();
this.findChangesInPositioning(this.javaElement, 0);
this.trimDelta(this.delta);
if (this.delta.getAffectedChildren().length == 0) {
// this is a fine grained but not children affected -> mark as content changed
this.delta.contentChanged();
}
} | void function() { this.delta = new JavaElementDelta(this.javaElement); if (this.javaElement.getElementType() >= IJavaScriptElement.JAVASCRIPT_UNIT) { this.delta.fineGrained(); } this.recordNewPositions(this.javaElement, 0); this.findAdditions(this.javaElement, 0); this.findDeletions(); this.findChangesInPositioning(this.javaElement, 0); this.trimDelta(this.delta); if (this.delta.getAffectedChildren().length == 0) { this.delta.contentChanged(); } } | /**
* Builds the java element deltas between the old content of the compilation
* unit and its new content.
*/ | Builds the java element deltas between the old content of the compilation unit and its new content | buildDeltas | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.core/src/org/eclipse/wst/jsdt/internal/core/JavaElementDeltaBuilder.java",
"license": "epl-1.0",
"size": 14709
} | [
"org.eclipse.wst.jsdt.core.IJavaScriptElement"
] | import org.eclipse.wst.jsdt.core.IJavaScriptElement; | import org.eclipse.wst.jsdt.core.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 1,069,374 |
public void registerForPushNotifications(Context context, String gcmSenderId, boolean checkManifest) {
pushService.registerForPushNotifications(context, gcmSenderId, checkManifest);
}
| void function(Context context, String gcmSenderId, boolean checkManifest) { pushService.registerForPushNotifications(context, gcmSenderId, checkManifest); } | /**
* Register this device with AppGlu to make it eligible to receive push notifications.
* @param context Activity or Application object
* @param gcmSenderId this is your Google Cloud Message project ID. More information available in GCM documentation: @see <a href="http://developer.android.com/google/gcm/gs.html">http://developer.android.com/google/gcm/gs.html</a>.
* @param checkManifest if <code>true</code> then GCMRegistrar.checkManifest(context) will be executed
*/ | Register this device with AppGlu to make it eligible to receive push notifications | registerForPushNotifications | {
"repo_name": "michelzanini/appglu-androidsdk",
"path": "appglu-android-sdk/src/main/java/com/appglu/android/push/PushApi.java",
"license": "apache-2.0",
"size": 2964
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 414,482 |
this.jdbcTemplate = new JdbcTemplate(dataSource);
} | this.jdbcTemplate = new JdbcTemplate(dataSource); } | /**
* Set the {@code DataSource}, typically provided via Dependency Injection.
* <p>This method also instantiates the {@link #jdbcTemplate} instance variable.
*/ | Set the DataSource, typically provided via Dependency Injection. This method also instantiates the <code>#jdbcTemplate</code> instance variable | setDataSource | {
"repo_name": "leogoing/spring_jeesite",
"path": "spring-test-4.0/org/springframework/test/context/testng/AbstractTransactionalTestNGSpringContextTests.java",
"license": "apache-2.0",
"size": 7845
} | [
"org.springframework.jdbc.core.JdbcTemplate"
] | import org.springframework.jdbc.core.JdbcTemplate; | import org.springframework.jdbc.core.*; | [
"org.springframework.jdbc"
] | org.springframework.jdbc; | 1,797,010 |
private void toggleMultiple(final Set<Long> selectedSet, final MultiToggleHelper helper) {
final Cursor c = mListAdapter.getCursor();
if (c == null || c.isClosed()) {
return;
}
final HashMap<Long, Boolean> setValues = new HashMap<Long, Boolean>();
boolean allWereSet = true;
/// M: re-sort the message's order, make current item first be processed.@{
final ArrayList<Long> messageResort = new ArrayList<Long>();
int currentItemPosition = getListView().getFirstVisiblePosition();
c.moveToPosition(currentItemPosition - 1);
while (c.moveToNext()) {
long id = c.getInt(MessagesAdapter.COLUMN_ID);
if (selectedSet.contains(id)) {
boolean value = helper.getField(c);
setValues.put(id, value);
messageResort.add(id);
allWereSet = allWereSet && value;
}
}
c.moveToPosition(-1);
while (c.moveToNext() && c.getPosition() < currentItemPosition) {
long id = c.getInt(MessagesAdapter.COLUMN_ID);
if (selectedSet.contains(id)) {
boolean value = helper.getField(c);
setValues.put(id, value);
messageResort.add(id);
allWereSet = allWereSet && value;
}
}
/// @}
if (!setValues.isEmpty()) {
final boolean newValue = !allWereSet;
c.moveToPosition(-1);
// TODO: we should probably put up a dialog or some other progress indicator for this.
/// M: request re-draw the list items to clear the selected state.@{
getListView().requestLayout();
/// @} | void function(final Set<Long> selectedSet, final MultiToggleHelper helper) { final Cursor c = mListAdapter.getCursor(); if (c == null c.isClosed()) { return; } final HashMap<Long, Boolean> setValues = new HashMap<Long, Boolean>(); boolean allWereSet = true; final ArrayList<Long> messageResort = new ArrayList<Long>(); int currentItemPosition = getListView().getFirstVisiblePosition(); c.moveToPosition(currentItemPosition - 1); while (c.moveToNext()) { long id = c.getInt(MessagesAdapter.COLUMN_ID); if (selectedSet.contains(id)) { boolean value = helper.getField(c); setValues.put(id, value); messageResort.add(id); allWereSet = allWereSet && value; } } c.moveToPosition(-1); while (c.moveToNext() && c.getPosition() < currentItemPosition) { long id = c.getInt(MessagesAdapter.COLUMN_ID); if (selectedSet.contains(id)) { boolean value = helper.getField(c); setValues.put(id, value); messageResort.add(id); allWereSet = allWereSet && value; } } if (!setValues.isEmpty()) { final boolean newValue = !allWereSet; c.moveToPosition(-1); getListView().requestLayout(); | /**
* Toggle multiple fields in a message, using the following logic: If one or more fields
* are "clear", then "set" them. If all fields are "set", then "clear" them all. Provider
* calls are applied asynchronously in setField
*
* @param selectedSet the set of messages that are selected
* @param helper functions to implement the specific getter & setter
*/ | Toggle multiple fields in a message, using the following logic: If one or more fields are "clear", then "set" them. If all fields are "set", then "clear" them all. Provider calls are applied asynchronously in setField | toggleMultiple | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Email/src/com/android/email/activity/MessageListFragment.java",
"license": "gpl-2.0",
"size": 89286
} | [
"android.database.Cursor",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.Set"
] | import android.database.Cursor; import java.util.ArrayList; import java.util.HashMap; import java.util.Set; | import android.database.*; import java.util.*; | [
"android.database",
"java.util"
] | android.database; java.util; | 2,527,317 |
public boolean validateArguments(String modeName,
ParameterBlock args,
StringBuffer msg) {
if (!super.validateArguments(modeName, args, msg)) {
return false;
}
if (!modeName.equalsIgnoreCase("rendered"))
return true;
// Retrieve the operation source and parameters.
RenderedImage src = args.getRenderedSource(0);
ColorCube colorMap = (ColorCube)args.getObjectParameter(0);
KernelJAI[] ditherMask = (KernelJAI[])args.getObjectParameter(1);
// Check color map validity.
if (!isValidColorMap(src, colorMap, msg)) {
return false;
}
// Check dither mask validity.
if (!isValidDitherMask(src, ditherMask, msg)) {
return false;
}
return true;
} | boolean function(String modeName, ParameterBlock args, StringBuffer msg) { if (!super.validateArguments(modeName, args, msg)) { return false; } if (!modeName.equalsIgnoreCase(STR)) return true; RenderedImage src = args.getRenderedSource(0); ColorCube colorMap = (ColorCube)args.getObjectParameter(0); KernelJAI[] ditherMask = (KernelJAI[])args.getObjectParameter(1); if (!isValidColorMap(src, colorMap, msg)) { return false; } if (!isValidDitherMask(src, ditherMask, msg)) { return false; } return true; } | /**
* Validates the input source and parameters.
*
* <p> In addition to the standard checks performed by the
* superclass method, this method checks that "colorMap"
* and "ditherMask" are valid for the given source image.
*/ | Validates the input source and parameters. In addition to the standard checks performed by the superclass method, this method checks that "colorMap" and "ditherMask" are valid for the given source image | validateArguments | {
"repo_name": "MarinnaCole/LightZone",
"path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/operator/OrderedDitherDescriptor.java",
"license": "bsd-3-clause",
"size": 10413
} | [
"com.lightcrafts.mediax.jai.ColorCube",
"com.lightcrafts.mediax.jai.KernelJAI",
"java.awt.image.RenderedImage",
"java.awt.image.renderable.ParameterBlock"
] | import com.lightcrafts.mediax.jai.ColorCube; import com.lightcrafts.mediax.jai.KernelJAI; import java.awt.image.RenderedImage; import java.awt.image.renderable.ParameterBlock; | import com.lightcrafts.mediax.jai.*; import java.awt.image.*; import java.awt.image.renderable.*; | [
"com.lightcrafts.mediax",
"java.awt"
] | com.lightcrafts.mediax; java.awt; | 712,279 |
@SuppressWarnings("unchecked")
public T public_() {
modifiers = (modifiers & ~(Opcodes.ACC_PRIVATE + Opcodes.ACC_PUBLIC + Opcodes.ACC_PROTECTED))
+ Opcodes.ACC_PUBLIC;
return (T) this;
} | @SuppressWarnings(STR) T function() { modifiers = (modifiers & ~(Opcodes.ACC_PRIVATE + Opcodes.ACC_PUBLIC + Opcodes.ACC_PROTECTED)) + Opcodes.ACC_PUBLIC; return (T) this; } | /**
* Set the access to private.
*
* @return
*/ | Set the access to private | public_ | {
"repo_name": "IBYoung/asmsupport",
"path": "asmsupport-client/src/main/java/cn/wensiqun/asmsupport/client/DummyAccessControl.java",
"license": "lgpl-3.0",
"size": 3568
} | [
"cn.wensiqun.asmsupport.org.objectweb.asm.Opcodes"
] | import cn.wensiqun.asmsupport.org.objectweb.asm.Opcodes; | import cn.wensiqun.asmsupport.org.objectweb.asm.*; | [
"cn.wensiqun.asmsupport"
] | cn.wensiqun.asmsupport; | 2,163,865 |
@Nullable
public OsInfo getOs() {
return this.os;
} | OsInfo function() { return this.os; } | /**
* Operating System level information.
*/ | Operating System level information | getOs | {
"repo_name": "arowla/elasticsearch",
"path": "src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodeInfo.java",
"license": "apache-2.0",
"size": 8542
} | [
"org.elasticsearch.monitor.os.OsInfo"
] | import org.elasticsearch.monitor.os.OsInfo; | import org.elasticsearch.monitor.os.*; | [
"org.elasticsearch.monitor"
] | org.elasticsearch.monitor; | 2,911,549 |
void buildContent(final MultiPartEmail content) throws EmailException; | void buildContent(final MultiPartEmail content) throws EmailException; | /**
* Builds email content to be sent using an email sender.
*
* @param content instance where content must be set.
* @throws EmailException if setting mail content fails.
*/ | Builds email content to be sent using an email sender | buildContent | {
"repo_name": "albertoirurueta/irurueta-server-commons-email",
"path": "src/main/java/com/irurueta/server/commons/email/ApacheMultipartEmailMessage.java",
"license": "apache-2.0",
"size": 1139
} | [
"org.apache.commons.mail.MultiPartEmail"
] | import org.apache.commons.mail.MultiPartEmail; | import org.apache.commons.mail.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,567,315 |
public static CommentHeader readVorbisCommentHeader(ParsableByteArray headerData)
throws ParserException {
verifyVorbisHeaderCapturePattern(0x03, headerData, false);
int length = 7;
int len = (int) headerData.readLittleEndianUnsignedInt();
length += 4;
String vendor = headerData.readString(len);
length += vendor.length();
long commentListLen = headerData.readLittleEndianUnsignedInt();
String[] comments = new String[(int) commentListLen];
length += 4;
for (int i = 0; i < commentListLen; i++) {
len = (int) headerData.readLittleEndianUnsignedInt();
length += 4;
comments[i] = headerData.readString(len);
length += comments[i].length();
}
if ((headerData.readUnsignedByte() & 0x01) == 0) {
throw new ParserException("framing bit expected to be set");
}
length += 1;
return new CommentHeader(vendor, comments, length);
} | static CommentHeader function(ParsableByteArray headerData) throws ParserException { verifyVorbisHeaderCapturePattern(0x03, headerData, false); int length = 7; int len = (int) headerData.readLittleEndianUnsignedInt(); length += 4; String vendor = headerData.readString(len); length += vendor.length(); long commentListLen = headerData.readLittleEndianUnsignedInt(); String[] comments = new String[(int) commentListLen]; length += 4; for (int i = 0; i < commentListLen; i++) { len = (int) headerData.readLittleEndianUnsignedInt(); length += 4; comments[i] = headerData.readString(len); length += comments[i].length(); } if ((headerData.readUnsignedByte() & 0x01) == 0) { throw new ParserException(STR); } length += 1; return new CommentHeader(vendor, comments, length); } | /**
* Reads a vorbis comment header.
*
* @see <a href="https://www.xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-640004.2.3">
* Vorbis spec/Comment header</a>
* @param headerData a {@link ParsableByteArray} wrapping the header data.
* @return a {@link VorbisUtil.CommentHeader} with all the comments.
* @throws ParserException thrown if invalid capture pattern is detected.
*/ | Reads a vorbis comment header | readVorbisCommentHeader | {
"repo_name": "bongole/ExoPlayer",
"path": "library/src/main/java/com/google/android/exoplayer/extractor/ogg/VorbisUtil.java",
"license": "apache-2.0",
"size": 16963
} | [
"com.google.android.exoplayer.ParserException",
"com.google.android.exoplayer.util.ParsableByteArray"
] | import com.google.android.exoplayer.ParserException; import com.google.android.exoplayer.util.ParsableByteArray; | import com.google.android.exoplayer.*; import com.google.android.exoplayer.util.*; | [
"com.google.android"
] | com.google.android; | 2,258,435 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "markus1978/emf-fragments",
"path": "de.hub.emffrag.edit/src/de/hub/emffrag/model/emffrag/provider/IndexedListItemProvider.java",
"license": "apache-2.0",
"size": 3814
} | [
"org.eclipse.emf.common.notify.Notification"
] | import org.eclipse.emf.common.notify.Notification; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,840,257 |
public void addSubConversation(SubConversationContext suc) {
if(m_subConversationSet.add(suc)) {
if(suc.getState() == ConversationState.DETACHED) {
suc.initialize(getWindowSession());
try {
suc.internalAttach();
} catch(Exception x) {
throw WrappedException.wrap(x); // Really great those checked exceptions 8-(
}
}
}
} | void function(SubConversationContext suc) { if(m_subConversationSet.add(suc)) { if(suc.getState() == ConversationState.DETACHED) { suc.initialize(getWindowSession()); try { suc.internalAttach(); } catch(Exception x) { throw WrappedException.wrap(x); } } } } | /**
* Register and activate a subconversation context.
*/ | Register and activate a subconversation context | addSubConversation | {
"repo_name": "fjalvingh/domui",
"path": "to.etc.domui/src/main/java/to/etc/domui/state/ConversationContext.java",
"license": "lgpl-2.1",
"size": 15934
} | [
"to.etc.util.WrappedException"
] | import to.etc.util.WrappedException; | import to.etc.util.*; | [
"to.etc.util"
] | to.etc.util; | 99,261 |
@Column(name = "created_date", nullable = false)
public LocalDateTime getCreatedDate() {
return (LocalDateTime) get(2);
}
// -------------------------------------------------------------------------
// Primary key information
// ------------------------------------------------------------------------- | @Column(name = STR, nullable = false) LocalDateTime function() { return (LocalDateTime) get(2); } | /**
* Getter for <code>public.password_change_request.created_date</code>.
*/ | Getter for <code>public.password_change_request.created_date</code> | getCreatedDate | {
"repo_name": "CellarHQ/cellarhq.com",
"path": "model/src/main/generated/com/cellarhq/generated/tables/records/PasswordChangeRequestRecord.java",
"license": "mit",
"size": 5444
} | [
"java.time.LocalDateTime",
"javax.persistence.Column"
] | import java.time.LocalDateTime; import javax.persistence.Column; | import java.time.*; import javax.persistence.*; | [
"java.time",
"javax.persistence"
] | java.time; javax.persistence; | 1,186,136 |
public AggregateEvent build() {
final String description = events.get(0).getDescription();
final SortedMap<Key, Interval> intervals = new TreeMap<>();
for (final Event event : events) {
final Key key = new Key(event.getInterval());
if (BuildConfig.DEBUG && intervals.containsKey(key)) {
throw new AssertionError();
}
intervals.put(key, event.getInterval());
}
return new AggregateEvent(description, intervals);
}
}
/**
* {@inheritDoc} | AggregateEvent function() { final String description = events.get(0).getDescription(); final SortedMap<Key, Interval> intervals = new TreeMap<>(); for (final Event event : events) { final Key key = new Key(event.getInterval()); if (BuildConfig.DEBUG && intervals.containsKey(key)) { throw new AssertionError(); } intervals.put(key, event.getInterval()); } return new AggregateEvent(description, intervals); } } /** * {@inheritDoc} | /**
* Generates an AggregateEvent based on all data collected so far.
*
* @return The AggregateEvent object.
*/ | Generates an AggregateEvent based on all data collected so far | build | {
"repo_name": "jmmv/nudgytimer",
"path": "lib/src/main/java/com/github/jmmv/nudgytimer/lib/AggregateEvent.java",
"license": "apache-2.0",
"size": 9636
} | [
"java.util.SortedMap",
"java.util.TreeMap",
"org.joda.time.Interval"
] | import java.util.SortedMap; import java.util.TreeMap; import org.joda.time.Interval; | import java.util.*; import org.joda.time.*; | [
"java.util",
"org.joda.time"
] | java.util; org.joda.time; | 2,852,539 |
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
}
}
}
}
@Getter
public static class AutomaticTax {
@SerializedName("enabled")
Boolean enabled;
@SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY)
Map<String, Object> extraParams;
private AutomaticTax(Boolean enabled, Map<String, Object> extraParams) {
this.enabled = enabled;
this.extraParams = extraParams;
} | Builder function(Map<String, Object> map) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.putAll(map); return this; } } } } public static class AutomaticTax { @SerializedName(STR) Boolean enabled; @SerializedName(ApiRequestParams.EXTRA_PARAMS_KEY) Map<String, Object> extraParams; private AutomaticTax(Boolean enabled, Map<String, Object> extraParams) { this.enabled = enabled; this.extraParams = extraParams; } | /**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original
* map. See {@link SessionCreateParams.AfterExpiration.Recovery#extraParams} for the field
* documentation.
*/ | Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>SessionCreateParams.AfterExpiration.Recovery#extraParams</code> for the field documentation | putAllExtraParam | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/checkout/SessionCreateParams.java",
"license": "mit",
"size": 222478
} | [
"com.google.gson.annotations.SerializedName",
"com.stripe.net.ApiRequestParams",
"java.util.HashMap",
"java.util.Map"
] | import com.google.gson.annotations.SerializedName; import com.stripe.net.ApiRequestParams; import java.util.HashMap; import java.util.Map; | import com.google.gson.annotations.*; import com.stripe.net.*; import java.util.*; | [
"com.google.gson",
"com.stripe.net",
"java.util"
] | com.google.gson; com.stripe.net; java.util; | 2,385,403 |
private void readAllParameters(StringTokenizer line){
String new_line;
StringTokenizer data;
while (line.hasMoreTokens()) { //While there is more parameters...
new_line = line.nextToken();
data = new StringTokenizer(new_line, "=");
while (data.hasMoreTokens()){
String pname = data.nextToken().trim(); //parameter name
String pvalue = data.nextToken().trim();
parameters.put(pname, pvalue); //parameter value
}
}
//If the algorithm is non-deterministic the first parameter is the Random SEED
}
| void function(StringTokenizer line){ String new_line; StringTokenizer data; while (line.hasMoreTokens()) { new_line = line.nextToken(); data = new StringTokenizer(new_line, "="); while (data.hasMoreTokens()){ String pname = data.nextToken().trim(); String pvalue = data.nextToken().trim(); parameters.put(pname, pvalue); } } } | /**
* We read all the possible parameters of the algorithm
* @param line StringTokenizer It contains all the parameters.
*/ | We read all the possible parameters of the algorithm | readAllParameters | {
"repo_name": "TheMurderer/keel",
"path": "src/keel/Algorithms/Genetic_Rule_Learning/olexGA/ParametersParser.java",
"license": "gpl-3.0",
"size": 7394
} | [
"java.util.StringTokenizer"
] | import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 36,255 |
public static WordSimilarityReport evaluate(
SemanticSpace sspace,
WordSimilarityEvaluation test,
Similarity.SimType vectorComparisonType) {
Collection<WordSimilarity> wordPairs = test.getPairs();
int unanswerable = 0;
// Use lists here to keep track of the judgements for each word pair
// that the SemanticSpace has vectors for. This allows us to skip
// trying to correlate human judgements for pairs that the S-Space
// cannot handle.
List<Double> humanJudgements = new ArrayList<Double>(wordPairs.size());
List<Double> sspaceJudgements = new ArrayList<Double>(wordPairs.size());
double testRange = test.getMostSimilarValue() -
test.getLeastSimilarValue();
// Compute the word pair similarity using the given Semantic Space for
// each word.
for (WordSimilarity pair : wordPairs) {
// get the vector for each word
Vector firstVector = sspace.getVector(pair.getFirstWord());
Vector secondVector = sspace.getVector(pair.getSecondWord());
// check that the s-space had both words
if (firstVector == null || secondVector == null) {
unanswerable++;
continue;
}
// use the similarity result and scale it based on the original
// answers
double similarity =
Similarity.getSimilarity(vectorComparisonType,
firstVector, secondVector);
double scaled = (similarity * testRange) +
test.getLeastSimilarValue();
humanJudgements.add(pair.getSimilarity());
sspaceJudgements.add(scaled);
}
// Calculate the correlation between the human judgements and the
// semantic space judgements.
double[] humanArr = new double[humanJudgements.size()];
double[] sspaceArr = new double[humanJudgements.size()];
for(int i = 0; i < humanArr.length; ++i) {
humanArr[i] = humanJudgements.get(i);
sspaceArr[i] = sspaceJudgements.get(i);
}
double correlation = Similarity.correlation(humanArr, sspaceArr);
return new SimpleReport(wordPairs.size(), correlation, unanswerable);
}
private static class SimpleReport implements WordSimilarityReport {
private final int numWordPairs;
private final double correlation;
private final int unanswerable;
public SimpleReport(int numWordPairs,
double correlation,
int unanswerable) {
this.numWordPairs = numWordPairs;
this.correlation = correlation;
this.unanswerable = unanswerable;
}
/**
* {@inheritDoc} | static WordSimilarityReport function( SemanticSpace sspace, WordSimilarityEvaluation test, Similarity.SimType vectorComparisonType) { Collection<WordSimilarity> wordPairs = test.getPairs(); int unanswerable = 0; List<Double> humanJudgements = new ArrayList<Double>(wordPairs.size()); List<Double> sspaceJudgements = new ArrayList<Double>(wordPairs.size()); double testRange = test.getMostSimilarValue() - test.getLeastSimilarValue(); for (WordSimilarity pair : wordPairs) { Vector firstVector = sspace.getVector(pair.getFirstWord()); Vector secondVector = sspace.getVector(pair.getSecondWord()); if (firstVector == null secondVector == null) { unanswerable++; continue; } double similarity = Similarity.getSimilarity(vectorComparisonType, firstVector, secondVector); double scaled = (similarity * testRange) + test.getLeastSimilarValue(); humanJudgements.add(pair.getSimilarity()); sspaceJudgements.add(scaled); } double[] humanArr = new double[humanJudgements.size()]; double[] sspaceArr = new double[humanJudgements.size()]; for(int i = 0; i < humanArr.length; ++i) { humanArr[i] = humanJudgements.get(i); sspaceArr[i] = sspaceJudgements.get(i); } double correlation = Similarity.correlation(humanArr, sspaceArr); return new SimpleReport(wordPairs.size(), correlation, unanswerable); } private static class SimpleReport implements WordSimilarityReport { private final int numWordPairs; private final double correlation; private final int unanswerable; public SimpleReport(int numWordPairs, double correlation, int unanswerable) { this.numWordPairs = numWordPairs; this.correlation = correlation; this.unanswerable = unanswerable; } /** * {@inheritDoc} | /**
* Evaluates the performance of a given {@code SemanticSpace} on a given
* {@code WordSimilarityEvaluation} using the provided similarity metric.
* Returns a {@link WordSimilarityReport} detailing the performance, with
* similarity scores scaled by the lowest and highest human based similarity
* ratings.
*
* @param sspace The {@link SemanticSpace} to test against
* @param test The {@link WordSimilarityEvaluation} providing human
* similarity scores
* @param vectorComparisonType The similarity measture to use
*
* @return A {@link WordSimilarityReport} detailing the performance
*/ | Evaluates the performance of a given SemanticSpace on a given WordSimilarityEvaluation using the provided similarity metric. Returns a <code>WordSimilarityReport</code> detailing the performance, with similarity scores scaled by the lowest and highest human based similarity ratings | evaluate | {
"repo_name": "fozziethebeat/S-Space",
"path": "src/main/java/edu/ucla/sspace/evaluation/WordSimilarityEvaluationRunner.java",
"license": "gpl-2.0",
"size": 6211
} | [
"edu.ucla.sspace.common.SemanticSpace",
"edu.ucla.sspace.common.Similarity",
"edu.ucla.sspace.vector.Vector",
"java.util.ArrayList",
"java.util.Collection",
"java.util.List"
] | import edu.ucla.sspace.common.SemanticSpace; import edu.ucla.sspace.common.Similarity; import edu.ucla.sspace.vector.Vector; import java.util.ArrayList; import java.util.Collection; import java.util.List; | import edu.ucla.sspace.common.*; import edu.ucla.sspace.vector.*; import java.util.*; | [
"edu.ucla.sspace",
"java.util"
] | edu.ucla.sspace; java.util; | 395,760 |
public void setValue(Map<String, Token[]> tokensMap) {
if (type == null) {
type = ItemType.MAP;
}
checkMappableType();
this.tokensMap = tokensMap;
} | void function(Map<String, Token[]> tokensMap) { if (type == null) { type = ItemType.MAP; } checkMappableType(); this.tokensMap = tokensMap; } | /**
* Sets a value to this Map type item.
* @param tokensMap the tokens map
*/ | Sets a value to this Map type item | setValue | {
"repo_name": "aspectran/aspectran",
"path": "core/src/main/java/com/aspectran/core/context/rule/ItemRule.java",
"license": "apache-2.0",
"size": 18621
} | [
"com.aspectran.core.context.expr.token.Token",
"com.aspectran.core.context.rule.type.ItemType",
"java.util.Map"
] | import com.aspectran.core.context.expr.token.Token; import com.aspectran.core.context.rule.type.ItemType; import java.util.Map; | import com.aspectran.core.context.expr.token.*; import com.aspectran.core.context.rule.type.*; import java.util.*; | [
"com.aspectran.core",
"java.util"
] | com.aspectran.core; java.util; | 935,744 |
public void setNewFileTree(KaufholdTreeModel aModel){
diskTree.setModel(aModel);
} | void function(KaufholdTreeModel aModel){ diskTree.setModel(aModel); } | /**
* Sets the tree model to one selected as the directory to be hashed
* @param aModel the tree model to one selected as the directory to be hashed
*/ | Sets the tree model to one selected as the directory to be hashed | setNewFileTree | {
"repo_name": "bolodev/multiviewer",
"path": "src/org/bolodev/mv/ui/panels/DiskTreePanel.java",
"license": "agpl-3.0",
"size": 2815
} | [
"org.bolodev.mv.utils.KaufholdTreeModel"
] | import org.bolodev.mv.utils.KaufholdTreeModel; | import org.bolodev.mv.utils.*; | [
"org.bolodev.mv"
] | org.bolodev.mv; | 2,363,791 |
protected EventStore getStore() {
return store;
} | EventStore function() { return store; } | /**
* Return store.
*
* @return event store
*/ | Return store | getStore | {
"repo_name": "JordanKergoat/hesperides",
"path": "src/main/java/com/vsct/dt/hesperides/templating/modules/template/event/AbstractTemplateCacheLoader.java",
"license": "gpl-3.0",
"size": 4786
} | [
"com.vsct.dt.hesperides.storage.EventStore"
] | import com.vsct.dt.hesperides.storage.EventStore; | import com.vsct.dt.hesperides.storage.*; | [
"com.vsct.dt"
] | com.vsct.dt; | 403,062 |
private void cleanupTestDatabasePostgreSql() throws Exception {
dropTestSequences(dbSupport, "test_sequence");
}
//
// Database setup for Db2
//
| void function() throws Exception { dropTestSequences(dbSupport, STR); } | /**
* Drops all created test database structures
*/ | Drops all created test database structures | cleanupTestDatabasePostgreSql | {
"repo_name": "arteam/unitils",
"path": "unitils-test/src/test/java/org/unitils/dbmaintainer/structure/SequenceUpdaterTest.java",
"license": "apache-2.0",
"size": 14680
} | [
"org.unitils.core.util.SQLTestUtils"
] | import org.unitils.core.util.SQLTestUtils; | import org.unitils.core.util.*; | [
"org.unitils.core"
] | org.unitils.core; | 462,077 |
private void assignContainers(FiCaSchedulerNode node) {
LOG.debug("assignContainers:" +
" node=" + node.getRMNode().getNodeAddress() +
" #applications=" + applications.size());
// Try to assign containers to applications in fifo order
for (Map.Entry<ApplicationId, SchedulerApplication<FiCaSchedulerApp>> e : applications
.entrySet()) {
FiCaSchedulerApp application = e.getValue().getCurrentAppAttempt();
if (application == null) {
continue;
}
LOG.debug("pre-assignContainers");
application.showRequests();
synchronized (application) {
// Check if this resource is on the blacklist
if (SchedulerAppUtils.isBlacklisted(application, node, LOG)) {
continue;
}
for (Priority priority : application.getPriorities()) {
int maxContainers =
getMaxAllocatableContainers(application, priority, node,
NodeType.OFF_SWITCH);
// Ensure the application needs containers of this priority
if (maxContainers > 0) {
int assignedContainers =
assignContainersOnNode(node, application, priority);
// Do not assign out of order w.r.t priorities
if (assignedContainers == 0) {
break;
}
}
}
}
LOG.debug("post-assignContainers");
application.showRequests();
// Done
if (Resources.lessThan(resourceCalculator, clusterResource,
node.getAvailableResource(), minimumAllocation)) {
break;
}
}
// Update the applications' headroom to correctly take into
// account the containers assigned in this update.
for (SchedulerApplication<FiCaSchedulerApp> application : applications.values()) {
FiCaSchedulerApp attempt =
(FiCaSchedulerApp) application.getCurrentAppAttempt();
if (attempt == null) {
continue;
}
updateAppHeadRoom(attempt);
}
} | void function(FiCaSchedulerNode node) { LOG.debug(STR + STR + node.getRMNode().getNodeAddress() + STR + applications.size()); for (Map.Entry<ApplicationId, SchedulerApplication<FiCaSchedulerApp>> e : applications .entrySet()) { FiCaSchedulerApp application = e.getValue().getCurrentAppAttempt(); if (application == null) { continue; } LOG.debug(STR); application.showRequests(); synchronized (application) { if (SchedulerAppUtils.isBlacklisted(application, node, LOG)) { continue; } for (Priority priority : application.getPriorities()) { int maxContainers = getMaxAllocatableContainers(application, priority, node, NodeType.OFF_SWITCH); if (maxContainers > 0) { int assignedContainers = assignContainersOnNode(node, application, priority); if (assignedContainers == 0) { break; } } } } LOG.debug(STR); application.showRequests(); if (Resources.lessThan(resourceCalculator, clusterResource, node.getAvailableResource(), minimumAllocation)) { break; } } for (SchedulerApplication<FiCaSchedulerApp> application : applications.values()) { FiCaSchedulerApp attempt = (FiCaSchedulerApp) application.getCurrentAppAttempt(); if (attempt == null) { continue; } updateAppHeadRoom(attempt); } } | /**
* Heart of the scheduler...
*
* @param node node on which resources are available to be allocated
*/ | Heart of the scheduler.. | assignContainers | {
"repo_name": "dilaver/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java",
"license": "apache-2.0",
"size": 37090
} | [
"java.util.Map",
"org.apache.hadoop.yarn.api.records.ApplicationId",
"org.apache.hadoop.yarn.api.records.Priority",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppUtils",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode",
"org.apache.hadoop.yarn.util.resource.Resources"
] | import java.util.Map; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.Priority; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeType; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerAppUtils; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerApplication; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode; import org.apache.hadoop.yarn.util.resource.Resources; | import java.util.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.*; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.*; import org.apache.hadoop.yarn.util.resource.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,619,252 |
public StringList getErrorMessages() {
if (fErrors == null || fErrors.length == 0) {
return StringListImpl.EMPTY_LIST;
}
return new PSVIErrorList(fErrors, false);
} | StringList function() { if (fErrors == null fErrors.length == 0) { return StringListImpl.EMPTY_LIST; } return new PSVIErrorList(fErrors, false); } | /**
* A list of error messages generated from the validation attempt or
* an empty <code>StringList</code> if no errors occurred during the
* validation attempt. The indices of error messages in this list are
* aligned with those in the <code>[schema error code]</code> list.
*/ | A list of error messages generated from the validation attempt or an empty <code>StringList</code> if no errors occurred during the validation attempt. The indices of error messages in this list are aligned with those in the <code>[schema error code]</code> list | getErrorMessages | {
"repo_name": "FauxFaux/jdk9-jaxp",
"path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/AttributePSVImpl.java",
"license": "gpl-2.0",
"size": 9628
} | [
"com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl",
"com.sun.org.apache.xerces.internal.xs.StringList"
] | import com.sun.org.apache.xerces.internal.impl.xs.util.StringListImpl; import com.sun.org.apache.xerces.internal.xs.StringList; | import com.sun.org.apache.xerces.internal.impl.xs.util.*; import com.sun.org.apache.xerces.internal.xs.*; | [
"com.sun.org"
] | com.sun.org; | 775,625 |
private AnnotationTargets_Targets getAnnotationTargets() {
try {
// Conditionally use the cache enabled implementation.
WebAnnotations webAnnotations = AnnotationsBetaHelper.getWebAnnotations( getModuleContainer() );
return webAnnotations.getAnnotationTargets();
} catch ( UnableToAdaptException e ) {
return null; // FFDC
}
} | AnnotationTargets_Targets function() { try { WebAnnotations webAnnotations = AnnotationsBetaHelper.getWebAnnotations( getModuleContainer() ); return webAnnotations.getAnnotationTargets(); } catch ( UnableToAdaptException e ) { return null; } } | /**
* Answer the annotation targets of the web module.
*
* @return The annotations targets of the web module. Return null if
* annotation processing fails.
*/ | Answer the annotation targets of the web module | getAnnotationTargets | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/webapp/WebApp.java",
"license": "epl-1.0",
"size": 312106
} | [
"com.ibm.ws.container.service.annocache.AnnotationsBetaHelper",
"com.ibm.ws.container.service.annotations.WebAnnotations",
"com.ibm.wsspi.adaptable.module.UnableToAdaptException"
] | import com.ibm.ws.container.service.annocache.AnnotationsBetaHelper; import com.ibm.ws.container.service.annotations.WebAnnotations; import com.ibm.wsspi.adaptable.module.UnableToAdaptException; | import com.ibm.ws.container.service.annocache.*; import com.ibm.ws.container.service.annotations.*; import com.ibm.wsspi.adaptable.module.*; | [
"com.ibm.ws",
"com.ibm.wsspi"
] | com.ibm.ws; com.ibm.wsspi; | 561,273 |
@Deployment
public void testParentActivationOnNonJoiningEnd() throws Exception {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("parentActivationOnNonJoiningEnd");
List<Execution> executionsBefore = runtimeService.createExecutionQuery().list();
assertEquals(3, executionsBefore.size());
// start first round of tasks
List<Task> firstTasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(2, firstTasks.size());
for (Task t: firstTasks) {
taskService.complete(t.getId());
}
// start first round of tasks
List<Task> secondTasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
assertEquals(2, secondTasks.size());
// complete one task
Task task = secondTasks.get(0);
taskService.complete(task.getId());
// should have merged last child execution into parent
List<Execution> executionsAfter = runtimeService.createExecutionQuery().list();
assertEquals(1, executionsAfter.size());
Execution execution = executionsAfter.get(0);
// and should have one active activity
List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId());
assertEquals(1, activeActivityIds.size());
// Completing last task should finish the process instance
Task lastTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
taskService.complete(lastTask.getId());
assertEquals(0l, runtimeService.createProcessInstanceQuery().active().count());
} | void function() throws Exception { ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(STR); List<Execution> executionsBefore = runtimeService.createExecutionQuery().list(); assertEquals(3, executionsBefore.size()); List<Task> firstTasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); assertEquals(2, firstTasks.size()); for (Task t: firstTasks) { taskService.complete(t.getId()); } List<Task> secondTasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list(); assertEquals(2, secondTasks.size()); Task task = secondTasks.get(0); taskService.complete(task.getId()); List<Execution> executionsAfter = runtimeService.createExecutionQuery().list(); assertEquals(1, executionsAfter.size()); Execution execution = executionsAfter.get(0); List<String> activeActivityIds = runtimeService.getActiveActivityIds(execution.getId()); assertEquals(1, activeActivityIds.size()); Task lastTask = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); taskService.complete(lastTask.getId()); assertEquals(0l, runtimeService.createProcessInstanceQuery().active().count()); } | /**
* Test for ACT-1216: When merging a concurrent execution the parent is not activated correctly
*/ | Test for ACT-1216: When merging a concurrent execution the parent is not activated correctly | testParentActivationOnNonJoiningEnd | {
"repo_name": "tkaefer/camunda-bpm-platform",
"path": "engine/src/test/java/org/camunda/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java",
"license": "apache-2.0",
"size": 18725
} | [
"java.util.List",
"org.camunda.bpm.engine.runtime.Execution",
"org.camunda.bpm.engine.runtime.ProcessInstance",
"org.camunda.bpm.engine.task.Task"
] | import java.util.List; import org.camunda.bpm.engine.runtime.Execution; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.task.Task; | import java.util.*; import org.camunda.bpm.engine.runtime.*; import org.camunda.bpm.engine.task.*; | [
"java.util",
"org.camunda.bpm"
] | java.util; org.camunda.bpm; | 517,578 |
@Test
public void testSetSeriesToolTipGenerator() {
CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
CategoryItemRenderer renderer = plot.getRenderer();
StandardCategoryToolTipGenerator tt
= new StandardCategoryToolTipGenerator();
renderer.setSeriesToolTipGenerator(0, tt);
CategoryToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0);
assertSame(tt2, tt);
}
| void function() { CategoryPlot plot = (CategoryPlot) this.chart.getPlot(); CategoryItemRenderer renderer = plot.getRenderer(); StandardCategoryToolTipGenerator tt = new StandardCategoryToolTipGenerator(); renderer.setSeriesToolTipGenerator(0, tt); CategoryToolTipGenerator tt2 = renderer.getToolTipGenerator(0, 0); assertSame(tt2, tt); } | /**
* Check that setting a tool tip generator for a series does override the
* default generator.
*/ | Check that setting a tool tip generator for a series does override the default generator | testSetSeriesToolTipGenerator | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/test/java/org/jfree/chart/StackedAreaChartTest.java",
"license": "lgpl-2.1",
"size": 6477
} | [
"org.jfree.chart.labels.CategoryToolTipGenerator",
"org.jfree.chart.labels.StandardCategoryToolTipGenerator",
"org.jfree.chart.plot.CategoryPlot",
"org.jfree.chart.renderer.category.CategoryItemRenderer",
"org.junit.Assert"
] | import org.jfree.chart.labels.CategoryToolTipGenerator; import org.jfree.chart.labels.StandardCategoryToolTipGenerator; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.renderer.category.CategoryItemRenderer; import org.junit.Assert; | import org.jfree.chart.labels.*; import org.jfree.chart.plot.*; import org.jfree.chart.renderer.category.*; import org.junit.*; | [
"org.jfree.chart",
"org.junit"
] | org.jfree.chart; org.junit; | 728,326 |
protected String serializeSaveThreadMain(BdsSerializer serializer) {
StringBuilder out = new StringBuilder();
out.append(getClass().getSimpleName());
out.append("\t" + bdsThreadNum);
out.append("\t" + serializer.serializeSaveValue(removeOnExit));
out.append("\t" + serializer.serializeSaveValue(getBdsThreadId()));
out.append("\t" + serializer.serializeSaveValue(statement.getNodeId()));
out.append("\t" + serializer.serializeSaveValue(scope.getNodeId()));
out.append("\t" + serializer.serializeSaveValue(parent != null ? parent.getBdsThreadId() : ""));
out.append("\t" + serializer.serializeSaveValue(runState.toString()));
out.append("\t" + serializer.serializeSaveValue(currentDir));
out.append("\t" + serializer.base64encode(stack));
return out.toString();
} | String function(BdsSerializer serializer) { StringBuilder out = new StringBuilder(); out.append(getClass().getSimpleName()); out.append("\t" + bdsThreadNum); out.append("\t" + serializer.serializeSaveValue(removeOnExit)); out.append("\t" + serializer.serializeSaveValue(getBdsThreadId())); out.append("\t" + serializer.serializeSaveValue(statement.getNodeId())); out.append("\t" + serializer.serializeSaveValue(scope.getNodeId())); out.append("\t" + serializer.serializeSaveValue(parent != null ? parent.getBdsThreadId() : STR\tSTR\tSTR\t" + serializer.base64encode(stack)); return out.toString(); } | /**
* Save thread's main information
*/ | Save thread's main information | serializeSaveThreadMain | {
"repo_name": "leepc12/BigDataScript",
"path": "src/org/bds/run/BdsThread.java",
"license": "apache-2.0",
"size": 38184
} | [
"org.bds.serialize.BdsSerializer"
] | import org.bds.serialize.BdsSerializer; | import org.bds.serialize.*; | [
"org.bds.serialize"
] | org.bds.serialize; | 2,907,874 |
Scope enterScope();
Expression getVariable(String name); | Scope enterScope(); Expression getVariable(String name); | /**
* Looks up a user defined variable with the given name. The variable must have been created in a
* currently active scope.
*/ | Looks up a user defined variable with the given name. The variable must have been created in a currently active scope | getVariable | {
"repo_name": "google/closure-templates",
"path": "java/src/com/google/template/soy/jbcsrc/LocalVariableManager.java",
"license": "apache-2.0",
"size": 2523
} | [
"com.google.template.soy.jbcsrc.restricted.Expression"
] | import com.google.template.soy.jbcsrc.restricted.Expression; | import com.google.template.soy.jbcsrc.restricted.*; | [
"com.google.template"
] | com.google.template; | 1,347,657 |
private boolean moveToNextResultsIfPresent(StatementScope scope, Statement stmt) throws SQLException {
boolean moreResults;
// This is the messed up JDBC approach for determining if there are more results
boolean movedToNextResultsSafely = moveToNextResultsSafely(scope, stmt);
int updateCount = stmt.getUpdateCount();
moreResults = !(!movedToNextResultsSafely && (updateCount == -1));
// ibatis-384: workaround for mysql not returning -1 for stmt.getUpdateCount()
if (moreResults == true) {
moreResults = !(!movedToNextResultsSafely && !isMultipleResultSetSupportPresent(scope, stmt));
}
return moreResults;
} | boolean function(StatementScope scope, Statement stmt) throws SQLException { boolean moreResults; boolean movedToNextResultsSafely = moveToNextResultsSafely(scope, stmt); int updateCount = stmt.getUpdateCount(); moreResults = !(!movedToNextResultsSafely && (updateCount == -1)); if (moreResults == true) { moreResults = !(!movedToNextResultsSafely && !isMultipleResultSetSupportPresent(scope, stmt)); } return moreResults; } | /**
* Move to next results if present.
*
* @param scope
* the scope
* @param stmt
* the stmt
* @return true, if successful
* @throws SQLException
* the SQL exception
*/ | Move to next results if present | moveToNextResultsIfPresent | {
"repo_name": "hazendaz/mybatis-2",
"path": "src/main/java/com/ibatis/sqlmap/engine/execution/DefaultSqlExecutor.java",
"license": "apache-2.0",
"size": 32810
} | [
"com.ibatis.sqlmap.engine.scope.StatementScope",
"java.sql.SQLException",
"java.sql.Statement"
] | import com.ibatis.sqlmap.engine.scope.StatementScope; import java.sql.SQLException; import java.sql.Statement; | import com.ibatis.sqlmap.engine.scope.*; import java.sql.*; | [
"com.ibatis.sqlmap",
"java.sql"
] | com.ibatis.sqlmap; java.sql; | 2,057,721 |
public void testGetUrlForRepoWithTrailingSlash() throws IOException {
assertEquals(String.valueOf(new GitList(GITLIST_URL + "/").getUrl()), GITLIST_URL + "/");
} | void function() throws IOException { assertEquals(String.valueOf(new GitList(GITLIST_URL + "/").getUrl()), GITLIST_URL + "/"); } | /**
* Test method for {@link hudson.plugins.git.browser.GitList#getUrl()}.
* @throws MalformedURLException
*/ | Test method for <code>hudson.plugins.git.browser.GitList#getUrl()</code> | testGetUrlForRepoWithTrailingSlash | {
"repo_name": "ialbors/git-plugin",
"path": "src/test/java/hudson/plugins/git/browser/GitListTest.java",
"license": "mit",
"size": 5094
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,728,420 |
public List<YParameter> getRequiredParams() { return null; } | public List<YParameter> getRequiredParams() { return null; } | /**
* This method is called when the work item running this codelet is cancelled.
* Override to cancel the codelet as required.
*/ | This method is called when the work item running this codelet is cancelled. Override to cancel the codelet as required | cancel | {
"repo_name": "yawlfoundation/yawl",
"path": "src/org/yawlfoundation/yawl/resourcing/codelets/AbstractCodelet.java",
"license": "lgpl-3.0",
"size": 11170
} | [
"java.util.List",
"org.yawlfoundation.yawl.elements.data.YParameter"
] | import java.util.List; import org.yawlfoundation.yawl.elements.data.YParameter; | import java.util.*; import org.yawlfoundation.yawl.elements.data.*; | [
"java.util",
"org.yawlfoundation.yawl"
] | java.util; org.yawlfoundation.yawl; | 988,229 |
public Collection<Scenario> getApplicableScenarios(Model model, IContext context, boolean isPublic) throws ThinklabException {
ArrayList<Scenario> ret = new ArrayList<Scenario>();
for (Scenario s : scenariosById.values()) {
if (isPublic && !s.isPublic())
continue;
if (context != null && s.getContext() != null) {
if (!s.getContext().intersects(context)) {
continue;
}
}
Set<IConcept> intersec = new HashSet<IConcept>(model.getObservables());
intersec.retainAll(s.getObservables());
if (!intersec.isEmpty()) {
ret.add(s);
}
}
return ret;
}
| Collection<Scenario> function(Model model, IContext context, boolean isPublic) throws ThinklabException { ArrayList<Scenario> ret = new ArrayList<Scenario>(); for (Scenario s : scenariosById.values()) { if (isPublic && !s.isPublic()) continue; if (context != null && s.getContext() != null) { if (!s.getContext().intersects(context)) { continue; } } Set<IConcept> intersec = new HashSet<IConcept>(model.getObservables()); intersec.retainAll(s.getObservables()); if (!intersec.isEmpty()) { ret.add(s); } } return ret; } | /**
* Get all scenarios that apply to the passed model.
*
* @param model
* @return
* @throws ThinklabException
*/ | Get all scenarios that apply to the passed model | getApplicableScenarios | {
"repo_name": "ariesteam/thinklab",
"path": "plugins/org.integratedmodelling.thinklab.modelling/src/org/integratedmodelling/modelling/model/ModelFactory.java",
"license": "gpl-3.0",
"size": 24363
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.HashSet",
"java.util.Set",
"org.integratedmodelling.corescience.interfaces.IContext",
"org.integratedmodelling.thinklab.exception.ThinklabException",
"org.integratedmodelling.thinklab.interfaces.knowledge.IConcept"
] | import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Set; import org.integratedmodelling.corescience.interfaces.IContext; import org.integratedmodelling.thinklab.exception.ThinklabException; import org.integratedmodelling.thinklab.interfaces.knowledge.IConcept; | import java.util.*; import org.integratedmodelling.corescience.interfaces.*; import org.integratedmodelling.thinklab.exception.*; import org.integratedmodelling.thinklab.interfaces.knowledge.*; | [
"java.util",
"org.integratedmodelling.corescience",
"org.integratedmodelling.thinklab"
] | java.util; org.integratedmodelling.corescience; org.integratedmodelling.thinklab; | 447,923 |
public static long freePhysicalMemory() {
return readLongAttribute("FreePhysicalMemorySize", -1L);
} | static long function() { return readLongAttribute(STR, -1L); } | /**
* Returns the amount of physical memory that is available on the system in bytes or -1 if not available.
*
* @return free physical memory in bytes or -1 if not available
*/ | Returns the amount of physical memory that is available on the system in bytes or -1 if not available | freePhysicalMemory | {
"repo_name": "mdogan/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/internal/memory/MemoryStatsSupport.java",
"license": "apache-2.0",
"size": 2307
} | [
"com.hazelcast.internal.util.OperatingSystemMXBeanSupport"
] | import com.hazelcast.internal.util.OperatingSystemMXBeanSupport; | import com.hazelcast.internal.util.*; | [
"com.hazelcast.internal"
] | com.hazelcast.internal; | 229,118 |
private String token(final String code) throws IOException {
return new JdkRequest(
new Href(this.gauth).path("o").path("oauth2").path("token")
.toString()
).body()
.formParam("client_id", this.app)
.formParam("redirect_uri", this.redir)
.formParam("client_secret", this.key)
.formParam("grant_type", "authorization_code")
.formParam(PsGoogle.CODE, code)
.back()
.header("Content-Type", "application/x-www-form-urlencoded")
.method(com.jcabi.http.Request.POST)
.fetch().as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_OK)
.as(JsonResponse.class).json()
.readObject()
.getString(PsGoogle.ACCESS_TOKEN);
} | String function(final String code) throws IOException { return new JdkRequest( new Href(this.gauth).path("o").path(STR).path("token") .toString() ).body() .formParam(STR, this.app) .formParam(STR, this.redir) .formParam(STR, this.key) .formParam(STR, STR) .formParam(PsGoogle.CODE, code) .back() .header(STR, STR) .method(com.jcabi.http.Request.POST) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(JsonResponse.class).json() .readObject() .getString(PsGoogle.ACCESS_TOKEN); } | /**
* Retrieve Google access token.
* @param code Google "authorization code"
* @return The token
* @throws IOException If failed
*/ | Retrieve Google access token | token | {
"repo_name": "dalifreire/takes",
"path": "src/main/java/org/takes/facets/auth/social/PsGoogle.java",
"license": "mit",
"size": 7552
} | [
"com.jcabi.http.request.JdkRequest",
"com.jcabi.http.response.JsonResponse",
"com.jcabi.http.response.RestResponse",
"java.io.IOException",
"java.net.HttpURLConnection",
"org.takes.Request",
"org.takes.misc.Href"
] | import com.jcabi.http.request.JdkRequest; import com.jcabi.http.response.JsonResponse; import com.jcabi.http.response.RestResponse; import java.io.IOException; import java.net.HttpURLConnection; import org.takes.Request; import org.takes.misc.Href; | import com.jcabi.http.request.*; import com.jcabi.http.response.*; import java.io.*; import java.net.*; import org.takes.*; import org.takes.misc.*; | [
"com.jcabi.http",
"java.io",
"java.net",
"org.takes",
"org.takes.misc"
] | com.jcabi.http; java.io; java.net; org.takes; org.takes.misc; | 752,651 |
@Test
public void testGetMaximumParameters() {
final RemoveDetailAction action = new RemoveDetailAction();
assertThat(action.getMaximumParameters(), is(0));
} | void function() { final RemoveDetailAction action = new RemoveDetailAction(); assertThat(action.getMaximumParameters(), is(0)); } | /**
* Tests for getMaximumParameters().
*/ | Tests for getMaximumParameters() | testGetMaximumParameters | {
"repo_name": "arianne/stendhal",
"path": "tests/games/stendhal/client/actions/RemoveDetailActionTest.java",
"license": "gpl-2.0",
"size": 2361
} | [
"org.hamcrest.CoreMatchers",
"org.junit.Assert"
] | import org.hamcrest.CoreMatchers; import org.junit.Assert; | import org.hamcrest.*; import org.junit.*; | [
"org.hamcrest",
"org.junit"
] | org.hamcrest; org.junit; | 918,100 |
private SortedSet<ClassInfo> computeListOfAllNonAbstractSubtypes(ClassInfo ci) {
SortedSet<ClassInfo> allNonAbstractSubtypes = new TreeSet<ClassInfo>();
if (ci.subtypes() != null) {
for (String subtypeId : ci.subtypes()) {
ClassInfo subtype = model.classById(subtypeId);
if (subtype == null) {
result.addWarning(this, 219, subtypeId, ci.name());
continue;
}
if (isExplicitlyModeledArcGISSubtype(subtype)) {
// ignore explicitly modelled ArcGIS subtype
}
if (model.isInSelectedSchemas(subtype)) {
if (subtype.isAbstract()) {
// ignore abstract subtypes
} else {
allNonAbstractSubtypes.add(subtype);
}
allNonAbstractSubtypes.addAll(computeListOfAllNonAbstractSubtypes(subtype));
} else {
result.addWarning(this, 220, subtype.name(), ci.name());
}
}
}
return allNonAbstractSubtypes;
}
| SortedSet<ClassInfo> function(ClassInfo ci) { SortedSet<ClassInfo> allNonAbstractSubtypes = new TreeSet<ClassInfo>(); if (ci.subtypes() != null) { for (String subtypeId : ci.subtypes()) { ClassInfo subtype = model.classById(subtypeId); if (subtype == null) { result.addWarning(this, 219, subtypeId, ci.name()); continue; } if (isExplicitlyModeledArcGISSubtype(subtype)) { } if (model.isInSelectedSchemas(subtype)) { if (subtype.isAbstract()) { } else { allNonAbstractSubtypes.add(subtype); } allNonAbstractSubtypes.addAll(computeListOfAllNonAbstractSubtypes(subtype)); } else { result.addWarning(this, 220, subtype.name(), ci.name()); } } } return allNonAbstractSubtypes; } | /**
* Computes the list of the (direct and indirect) non abstract subtypes of the
* given class. NOTE: Ignores explicitly modelled subtypes if
* {@value ArcGISWorkspaceConstants#RULE_ALL_SUBTYPES} is enabled.
*
* @param ci
* @return
*/ | Computes the list of the (direct and indirect) non abstract subtypes of the ArcGISWorkspaceConstants#RULE_ALL_SUBTYPES is enabled | computeListOfAllNonAbstractSubtypes | {
"repo_name": "ShapeChange/ShapeChange",
"path": "src/main/java/de/interactive_instruments/ShapeChange/Target/ArcGISWorkspace/ArcGISWorkspace.java",
"license": "gpl-3.0",
"size": 170900
} | [
"de.interactive_instruments.ShapeChange",
"java.util.SortedSet",
"java.util.TreeSet"
] | import de.interactive_instruments.ShapeChange; import java.util.SortedSet; import java.util.TreeSet; | import de.interactive_instruments.*; import java.util.*; | [
"de.interactive_instruments",
"java.util"
] | de.interactive_instruments; java.util; | 933,509 |
public static boolean setLowestPriority(String packageName) {
try {
return OM.get().setLowestPriority(packageName, CURRENT_USER);
} catch (RemoteException re) {
Log.e(SUBSTRATUM_LOG,
"Unable to set lowest priority for \"" + packageName + "\".");
}
return false;
} | static boolean function(String packageName) { try { return OM.get().setLowestPriority(packageName, CURRENT_USER); } catch (RemoteException re) { Log.e(SUBSTRATUM_LOG, STRSTR\"."); } return false; } | /**
* Change the priority of the overlay to the lowest priority relative to
* the other overlays for the same target and user.
*
* @param packageName The name of the overlay package whose priority should
* be adjusted.
*/ | Change the priority of the overlay to the lowest priority relative to the other overlays for the same target and user | setLowestPriority | {
"repo_name": "divergeTeam/diverge",
"path": "app/src/main/java/projekt/substratum/common/platform/OverlayManagerService.java",
"license": "gpl-3.0",
"size": 8520
} | [
"android.content.om.OM",
"android.os.RemoteException",
"android.util.Log"
] | import android.content.om.OM; import android.os.RemoteException; import android.util.Log; | import android.content.om.*; import android.os.*; import android.util.*; | [
"android.content",
"android.os",
"android.util"
] | android.content; android.os; android.util; | 1,594,994 |
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response)
throws Exception {
this.servletInstance.service(request, response);
return null;
} | ModelAndView function(HttpServletRequest request, HttpServletResponse response) throws Exception { this.servletInstance.service(request, response); return null; } | /**
* Invoke the the wrapped Servlet instance.
* @see javax.servlet.Servlet#service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
*/ | Invoke the the wrapped Servlet instance | handleRequestInternal | {
"repo_name": "QBNemo/spring-mvc-showcase",
"path": "src/main/java/org/springframework/web/servlet/mvc/ServletWrappingController.java",
"license": "apache-2.0",
"size": 6549
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.springframework.web.servlet.ModelAndView"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; | import javax.servlet.http.*; import org.springframework.web.servlet.*; | [
"javax.servlet",
"org.springframework.web"
] | javax.servlet; org.springframework.web; | 799,479 |
public XmpConfigFactory(String configFile)
throws MarshalException, ValidationException, IOException
{
InputStream cfgIn = new FileInputStream(configFile);
config = (XmpConfig)Unmarshaller.unmarshal(XmpConfig.class,
new InputStreamReader(cfgIn, "UTF-8"));
cfgIn.close();
return;
}
public XmpConfigFactory(Reader rdr)
throws MarshalException, ValidationException, IOException
{
config = (XmpConfig)Unmarshaller.unmarshal(XmpConfig.class,rdr);
}
| public XmpConfigFactory(String configFile) throws MarshalException, ValidationException, IOException { InputStream cfgIn = new FileInputStream(configFile); config = (XmpConfig)Unmarshaller.unmarshal(XmpConfig.class, new InputStreamReader(cfgIn, "UTF-8")); cfgIn.close(); return; } public XmpConfigFactory(Reader rdr) throws MarshalException, ValidationException, IOException { config = (XmpConfig)Unmarshaller.unmarshal(XmpConfig.class,rdr); } | /**
* <p>Getter for the field <code>instance</code>.</p>
*
* @return a {@link org.opennms.netmgt.protocols.xmp.config.XmpConfigFactory} object.
*/ | Getter for the field <code>instance</code> | getInstance | {
"repo_name": "tharindum/opennms_dashboard",
"path": "protocols/xmp/src/main/java/org/opennms/netmgt/protocols/xmp/config/XmpConfigFactory.java",
"license": "gpl-2.0",
"size": 5286
} | [
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.io.Reader",
"org.exolab.castor.xml.MarshalException",
"org.exolab.castor.xml.Unmarshaller",
"org.exolab.castor.xml.ValidationException",
"org.opennms.netmgt.config.xmpConfig.XmpConfig"
] | import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Unmarshaller; import org.exolab.castor.xml.ValidationException; import org.opennms.netmgt.config.xmpConfig.XmpConfig; | import java.io.*; import org.exolab.castor.xml.*; import org.opennms.netmgt.config.*; | [
"java.io",
"org.exolab.castor",
"org.opennms.netmgt"
] | java.io; org.exolab.castor; org.opennms.netmgt; | 2,359,969 |
public static int insert (Connect connect,String short_name, String name) {
if(null == short_name || short_name.length() == 0) return 0;
int result_id = 0;
StringBuilder str_sql = new StringBuilder();
try
{
try (Statement s = connect.conn.createStatement ()) {
str_sql.append("INSERT INTO label (short_name, name) VALUES (\"");
String safe_title = PageTableBase.convertToSafeStringEncodeToDBWunderscore(connect, short_name);
str_sql.append(safe_title);
str_sql.append("\",\"");
safe_title = PageTableBase.convertToSafeStringEncodeToDBWunderscore(connect, name);
str_sql.append(safe_title);
str_sql.append("\")");
s.executeUpdate (str_sql.toString(), Statement.RETURN_GENERATED_KEYS);
ResultSet rs = s.getGeneratedKeys();
if (rs.next()){
result_id = rs.getInt(1);
}
}
}catch(SQLException ex) {
System.out.println("SQLException (wikt_parsed TLabel.insert(without category_id)):: sql='" + str_sql.toString() + "' " + ex.getMessage());
}
return result_id;
}
| static int function (Connect connect,String short_name, String name) { if(null == short_name short_name.length() == 0) return 0; int result_id = 0; StringBuilder str_sql = new StringBuilder(); try { try (Statement s = connect.conn.createStatement ()) { str_sql.append(STRSTR\",\"STR\")"); s.executeUpdate (str_sql.toString(), Statement.RETURN_GENERATED_KEYS); ResultSet rs = s.getGeneratedKeys(); if (rs.next()){ result_id = rs.getInt(1); } } }catch(SQLException ex) { System.out.println(STR + str_sql.toString() + STR + ex.getMessage()); } return result_id; } | /** Inserts record into the table 'label', gets last inserted ID.<br><br>
* INSERT INTO label (short_name, name) VALUES ("short name", "name");
* @param short_name label itself
* @param name full name of label
*
* @return last inserted ID, 0 means error
*/ | Inserts record into the table 'label', gets last inserted ID. INSERT INTO label (short_name, name) VALUES ("short name", "name") | insert | {
"repo_name": "componavt/wikokit",
"path": "common_wiki_jdbc/src/wikokit/base/wikt/sql/label/TLabel.java",
"license": "apache-2.0",
"size": 22952
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,382,062 |
JCExpression typeArgumentsOpt(JCExpression t) {
if (S.token() == LT &&
(mode & TYPE) != 0 &&
(mode & NOPARAMS) == 0) {
mode = TYPE;
checkGenerics();
return typeArguments(t, false);
} else {
return t;
}
} | JCExpression typeArgumentsOpt(JCExpression t) { if (S.token() == LT && (mode & TYPE) != 0 && (mode & NOPARAMS) == 0) { mode = TYPE; checkGenerics(); return typeArguments(t, false); } else { return t; } } | /** TypeArgumentsOpt = [ TypeArguments ]
*/ | TypeArgumentsOpt = [ TypeArguments ] | typeArgumentsOpt | {
"repo_name": "sebastianoe/s4j",
"path": "src/share/classes/com/sun/tools/javac/parser/JavacParser.java",
"license": "gpl-2.0",
"size": 116611
} | [
"com.sun.tools.javac.tree.JCTree"
] | import com.sun.tools.javac.tree.JCTree; | import com.sun.tools.javac.tree.*; | [
"com.sun.tools"
] | com.sun.tools; | 1,891,989 |
File inputFiles[] = new File("src/test/resources").listFiles();
Assert.assertNotNull(inputFiles);
Assert.assertNotEquals(0, inputFiles.length);
int filesTested = 0;
for (File inputFile : inputFiles) {
MassSpectrumType trueType;
if (inputFile.getName().startsWith("centroided"))
trueType = MassSpectrumType.CENTROIDED;
else if (inputFile.getName().startsWith("thresholded"))
trueType = MassSpectrumType.THRESHOLDED;
else if (inputFile.getName().startsWith("profile"))
trueType = MassSpectrumType.PROFILE;
else
continue;
logger.info("Checking autodetection of centroided/thresholded/profile scans on file "
+ inputFile.getName());
MZmineProject project = new MZmineProjectImpl();
Task newTask = null;
String extension = inputFile.getName()
.substring(inputFile.getName().lastIndexOf(".") + 1)
.toLowerCase();
RawDataFileImpl file = new RawDataFileImpl(inputFile.getName());
if (extension.endsWith("mzdata")) {
newTask = new MzDataReadTask(project, inputFile, file);
}
if (extension.endsWith("mzxml")) {
newTask = new MzXMLReadTask(project, inputFile, file);
}
if (extension.endsWith("mzml")) {
newTask = new MzMLReadTask(project, inputFile, file);
}
Assert.assertNotNull(newTask);
newTask.run();
Assert.assertEquals(TaskStatus.FINISHED, newTask.getStatus());
Assert.assertEquals(1, project.getDataFiles().length);
int scanNumbers[] = file.getScanNumbers(1);
for (int scanNumber : scanNumbers) {
Scan scan = file.getScan(scanNumber);
DataPoint dataPoints[] = scan.getDataPoints();
MassSpectrumType detectedType = ScanUtils
.detectSpectrumType(dataPoints);
Assert.assertEquals("Scan type wrongly detected for scan "
+ scanNumber + " in " + file.getName(), trueType,
detectedType);
}
filesTested++;
}
// make sure we tested 10+ files
Assert.assertTrue(filesTested > 10);
} | File inputFiles[] = new File(STR).listFiles(); Assert.assertNotNull(inputFiles); Assert.assertNotEquals(0, inputFiles.length); int filesTested = 0; for (File inputFile : inputFiles) { MassSpectrumType trueType; if (inputFile.getName().startsWith(STR)) trueType = MassSpectrumType.CENTROIDED; else if (inputFile.getName().startsWith(STR)) trueType = MassSpectrumType.THRESHOLDED; else if (inputFile.getName().startsWith(STR)) trueType = MassSpectrumType.PROFILE; else continue; logger.info(STR + inputFile.getName()); MZmineProject project = new MZmineProjectImpl(); Task newTask = null; String extension = inputFile.getName() .substring(inputFile.getName().lastIndexOf(".") + 1) .toLowerCase(); RawDataFileImpl file = new RawDataFileImpl(inputFile.getName()); if (extension.endsWith(STR)) { newTask = new MzDataReadTask(project, inputFile, file); } if (extension.endsWith("mzxml")) { newTask = new MzXMLReadTask(project, inputFile, file); } if (extension.endsWith("mzml")) { newTask = new MzMLReadTask(project, inputFile, file); } Assert.assertNotNull(newTask); newTask.run(); Assert.assertEquals(TaskStatus.FINISHED, newTask.getStatus()); Assert.assertEquals(1, project.getDataFiles().length); int scanNumbers[] = file.getScanNumbers(1); for (int scanNumber : scanNumbers) { Scan scan = file.getScan(scanNumber); DataPoint dataPoints[] = scan.getDataPoints(); MassSpectrumType detectedType = ScanUtils .detectSpectrumType(dataPoints); Assert.assertEquals(STR + scanNumber + STR + file.getName(), trueType, detectedType); } filesTested++; } Assert.assertTrue(filesTested > 10); } | /**
* Test the detectSpectrumType() method
*/ | Test the detectSpectrumType() method | testDetectSpectrumType | {
"repo_name": "tomas-pluskal/mzmine2",
"path": "src/test/java/net/sf/mzmine/util/ScanUtilsTest.java",
"license": "gpl-2.0",
"size": 3760
} | [
"java.io.File",
"net.sf.mzmine.datamodel.DataPoint",
"net.sf.mzmine.datamodel.MZmineProject",
"net.sf.mzmine.datamodel.MassSpectrumType",
"net.sf.mzmine.datamodel.Scan",
"net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.MzDataReadTask",
"net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.MzMLReadTask",
"net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.MzXMLReadTask",
"net.sf.mzmine.project.impl.MZmineProjectImpl",
"net.sf.mzmine.project.impl.RawDataFileImpl",
"net.sf.mzmine.taskcontrol.Task",
"net.sf.mzmine.taskcontrol.TaskStatus",
"org.junit.Assert"
] | import java.io.File; import net.sf.mzmine.datamodel.DataPoint; import net.sf.mzmine.datamodel.MZmineProject; import net.sf.mzmine.datamodel.MassSpectrumType; import net.sf.mzmine.datamodel.Scan; import net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.MzDataReadTask; import net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.MzMLReadTask; import net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.MzXMLReadTask; import net.sf.mzmine.project.impl.MZmineProjectImpl; import net.sf.mzmine.project.impl.RawDataFileImpl; import net.sf.mzmine.taskcontrol.Task; import net.sf.mzmine.taskcontrol.TaskStatus; import org.junit.Assert; | import java.io.*; import net.sf.mzmine.datamodel.*; import net.sf.mzmine.modules.rawdatamethods.rawdataimport.fileformats.*; import net.sf.mzmine.project.impl.*; import net.sf.mzmine.taskcontrol.*; import org.junit.*; | [
"java.io",
"net.sf.mzmine",
"org.junit"
] | java.io; net.sf.mzmine; org.junit; | 2,005,238 |
private HostRoleStatus updateAuditlogCache(HostRoleCommandEntity commandEntity, Long requestId) {
RequestDetails details = auditlogRequestCache.getIfPresent(requestId);
if(details == null) {
return null;
}
RequestDetails.Component component = new RequestDetails.Component(commandEntity.getRole(), commandEntity.getHostName());
HostRoleStatus lastTaskStatus = null;
if(details.getTasks().containsKey(component)) {
lastTaskStatus = details.getTasks().get(component);
}
details.getTasks().put(component, commandEntity.getStatus());
return lastTaskStatus;
} | HostRoleStatus function(HostRoleCommandEntity commandEntity, Long requestId) { RequestDetails details = auditlogRequestCache.getIfPresent(requestId); if(details == null) { return null; } RequestDetails.Component component = new RequestDetails.Component(commandEntity.getRole(), commandEntity.getHostName()); HostRoleStatus lastTaskStatus = null; if(details.getTasks().containsKey(component)) { lastTaskStatus = details.getTasks().get(component); } details.getTasks().put(component, commandEntity.getStatus()); return lastTaskStatus; } | /**
* Updates auditlog cache and returns the status of the latest task for the given component on the given host.
* @param commandEntity new entity with the new status. It also holds the component and the hostname
* @param requestId
* @return
*/ | Updates auditlog cache and returns the status of the latest task for the given component on the given host | updateAuditlogCache | {
"repo_name": "sekikn/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java",
"license": "apache-2.0",
"size": 40399
} | [
"org.apache.ambari.server.orm.entities.HostRoleCommandEntity"
] | import org.apache.ambari.server.orm.entities.HostRoleCommandEntity; | import org.apache.ambari.server.orm.entities.*; | [
"org.apache.ambari"
] | org.apache.ambari; | 1,683,243 |
public void openStandAloneFormEditor(final CmsEditorContext context) {
final CmsContentDefinition definition;
try {
definition = (CmsContentDefinition)CmsRpcPrefetcher.getSerializedObjectFromDictionary(
getService(),
I_CmsContentService.DICT_CONTENT_DEFINITION);
} catch (SerializationException e) {
RootPanel.get().add(new Label(e.getMessage()));
return;
}
m_isStandAlone = true;
if (definition.isModelInfo()) {
openModelSelectDialog(context, definition);
} else {
if (CmsCoreProvider.get().lock(CmsContentDefinition.entityIdToUuid(definition.getEntityId()))) {
registerContentDefinition(definition);
// register all external widgets
WidgetRegistry.getInstance().registerExternalWidgets(
definition.getExternalWidgetConfigurations(),
new Command() {
| void function(final CmsEditorContext context) { final CmsContentDefinition definition; try { definition = (CmsContentDefinition)CmsRpcPrefetcher.getSerializedObjectFromDictionary( getService(), I_CmsContentService.DICT_CONTENT_DEFINITION); } catch (SerializationException e) { RootPanel.get().add(new Label(e.getMessage())); return; } m_isStandAlone = true; if (definition.isModelInfo()) { openModelSelectDialog(context, definition); } else { if (CmsCoreProvider.get().lock(CmsContentDefinition.entityIdToUuid(definition.getEntityId()))) { registerContentDefinition(definition); WidgetRegistry.getInstance().registerExternalWidgets( definition.getExternalWidgetConfigurations(), new Command() { | /**
* Opens the form based editor. Used within the stand alone contenteditor.jsp.<p>
*
* @param context the editor context
*/ | Opens the form based editor. Used within the stand alone contenteditor.jsp | openStandAloneFormEditor | {
"repo_name": "mediaworx/opencms-core",
"path": "src-gwt/org/opencms/ade/contenteditor/client/CmsContentEditor.java",
"license": "lgpl-2.1",
"size": 85854
} | [
"com.google.gwt.user.client.Command",
"com.google.gwt.user.client.rpc.SerializationException",
"com.google.gwt.user.client.ui.Label",
"com.google.gwt.user.client.ui.RootPanel",
"org.opencms.ade.contenteditor.shared.CmsContentDefinition",
"org.opencms.ade.contenteditor.widgetregistry.client.WidgetRegistry",
"org.opencms.gwt.client.CmsCoreProvider",
"org.opencms.gwt.client.rpc.CmsRpcPrefetcher"
] | import com.google.gwt.user.client.Command; import com.google.gwt.user.client.rpc.SerializationException; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootPanel; import org.opencms.ade.contenteditor.shared.CmsContentDefinition; import org.opencms.ade.contenteditor.widgetregistry.client.WidgetRegistry; import org.opencms.gwt.client.CmsCoreProvider; import org.opencms.gwt.client.rpc.CmsRpcPrefetcher; | import com.google.gwt.user.client.*; import com.google.gwt.user.client.rpc.*; import com.google.gwt.user.client.ui.*; import org.opencms.ade.contenteditor.shared.*; import org.opencms.ade.contenteditor.widgetregistry.client.*; import org.opencms.gwt.client.*; import org.opencms.gwt.client.rpc.*; | [
"com.google.gwt",
"org.opencms.ade",
"org.opencms.gwt"
] | com.google.gwt; org.opencms.ade; org.opencms.gwt; | 1,493,039 |
Player player = event.getPlayer();
if (event.getNewData().getPlaying() != null && event.getNewData().getPlaying().equals(team)) {
addPlayer(player);
} else {
removePlayer(player);
}
} | Player player = event.getPlayer(); if (event.getNewData().getPlaying() != null && event.getNewData().getPlaying().equals(team)) { addPlayer(player); } else { removePlayer(player); } } | /**
* Adds or removes a player from this channel when they change teams.
*
* @param event The event.
*/ | Adds or removes a player from this channel when they change teams | onPlayerChangeTeam | {
"repo_name": "CardinalDevelopment/Cardinal",
"path": "src/main/java/in/twizmwaz/cardinal/module/channel/channels/TeamChannel.java",
"license": "bsd-2-clause",
"size": 2961
} | [
"org.bukkit.entity.Player"
] | import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 602,195 |
Collection<UserManager.UserAttribute> getSupportedAttributes(); | Collection<UserManager.UserAttribute> getSupportedAttributes(); | /**
* <p>This method is used to provide all the supported user attributes supported by the specific manager implementation.</p>
* @return The collection of supported attributes in the underlying security system.
*/ | This method is used to provide all the supported user attributes supported by the specific manager implementation | getSupportedAttributes | {
"repo_name": "mbiarnes/uberfire",
"path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/UserManagerSettings.java",
"license": "apache-2.0",
"size": 1143
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,144,522 |
@Fold
@SuppressWarnings("all")
static boolean assertionsEnabled(@InjectedParameter GraalHotSpotVMConfig config) {
return Assertions.assertionsEnabled() || cAssertionsEnabled(config);
}
public static final HotSpotForeignCallDescriptor EXCEPTION_HANDLER_FOR_PC = newDescriptor(SAFEPOINT, REEXECUTABLE, any(), ExceptionHandlerStub.class, "exceptionHandlerForPc", Word.class,
Word.class); | @SuppressWarnings("all") static boolean assertionsEnabled(@InjectedParameter GraalHotSpotVMConfig config) { return Assertions.assertionsEnabled() cAssertionsEnabled(config); } public static final HotSpotForeignCallDescriptor EXCEPTION_HANDLER_FOR_PC = newDescriptor(SAFEPOINT, REEXECUTABLE, any(), ExceptionHandlerStub.class, STR, Word.class, Word.class); | /**
* Determines if either Java assertions are enabled for Graal or if this is a HotSpot build
* where the ASSERT mechanism is enabled.
*/ | Determines if either Java assertions are enabled for Graal or if this is a HotSpot build where the ASSERT mechanism is enabled | assertionsEnabled | {
"repo_name": "smarr/Truffle",
"path": "compiler/src/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/ExceptionHandlerStub.java",
"license": "gpl-2.0",
"size": 7945
} | [
"org.graalvm.compiler.api.replacements.Fold",
"org.graalvm.compiler.debug.Assertions",
"org.graalvm.compiler.hotspot.GraalHotSpotVMConfig",
"org.graalvm.compiler.hotspot.meta.HotSpotForeignCallDescriptor",
"org.graalvm.compiler.hotspot.stubs.StubUtil",
"org.graalvm.compiler.word.Word",
"org.graalvm.word.LocationIdentity"
] | import org.graalvm.compiler.api.replacements.Fold; import org.graalvm.compiler.debug.Assertions; import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig; import org.graalvm.compiler.hotspot.meta.HotSpotForeignCallDescriptor; import org.graalvm.compiler.hotspot.stubs.StubUtil; import org.graalvm.compiler.word.Word; import org.graalvm.word.LocationIdentity; | import org.graalvm.compiler.api.replacements.*; import org.graalvm.compiler.debug.*; import org.graalvm.compiler.hotspot.*; import org.graalvm.compiler.hotspot.meta.*; import org.graalvm.compiler.hotspot.stubs.*; import org.graalvm.compiler.word.*; import org.graalvm.word.*; | [
"org.graalvm.compiler",
"org.graalvm.word"
] | org.graalvm.compiler; org.graalvm.word; | 518,194 |
public static void clearField(FhirContext theFhirContext, String theFieldName, IBaseResource theResource) {
BaseRuntimeChildDefinition childDefinition = getBaseRuntimeChildDefinition(theFhirContext, theFieldName, theResource);
clear(childDefinition.getAccessor().getValues(theResource));
} | static void function(FhirContext theFhirContext, String theFieldName, IBaseResource theResource) { BaseRuntimeChildDefinition childDefinition = getBaseRuntimeChildDefinition(theFhirContext, theFieldName, theResource); clear(childDefinition.getAccessor().getValues(theResource)); } | /**
* Clears the specified field on the resource provided
*
* @param theFhirContext Context holding resource definition
* @param theFieldName
* @param theResource
*/ | Clears the specified field on the resource provided | clearField | {
"repo_name": "jamesagnew/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TerserUtil.java",
"license": "apache-2.0",
"size": 28898
} | [
"ca.uhn.fhir.context.BaseRuntimeChildDefinition",
"ca.uhn.fhir.context.FhirContext",
"org.hl7.fhir.instance.model.api.IBaseResource"
] | import ca.uhn.fhir.context.BaseRuntimeChildDefinition; import ca.uhn.fhir.context.FhirContext; import org.hl7.fhir.instance.model.api.IBaseResource; | import ca.uhn.fhir.context.*; import org.hl7.fhir.instance.model.api.*; | [
"ca.uhn.fhir",
"org.hl7.fhir"
] | ca.uhn.fhir; org.hl7.fhir; | 1,374,865 |
public static boolean compareQNameLists(List<QName> list1, List<QName> list2) {
if (list1 == list2)
return true;
if (list1 == null || list2 == null)
return false;
if (list1.size() != list2.size())
return false;
for (int i = 0; i < list1.size(); i++) {
if (!compareQNames(list1.get(i), list2.get(i)))
return false;
}
return true;
} | static boolean function(List<QName> list1, List<QName> list2) { if (list1 == list2) return true; if (list1 == null list2 == null) return false; if (list1.size() != list2.size()) return false; for (int i = 0; i < list1.size(); i++) { if (!compareQNames(list1.get(i), list2.get(i))) return false; } return true; } | /**
* Compares two lists of QNames for equality.
*
* @param list1
* @param list2
* @return true iff each list contains the same QName values in the same order
*/ | Compares two lists of QNames for equality | compareQNameLists | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jaxws.common/src/com/ibm/ws/jaxws/metadata/Utils.java",
"license": "epl-1.0",
"size": 3821
} | [
"java.util.List",
"javax.xml.namespace.QName"
] | import java.util.List; import javax.xml.namespace.QName; | import java.util.*; import javax.xml.namespace.*; | [
"java.util",
"javax.xml"
] | java.util; javax.xml; | 1,138,310 |
public BiomeGenBase getBiome(EarthChunkProvider gen, World world, Coordinate coord); | BiomeGenBase function(EarthChunkProvider gen, World world, Coordinate coord); | /**
* Get the biome at a particular location
* @param gen The generator for this world
* @param world World to get biomes for
* @param coord Location to get biomes
* @return The Biome type
*/ | Get the biome at a particular location | getBiome | {
"repo_name": "sbliven/earthcraft",
"path": "src/main/java/us/bliven/bukkit/earthcraft/biome/CoordBiomeProvider.java",
"license": "gpl-3.0",
"size": 569
} | [
"com.vividsolutions.jts.geom.Coordinate",
"net.minecraft.world.World",
"net.minecraft.world.biome.BiomeGenBase",
"us.bliven.bukkit.earthcraft.worldgen.EarthChunkProvider"
] | import com.vividsolutions.jts.geom.Coordinate; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import us.bliven.bukkit.earthcraft.worldgen.EarthChunkProvider; | import com.vividsolutions.jts.geom.*; import net.minecraft.world.*; import net.minecraft.world.biome.*; import us.bliven.bukkit.earthcraft.worldgen.*; | [
"com.vividsolutions.jts",
"net.minecraft.world",
"us.bliven.bukkit"
] | com.vividsolutions.jts; net.minecraft.world; us.bliven.bukkit; | 1,259,627 |
UserProfilePhotos getProfilePhotos(TelegramBot telegramBot); | UserProfilePhotos getProfilePhotos(TelegramBot telegramBot); | /**
* Gets the profile photos for the User
*
* @param telegramBot The TelegramBot instance that should retrieve the profile photos
*
* @return The UserProfilePhotos for the User
*/ | Gets the profile photos for the User | getProfilePhotos | {
"repo_name": "zackpollard/JavaTelegramBot-API",
"path": "core/src/main/java/pro/zackpollard/telegrambot/api/user/User.java",
"license": "gpl-3.0",
"size": 1587
} | [
"pro.zackpollard.telegrambot.api.TelegramBot"
] | import pro.zackpollard.telegrambot.api.TelegramBot; | import pro.zackpollard.telegrambot.api.*; | [
"pro.zackpollard.telegrambot"
] | pro.zackpollard.telegrambot; | 393,559 |
@Test
public void testGetTaggersByCodes() {
List<String> codeList = new ArrayList<String>();
codeList.add(crisisDTO.getCode());
List<TaggersForCodes> taggersForCodes = null;
if(!codeList.isEmpty()){
taggersForCodes = modelFamilyResourceFacadeImp.getTaggersByCodes(codeList);
}
assertNotNull(taggersForCodes);
}
| void function() { List<String> codeList = new ArrayList<String>(); codeList.add(crisisDTO.getCode()); List<TaggersForCodes> taggersForCodes = null; if(!codeList.isEmpty()){ taggersForCodes = modelFamilyResourceFacadeImp.getTaggersByCodes(codeList); } assertNotNull(taggersForCodes); } | /**
* Test for fetching TaggersByCodes
*/ | Test for fetching TaggersByCodes | testGetTaggersByCodes | {
"repo_name": "qcri-social/Crisis-Computing",
"path": "aidr-db-manager/src/test/java/qa/qcri/aidr/dbmanager/ejb/remote/facade/imp/TestModelFamilyResourceFacadeImp.java",
"license": "agpl-3.0",
"size": 8713
} | [
"java.util.ArrayList",
"java.util.List",
"org.junit.Assert",
"qa.qcri.aidr.dbmanager.dto.taggerapi.TaggersForCodes"
] | import java.util.ArrayList; import java.util.List; import org.junit.Assert; import qa.qcri.aidr.dbmanager.dto.taggerapi.TaggersForCodes; | import java.util.*; import org.junit.*; import qa.qcri.aidr.dbmanager.dto.taggerapi.*; | [
"java.util",
"org.junit",
"qa.qcri.aidr"
] | java.util; org.junit; qa.qcri.aidr; | 2,374,732 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<DataConnectorInner>> getWithResponseAsync(
String resourceGroupName, String workspaceName, String dataConnectorId, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (workspaceName == null) {
return Mono.error(new IllegalArgumentException("Parameter workspaceName is required and cannot be null."));
}
if (dataConnectorId == null) {
return Mono
.error(new IllegalArgumentException("Parameter dataConnectorId is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
resourceGroupName,
workspaceName,
dataConnectorId,
accept,
context);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<DataConnectorInner>> function( String resourceGroupName, String workspaceName, String dataConnectorId, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (workspaceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (dataConnectorId == null) { return Mono .error(new IllegalArgumentException(STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, workspaceName, dataConnectorId, accept, context); } | /**
* Gets a data connector.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param dataConnectorId Connector ID.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a data connector along with {@link Response} on successful completion of {@link Mono}.
*/ | Gets a data connector | getWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/securityinsights/azure-resourcemanager-securityinsights/src/main/java/com/azure/resourcemanager/securityinsights/implementation/DataConnectorsClientImpl.java",
"license": "mit",
"size": 61458
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.securityinsights.fluent.models.DataConnectorInner"
] | 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.resourcemanager.securityinsights.fluent.models.DataConnectorInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.securityinsights.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,603,665 |
public Map<Keys, String> getValues(){
return values;
}
}
public static class JobInfo extends KeyValuePair{
private Map<String, Task> allTasks = new TreeMap<String, Task>();
public JobInfo(String jobId){
set(Keys.JOBID, jobId);
}
public Map<String, Task> getAllTasks() { return allTasks; } | Map<Keys, String> function(){ return values; } } public static class JobInfo extends KeyValuePair{ private Map<String, Task> allTasks = new TreeMap<String, Task>(); public JobInfo(String jobId){ set(Keys.JOBID, jobId); } public Map<String, Task> getAllTasks() { return allTasks; } | /**
* Returns Map containing all key-values.
*/ | Returns Map containing all key-values | getValues | {
"repo_name": "dhootha/hadoop-common",
"path": "src/mapred/org/apache/hadoop/mapred/JobHistory.java",
"license": "apache-2.0",
"size": 66630
} | [
"java.util.Map",
"java.util.TreeMap"
] | import java.util.Map; import java.util.TreeMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,487,083 |
EList<Class> getSuperClass(); | EList<Class> getSuperClass(); | /**
* Returns the value of the '<em><b>Super Class</b></em>' reference list.
* The list contents are of type {@link umlClass.Class}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Super Class</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Super Class</em>' reference list.
* @see umlClass.UmlClassPackage#getClass_SuperClass()
* @model
* @generated
*/ | Returns the value of the 'Super Class' reference list. The list contents are of type <code>umlClass.Class</code>. If the meaning of the 'Super Class' reference list isn't clear, there really should be more of a description here... | getSuperClass | {
"repo_name": "posl/iArch",
"path": "jp.ac.kyushu_u.iarch.model/src/umlClass/Class.java",
"license": "epl-1.0",
"size": 5126
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,397,240 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.