method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public static byte[] readBinary(final InputStream content) throws EntityProviderException {
return createEntityProvider().readBinary(content);
}
/**
* Read (de-serialize) data from metadata <code>inputStream</code> (as {@link InputStream}) and provide Edm as
* {@link Edm}
*
* @param metadataXml a metadata xml input stream (means the metadata document)
* @param validate has to be true if metadata should be validated
* @return Edm as {@link Edm} | static byte[] function(final InputStream content) throws EntityProviderException { return createEntityProvider().readBinary(content); } /** * Read (de-serialize) data from metadata <code>inputStream</code> (as {@link InputStream}) and provide Edm as * {@link Edm} * * @param metadataXml a metadata xml input stream (means the metadata document) * @param validate has to be true if metadata should be validated * @return Edm as {@link Edm} | /**
* Read (de-serialize) binary data from <code>content</code> (as {@link InputStream}) and provide it as
* <code>byte[]</code>.
*
* @param content data in form of an {@link InputStream} which contains the binary data
* @return binary data as bytes
* @throws EntityProviderException if reading of data (de-serialization) fails
*/ | Read (de-serialize) binary data from <code>content</code> (as <code>InputStream</code>) and provide it as <code>byte[]</code> | readBinary | {
"repo_name": "apache/olingo-odata2",
"path": "odata2-lib/odata-api/src/main/java/org/apache/olingo/odata2/api/ep/EntityProvider.java",
"license": "apache-2.0",
"size": 52818
} | [
"java.io.InputStream",
"org.apache.olingo.odata2.api.edm.Edm"
] | import java.io.InputStream; import org.apache.olingo.odata2.api.edm.Edm; | import java.io.*; import org.apache.olingo.odata2.api.edm.*; | [
"java.io",
"org.apache.olingo"
] | java.io; org.apache.olingo; | 2,518,048 |
public static synchronized FallbackProperties getInstance() {
if (fProperties == null) {
fProperties = new FallbackProperties();
}
return fProperties;
}
private FallbackProperties() {
// Load client properties from file
if (LOG.isDebugEnabled()) {
LOG.debug(new StringBuffer("init() : loading properties from file ").append(PROPERTY_FILE_NAME).toString());
}
try {
Properties fallbackProperties = new Properties();
InputStream fps = getClass().getClassLoader().getResourceAsStream(PROPERTY_FILE_NAME);
if (fps != null) {
fallbackProperties.load(fps);
this.minimunDiscFreeSpace = Integer.parseInt(fallbackProperties.getProperty("fallback.minimum.freespace", FREE_SPACE_CHECK_FREQUENCY));
this.freeSpaceCheckFrequency = Integer.parseInt(fallbackProperties.getProperty("fallback.discsize.check", DISC_SIZE_CHECK));
this.numberLinesToReadFromFile = Integer.parseInt(fallbackProperties.getProperty("fallback.read.lines.per.iteration", NUMBER_LINES_FROM_FILE));
} else {
LOG.warn(new StringBuffer("init() : Unable to find/read properties file ").append(PROPERTY_FILE_NAME).toString());
LOG.info("init() : Using default values for the fallback parameters");
}
} catch (FileNotFoundException fnfe) {
LOG.warn(new StringBuffer("init() : Unable to find properties file ").append(PROPERTY_FILE_NAME).toString());
LOG.info("init() : Using default values as fallback parameters.");
}
catch (IOException ioe) {
LOG.warn(new StringBuffer("init() : Unable to read properties file ").append(PROPERTY_FILE_NAME).toString());
LOG.info("init() : Using default values for the fallback properties.");
}
} | static synchronized FallbackProperties function() { if (fProperties == null) { fProperties = new FallbackProperties(); } return fProperties; } private FallbackProperties() { if (LOG.isDebugEnabled()) { LOG.debug(new StringBuffer(STR).append(PROPERTY_FILE_NAME).toString()); } try { Properties fallbackProperties = new Properties(); InputStream fps = getClass().getClassLoader().getResourceAsStream(PROPERTY_FILE_NAME); if (fps != null) { fallbackProperties.load(fps); this.minimunDiscFreeSpace = Integer.parseInt(fallbackProperties.getProperty(STR, FREE_SPACE_CHECK_FREQUENCY)); this.freeSpaceCheckFrequency = Integer.parseInt(fallbackProperties.getProperty(STR, DISC_SIZE_CHECK)); this.numberLinesToReadFromFile = Integer.parseInt(fallbackProperties.getProperty(STR, NUMBER_LINES_FROM_FILE)); } else { LOG.warn(new StringBuffer(STR).append(PROPERTY_FILE_NAME).toString()); LOG.info(STR); } } catch (FileNotFoundException fnfe) { LOG.warn(new StringBuffer(STR).append(PROPERTY_FILE_NAME).toString()); LOG.info(STR); } catch (IOException ioe) { LOG.warn(new StringBuffer(STR).append(PROPERTY_FILE_NAME).toString()); LOG.info(STR); } } | /**
* Gets the unique instance of the FallbackProperties class
* @return The unique instance of the class
*/ | Gets the unique instance of the FallbackProperties class | getInstance | {
"repo_name": "c2mon/c2mon",
"path": "c2mon-shared/c2mon-shared-persistence-manager/src/main/java/cern/c2mon/pmanager/fallback/FallbackProperties.java",
"license": "lgpl-3.0",
"size": 5645
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream",
"java.util.Properties"
] | import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,238,446 |
@GET
@Path("{foreignSource}/nodes/{foreignId}/interfaces/{ipAddress}")
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML})
public RequisitionInterface getInterfaceForNode(@PathParam("foreignSource") final String foreignSource, @PathParam("foreignId") final String foreignId, @PathParam("ipAddress") final String ipAddress) throws ParseException {
RequisitionInterface iface = m_accessService.getInterfaceForNode(foreignSource, foreignId, ipAddress);
if (iface == null) {
throw getException(Response.Status.NOT_FOUND, "Foreign ID '" + foreignId + "' not found in foreign source '" + foreignSource + "'.");
}
return iface;
} | @Path(STR) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.APPLICATION_ATOM_XML}) RequisitionInterface function(@PathParam(STR) final String foreignSource, @PathParam(STR) final String foreignId, @PathParam(STR) final String ipAddress) throws ParseException { RequisitionInterface iface = m_accessService.getInterfaceForNode(foreignSource, foreignId, ipAddress); if (iface == null) { throw getException(Response.Status.NOT_FOUND, STR + foreignId + STR + foreignSource + "'."); } return iface; } | /**
* Returns the interface with the given foreign source/foreignid/ipaddress combination.
*
* @param foreignSource a {@link java.lang.String} object.
* @param foreignId a {@link java.lang.String} object.
* @param ipAddress a {@link java.lang.String} object.
* @return a {@link org.opennms.netmgt.provision.persist.requisition.RequisitionInterface} object.
* @throws java.text.ParseException if any.
*/ | Returns the interface with the given foreign source/foreignid/ipaddress combination | getInterfaceForNode | {
"repo_name": "peternixon/opennms-mirror",
"path": "opennms-webapp/src/main/java/org/opennms/web/rest/RequisitionRestService.java",
"license": "gpl-2.0",
"size": 33150
} | [
"java.text.ParseException",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.opennms.netmgt.provision.persist.requisition.RequisitionInterface"
] | import java.text.ParseException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.opennms.netmgt.provision.persist.requisition.RequisitionInterface; | import java.text.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.opennms.netmgt.provision.persist.requisition.*; | [
"java.text",
"javax.ws",
"org.opennms.netmgt"
] | java.text; javax.ws; org.opennms.netmgt; | 1,813,379 |
protected String createQueryString(Map<String, String> params) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : params.entrySet()) {
sb.append(entry.getKey()).append('=').append(entry.getValue()).append('&');
}
return sb.toString().substring(0, sb.length() - 1);
}
| String function(Map<String, String> params) { StringBuilder sb = new StringBuilder(); for (Map.Entry<String, String> entry : params.entrySet()) { sb.append(entry.getKey()).append('=').append(entry.getValue()).append('&'); } return sb.toString().substring(0, sb.length() - 1); } | /**
* Create the HTTP Query String from the passsed hash
* @param params map to build HTTP query string from
* */ | Create the HTTP Query String from the passsed hash | createQueryString | {
"repo_name": "NCIP/caaers",
"path": "caAERS/software/web/src/main/java/gov/nih/nci/cabig/caaers/web/AbstractAjaxFacade.java",
"license": "bsd-3-clause",
"size": 4718
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 285,022 |
public final SqlAggFunction getAggregation() {
return aggFunction;
} | final SqlAggFunction function() { return aggFunction; } | /**
* Returns the aggregate function.
*
* @return aggregate function
*/ | Returns the aggregate function | getAggregation | {
"repo_name": "mehant/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/rel/core/AggregateCall.java",
"license": "apache-2.0",
"size": 7459
} | [
"org.apache.calcite.sql.SqlAggFunction"
] | import org.apache.calcite.sql.SqlAggFunction; | import org.apache.calcite.sql.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 1,624,102 |
public AccessibleValue getAccessibleValue()
{
return this;
} | AccessibleValue function() { return this; } | /**
* Returns the accessible value of this AccessibleAbstractButton, which
* is always <code>this</code>.
*
* @return the accessible value of this AccessibleAbstractButton, which
* is always <code>this</code>
*/ | Returns the accessible value of this AccessibleAbstractButton, which is always <code>this</code> | getAccessibleValue | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/AbstractButton.java",
"license": "bsd-3-clause",
"size": 77459
} | [
"javax.accessibility.AccessibleValue"
] | import javax.accessibility.AccessibleValue; | import javax.accessibility.*; | [
"javax.accessibility"
] | javax.accessibility; | 1,508,588 |
public static SSLEngine getClientSSLEngine(
SSLContext context, boolean useSNI) {
SSLEngine clientEngine = context.createSSLEngine(HOST, 80);
clientEngine.setUseClientMode(true);
if (useSNI) {
SNIHostName serverName = new SNIHostName(SERVER_NAME);
List<SNIServerName> serverNames = new ArrayList<>();
serverNames.add(serverName);
SSLParameters params = clientEngine.getSSLParameters();
params.setServerNames(serverNames);
clientEngine.setSSLParameters(params);
}
return clientEngine;
} | static SSLEngine function( SSLContext context, boolean useSNI) { SSLEngine clientEngine = context.createSSLEngine(HOST, 80); clientEngine.setUseClientMode(true); if (useSNI) { SNIHostName serverName = new SNIHostName(SERVER_NAME); List<SNIServerName> serverNames = new ArrayList<>(); serverNames.add(serverName); SSLParameters params = clientEngine.getSSLParameters(); params.setServerNames(serverNames); clientEngine.setSSLParameters(params); } return clientEngine; } | /**
* Returns client ssl engine.
*
* @param context - SSLContext to get SSLEngine from.
* @param useSNI - flag used to enable or disable using SNI extension.
* Needed for Kerberos.
*/ | Returns client ssl engine | getClientSSLEngine | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/test/javax/net/ssl/TLSCommon/SSLEngineTestCase.java",
"license": "gpl-2.0",
"size": 47703
} | [
"java.util.ArrayList",
"java.util.List",
"javax.net.ssl.SNIHostName",
"javax.net.ssl.SNIServerName",
"javax.net.ssl.SSLContext",
"javax.net.ssl.SSLEngine",
"javax.net.ssl.SSLParameters"
] | import java.util.ArrayList; import java.util.List; import javax.net.ssl.SNIHostName; import javax.net.ssl.SNIServerName; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLParameters; | import java.util.*; import javax.net.ssl.*; | [
"java.util",
"javax.net"
] | java.util; javax.net; | 149,741 |
private void handleDiscoveryEvent(NodeDiscoveryEvent event) {
switch (event.type()) {
case JOIN:
handleJoinEvent(event.subject());
break;
case LEAVE:
handleLeaveEvent(event.subject());
break;
default:
throw new AssertionError();
}
} | void function(NodeDiscoveryEvent event) { switch (event.type()) { case JOIN: handleJoinEvent(event.subject()); break; case LEAVE: handleLeaveEvent(event.subject()); break; default: throw new AssertionError(); } } | /**
* Handles a member location event.
*
* @param event the member location event
*/ | Handles a member location event | handleDiscoveryEvent | {
"repo_name": "kuujo/copycat",
"path": "cluster/src/main/java/io/atomix/cluster/protocol/SwimMembershipProtocol.java",
"license": "apache-2.0",
"size": 37184
} | [
"io.atomix.cluster.discovery.NodeDiscoveryEvent"
] | import io.atomix.cluster.discovery.NodeDiscoveryEvent; | import io.atomix.cluster.discovery.*; | [
"io.atomix.cluster"
] | io.atomix.cluster; | 2,176,939 |
SubnetPutResponse beginCreateOrUpdating(String resourceGroupName, String virtualNetworkName, String subnetName, Subnet subnetParameters) throws IOException, ServiceException; | SubnetPutResponse beginCreateOrUpdating(String resourceGroupName, String virtualNetworkName, String subnetName, Subnet subnetParameters) throws IOException, ServiceException; | /**
* The Put Subnet operation creates/updates a subnet in thespecified virtual
* network
*
* @param resourceGroupName Required. The name of the resource group.
* @param virtualNetworkName Required. The name of the virtual network.
* @param subnetName Required. The name of the subnet.
* @param subnetParameters Required. Parameters supplied to the
* create/update Subnet operation
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Response for PutSubnet Api service call
*/ | The Put Subnet operation creates/updates a subnet in thespecified virtual network | beginCreateOrUpdating | {
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "resource-management/azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/SubnetOperations.java",
"license": "apache-2.0",
"size": 12361
} | [
"com.microsoft.azure.management.network.models.Subnet",
"com.microsoft.azure.management.network.models.SubnetPutResponse",
"com.microsoft.windowsazure.exception.ServiceException",
"java.io.IOException"
] | import com.microsoft.azure.management.network.models.Subnet; import com.microsoft.azure.management.network.models.SubnetPutResponse; import com.microsoft.windowsazure.exception.ServiceException; import java.io.IOException; | import com.microsoft.azure.management.network.models.*; import com.microsoft.windowsazure.exception.*; import java.io.*; | [
"com.microsoft.azure",
"com.microsoft.windowsazure",
"java.io"
] | com.microsoft.azure; com.microsoft.windowsazure; java.io; | 1,323,021 |
protected void setFixture(EIPModel fixture) {
this.fixture = fixture;
} | void function(EIPModel fixture) { this.fixture = fixture; } | /**
* Sets the fixture for this EIP Model test case.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Sets the fixture for this EIP Model test case. | setFixture | {
"repo_name": "lbroudoux/eip-designer",
"path": "plugins/com.github.lbroudoux.dsl.eip.tests/src/com/github/lbroudoux/dsl/eip/tests/EIPModelTest.java",
"license": "apache-2.0",
"size": 1862
} | [
"com.github.lbroudoux.dsl.eip.EIPModel"
] | import com.github.lbroudoux.dsl.eip.EIPModel; | import com.github.lbroudoux.dsl.eip.*; | [
"com.github.lbroudoux"
] | com.github.lbroudoux; | 2,146,135 |
public void saveState(IMemento memento) {
String workingSetName= ""; //$NON-NLS-1$
boolean isWindowWorkingSet= false;
if (fWorkingSet != null) {
if (fWorkingSet.isAggregateWorkingSet()) {
isWindowWorkingSet= true;
} else {
workingSetName= fWorkingSet.getName();
}
}
memento.putString(TAG_IS_WINDOW_WORKING_SET, Boolean.toString(isWindowWorkingSet));
memento.putString(TAG_WORKING_SET_NAME, workingSetName);
} | void function(IMemento memento) { String workingSetName= ""; boolean isWindowWorkingSet= false; if (fWorkingSet != null) { if (fWorkingSet.isAggregateWorkingSet()) { isWindowWorkingSet= true; } else { workingSetName= fWorkingSet.getName(); } } memento.putString(TAG_IS_WINDOW_WORKING_SET, Boolean.toString(isWindowWorkingSet)); memento.putString(TAG_WORKING_SET_NAME, workingSetName); } | /**
* Saves the state of the filter actions in a memento.
*
* @param memento the memento
*/ | Saves the state of the filter actions in a memento | saveState | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/workingsets/WorkingSetFilterActionGroup.java",
"license": "epl-1.0",
"size": 11516
} | [
"org.eclipse.ui.IMemento"
] | import org.eclipse.ui.IMemento; | import org.eclipse.ui.*; | [
"org.eclipse.ui"
] | org.eclipse.ui; | 894,463 |
public static WebDriver getWebDriver(
int requester, Browser browser, String proxyAddress, int proxyPort) {
validateProxyAddressPort(proxyAddress, proxyPort);
return getWebDriverImpl(requester, browser, proxyAddress, proxyPort);
} | static WebDriver function( int requester, Browser browser, String proxyAddress, int proxyPort) { validateProxyAddressPort(proxyAddress, proxyPort); return getWebDriverImpl(requester, browser, proxyAddress, proxyPort); } | /**
* Gets a {@code WebDriver} for the given requester and {@code browser} proxying through the
* given address and port.
*
* @param requester the ID of the component requesting the {@code WebDriver}.
* @param browser the target browser.
* @param proxyAddress the address of the proxy.
* @param proxyPort the port of the proxy.
* @return the {@code WebDriver} to the given {@code browser}, proxying through the given
* address and port.
* @throws IllegalArgumentException if {@code proxyAddress} is {@code null} or empty, or if
* {@code proxyPort} is not a valid port number (between 1 and 65535).
* @see #getWebDriver(Browser)
*/ | Gets a WebDriver for the given requester and browser proxying through the given address and port | getWebDriver | {
"repo_name": "veggiespam/zap-extensions",
"path": "addOns/selenium/src/main/java/org/zaproxy/zap/extension/selenium/ExtensionSelenium.java",
"license": "apache-2.0",
"size": 38630
} | [
"org.openqa.selenium.WebDriver"
] | import org.openqa.selenium.WebDriver; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 408,316 |
public List<StepMeta> findNextSteps( StepMeta stepMeta ) {
List<StepMeta> nextSteps = new ArrayList<>();
for ( int i = 0; i < nrTransHops(); i++ ) { // Look at all the hops;
TransHopMeta hi = getTransHop( i );
if ( hi.isEnabled() && hi.getFromStep().equals( stepMeta ) ) {
nextSteps.add( hi.getToStep() );
}
}
return nextSteps;
} | List<StepMeta> function( StepMeta stepMeta ) { List<StepMeta> nextSteps = new ArrayList<>(); for ( int i = 0; i < nrTransHops(); i++ ) { TransHopMeta hi = getTransHop( i ); if ( hi.isEnabled() && hi.getFromStep().equals( stepMeta ) ) { nextSteps.add( hi.getToStep() ); } } return nextSteps; } | /**
* Retrieve a list of succeeding steps for a certain originating step.
*
* @param stepMeta
* The originating step
* @return an array of succeeding steps.
*/ | Retrieve a list of succeeding steps for a certain originating step | findNextSteps | {
"repo_name": "dkincade/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java",
"license": "apache-2.0",
"size": 227503
} | [
"java.util.ArrayList",
"java.util.List",
"org.pentaho.di.trans.step.StepMeta"
] | import java.util.ArrayList; import java.util.List; import org.pentaho.di.trans.step.StepMeta; | import java.util.*; import org.pentaho.di.trans.step.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 634,926 |
@NonNull
public static WrappedDimensionProp wrap() {
return WRAP;
}
public static final class DpProp
implements ContainerDimension, ImageDimension, SpacerDimension {
private final DimensionProto.DpProp mImpl;
private DpProp(DimensionProto.DpProp impl) {
this.mImpl = impl;
} | static WrappedDimensionProp function() { return WRAP; } public static final class DpProp implements ContainerDimension, ImageDimension, SpacerDimension { private final DimensionProto.DpProp mImpl; private DpProp(DimensionProto.DpProp impl) { this.mImpl = impl; } | /**
* Shortcut for building an {@link WrappedDimensionProp} that will shrink to the size of its
* children.
*/ | Shortcut for building an <code>WrappedDimensionProp</code> that will shrink to the size of its children | wrap | {
"repo_name": "AndroidX/androidx",
"path": "wear/tiles/tiles/src/main/java/androidx/wear/tiles/DimensionBuilders.java",
"license": "apache-2.0",
"size": 21217
} | [
"androidx.wear.tiles.proto.DimensionProto"
] | import androidx.wear.tiles.proto.DimensionProto; | import androidx.wear.tiles.proto.*; | [
"androidx.wear"
] | androidx.wear; | 598,021 |
public void testIteratorOrdering() {
final LinkedBlockingDeque q = new LinkedBlockingDeque(3);
q.add(one);
q.add(two);
q.add(three);
assertEquals(0, q.remainingCapacity());
int k = 0;
for (Iterator it = q.iterator(); it.hasNext();) {
assertEquals(++k, it.next());
}
assertEquals(3, k);
} | void function() { final LinkedBlockingDeque q = new LinkedBlockingDeque(3); q.add(one); q.add(two); q.add(three); assertEquals(0, q.remainingCapacity()); int k = 0; for (Iterator it = q.iterator(); it.hasNext();) { assertEquals(++k, it.next()); } assertEquals(3, k); } | /**
* iterator ordering is FIFO
*/ | iterator ordering is FIFO | testIteratorOrdering | {
"repo_name": "AdmireTheDistance/android_libcore",
"path": "jsr166-tests/src/test/java/jsr166/LinkedBlockingDequeTest.java",
"license": "gpl-2.0",
"size": 59941
} | [
"java.util.Iterator",
"java.util.concurrent.LinkedBlockingDeque"
] | import java.util.Iterator; import java.util.concurrent.LinkedBlockingDeque; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,607,511 |
protected PackageManager getPackageManager() {
return getActivity().getPackageManager();
} | PackageManager function() { return getActivity().getPackageManager(); } | /**
* Returns the PackageManager from the owning Activity.
*/ | Returns the PackageManager from the owning Activity | getPackageManager | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Settings/src/com/android/settings/SettingsPreferenceFragment.java",
"license": "gpl-2.0",
"size": 12351
} | [
"android.content.pm.PackageManager"
] | import android.content.pm.PackageManager; | import android.content.pm.*; | [
"android.content"
] | android.content; | 933,310 |
public RoleDAO getRoleDAO() {
return getDAO(RoleDAO.class);
} | RoleDAO function() { return getDAO(RoleDAO.class); } | /**
* Retrieves the singleton instance of {@link RoleDAO}.
*
* @return the dao
*/ | Retrieves the singleton instance of <code>RoleDAO</code> | getRoleDAO | {
"repo_name": "derekhiggins/ovirt-engine",
"path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java",
"license": "apache-2.0",
"size": 28652
} | [
"org.ovirt.engine.core.dao.RoleDAO"
] | import org.ovirt.engine.core.dao.RoleDAO; | import org.ovirt.engine.core.dao.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 2,636,324 |
public SearchSourceBuilder filter(Map filter) {
try {
XContentBuilder builder = XContentFactory.contentBuilder(Requests.CONTENT_TYPE);
builder.map(filter);
return filter(builder);
} catch (IOException e) {
throw new ElasticSearchGenerationException("Failed to generate [" + filter + "]", e);
}
} | SearchSourceBuilder function(Map filter) { try { XContentBuilder builder = XContentFactory.contentBuilder(Requests.CONTENT_TYPE); builder.map(filter); return filter(builder); } catch (IOException e) { throw new ElasticSearchGenerationException(STR + filter + "]", e); } } | /**
* Constructs a new search source builder with a query from a map.
*/ | Constructs a new search source builder with a query from a map | filter | {
"repo_name": "lmenezes/elasticsearch",
"path": "src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java",
"license": "apache-2.0",
"size": 27894
} | [
"java.io.IOException",
"java.util.Map",
"org.elasticsearch.ElasticSearchGenerationException",
"org.elasticsearch.client.Requests",
"org.elasticsearch.common.xcontent.XContentBuilder",
"org.elasticsearch.common.xcontent.XContentFactory"
] | import java.io.IOException; import java.util.Map; import org.elasticsearch.ElasticSearchGenerationException; import org.elasticsearch.client.Requests; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; | import java.io.*; import java.util.*; import org.elasticsearch.*; import org.elasticsearch.client.*; import org.elasticsearch.common.xcontent.*; | [
"java.io",
"java.util",
"org.elasticsearch",
"org.elasticsearch.client",
"org.elasticsearch.common"
] | java.io; java.util; org.elasticsearch; org.elasticsearch.client; org.elasticsearch.common; | 1,518,949 |
private static CommandLine spawnCommandLine(PathFragment javaExecutable, Artifact javaBuilderJar,
Artifact langtoolsJar, ImmutableList<Artifact> instrumentationJars, Artifact paramFile,
ImmutableList<String> javaBuilderJvmFlags, String javaBuilderMainClass,
String pathDelimiter) {
Preconditions.checkNotNull(langtoolsJar);
Preconditions.checkNotNull(javaBuilderJar);
CustomCommandLine.Builder builder = CustomCommandLine.builder()
.addPath(javaExecutable)
// Langtools jar is placed on the boot classpath so that it can override classes
// in the JRE. Typically this has no effect since langtools.jar does not have
// classes in common with rt.jar. However, it is necessary when using a version
// of javac.jar generated via ant from the langtools build.xml that is of a
// different version than AND has an overlap in contents with the default
// run-time (eg while upgrading the Java version).
.addPaths("-Xbootclasspath/p:%s", langtoolsJar.getExecPath())
.add(javaBuilderJvmFlags);
if (!instrumentationJars.isEmpty()) {
builder
.addJoinExecPaths("-cp", pathDelimiter,
Iterables.concat(instrumentationJars, ImmutableList.of(javaBuilderJar)))
.add(javaBuilderMainClass);
} else {
// If there are no instrumentation jars, use the simpler '-jar' option to launch JavaBuilder.
builder.addExecPath("-jar", javaBuilderJar);
}
return builder
.addPaths("@%s", paramFile.getExecPath())
.build();
}
public interface ArtifactFactory { | static CommandLine function(PathFragment javaExecutable, Artifact javaBuilderJar, Artifact langtoolsJar, ImmutableList<Artifact> instrumentationJars, Artifact paramFile, ImmutableList<String> javaBuilderJvmFlags, String javaBuilderMainClass, String pathDelimiter) { Preconditions.checkNotNull(langtoolsJar); Preconditions.checkNotNull(javaBuilderJar); CustomCommandLine.Builder builder = CustomCommandLine.builder() .addPath(javaExecutable) .addPaths(STR, langtoolsJar.getExecPath()) .add(javaBuilderJvmFlags); if (!instrumentationJars.isEmpty()) { builder .addJoinExecPaths("-cp", pathDelimiter, Iterables.concat(instrumentationJars, ImmutableList.of(javaBuilderJar))) .add(javaBuilderMainClass); } else { builder.addExecPath("-jar", javaBuilderJar); } return builder .addPaths("@%s", paramFile.getExecPath()) .build(); } public interface ArtifactFactory { | /**
* The actual command line executed for a compile action.
*/ | The actual command line executed for a compile action | spawnCommandLine | {
"repo_name": "anupcshan/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileAction.java",
"license": "apache-2.0",
"size": 39638
} | [
"com.google.common.collect.ImmutableList",
"com.google.common.collect.Iterables",
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.analysis.actions.CommandLine",
"com.google.devtools.build.lib.analysis.actions.CustomCommandLine",
"com.google.devtools.build.lib.util.Preconditions",
"com.google.devtools.build.lib.vfs.PathFragment"
] | import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.actions.CommandLine; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.vfs.PathFragment; | import com.google.common.collect.*; import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.actions.*; import com.google.devtools.build.lib.util.*; import com.google.devtools.build.lib.vfs.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 564,844 |
public List<Episode> getAllEpisodes()
{
Cursor cursor = null;
List<Episode> episodes = null;
try
{
// perform the query on the database
cursor = db.query(
DBMediaOpenHelper.TABLE_EPISODES,
allColumns,
null, null, null, null, null); // null 'selection' param returns all rows in table
// get all result Episodes from the cursor and return the List
episodes = getEpisodesFromCursor(cursor);
if (MyLog.verbose) MyLog.v(TAG, "Episodes parsed and returned: " +episodes.size());
return episodes;
}
finally
{
// close the cursor, freeing up its resources
if (cursor != null)
cursor.close();
}
}
| List<Episode> function() { Cursor cursor = null; List<Episode> episodes = null; try { cursor = db.query( DBMediaOpenHelper.TABLE_EPISODES, allColumns, null, null, null, null, null); episodes = getEpisodesFromCursor(cursor); if (MyLog.verbose) MyLog.v(TAG, STR +episodes.size()); return episodes; } finally { if (cursor != null) cursor.close(); } } | /**
* Retrieve all stored Episodes in the database.
* Will return every Episode saved and as such should not be used unless explicitly needed.
* @return List of all Episodes
*/ | Retrieve all stored Episodes in the database. Will return every Episode saved and as such should not be used unless explicitly needed | getAllEpisodes | {
"repo_name": "indivisible-irl/MightyV",
"path": "src/com/indivisible/mightyv/data/EpisodeDataSource.java",
"license": "apache-2.0",
"size": 19913
} | [
"android.database.Cursor",
"com.indivisible.mightyv.util.MyLog",
"java.util.List"
] | import android.database.Cursor; import com.indivisible.mightyv.util.MyLog; import java.util.List; | import android.database.*; import com.indivisible.mightyv.util.*; import java.util.*; | [
"android.database",
"com.indivisible.mightyv",
"java.util"
] | android.database; com.indivisible.mightyv; java.util; | 954,070 |
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
);
} | List<ReactPackage> function() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); } | /**
* A list of packages used by the app. If the app uses additional views
* or modules besides the default ones, add more packages here.
*/ | A list of packages used by the app. If the app uses additional views or modules besides the default ones, add more packages here | getPackages | {
"repo_name": "AngryLi/ResourceSummary",
"path": "React Native/Demos/XieChengDemo/android/app/src/main/java/com/xiechengdemo/MainActivity.java",
"license": "mit",
"size": 1038
} | [
"com.facebook.react.ReactPackage",
"com.facebook.react.shell.MainReactPackage",
"java.util.Arrays",
"java.util.List"
] | import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import java.util.Arrays; import java.util.List; | import com.facebook.react.*; import com.facebook.react.shell.*; import java.util.*; | [
"com.facebook.react",
"java.util"
] | com.facebook.react; java.util; | 1,197,064 |
private String getconfigName(DataMapperMediatorImpl datamapper) {
String configName= null;
String regPath = datamapper.getConfiguration().getKeyValue();
if(StringUtils.isNotEmpty(regPath)){
configName = regPath.substring(regPath.lastIndexOf("/") + 1, regPath.length());
}
return configName;
} | String function(DataMapperMediatorImpl datamapper) { String configName= null; String regPath = datamapper.getConfiguration().getKeyValue(); if(StringUtils.isNotEmpty(regPath)){ configName = regPath.substring(regPath.lastIndexOf("/") + 1, regPath.length()); } return configName; } | /**
* Gets the configuration name of the datamapper config
* @param datamapper DataMapper Mediator object
* @return configuration name
*/ | Gets the configuration name of the datamapper config | getconfigName | {
"repo_name": "nwnpallewela/developer-studio",
"path": "esb/plugins/org.wso2.developerstudio.eclipse.gmf.esb.diagram/src/org/wso2/developerstudio/eclipse/gmf/esb/diagram/edit/parts/DataMapperMediatorEditPart.java",
"license": "apache-2.0",
"size": 21988
} | [
"org.apache.commons.lang.StringUtils",
"org.wso2.developerstudio.eclipse.gmf.esb.impl.DataMapperMediatorImpl"
] | import org.apache.commons.lang.StringUtils; import org.wso2.developerstudio.eclipse.gmf.esb.impl.DataMapperMediatorImpl; | import org.apache.commons.lang.*; import org.wso2.developerstudio.eclipse.gmf.esb.impl.*; | [
"org.apache.commons",
"org.wso2.developerstudio"
] | org.apache.commons; org.wso2.developerstudio; | 2,412,224 |
@Override
public Object clone() throws CloneNotSupportedException {
XYLineAndShapeRenderer clone = (XYLineAndShapeRenderer) super.clone();
clone.seriesLinesVisible
= (BooleanList) this.seriesLinesVisible.clone();
if (this.legendLine != null) {
clone.legendLine = ShapeUtilities.clone(this.legendLine);
}
clone.seriesShapesVisible
= (BooleanList) this.seriesShapesVisible.clone();
clone.seriesShapesFilled
= (BooleanList) this.seriesShapesFilled.clone();
return clone;
}
| Object function() throws CloneNotSupportedException { XYLineAndShapeRenderer clone = (XYLineAndShapeRenderer) super.clone(); clone.seriesLinesVisible = (BooleanList) this.seriesLinesVisible.clone(); if (this.legendLine != null) { clone.legendLine = ShapeUtilities.clone(this.legendLine); } clone.seriesShapesVisible = (BooleanList) this.seriesShapesVisible.clone(); clone.seriesShapesFilled = (BooleanList) this.seriesShapesFilled.clone(); return clone; } | /**
* Returns a clone of the renderer.
*
* @return A clone.
*
* @throws CloneNotSupportedException if the clone cannot be created.
*/ | Returns a clone of the renderer | clone | {
"repo_name": "ciaracdb/LOG6302",
"path": "examples/jfreechart/source/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.java",
"license": "apache-2.0",
"size": 47218
} | [
"org.jfree.util.BooleanList",
"org.jfree.util.ShapeUtilities"
] | import org.jfree.util.BooleanList; import org.jfree.util.ShapeUtilities; | import org.jfree.util.*; | [
"org.jfree.util"
] | org.jfree.util; | 1,516,241 |
public String getURL()
{
return getAttribute(IFrameAttributes.Src);
} | String function() { return getAttribute(IFrameAttributes.Src); } | /**
* Returns this IFrames URL
* <p>
*
* @return String that is this frame URL
*/ | Returns this IFrames URL | getURL | {
"repo_name": "GedMarc/JWebSwing",
"path": "src/main/java/com/jwebmp/core/base/html/IFrame.java",
"license": "gpl-3.0",
"size": 4550
} | [
"com.jwebmp.core.base.html.attributes.IFrameAttributes"
] | import com.jwebmp.core.base.html.attributes.IFrameAttributes; | import com.jwebmp.core.base.html.attributes.*; | [
"com.jwebmp.core"
] | com.jwebmp.core; | 1,143,349 |
public AbasDate addWorkingDays(DbContext dbContext, AbasDate date, int days) {
// declares variables as in FOP
if (!getUserTextBuffer().isVarDefined(XGD2DATE)) {
getUserTextBuffer().defineVar(TYPE_GD2, XGD2DATE);
}
if (!getUserTextBuffer().isVarDefined(XGD2RESULT)) {
getUserTextBuffer().defineVar(TYPE_GD2, XGD2RESULT);
}
if (!getUserTextBuffer().isVarDefined(XGD8RESULT)) {
getUserTextBuffer().defineVar(TYPE_GD8, XGD8RESULT);
}
// initializes variables and calculates new date
getUserTextBuffer().assign(XGD2DATE, date);
getUserTextBuffer().formulaField(XGD2RESULT, userTextBuffer, XGD2DATE + " &" + days);
getUserTextBuffer().formulaValue(XGD8RESULT, userTextBuffer, XGD2RESULT);
// gets the new date from UserTextBuffer and returns it
AbasDate abasDate = getUserTextBuffer().getAbasDateValue(XGD8RESULT);
return abasDate;
}
| AbasDate function(DbContext dbContext, AbasDate date, int days) { if (!getUserTextBuffer().isVarDefined(XGD2DATE)) { getUserTextBuffer().defineVar(TYPE_GD2, XGD2DATE); } if (!getUserTextBuffer().isVarDefined(XGD2RESULT)) { getUserTextBuffer().defineVar(TYPE_GD2, XGD2RESULT); } if (!getUserTextBuffer().isVarDefined(XGD8RESULT)) { getUserTextBuffer().defineVar(TYPE_GD8, XGD8RESULT); } getUserTextBuffer().assign(XGD2DATE, date); getUserTextBuffer().formulaField(XGD2RESULT, userTextBuffer, XGD2DATE + STR + days); getUserTextBuffer().formulaValue(XGD8RESULT, userTextBuffer, XGD2RESULT); AbasDate abasDate = getUserTextBuffer().getAbasDateValue(XGD8RESULT); return abasDate; } | /**
* Adds a number of days to an AbasDate only considering working days.
*
* @param dbContext The database context.
* @param date The AbasDate to add the days to.
* @param days The amount of days to add.
* @return The AbasDate with the days added.
*/ | Adds a number of days to an AbasDate only considering working days | addWorkingDays | {
"repo_name": "abassoftware/ajo-examples",
"path": "src/de/abas/examples/utilities/AbasDateUtilities.java",
"license": "epl-1.0",
"size": 15491
} | [
"de.abas.erp.common.type.AbasDate",
"de.abas.erp.db.DbContext"
] | import de.abas.erp.common.type.AbasDate; import de.abas.erp.db.DbContext; | import de.abas.erp.common.type.*; import de.abas.erp.db.*; | [
"de.abas.erp"
] | de.abas.erp; | 1,608,600 |
public Timestamp getCreated();
public static final String COLUMNNAME_CreatedBy = "CreatedBy"; | Timestamp function(); public static final String COLUMNNAME_CreatedBy = STR; | /** Get Created.
* Date this record was created
*/ | Get Created. Date this record was created | getCreated | {
"repo_name": "braully/adempiere",
"path": "base/src/org/compiere/model/I_A_Asset_Reval.java",
"license": "gpl-2.0",
"size": 8563
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 607,751 |
@Override
protected void onUnsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) throws IOException {
super.onUnsuccessfulAuthentication(request, response, failed);
LOGGER.log(Level.INFO, "Login attempt failed", failed);
}
private static final Logger LOGGER = Logger.getLogger(AuthenticationProcessingFilter2.class.getName()); | void function(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) throws IOException { super.onUnsuccessfulAuthentication(request, response, failed); LOGGER.log(Level.INFO, STR, failed); } private static final Logger LOGGER = Logger.getLogger(AuthenticationProcessingFilter2.class.getName()); | /**
* Leave the information about login failure.
*
* <p>
* Otherwise it seems like Acegi doesn't really leave the detail of the failure anywhere.
*/ | Leave the information about login failure. Otherwise it seems like Acegi doesn't really leave the detail of the failure anywhere | onUnsuccessfulAuthentication | {
"repo_name": "syl20bnr/jenkins",
"path": "core/src/main/java/hudson/security/AuthenticationProcessingFilter2.java",
"license": "mit",
"size": 4703
} | [
"java.io.IOException",
"java.util.logging.Level",
"java.util.logging.Logger",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.acegisecurity.AuthenticationException"
] | import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.acegisecurity.AuthenticationException; | import java.io.*; import java.util.logging.*; import javax.servlet.http.*; import org.acegisecurity.*; | [
"java.io",
"java.util",
"javax.servlet",
"org.acegisecurity"
] | java.io; java.util; javax.servlet; org.acegisecurity; | 261,082 |
@Test
public void appendMultipleMappedQueryParams() throws Exception {
Map<String, Object> params = new LinkedHashMap<String, Object>();
params.put("a", "b");
params.put("c", "d");
assertEquals("http://test.com/1?a=b&c=d",
HttpRequest.append("http://test.com/1", params));
} | void function() throws Exception { Map<String, Object> params = new LinkedHashMap<String, Object>(); params.put("a", "b"); params.put("c", "d"); assertEquals(STRhttp: } | /**
* Append multiple params
*
* @throws Exception
*/ | Append multiple params | appendMultipleMappedQueryParams | {
"repo_name": "shulei1/http-request",
"path": "lib/src/test/java/com/github/kevinsawicki/http/HttpRequestTest.java",
"license": "mit",
"size": 108437
} | [
"com.github.kevinsawicki.http.HttpRequest",
"java.util.LinkedHashMap",
"java.util.Map",
"org.junit.Assert"
] | import com.github.kevinsawicki.http.HttpRequest; import java.util.LinkedHashMap; import java.util.Map; import org.junit.Assert; | import com.github.kevinsawicki.http.*; import java.util.*; import org.junit.*; | [
"com.github.kevinsawicki",
"java.util",
"org.junit"
] | com.github.kevinsawicki; java.util; org.junit; | 2,933 |
final Catalog catalog;
if (fieldFormatData == null) {
catalog = new ComparatorCatalog(loader, null);
} else {
final Map<String, Format> enumFormats =
new HashMap<String, Format>();
catalog = new ComparatorCatalog(loader, enumFormats);
for (Map.Entry<String, String[]> entry :
fieldFormatData.entrySet()) {
final String fldClassName = entry.getKey();
final String[] enumNames = entry.getValue();
final Class fldClass;
try {
fldClass = catalog.resolveClass(fldClassName);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
enumFormats.put(fldClassName,
new EnumFormat(catalog, fldClass, enumNames));
}
for (Format fldFormat : enumFormats.values()) {
fldFormat.initializeIfNeeded(catalog, null );
}
}
final Class keyClass;
try {
keyClass = catalog.resolveClass(keyClassName);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
binding = new PersistKeyBinding(catalog, keyClass,
comositeFieldOrder);
} | final Catalog catalog; if (fieldFormatData == null) { catalog = new ComparatorCatalog(loader, null); } else { final Map<String, Format> enumFormats = new HashMap<String, Format>(); catalog = new ComparatorCatalog(loader, enumFormats); for (Map.Entry<String, String[]> entry : fieldFormatData.entrySet()) { final String fldClassName = entry.getKey(); final String[] enumNames = entry.getValue(); final Class fldClass; try { fldClass = catalog.resolveClass(fldClassName); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } enumFormats.put(fldClassName, new EnumFormat(catalog, fldClass, enumNames)); } for (Format fldFormat : enumFormats.values()) { fldFormat.initializeIfNeeded(catalog, null ); } } final Class keyClass; try { keyClass = catalog.resolveClass(keyClassName); } catch (ClassNotFoundException e) { throw new IllegalStateException(e); } binding = new PersistKeyBinding(catalog, keyClass, comositeFieldOrder); } | /**
* In BDB JE this method will be called after the comparator is
* deserialized, including during recovery. We must construct the binding
* here, without access to the stored catalog since recovery is not
* complete.
*/ | In BDB JE this method will be called after the comparator is deserialized, including during recovery. We must construct the binding here, without access to the stored catalog since recovery is not complete | initialize | {
"repo_name": "prat0318/dbms",
"path": "mini_dbms/je-5.0.103/src/com/sleepycat/persist/impl/PersistComparator.java",
"license": "mit",
"size": 5671
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 183,359 |
@Override
public List<Comparable> getRowKeys() {
return this.underlying.getRowKeys();
}
| List<Comparable> function() { return this.underlying.getRowKeys(); } | /**
* Returns the row keys.
*
* @return The keys.
*/ | Returns the row keys | getRowKeys | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/data/gantt/SlidingGanttCategoryDataset.java",
"license": "lgpl-2.1",
"size": 20229
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 705,353 |
Map<String, Object> readKeyValues(Deserializer deserializer); | Map<String, Object> readKeyValues(Deserializer deserializer); | /**
* Read key - value pairs. This is required for the RecordSet deserializer.
*
* @param deserializer deserializer
* @return key-value pairs
*/ | Read key - value pairs. This is required for the RecordSet deserializer | readKeyValues | {
"repo_name": "cwpenhale/red5-mobileconsole",
"path": "red5_server/src/main/java/org/red5/io/object/Input.java",
"license": "apache-2.0",
"size": 4240
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,736,689 |
private void createContents() {
shlHelp = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
shlHelp.setSize(600, 383);
shlHelp.setText(DICT.getString("HelpDialog.shlHelp.text")); //$NON-NLS-1$
shlHelp.setLayout(new GridLayout(1, false));
Browser browser = new Browser(shlHelp, SWT.NONE);
URL url = HelpDialog.class.getResource("/de/tudresden/inf/gsvgplott/docs/Help_de.htm");
if(url != null)
browser.setUrl(url.toString());
else
browser.setText("<html><body><h1>No Help Document Found.</h1></body></html>");
browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
| void function() { shlHelp = new Shell(getParent(), SWT.DIALOG_TRIM SWT.RESIZE SWT.APPLICATION_MODAL); shlHelp.setSize(600, 383); shlHelp.setText(DICT.getString(STR)); shlHelp.setLayout(new GridLayout(1, false)); Browser browser = new Browser(shlHelp, SWT.NONE); URL url = HelpDialog.class.getResource(STR); if(url != null) browser.setUrl(url.toString()); else browser.setText(STR); browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); | /**
* Create contents of the dialog.
*/ | Create contents of the dialog | createContents | {
"repo_name": "DavidGollasch/gSVGPlott",
"path": "gSVGPlott/src/de/tudresden/inf/gsvgplott/ui/HelpDialog.java",
"license": "gpl-2.0",
"size": 2399
} | [
"org.eclipse.swt.browser.Browser",
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.widgets.Shell"
] | import org.eclipse.swt.browser.Browser; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Shell; | import org.eclipse.swt.browser.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,172,029 |
@ApiModelProperty(value = "")
public CurrencyCode getCurrencyCode() {
return currencyCode;
} | @ApiModelProperty(value = "") CurrencyCode function() { return currencyCode; } | /**
* Get currencyCode
*
* @return currencyCode
*/ | Get currencyCode | getCurrencyCode | {
"repo_name": "XeroAPI/Xero-Java",
"path": "src/main/java/com/xero/models/accounting/Account.java",
"license": "mit",
"size": 27803
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,397,099 |
public void testParse_testFailed() {
StringBuilder output = buildCommonResult();
addStackTrace(output);
addFailureCode(output);
mMockListener.testRunStarted(RUN_NAME, 1);
mMockListener.testStarted(TEST_ID);
mMockListener.testFailed(TestFailure.FAILURE, TEST_ID, STACK_TRACE);
mMockListener.testEnded(TEST_ID, Collections.EMPTY_MAP);
mMockListener.testRunEnded(0, Collections.EMPTY_MAP);
injectAndVerifyTestString(output.toString());
} | void function() { StringBuilder output = buildCommonResult(); addStackTrace(output); addFailureCode(output); mMockListener.testRunStarted(RUN_NAME, 1); mMockListener.testStarted(TEST_ID); mMockListener.testFailed(TestFailure.FAILURE, TEST_ID, STACK_TRACE); mMockListener.testEnded(TEST_ID, Collections.EMPTY_MAP); mMockListener.testRunEnded(0, Collections.EMPTY_MAP); injectAndVerifyTestString(output.toString()); } | /**
* Test parsing output for a test failure.
*/ | Test parsing output for a test failure | testParse_testFailed | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "sdk/ddms/libs/ddmlib/tests/src/com/android/ddmlib/testrunner/InstrumentationResultParserTest.java",
"license": "gpl-2.0",
"size": 15478
} | [
"com.android.ddmlib.testrunner.ITestRunListener",
"java.util.Collections"
] | import com.android.ddmlib.testrunner.ITestRunListener; import java.util.Collections; | import com.android.ddmlib.testrunner.*; import java.util.*; | [
"com.android.ddmlib",
"java.util"
] | com.android.ddmlib; java.util; | 1,848,811 |
public static Element formalItemTitle(
final SFormalItemTitle s)
{
NullCheck.notNull(s, "Title");
final Element e =
new Element("s:formal-item-title", SXML.XML_URI.toString());
e.appendChild(s.getActual().toString());
return e;
} | static Element function( final SFormalItemTitle s) { NullCheck.notNull(s, "Title"); final Element e = new Element(STR, SXML.XML_URI.toString()); e.appendChild(s.getActual().toString()); return e; } | /**
* Serialize the given element to XML.
*
* @param s
* The element
* @return An XML element
*/ | Serialize the given element to XML | formalItemTitle | {
"repo_name": "io7m/jstructural",
"path": "io7m-jstructural-xom/src/main/java/com/io7m/jstructural/xom/SDocumentSerializer.java",
"license": "isc",
"size": 36816
} | [
"com.io7m.jnull.NullCheck",
"com.io7m.jstructural.core.SFormalItemTitle",
"nu.xom.Element"
] | import com.io7m.jnull.NullCheck; import com.io7m.jstructural.core.SFormalItemTitle; import nu.xom.Element; | import com.io7m.jnull.*; import com.io7m.jstructural.core.*; import nu.xom.*; | [
"com.io7m.jnull",
"com.io7m.jstructural",
"nu.xom"
] | com.io7m.jnull; com.io7m.jstructural; nu.xom; | 710,532 |
public static void log (String category, String source, String message, int level)
{
if (categories == null)
{
return;
}
if (! categories.containsKey (category) || level < logLevel)
{
return;
}
List loggerlist = (List) categories.get (category);
for (int i = 0; i < loggerlist.size (); ++i)
{
((Logger) loggers.get (loggerlist.get (i))).log (category, source, message, level);
}
} | static void function (String category, String source, String message, int level) { if (categories == null) { return; } if (! categories.containsKey (category) level < logLevel) { return; } List loggerlist = (List) categories.get (category); for (int i = 0; i < loggerlist.size (); ++i) { ((Logger) loggers.get (loggerlist.get (i))).log (category, source, message, level); } } | /**
* Send a log message to the logger.
*
* @param category The category of the log message.
* @param source A description of the source of this log message.
* @param message The log message itself.
* @param level The level of the log message.
*/ | Send a log message to the logger | log | {
"repo_name": "grappendorf/openmetix",
"path": "src/java/de/iritgo/openmetix/core/logger/Log.java",
"license": "gpl-2.0",
"size": 7655
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,187,374 |
public CmsUUID getParentId() {
return m_parentId;
}
| CmsUUID function() { return m_parentId; } | /**
* Returns the parent group id of this group.<p>
*
* @return the parent group id of this group
*/ | Returns the parent group id of this group | getParentId | {
"repo_name": "comundus/opencms-comundus",
"path": "src/main/java/org/opencms/file/CmsGroup.java",
"license": "lgpl-2.1",
"size": 7590
} | [
"org.opencms.util.CmsUUID"
] | import org.opencms.util.CmsUUID; | import org.opencms.util.*; | [
"org.opencms.util"
] | org.opencms.util; | 2,434,881 |
@NonNull
public Event processEvent(final Event event) {
final Event processedEvent = mCombinerChain.processEvent(mEvents, event);
// The retained state of the combiner chain may have changed while processing the event,
// so we need to update our cache.
refreshTypedWordCache();
mEvents.add(event);
return processedEvent;
} | Event function(final Event event) { final Event processedEvent = mCombinerChain.processEvent(mEvents, event); refreshTypedWordCache(); mEvents.add(event); return processedEvent; } | /**
* Process an event and return an event, and return a processed event to apply.
* @param event the unprocessed event.
* @return the processed event. Never null, but may be marked as consumed.
*/ | Process an event and return an event, and return a processed event to apply | processEvent | {
"repo_name": "vorgoron/LatinIME-extended-with-Russian-languages",
"path": "app/src/main/java/com/udmurtlyk/extrainputmethod/latin/WordComposer.java",
"license": "apache-2.0",
"size": 20102
} | [
"com.udmurtlyk.extrainputmethod.event.Event"
] | import com.udmurtlyk.extrainputmethod.event.Event; | import com.udmurtlyk.extrainputmethod.event.*; | [
"com.udmurtlyk.extrainputmethod"
] | com.udmurtlyk.extrainputmethod; | 2,196 |
public double[] getDataRowForProbeID(
Connection connection,
String probeId)
throws SQLException
{
// build the query
String probeSelectStatementString =
"SELECT * from " + DATA_TABLE_NAME + " WHERE " +
COL_NAME_PREFIX + 0 + " = ?";
PreparedStatement probeSelectStatement =
connection.prepareStatement(probeSelectStatementString);
probeSelectStatement.setString(1, probeId);
// run the query
ResultSet results = probeSelectStatement.executeQuery();
try
{
if(results.next())
{
int columnCount = results.getMetaData().getColumnCount();
double[] dataRow = new double[columnCount - 1];
// there are two reasons for the weird indexing
// 1) JDBC uses 1-based indexing
// 2) we're skipping over the primary key
for(int sqlCol = 2; sqlCol <= columnCount; sqlCol++)
{
dataRow[sqlCol - 2] = results.getDouble(sqlCol);
}
return dataRow;
}
else
{
// could not find the given probe
return null;
}
}
finally
{
probeSelectStatement.close();
results.close();
}
} | double[] function( Connection connection, String probeId) throws SQLException { String probeSelectStatementString = STR + DATA_TABLE_NAME + STR + COL_NAME_PREFIX + 0 + STR; PreparedStatement probeSelectStatement = connection.prepareStatement(probeSelectStatementString); probeSelectStatement.setString(1, probeId); ResultSet results = probeSelectStatement.executeQuery(); try { if(results.next()) { int columnCount = results.getMetaData().getColumnCount(); double[] dataRow = new double[columnCount - 1]; for(int sqlCol = 2; sqlCol <= columnCount; sqlCol++) { dataRow[sqlCol - 2] = results.getDouble(sqlCol); } return dataRow; } else { return null; } } finally { probeSelectStatement.close(); results.close(); } } | /**
* Gets the data row for the given probe. This includes the probe ID
* plus all of the probe values
* @param connection
* the connection
* @param probeId
* the probe ID
* @return
* the data
* @throws SQLException
* if JDBC doesn't like what we're trying to do
*/ | Gets the data row for the given probe. This includes the probe ID plus all of the probe values | getDataRowForProbeID | {
"repo_name": "cgd/pub-array",
"path": "modules/pub-array-core/src/java/org/jax/pubarray/db/PersistenceManager.java",
"license": "gpl-3.0",
"size": 80927
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,215,060 |
ExceptionHandler getExceptionHandler();
| ExceptionHandler getExceptionHandler(); | /**
* Returns an exception handler that may be used to handle exceptions.
* Guaranteed not to return null.
*/ | Returns an exception handler that may be used to handle exceptions. Guaranteed not to return null | getExceptionHandler | {
"repo_name": "smaccm/smaccm",
"path": "fm-workbench/simulator/edu.uah.rsesc.aadlsimulator/src/edu/uah/rsesc/aadlsimulator/services/SimulationService.java",
"license": "bsd-3-clause",
"size": 3060
} | [
"edu.uah.rsesc.aadlsimulator.ExceptionHandler"
] | import edu.uah.rsesc.aadlsimulator.ExceptionHandler; | import edu.uah.rsesc.aadlsimulator.*; | [
"edu.uah.rsesc"
] | edu.uah.rsesc; | 184,490 |
public void testSetAllowedValuesDouble_N01()
{
boolean result = true;
try
{
simulatorResourceServer.addAttributeDouble(KEY, 10.5);
}
catch (Exception e)
{
result = false;
e.printStackTrace();
}
Vector<Double> values = new Vector<Double>();
values.add(11.5);
values.add(10.5);
values.add(20.5);
values.add(50.5);
try
{
simulatorResourceServer.setAllowedValuesDouble(KEY, values);
}
catch (Exception e)
{
result = false;
e.printStackTrace();
}
result = result && Double.parseDouble(getValue(KEY) + "") == 10.5;
try
{
simulatorResourceServer.updateAttributeDouble(KEY, 2.2);
result = false;
}
catch (Exception e)
{
result = true;
}
result = result && Double.parseDouble(getValue(KEY) + "") == 10.5;
assertTrue(result);
} | void function() { boolean result = true; try { simulatorResourceServer.addAttributeDouble(KEY, 10.5); } catch (Exception e) { result = false; e.printStackTrace(); } Vector<Double> values = new Vector<Double>(); values.add(11.5); values.add(10.5); values.add(20.5); values.add(50.5); try { simulatorResourceServer.setAllowedValuesDouble(KEY, values); } catch (Exception e) { result = false; e.printStackTrace(); } result = result && Double.parseDouble(getValue(KEY) + STR") == 10.5; assertTrue(result); } | /**
* Try setting with out of range
*/ | Try setting with out of range | testSetAllowedValuesDouble_N01 | {
"repo_name": "tjaffri/msiot-samples",
"path": "AllJoyn/Samples/OICAdapter/iotivity-1.0.0/service/simulator/unittests/SimulatorTest/src/org/oic/simulator/serviceprovider/test/SimlatorResourceServerTest.java",
"license": "mit",
"size": 22204
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,349,027 |
public static void main(String[] args) {
EnvironmentInformation.logEnvironmentInfo(LOG, "YARN ApplicationMaster / ResourceManager / JobManager", args);
SignalHandler.register(LOG);
JvmShutdownSafeguard.installAsShutdownHook(LOG);
// run and exit with the proper return code
int returnCode = new YarnApplicationMasterRunner().run(args);
System.exit(returnCode);
} | static void function(String[] args) { EnvironmentInformation.logEnvironmentInfo(LOG, STR, args); SignalHandler.register(LOG); JvmShutdownSafeguard.installAsShutdownHook(LOG); int returnCode = new YarnApplicationMasterRunner().run(args); System.exit(returnCode); } | /**
* The entry point for the YARN application master.
*
* @param args The command line arguments.
*/ | The entry point for the YARN application master | main | {
"repo_name": "mylog00/flink",
"path": "flink-yarn/src/main/java/org/apache/flink/yarn/YarnApplicationMasterRunner.java",
"license": "apache-2.0",
"size": 21335
} | [
"org.apache.flink.runtime.util.EnvironmentInformation",
"org.apache.flink.runtime.util.JvmShutdownSafeguard",
"org.apache.flink.runtime.util.SignalHandler"
] | import org.apache.flink.runtime.util.EnvironmentInformation; import org.apache.flink.runtime.util.JvmShutdownSafeguard; import org.apache.flink.runtime.util.SignalHandler; | import org.apache.flink.runtime.util.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,226,424 |
public static java.util.List extractGpToPracticeList(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.GPPracticesLiteVoCollection voCollection)
{
return extractGpToPracticeList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.GPPracticesLiteVoCollection voCollection) { return extractGpToPracticeList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.core.resource.domain.objects.GpToPractice list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.core.resource.domain.objects.GpToPractice list from the value object collection | extractGpToPracticeList | {
"repo_name": "open-health-hub/openmaxims-linux",
"path": "openmaxims_workspace/ValueObjects/src/ims/core/vo/domain/GPPracticesLiteVoAssembler.java",
"license": "agpl-3.0",
"size": 16580
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,264,894 |
public ContentData getContentDataForRead(int version, String path); | ContentData function(int version, String path); | /**
* Get the ContentData on a file.
* @param version The version to look under.
* @param path The path to the file.
* @return The ContentData corresponding to the file.
*/ | Get the ContentData on a file | getContentDataForRead | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/repository/source/java/org/alfresco/repo/avm/AVMStore.java",
"license": "lgpl-3.0",
"size": 17578
} | [
"org.alfresco.service.cmr.repository.ContentData"
] | import org.alfresco.service.cmr.repository.ContentData; | import org.alfresco.service.cmr.repository.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 2,898,228 |
private void generateNames(Set<Property> props, Set<String> reservedNames) {
NameGenerator nameGen = new NameGenerator(
reservedNames, "", reservedCharacters);
for (Property p : props) {
if (generatePseudoNames) {
p.newName = "$" + p.oldName + "$";
} else {
// If we haven't already given this property a reusable name.
if (p.newName == null) {
p.newName = nameGen.generateNextName();
}
}
reservedNames.add(p.newName);
compiler.addToDebugLog(p.oldName + " => " + p.newName);
}
} | void function(Set<Property> props, Set<String> reservedNames) { NameGenerator nameGen = new NameGenerator( reservedNames, STR$STR$STR => " + p.newName); } } | /**
* Generates new names for properties.
*
* @param props Properties to generate new names for
* @param reservedNames A set of names to which properties should not be
* renamed
*/ | Generates new names for properties | generateNames | {
"repo_name": "abdullah38rcc/closure-compiler",
"path": "src/com/google/javascript/jscomp/RenameProperties.java",
"license": "apache-2.0",
"size": 20111
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,568,650 |
private void writeSourceRepository( XMLWriter writer, MavenProject project, String connection )
{
ScmRepository repository = getScmRepository( connection );
DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), "repository" );
if ( isScmSystem( repository, "cvs" ) )
{
DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), "CVSRepository" );
CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) repository.getProviderRepository();
DoapUtil.writeElement( writer, doapOptions.getXmlnsPrefix(), "anon-root", cvsRepo.getCvsRoot() );
DoapUtil.writeElement( writer, doapOptions.getXmlnsPrefix(), "module", cvsRepo.getModule() );
}
else if ( isScmSystem( repository, "svn" ) )
{
DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), "SVNRepository" );
SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository();
DoapUtil.writeRdfResourceElement( writer, doapOptions.getXmlnsPrefix(), "location", svnRepo.getUrl() );
}
else
{
DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), "Repository" );
if ( connection.length() < 4 )
{
throw new IllegalArgumentException( "The source repository connection is too short." );
}
DoapUtil.writeRdfResourceElement( writer, doapOptions.getXmlnsPrefix(), "location",
connection.substring( 4 ) );
}
DoapUtil.writeRdfResourceElement( writer, doapOptions.getXmlnsPrefix(), "browse", project.getScm().getUrl() );
writer.endElement(); // CVSRepository || SVNRepository || Repository
writer.endElement(); // repository
} | void function( XMLWriter writer, MavenProject project, String connection ) { ScmRepository repository = getScmRepository( connection ); DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), STR ); if ( isScmSystem( repository, "cvs" ) ) { DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), STR ); CvsScmProviderRepository cvsRepo = (CvsScmProviderRepository) repository.getProviderRepository(); DoapUtil.writeElement( writer, doapOptions.getXmlnsPrefix(), STR, cvsRepo.getCvsRoot() ); DoapUtil.writeElement( writer, doapOptions.getXmlnsPrefix(), STR, cvsRepo.getModule() ); } else if ( isScmSystem( repository, "svn" ) ) { DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), STR ); SvnScmProviderRepository svnRepo = (SvnScmProviderRepository) repository.getProviderRepository(); DoapUtil.writeRdfResourceElement( writer, doapOptions.getXmlnsPrefix(), STR, svnRepo.getUrl() ); } else { DoapUtil.writeStartElement( writer, doapOptions.getXmlnsPrefix(), STR ); if ( connection.length() < 4 ) { throw new IllegalArgumentException( STR ); } DoapUtil.writeRdfResourceElement( writer, doapOptions.getXmlnsPrefix(), STR, connection.substring( 4 ) ); } DoapUtil.writeRdfResourceElement( writer, doapOptions.getXmlnsPrefix(), STR, project.getScm().getUrl() ); writer.endElement(); writer.endElement(); } | /**
* Write a DOAP repository, for instance:
* <p/>
* <pre>
* <repository>
* <SVNRepository>
* <location rdf:resource="http://svn.apache.org/repos/asf/maven/components/trunk/"/>
* <browse rdf:resource="http://svn.apache.org/viewcvs.cgi/maven/components/trunk/"/>
* </SVNRepository>
* </repository>
* </pre>
*
* @param writer not null
* @param project the Maven project, not null
* @param connection not null
* @see <a href="http://usefulinc.com/ns/doap#Repository">http://usefulinc.com/ns/doap#Repository</a>
* @see <a href="http://usefulinc.com/ns/doap#CVSRepository">http://usefulinc.com/ns/doap#CVSRepository</a>
* @see <a href="http://usefulinc.com/ns/doap#SVNRepository">http://usefulinc.com/ns/doap#SVNRepository</a>
*/ | Write a DOAP repository, for instance: <code> <repository> <SVNRepository> <location rdf:resource="HREF"/> <browse rdf:resource="HREF"/> </SVNRepository> </repository> </code> | writeSourceRepository | {
"repo_name": "restlet/maven-plugins",
"path": "maven-doap-plugin/src/main/java/org/apache/maven/plugin/doap/DoapMojo.java",
"license": "apache-2.0",
"size": 99407
} | [
"org.apache.maven.project.MavenProject",
"org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository",
"org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository",
"org.apache.maven.scm.repository.ScmRepository",
"org.codehaus.plexus.util.xml.XMLWriter"
] | import org.apache.maven.project.MavenProject; import org.apache.maven.scm.provider.cvslib.repository.CvsScmProviderRepository; import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository; import org.apache.maven.scm.repository.ScmRepository; import org.codehaus.plexus.util.xml.XMLWriter; | import org.apache.maven.project.*; import org.apache.maven.scm.provider.cvslib.repository.*; import org.apache.maven.scm.provider.svn.repository.*; import org.apache.maven.scm.repository.*; import org.codehaus.plexus.util.xml.*; | [
"org.apache.maven",
"org.codehaus.plexus"
] | org.apache.maven; org.codehaus.plexus; | 778,131 |
public boolean isOthers(final Environmental E); | boolean function(final Environmental E); | /**
* Returns whether the given Environmental object is neither the source
* nor the target of this message.
* @see com.suscipio_solutions.consecro_mud.core.interfaces.Environmental
* @see com.suscipio_solutions.consecro_mud.Common.interfaces.CMMsg#source()
* @see com.suscipio_solutions.consecro_mud.Common.interfaces.CMMsg#target()
* @param E the Environmental to inspect, may not be null
* @return whether the given E is neither the source nor target of this message
*/ | Returns whether the given Environmental object is neither the source nor the target of this message | isOthers | {
"repo_name": "ConsecroMUD/ConsecroMUD",
"path": "com/suscipio_solutions/consecro_mud/Common/interfaces/CMMsg.java",
"license": "apache-2.0",
"size": 72426
} | [
"com.suscipio_solutions.consecro_mud.core.interfaces.Environmental"
] | import com.suscipio_solutions.consecro_mud.core.interfaces.Environmental; | import com.suscipio_solutions.consecro_mud.core.interfaces.*; | [
"com.suscipio_solutions.consecro_mud"
] | com.suscipio_solutions.consecro_mud; | 1,033,064 |
private void resizeContainer(Rect2D container, Rect2D rect0, Rect2D rect1)
{
// Compute minimum and maximum x coords to get containing width
final float minX = Math.min(rect0.getX(), rect1.getX());
final float maxX = Math.max(rect0.getX() + rect0.getWidth(), rect1.getX() + rect1.getWidth());
// Compute minimum and maximum y coords to get containing height
final float minY = Math.min(rect0.getY(), rect1.getY());
final float maxY = Math.max(rect0.getY() + rect0.getHeight(), rect1.getY() + rect1.getHeight());
// Resize and relocate container to wrap left and right Nodes
container.setWidth(maxX - minX);
container.setHeight(maxY - minY);
container.moveTo(minX, minY);
} | void function(Rect2D container, Rect2D rect0, Rect2D rect1) { final float minX = Math.min(rect0.getX(), rect1.getX()); final float maxX = Math.max(rect0.getX() + rect0.getWidth(), rect1.getX() + rect1.getWidth()); final float minY = Math.min(rect0.getY(), rect1.getY()); final float maxY = Math.max(rect0.getY() + rect0.getHeight(), rect1.getY() + rect1.getHeight()); container.setWidth(maxX - minX); container.setHeight(maxY - minY); container.moveTo(minX, minY); } | /**
* <p>Change a given {@link Rect2D}'s size to contain two other Rect2Ds.</p>
*
* @param container Rect2D to resize.
* @param rect0 contained Rect2D.
* @param rect1 other contained Rect2D.
*/ | Change a given <code>Rect2D</code>'s size to contain two other Rect2Ds | resizeContainer | {
"repo_name": "joltix/Cinnamon",
"path": "com/cinnamon/object/BoundingTree.java",
"license": "mit",
"size": 20383
} | [
"com.cinnamon.utils.Rect2D"
] | import com.cinnamon.utils.Rect2D; | import com.cinnamon.utils.*; | [
"com.cinnamon.utils"
] | com.cinnamon.utils; | 1,880,171 |
Mono<PagedResponse<QueueProperties>> listQueuesNextPage(String continuationToken, Context context) {
if (continuationToken == null || continuationToken.isEmpty()) {
return Mono.empty();
}
try {
final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, AZ_TRACING_NAMESPACE_VALUE);
final int skip = Integer.parseInt(continuationToken);
return listQueues(skip, withTracing);
} catch (RuntimeException e) {
return monoError(logger, e);
}
} | Mono<PagedResponse<QueueProperties>> listQueuesNextPage(String continuationToken, Context context) { if (continuationToken == null continuationToken.isEmpty()) { return Mono.empty(); } try { final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, AZ_TRACING_NAMESPACE_VALUE); final int skip = Integer.parseInt(continuationToken); return listQueues(skip, withTracing); } catch (RuntimeException e) { return monoError(logger, e); } } | /**
* Gets the next page of queues with context.
*
* @param continuationToken Number of items to skip in feed.
* @param context Context to pass into request.
*
* @return A Mono that completes with a page of queues or empty if there are no items left.
*/ | Gets the next page of queues with context | listQueuesNextPage | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/servicebus/azure-messaging-servicebus/src/main/java/com/azure/messaging/servicebus/administration/ServiceBusAdministrationAsyncClient.java",
"license": "mit",
"size": 144140
} | [
"com.azure.core.http.rest.PagedResponse",
"com.azure.core.util.Context",
"com.azure.core.util.FluxUtil",
"com.azure.messaging.servicebus.administration.models.QueueProperties"
] | import com.azure.core.http.rest.PagedResponse; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.messaging.servicebus.administration.models.QueueProperties; | import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.messaging.servicebus.administration.models.*; | [
"com.azure.core",
"com.azure.messaging"
] | com.azure.core; com.azure.messaging; | 2,726,364 |
public boolean cancel(Task p) {
lock.lock();
try { try {
LOGGER.log(Level.FINE, "Cancelling {0}", p);
for (WaitingItem item : waitingList) {
if (item.task.equals(p)) {
return item.cancel(this);
}
}
// use bitwise-OR to make sure that both branches get evaluated all the time
return blockedProjects.cancel(p) != null | buildables.cancel(p) != null;
} finally { updateSnapshot(); } } finally {
lock.unlock();
}
} | boolean function(Task p) { lock.lock(); try { try { LOGGER.log(Level.FINE, STR, p); for (WaitingItem item : waitingList) { if (item.task.equals(p)) { return item.cancel(this); } } return blockedProjects.cancel(p) != null buildables.cancel(p) != null; } finally { updateSnapshot(); } } finally { lock.unlock(); } } | /**
* Cancels the item in the queue. If the item is scheduled more than once, cancels the first occurrence.
*
* @return true if the project was indeed in the queue and was removed.
* false if this was no-op.
*/ | Cancels the item in the queue. If the item is scheduled more than once, cancels the first occurrence | cancel | {
"repo_name": "amuniz/jenkins",
"path": "core/src/main/java/hudson/model/Queue.java",
"license": "mit",
"size": 115272
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,016,785 |
public boolean similar(Object other) {
try {
if (!(other instanceof JSONObject)) {
return false;
}
Set<String> set = this.keySet();
if (!set.equals(((JSONObject)other).keySet())) {
return false;
}
Iterator<String> iterator = set.iterator();
while (iterator.hasNext()) {
String name = iterator.next();
Object valueThis = this.get(name);
Object valueOther = ((JSONObject)other).get(name);
if (valueThis instanceof JSONObject) {
if (!((JSONObject)valueThis).similar(valueOther)) {
return false;
}
} else if (valueThis instanceof JSONArray) {
if (!((JSONArray)valueThis).similar(valueOther)) {
return false;
}
} else if (!valueThis.equals(valueOther)) {
return false;
}
}
return true;
} catch (Throwable exception) {
return false;
}
} | boolean function(Object other) { try { if (!(other instanceof JSONObject)) { return false; } Set<String> set = this.keySet(); if (!set.equals(((JSONObject)other).keySet())) { return false; } Iterator<String> iterator = set.iterator(); while (iterator.hasNext()) { String name = iterator.next(); Object valueThis = this.get(name); Object valueOther = ((JSONObject)other).get(name); if (valueThis instanceof JSONObject) { if (!((JSONObject)valueThis).similar(valueOther)) { return false; } } else if (valueThis instanceof JSONArray) { if (!((JSONArray)valueThis).similar(valueOther)) { return false; } } else if (!valueThis.equals(valueOther)) { return false; } } return true; } catch (Throwable exception) { return false; } } | /**
* Determine if two JSONObjects are similar.
* They must contain the same set of names which must be associated with
* similar values.
*
* @param other The other JSONObject
* @return true if they are equal
*/ | Determine if two JSONObjects are similar. They must contain the same set of names which must be associated with similar values | similar | {
"repo_name": "Sixstring982/ggj2015",
"path": "src/org/json/JSONObject.java",
"license": "gpl-2.0",
"size": 57492
} | [
"java.util.Iterator",
"java.util.Set"
] | import java.util.Iterator; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,361,810 |
for (final NotEmptyAlternateIfOtherIsNotEmptyTestBean testBean : NotEmptyAlternateIfOinTestCases
.getCompareFieldEmptyBeans()) {
super.validationTest(testBean, true, null);
}
} | for (final NotEmptyAlternateIfOtherIsNotEmptyTestBean testBean : NotEmptyAlternateIfOinTestCases .getCompareFieldEmptyBeans()) { super.validationTest(testBean, true, null); } } | /**
* the compare field is empty, alternate fields can be filled in every way.
*/ | the compare field is empty, alternate fields can be filled in every way | testCompareIsEmptyAlternateEverythingIsAllowed | {
"repo_name": "ManfredTremmel/mt-bean-validators",
"path": "src/test/java/de/knightsoftnet/validators/server/NotEmptyAlternateIfOtherIsNotEmptyTest.java",
"license": "apache-2.0",
"size": 2487
} | [
"de.knightsoftnet.validators.shared.beans.NotEmptyAlternateIfOtherIsNotEmptyTestBean",
"de.knightsoftnet.validators.shared.testcases.NotEmptyAlternateIfOinTestCases"
] | import de.knightsoftnet.validators.shared.beans.NotEmptyAlternateIfOtherIsNotEmptyTestBean; import de.knightsoftnet.validators.shared.testcases.NotEmptyAlternateIfOinTestCases; | import de.knightsoftnet.validators.shared.beans.*; import de.knightsoftnet.validators.shared.testcases.*; | [
"de.knightsoftnet.validators"
] | de.knightsoftnet.validators; | 2,213,744 |
void setObservationDate(Date dtg); | void setObservationDate(Date dtg); | /**
* The date the annotator annotated this observation. Got it ;-)
* @param dtg
*/ | The date the annotator annotated this observation. Got it ;-) | setObservationDate | {
"repo_name": "hohonuuli/vars",
"path": "vars-core/src/main/java/vars/annotation/Observation.java",
"license": "lgpl-2.1",
"size": 3383
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,660,710 |
@Override
public void afterPropertiesSet() throws JMException, IOException
{
try
{
super.afterPropertiesSet();
if (logger.isInfoEnabled())
{
logger.info("Created JMX serverConnector");
}
}
catch (Exception e)
{
if (logger.isWarnEnabled())
{
logger.warn("JMX ServerConnector can't be initialized due to: ", e);
}
}
}
| void function() throws JMException, IOException { try { super.afterPropertiesSet(); if (logger.isInfoEnabled()) { logger.info(STR); } } catch (Exception e) { if (logger.isWarnEnabled()) { logger.warn(STR, e); } } } | /**
* Wraps original initialization method to log errors, rather than having
* exceptions occur within the Spring framework itself (this would cause the entire webapp to fail)
*
* @see org.springframework.jmx.support.ConnectorServerFactoryBean#afterPropertiesSet()
*/ | Wraps original initialization method to log errors, rather than having exceptions occur within the Spring framework itself (this would cause the entire webapp to fail) | afterPropertiesSet | {
"repo_name": "loftuxab/community-edition-old",
"path": "projects/mbeans/source/java/org/alfresco/mbeans/ConnectorServerFactory.java",
"license": "lgpl-3.0",
"size": 2199
} | [
"java.io.IOException",
"javax.management.JMException"
] | import java.io.IOException; import javax.management.JMException; | import java.io.*; import javax.management.*; | [
"java.io",
"javax.management"
] | java.io; javax.management; | 1,876,196 |
private static String multipart(final String name, final String content) {
return Joiner.on("\r\n").join(
"--AaB03x",
"Content-Disposition: form-data; name=\"name\"",
"",
name,
"--AaB03x",
Joiner.on("; ").join(
"Content-Disposition: form-data",
"name=\"file\"",
String.format("filename=\"%s\"", name)
),
"Content-Transfer-Encoding: utf-8",
"",
content,
"--AaB03x--"
);
} | static String function(final String name, final String content) { return Joiner.on("\r\n").join( STR, STRname\STR", name, STR, Joiner.on("; STRContent-Disposition: form-dataSTRname=\"file\"STRfilename=\"%s\"STRContent-Transfer-Encoding: utf-8STRSTR--AaB03x--" ); } | /**
* Multipart request body.
* @param name File name
* @param content File content
* @return Request body
*/ | Multipart request body | multipart | {
"repo_name": "Nerodesk/nerodesk",
"path": "src/test/java/com/libre/takes/TkAppTest.java",
"license": "bsd-3-clause",
"size": 17158
} | [
"com.google.common.base.Joiner"
] | import com.google.common.base.Joiner; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,710,056 |
public void renderCalendar(boolean updateDate) {
super.setStylePrimaryName(
parent.getStylePrimaryName() + "-calendarpanel");
if (focusedDate == null) {
Date now = new Date();
// focusedDate must have zero hours, mins, secs, millisecs
focusedDate = new FocusedDate(now.getYear(), now.getMonth(),
now.getDate());
displayedMonth = new FocusedDate(now.getYear(), now.getMonth(), 1);
}
if (updateDate && getResolution().getCalendarField() <= Resolution.MONTH
.getCalendarField() && focusChangeListener != null) {
focusChangeListener.focusChanged(new Date(focusedDate.getTime()));
}
final boolean needsMonth = getResolution()
.getCalendarField() > Resolution.YEAR.getCalendarField();
boolean needsBody = getResolution().getCalendarField() >= Resolution.DAY
.getCalendarField();
buildCalendarHeader(needsMonth);
clearCalendarBody(!needsBody);
if (needsBody) {
buildCalendarBody();
}
if (isTimeSelectorNeeded()) {
time = new VTime();
setWidget(2, 0, time);
getFlexCellFormatter().setColSpan(2, 0, 5);
getFlexCellFormatter().setStyleName(2, 0,
parent.getStylePrimaryName() + "-calendarpanel-time");
} else if (time != null) {
remove(time);
}
initialRenderDone = true;
} | void function(boolean updateDate) { super.setStylePrimaryName( parent.getStylePrimaryName() + STR); if (focusedDate == null) { Date now = new Date(); focusedDate = new FocusedDate(now.getYear(), now.getMonth(), now.getDate()); displayedMonth = new FocusedDate(now.getYear(), now.getMonth(), 1); } if (updateDate && getResolution().getCalendarField() <= Resolution.MONTH .getCalendarField() && focusChangeListener != null) { focusChangeListener.focusChanged(new Date(focusedDate.getTime())); } final boolean needsMonth = getResolution() .getCalendarField() > Resolution.YEAR.getCalendarField(); boolean needsBody = getResolution().getCalendarField() >= Resolution.DAY .getCalendarField(); buildCalendarHeader(needsMonth); clearCalendarBody(!needsBody); if (needsBody) { buildCalendarBody(); } if (isTimeSelectorNeeded()) { time = new VTime(); setWidget(2, 0, time); getFlexCellFormatter().setColSpan(2, 0, 5); getFlexCellFormatter().setStyleName(2, 0, parent.getStylePrimaryName() + STR); } else if (time != null) { remove(time); } initialRenderDone = true; } | /**
* For internal use only. May be removed or replaced in the future.
*
* Updates the calendar and text field with the selected dates.
*
* @param updateDate
* The value false prevents setting the selected date of the
* calendar based on focusedDate. That can be used when only the
* resolution of the calendar is changed and no date has been
* selected.
*/ | For internal use only. May be removed or replaced in the future. Updates the calendar and text field with the selected dates | renderCalendar | {
"repo_name": "Darsstar/framework",
"path": "compatibility-client/src/main/java/com/vaadin/v7/client/ui/VCalendarPanel.java",
"license": "apache-2.0",
"size": 74958
} | [
"com.vaadin.v7.shared.ui.datefield.Resolution",
"java.util.Date"
] | import com.vaadin.v7.shared.ui.datefield.Resolution; import java.util.Date; | import com.vaadin.v7.shared.ui.datefield.*; import java.util.*; | [
"com.vaadin.v7",
"java.util"
] | com.vaadin.v7; java.util; | 258,608 |
@Test
public void testRatingWihtKingdomSynonym() throws IOException {
LinneanClassification cn1 = new NameUsageMatch();
cn1.setKingdom("Plantae");
cn1.setPhylum("Dinophyta");
cn1.setClazz("Dinophyceae");
cn1.setOrder("Gonyaulacales");
LinneanClassification cn2 = new NameUsageMatch();
cn2.setKingdom("Plantae");
cn2.setPhylum("Dinophyta");
cn2.setClazz("Dinophyceae");
cn2.setOrder("Gonyaulacales");
// test identical
int score = matcher.classificationSimilarity(cn1, cn2);
assertTrue(score > 45);
// test kingdom synonym
cn2.setKingdom("Plants");
cn2.setPhylum("Dinophyta");
cn2.setClazz("");
cn2.setOrder("");
// test identical
score = matcher.classificationSimilarity(cn1, cn2);
assertTrue(score > 15);
// test vague kingdom
cn2.setKingdom("Protozoa");
score = matcher.classificationSimilarity(cn1, cn2);
assertTrue(score > -10);
assertTrue(score <= 0);
// test very different kingdom
cn2.setKingdom("Animalia");
score = matcher.classificationSimilarity(cn1, cn2);
assertTrue(score <= -15);
} | void function() throws IOException { LinneanClassification cn1 = new NameUsageMatch(); cn1.setKingdom(STR); cn1.setPhylum(STR); cn1.setClazz(STR); cn1.setOrder(STR); LinneanClassification cn2 = new NameUsageMatch(); cn2.setKingdom(STR); cn2.setPhylum(STR); cn2.setClazz(STR); cn2.setOrder(STR); int score = matcher.classificationSimilarity(cn1, cn2); assertTrue(score > 45); cn2.setKingdom(STR); cn2.setPhylum(STR); cn2.setClazz(STRSTRProtozoaSTRAnimalia"); score = matcher.classificationSimilarity(cn1, cn2); assertTrue(score <= -15); } | /**
* compare
* Plantae;Dinophyta;Dinophyceae;Gonyaulacales;;;
* with
* Protozoa;Dinophyta;;;;;
*
* @throws java.io.IOException
*/ | compare Plantae;Dinophyta;Dinophyceae;Gonyaulacales;;; with Protozoa;Dinophyta;;;; | testRatingWihtKingdomSynonym | {
"repo_name": "fmendezh/checklistbank",
"path": "checklistbank-nub/src/test/java/org/gbif/nub/lookup/NubMatchingServiceImplLegacyIT.java",
"license": "apache-2.0",
"size": 6355
} | [
"java.io.IOException",
"org.gbif.api.model.checklistbank.NameUsageMatch",
"org.gbif.api.model.common.LinneanClassification",
"org.junit.Assert"
] | import java.io.IOException; import org.gbif.api.model.checklistbank.NameUsageMatch; import org.gbif.api.model.common.LinneanClassification; import org.junit.Assert; | import java.io.*; import org.gbif.api.model.checklistbank.*; import org.gbif.api.model.common.*; import org.junit.*; | [
"java.io",
"org.gbif.api",
"org.junit"
] | java.io; org.gbif.api; org.junit; | 2,448,770 |
public void getData() {
if ( isDebug() ) {
logDebug( "getting fields info..." );
}
wLimit.setText( input.getRowLimit() );
wNeverEnding.setSelection( input.isNeverEnding() );
wInterval.setText( Const.NVL( input.getIntervalInMs(), "" ) );
wRowTimeField.setText( Const.NVL( input.getRowTimeField(), "" ) );
wLastTimeField.setText( Const.NVL( input.getLastTimeField(), "" ) );
for ( int i = 0; i < input.getFieldName().length; i++ ) {
if ( input.getFieldName()[i] != null ) {
TableItem item = wFields.table.getItem( i );
int col = 1;
item.setText( col++, input.getFieldName()[i] );
String type = input.getFieldType()[i];
String format = input.getFieldFormat()[i];
String length = input.getFieldLength()[i] < 0 ? "" : ( "" + input.getFieldLength()[i] );
String prec = input.getFieldPrecision()[i] < 0 ? "" : ( "" + input.getFieldPrecision()[i] );
String curr = input.getCurrency()[i];
String group = input.getGroup()[i];
String decim = input.getDecimal()[i];
String def = input.getValue()[i];
item.setText( col++, Const.NVL( type, "" ) );
item.setText( col++, Const.NVL( format, "" ) );
item.setText( col++, Const.NVL( length, "" ) );
item.setText( col++, Const.NVL( prec, "" ) );
item.setText( col++, Const.NVL( curr, "" ) );
item.setText( col++, Const.NVL( decim, "" ) );
item.setText( col++, Const.NVL( group, "" ) );
item.setText( col++, Const.NVL( def, "" ) );
item
.setText( col++, input.isSetEmptyString()[i]
? BaseMessages.getString( PKG, "System.Combo.Yes" ) : BaseMessages.getString(
PKG, "System.Combo.No" ) );
}
}
wFields.setRowNums();
wFields.optWidth( true );
setActive();
wStepname.selectAll();
wStepname.setFocus();
} | void function() { if ( isDebug() ) { logDebug( STR ); } wLimit.setText( input.getRowLimit() ); wNeverEnding.setSelection( input.isNeverEnding() ); wInterval.setText( Const.NVL( input.getIntervalInMs(), STRSTRSTRSTRSTRSTRSTRSTRSTRSTRSTRSTRSTRSTRSTRSystem.Combo.YesSTRSystem.Combo.No" ) ); } } wFields.setRowNums(); wFields.optWidth( true ); setActive(); wStepname.selectAll(); wStepname.setFocus(); } | /**
* Copy information from the meta-data input to the dialog fields.
*/ | Copy information from the meta-data input to the dialog fields | getData | {
"repo_name": "tkafalas/pentaho-kettle",
"path": "ui/src/main/java/org/pentaho/di/ui/trans/steps/rowgenerator/RowGeneratorDialog.java",
"license": "apache-2.0",
"size": 21171
} | [
"org.pentaho.di.core.Const"
] | import org.pentaho.di.core.Const; | import org.pentaho.di.core.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 134,987 |
public JsonObject getLeaderBoard(String modelId) throws InsightsCustomException {
try {
log.debug("Get Leaderboard: {}", modelId);
String url = h2oEndpoint+H2ORestApiUrls.LEADERBOARD_URL+modelId;
String response = RestApiHandler.doGet(url, null);
JsonObject jsonResponse = new Gson().fromJson(response, JsonObject.class);
JsonObject leaderboardTable = new Gson().fromJson(jsonResponse.get("leaderboard_table"), JsonObject.class);
JsonArray columns = new Gson().fromJson(leaderboardTable.get(COLUMNS), JsonArray.class);
columns.remove(0);
JsonArray data = new Gson().fromJson(leaderboardTable.get("data"), JsonArray.class);
data.remove(0);
JsonArray leaderboardArray = new JsonArray();
for (int i = 0; i < columns.size(); i++) {
JsonObject leaderboard = new JsonObject();
for(int j=0;j<columns.size();j++)
{
JsonObject colmn =columns.get(j).getAsJsonObject();
String colName=colmn.get("name").getAsString();
String colData=data.get(j).getAsJsonArray().get(i).getAsString();
leaderboard.addProperty(colName, colData);
}
leaderboardArray.add(leaderboard);
}
JsonObject finalResponse= new JsonObject();
finalResponse.add("data", leaderboardArray);
return finalResponse;
} catch (Exception e) {
log.error(e.getMessage());
throw new InsightsCustomException(e.getMessage());
}
} | JsonObject function(String modelId) throws InsightsCustomException { try { log.debug(STR, modelId); String url = h2oEndpoint+H2ORestApiUrls.LEADERBOARD_URL+modelId; String response = RestApiHandler.doGet(url, null); JsonObject jsonResponse = new Gson().fromJson(response, JsonObject.class); JsonObject leaderboardTable = new Gson().fromJson(jsonResponse.get(STR), JsonObject.class); JsonArray columns = new Gson().fromJson(leaderboardTable.get(COLUMNS), JsonArray.class); columns.remove(0); JsonArray data = new Gson().fromJson(leaderboardTable.get("data"), JsonArray.class); data.remove(0); JsonArray leaderboardArray = new JsonArray(); for (int i = 0; i < columns.size(); i++) { JsonObject leaderboard = new JsonObject(); for(int j=0;j<columns.size();j++) { JsonObject colmn =columns.get(j).getAsJsonObject(); String colName=colmn.get("name").getAsString(); String colData=data.get(j).getAsJsonArray().get(i).getAsString(); leaderboard.addProperty(colName, colData); } leaderboardArray.add(leaderboard); } JsonObject finalResponse= new JsonObject(); finalResponse.add("data", leaderboardArray); return finalResponse; } catch (Exception e) { log.error(e.getMessage()); throw new InsightsCustomException(e.getMessage()); } } | /** Get the leaderboard from modelId
* @param modelId
* @return
* @throws InsightsCustomException
*/ | Get the leaderboard from modelId | getLeaderBoard | {
"repo_name": "CognizantOneDevOps/Insights",
"path": "PlatformCommons/src/main/java/com/cognizant/devops/platformcommons/dal/ai/H2oApiCommunicator.java",
"license": "apache-2.0",
"size": 16595
} | [
"com.cognizant.devops.platformcommons.dal.RestApiHandler",
"com.cognizant.devops.platformcommons.exception.InsightsCustomException",
"com.google.gson.Gson",
"com.google.gson.JsonArray",
"com.google.gson.JsonObject"
] | import com.cognizant.devops.platformcommons.dal.RestApiHandler; import com.cognizant.devops.platformcommons.exception.InsightsCustomException; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; | import com.cognizant.devops.platformcommons.dal.*; import com.cognizant.devops.platformcommons.exception.*; import com.google.gson.*; | [
"com.cognizant.devops",
"com.google.gson"
] | com.cognizant.devops; com.google.gson; | 2,369,705 |
public void create(String namespaceId, String name, DatasetInstanceConfiguration props) throws Exception {
// Throws NamespaceNotFoundException if the namespace does not exist
Id.Namespace namespace = ConversionHelpers.toNamespaceId(namespaceId);
ensureNamespaceExists(namespace);
Id.DatasetInstance newInstance = ConversionHelpers.toDatasetInstanceId(namespaceId, name);
DatasetSpecification existing = instanceManager.get(newInstance);
if (existing != null && !allowDatasetUncheckedUpgrade) {
throw new DatasetAlreadyExistsException(newInstance);
}
DatasetTypeMeta typeMeta = getTypeInfo(namespace, props.getTypeName());
if (typeMeta == null) {
// Type not found in the instance's namespace and the system namespace. Bail out.
throw new DatasetTypeNotFoundException(ConversionHelpers.toDatasetTypeId(namespace, props.getTypeName()));
}
LOG.info("Creating dataset {}.{}, type name: {}, properties: {}",
namespaceId, name, props.getTypeName(), props.getProperties());
// Disable explore if the table already existed
if (existing != null) {
disableExplore(newInstance);
}
// Note how we execute configure() via opExecutorClient (outside of ds service) to isolate running user code
DatasetSpecification spec = opExecutorClient.create(newInstance, typeMeta,
DatasetProperties.builder()
.addAll(props.getProperties())
.build());
instanceManager.add(namespace, spec);
// Enable explore
enableExplore(newInstance, props);
} | void function(String namespaceId, String name, DatasetInstanceConfiguration props) throws Exception { Id.Namespace namespace = ConversionHelpers.toNamespaceId(namespaceId); ensureNamespaceExists(namespace); Id.DatasetInstance newInstance = ConversionHelpers.toDatasetInstanceId(namespaceId, name); DatasetSpecification existing = instanceManager.get(newInstance); if (existing != null && !allowDatasetUncheckedUpgrade) { throw new DatasetAlreadyExistsException(newInstance); } DatasetTypeMeta typeMeta = getTypeInfo(namespace, props.getTypeName()); if (typeMeta == null) { throw new DatasetTypeNotFoundException(ConversionHelpers.toDatasetTypeId(namespace, props.getTypeName())); } LOG.info(STR, namespaceId, name, props.getTypeName(), props.getProperties()); if (existing != null) { disableExplore(newInstance); } DatasetSpecification spec = opExecutorClient.create(newInstance, typeMeta, DatasetProperties.builder() .addAll(props.getProperties()) .build()); instanceManager.add(namespace, spec); enableExplore(newInstance, props); } | /**
* Creates a dataset instance.
*
* @param namespaceId the namespace to create the dataset instance in
* @param name the name of the new dataset instance
* @param props the properties for the new dataset instance
* @throws NamespaceNotFoundException if the specified namespace was not found
* @throws DatasetAlreadyExistsException if a dataset with the same name already exists
* @throws DatasetTypeNotFoundException if the dataset type was not found
* @throws Exception if something went wrong
*/ | Creates a dataset instance | create | {
"repo_name": "chtyim/cdap",
"path": "cdap-data-fabric/src/main/java/co/cask/cdap/data2/datafabric/dataset/service/DatasetInstanceService.java",
"license": "apache-2.0",
"size": 16896
} | [
"co.cask.cdap.api.dataset.DatasetProperties",
"co.cask.cdap.api.dataset.DatasetSpecification",
"co.cask.cdap.common.DatasetAlreadyExistsException",
"co.cask.cdap.common.DatasetTypeNotFoundException",
"co.cask.cdap.proto.DatasetInstanceConfiguration",
"co.cask.cdap.proto.DatasetTypeMeta",
"co.cask.cdap.proto.Id"
] | import co.cask.cdap.api.dataset.DatasetProperties; import co.cask.cdap.api.dataset.DatasetSpecification; import co.cask.cdap.common.DatasetAlreadyExistsException; import co.cask.cdap.common.DatasetTypeNotFoundException; import co.cask.cdap.proto.DatasetInstanceConfiguration; import co.cask.cdap.proto.DatasetTypeMeta; import co.cask.cdap.proto.Id; | import co.cask.cdap.api.dataset.*; import co.cask.cdap.common.*; import co.cask.cdap.proto.*; | [
"co.cask.cdap"
] | co.cask.cdap; | 1,128,749 |
public Timestamp getTransactionEntryProcessedTs() {
return transactionEntryProcessedTs;
}
| Timestamp function() { return transactionEntryProcessedTs; } | /**
* Gets the transactionEntryProcessedTs attribute.
*
* @return Returns the transactionEntryProcessedTs
*/ | Gets the transactionEntryProcessedTs attribute | getTransactionEntryProcessedTs | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/sys/businessobject/GeneralLedgerPendingEntry.java",
"license": "agpl-3.0",
"size": 34159
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 644,741 |
@SuppressWarnings("unchecked")
@Test(expected = CloudPoolDriverException.class)
public void testSetMembershipStatusOnError() {
this.driver = new SpotPoolDriver(this.mockClient, this.executor, this.mockEventBus);
this.driver.configure(config());
List<SpotInstanceRequest> poolMembers = asList(spotRequest("sir-1", "open", null, POOL1_TAG));
when(this.mockClient.getSpotInstanceRequests(Matchers.anyCollection())).thenReturn(poolMembers);
Tag statusTag = new Tag(ScalingTags.MEMBERSHIP_STATUS_TAG, MembershipStatus.blessed().toString());
doThrow(new AmazonServiceException("something went wrong")).when(this.mockClient).tagResource("sir-1",
asList(statusTag));
this.driver.setMembershipStatus("sir-1", MembershipStatus.blessed());
} | @SuppressWarnings(STR) @Test(expected = CloudPoolDriverException.class) void function() { this.driver = new SpotPoolDriver(this.mockClient, this.executor, this.mockEventBus); this.driver.configure(config()); List<SpotInstanceRequest> poolMembers = asList(spotRequest("sir-1", "open", null, POOL1_TAG)); when(this.mockClient.getSpotInstanceRequests(Matchers.anyCollection())).thenReturn(poolMembers); Tag statusTag = new Tag(ScalingTags.MEMBERSHIP_STATUS_TAG, MembershipStatus.blessed().toString()); doThrow(new AmazonServiceException(STR)).when(this.mockClient).tagResource("sir-1", asList(statusTag)); this.driver.setMembershipStatus("sir-1", MembershipStatus.blessed()); } | /**
* An error to complete the operation should result in a
* {@link CloudPoolDriverException}.
*/ | An error to complete the operation should result in a <code>CloudPoolDriverException</code> | testSetMembershipStatusOnError | {
"repo_name": "elastisys/scale.cloudpool",
"path": "aws/spot/src/test/java/com/elastisys/scale/cloudpool/aws/spot/driver/TestSpotPoolDriverOperation.java",
"license": "apache-2.0",
"size": 32610
} | [
"com.amazonaws.AmazonServiceException",
"com.amazonaws.services.ec2.model.SpotInstanceRequest",
"com.amazonaws.services.ec2.model.Tag",
"com.elastisys.scale.cloudpool.api.types.MembershipStatus",
"com.elastisys.scale.cloudpool.aws.commons.ScalingTags",
"com.elastisys.scale.cloudpool.commons.basepool.driver.CloudPoolDriverException",
"java.util.Arrays",
"java.util.List",
"org.junit.Test",
"org.mockito.Matchers",
"org.mockito.Mockito"
] | import com.amazonaws.AmazonServiceException; import com.amazonaws.services.ec2.model.SpotInstanceRequest; import com.amazonaws.services.ec2.model.Tag; import com.elastisys.scale.cloudpool.api.types.MembershipStatus; import com.elastisys.scale.cloudpool.aws.commons.ScalingTags; import com.elastisys.scale.cloudpool.commons.basepool.driver.CloudPoolDriverException; import java.util.Arrays; import java.util.List; import org.junit.Test; import org.mockito.Matchers; import org.mockito.Mockito; | import com.amazonaws.*; import com.amazonaws.services.ec2.model.*; import com.elastisys.scale.cloudpool.api.types.*; import com.elastisys.scale.cloudpool.aws.commons.*; import com.elastisys.scale.cloudpool.commons.basepool.driver.*; import java.util.*; import org.junit.*; import org.mockito.*; | [
"com.amazonaws",
"com.amazonaws.services",
"com.elastisys.scale",
"java.util",
"org.junit",
"org.mockito"
] | com.amazonaws; com.amazonaws.services; com.elastisys.scale; java.util; org.junit; org.mockito; | 1,382,209 |
public final void setClusterID(final byte[] newClusterID) {
this.clusterID = Arrays.copyOf(newClusterID, newClusterID.length);
}
| final void function(final byte[] newClusterID) { this.clusterID = Arrays.copyOf(newClusterID, newClusterID.length); } | /**
* Sets the cluster ID.
*
* @param newClusterID the new cluster ID
*/ | Sets the cluster ID | setClusterID | {
"repo_name": "Telsis/jOCP",
"path": "src/com/telsis/jocp/messages/ConnectToResource.java",
"license": "gpl-3.0",
"size": 9650
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,013,631 |
private void registerModulesForCustomFieldDef(ObjectMapper objectMapper) {
SimpleModule simpleModule = new SimpleModule("CustomFieldDefinition", new Version(1, 0, 0, null));
simpleModule.addDeserializer(CustomFieldDefinition.class, new CustomFieldDefinitionDeserializer());
objectMapper.registerModule(simpleModule);
} | void function(ObjectMapper objectMapper) { SimpleModule simpleModule = new SimpleModule(STR, new Version(1, 0, 0, null)); simpleModule.addDeserializer(CustomFieldDefinition.class, new CustomFieldDefinitionDeserializer()); objectMapper.registerModule(simpleModule); } | /**
* Method to add custom deserializer for CustomFieldDefinition
*
* @param objectMapper the Jackson object mapper
*/ | Method to add custom deserializer for CustomFieldDefinition | registerModulesForCustomFieldDef | {
"repo_name": "intuit/QuickBooks-V3-Java-SDK",
"path": "ipp-v3-java-devkit/src/main/java/com/intuit/ipp/serialization/BatchItemResponseDeserializer.java",
"license": "apache-2.0",
"size": 6738
} | [
"com.fasterxml.jackson.core.Version",
"com.fasterxml.jackson.databind.ObjectMapper",
"com.fasterxml.jackson.databind.module.SimpleModule",
"com.intuit.ipp.data.CustomFieldDefinition"
] | import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.module.SimpleModule; import com.intuit.ipp.data.CustomFieldDefinition; | import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.module.*; import com.intuit.ipp.data.*; | [
"com.fasterxml.jackson",
"com.intuit.ipp"
] | com.fasterxml.jackson; com.intuit.ipp; | 2,713,157 |
public MetaProperty<LocalTime> expiryTime() {
return expiryTime;
} | MetaProperty<LocalTime> function() { return expiryTime; } | /**
* The meta-property for the {@code expiryTime} property.
* @return the meta-property, not null
*/ | The meta-property for the expiryTime property | expiryTime | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/product/src/main/java/com/opengamma/strata/product/index/IborFutureOptionSecurity.java",
"license": "apache-2.0",
"size": 34787
} | [
"java.time.LocalTime",
"org.joda.beans.MetaProperty"
] | import java.time.LocalTime; import org.joda.beans.MetaProperty; | import java.time.*; import org.joda.beans.*; | [
"java.time",
"org.joda.beans"
] | java.time; org.joda.beans; | 2,146,557 |
public ServiceResponse<Void> putValid(ArrayWrapper complexBody) throws ErrorException, IOException, IllegalArgumentException {
return putValidAsync(complexBody).toBlocking().single();
} | ServiceResponse<Void> function(ArrayWrapper complexBody) throws ErrorException, IOException, IllegalArgumentException { return putValidAsync(complexBody).toBlocking().single(); } | /**
* Put complex types with array property.
*
* @param complexBody Please put an array with 4 items: "1, 2, 3, 4", "", null, "&S#$(*Y", "The quick brown fox jumps over the lazy dog"
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the {@link ServiceResponse} object if successful.
*/ | Put complex types with array property | putValid | {
"repo_name": "haocs/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodycomplex/implementation/ArraysImpl.java",
"license": "mit",
"size": 14659
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 943,949 |
protected final void addViewInternal(View child, ViewGroup.LayoutParams params) {
super.addView(child, -1, params);
} | final void function(View child, ViewGroup.LayoutParams params) { super.addView(child, -1, params); } | /**
* Used internally for adding view. Need because we override addView to
* pass-through to the Refreshable View
*/ | Used internally for adding view. Need because we override addView to pass-through to the Refreshable View | addViewInternal | {
"repo_name": "liudeyu/MeLife",
"path": "PMS/Android-PullToRefresh/src/com/handmark/pulltorefresh/library/PullToRefreshBase.java",
"license": "apache-2.0",
"size": 46568
} | [
"android.view.View",
"android.view.ViewGroup"
] | import android.view.View; import android.view.ViewGroup; | import android.view.*; | [
"android.view"
] | android.view; | 1,579,059 |
int number();
@Immutable
@ToString
@Loggable(Loggable.DEBUG)
@EqualsAndHashCode(of = { "key", "jsn" })
final class Smart implements PublicKey {
private final transient PublicKey key;
private final transient SmartJson jsn;
public Smart(
@NotNull(message = "public key is never NULL") final PublicKey pkey
) {
this.key = pkey;
this.jsn = new SmartJson(pkey);
} | int number(); @Loggable(Loggable.DEBUG) @EqualsAndHashCode(of = { "key", "jsn" }) final class Smart implements PublicKey { private final transient PublicKey key; private final transient SmartJson jsn; public Smart( @NotNull(message = STR) final PublicKey pkey ) { this.key = pkey; this.jsn = new SmartJson(pkey); } | /**
* ID Number of this public key.
* @return Public key ID number
*/ | ID Number of this public key | number | {
"repo_name": "prondzyn/jcabi-github",
"path": "src/main/java/com/jcabi/github/PublicKey.java",
"license": "bsd-3-clause",
"size": 5958
} | [
"com.jcabi.aspects.Loggable",
"javax.validation.constraints.NotNull"
] | import com.jcabi.aspects.Loggable; import javax.validation.constraints.NotNull; | import com.jcabi.aspects.*; import javax.validation.constraints.*; | [
"com.jcabi.aspects",
"javax.validation"
] | com.jcabi.aspects; javax.validation; | 378,700 |
private Map<JSType, String> buildPropNames(Property prop) {
UnionFind<JSType> pTypes = prop.getTypes();
String pname = prop.name;
Map<JSType, String> names = new HashMap<>();
for (Set<JSType> set : pTypes.allEquivalenceClasses()) {
checkState(!set.isEmpty());
JSType representative = pTypes.find(set.iterator().next());
String typeName = null;
for (JSType type : set) {
String typeString = type.toString();
if (typeName == null || typeString.compareTo(typeName) < 0) {
typeName = typeString;
}
}
String newName;
if ("{...}".equals(typeName)) {
newName = pname;
} else {
newName = NONWORD_PATTERN.matcher(typeName).replaceAll("_") + '$' + pname;
}
names.put(representative, newName);
}
return names;
} | Map<JSType, String> function(Property prop) { UnionFind<JSType> pTypes = prop.getTypes(); String pname = prop.name; Map<JSType, String> names = new HashMap<>(); for (Set<JSType> set : pTypes.allEquivalenceClasses()) { checkState(!set.isEmpty()); JSType representative = pTypes.find(set.iterator().next()); String typeName = null; for (JSType type : set) { String typeString = type.toString(); if (typeName == null typeString.compareTo(typeName) < 0) { typeName = typeString; } } String newName; if ("{...}".equals(typeName)) { newName = pname; } else { newName = NONWORD_PATTERN.matcher(typeName).replaceAll("_") + '$' + pname; } names.put(representative, newName); } return names; } | /**
* Chooses a name to use for renaming in each equivalence class and maps
* the representative type of that class to that name.
*/ | Chooses a name to use for renaming in each equivalence class and maps the representative type of that class to that name | buildPropNames | {
"repo_name": "tdelmas/closure-compiler",
"path": "src/com/google/javascript/jscomp/DisambiguateProperties.java",
"license": "apache-2.0",
"size": 34874
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.jscomp.graph.UnionFind",
"com.google.javascript.rhino.jstype.JSType",
"java.util.HashMap",
"java.util.Map",
"java.util.Set"
] | import com.google.common.base.Preconditions; import com.google.javascript.jscomp.graph.UnionFind; import com.google.javascript.rhino.jstype.JSType; import java.util.HashMap; import java.util.Map; import java.util.Set; | import com.google.common.base.*; import com.google.javascript.jscomp.graph.*; import com.google.javascript.rhino.jstype.*; import java.util.*; | [
"com.google.common",
"com.google.javascript",
"java.util"
] | com.google.common; com.google.javascript; java.util; | 1,799,895 |
EReference getAdditiveLockedJointType_Right(); | EReference getAdditiveLockedJointType_Right(); | /**
* Returns the meta object for the containment reference list '{@link uk.ac.kcl.inf.robotics.rigidBodies.AdditiveLockedJointType#getRight <em>Right</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Right</em>'.
* @see uk.ac.kcl.inf.robotics.rigidBodies.AdditiveLockedJointType#getRight()
* @see #getAdditiveLockedJointType()
* @generated
*/ | Returns the meta object for the containment reference list '<code>uk.ac.kcl.inf.robotics.rigidBodies.AdditiveLockedJointType#getRight Right</code>'. | getAdditiveLockedJointType_Right | {
"repo_name": "szschaler/RigidBodies",
"path": "uk.ac.kcl.inf.robotics.rigid_bodies/src-gen/uk/ac/kcl/inf/robotics/rigidBodies/RigidBodiesPackage.java",
"license": "mit",
"size": 163741
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 842,756 |
@Override
public boolean isUnauthenticated(Subject subject) throws MessagingAuthenticationException {
SibTr.entry(tc, CLASS_NAME + "isUnauthenticated", subject);
boolean result = false;
if (!isMessagingSecure()) {
result = false;
} else {
try {
result = messagingSecurityService.isUnauthenticated(subject);
} catch (Exception e) {
throw new MessagingAuthenticationException(e.getMessage());
}
}
SibTr.exit(tc, CLASS_NAME + "isUnauthenticated", subject);
return result;
} | boolean function(Subject subject) throws MessagingAuthenticationException { SibTr.entry(tc, CLASS_NAME + STR, subject); boolean result = false; if (!isMessagingSecure()) { result = false; } else { try { result = messagingSecurityService.isUnauthenticated(subject); } catch (Exception e) { throw new MessagingAuthenticationException(e.getMessage()); } } SibTr.exit(tc, CLASS_NAME + STR, subject); return result; } | /**
* Check if the subject passed is Authenticated
* <ul>
* <li> If Messaging Security is disabled, it returns false
* <li> If Messaging Security is enabled, it calls MessagingAuthenticationService
* from Messaging Security component </li>
*
* @param subject
* Subject which need to be checked
* @return
* true : If the Subject is unauthenticated
* false: If the Subject is authenticated
*/ | Check if the subject passed is Authenticated If Messaging Security is disabled, it returns false If Messaging Security is enabled, it calls MessagingAuthenticationService from Messaging Security component | isUnauthenticated | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.messaging.security.common/src/com/ibm/ws/messaging/security/RuntimeSecurityServiceImpl.java",
"license": "epl-1.0",
"size": 7990
} | [
"com.ibm.ws.messaging.security.authentication.MessagingAuthenticationException",
"com.ibm.ws.sib.utils.ras.SibTr",
"javax.security.auth.Subject"
] | import com.ibm.ws.messaging.security.authentication.MessagingAuthenticationException; import com.ibm.ws.sib.utils.ras.SibTr; import javax.security.auth.Subject; | import com.ibm.ws.messaging.security.authentication.*; import com.ibm.ws.sib.utils.ras.*; import javax.security.auth.*; | [
"com.ibm.ws",
"javax.security"
] | com.ibm.ws; javax.security; | 834,509 |
private void loadData(){
habits = new ArrayList<>();
if (Util.isNetworkAvailable(MyHabitHistory.this)) {
if (profile == null) {
Log.i("Error", "Failed to load habits: profile is null!");
return;
}
if (profile.getHabitIds() == null) {
Log.i("Error", "Failed to load habits: habit id list is null!");
return;
}
Log.i("Info", "Fetching habits for profile id " + profile.getUserId());
ElasticSearchController.GetHabitsTask getHabitsTask
= new ElasticSearchController.GetHabitsTask();
ArrayList<String> ids = profile.getHabitIds();
getHabitsTask.execute(ids.toArray(new String[ids.size()]));
try {
habits = getHabitsTask.get();
} catch (Exception e) {
Log.i("Error", "ElasticSearch failed to find habits for profile with id " + profile.getUserId());
}
}
else{
try {
FileInputStream fis = openFileInput(FILENAME);
BufferedReader in = new BufferedReader(new InputStreamReader(fis));
Gson gson = new Gson();
//Taken from https://stackoverflow.com/questions/12384064/gson-convert-from-json-to-a-typed-arraylistt
//2017-09-28
Type listType = new TypeToken<ArrayList<Habit>>(){}.getType();
habits = gson.fromJson(in,listType);
Type profileType = new TypeToken<Profile>(){}.getType();
profile = gson.fromJson(in,profileType);
in.close();
fis.close();
} catch (FileNotFoundException e) {
//We either need internet connection or previously stored data for the app to work
throw new RuntimeException();
} catch (IOException e) {
throw new RuntimeException();
}
}
} | void function(){ habits = new ArrayList<>(); if (Util.isNetworkAvailable(MyHabitHistory.this)) { if (profile == null) { Log.i("Error", STR); return; } if (profile.getHabitIds() == null) { Log.i("Error", STR); return; } Log.i("Info", STR + profile.getUserId()); ElasticSearchController.GetHabitsTask getHabitsTask = new ElasticSearchController.GetHabitsTask(); ArrayList<String> ids = profile.getHabitIds(); getHabitsTask.execute(ids.toArray(new String[ids.size()])); try { habits = getHabitsTask.get(); } catch (Exception e) { Log.i("Error", STR + profile.getUserId()); } } else{ try { FileInputStream fis = openFileInput(FILENAME); BufferedReader in = new BufferedReader(new InputStreamReader(fis)); Gson gson = new Gson(); Type listType = new TypeToken<ArrayList<Habit>>(){}.getType(); habits = gson.fromJson(in,listType); Type profileType = new TypeToken<Profile>(){}.getType(); profile = gson.fromJson(in,profileType); in.close(); fis.close(); } catch (FileNotFoundException e) { throw new RuntimeException(); } catch (IOException e) { throw new RuntimeException(); } } } | /**
* Loads habits of user from ElasticSearch server or, if server is unavailable, local
*/ | Loads habits of user from ElasticSearch server or, if server is unavailable, local | loadData | {
"repo_name": "CMPUT301F17T09/GoalsAndHabits",
"path": "GoalsAndHabits/app/src/main/java/cmput301f17t09/goalsandhabits/Profiles/MyHabitHistory.java",
"license": "mit",
"size": 11022
} | [
"android.util.Log",
"com.google.gson.Gson",
"com.google.gson.reflect.TypeToken",
"java.io.BufferedReader",
"java.io.FileInputStream",
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStreamReader",
"java.lang.reflect.Type",
"java.util.ArrayList"
] | import android.util.Log; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Type; import java.util.ArrayList; | import android.util.*; import com.google.gson.*; import com.google.gson.reflect.*; import java.io.*; import java.lang.reflect.*; import java.util.*; | [
"android.util",
"com.google.gson",
"java.io",
"java.lang",
"java.util"
] | android.util; com.google.gson; java.io; java.lang; java.util; | 137,803 |
@Override
public synchronized <T extends IRestfulClient> T newClient(Class<T> theClientType, String theServerBase) {
validateConfigured();
if (!theClientType.isInterface()) {
throw new ConfigurationException(theClientType.getCanonicalName() + " is not an interface");
}
ClientInvocationHandlerFactory invocationHandler = myInvocationHandlers.get(theClientType);
if (invocationHandler == null) {
IHttpClient httpClient = getHttpClient(theServerBase);
invocationHandler = new ClientInvocationHandlerFactory(httpClient, myContext, theServerBase, theClientType);
for (Method nextMethod : theClientType.getMethods()) {
BaseMethodBinding<?> binding = BaseMethodBinding.bindMethod(nextMethod, myContext, null);
invocationHandler.addBinding(nextMethod, binding);
}
myInvocationHandlers.put(theClientType, invocationHandler);
}
T proxy = instantiateProxy(theClientType, invocationHandler.newInvocationHandler(this));
return proxy;
} | synchronized <T extends IRestfulClient> T function(Class<T> theClientType, String theServerBase) { validateConfigured(); if (!theClientType.isInterface()) { throw new ConfigurationException(theClientType.getCanonicalName() + STR); } ClientInvocationHandlerFactory invocationHandler = myInvocationHandlers.get(theClientType); if (invocationHandler == null) { IHttpClient httpClient = getHttpClient(theServerBase); invocationHandler = new ClientInvocationHandlerFactory(httpClient, myContext, theServerBase, theClientType); for (Method nextMethod : theClientType.getMethods()) { BaseMethodBinding<?> binding = BaseMethodBinding.bindMethod(nextMethod, myContext, null); invocationHandler.addBinding(nextMethod, binding); } myInvocationHandlers.put(theClientType, invocationHandler); } T proxy = instantiateProxy(theClientType, invocationHandler.newInvocationHandler(this)); return proxy; } | /**
* Instantiates a new client instance
*
* @param theClientType
* The client type, which is an interface type to be instantiated
* @param theServerBase
* The URL of the base for the restful FHIR server to connect to
* @return A newly created client
* @throws ConfigurationException
* If the interface type is not an interface
*/ | Instantiates a new client instance | newClient | {
"repo_name": "botunge/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java",
"license": "apache-2.0",
"size": 12884
} | [
"ca.uhn.fhir.context.ConfigurationException",
"ca.uhn.fhir.rest.client.api.IHttpClient",
"ca.uhn.fhir.rest.client.api.IRestfulClient",
"ca.uhn.fhir.rest.method.BaseMethodBinding",
"java.lang.reflect.Method"
] | import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.rest.client.api.IHttpClient; import ca.uhn.fhir.rest.client.api.IRestfulClient; import ca.uhn.fhir.rest.method.BaseMethodBinding; import java.lang.reflect.Method; | import ca.uhn.fhir.context.*; import ca.uhn.fhir.rest.client.api.*; import ca.uhn.fhir.rest.method.*; import java.lang.reflect.*; | [
"ca.uhn.fhir",
"java.lang"
] | ca.uhn.fhir; java.lang; | 94,945 |
public synchronized void startServer() {
if (this.server != null)
throw new IllegalStateException();
// Create the Jetty Server instance.
this.server = new Server(this.port);
this.server.setStopAtShutdown(true);
if (enableSsl)
activateSslOnlyMode();
// Use the web.xml to configure things.
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
webapp.setWar("src/main/webapp");
if (this.webAppAttributes != null) {
for (Entry<String, Object> attribute : this.webAppAttributes.entrySet())
webapp.setAttribute(attribute.getKey(), attribute.getValue());
}
configureForMavenWarProject(webapp, new File("."));
enableAnnotationConfigs(webapp);
enableDefaultServlet(webapp);
enableJspServlet(webapp);
ContextHandlerCollection contexts = new ContextHandlerCollection();
contexts.addHandler(webapp);
this.server.setHandler(contexts);
// Start up Jetty.
try {
this.server.start();
} catch (Exception e) {
throw new RuntimeException(e);
}
} | synchronized void function() { if (this.server != null) throw new IllegalStateException(); this.server = new Server(this.port); this.server.setStopAtShutdown(true); if (enableSsl) activateSslOnlyMode(); WebAppContext webapp = new WebAppContext(); webapp.setContextPath("/"); webapp.setWar(STR); if (this.webAppAttributes != null) { for (Entry<String, Object> attribute : this.webAppAttributes.entrySet()) webapp.setAttribute(attribute.getKey(), attribute.getValue()); } configureForMavenWarProject(webapp, new File(".")); enableAnnotationConfigs(webapp); enableDefaultServlet(webapp); enableJspServlet(webapp); ContextHandlerCollection contexts = new ContextHandlerCollection(); contexts.addHandler(webapp); this.server.setHandler(contexts); try { this.server.start(); } catch (Exception e) { throw new RuntimeException(e); } } | /**
* Launches Jetty, configuring it to run the web application configured in
* <code>rps-tourney-webservice/src/main/webapp/WEB-INF/web.xml</code>.
*/ | Launches Jetty, configuring it to run the web application configured in <code>rps-tourney-webservice/src/main/webapp/WEB-INF/web.xml</code> | startServer | {
"repo_name": "karlmdavis/jessentials",
"path": "jessentials-misc/src/main/java/com/justdavis/karl/misc/jetty/EmbeddedServer.java",
"license": "apache-2.0",
"size": 16239
} | [
"java.io.File",
"java.util.Map",
"org.eclipse.jetty.server.Server",
"org.eclipse.jetty.server.handler.ContextHandlerCollection",
"org.eclipse.jetty.webapp.WebAppContext"
] | import java.io.File; import java.util.Map; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.webapp.WebAppContext; | import java.io.*; import java.util.*; import org.eclipse.jetty.server.*; import org.eclipse.jetty.server.handler.*; import org.eclipse.jetty.webapp.*; | [
"java.io",
"java.util",
"org.eclipse.jetty"
] | java.io; java.util; org.eclipse.jetty; | 2,345,357 |
void applyEditorValue() {
// avoid re-entering
if (!inEditorDeactivation) {
try {
inEditorDeactivation = true;
CellEditor c = this.cellEditor;
if (c != null && this.cell != null) {
ColumnViewerEditorDeactivationEvent tmp = new ColumnViewerEditorDeactivationEvent(
cell);
tmp.eventType = ColumnViewerEditorDeactivationEvent.EDITOR_SAVED;
if (editorActivationListener != null
&& !editorActivationListener.isEmpty()) {
Object[] ls = editorActivationListener.getListeners();
for (int i = 0; i < ls.length; i++) {
((ColumnViewerEditorActivationListener) ls[i])
.beforeEditorDeactivated(tmp);
}
}
Item t = (Item) this.cell.getItem();
// don't null out table item -- same item is still selected
if (t != null && !t.isDisposed()) {
saveEditorValue(c);
}
if (!viewer.getControl().isDisposed()) {
setEditor(null, null, 0);
}
c.removeListener(cellEditorListener);
Control control = c.getControl();
if (control != null && !control.isDisposed()) {
if (mouseListener != null) {
control.removeMouseListener(mouseListener);
// Clear the instance not needed any more
mouseListener = null;
}
if (focusListener != null) {
control.removeFocusListener(focusListener);
}
if (tabeditingListener != null) {
control.removeTraverseListener(tabeditingListener);
}
}
c.deactivate(tmp);
if (editorActivationListener != null
&& !editorActivationListener.isEmpty()) {
Object[] ls = editorActivationListener.getListeners();
for (int i = 0; i < ls.length; i++) {
((ColumnViewerEditorActivationListener) ls[i])
.afterEditorDeactivated(tmp);
}
}
if( ! this.cell.getItem().isDisposed() ) {
this.cell.getItem().removeDisposeListener(disposeListener);
}
}
this.cellEditor = null;
this.cell = null;
} finally {
inEditorDeactivation = false;
}
}
} | void applyEditorValue() { if (!inEditorDeactivation) { try { inEditorDeactivation = true; CellEditor c = this.cellEditor; if (c != null && this.cell != null) { ColumnViewerEditorDeactivationEvent tmp = new ColumnViewerEditorDeactivationEvent( cell); tmp.eventType = ColumnViewerEditorDeactivationEvent.EDITOR_SAVED; if (editorActivationListener != null && !editorActivationListener.isEmpty()) { Object[] ls = editorActivationListener.getListeners(); for (int i = 0; i < ls.length; i++) { ((ColumnViewerEditorActivationListener) ls[i]) .beforeEditorDeactivated(tmp); } } Item t = (Item) this.cell.getItem(); if (t != null && !t.isDisposed()) { saveEditorValue(c); } if (!viewer.getControl().isDisposed()) { setEditor(null, null, 0); } c.removeListener(cellEditorListener); Control control = c.getControl(); if (control != null && !control.isDisposed()) { if (mouseListener != null) { control.removeMouseListener(mouseListener); mouseListener = null; } if (focusListener != null) { control.removeFocusListener(focusListener); } if (tabeditingListener != null) { control.removeTraverseListener(tabeditingListener); } } c.deactivate(tmp); if (editorActivationListener != null && !editorActivationListener.isEmpty()) { Object[] ls = editorActivationListener.getListeners(); for (int i = 0; i < ls.length; i++) { ((ColumnViewerEditorActivationListener) ls[i]) .afterEditorDeactivated(tmp); } } if( ! this.cell.getItem().isDisposed() ) { this.cell.getItem().removeDisposeListener(disposeListener); } } this.cellEditor = null; this.cell = null; } finally { inEditorDeactivation = false; } } } | /**
* Applies the current value and deactivates the currently active cell
* editor.
*/ | Applies the current value and deactivates the currently active cell editor | applyEditorValue | {
"repo_name": "neelance/jface4ruby",
"path": "jface4ruby/src/org/eclipse/jface/viewers/ColumnViewerEditor.java",
"license": "epl-1.0",
"size": 21139
} | [
"org.eclipse.swt.widgets.Control",
"org.eclipse.swt.widgets.Item"
] | import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Item; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 582,722 |
@Override
public boolean updatePodIfNotExist(String id, Pod pod) {
Pod oldValue = getInternalPodMap(namespace).putIfAbsent(id, pod);
return oldValue == null;
} | boolean function(String id, Pod pod) { Pod oldValue = getInternalPodMap(namespace).putIfAbsent(id, pod); return oldValue == null; } | /**
* Updates the pod if one does not already exist
*/ | Updates the pod if one does not already exist | updatePodIfNotExist | {
"repo_name": "jstrachan/jube",
"path": "node/src/main/java/io/fabric8/jube/local/LocalKubernetesModel.java",
"license": "apache-2.0",
"size": 11140
} | [
"io.fabric8.kubernetes.api.model.Pod"
] | import io.fabric8.kubernetes.api.model.Pod; | import io.fabric8.kubernetes.api.model.*; | [
"io.fabric8.kubernetes"
] | io.fabric8.kubernetes; | 1,579,046 |
public VmNetworkInterfaceDao getVmNetworkInterfaceDao() {
return getDao(VmNetworkInterfaceDao.class);
} | VmNetworkInterfaceDao function() { return getDao(VmNetworkInterfaceDao.class); } | /**
* Returns the singleton instance of {@link VmNetworkInterfaceDao}.
*
* @return the dao
*/ | Returns the singleton instance of <code>VmNetworkInterfaceDao</code> | getVmNetworkInterfaceDao | {
"repo_name": "jtux270/translate",
"path": "ovirt/3.6_source/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java",
"license": "gpl-3.0",
"size": 42484
} | [
"org.ovirt.engine.core.dao.network.VmNetworkInterfaceDao"
] | import org.ovirt.engine.core.dao.network.VmNetworkInterfaceDao; | import org.ovirt.engine.core.dao.network.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 2,876,148 |
IndexDefinitionTemplate setNodeTypeName( Name name ); | IndexDefinitionTemplate setNodeTypeName( Name name ); | /**
* Set the name of the node type for which this index applies.
*
* @param name the name of the node type for which this index applies; may be null if the property applies to all node types
* (e.g., {@code nt:base}).
* @return this instance for method chaining; never null
*/ | Set the name of the node type for which this index applies | setNodeTypeName | {
"repo_name": "rhauch/modeshape",
"path": "modeshape-jcr/src/main/java/org/modeshape/jcr/spi/index/IndexDefinitionTemplate.java",
"license": "apache-2.0",
"size": 3048
} | [
"org.modeshape.jcr.value.Name"
] | import org.modeshape.jcr.value.Name; | import org.modeshape.jcr.value.*; | [
"org.modeshape.jcr"
] | org.modeshape.jcr; | 1,144,316 |
protected void sendReply(UUID nodeId, GridDhtTxFinishRequest req, boolean committed, GridCacheVersion nearTxId) {
if (req.replyRequired() || req.checkCommitted()) {
GridDhtTxFinishResponse res = new GridDhtTxFinishResponse(req.version(), req.futureId(), req.miniId());
if (req.checkCommitted()) {
res.checkCommitted(true);
if (!committed) {
ClusterTopologyCheckedException cause =
new ClusterTopologyCheckedException("Primary node left grid.");
res.checkCommittedError(new IgniteTxRollbackCheckedException("Failed to commit transaction " +
"(transaction has been rolled back on backup node): " + req.version(), cause));
}
}
try {
ctx.io().send(nodeId, res, req.policy());
if (txFinishMsgLog.isDebugEnabled()) {
txFinishMsgLog.debug("Sent dht tx finish response [txId=" + nearTxId +
", dhtTxId=" + req.version() +
", node=" + nodeId +
", checkCommitted=" + req.checkCommitted() + ']');
}
}
catch (Throwable e) {
// Double-check.
if (ctx.discovery().node(nodeId) == null) {
if (txFinishMsgLog.isDebugEnabled()) {
txFinishMsgLog.debug("Node left while send dht tx finish response [txId=" + nearTxId +
", dhtTxId=" + req.version() +
", node=" + nodeId + ']');
}
}
else {
U.error(log, "Failed to send finish response to node [txId=" + nearTxId +
", dhtTxId=" + req.version() +
", nodeId=" + nodeId +
", res=" + res + ']', e);
}
if (e instanceof Error)
throw (Error)e;
}
}
else {
if (txFinishMsgLog.isDebugEnabled()) {
txFinishMsgLog.debug("Skip send dht tx finish response [txId=" + nearTxId +
", dhtTxId=" + req.version() +
", node=" + nodeId + ']');
}
}
} | void function(UUID nodeId, GridDhtTxFinishRequest req, boolean committed, GridCacheVersion nearTxId) { if (req.replyRequired() req.checkCommitted()) { GridDhtTxFinishResponse res = new GridDhtTxFinishResponse(req.version(), req.futureId(), req.miniId()); if (req.checkCommitted()) { res.checkCommitted(true); if (!committed) { ClusterTopologyCheckedException cause = new ClusterTopologyCheckedException(STR); res.checkCommittedError(new IgniteTxRollbackCheckedException(STR + STR + req.version(), cause)); } } try { ctx.io().send(nodeId, res, req.policy()); if (txFinishMsgLog.isDebugEnabled()) { txFinishMsgLog.debug(STR + nearTxId + STR + req.version() + STR + nodeId + STR + req.checkCommitted() + ']'); } } catch (Throwable e) { if (ctx.discovery().node(nodeId) == null) { if (txFinishMsgLog.isDebugEnabled()) { txFinishMsgLog.debug(STR + nearTxId + STR + req.version() + STR + nodeId + ']'); } } else { U.error(log, STR + nearTxId + STR + req.version() + STR + nodeId + STR + res + ']', e); } if (e instanceof Error) throw (Error)e; } } else { if (txFinishMsgLog.isDebugEnabled()) { txFinishMsgLog.debug(STR + nearTxId + STR + req.version() + STR + nodeId + ']'); } } } | /**
* Sends tx finish response to remote node, if response is requested.
*
* @param nodeId Node id that originated finish request.
* @param req Request.
* @param committed {@code True} if transaction committed on this node.
* @param nearTxId Near tx version.
*/ | Sends tx finish response to remote node, if response is requested | sendReply | {
"repo_name": "tkpanther/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java",
"license": "apache-2.0",
"size": 61915
} | [
"org.apache.ignite.internal.cluster.ClusterTopologyCheckedException",
"org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest",
"org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse",
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion",
"org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException",
"org.apache.ignite.internal.util.typedef.internal.U"
] | import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishRequest; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; import org.apache.ignite.internal.util.typedef.internal.U; | import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.processors.cache.version.*; import org.apache.ignite.internal.transactions.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,625,976 |
private static void updateModuleItem(Context context, ContentResolver resolver,
String accountName, String moduleName, SugarBean sBean,
long rawId, BatchOperation batchOperation)
throws SugarCrmException {
if (Log.isLoggable(LOG_TAG, Log.VERBOSE))
Log.v(LOG_TAG, "In updateModuleItem");
Uri contentUri = ContentUtils.getModuleUri(moduleName);
String[] projections = ContentUtils.getModuleProjections(moduleName);
Uri uri = ContentUris.withAppendedId(contentUri, rawId);
// check the changes from server and mark them for merge in sync table
SyncRecord syncRecord = databaseHelper.getSyncRecord(rawId, moduleName);
if (syncRecord != null) {
ContentValues values = new ContentValues();
values.put(Sync.SYNC_STATUS, Util.SYNC_CONFLICTS);
databaseHelper.updateSyncRecord(syncRecord._id, values);
} else {
final Cursor c = resolver.query(contentUri, projections, mSelection, new String[] { String.valueOf(rawId) }, null);
// TODO - do something here with cursor, create update only for values that have changed
c.close();
final SugarCRMOperations moduleItemOp = SugarCRMOperations.updateExistingModuleItem(context, moduleName, sBean, rawId, batchOperation);
moduleItemOp.updateSugarBean(sBean, uri);
}
} | static void function(Context context, ContentResolver resolver, String accountName, String moduleName, SugarBean sBean, long rawId, BatchOperation batchOperation) throws SugarCrmException { if (Log.isLoggable(LOG_TAG, Log.VERBOSE)) Log.v(LOG_TAG, STR); Uri contentUri = ContentUtils.getModuleUri(moduleName); String[] projections = ContentUtils.getModuleProjections(moduleName); Uri uri = ContentUris.withAppendedId(contentUri, rawId); SyncRecord syncRecord = databaseHelper.getSyncRecord(rawId, moduleName); if (syncRecord != null) { ContentValues values = new ContentValues(); values.put(Sync.SYNC_STATUS, Util.SYNC_CONFLICTS); databaseHelper.updateSyncRecord(syncRecord._id, values); } else { final Cursor c = resolver.query(contentUri, projections, mSelection, new String[] { String.valueOf(rawId) }, null); c.close(); final SugarCRMOperations moduleItemOp = SugarCRMOperations.updateExistingModuleItem(context, moduleName, sBean, rawId, batchOperation); moduleItemOp.updateSugarBean(sBean, uri); } } | /**
* Updates a single module item to the sugar crm content provider.
*
* @param context
* the Authenticator Activity context
* @param resolver
* the ContentResolver to use
* @param accountName
* the account the module item belongs to
* @param moduleName
* the name of the module being synced
* @param sBean
* the sugar crm sync adapter object.
* @param rawId
* the unique Id for this raw module item in sugar crm content provider
*/ | Updates a single module item to the sugar crm content provider | updateModuleItem | {
"repo_name": "Imaginea/pancake-android",
"path": "src/com/imaginea/android/sugarcrm/sync/SugarSyncManager.java",
"license": "apache-2.0",
"size": 50197
} | [
"android.content.ContentResolver",
"android.content.ContentUris",
"android.content.ContentValues",
"android.content.Context",
"android.database.Cursor",
"android.net.Uri",
"android.util.Log",
"com.imaginea.android.sugarcrm.provider.ContentUtils",
"com.imaginea.android.sugarcrm.provider.SugarCRMContent",
"com.imaginea.android.sugarcrm.util.SugarBean",
"com.imaginea.android.sugarcrm.util.SugarCrmException",
"com.imaginea.android.sugarcrm.util.Util"
] | import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.util.Log; import com.imaginea.android.sugarcrm.provider.ContentUtils; import com.imaginea.android.sugarcrm.provider.SugarCRMContent; import com.imaginea.android.sugarcrm.util.SugarBean; import com.imaginea.android.sugarcrm.util.SugarCrmException; import com.imaginea.android.sugarcrm.util.Util; | import android.content.*; import android.database.*; import android.net.*; import android.util.*; import com.imaginea.android.sugarcrm.provider.*; import com.imaginea.android.sugarcrm.util.*; | [
"android.content",
"android.database",
"android.net",
"android.util",
"com.imaginea.android"
] | android.content; android.database; android.net; android.util; com.imaginea.android; | 1,280,736 |
public void addPart(byte[] payload, String contentId) throws MessagingException, IOException {
addPart(payload, null, contentId);
} | void function(byte[] payload, String contentId) throws MessagingException, IOException { addPart(payload, null, contentId); } | /**
* Add a new part to the mime multipart.
*
* @param payload the data.
* @param contentId the id to set the content with.
* @throws MessagingException if there was a failure adding the part. MimeMultiPart
* @throws IOException if there was an IOException
*/ | Add a new part to the mime multipart | addPart | {
"repo_name": "adaptris/interlok",
"path": "interlok-core/src/main/java/com/adaptris/util/text/mime/MultiPartOutput.java",
"license": "apache-2.0",
"size": 13793
} | [
"java.io.IOException",
"javax.mail.MessagingException"
] | import java.io.IOException; import javax.mail.MessagingException; | import java.io.*; import javax.mail.*; | [
"java.io",
"javax.mail"
] | java.io; javax.mail; | 1,890,506 |
private void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference.setOnPreferenceChangeListener(this);
// Trigger the listener immediately with the preference's
// current value.
setPreferenceSummary(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), ""));
} | void function(Preference preference) { preference.setOnPreferenceChangeListener(this); setPreferenceSummary(preference, PreferenceManager .getDefaultSharedPreferences(preference.getContext()) .getString(preference.getKey(), "")); } | /**
* Attaches a listener so the summary is always updated with the preference value.
* Also fires the listener once, to initialize the summary (so it shows up before the value
* is changed.)
*/ | Attaches a listener so the summary is always updated with the preference value. Also fires the listener once, to initialize the summary (so it shows up before the value is changed.) | bindPreferenceSummaryToValue | {
"repo_name": "7odri9o/Sunshine",
"path": "app/src/main/java/com/dreamdevs/sunshine/activity/SettingsActivity.java",
"license": "mit",
"size": 5275
} | [
"android.preference.Preference",
"android.preference.PreferenceManager"
] | import android.preference.Preference; import android.preference.PreferenceManager; | import android.preference.*; | [
"android.preference"
] | android.preference; | 2,803,058 |
protected ModelAndView generateResponseForAccessToken(final HttpServletRequest request,
final HttpServletResponse response,
final OAuth20AccessTokenResponseResult result) {
val model = getAccessTokenResponseModel(request, response, result);
return new ModelAndView(new MappingJackson2JsonView(MAPPER), model);
} | ModelAndView function(final HttpServletRequest request, final HttpServletResponse response, final OAuth20AccessTokenResponseResult result) { val model = getAccessTokenResponseModel(request, response, result); return new ModelAndView(new MappingJackson2JsonView(MAPPER), model); } | /**
* Generate response for access token model and view.
*
* @param request the request
* @param response the response
* @param result the result
* @return the model and view
*/ | Generate response for access token model and view | generateResponseForAccessToken | {
"repo_name": "pdrados/cas",
"path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/response/accesstoken/response/OAuth20DefaultAccessTokenResponseGenerator.java",
"license": "apache-2.0",
"size": 6570
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.springframework.web.servlet.ModelAndView",
"org.springframework.web.servlet.view.json.MappingJackson2JsonView"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.json.MappingJackson2JsonView; | import javax.servlet.http.*; import org.springframework.web.servlet.*; import org.springframework.web.servlet.view.json.*; | [
"javax.servlet",
"org.springframework.web"
] | javax.servlet; org.springframework.web; | 1,715,951 |
private synchronized void checkDatanodeUuid() throws IOException {
if (storage.getDatanodeUuid() == null) {
storage.setDatanodeUuid(generateUuid());
storage.writeAll();
LOG.info("Generated and persisted new Datanode UUID " +
storage.getDatanodeUuid());
}
} | synchronized void function() throws IOException { if (storage.getDatanodeUuid() == null) { storage.setDatanodeUuid(generateUuid()); storage.writeAll(); LOG.info(STR + storage.getDatanodeUuid()); } } | /**
* Verify that the DatanodeUuid has been initialized. If this is a new
* datanode then we generate a new Datanode Uuid and persist it to disk.
*
* @throws IOException
*/ | Verify that the DatanodeUuid has been initialized. If this is a new datanode then we generate a new Datanode Uuid and persist it to disk | checkDatanodeUuid | {
"repo_name": "VicoWu/hadoop-2.7.3",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java",
"license": "apache-2.0",
"size": 119126
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 202,047 |
public Node getNamedItemNS(String namespaceURI, String localName)
{
if ("".equals(namespaceURI))
{
namespaceURI = null;
}
for (DomNode ctx = first; ctx != null; ctx = ctx.next)
{
String name = ctx.getLocalName();
if ((localName == null && name == null) ||
(localName != null && localName.equals(name)))
{
String uri = ctx.getNamespaceURI();
if ("".equals(uri))
{
uri = null;
}
if ((namespaceURI == null && uri == null) ||
(namespaceURI != null && namespaceURI.equals(uri)))
{
return ctx;
}
}
}
return null;
} | Node function(String namespaceURI, String localName) { if (STR".equals(uri)) { uri = null; } if ((namespaceURI == null && uri == null) (namespaceURI != null && namespaceURI.equals(uri))) { return ctx; } } } return null; } | /**
* <b>DOM L2</b>
* Returns the named item from the map, or null; names are the
* localName and namespaceURI properties, ignoring any prefix.
*/ | DOM L2 Returns the named item from the map, or null; names are the localName and namespaceURI properties, ignoring any prefix | getNamedItemNS | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/xml/dom/DomNamedNodeMap.java",
"license": "bsd-3-clause",
"size": 11403
} | [
"org.w3c.dom.Node"
] | import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 959,573 |
void loadEntry(String keyStart, Map<String, Object> data, CoreSettings cs) throws URISyntaxException; | void loadEntry(String keyStart, Map<String, Object> data, CoreSettings cs) throws URISyntaxException; | /**
* Local (entry specific) load operation.
* @param keyStart string used to start a key
* @param data the data to load information from, usually a mapping of strings to objects
* @param cs core settings required for loading data
* @throws IllegalArgumentException if any of the required arguments or map entries are not set or empty
* @throws URISyntaxException if an SKB link is used to de-reference an entry and the URL is not formed well
*/ | Local (entry specific) load operation | loadEntry | {
"repo_name": "vdmeer/skb-java-datatool",
"path": "src/main/java/de/vandermeer/skb/datatool/commons/DataEntry.java",
"license": "apache-2.0",
"size": 4263
} | [
"java.net.URISyntaxException",
"java.util.Map"
] | import java.net.URISyntaxException; import java.util.Map; | import java.net.*; import java.util.*; | [
"java.net",
"java.util"
] | java.net; java.util; | 2,546,010 |
private EnforcerLevel getLevel( EnforcerRule rule )
{
if ( rule instanceof EnforcerRule2 )
{
return ( (EnforcerRule2) rule ).getLevel();
}
else
{
return EnforcerLevel.ERROR;
}
} | EnforcerLevel function( EnforcerRule rule ) { if ( rule instanceof EnforcerRule2 ) { return ( (EnforcerRule2) rule ).getLevel(); } else { return EnforcerLevel.ERROR; } } | /**
* Returns the level of the rule, defaults to {@link EnforcerLevel#ERROR} for backwards compatibility.
*
* @param rule might be of type {@link EnforcerRule2}.
* @return level of the rule.
*/ | Returns the level of the rule, defaults to <code>EnforcerLevel#ERROR</code> for backwards compatibility | getLevel | {
"repo_name": "kidaa/maven-enforcer",
"path": "maven-enforcer-plugin/src/main/java/org/apache/maven/plugins/enforcer/EnforceMojo.java",
"license": "apache-2.0",
"size": 13074
} | [
"org.apache.maven.enforcer.rule.api.EnforcerLevel",
"org.apache.maven.enforcer.rule.api.EnforcerRule",
"org.apache.maven.enforcer.rule.api.EnforcerRule2"
] | import org.apache.maven.enforcer.rule.api.EnforcerLevel; import org.apache.maven.enforcer.rule.api.EnforcerRule; import org.apache.maven.enforcer.rule.api.EnforcerRule2; | import org.apache.maven.enforcer.rule.api.*; | [
"org.apache.maven"
] | org.apache.maven; | 329,626 |
@Test
public void testGetJobsOrderBysDefault() {
//Default to order by Updated
final List<Job> jobs = this.service.getJobs(null, null, null, null, null, null, null, null, null,
0, 10, true, null);
Assert.assertEquals(2, jobs.size());
Assert.assertEquals(JOB_1_ID, jobs.get(0).getId());
Assert.assertEquals(JOB_2_ID, jobs.get(1).getId());
} | void function() { final List<Job> jobs = this.service.getJobs(null, null, null, null, null, null, null, null, null, 0, 10, true, null); Assert.assertEquals(2, jobs.size()); Assert.assertEquals(JOB_1_ID, jobs.get(0).getId()); Assert.assertEquals(JOB_2_ID, jobs.get(1).getId()); } | /**
* Test the get jobs method default order by.
*/ | Test the get jobs method default order by | testGetJobsOrderBysDefault | {
"repo_name": "sensaid/genie",
"path": "genie-core/src/integration-test/java/com/netflix/genie/core/services/impl/jpa/IntTestJobServiceJPAImpl.java",
"license": "apache-2.0",
"size": 29071
} | [
"com.netflix.genie.common.model.Job",
"java.util.List",
"org.junit.Assert"
] | import com.netflix.genie.common.model.Job; import java.util.List; import org.junit.Assert; | import com.netflix.genie.common.model.*; import java.util.*; import org.junit.*; | [
"com.netflix.genie",
"java.util",
"org.junit"
] | com.netflix.genie; java.util; org.junit; | 1,871,725 |
private void acquireNewPageIfNecessary(int requiredSpace) throws IOException {
assert (requiredSpace <= pageSizeBytes);
if (requiredSpace > freeSpaceInCurrentPage) {
logger.trace("Required space {} is less than free space in current page ({})", requiredSpace,
freeSpaceInCurrentPage);
// TODO: we should track metrics on the amount of space wasted when we roll over to a new page
// without using the free space at the end of the current page. We should also do this for
// BytesToBytesMap.
if (requiredSpace > pageSizeBytes) {
throw new IOException("Required space " + requiredSpace + " is greater than page size (" +
pageSizeBytes + ")");
} else {
acquireNewPage();
}
}
} | void function(int requiredSpace) throws IOException { assert (requiredSpace <= pageSizeBytes); if (requiredSpace > freeSpaceInCurrentPage) { logger.trace(STR, requiredSpace, freeSpaceInCurrentPage); if (requiredSpace > pageSizeBytes) { throw new IOException(STR + requiredSpace + STR + pageSizeBytes + ")"); } else { acquireNewPage(); } } } | /**
* Allocates more memory in order to insert an additional record. This will request additional
* memory from the {@link ShuffleMemoryManager} and spill if the requested memory can not be
* obtained.
*
* @param requiredSpace the required space in the data page, in bytes, including space for storing
* the record size. This must be less than or equal to the page size (records
* that exceed the page size are handled via a different code path which uses
* special overflow pages).
*/ | Allocates more memory in order to insert an additional record. This will request additional memory from the <code>ShuffleMemoryManager</code> and spill if the requested memory can not be obtained | acquireNewPageIfNecessary | {
"repo_name": "ArvinDevel/onlineAggregationOnSparkV2",
"path": "core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java",
"license": "apache-2.0",
"size": 20888
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 622,966 |
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
Class<?> aClass = Class.forName("com.fnp.syncadapterexample.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
} | static void function( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { Class<?> aClass = Class.forName(STR); aClass .getMethod(STR, Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } | /**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/ | Loads Flipper in React Native templates. Call this in the onCreate method with something like initializeFlipper(this, getReactNativeHost().getReactInstanceManager()) | initializeFlipper | {
"repo_name": "ferrannp/react-native-sync-adapter",
"path": "example/android/app/src/main/java/com/fnp/syncadapterexample/MainApplication.java",
"license": "mit",
"size": 2627
} | [
"android.content.Context",
"com.facebook.react.ReactInstanceManager",
"java.lang.reflect.InvocationTargetException"
] | import android.content.Context; import com.facebook.react.ReactInstanceManager; import java.lang.reflect.InvocationTargetException; | import android.content.*; import com.facebook.react.*; import java.lang.reflect.*; | [
"android.content",
"com.facebook.react",
"java.lang"
] | android.content; com.facebook.react; java.lang; | 2,375,692 |
public native String[] getEras();
/**
* Returns a new {@code DateFormatSymbols} instance for the user's default locale.
* See "<a href="../util/Locale.html#default_locale">Be wary of the default locale</a>".
*
* @return an instance of {@code DateFormatSymbols} | native String[] function(); /** * Returns a new {@code DateFormatSymbols} instance for the user's default locale. * See STR../util/Locale.html#default_localeSTR. * * @return an instance of {@code DateFormatSymbols} | /**
* Returns the array of strings which represent BC and AD. Use the
* {@link java.util.Calendar} constants {@code GregorianCalendar.BC} and
* {@code GregorianCalendar.AD} as indices for the array.
*
* @return an array of strings.
*/ | Returns the array of strings which represent BC and AD. Use the <code>java.util.Calendar</code> constants GregorianCalendar.BC and GregorianCalendar.AD as indices for the array | getEras | {
"repo_name": "appnativa/rare",
"path": "sdk/j2objc/mods/java/text/DateFormatSymbols.java",
"license": "gpl-3.0",
"size": 8360
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,404,577 |
public ConstraintOp getConstraintOp() {
return op;
} | ConstraintOp function() { return op; } | /**
* Returns constraint operation
* @return constraint operation
*/ | Returns constraint operation | getConstraintOp | {
"repo_name": "elsiklab/intermine",
"path": "intermine/web/main/src/org/intermine/web/logic/template/ConstraintInput.java",
"license": "lgpl-2.1",
"size": 6429
} | [
"org.intermine.metadata.ConstraintOp"
] | import org.intermine.metadata.ConstraintOp; | import org.intermine.metadata.*; | [
"org.intermine.metadata"
] | org.intermine.metadata; | 93,927 |
public void setPriceList (BigDecimal PriceList)
{
set_Value (COLUMNNAME_PriceList, PriceList);
} | void function (BigDecimal PriceList) { set_Value (COLUMNNAME_PriceList, PriceList); } | /** Set List Price.
@param PriceList
List Price
*/ | Set List Price | setPriceList | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/model/X_I_PriceList.java",
"license": "gpl-2.0",
"size": 15476
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,650,745 |
@Schema(description = "Modification date")
public DateTime getUpdatedAt() {
return updatedAt;
} | @Schema(description = STR) DateTime function() { return updatedAt; } | /**
* Modification date
* @return updatedAt
**/ | Modification date | getUpdatedAt | {
"repo_name": "iterate-ch/cyberduck",
"path": "dracoon/src/main/java/ch/cyberduck/core/sds/io/swagger/client/model/EncryptionPasswordPolicies.java",
"license": "gpl-3.0",
"size": 6955
} | [
"io.swagger.v3.oas.annotations.media.Schema",
"org.joda.time.DateTime"
] | import io.swagger.v3.oas.annotations.media.Schema; import org.joda.time.DateTime; | import io.swagger.v3.oas.annotations.media.*; import org.joda.time.*; | [
"io.swagger.v3",
"org.joda.time"
] | io.swagger.v3; org.joda.time; | 1,460,364 |
public Object persist(final Committer committer) throws InterruptedException
{
try {
log.debug("Persisting pending data.");
final long start = System.currentTimeMillis();
final Object commitMetadata = appenderator.persistAll(wrapCommitter(committer)).get();
log.debug("Persisted pending data in %,dms.", System.currentTimeMillis() - start);
return commitMetadata;
}
catch (InterruptedException e) {
throw e;
}
catch (Exception e) {
throw new RuntimeException(e);
}
} | Object function(final Committer committer) throws InterruptedException { try { log.debug(STR); final long start = System.currentTimeMillis(); final Object commitMetadata = appenderator.persistAll(wrapCommitter(committer)).get(); log.debug(STR, System.currentTimeMillis() - start); return commitMetadata; } catch (InterruptedException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } | /**
* Persist all data indexed through this driver so far. Blocks until complete.
* <p>
* Should be called after all data has been added through {@link #add(InputRow, String, Supplier, boolean, boolean)}.
*
* @param committer committer representing all data that has been added so far
*
* @return commitMetadata persisted
*/ | Persist all data indexed through this driver so far. Blocks until complete. Should be called after all data has been added through <code>#add(InputRow, String, Supplier, boolean, boolean)</code> | persist | {
"repo_name": "mghosh4/druid",
"path": "server/src/main/java/org/apache/druid/segment/realtime/appenderator/StreamAppenderatorDriver.java",
"license": "apache-2.0",
"size": 19167
} | [
"org.apache.druid.data.input.Committer"
] | import org.apache.druid.data.input.Committer; | import org.apache.druid.data.input.*; | [
"org.apache.druid"
] | org.apache.druid; | 1,347,240 |
public Account getDbEntry(){
Log.d(TAG, "Trying to retrieve Account entry in DB for user " + username);
final Realm DB = Realm.getDefaultInstance();
RealmQuery<Account> queryAccount = DB.where(Account.class);
Log.d(TAG, "getDbEntry: Query username:url "+username+":"+serverURL);
queryAccount.equalTo(Account.FIELD_USERNAME, username)
.equalTo(Account.FIELD_HOSTNAME, serverURL.getHost())
.equalTo(Account.FIELD_PATH, serverURL.getPath()); | Account function(){ Log.d(TAG, STR + username); final Realm DB = Realm.getDefaultInstance(); RealmQuery<Account> queryAccount = DB.where(Account.class); Log.d(TAG, STR+username+":"+serverURL); queryAccount.equalTo(Account.FIELD_USERNAME, username) .equalTo(Account.FIELD_HOSTNAME, serverURL.getHost()) .equalTo(Account.FIELD_PATH, serverURL.getPath()); | /**
* Get the account model corresponding to the user
* @return The user account entry in the database
*/ | Get the account model corresponding to the user | getDbEntry | {
"repo_name": "phpnetfrance/drivinCloudOpen",
"path": "app/src/main/java/org/phpnet/openDrivinCloudAndroid/Common/User.java",
"license": "apache-2.0",
"size": 10150
} | [
"android.util.Log",
"io.realm.Realm",
"io.realm.RealmQuery",
"org.phpnet.openDrivinCloudAndroid.Model"
] | import android.util.Log; import io.realm.Realm; import io.realm.RealmQuery; import org.phpnet.openDrivinCloudAndroid.Model; | import android.util.*; import io.realm.*; import org.phpnet.*; | [
"android.util",
"io.realm",
"org.phpnet"
] | android.util; io.realm; org.phpnet; | 336,832 |
public Group<E> range(int begin, int end) {
// bag arguments => return null
if (begin > end) {
return null;
}
if (begin < 0) {
begin = 0;
}
if (end > this.size()) {
end = this.size();
}
try {
ProxyForGroup<E> result = new ProxyForGroup<E>(this.getTypeName());
for (int i = begin; i <= end; i++) {
result.add(this.get(i));
}
return result;
} catch (ConstructionOfReifiedObjectFailedException e) {
e.printStackTrace();
return null;
}
} | Group<E> function(int begin, int end) { if (begin > end) { return null; } if (begin < 0) { begin = 0; } if (end > this.size()) { end = this.size(); } try { ProxyForGroup<E> result = new ProxyForGroup<E>(this.getTypeName()); for (int i = begin; i <= end; i++) { result.add(this.get(i)); } return result; } catch (ConstructionOfReifiedObjectFailedException e) { e.printStackTrace(); return null; } } | /**
* Creates a new group with the members of the group begining at the index <code>begin</code>
* and ending at the index <code>end</code>.
*
* @param begin
* - the begining index
* @param end
* - the ending index
* @return a group that contain the members of the group from <code>begin</code> to
* <code>end</code>. <code>null</code> if <code>begin > end</code>.
*/ | Creates a new group with the members of the group begining at the index <code>begin</code> and ending at the index <code>end</code> | range | {
"repo_name": "lpellegr/programming",
"path": "programming-core/src/main/java/org/objectweb/proactive/core/group/ProxyForGroup.java",
"license": "agpl-3.0",
"size": 55367
} | [
"org.objectweb.proactive.core.mop.ConstructionOfReifiedObjectFailedException"
] | import org.objectweb.proactive.core.mop.ConstructionOfReifiedObjectFailedException; | import org.objectweb.proactive.core.mop.*; | [
"org.objectweb.proactive"
] | org.objectweb.proactive; | 2,622,699 |
@Override
public String toString() {
StringBuilder buf = new StringBuilder(32);
switch (this.eventType) {
case TYPE_EXECUTE:
buf.append("EXECUTE");
break;
case TYPE_FETCH:
buf.append("FETCH");
break;
case TYPE_OBJECT_CREATION:
buf.append("CONSTRUCT");
break;
case TYPE_PREPARE:
buf.append("PREPARE");
break;
case TYPE_QUERY:
buf.append("QUERY");
break;
case TYPE_WARN:
buf.append("WARN");
break;
case TYPE_SLOW_QUERY:
buf.append("SLOW QUERY");
break;
default:
buf.append("UNKNOWN");
}
buf.append(" created: ");
buf.append(new Date(this.eventCreationTime));
buf.append(" duration: ");
buf.append(this.eventDuration);
buf.append(" connection: ");
buf.append(this.connectionId);
buf.append(" statement: ");
buf.append(this.statementId);
buf.append(" resultset: ");
buf.append(this.resultSetId);
if (this.message != null) {
buf.append(" message: ");
buf.append(this.message);
}
if (this.eventCreationPointDesc != null) {
buf.append("\n\nEvent Created at:\n");
buf.append(this.eventCreationPointDesc);
}
return buf.toString();
} | String function() { StringBuilder buf = new StringBuilder(32); switch (this.eventType) { case TYPE_EXECUTE: buf.append(STR); break; case TYPE_FETCH: buf.append("FETCH"); break; case TYPE_OBJECT_CREATION: buf.append(STR); break; case TYPE_PREPARE: buf.append(STR); break; case TYPE_QUERY: buf.append("QUERY"); break; case TYPE_WARN: buf.append("WARN"); break; case TYPE_SLOW_QUERY: buf.append(STR); break; default: buf.append(STR); } buf.append(STR); buf.append(new Date(this.eventCreationTime)); buf.append(STR); buf.append(this.eventDuration); buf.append(STR); buf.append(this.connectionId); buf.append(STR); buf.append(this.statementId); buf.append(STR); buf.append(this.resultSetId); if (this.message != null) { buf.append(STR); buf.append(this.message); } if (this.eventCreationPointDesc != null) { buf.append(STR); buf.append(this.eventCreationPointDesc); } return buf.toString(); } | /**
* Returns a representation of this event as a String.
*
* @return a String representation of this event.
*/ | Returns a representation of this event as a String | toString | {
"repo_name": "richardgutkowski/ansible-roles",
"path": "stash/files/mysql-connector-java-5.1.35/src/com/mysql/jdbc/profiler/ProfilerEvent.java",
"license": "mit",
"size": 14272
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,615,098 |
public void handleStateMessage(SmartthingsStateData stateData) {
// First locate the channel
Channel matchingChannel = null;
for (Channel ch : thing.getChannels()) {
if (ch.getUID().getAsString().endsWith(stateData.capabilityAttribute)) {
matchingChannel = ch;
break;
}
}
if (matchingChannel == null) {
return;
}
SmartthingsConverter converter = converters.get(matchingChannel.getUID());
// If value from Smartthings is null then stop here
State state;
if (stateData.value != null) {
state = converter.convertToOpenHab(matchingChannel.getAcceptedItemType(), stateData);
} else {
state = UnDefType.NULL;
}
updateState(matchingChannel.getUID(), state);
logger.trace("Smartthings updated State for channel: {} to {}", matchingChannel.getUID().getAsString(),
state.toString());
} | void function(SmartthingsStateData stateData) { Channel matchingChannel = null; for (Channel ch : thing.getChannels()) { if (ch.getUID().getAsString().endsWith(stateData.capabilityAttribute)) { matchingChannel = ch; break; } } if (matchingChannel == null) { return; } SmartthingsConverter converter = converters.get(matchingChannel.getUID()); State state; if (stateData.value != null) { state = converter.convertToOpenHab(matchingChannel.getAcceptedItemType(), stateData); } else { state = UnDefType.NULL; } updateState(matchingChannel.getUID(), state); logger.trace(STR, matchingChannel.getUID().getAsString(), state.toString()); } | /**
* State messages sent from the hub arrive here, are processed and the openHab state is updated.
*
* @param stateData
*/ | State messages sent from the hub arrive here, are processed and the openHab state is updated | handleStateMessage | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.smartthings/src/main/java/org/openhab/binding/smartthings/internal/handler/SmartthingsThingHandler.java",
"license": "epl-1.0",
"size": 11611
} | [
"org.openhab.binding.smartthings.internal.converter.SmartthingsConverter",
"org.openhab.binding.smartthings.internal.dto.SmartthingsStateData",
"org.openhab.core.thing.Channel",
"org.openhab.core.types.State",
"org.openhab.core.types.UnDefType"
] | import org.openhab.binding.smartthings.internal.converter.SmartthingsConverter; import org.openhab.binding.smartthings.internal.dto.SmartthingsStateData; import org.openhab.core.thing.Channel; import org.openhab.core.types.State; import org.openhab.core.types.UnDefType; | import org.openhab.binding.smartthings.internal.converter.*; import org.openhab.binding.smartthings.internal.dto.*; import org.openhab.core.thing.*; import org.openhab.core.types.*; | [
"org.openhab.binding",
"org.openhab.core"
] | org.openhab.binding; org.openhab.core; | 2,067,745 |
public static void closeCoreWindows() {
TopComponent directoryTree = null;
TopComponent favorites = null;
final WindowManager windowManager = WindowManager.getDefault();
// Set the UI selections to null before closing the top components.
// Otherwise it may experience errors trying to load data for the closed case.
for (Mode mode : windowManager.getModes()) {
for (TopComponent tc : windowManager.getOpenedTopComponents(mode)) {
if(tc instanceof DataContent) {
((DataContent) tc).setNode(null);
} else if(tc instanceof DataResult) {
((DataResult) tc).setNode(null);
}
}
}
for (Mode mode : windowManager.getModes()) {
for (TopComponent tc : windowManager.getOpenedTopComponents(mode)) {
String tcName = tc.getName();
if (tcName == null) {
logger.log(Level.INFO, "tcName was null"); //NON-NLS
}
// switch requires constant strings, so converted to if/else.
if (DIRECTORY_TREE.equals(tcName)) {
directoryTree = tc;
} else if (FAVORITES.equals(tcName)) {
favorites = tc;
} else {
tc.close();
}
}
}
if (directoryTree != null) {
directoryTree.close();
}
if (favorites != null) {
favorites.close();
}
} | static void function() { TopComponent directoryTree = null; TopComponent favorites = null; final WindowManager windowManager = WindowManager.getDefault(); for (Mode mode : windowManager.getModes()) { for (TopComponent tc : windowManager.getOpenedTopComponents(mode)) { if(tc instanceof DataContent) { ((DataContent) tc).setNode(null); } else if(tc instanceof DataResult) { ((DataResult) tc).setNode(null); } } } for (Mode mode : windowManager.getModes()) { for (TopComponent tc : windowManager.getOpenedTopComponents(mode)) { String tcName = tc.getName(); if (tcName == null) { logger.log(Level.INFO, STR); } if (DIRECTORY_TREE.equals(tcName)) { directoryTree = tc; } else if (FAVORITES.equals(tcName)) { favorites = tc; } else { tc.close(); } } } if (directoryTree != null) { directoryTree.close(); } if (favorites != null) { favorites.close(); } } | /**
* Closes all TopComponent windows that needed
* ({@link DataExplorer}, {@link DataResult}, and {@link DataContent}).
*
* Note: The DataContent Top Component must be closed before the Directory
* Tree and Favorites Top Components. Otherwise a NullPointerException will
* be thrown from JFXPanel.
*/ | Closes all TopComponent windows that needed (<code>DataExplorer</code>, <code>DataResult</code>, and <code>DataContent</code>). Note: The DataContent Top Component must be closed before the Directory Tree and Favorites Top Components. Otherwise a NullPointerException will be thrown from JFXPanel | closeCoreWindows | {
"repo_name": "sleuthkit/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/CoreComponentControl.java",
"license": "apache-2.0",
"size": 5390
} | [
"java.util.logging.Level",
"org.openide.windows.Mode",
"org.openide.windows.TopComponent",
"org.openide.windows.WindowManager"
] | import java.util.logging.Level; import org.openide.windows.Mode; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; | import java.util.logging.*; import org.openide.windows.*; | [
"java.util",
"org.openide.windows"
] | java.util; org.openide.windows; | 1,359,524 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.