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 void knownLink(PhysicalLink link); | void function(PhysicalLink link); | /**
* Sets the linkid back to the original linkid for a physical link that
* previously existed and has gone away and come back.
*
* @param link
* - the new link that has just been detected,
* @return a linkId if this link was known, otherwise null
*/ | Sets the linkid back to the original linkid for a physical link that previously existed and has gone away and come back | knownLink | {
"repo_name": "hujw/L2OVX",
"path": "src/main/java/net/onrc/openvirtex/elements/Mappable.java",
"license": "apache-2.0",
"size": 12656
} | [
"net.onrc.openvirtex.elements.link.PhysicalLink"
] | import net.onrc.openvirtex.elements.link.PhysicalLink; | import net.onrc.openvirtex.elements.link.*; | [
"net.onrc.openvirtex"
] | net.onrc.openvirtex; | 2,718,699 |
protected Hashtable<String,String> getEnvironment() {
return env;
}
| Hashtable<String,String> function() { return env; } | /**
* Gets derived CGI environment
*
* @return CGI environment
*
*/ | Gets derived CGI environment | getEnvironment | {
"repo_name": "wenzhucjy/tomcat_source",
"path": "tomcat-8.0.9-sourcecode/java/org/apache/catalina/servlets/CGIServlet.java",
"license": "apache-2.0",
"size": 73145
} | [
"java.util.Hashtable"
] | import java.util.Hashtable; | import java.util.*; | [
"java.util"
] | java.util; | 2,261,845 |
private void addPropertyValueField(JPanel panel) {
m_propertyValueField = new JTextField();
m_propertyValueField.setFont(m_font);
JLabel lbl = new JLabel(m_guiText.getString("PropertyNameLabel"));
lbl.setFont(m_font);
panel.add(lbl);
panel.add(m_propertyValueField);
}
| void function(JPanel panel) { m_propertyValueField = new JTextField(); m_propertyValueField.setFont(m_font); JLabel lbl = new JLabel(m_guiText.getString(STR)); lbl.setFont(m_font); panel.add(lbl); panel.add(m_propertyValueField); } | /**
* This method adds a notification property value field to the panel.
*
* @param panel to which the property value field should be added
*/ | This method adds a notification property value field to the panel | addPropertyValueField | {
"repo_name": "kyle0311/oliot-fc",
"path": "fc-client/src/main/java/org/fosstrak/ale/client/tabs/ALELRClient.java",
"license": "lgpl-2.1",
"size": 17063
} | [
"javax.swing.JLabel",
"javax.swing.JPanel",
"javax.swing.JTextField"
] | import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,022,063 |
@Override
public void onConnected(Bundle connectionHint) {
updateConnectButtonState();
setProgressBarVisible(false);
onPlusClientSignIn();
} | void function(Bundle connectionHint) { updateConnectButtonState(); setProgressBarVisible(false); onPlusClientSignIn(); } | /**
* Successfully connected (called by PlusClient)
*/ | Successfully connected (called by PlusClient) | onConnected | {
"repo_name": "deanmsands3/PersonnelTracker",
"path": "app/src/main/java/com/deanmsands3/mac/personneltracker/PlusBaseActivity.java",
"license": "mit",
"size": 9984
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 985,339 |
CompassMoreLikeThisQuery moreLikeThis(Reader reader); | CompassMoreLikeThisQuery moreLikeThis(Reader reader); | /**
* Constructs a more like this query to find hits that are similar to
* the give text represented by the reader.
*/ | Constructs a more like this query to find hits that are similar to the give text represented by the reader | moreLikeThis | {
"repo_name": "vthriller/opensymphony-compass-backup",
"path": "src/main/src/org/compass/core/CompassQueryBuilder.java",
"license": "apache-2.0",
"size": 27584
} | [
"java.io.Reader"
] | import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 1,194,184 |
@Test
public void testGrouperLevels() throws Exception{
ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); // 100 KB value, make it easy to have multiple files
//Need entropy to prevent compression so size is predictable with compression enabled/disabled
new Random().nextBytes(value.array());
// Enough data to have a level 1 and 2
int rows = 40;
int columns = 20;
// Adds enough data to trigger multiple sstable per level
for (int r = 0; r < rows; r++)
{
UpdateBuilder update = UpdateBuilder.create(cfs.metadata(), String.valueOf(r));
for (int c = 0; c < columns; c++)
update.newRow("column" + c).add("val", value);
update.applyUnsafe();
cfs.forceBlockingFlush();
}
waitForLeveling(cfs);
CompactionStrategyManager strategyManager = cfs.getCompactionStrategyManager();
// Checking we're not completely bad at math
int l1Count = strategyManager.getSSTableCountPerLevel()[1];
int l2Count = strategyManager.getSSTableCountPerLevel()[2];
if (l1Count == 0 || l2Count == 0)
{
logger.error("L1 or L2 has 0 sstables. Expected > 0 on both.");
logger.error("L1: " + l1Count);
logger.error("L2: " + l2Count);
Assert.fail();
}
Collection<Collection<SSTableReader>> groupedSSTables = cfs.getCompactionStrategyManager().groupSSTablesForAntiCompaction(cfs.getLiveSSTables());
for (Collection<SSTableReader> sstableGroup : groupedSSTables)
{
int groupLevel = -1;
Iterator<SSTableReader> it = sstableGroup.iterator();
while (it.hasNext())
{
SSTableReader sstable = it.next();
int tableLevel = sstable.getSSTableLevel();
if (groupLevel == -1)
groupLevel = tableLevel;
assert groupLevel == tableLevel;
}
}
} | void function() throws Exception{ ByteBuffer value = ByteBuffer.wrap(new byte[100 * 1024]); new Random().nextBytes(value.array()); int rows = 40; int columns = 20; for (int r = 0; r < rows; r++) { UpdateBuilder update = UpdateBuilder.create(cfs.metadata(), String.valueOf(r)); for (int c = 0; c < columns; c++) update.newRow(STR + c).add("val", value); update.applyUnsafe(); cfs.forceBlockingFlush(); } waitForLeveling(cfs); CompactionStrategyManager strategyManager = cfs.getCompactionStrategyManager(); int l1Count = strategyManager.getSSTableCountPerLevel()[1]; int l2Count = strategyManager.getSSTableCountPerLevel()[2]; if (l1Count == 0 l2Count == 0) { logger.error(STR); logger.error(STR + l1Count); logger.error(STR + l2Count); Assert.fail(); } Collection<Collection<SSTableReader>> groupedSSTables = cfs.getCompactionStrategyManager().groupSSTablesForAntiCompaction(cfs.getLiveSSTables()); for (Collection<SSTableReader> sstableGroup : groupedSSTables) { int groupLevel = -1; Iterator<SSTableReader> it = sstableGroup.iterator(); while (it.hasNext()) { SSTableReader sstable = it.next(); int tableLevel = sstable.getSSTableLevel(); if (groupLevel == -1) groupLevel = tableLevel; assert groupLevel == tableLevel; } } } | /**
* Ensure that the grouping operation preserves the levels of grouped tables
*/ | Ensure that the grouping operation preserves the levels of grouped tables | testGrouperLevels | {
"repo_name": "cooldoger/cassandra",
"path": "test/unit/org/apache/cassandra/db/compaction/LeveledCompactionStrategyTest.java",
"license": "apache-2.0",
"size": 21177
} | [
"java.nio.ByteBuffer",
"java.util.Collection",
"java.util.Iterator",
"java.util.Random",
"org.apache.cassandra.UpdateBuilder",
"org.apache.cassandra.io.sstable.format.SSTableReader",
"org.junit.Assert"
] | import java.nio.ByteBuffer; import java.util.Collection; import java.util.Iterator; import java.util.Random; import org.apache.cassandra.UpdateBuilder; import org.apache.cassandra.io.sstable.format.SSTableReader; import org.junit.Assert; | import java.nio.*; import java.util.*; import org.apache.cassandra.*; import org.apache.cassandra.io.sstable.format.*; import org.junit.*; | [
"java.nio",
"java.util",
"org.apache.cassandra",
"org.junit"
] | java.nio; java.util; org.apache.cassandra; org.junit; | 1,482,991 |
public Boolean isDeferredSyntaxAllowedAsLiteral()
{
return Strings.isTrue(childNode.getTextValueForPatternName("deferred-syntax-allowed-as-literal"));
} | Boolean function() { return Strings.isTrue(childNode.getTextValueForPatternName(STR)); } | /**
* Returns the <code>deferred-syntax-allowed-as-literal</code> element
* @return the node defined for the element <code>deferred-syntax-allowed-as-literal</code>
*/ | Returns the <code>deferred-syntax-allowed-as-literal</code> element | isDeferredSyntaxAllowedAsLiteral | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jsp21/JspPropertyGroupTypeImpl.java",
"license": "epl-1.0",
"size": 21354
} | [
"org.jboss.shrinkwrap.descriptor.impl.base.Strings"
] | import org.jboss.shrinkwrap.descriptor.impl.base.Strings; | import org.jboss.shrinkwrap.descriptor.impl.base.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 2,538,469 |
@Test
public void testTomcat7_0_32_WithTransferEncoding() throws Exception
{
DummyServer server = new DummyServer();
int bufferSize = 512;
QueuedThreadPool threadPool = new QueuedThreadPool();
WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize);
try
{
server.start();
// Setup Client Factory
threadPool.start();
factory.start();
// Create Client
WebSocketClient client = new WebSocketClient(factory); | void function() throws Exception { DummyServer server = new DummyServer(); int bufferSize = 512; QueuedThreadPool threadPool = new QueuedThreadPool(); WebSocketClientFactory factory = new WebSocketClientFactory(threadPool, new ZeroMaskGen(), bufferSize); try { server.start(); threadPool.start(); factory.start(); WebSocketClient client = new WebSocketClient(factory); | /**
* Test for when encountering a "Transfer-Encoding: chunked" on a Upgrade Response header.
* <ul>
* <li><a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=393075">Eclipse Jetty Bug #393075</a></li>
* <li><a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=54067">Apache Tomcat Bug #54067</a></li>
* </ul>
* @throws IOException
*/ | Test for when encountering a "Transfer-Encoding: chunked" on a Upgrade Response header. Eclipse Jetty Bug #393075 Apache Tomcat Bug #54067 | testTomcat7_0_32_WithTransferEncoding | {
"repo_name": "xmpace/jetty-read",
"path": "jetty-websocket/src/test/java/org/eclipse/jetty/websocket/TomcatServerQuirksTest.java",
"license": "apache-2.0",
"size": 4674
} | [
"org.eclipse.jetty.util.thread.QueuedThreadPool",
"org.eclipse.jetty.websocket.dummy.DummyServer"
] | import org.eclipse.jetty.util.thread.QueuedThreadPool; import org.eclipse.jetty.websocket.dummy.DummyServer; | import org.eclipse.jetty.util.thread.*; import org.eclipse.jetty.websocket.dummy.*; | [
"org.eclipse.jetty"
] | org.eclipse.jetty; | 1,283,528 |
private File getAsterixDistributableLocation() {
//Look in the PWD for the "asterix" folder
File tarDir = new File("asterix");
if (!tarDir.exists()) {
throw new IllegalArgumentException(
"Default directory structure not in use- please specify an asterix zip and base config file to distribute");
}
FileFilter tarFilter = new WildcardFileFilter("asterix-server*.zip");
File[] tarFiles = tarDir.listFiles(tarFilter);
if (tarFiles.length != 1) {
throw new IllegalArgumentException(
"There is more than one canonically named asterix distributable in the default directory. Please leave only one there.");
}
return tarFiles[0];
} | File function() { File tarDir = new File(STR); if (!tarDir.exists()) { throw new IllegalArgumentException( STR); } FileFilter tarFilter = new WildcardFileFilter(STR); File[] tarFiles = tarDir.listFiles(tarFilter); if (tarFiles.length != 1) { throw new IllegalArgumentException( STR); } return tarFiles[0]; } | /**
* Find the distributable asterix bundle, be it in the default location or in a user-specified location.
*
* @return
*/ | Find the distributable asterix bundle, be it in the default location or in a user-specified location | getAsterixDistributableLocation | {
"repo_name": "heriram/incubator-asterixdb",
"path": "asterixdb/asterix-yarn/src/main/java/org/apache/asterix/aoya/AsterixYARNClient.java",
"license": "apache-2.0",
"size": 60691
} | [
"java.io.File",
"java.io.FileFilter",
"org.apache.commons.io.filefilter.WildcardFileFilter"
] | import java.io.File; import java.io.FileFilter; import org.apache.commons.io.filefilter.WildcardFileFilter; | import java.io.*; import org.apache.commons.io.filefilter.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 562,092 |
protected boolean checkEmptyDocumentField(String propertyName, Object valueToTest, String parameter) {
boolean success = true;
success = checkEmptyValue(valueToTest);
if (!success) {
putDocumentError(propertyName, RiceKeyConstants.ERROR_REQUIRED, parameter);
}
return success;
}
| boolean function(String propertyName, Object valueToTest, String parameter) { boolean success = true; success = checkEmptyValue(valueToTest); if (!success) { putDocumentError(propertyName, RiceKeyConstants.ERROR_REQUIRED, parameter); } return success; } | /**
* This method accepts document field (such as , and attempts to determine whether it is empty by this method's
* definition.
*
* OBJECT RESULT null false empty-string false whitespace false otherwise true
*
* If the result is false, it will add document field error to the Global Errors.
*
* @param valueToTest - any object to test, usually a String
* @param propertyName - the name of the property being tested
* @return true or false, by the description above
*/ | This method accepts document field (such as , and attempts to determine whether it is empty by this method's definition. OBJECT RESULT null false empty-string false whitespace false otherwise true If the result is false, it will add document field error to the Global Errors | checkEmptyDocumentField | {
"repo_name": "sbower/kuali-rice-1",
"path": "krad/krad-web-framework/src/main/java/org/kuali/rice/krad/rules/MaintenanceDocumentRuleBase.java",
"license": "apache-2.0",
"size": 61237
} | [
"org.kuali.rice.core.api.util.RiceKeyConstants"
] | import org.kuali.rice.core.api.util.RiceKeyConstants; | import org.kuali.rice.core.api.util.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 956,605 |
String getNodeLocation(long nodeId) throws SQLException; | String getNodeLocation(long nodeId) throws SQLException; | /**
* Retrieve nodeLocation from the node table of the database given a particular
* nodeId.
*
* @param nodeId
* Node identifier
*
* @return nodeLocation Retrieved nodeLocation
*
* @throws SQLException
* if database error encountered
*/ | Retrieve nodeLocation from the node table of the database given a particular nodeId | getNodeLocation | {
"repo_name": "aihua/opennms",
"path": "features/events/daemon/src/main/java/org/opennms/netmgt/eventd/EventUtil.java",
"license": "agpl-3.0",
"size": 4374
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 349,959 |
public Set<String> getOutFilter() {
if (outFilter == null) {
outFilter = new HashSet<>();
}
return outFilter;
} | Set<String> function() { if (outFilter == null) { outFilter = new HashSet<>(); } return outFilter; } | /**
* Gets the "out" direction filter set. The "out" direction is referred to
* copying headers from a Camel message to an external message.
*
* @return a set that contains header names that should be excluded.
*/ | Gets the "out" direction filter set. The "out" direction is referred to copying headers from a Camel message to an external message | getOutFilter | {
"repo_name": "objectiser/camel",
"path": "core/camel-support/src/main/java/org/apache/camel/support/DefaultHeaderFilterStrategy.java",
"license": "apache-2.0",
"size": 9848
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,018,183 |
Connection<CL> openConnection() throws ConnectionException; | Connection<CL> openConnection() throws ConnectionException; | /**
* This open is different from borrowConnection in that it actually creates
* a new connection without waiting for one that may be idle. openConnection
* is still subject to all other connection pool limitations.
*
* @return
* @throws ConnectionException
*/ | This open is different from borrowConnection in that it actually creates a new connection without waiting for one that may be idle. openConnection is still subject to all other connection pool limitations | openConnection | {
"repo_name": "hector-client-org/hector-exp",
"path": "astyanax-pooling/src/main/java/com/netflix/astyanax/connectionpool/HostConnectionPool.java",
"license": "apache-2.0",
"size": 4409
} | [
"com.netflix.astyanax.connectionpool.exceptions.ConnectionException"
] | import com.netflix.astyanax.connectionpool.exceptions.ConnectionException; | import com.netflix.astyanax.connectionpool.exceptions.*; | [
"com.netflix.astyanax"
] | com.netflix.astyanax; | 1,196,289 |
public void config(final Marker marker, final String message, final Object... params); | void function(final Marker marker, final String message, final Object... params); | /**
* Logs a message with parameters at the;@code CONFIG} level.
*
* @param marker
* the marker data specific to this log statement
* @param message
* the message to log; the format depends on the message factory.
* @param params
* parameters to the message.
* @see #getMessageFactory()
*/ | Logs a message with parameters at the;@code CONFIG} level | config | {
"repo_name": "robertgeiger/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/logging/log4j/GemFireLogger.java",
"license": "apache-2.0",
"size": 27574
} | [
"org.apache.logging.log4j.Marker"
] | import org.apache.logging.log4j.Marker; | import org.apache.logging.log4j.*; | [
"org.apache.logging"
] | org.apache.logging; | 368,533 |
@Override
protected void doOptions(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setHeader("DAV", "1");
// TODO: Is there anything else to do?!
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("DAV", "1"); } | /**
* HTTP OPTIONS implementation.
*/ | HTTP OPTIONS implementation | doOptions | {
"repo_name": "wyona/yanel",
"path": "src/webapp/src/java/org/wyona/yanel/servlet/YanelServlet.java",
"license": "apache-2.0",
"size": 182219
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 787,127 |
private void setupPathParamId() {
MultivaluedMap<String, String> paramsMap = mock(MultivaluedMap.class);
when(paramsMap.get("id")).thenReturn(Arrays.asList("instanceId"));
UriInfo uriInfo = mock(UriInfo.class);
when(uriInfo.getPathParameters()).thenReturn(paramsMap);
when(request.getUriInfo()).thenReturn(uriInfo);
} | void function() { MultivaluedMap<String, String> paramsMap = mock(MultivaluedMap.class); when(paramsMap.get("id")).thenReturn(Arrays.asList(STR)); UriInfo uriInfo = mock(UriInfo.class); when(uriInfo.getPathParameters()).thenReturn(paramsMap); when(request.getUriInfo()).thenReturn(uriInfo); } | /**
* Setup path param id.
*/ | Setup path param id | setupPathParamId | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-export/src/test/java/com/sirma/sep/export/word/action/ExportWordBodyReaderTest.java",
"license": "lgpl-3.0",
"size": 3866
} | [
"java.util.Arrays",
"javax.ws.rs.core.MultivaluedMap",
"javax.ws.rs.core.UriInfo",
"org.mockito.Mockito"
] | import java.util.Arrays; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; import org.mockito.Mockito; | import java.util.*; import javax.ws.rs.core.*; import org.mockito.*; | [
"java.util",
"javax.ws",
"org.mockito"
] | java.util; javax.ws; org.mockito; | 2,015,189 |
public com.mozu.api.contracts.customer.InStockNotificationSubscription getInStockNotificationSubscription(Integer id, String responseFields) throws Exception
{
MozuClient<com.mozu.api.contracts.customer.InStockNotificationSubscription> client = com.mozu.api.clients.commerce.InStockNotificationSubscriptionClient.getInStockNotificationSubscriptionClient( id, responseFields);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
} | com.mozu.api.contracts.customer.InStockNotificationSubscription function(Integer id, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.customer.InStockNotificationSubscription> client = com.mozu.api.clients.commerce.InStockNotificationSubscriptionClient.getInStockNotificationSubscriptionClient( id, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* Retrieves the details of a subscription that sends a push notification when a product is available in a site's active stock.
* <p><pre><code>
* InStockNotificationSubscription instocknotificationsubscription = new InStockNotificationSubscription();
* InStockNotificationSubscription inStockNotificationSubscription = instocknotificationsubscription.getInStockNotificationSubscription( id, responseFields);
* </code></pre></p>
* @param id Unique identifier of the customer segment to retrieve.
* @param responseFields Use this field to include those fields which are not included by default.
* @return com.mozu.api.contracts.customer.InStockNotificationSubscription
* @see com.mozu.api.contracts.customer.InStockNotificationSubscription
*/ | Retrieves the details of a subscription that sends a push notification when a product is available in a site's active stock. <code><code> InStockNotificationSubscription instocknotificationsubscription = new InStockNotificationSubscription(); InStockNotificationSubscription inStockNotificationSubscription = instocknotificationsubscription.getInStockNotificationSubscription( id, responseFields); </code></code> | getInStockNotificationSubscription | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/InStockNotificationSubscriptionResource.java",
"license": "mit",
"size": 18984
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,651,795 |
@Deprecated
public static <R extends Readable & Closeable,
W extends Appendable & Closeable> long copy(InputSupplier<R> from,
OutputSupplier<W> to) throws IOException {
return asCharSource(from).copyTo(asCharSink(to));
} | static <R extends Readable & Closeable, W extends Appendable & Closeable> long function(InputSupplier<R> from, OutputSupplier<W> to) throws IOException { return asCharSource(from).copyTo(asCharSink(to)); } | /**
* Opens {@link Readable} and {@link Appendable} objects from the
* given factories, copies all characters between the two, and closes
* them.
*
* @param from the input factory
* @param to the output factory
* @return the number of characters copied
* @throws IOException if an I/O error occurs
* @deprecated Use {@link CharSource#copyTo(CharSink)} instead. This method is
* scheduled for removal in Guava 18.0.
*/ | Opens <code>Readable</code> and <code>Appendable</code> objects from the given factories, copies all characters between the two, and closes them | copy | {
"repo_name": "maxvetrenko/guava-libraries-17-0",
"path": "guava/src/com/google/common/io/CharStreams.java",
"license": "apache-2.0",
"size": 19794
} | [
"java.io.Closeable",
"java.io.IOException"
] | import java.io.Closeable; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,097,251 |
@POST
@Path("/update/{objectIdentifier}")
@Consumes(MediaType.APPLICATION_JSON + "; " + CHARSET)
@Produces(MediaType.APPLICATION_JSON + "; " + CHARSET)
public String updateItem(@PathParam("listIdentifier") String listIdentifier,
@PathParam("objectIdentifier") String objectIdentifier,
String payload) {
LOG.log(Level.INFO, "Updated item with id " + objectIdentifier + " in list " + listIdentifier + ": " + payload);
try (JsonReader jsonReader = Json.createReader(new StringReader(payload))) {
JsonObject jsonObject = jsonReader.readObject();
String title = jsonObject.containsKey("title") ? jsonObject.getString("title") : "";
String text = jsonObject.containsKey("text") ? jsonObject.getString("text") : "";
noteService.update(objectIdentifier, title, text);
}
return "{}";
} | @Path(STR) @Consumes(MediaType.APPLICATION_JSON + STR + CHARSET) @Produces(MediaType.APPLICATION_JSON + STR + CHARSET) String function(@PathParam(STR) String listIdentifier, @PathParam(STR) String objectIdentifier, String payload) { LOG.log(Level.INFO, STR + objectIdentifier + STR + listIdentifier + STR + payload); try (JsonReader jsonReader = Json.createReader(new StringReader(payload))) { JsonObject jsonObject = jsonReader.readObject(); String title = jsonObject.containsKey("titleSTRtitle") : STRtextSTRtextSTRSTR{}"; } | /**
* Called from Gluon CloudLink when an existing object is updated in a list. This implementation will update the
* object in the database.
*
* @param listIdentifier the identifier of the list where the object is updated in
* @param objectIdentifier the identifier of the object that is updated
* @param payload the raw JSON payload of the object that is updated
* @return an empty response, as the response is ignored by Gluon CloudLink
*/ | Called from Gluon CloudLink when an existing object is updated in a list. This implementation will update the object in the database | updateItem | {
"repo_name": "erwin1/gluon-samples",
"path": "cloudlink-rest-connector/src/main/java/com/gluonhq/samples/cloudlink/connector/rest/handler/ListHandler.java",
"license": "bsd-3-clause",
"size": 8353
} | [
"java.io.StringReader",
"java.util.logging.Level",
"javax.json.Json",
"javax.json.JsonObject",
"javax.json.JsonReader",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType"
] | import java.io.StringReader; import java.util.logging.Level; import javax.json.Json; import javax.json.JsonObject; import javax.json.JsonReader; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; | import java.io.*; import java.util.logging.*; import javax.json.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"java.io",
"java.util",
"javax.json",
"javax.ws"
] | java.io; java.util; javax.json; javax.ws; | 1,847,688 |
EAttribute getCommand_NewValue(); | EAttribute getCommand_NewValue(); | /**
* Returns the meta object for the attribute '{@link org.xtext.example.statemachine.statemachine.Command#isNewValue <em>New Value</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>New Value</em>'.
* @see org.xtext.example.statemachine.statemachine.Command#isNewValue()
* @see #getCommand()
* @generated
*/ | Returns the meta object for the attribute '<code>org.xtext.example.statemachine.statemachine.Command#isNewValue New Value</code>'. | getCommand_NewValue | {
"repo_name": "spoenemann/xtext-orion",
"path": "org.xtext.example.statemachine/src-gen/org/xtext/example/statemachine/statemachine/StatemachinePackage.java",
"license": "epl-1.0",
"size": 26885
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,445,997 |
protected AccessControlGroup group(String groupId, AccessControlGroup inherit, String... permissionIds) {
return group(groupId, Collections.singletonList(inherit), permissionIds);
} | AccessControlGroup function(String groupId, AccessControlGroup inherit, String... permissionIds) { return group(groupId, Collections.singletonList(inherit), permissionIds); } | /**
* Creates a new {@link AccessControlGroup} for static configuration of access controls.
*
* @param groupId {@link AccessControlGroup#getId() ID} of {@link AccessControlGroup} to create.
* @param inherit single {@link AccessControlGroup} to {@link AccessControlGroup#getInherits() inherit}.
* @param permissionIds {@link AccessControlPermission#getId() ID}s of the {@link #permission(String) permissions} to
* {@link AccessControlGroup#getPermissions() use}.
* @return the newly created and registered {@link AccessControlGroup}.
*/ | Creates a new <code>AccessControlGroup</code> for static configuration of access controls | group | {
"repo_name": "oasp/oasp4j",
"path": "modules/security/src/main/java/io/oasp/module/security/common/base/accesscontrol/AccessControlConfig.java",
"license": "apache-2.0",
"size": 4221
} | [
"io.oasp.module.security.common.api.accesscontrol.AccessControlGroup",
"java.util.Collections"
] | import io.oasp.module.security.common.api.accesscontrol.AccessControlGroup; import java.util.Collections; | import io.oasp.module.security.common.api.accesscontrol.*; import java.util.*; | [
"io.oasp.module",
"java.util"
] | io.oasp.module; java.util; | 2,468,957 |
public Drawable getBadgeDrawable() {
return mBadgeDrawable;
} | Drawable function() { return mBadgeDrawable; } | /**
* Returns the badge drawable.
*/ | Returns the badge drawable | getBadgeDrawable | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/support/v17/leanback/src/android/support/v17/leanback/app/VerticalGridSupportFragment.java",
"license": "gpl-3.0",
"size": 14530
} | [
"android.graphics.drawable.Drawable"
] | import android.graphics.drawable.Drawable; | import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 2,622,627 |
private int calculateSharesForTwoMandatoryResources(
ResourceInformation[] clusterRes, Resource first, Resource second,
double[] firstShares, double[] secondShares) {
ResourceInformation[] firstRes = first.getResources();
ResourceInformation[] secondRes = second.getResources();
firstShares[0] = calculateShare(clusterRes[0], firstRes[0]);
secondShares[0] = calculateShare(clusterRes[0], secondRes[0]);
firstShares[1] = calculateShare(clusterRes[1], firstRes[1]);
secondShares[1] = calculateShare(clusterRes[1], secondRes[1]);
int firstDom = 0;
int firstSub = 1;
if (firstShares[1] > firstShares[0]) {
firstDom = 1;
firstSub = 0;
}
int secondDom = 0;
int secondSub = 1;
if (secondShares[1] > secondShares[0]) {
secondDom = 1;
secondSub = 0;
}
if (firstShares[firstDom] > secondShares[secondDom]) {
return 1;
} else if (firstShares[firstDom] < secondShares[secondDom]) {
return -1;
} else if (firstShares[firstSub] > secondShares[secondSub]) {
return 1;
} else if (firstShares[firstSub] < secondShares[secondSub]) {
return -1;
} else {
return 0;
}
} | int function( ResourceInformation[] clusterRes, Resource first, Resource second, double[] firstShares, double[] secondShares) { ResourceInformation[] firstRes = first.getResources(); ResourceInformation[] secondRes = second.getResources(); firstShares[0] = calculateShare(clusterRes[0], firstRes[0]); secondShares[0] = calculateShare(clusterRes[0], secondRes[0]); firstShares[1] = calculateShare(clusterRes[1], firstRes[1]); secondShares[1] = calculateShare(clusterRes[1], secondRes[1]); int firstDom = 0; int firstSub = 1; if (firstShares[1] > firstShares[0]) { firstDom = 1; firstSub = 0; } int secondDom = 0; int secondSub = 1; if (secondShares[1] > secondShares[0]) { secondDom = 1; secondSub = 0; } if (firstShares[firstDom] > secondShares[secondDom]) { return 1; } else if (firstShares[firstDom] < secondShares[secondDom]) { return -1; } else if (firstShares[firstSub] > secondShares[secondSub]) { return 1; } else if (firstShares[firstSub] < secondShares[secondSub]) { return -1; } else { return 0; } } | /**
* Calculate the shares for {@code first} and {@code second} according to
* {@code clusterRes}, and store the results in {@code firstShares} and
* {@code secondShares}, respectively. All parameters must be non-null.
* This method assumes that the length of {@code clusterRes} is exactly 2 and
* makes performance optimizations based on that assumption.
* @param clusterRes the array of ResourceInformation instances that
* represents the cluster's maximum resources
* @param first the first resource to compare
* @param second the second resource to compare
* @param firstShares an array to store the shares for the first resource
* @param secondShares an array to store the shares for the second resource
* @return -1.0, 0.0, or 1.0, depending on whether the max share of the first
* resource is less than, equal to, or greater than the max share of the
* second resource, respectively
* @throws NullPointerException if any parameter is null
*/ | Calculate the shares for first and second according to clusterRes, and store the results in firstShares and secondShares, respectively. All parameters must be non-null. This method assumes that the length of clusterRes is exactly 2 and makes performance optimizations based on that assumption | calculateSharesForTwoMandatoryResources | {
"repo_name": "soumabrata-chakraborty/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/resource/DominantResourceCalculator.java",
"license": "apache-2.0",
"size": 22418
} | [
"org.apache.hadoop.yarn.api.records.Resource",
"org.apache.hadoop.yarn.api.records.ResourceInformation"
] | import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceInformation; | import org.apache.hadoop.yarn.api.records.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 837,360 |
boolean isInverted();
/**
* Sets the mode in which {@link #match(com.mucommander.commons.file.AbstractFile)} operates. If <code>true</code>, this
* filter will operate in inverted mode: files that would be accepted by {@link #match(com.mucommander.commons.file.AbstractFile)} | boolean isInverted(); /** * Sets the mode in which {@link #match(com.mucommander.commons.file.AbstractFile)} operates. If <code>true</code>, this * filter will operate in inverted mode: files that would be accepted by {@link #match(com.mucommander.commons.file.AbstractFile)} | /**
* Return <code>true</code> if this filter operates in normal mode, <code>false</code> if in inverted mode.
*
* @return true if this filter operates in normal mode, false if in inverted mode
*/ | Return <code>true</code> if this filter operates in normal mode, <code>false</code> if in inverted mode | isInverted | {
"repo_name": "Keltek/mucommander",
"path": "src/main/com/mucommander/commons/file/filter/FileFilter.java",
"license": "gpl-3.0",
"size": 7087
} | [
"com.mucommander.commons.file.AbstractFile"
] | import com.mucommander.commons.file.AbstractFile; | import com.mucommander.commons.file.*; | [
"com.mucommander.commons"
] | com.mucommander.commons; | 2,649,200 |
public void testURLBadEscape() throws IOException {
File file = new File("output/urlbadescape.properties");
FileWriter writer = new FileWriter(file);
writer.write("log4j.rootLogger=\\uXX41");
writer.close();
URL url = file.toURL();
PropertyConfigurator.configure(url);
assertTrue(file.delete());
assertFalse(file.exists());
} | void function() throws IOException { File file = new File(STR); FileWriter writer = new FileWriter(file); writer.write(STR); writer.close(); URL url = file.toURL(); PropertyConfigurator.configure(url); assertTrue(file.delete()); assertFalse(file.exists()); } | /**
* Test for bug 40944.
* configure(URL) did not catch IllegalArgumentException and
* did not close stream.
* @throws IOException if IOException creating properties file.
*/ | Test for bug 40944. configure(URL) did not catch IllegalArgumentException and did not close stream | testURLBadEscape | {
"repo_name": "cacheonix/cacheonix-core",
"path": "3rdparty/apache-log4j-1.2.15/tests/src/java/org/apache/log4j/PropertyConfiguratorTest.java",
"license": "lgpl-2.1",
"size": 3465
} | [
"java.io.File",
"java.io.FileWriter",
"java.io.IOException"
] | import java.io.File; import java.io.FileWriter; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,883,078 |
public String getFullFilePath(WPBFile file) throws WPBIOException;
| String function(WPBFile file) throws WPBIOException; | /**
* Given a WPBFile the method returns the full file path.
* @param file Instance of WPBFile that can represent a file or a directory.
* @return Returns the full file path. For the files located in root the method returns their file name.
* @throws WPBIOException Exception
*/ | Given a WPBFile the method returns the full file path | getFullFilePath | {
"repo_name": "webpagebytes/cms",
"path": "src/main/java/com/webpagebytes/cms/WPBFilesCache.java",
"license": "apache-2.0",
"size": 1999
} | [
"com.webpagebytes.cms.cmsdata.WPBFile",
"com.webpagebytes.cms.exception.WPBIOException"
] | import com.webpagebytes.cms.cmsdata.WPBFile; import com.webpagebytes.cms.exception.WPBIOException; | import com.webpagebytes.cms.cmsdata.*; import com.webpagebytes.cms.exception.*; | [
"com.webpagebytes.cms"
] | com.webpagebytes.cms; | 1,636,695 |
static void addToRootFileCache(File sourceFile, JarFile jarFile) {
Map<File, JarFile> cache = rootFileCache.get();
if (cache == null) {
cache = new ConcurrentHashMap<>();
rootFileCache = new SoftReference<>(cache);
}
cache.put(sourceFile, jarFile);
} | static void addToRootFileCache(File sourceFile, JarFile jarFile) { Map<File, JarFile> cache = rootFileCache.get(); if (cache == null) { cache = new ConcurrentHashMap<>(); rootFileCache = new SoftReference<>(cache); } cache.put(sourceFile, jarFile); } | /**
* Add the given {@link JarFile} to the root file cache.
* @param sourceFile the source file to add
* @param jarFile the jar file.
*/ | Add the given <code>JarFile</code> to the root file cache | addToRootFileCache | {
"repo_name": "olivergierke/spring-boot",
"path": "spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java",
"license": "apache-2.0",
"size": 9387
} | [
"java.io.File",
"java.lang.ref.SoftReference",
"java.util.Map",
"java.util.concurrent.ConcurrentHashMap"
] | import java.io.File; import java.lang.ref.SoftReference; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; | import java.io.*; import java.lang.ref.*; import java.util.*; import java.util.concurrent.*; | [
"java.io",
"java.lang",
"java.util"
] | java.io; java.lang; java.util; | 2,872,619 |
public static void assertEqualsAndHashCode(String itemNames, Object objectA, Object objectB)
{
try
{
if (objectA == null || objectB == null)
{
Assert.fail("Neither item should be null: <" + objectA + "> <" + objectB + '>');
}
Assert.assertFalse("Neither item should equal null", objectA.equals(null));
Assert.assertFalse("Neither item should equal null", objectB.equals(null));
Verify.assertNotEquals("Neither item should equal new Object()", objectA.equals(new Object()));
Verify.assertNotEquals("Neither item should equal new Object()", objectB.equals(new Object()));
Assert.assertEquals("Expected " + itemNames + " to be equal.", objectA, objectA);
Assert.assertEquals("Expected " + itemNames + " to be equal.", objectB, objectB);
Assert.assertEquals("Expected " + itemNames + " to be equal.", objectA, objectB);
Assert.assertEquals("Expected " + itemNames + " to be equal.", objectB, objectA);
Assert.assertEquals(
"Expected " + itemNames + " to have the same hashCode().",
objectA.hashCode(),
objectB.hashCode());
}
catch (AssertionError e)
{
Verify.throwMangledException(e);
}
} | static void function(String itemNames, Object objectA, Object objectB) { try { if (objectA == null objectB == null) { Assert.fail(STR + objectA + STR + objectB + '>'); } Assert.assertFalse(STR, objectA.equals(null)); Assert.assertFalse(STR, objectB.equals(null)); Verify.assertNotEquals(STR, objectA.equals(new Object())); Verify.assertNotEquals(STR, objectB.equals(new Object())); Assert.assertEquals(STR + itemNames + STR, objectA, objectA); Assert.assertEquals(STR + itemNames + STR, objectB, objectB); Assert.assertEquals(STR + itemNames + STR, objectA, objectB); Assert.assertEquals(STR + itemNames + STR, objectB, objectA); Assert.assertEquals( STR + itemNames + STR, objectA.hashCode(), objectB.hashCode()); } catch (AssertionError e) { Verify.throwMangledException(e); } } | /**
* Assert that {@code objectA} and {@code objectB} are equal (via the {@link Object#equals(Object)} method,
* and that they both return the same {@link Object#hashCode()}.
*/ | Assert that objectA and objectB are equal (via the <code>Object#equals(Object)</code> method, and that they both return the same <code>Object#hashCode()</code> | assertEqualsAndHashCode | {
"repo_name": "bhav0904/eclipse-collections",
"path": "eclipse-collections-testutils/src/main/java/org/eclipse/collections/impl/test/Verify.java",
"license": "bsd-3-clause",
"size": 138680
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,592,665 |
public static void tryOpenIndex(Path indexLocation, ShardId shardId, NodeEnvironment.ShardLocker shardLocker, Logger logger) throws IOException, ShardLockObtainFailedException {
try (ShardLock lock = shardLocker.lock(shardId, "open index", TimeUnit.SECONDS.toMillis(5));
Directory dir = new SimpleFSDirectory(indexLocation)) {
failIfCorrupted(dir);
SegmentInfos segInfo = Lucene.readSegmentInfos(dir);
logger.trace("{} loaded segment info [{}]", shardId, segInfo);
}
} | static void function(Path indexLocation, ShardId shardId, NodeEnvironment.ShardLocker shardLocker, Logger logger) throws IOException, ShardLockObtainFailedException { try (ShardLock lock = shardLocker.lock(shardId, STR, TimeUnit.SECONDS.toMillis(5)); Directory dir = new SimpleFSDirectory(indexLocation)) { failIfCorrupted(dir); SegmentInfos segInfo = Lucene.readSegmentInfos(dir); logger.trace(STR, shardId, segInfo); } } | /**
* Tries to open an index for the given location. This includes reading the
* segment infos and possible corruption markers. If the index can not
* be opened, an exception is thrown
*/ | Tries to open an index for the given location. This includes reading the segment infos and possible corruption markers. If the index can not be opened, an exception is thrown | tryOpenIndex | {
"repo_name": "EvilMcJerkface/crate",
"path": "server/src/main/java/org/elasticsearch/index/store/Store.java",
"license": "apache-2.0",
"size": 78110
} | [
"java.io.IOException",
"java.nio.file.Path",
"java.util.concurrent.TimeUnit",
"org.apache.logging.log4j.Logger",
"org.apache.lucene.index.SegmentInfos",
"org.apache.lucene.store.Directory",
"org.apache.lucene.store.SimpleFSDirectory",
"org.elasticsearch.common.lucene.Lucene",
"org.elasticsearch.env.NodeEnvironment",
"org.elasticsearch.env.ShardLock",
"org.elasticsearch.env.ShardLockObtainFailedException",
"org.elasticsearch.index.shard.ShardId"
] | import java.io.IOException; import java.nio.file.Path; import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.Logger; import org.apache.lucene.index.SegmentInfos; import org.apache.lucene.store.Directory; import org.apache.lucene.store.SimpleFSDirectory; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.env.NodeEnvironment; import org.elasticsearch.env.ShardLock; import org.elasticsearch.env.ShardLockObtainFailedException; import org.elasticsearch.index.shard.ShardId; | import java.io.*; import java.nio.file.*; import java.util.concurrent.*; import org.apache.logging.log4j.*; import org.apache.lucene.index.*; import org.apache.lucene.store.*; import org.elasticsearch.common.lucene.*; import org.elasticsearch.env.*; import org.elasticsearch.index.shard.*; | [
"java.io",
"java.nio",
"java.util",
"org.apache.logging",
"org.apache.lucene",
"org.elasticsearch.common",
"org.elasticsearch.env",
"org.elasticsearch.index"
] | java.io; java.nio; java.util; org.apache.logging; org.apache.lucene; org.elasticsearch.common; org.elasticsearch.env; org.elasticsearch.index; | 2,831,922 |
protected void afterIfFailed(List<Throwable> errors) {
} | void function(List<Throwable> errors) { } | /**
* Called when a test fails, supplying the errors it generated. Not called when the test fails because assumptions are violated.
*/ | Called when a test fails, supplying the errors it generated. Not called when the test fails because assumptions are violated | afterIfFailed | {
"repo_name": "yanjunh/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/ESTestCase.java",
"license": "apache-2.0",
"size": 40527
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,309,866 |
public static <T> Predicates<T> attributeNotIn(
Function<? super T, ?> function,
Iterable<?> iterable)
{
return new AttributePredicate<>(function, Predicates.notIn(iterable));
} | static <T> Predicates<T> function( Function<? super T, ?> function, Iterable<?> iterable) { return new AttributePredicate<>(function, Predicates.notIn(iterable)); } | /**
* Creates a predicate which returns true if an attribute selected from an object passed to accept method
* is not contained in the iterable.
*/ | Creates a predicate which returns true if an attribute selected from an object passed to accept method is not contained in the iterable | attributeNotIn | {
"repo_name": "bhav0904/eclipse-collections",
"path": "eclipse-collections/src/main/java/org/eclipse/collections/impl/block/factory/Predicates.java",
"license": "bsd-3-clause",
"size": 44742
} | [
"org.eclipse.collections.api.block.function.Function"
] | import org.eclipse.collections.api.block.function.Function; | import org.eclipse.collections.api.block.function.*; | [
"org.eclipse.collections"
] | org.eclipse.collections; | 147,294 |
public View create(Element elem)
{
// Subclasses have to implement this to get this functionality.
return null;
} | View function(Element elem) { return null; } | /**
* Creates a {@link View} for the specified {@link Element}.
*
* @param elem the <code>Element</code> to create a <code>View</code> for
*
* @see ViewFactory
*/ | Creates a <code>View</code> for the specified <code>Element</code> | create | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicTextUI.java",
"license": "bsd-3-clause",
"size": 41609
} | [
"javax.swing.text.Element",
"javax.swing.text.View"
] | import javax.swing.text.Element; import javax.swing.text.View; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 482,310 |
public void markMoveTargets(String nodeId) throws PortalException {
throw new UnsupportedOperationException(
"Use an appropriate " + "processor for adding targets.");
} | void function(String nodeId) throws PortalException { throw new UnsupportedOperationException( STR + STR); } | /**
* Unsupported operation in DLM. This feature is handled by pluggable processors in the DLM
* processing pipe. See properties/dlmContext.xml.
*/ | Unsupported operation in DLM. This feature is handled by pluggable processors in the DLM processing pipe. See properties/dlmContext.xml | markMoveTargets | {
"repo_name": "jhelmer-unicon/uPortal",
"path": "uportal-war/src/main/java/org/apereo/portal/layout/dlm/DistributedLayoutManager.java",
"license": "apache-2.0",
"size": 64473
} | [
"org.apereo.portal.PortalException"
] | import org.apereo.portal.PortalException; | import org.apereo.portal.*; | [
"org.apereo.portal"
] | org.apereo.portal; | 1,460,836 |
@Override
public void dropTable(String table) {
DrillFileSystem fs = getFS();
String defaultLocation = getDefaultLocation();
try {
if (!isHomogeneous(table)) {
throw UserException
.validationError()
.message("Table contains different file formats. \n" +
"Drop Table is only supported for directories that contain homogeneous file formats consumable by Drill")
.build(logger);
}
StringBuilder tableRenameBuilder = new StringBuilder();
int lastSlashIndex = table.lastIndexOf(Path.SEPARATOR);
if (lastSlashIndex != -1) {
tableRenameBuilder.append(table.substring(0, lastSlashIndex + 1));
}
// Generate unique identifier which will be added as a suffix to the table name
ThreadLocalRandom r = ThreadLocalRandom.current();
long time = (System.currentTimeMillis()/1000);
Long p1 = ((Integer.MAX_VALUE - time) << 32) + r.nextInt();
Long p2 = r.nextLong();
final String fileNameDelimiter = DrillFileSystem.UNDERSCORE_PREFIX;
String[] pathSplit = table.split(Path.SEPARATOR);
tableRenameBuilder
.append(DrillFileSystem.UNDERSCORE_PREFIX)
.append(pathSplit[pathSplit.length - 1])
.append(fileNameDelimiter)
.append(p1.toString())
.append(fileNameDelimiter)
.append(p2.toString());
String tableRename = tableRenameBuilder.toString();
fs.rename(new Path(defaultLocation, table), new Path(defaultLocation, tableRename));
fs.delete(new Path(defaultLocation, tableRename), true);
} catch (AccessControlException e) {
throw UserException
.permissionError(e)
.message("Unauthorized to drop table")
.build(logger);
} catch (IOException e) {
throw UserException
.dataWriteError(e)
.message("Failed to drop table: " + e.getMessage())
.build(logger);
}
} | void function(String table) { DrillFileSystem fs = getFS(); String defaultLocation = getDefaultLocation(); try { if (!isHomogeneous(table)) { throw UserException .validationError() .message(STR + STR) .build(logger); } StringBuilder tableRenameBuilder = new StringBuilder(); int lastSlashIndex = table.lastIndexOf(Path.SEPARATOR); if (lastSlashIndex != -1) { tableRenameBuilder.append(table.substring(0, lastSlashIndex + 1)); } ThreadLocalRandom r = ThreadLocalRandom.current(); long time = (System.currentTimeMillis()/1000); Long p1 = ((Integer.MAX_VALUE - time) << 32) + r.nextInt(); Long p2 = r.nextLong(); final String fileNameDelimiter = DrillFileSystem.UNDERSCORE_PREFIX; String[] pathSplit = table.split(Path.SEPARATOR); tableRenameBuilder .append(DrillFileSystem.UNDERSCORE_PREFIX) .append(pathSplit[pathSplit.length - 1]) .append(fileNameDelimiter) .append(p1.toString()) .append(fileNameDelimiter) .append(p2.toString()); String tableRename = tableRenameBuilder.toString(); fs.rename(new Path(defaultLocation, table), new Path(defaultLocation, tableRename)); fs.delete(new Path(defaultLocation, tableRename), true); } catch (AccessControlException e) { throw UserException .permissionError(e) .message(STR) .build(logger); } catch (IOException e) { throw UserException .dataWriteError(e) .message(STR + e.getMessage()) .build(logger); } } | /**
* We check if the table contains homogeneous file formats that Drill can read. Once the checks are performed
* we rename the file to start with an "_". After the rename we issue a recursive delete of the directory.
* @param table - Path of table to be dropped
*/ | We check if the table contains homogeneous file formats that Drill can read. Once the checks are performed we rename the file to start with an "_". After the rename we issue a recursive delete of the directory | dropTable | {
"repo_name": "sohami/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/store/dfs/WorkspaceSchemaFactory.java",
"license": "apache-2.0",
"size": 29909
} | [
"java.io.IOException",
"java.util.concurrent.ThreadLocalRandom",
"org.apache.drill.common.exceptions.UserException",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.security.AccessControlException"
] | import java.io.IOException; import java.util.concurrent.ThreadLocalRandom; import org.apache.drill.common.exceptions.UserException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.security.AccessControlException; | import java.io.*; import java.util.concurrent.*; import org.apache.drill.common.exceptions.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.security.*; | [
"java.io",
"java.util",
"org.apache.drill",
"org.apache.hadoop"
] | java.io; java.util; org.apache.drill; org.apache.hadoop; | 609,659 |
@Hook(Pointcut.CLIENT_RESPONSE)
void interceptResponse(IHttpResponse theResponse) throws IOException; | @Hook(Pointcut.CLIENT_RESPONSE) void interceptResponse(IHttpResponse theResponse) throws IOException; | /**
* Fired by the client upon receiving an HTTP response, prior to processing that response
*/ | Fired by the client upon receiving an HTTP response, prior to processing that response | interceptResponse | {
"repo_name": "jamesagnew/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/api/IClientInterceptor.java",
"license": "apache-2.0",
"size": 1642
} | [
"ca.uhn.fhir.interceptor.api.Hook",
"ca.uhn.fhir.interceptor.api.Pointcut",
"java.io.IOException"
] | import ca.uhn.fhir.interceptor.api.Hook; import ca.uhn.fhir.interceptor.api.Pointcut; import java.io.IOException; | import ca.uhn.fhir.interceptor.api.*; import java.io.*; | [
"ca.uhn.fhir",
"java.io"
] | ca.uhn.fhir; java.io; | 1,437,519 |
public static boolean any(Object self) {
BooleanReturningMethodInvoker bmi = new BooleanReturningMethodInvoker();
for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) {
if (bmi.convertToBoolean(iter.next())) {
return true;
}
}
return false;
} | static boolean function(Object self) { BooleanReturningMethodInvoker bmi = new BooleanReturningMethodInvoker(); for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) { if (bmi.convertToBoolean(iter.next())) { return true; } } return false; } | /**
* Iterates over the elements of a collection, and checks whether at least
* one element is true according to the Groovy Truth.
* Equivalent to self.any({element {@code ->} element})
* <pre class="groovyTestCase">
* assert [false, true].any()
* assert [0, 1].any()
* assert ![0, 0].any()
* </pre>
*
* @param self the object over which we iterate
* @return true if any item in the collection matches the closure predicate
* @since 1.5.0
*/ | Iterates over the elements of a collection, and checks whether at least one element is true according to the Groovy Truth. Equivalent to self.any({element -> element}) assert [false, true].any() assert [0, 1].any() assert ![0, 0].any() </code> | any | {
"repo_name": "apache/incubator-groovy",
"path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 703151
} | [
"java.util.Iterator",
"org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker"
] | import java.util.Iterator; import org.codehaus.groovy.runtime.callsite.BooleanReturningMethodInvoker; | import java.util.*; import org.codehaus.groovy.runtime.callsite.*; | [
"java.util",
"org.codehaus.groovy"
] | java.util; org.codehaus.groovy; | 2,620,492 |
@Nullable
public VS toValuesSource(QueryShardContext context) throws IOException {
if (!valid()) {
throw new IllegalStateException(
"value source config is invalid; must have either a field context or a script or marked as unwrapped");
}
final VS vs;
if (unmapped()) {
if (missing() == null) {
// otherwise we will have values because of the missing value
vs = null;
} else if (valueSourceType() == ValuesSourceType.NUMERIC) {
vs = (VS) ValuesSource.Numeric.EMPTY;
} else if (valueSourceType() == ValuesSourceType.GEOPOINT) {
vs = (VS) ValuesSource.GeoPoint.EMPTY;
} else if (valueSourceType() == ValuesSourceType.ANY || valueSourceType() == ValuesSourceType.BYTES) {
vs = (VS) ValuesSource.Bytes.WithOrdinals.EMPTY;
} else {
throw new IllegalArgumentException("Can't deal with unmapped ValuesSource type " + valueSourceType());
}
} else {
vs = originalValuesSource();
}
if (missing() == null) {
return vs;
}
if (vs instanceof ValuesSource.Bytes) {
final BytesRef missing = new BytesRef(missing().toString());
if (vs instanceof ValuesSource.Bytes.WithOrdinals) {
return (VS) MissingValues.replaceMissing((ValuesSource.Bytes.WithOrdinals) vs, missing);
} else {
return (VS) MissingValues.replaceMissing((ValuesSource.Bytes) vs, missing);
}
} else if (vs instanceof ValuesSource.Numeric) {
Number missing = format.parseDouble(missing().toString(), false, context::nowInMillis);
return (VS) MissingValues.replaceMissing((ValuesSource.Numeric) vs, missing);
} else if (vs instanceof ValuesSource.GeoPoint) {
// TODO: also support the structured formats of geo points
final GeoPoint missing = GeoUtils.parseGeoPoint(missing().toString(), new GeoPoint());
return (VS) MissingValues.replaceMissing((ValuesSource.GeoPoint) vs, missing);
} else {
// Should not happen
throw new IllegalArgumentException("Can't apply missing values on a " + vs.getClass());
}
} | VS function(QueryShardContext context) throws IOException { if (!valid()) { throw new IllegalStateException( STR); } final VS vs; if (unmapped()) { if (missing() == null) { vs = null; } else if (valueSourceType() == ValuesSourceType.NUMERIC) { vs = (VS) ValuesSource.Numeric.EMPTY; } else if (valueSourceType() == ValuesSourceType.GEOPOINT) { vs = (VS) ValuesSource.GeoPoint.EMPTY; } else if (valueSourceType() == ValuesSourceType.ANY valueSourceType() == ValuesSourceType.BYTES) { vs = (VS) ValuesSource.Bytes.WithOrdinals.EMPTY; } else { throw new IllegalArgumentException(STR + valueSourceType()); } } else { vs = originalValuesSource(); } if (missing() == null) { return vs; } if (vs instanceof ValuesSource.Bytes) { final BytesRef missing = new BytesRef(missing().toString()); if (vs instanceof ValuesSource.Bytes.WithOrdinals) { return (VS) MissingValues.replaceMissing((ValuesSource.Bytes.WithOrdinals) vs, missing); } else { return (VS) MissingValues.replaceMissing((ValuesSource.Bytes) vs, missing); } } else if (vs instanceof ValuesSource.Numeric) { Number missing = format.parseDouble(missing().toString(), false, context::nowInMillis); return (VS) MissingValues.replaceMissing((ValuesSource.Numeric) vs, missing); } else if (vs instanceof ValuesSource.GeoPoint) { final GeoPoint missing = GeoUtils.parseGeoPoint(missing().toString(), new GeoPoint()); return (VS) MissingValues.replaceMissing((ValuesSource.GeoPoint) vs, missing); } else { throw new IllegalArgumentException(STR + vs.getClass()); } } | /** Get a value source given its configuration. A return value of null indicates that
* no value source could be built. */ | Get a value source given its configuration. A return value of null indicates that | toValuesSource | {
"repo_name": "strapdata/elassandra5-rc",
"path": "core/src/main/java/org/elasticsearch/search/aggregations/support/ValuesSourceConfig.java",
"license": "apache-2.0",
"size": 13302
} | [
"java.io.IOException",
"org.apache.lucene.util.BytesRef",
"org.elasticsearch.common.geo.GeoPoint",
"org.elasticsearch.common.geo.GeoUtils",
"org.elasticsearch.index.query.QueryShardContext"
] | import java.io.IOException; import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.geo.GeoUtils; import org.elasticsearch.index.query.QueryShardContext; | import java.io.*; import org.apache.lucene.util.*; import org.elasticsearch.common.geo.*; import org.elasticsearch.index.query.*; | [
"java.io",
"org.apache.lucene",
"org.elasticsearch.common",
"org.elasticsearch.index"
] | java.io; org.apache.lucene; org.elasticsearch.common; org.elasticsearch.index; | 2,669,177 |
public Timestamp getUpdated();
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; | Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR; | /** Get Updated.
* Date this record was updated
*/ | Get Updated. Date this record was updated | getUpdated | {
"repo_name": "erpcya/adempierePOS",
"path": "base/src/org/compiere/model/I_GL_Budget.java",
"license": "gpl-2.0",
"size": 5081
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 486,688 |
Optional<T> getKeyWithHighestCount(); | Optional<T> getKeyWithHighestCount(); | /**
* Returns a key with the highest count if one exists. In case of ties, no guarantee is made as to which key will be
* returned.
*
* @return a key with the highest count or {@link Optional#absent()} if the map is empty
*/ | Returns a key with the highest count if one exists. In case of ties, no guarantee is made as to which key will be returned | getKeyWithHighestCount | {
"repo_name": "Tyler-Yates/Myrtle",
"path": "src/main/java/com/tyleryates/util/CountingMap.java",
"license": "mit",
"size": 4897
} | [
"com.google.common.base.Optional"
] | import com.google.common.base.Optional; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,440,284 |
public static void createFieldDebugInfo(FacesContext facesContext,
final String field, Object oldValue,
Object newValue, String clientId)
{
if ((oldValue == null && newValue == null)
|| (oldValue != null && oldValue.equals(newValue)))
{
// nothing changed - NOTE that this is a difference to the method in
// UIInput, because in UIInput every call to this method comes from
// setSubmittedValue or setLocalValue and here every call comes
// from the VisitCallback of the PhaseListener.
return;
}
// convert Array values into a more readable format
if (oldValue != null && oldValue.getClass().isArray())
{
oldValue = Arrays.deepToString((Object[]) oldValue);
}
if (newValue != null && newValue.getClass().isArray())
{
newValue = Arrays.deepToString((Object[]) newValue);
}
// NOTE that the call stack does not make much sence here
// create the debug-info array
// structure:
// - 0: phase
// - 1: old value
// - 2: new value
// - 3: StackTraceElement List
// NOTE that we cannot create a class here to encapsulate this data,
// because this is not on the spec and the class would not be available in impl.
Object[] debugInfo = new Object[4];
debugInfo[0] = facesContext.getCurrentPhaseId();
debugInfo[1] = oldValue;
debugInfo[2] = newValue;
debugInfo[3] = null; // here we have no call stack (only in UIInput)
// add the debug info
getFieldDebugInfos(field, clientId).add(debugInfo);
}
private class DebugVisitCallback implements VisitCallback
{ | static void function(FacesContext facesContext, final String field, Object oldValue, Object newValue, String clientId) { if ((oldValue == null && newValue == null) (oldValue != null && oldValue.equals(newValue))) { return; } if (oldValue != null && oldValue.getClass().isArray()) { oldValue = Arrays.deepToString((Object[]) oldValue); } if (newValue != null && newValue.getClass().isArray()) { newValue = Arrays.deepToString((Object[]) newValue); } Object[] debugInfo = new Object[4]; debugInfo[0] = facesContext.getCurrentPhaseId(); debugInfo[1] = oldValue; debugInfo[2] = newValue; debugInfo[3] = null; getFieldDebugInfos(field, clientId).add(debugInfo); } private class DebugVisitCallback implements VisitCallback { | /**
* Creates the field debug-info for the given field, which changed
* from oldValue to newValue in the given component.
* ATTENTION: this method is duplicate in UIInput.
* @param facesContext
* @param field
* @param oldValue
* @param newValue
* @param clientId
*/ | Creates the field debug-info for the given field, which changed from oldValue to newValue in the given component | createFieldDebugInfo | {
"repo_name": "kulinski/myfaces",
"path": "impl/src/main/java/org/apache/myfaces/view/facelets/tag/ui/DebugPhaseListener.java",
"license": "apache-2.0",
"size": 12288
} | [
"java.util.Arrays",
"javax.faces.component.visit.VisitCallback",
"javax.faces.context.FacesContext"
] | import java.util.Arrays; import javax.faces.component.visit.VisitCallback; import javax.faces.context.FacesContext; | import java.util.*; import javax.faces.component.visit.*; import javax.faces.context.*; | [
"java.util",
"javax.faces"
] | java.util; javax.faces; | 1,351,744 |
ExecutionPlan build(PlannerContext plannerContext,
Set<PlanHint> planHints,
ProjectionBuilder projectionBuilder,
int limit,
int offset,
@Nullable OrderBy order,
@Nullable Integer pageSizeHint,
Row params,
SubQueryResults subQueryResults); | ExecutionPlan build(PlannerContext plannerContext, Set<PlanHint> planHints, ProjectionBuilder projectionBuilder, int limit, int offset, @Nullable OrderBy order, @Nullable Integer pageSizeHint, Row params, SubQueryResults subQueryResults); | /**
* Uses the current shard allocation information to create a physical execution plan.
* <br />
* {@code limit}, {@code offset}, {@code order} can be passed from one operator to another. Depending on the
* operators implementation. Operator may choose to make use of this information, but can also ignore it.
*/ | Uses the current shard allocation information to create a physical execution plan. limit, offset, order can be passed from one operator to another. Depending on the operators implementation. Operator may choose to make use of this information, but can also ignore it | build | {
"repo_name": "crate/crate",
"path": "server/src/main/java/io/crate/planner/operators/LogicalPlan.java",
"license": "apache-2.0",
"size": 9309
} | [
"io.crate.analyze.OrderBy",
"io.crate.data.Row",
"io.crate.execution.dsl.projection.builder.ProjectionBuilder",
"io.crate.planner.ExecutionPlan",
"io.crate.planner.PlannerContext",
"java.util.Set",
"javax.annotation.Nullable"
] | import io.crate.analyze.OrderBy; import io.crate.data.Row; import io.crate.execution.dsl.projection.builder.ProjectionBuilder; import io.crate.planner.ExecutionPlan; import io.crate.planner.PlannerContext; import java.util.Set; import javax.annotation.Nullable; | import io.crate.analyze.*; import io.crate.data.*; import io.crate.execution.dsl.projection.builder.*; import io.crate.planner.*; import java.util.*; import javax.annotation.*; | [
"io.crate.analyze",
"io.crate.data",
"io.crate.execution",
"io.crate.planner",
"java.util",
"javax.annotation"
] | io.crate.analyze; io.crate.data; io.crate.execution; io.crate.planner; java.util; javax.annotation; | 1,600,080 |
@SuppressWarnings("unchecked")
private <V1> V1 createValue(final GridCacheVersion ver,
final long expireTime,
final long ttl,
final Object val,
@Nullable final EntryGetResult getRes,
final boolean needVer) {
final V1 v;
if (!needVer)
v = (V1) val;
else if (getRes == null) {
v = expireTime != 0 || ttl != 0
? (V1)new EntryGetWithTtlResult(val, ver, false, expireTime, ttl)
: (V1)new EntryGetResult(val, ver, false);
}
else {
getRes.value(val);
v = (V1)getRes;
}
return v;
} | @SuppressWarnings(STR) <V1> V1 function(final GridCacheVersion ver, final long expireTime, final long ttl, final Object val, @Nullable final EntryGetResult getRes, final boolean needVer) { final V1 v; if (!needVer) v = (V1) val; else if (getRes == null) { v = expireTime != 0 ttl != 0 ? (V1)new EntryGetWithTtlResult(val, ver, false, expireTime, ttl) : (V1)new EntryGetResult(val, ver, false); } else { getRes.value(val); v = (V1)getRes; } return v; } | /**
* Creates new EntryGetResult or uses existing one.
*
* @param ver Version.
* @param expireTime Entry expire time.
* @param ttl Entry TTL.
* @param val Value.
* @param getRes EntryGetResult
* @param needVer Need version flag.
* @return EntryGetResult or value.
*/ | Creates new EntryGetResult or uses existing one | createValue | {
"repo_name": "vladisav/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java",
"license": "apache-2.0",
"size": 67827
} | [
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.internal.processors.cache.version.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 207,046 |
@Override
public URL getChangeSetLink(GitChangeSet changeSet) throws IOException {
URL url = getUrl();
return new URL(url, url.getPath() + "History/" + changeSet.getId() + param(url).toString());
} | URL function(GitChangeSet changeSet) throws IOException { URL url = getUrl(); return new URL(url, url.getPath() + STR + changeSet.getId() + param(url).toString()); } | /**
* Creates a link to the change set
* http://[KilnGit URL]/History/[commit]
*
* @param changeSet commit hash
* @return change set link
* @throws IOException
*/ | Creates a link to the change set HREF[KilnGit URL]/History/[commit] | getChangeSetLink | {
"repo_name": "ialbors/git-plugin",
"path": "src/main/java/hudson/plugins/git/browser/KilnGit.java",
"license": "mit",
"size": 3844
} | [
"hudson.plugins.git.GitChangeSet",
"java.io.IOException"
] | import hudson.plugins.git.GitChangeSet; import java.io.IOException; | import hudson.plugins.git.*; import java.io.*; | [
"hudson.plugins.git",
"java.io"
] | hudson.plugins.git; java.io; | 1,373,851 |
private void fetchStreamStart() {
// Read the token.
Mark mark = reader.getMark();
// Add STREAM-START.
Token token = new StreamStartToken(mark, mark);
this.tokens.add(token);
} | void function() { Mark mark = reader.getMark(); Token token = new StreamStartToken(mark, mark); this.tokens.add(token); } | /**
* We always add STREAM-START as the first token and STREAM-END as the last
* token.
*/ | We always add STREAM-START as the first token and STREAM-END as the last token | fetchStreamStart | {
"repo_name": "lsst-camera-dh/snakeyaml",
"path": "src/main/java/org/yaml/snakeyaml/scanner/ScannerImpl.java",
"license": "apache-2.0",
"size": 82645
} | [
"org.yaml.snakeyaml.error.Mark",
"org.yaml.snakeyaml.tokens.StreamStartToken",
"org.yaml.snakeyaml.tokens.Token"
] | import org.yaml.snakeyaml.error.Mark; import org.yaml.snakeyaml.tokens.StreamStartToken; import org.yaml.snakeyaml.tokens.Token; | import org.yaml.snakeyaml.error.*; import org.yaml.snakeyaml.tokens.*; | [
"org.yaml.snakeyaml"
] | org.yaml.snakeyaml; | 2,084,230 |
// ------------------------------------------------------------------------
public static String formatLocation(Location loc) {
return new StringBuilder().append('(')
.append(loc.getBlockX()).append(", ")
.append(loc.getBlockY()).append(", ")
.append(loc.getBlockZ()).append(") ")
.append(loc.getWorld().getName()).toString();
} | static String function(Location loc) { return new StringBuilder().append('(') .append(loc.getBlockX()).append(STR) .append(loc.getBlockY()).append(STR) .append(loc.getBlockZ()).append(STR) .append(loc.getWorld().getName()).toString(); } | /**
* Format a location as "(x, y, z) world", with integer coordinates.
*
* @param loc the location.
* @return the location as a formatted String.
*/ | Format a location as "(x, y, z) world", with integer coordinates | formatLocation | {
"repo_name": "NerdNu/EasyRider",
"path": "src/nu/nerd/easyrider/Util.java",
"license": "mit",
"size": 13429
} | [
"org.bukkit.Location"
] | import org.bukkit.Location; | import org.bukkit.*; | [
"org.bukkit"
] | org.bukkit; | 1,726,335 |
public void writeGraph(final OutputStream outputStream, final Graph g) throws IOException; | void function(final OutputStream outputStream, final Graph g) throws IOException; | /**
* Write the entire graph to a stream.
*/ | Write the entire graph to a stream | writeGraph | {
"repo_name": "mpollmeier/tinkerpop3",
"path": "gremlin-core/src/main/java/com/tinkerpop/gremlin/structure/io/GraphWriter.java",
"license": "apache-2.0",
"size": 2646
} | [
"com.tinkerpop.gremlin.structure.Graph",
"java.io.IOException",
"java.io.OutputStream"
] | import com.tinkerpop.gremlin.structure.Graph; import java.io.IOException; import java.io.OutputStream; | import com.tinkerpop.gremlin.structure.*; import java.io.*; | [
"com.tinkerpop.gremlin",
"java.io"
] | com.tinkerpop.gremlin; java.io; | 1,088,007 |
@Override
public Adapter createFilterMediatorOutputConnectorAdapter() {
if (filterMediatorOutputConnectorItemProvider == null) {
filterMediatorOutputConnectorItemProvider = new FilterMediatorOutputConnectorItemProvider(this);
}
return filterMediatorOutputConnectorItemProvider;
}
protected FilterMediatorPassOutputConnectorItemProvider filterMediatorPassOutputConnectorItemProvider; | Adapter function() { if (filterMediatorOutputConnectorItemProvider == null) { filterMediatorOutputConnectorItemProvider = new FilterMediatorOutputConnectorItemProvider(this); } return filterMediatorOutputConnectorItemProvider; } protected FilterMediatorPassOutputConnectorItemProvider filterMediatorPassOutputConnectorItemProvider; | /**
* This creates an adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.FilterMediatorOutputConnector}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>org.wso2.developerstudio.eclipse.gmf.esb.FilterMediatorOutputConnector</code>. | createFilterMediatorOutputConnectorAdapter | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EsbItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 339597
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,300,271 |
public PermissionCollection getPermissionCollection() {
return permissionCollection;
} | PermissionCollection function() { return permissionCollection; } | /**
* Get the SecurityManager PermissionCollection for this
* web application context.
*
* @return PermissionCollection permissions
*/ | Get the SecurityManager PermissionCollection for this web application context | getPermissionCollection | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.43/JspRuntimeContext.java",
"license": "mit",
"size": 15726
} | [
"java.security.PermissionCollection"
] | import java.security.PermissionCollection; | import java.security.*; | [
"java.security"
] | java.security; | 649,088 |
public void testImplicitDefaultMetricSingleMetric() throws Exception {
DocumentMapper mapper = createDocumentMapper(
fieldMapping(b -> b.field("type", CONTENT_TYPE).field(METRICS_FIELD, new String[] { "value_count" }))
);
Mapper fieldMapper = mapper.mappers().getMapper("field");
assertThat(fieldMapper, instanceOf(AggregateDoubleMetricFieldMapper.class));
assertEquals(AggregateDoubleMetricFieldMapper.Metric.value_count, ((AggregateDoubleMetricFieldMapper) fieldMapper).defaultMetric);
} | void function() throws Exception { DocumentMapper mapper = createDocumentMapper( fieldMapping(b -> b.field("type", CONTENT_TYPE).field(METRICS_FIELD, new String[] { STR })) ); Mapper fieldMapper = mapper.mappers().getMapper("field"); assertThat(fieldMapper, instanceOf(AggregateDoubleMetricFieldMapper.class)); assertEquals(AggregateDoubleMetricFieldMapper.Metric.value_count, ((AggregateDoubleMetricFieldMapper) fieldMapper).defaultMetric); } | /**
* Test the default_metric when not set explicitly. When only a single metric is contained, this is set as the default
*/ | Test the default_metric when not set explicitly. When only a single metric is contained, this is set as the default | testImplicitDefaultMetricSingleMetric | {
"repo_name": "nknize/elasticsearch",
"path": "x-pack/plugin/mapper-aggregate-metric/src/test/java/org/elasticsearch/xpack/aggregatemetric/mapper/AggregateDoubleMetricFieldMapperTests.java",
"license": "apache-2.0",
"size": 22583
} | [
"org.elasticsearch.index.mapper.DocumentMapper",
"org.elasticsearch.index.mapper.Mapper",
"org.hamcrest.core.IsInstanceOf"
] | import org.elasticsearch.index.mapper.DocumentMapper; import org.elasticsearch.index.mapper.Mapper; import org.hamcrest.core.IsInstanceOf; | import org.elasticsearch.index.mapper.*; import org.hamcrest.core.*; | [
"org.elasticsearch.index",
"org.hamcrest.core"
] | org.elasticsearch.index; org.hamcrest.core; | 2,241,604 |
@Description("The Resin home directory used when starting"
+ " this instance of Resin. This is the location"
+ " of the Resin program files")
public String getResinHome(); | @Description(STR + STR + STR) String function(); | /**
* The Resin home directory used when starting this instance of Resin.
* This is the location of the Resin program files.
*/ | The Resin home directory used when starting this instance of Resin. This is the location of the Resin program files | getResinHome | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/management/server/ResinMXBean.java",
"license": "gpl-2.0",
"size": 4380
} | [
"com.caucho.jmx.Description"
] | import com.caucho.jmx.Description; | import com.caucho.jmx.*; | [
"com.caucho.jmx"
] | com.caucho.jmx; | 1,088,433 |
private void testLikeQuery()
{
String queryString = "Select min(p.age) from PersonES p where p.personName like '%mit'";
Query query = em.createQuery(queryString);
List resultList = query.getResultList();
Assert.assertEquals(1, resultList.size());
Assert.assertEquals(20.0, resultList.get(0));
} | void function() { String queryString = STR; Query query = em.createQuery(queryString); List resultList = query.getResultList(); Assert.assertEquals(1, resultList.size()); Assert.assertEquals(20.0, resultList.get(0)); } | /**
* Test like query.
*/ | Test like query | testLikeQuery | {
"repo_name": "ravisund/Kundera",
"path": "src/kundera-elastic-search/src/test/java/com/impetus/client/es/ESAggregationTest.java",
"license": "apache-2.0",
"size": 20052
} | [
"java.util.List",
"javax.persistence.Query",
"junit.framework.Assert"
] | import java.util.List; import javax.persistence.Query; import junit.framework.Assert; | import java.util.*; import javax.persistence.*; import junit.framework.*; | [
"java.util",
"javax.persistence",
"junit.framework"
] | java.util; javax.persistence; junit.framework; | 2,758,876 |
boolean validateEpisodeObservationTemplateId(DiagnosticChain diagnostics, Map<Object, Object> context);
| boolean validateEpisodeObservationTemplateId(DiagnosticChain diagnostics, Map<Object, Object> context); | /**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* <!-- begin-model-doc -->
* self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.113883.10.20.1.41')
* @param diagnostics The chain of diagnostics to which problems are to be appended.
* @param context The cache of context-specific information.
* <!-- end-model-doc -->
* @model annotation="http://www.eclipse.org/uml2/1.1.0/GenModel body='self.templateId->exists(id : datatypes::II | id.root = \'2.16.840.1.113883.10.20.1.41\')'"
* @generated
*/ | self.templateId->exists(id : datatypes::II | id.root = '2.16.840.1.113883.10.20.1.41') | validateEpisodeObservationTemplateId | {
"repo_name": "drbgfc/mdht",
"path": "cda/deprecated/org.openhealthtools.mdht.uml.cda.ccd/src/org/openhealthtools/mdht/uml/cda/ccd/EpisodeObservation.java",
"license": "epl-1.0",
"size": 8062
} | [
"java.util.Map",
"org.eclipse.emf.common.util.DiagnosticChain"
] | import java.util.Map; import org.eclipse.emf.common.util.DiagnosticChain; | import java.util.*; import org.eclipse.emf.common.util.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 52,542 |
private CommandCallable build(Object object, Method method, Command definition) throws ParametricException {
checkNotNull(object);
checkNotNull(method);
return new ParametricCallable(this, object, method, definition);
} | CommandCallable function(Object object, Method method, Command definition) throws ParametricException { checkNotNull(object); checkNotNull(method); return new ParametricCallable(this, object, method, definition); } | /**
* Build a {@link CommandCallable} for the given method.
*
* @param object the object to be invoked on
* @param method the method to invoke
* @param definition the command definition annotation
* @return the command executor
* @throws ParametricException thrown on an error
*/ | Build a <code>CommandCallable</code> for the given method | build | {
"repo_name": "nailed/nailed-api",
"path": "src/main/java/jk_5/nailed/api/command/parametric/ParametricBuilder.java",
"license": "mit",
"size": 9600
} | [
"com.google.common.base.Preconditions",
"java.lang.reflect.Method"
] | import com.google.common.base.Preconditions; import java.lang.reflect.Method; | import com.google.common.base.*; import java.lang.reflect.*; | [
"com.google.common",
"java.lang"
] | com.google.common; java.lang; | 2,151,571 |
public void testIntegration4() {
boolean res;
int originalAppIdValue = mAppIdValue;
int originalContentTypeValue = mContentTypeValue;
String originalAppIdName = mAppIdName;
String originalContentTypeName = mContentTypeName;
String originalClassName = mClassName;
byte[] originalMessageBody = mMessageBody;
Random rd = new Random();
IWapPushManager iwapman = getInterface();
IDataVerify dataverify = getVerifyInterface();
mClassName = "com.android.smspush.unitTests.ReceiverService";
for (int i = 0; i < OMA_APPLICATION_ID_NAMES.length
+ OMA_CONTENT_TYPE_NAMES.length; i++) {
mAppIdName = OMA_APPLICATION_ID_NAMES[rd.nextInt(OMA_APPLICATION_ID_NAMES.length)];
int contIndex = rd.nextInt(OMA_CONTENT_TYPE_NAMES.length);
mContentTypeName = OMA_CONTENT_TYPE_NAMES[contIndex];
mMessageBody = new byte[100 + rd.nextInt(100)];
rd.nextBytes(mMessageBody);
byte[] pdu = createPDU(8);
byte[] wappushPdu = retrieveWspBody();
try {
dataverify.resetData();
// set up data
iwapman.addPackage(mAppIdName,
mContentTypeName, mPackageName, mClassName,
WapPushManagerParams.APP_TYPE_SERVICE, false, false);
dispatchWapPdu(wappushPdu, iwapman);
// clean up data
iwapman.deletePackage(mAppIdName,
mContentTypeName, mPackageName, mClassName);
if (mContentTypeName.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO)) {
assertTrue(dataverify.verifyData(wappushPdu));
} else {
assertTrue(dataverify.verifyData(mMessageBody));
}
} catch (RemoteException e) {
}
}
mClassName = originalClassName;
mAppIdName = originalAppIdName;
mContentTypeName = originalContentTypeName;
mAppIdValue = originalAppIdValue;
mContentTypeValue = originalContentTypeValue;
mMessageBody = originalMessageBody;
} | void function() { boolean res; int originalAppIdValue = mAppIdValue; int originalContentTypeValue = mContentTypeValue; String originalAppIdName = mAppIdName; String originalContentTypeName = mContentTypeName; String originalClassName = mClassName; byte[] originalMessageBody = mMessageBody; Random rd = new Random(); IWapPushManager iwapman = getInterface(); IDataVerify dataverify = getVerifyInterface(); mClassName = STR; for (int i = 0; i < OMA_APPLICATION_ID_NAMES.length + OMA_CONTENT_TYPE_NAMES.length; i++) { mAppIdName = OMA_APPLICATION_ID_NAMES[rd.nextInt(OMA_APPLICATION_ID_NAMES.length)]; int contIndex = rd.nextInt(OMA_CONTENT_TYPE_NAMES.length); mContentTypeName = OMA_CONTENT_TYPE_NAMES[contIndex]; mMessageBody = new byte[100 + rd.nextInt(100)]; rd.nextBytes(mMessageBody); byte[] pdu = createPDU(8); byte[] wappushPdu = retrieveWspBody(); try { dataverify.resetData(); iwapman.addPackage(mAppIdName, mContentTypeName, mPackageName, mClassName, WapPushManagerParams.APP_TYPE_SERVICE, false, false); dispatchWapPdu(wappushPdu, iwapman); iwapman.deletePackage(mAppIdName, mContentTypeName, mPackageName, mClassName); if (mContentTypeName.equals(WspTypeDecoder.CONTENT_TYPE_B_PUSH_CO)) { assertTrue(dataverify.verifyData(wappushPdu)); } else { assertTrue(dataverify.verifyData(mMessageBody)); } } catch (RemoteException e) { } } mClassName = originalClassName; mAppIdName = originalAppIdName; mContentTypeName = originalContentTypeName; mAppIdValue = originalAppIdValue; mContentTypeValue = originalContentTypeValue; mMessageBody = originalMessageBody; } | /**
* Integration test 4, iterate OmaApplication ID, Oma content type
*/ | Integration test 4, iterate OmaApplication ID, Oma content type | testIntegration4 | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/smspush/unitTests/WapPushTest.java",
"license": "apache-2.0",
"size": 92186
} | [
"android.os.RemoteException",
"com.android.internal.telephony.IWapPushManager",
"com.android.internal.telephony.WapPushManagerParams",
"com.android.internal.telephony.WspTypeDecoder",
"java.util.Random"
] | import android.os.RemoteException; import com.android.internal.telephony.IWapPushManager; import com.android.internal.telephony.WapPushManagerParams; import com.android.internal.telephony.WspTypeDecoder; import java.util.Random; | import android.os.*; import com.android.internal.telephony.*; import java.util.*; | [
"android.os",
"com.android.internal",
"java.util"
] | android.os; com.android.internal; java.util; | 2,685,564 |
@Test
public void testJsonResponse_1()
throws Exception {
JsonResponse result = new JsonResponse();
// An unexpected exception was thrown in user code while executing this test:
// java.lang.ExceptionInInitializerError
// at org.apache.log4j.Logger.getLogger(Logger.java:117)
// at com.intuit.tank.http.BaseResponse.<clinit>(BaseResponse.java:18)
assertNotNull(result);
} | void function() throws Exception { JsonResponse result = new JsonResponse(); assertNotNull(result); } | /**
* Run the JsonResponse() constructor test.
*
* @throws Exception
*
* @generatedBy CodePro at 12/16/14 3:57 PM
*/ | Run the JsonResponse() constructor test | testJsonResponse_1 | {
"repo_name": "rkadle/Tank",
"path": "agent/apiharness/src/test/java/com/intuit/tank/http/json/JsonResponseTest.java",
"license": "epl-1.0",
"size": 6243
} | [
"com.intuit.tank.http.json.JsonResponse",
"org.junit.Assert"
] | import com.intuit.tank.http.json.JsonResponse; import org.junit.Assert; | import com.intuit.tank.http.json.*; import org.junit.*; | [
"com.intuit.tank",
"org.junit"
] | com.intuit.tank; org.junit; | 1,374,210 |
public void testSimpleSerialization() throws Exception {
final Object o = makeObject();
if (o instanceof Serializable && isTestSerialization()) {
final byte[] objekt = writeExternalFormToBytes((Serializable) o);
readExternalFormFromBytes(objekt);
}
} | void function() throws Exception { final Object o = makeObject(); if (o instanceof Serializable && isTestSerialization()) { final byte[] objekt = writeExternalFormToBytes((Serializable) o); readExternalFormFromBytes(objekt); } } | /**
* Sanity check method, makes sure that any Serializable
* class can be serialized and de-serialized in memory,
* using the handy makeObject() method
*
* @throws IOException
* @throws ClassNotFoundException
*/ | Sanity check method, makes sure that any Serializable class can be serialized and de-serialized in memory, using the handy makeObject() method | testSimpleSerialization | {
"repo_name": "nsoft/jesterj",
"path": "code/ingest/src/test/java/org/jesterj/ingest/trie/AbstractObjectTest.java",
"license": "apache-2.0",
"size": 12358
} | [
"java.io.Serializable"
] | import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 273,849 |
public static ToggleButton createToggleButtonWithImageStates(Image upImage,
Image hvImage, String styleName,
ClickHandler handler) {
final ToggleButton button = createToggleButtonWithImageStates(upImage,
styleName, handler);
button.getUpHoveringFace().setImage(hvImage);
return button;
} | static ToggleButton function(Image upImage, Image hvImage, String styleName, ClickHandler handler) { final ToggleButton button = createToggleButtonWithImageStates(upImage, styleName, handler); button.getUpHoveringFace().setImage(hvImage); return button; } | /**
* Creates a {@link ToggleButton} with the specified face images and
* stylename.
*
* @param upImage the image to be used on the up face
* @param hvImage the image to be used on the hover face
* @param styleName the stylename to use for the widget
* @param handler a click handler to which to bind the button
* @return the button
*/ | Creates a <code>ToggleButton</code> with the specified face images and stylename | createToggleButtonWithImageStates | {
"repo_name": "mikazuki/tuwien2010-imagenotes",
"path": "src/com/google/appengine/demos/sticky/client/Buttons.java",
"license": "apache-2.0",
"size": 5831
} | [
"com.google.gwt.event.dom.client.ClickHandler",
"com.google.gwt.user.client.ui.Image",
"com.google.gwt.user.client.ui.ToggleButton"
] | import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.ToggleButton; | import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 713,859 |
public void run() {
if (fViewer instanceof TreeViewer) {
ArrayList allVisible= new ArrayList();
Tree tree= ((TreeViewer) fViewer).getTree();
collectExpandedAndVisible(tree.getItems(), allVisible);
tree.setSelection((TreeItem[]) allVisible.toArray(new TreeItem[allVisible.size()]));
fViewer.setSelection(fViewer.getSelection());
} else if (fViewer instanceof TableViewer) {
((TableViewer) fViewer).getTable().selectAll();
// force viewer selection change
fViewer.setSelection(fViewer.getSelection());
}
} | void function() { if (fViewer instanceof TreeViewer) { ArrayList allVisible= new ArrayList(); Tree tree= ((TreeViewer) fViewer).getTree(); collectExpandedAndVisible(tree.getItems(), allVisible); tree.setSelection((TreeItem[]) allVisible.toArray(new TreeItem[allVisible.size()])); fViewer.setSelection(fViewer.getSelection()); } else if (fViewer instanceof TableViewer) { ((TableViewer) fViewer).getTable().selectAll(); fViewer.setSelection(fViewer.getSelection()); } } | /**
* Selects all resources in the view.
*/ | Selects all resources in the view | run | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/ui/actions/SelectAllAction.java",
"license": "epl-1.0",
"size": 2703
} | [
"java.util.ArrayList",
"org.eclipse.jface.viewers.TableViewer",
"org.eclipse.jface.viewers.TreeViewer",
"org.eclipse.swt.widgets.Tree",
"org.eclipse.swt.widgets.TreeItem"
] | import java.util.ArrayList; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.swt.widgets.Tree; import org.eclipse.swt.widgets.TreeItem; | import java.util.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.widgets.*; | [
"java.util",
"org.eclipse.jface",
"org.eclipse.swt"
] | java.util; org.eclipse.jface; org.eclipse.swt; | 2,585,485 |
public ChannelConfig setDescription(String description) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mNotificationChannel.setDescription(description);
}
return this;
} | ChannelConfig function(String description) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { mNotificationChannel.setDescription(description); } return this; } | /**
* Sets the user visible description of this channel.
*
* <p>The recommended maximum length is 300 characters; the value may be truncated if it is too
* long.
*/ | Sets the user visible description of this channel. The recommended maximum length is 300 characters; the value may be truncated if it is too long | setDescription | {
"repo_name": "didi/DoraemonKit",
"path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/NotificationUtils.java",
"license": "apache-2.0",
"size": 13334
} | [
"android.os.Build"
] | import android.os.Build; | import android.os.*; | [
"android.os"
] | android.os; | 6,354 |
DBJobs selectByPrimaryKey(Integer id); | DBJobs selectByPrimaryKey(Integer id); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table jobs
*
* @mbggenerated Tue May 26 15:53:09 CST 2015
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table jobs | selectByPrimaryKey | {
"repo_name": "wolabs/womano",
"path": "main/java/com/culabs/unicomportal/dao/DBJobsMapper.java",
"license": "apache-2.0",
"size": 1729
} | [
"com.culabs.unicomportal.model.db.DBJobs"
] | import com.culabs.unicomportal.model.db.DBJobs; | import com.culabs.unicomportal.model.db.*; | [
"com.culabs.unicomportal"
] | com.culabs.unicomportal; | 1,625,607 |
public void send( String text ) throws NotYetConnectedException {
engine.send( text );
} | void function( String text ) throws NotYetConnectedException { engine.send( text ); } | /**
* Sends <var>text</var> to the connected websocket server.
*
* @param text
* The string which will be transmitted.
*/ | Sends text to the connected websocket server | send | {
"repo_name": "matejdro/PebbleAndroidCommons",
"path": "src/main/java/org/java_websocket/client/WebSocketClient.java",
"license": "gpl-3.0",
"size": 12125
} | [
"java.nio.channels.NotYetConnectedException"
] | import java.nio.channels.NotYetConnectedException; | import java.nio.channels.*; | [
"java.nio"
] | java.nio; | 293,046 |
private ModelAndView handlePagination(HttpServletRequest request, Object command, ArrayList<String> errorMessages, Set<Integer> modulesIds) throws BusinessException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException{
logger.debug("handlePagination - START");
ModelAndView mav = new ModelAndView(getSuccessView());
SearchPermissionBean searchPermissionBean = (SearchPermissionBean) command;
try {
if (request.getParameter(PAGE) != null){
if (NEXT.equals(request.getParameter(PAGE))){
searchPermissionBean.setCurrentPage(searchPermissionBean.getCurrentPage() + 1);
}
if (PREV.equals(request.getParameter(PAGE))){
searchPermissionBean.setCurrentPage(searchPermissionBean.getCurrentPage() - 1);
}
if (FIRST.equals(request.getParameter(PAGE))){
searchPermissionBean.setCurrentPage(1);
}
if (LAST.equals(request.getParameter(PAGE))){
searchPermissionBean.setCurrentPage(searchPermissionBean.getNbrOfPages());
}
if (NUMBER.equals(request.getParameter(PAGE))){
if (request.getParameter(PAGE_NBR) != null && !"".equals(request.getParameter(PAGE_NBR))){
searchPermissionBean.setCurrentPage(Integer.parseInt(request.getParameter(PAGE_NBR)));
} else {
// something is wrong
// I will show the first page
searchPermissionBean.setCurrentPage(-1);
}
}
}
} catch(Exception e) {
// something is wrong
// I will show the first page
logger.error(PAGINATION_ERROR,e);
searchPermissionBean.setCurrentPage(-1);
}
List<PermissionWeb> res = null;
try{
res = BLPermission.getInstance().getResultsForSearch(searchPermissionBean, false, modulesIds);
Localization localization = null;
for(PermissionWeb permission : res){
String locale = RequestContextUtils.getLocale(request).getLanguage();
if (permission.getDescription() != null){
localization = BLLocalization.getInstance().getByLocale(permission.getDescription().getLocalizationId(), locale.toUpperCase());
permission.setSketch(ControllerUtils.getInstance().getDescriptionForLocale(localization, locale));
}
}
} catch (BusinessException be) {
logger.error("", be);
mav = new ModelAndView(IConstant.FORM_VIEW_MESSAGES);
errorMessages.add(messageSource.getMessage(SEARCH_ERROR, new Object[] {be.getCode(), ControllerUtils.getInstance().getFormattedCurrentTime()}, RequestContextUtils.getLocale(request)));
} catch (Exception e) {
logger.error("", e);
mav = new ModelAndView(IConstant.FORM_VIEW_MESSAGES);
errorMessages.add(messageSource.getMessage(SEARCH_ERROR, new Object[] {null, ControllerUtils.getInstance().getFormattedCurrentTime()}, RequestContextUtils.getLocale(request)));
}
mav.addObject(SEARCH_RESULTS, res);
// find the number of pages shown in pagination area
ControllerUtils.getInstance().findPagesLimit(searchPermissionBean, PAGES);
mav.addObject(SEARCH_PERMISSION_BEAN, searchPermissionBean);
mav.addObject(COMMAND, command);
logger.debug("handlePagination - END");
return mav;
}
| ModelAndView function(HttpServletRequest request, Object command, ArrayList<String> errorMessages, Set<Integer> modulesIds) throws BusinessException, ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException{ logger.debug(STR); ModelAndView mav = new ModelAndView(getSuccessView()); SearchPermissionBean searchPermissionBean = (SearchPermissionBean) command; try { if (request.getParameter(PAGE) != null){ if (NEXT.equals(request.getParameter(PAGE))){ searchPermissionBean.setCurrentPage(searchPermissionBean.getCurrentPage() + 1); } if (PREV.equals(request.getParameter(PAGE))){ searchPermissionBean.setCurrentPage(searchPermissionBean.getCurrentPage() - 1); } if (FIRST.equals(request.getParameter(PAGE))){ searchPermissionBean.setCurrentPage(1); } if (LAST.equals(request.getParameter(PAGE))){ searchPermissionBean.setCurrentPage(searchPermissionBean.getNbrOfPages()); } if (NUMBER.equals(request.getParameter(PAGE))){ if (request.getParameter(PAGE_NBR) != null && !STRSTRSTRhandlePagination - END"); return mav; } | /**
* Handles the results pagination
*
* @author alu
*
* @param request
* @param command
* @return
* @throws BusinessException
* @throws ClassNotFoundException
* @throws NoSuchMethodException
* @throws SecurityException
* @throws InvocationTargetException
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/ | Handles the results pagination | handlePagination | {
"repo_name": "CodeSphere/termitaria",
"path": "TermitariaOM/JavaSource/ro/cs/om/web/controller/form/PermissionSearchController.java",
"license": "agpl-3.0",
"size": 20010
} | [
"java.lang.reflect.InvocationTargetException",
"java.util.ArrayList",
"java.util.Set",
"javax.servlet.http.HttpServletRequest",
"org.springframework.web.servlet.ModelAndView",
"ro.cs.om.entity.SearchPermissionBean",
"ro.cs.om.exception.BusinessException"
] | import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Set; import javax.servlet.http.HttpServletRequest; import org.springframework.web.servlet.ModelAndView; import ro.cs.om.entity.SearchPermissionBean; import ro.cs.om.exception.BusinessException; | import java.lang.reflect.*; import java.util.*; import javax.servlet.http.*; import org.springframework.web.servlet.*; import ro.cs.om.entity.*; import ro.cs.om.exception.*; | [
"java.lang",
"java.util",
"javax.servlet",
"org.springframework.web",
"ro.cs.om"
] | java.lang; java.util; javax.servlet; org.springframework.web; ro.cs.om; | 1,157,602 |
private boolean hasTokenValue(Installation installation) {
return (installation.getDeviceToken() != null && (!installation.getDeviceToken().isEmpty()));
} | boolean function(Installation installation) { return (installation.getDeviceToken() != null && (!installation.getDeviceToken().isEmpty())); } | /**
* A simple validation util that checks if a token is present
*/ | A simple validation util that checks if a token is present | hasTokenValue | {
"repo_name": "fheng/aerogear-unifiedpush-server",
"path": "service/src/main/java/org/jboss/aerogear/unifiedpush/service/impl/ClientInstallationServiceImpl.java",
"license": "apache-2.0",
"size": 11748
} | [
"org.jboss.aerogear.unifiedpush.api.Installation"
] | import org.jboss.aerogear.unifiedpush.api.Installation; | import org.jboss.aerogear.unifiedpush.api.*; | [
"org.jboss.aerogear"
] | org.jboss.aerogear; | 1,830,243 |
public void setMediaButtonReceiver(@Nullable PendingIntent mbr) {
try {
mBinder.setMediaButtonReceiver(mbr);
} catch (RemoteException e) {
Log.wtf(TAG, "Failure in setMediaButtonReceiver.", e);
}
} | void function(@Nullable PendingIntent mbr) { try { mBinder.setMediaButtonReceiver(mbr); } catch (RemoteException e) { Log.wtf(TAG, STR, e); } } | /**
* Set a pending intent for your media button receiver to allow restarting
* playback after the session has been stopped. If your app is started in
* this way an {@link Intent#ACTION_MEDIA_BUTTON} intent will be sent via
* the pending intent.
*
* @param mbr The {@link PendingIntent} to send the media button event to.
*/ | Set a pending intent for your media button receiver to allow restarting playback after the session has been stopped. If your app is started in this way an <code>Intent#ACTION_MEDIA_BUTTON</code> intent will be sent via the pending intent | setMediaButtonReceiver | {
"repo_name": "xorware/android_frameworks_base",
"path": "media/java/android/media/session/MediaSession.java",
"license": "apache-2.0",
"size": 49272
} | [
"android.annotation.Nullable",
"android.app.PendingIntent",
"android.os.RemoteException",
"android.util.Log"
] | import android.annotation.Nullable; import android.app.PendingIntent; import android.os.RemoteException; import android.util.Log; | import android.annotation.*; import android.app.*; import android.os.*; import android.util.*; | [
"android.annotation",
"android.app",
"android.os",
"android.util"
] | android.annotation; android.app; android.os; android.util; | 2,913,222 |
// begin Kuali Foundation modification
public Map getFormatterTypes() {
return formatterTypes;
}
// end Kuali Foundation modification
| Map function() { return formatterTypes; } | /**
* Gets the formatterTypes attribute.
*
* @return Returns the formatterTypes.
*/ | Gets the formatterTypes attribute | getFormatterTypes | {
"repo_name": "jwillia/kc-rice1",
"path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/web/struts/form/pojo/PojoFormBase.java",
"license": "apache-2.0",
"size": 26057
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,889,133 |
public static void systemCallSoundFmodChannelGetPaused(
int channelID,
Wrapper<ReturnCode> outReturnCode, Wrapper<SoundReturnCode> outSoundReturnCode, Wrapper<FmodResult> outFmodResult,
Wrapper<Boolean> outPaused
){
List<Parameter> params = new ArrayList<>();
params.add(Parameter.createInt(channelID));
QAMessage response = Kernel.systemCall("de.silveryard.basesystem.systemcall.sound.fmodchannel.getpaused", params);
outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt());
outSoundReturnCode.value = SoundReturnCode.getEnumValue(response.getParameters().get(1).getInt());
outFmodResult.value = FmodResult.getEnumValue(response.getParameters().get(2).getInt());
outPaused.value = response.getParameters().get(3).getBoolean();
} | static void function( int channelID, Wrapper<ReturnCode> outReturnCode, Wrapper<SoundReturnCode> outSoundReturnCode, Wrapper<FmodResult> outFmodResult, Wrapper<Boolean> outPaused ){ List<Parameter> params = new ArrayList<>(); params.add(Parameter.createInt(channelID)); QAMessage response = Kernel.systemCall(STR, params); outReturnCode.value = ReturnCode.getEnumValue(response.getParameters().get(0).getInt()); outSoundReturnCode.value = SoundReturnCode.getEnumValue(response.getParameters().get(1).getInt()); outFmodResult.value = FmodResult.getEnumValue(response.getParameters().get(2).getInt()); outPaused.value = response.getParameters().get(3).getBoolean(); } | /**
* Fetches the paused flag of a given channel
* @param channelID The given channels id
* @param outReturnCode General Return Code
* @param outSoundReturnCode Sound Return Code
* @param outFmodResult Fmod Result
* @param outPaused Value of the paused flag
*/ | Fetches the paused flag of a given channel | systemCallSoundFmodChannelGetPaused | {
"repo_name": "Silveryard/BaseSystem",
"path": "Libraries/App/Java/AppSDK/src/main/java/de/silveryard/basesystem/sdk/kernel/sound/FmodChannel.java",
"license": "mit",
"size": 23930
} | [
"de.silveryard.basesystem.sdk.kernel.Kernel",
"de.silveryard.basesystem.sdk.kernel.ReturnCode",
"de.silveryard.basesystem.sdk.kernel.Wrapper",
"de.silveryard.transport.Parameter",
"de.silveryard.transport.highlevelprotocols.qa.QAMessage",
"java.util.ArrayList",
"java.util.List"
] | import de.silveryard.basesystem.sdk.kernel.Kernel; import de.silveryard.basesystem.sdk.kernel.ReturnCode; import de.silveryard.basesystem.sdk.kernel.Wrapper; import de.silveryard.transport.Parameter; import de.silveryard.transport.highlevelprotocols.qa.QAMessage; import java.util.ArrayList; import java.util.List; | import de.silveryard.basesystem.sdk.kernel.*; import de.silveryard.transport.*; import de.silveryard.transport.highlevelprotocols.qa.*; import java.util.*; | [
"de.silveryard.basesystem",
"de.silveryard.transport",
"java.util"
] | de.silveryard.basesystem; de.silveryard.transport; java.util; | 2,723,956 |
protected void resize(final int width, final int height) {
if (width == fWidth && height == fHeight)
return;
fWidth = width;
fHeight = height;
// Replace attributes in document:
MutableAttributeSet attr = new SimpleAttributeSet();
attr.addAttribute(HTML.Attribute.WIDTH, Integer.toString(width));
attr.addAttribute(HTML.Attribute.HEIGHT, Integer.toString(height));
((StyledDocument) getDocument()).setCharacterAttributes(fElement
.getStartOffset(), fElement.getEndOffset(), attr, false);
}
// --- Mouse event handling -------------------------------------------- | void function(final int width, final int height) { if (width == fWidth && height == fHeight) return; fWidth = width; fHeight = height; MutableAttributeSet attr = new SimpleAttributeSet(); attr.addAttribute(HTML.Attribute.WIDTH, Integer.toString(width)); attr.addAttribute(HTML.Attribute.HEIGHT, Integer.toString(height)); ((StyledDocument) getDocument()).setCharacterAttributes(fElement .getStartOffset(), fElement.getEndOffset(), attr, false); } | /**
* Change the size of this image. This alters the HEIGHT and WIDTH attributes
* of the Element and causes a re-layout.
*/ | Change the size of this image. This alters the HEIGHT and WIDTH attributes of the Element and causes a re-layout | resize | {
"repo_name": "GenomicParisCentre/doelan",
"path": "src/main/java/fr/ens/transcriptome/doelan/gui/MyImageView.java",
"license": "gpl-2.0",
"size": 27126
} | [
"javax.swing.text.MutableAttributeSet",
"javax.swing.text.SimpleAttributeSet",
"javax.swing.text.StyledDocument"
] | import javax.swing.text.MutableAttributeSet; import javax.swing.text.SimpleAttributeSet; import javax.swing.text.StyledDocument; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 1,081,893 |
public PlanNode parseNode(QueryPlan mother, Element el) {
PlanNode newNode = new PlanNode(Integer.parseInt(el.getAttributes()
.getNamedItem("id").getNodeValue()), getScheme(el
.getAttributes().getNamedItem("kind").getNodeValue()), mother);
fillNode(newNode, el, mother, newNode);
return newNode;
} | PlanNode function(QueryPlan mother, Element el) { PlanNode newNode = new PlanNode(Integer.parseInt(el.getAttributes() .getNamedItem("id").getNodeValue()), getScheme(el .getAttributes().getNamedItem("kind").getNodeValue()), mother); fillNode(newNode, el, mother, newNode); return newNode; } | /**
* Parses a PlanNode from a single DOM-element
*
* @param mother
* the surrounding plan
* @param el
* the element to be parsed
* @return the parsed and filled PlanNode
*/ | Parses a PlanNode from a single DOM-element | parseNode | {
"repo_name": "patrickbr/ferryleaks",
"path": "src/com/algebraweb/editor/server/logicalplan/xmlplanloader/planparser/PlanParser.java",
"license": "gpl-2.0",
"size": 12116
} | [
"com.algebraweb.editor.shared.node.PlanNode",
"com.algebraweb.editor.shared.node.QueryPlan",
"org.w3c.dom.Element"
] | import com.algebraweb.editor.shared.node.PlanNode; import com.algebraweb.editor.shared.node.QueryPlan; import org.w3c.dom.Element; | import com.algebraweb.editor.shared.node.*; import org.w3c.dom.*; | [
"com.algebraweb.editor",
"org.w3c.dom"
] | com.algebraweb.editor; org.w3c.dom; | 1,645,223 |
public boolean isAuditorEnabledForTransaction(AuditEventMessage msg)
{
CodedValueType transactionCode = EventUtils.getIHETransactionCodeFromMessage(msg);
return isAuditorEnabledForTransaction(transactionCode);
}
| boolean function(AuditEventMessage msg) { CodedValueType transactionCode = EventUtils.getIHETransactionCodeFromMessage(msg); return isAuditorEnabledForTransaction(transactionCode); } | /**
* Determines if this audit message represented should be sent or not
* based on the IHE transaction it represents. Examples of transactions
* that may be disabled are the ITI code ("ITI-14") or the name of
* the transaction ("Register Document Set").
*
* @see org.openhealthtools.ihe.atna.auditor.context.AuditorModuleConfig#getDisabledIHETransactions()
* @see org.openhealthtools.ihe.atna.auditor.codes.ihe.IHETransactionEventTypeCodes
* @param msg The audit event message to check
* @return Whether the message should be sent
*/ | Determines if this audit message represented should be sent or not based on the IHE transaction it represents. Examples of transactions that may be disabled are the ITI code ("ITI-14") or the name of the transaction ("Register Document Set") | isAuditorEnabledForTransaction | {
"repo_name": "oehf/ipf-oht-atna",
"path": "auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/IHEAuditor.java",
"license": "epl-1.0",
"size": 24587
} | [
"org.openhealthtools.ihe.atna.auditor.events.AuditEventMessage",
"org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType",
"org.openhealthtools.ihe.atna.auditor.utils.EventUtils"
] | import org.openhealthtools.ihe.atna.auditor.events.AuditEventMessage; import org.openhealthtools.ihe.atna.auditor.models.rfc3881.CodedValueType; import org.openhealthtools.ihe.atna.auditor.utils.EventUtils; | import org.openhealthtools.ihe.atna.auditor.events.*; import org.openhealthtools.ihe.atna.auditor.models.rfc3881.*; import org.openhealthtools.ihe.atna.auditor.utils.*; | [
"org.openhealthtools.ihe"
] | org.openhealthtools.ihe; | 266,131 |
static void printException(Throwable t) {
printToLogFile(Tools.getFullStackTrace(t));
}
/*
private static String getLogPath() {
String xdgDataHome = System.getenv().get("XDG_DATA_HOME");
String logHome = xdgDataHome != null ? xdgDataHome + "/LanguageTool" : homeDir;
String path = logHome + "/" + logFileName;
File parentDir = new File(path).getParentFile();
if (parentDir != null && !testMode) {
if (!parentDir.exists()) {
boolean success = parentDir.mkdirs();
if (!success) {
showMessage("Can't create directory: " + parentDir);
}
}
}
return path;
} | static void printException(Throwable t) { printToLogFile(Tools.getFullStackTrace(t)); } /* private static String getLogPath() { String xdgDataHome = System.getenv().get(STR); String logHome = xdgDataHome != null ? xdgDataHome + STR : homeDir; String path = logHome + "/" + logFileName; File parentDir = new File(path).getParentFile(); if (parentDir != null && !testMode) { if (!parentDir.exists()) { boolean success = parentDir.mkdirs(); if (!success) { showMessage(STR + parentDir); } } } return path; } | /**
* Prints Exception to log-file
*/ | Prints Exception to log-file | printException | {
"repo_name": "jimregan/languagetool",
"path": "languagetool-office-extension/src/main/java/org/languagetool/openoffice/MessageHandler.java",
"license": "lgpl-2.1",
"size": 6077
} | [
"org.languagetool.tools.Tools"
] | import org.languagetool.tools.Tools; | import org.languagetool.tools.*; | [
"org.languagetool.tools"
] | org.languagetool.tools; | 2,005,967 |
public LdapConnection getUserConnection() throws LdapException
{
try
{
return userPool.getConnection();
}
catch ( Exception e )
{
throw new LdapException( e );
}
} | LdapConnection function() throws LdapException { try { return userPool.getConnection(); } catch ( Exception e ) { throw new LdapException( e ); } } | /**
* Calls the PoolMgr to get an User connection to the LDAP server.
*
* @return ldap connection.
* @throws LdapException If we had an issue getting an LDAP connection
*/ | Calls the PoolMgr to get an User connection to the LDAP server | getUserConnection | {
"repo_name": "PennState/directory-fortress-core-1",
"path": "src/main/java/org/apache/directory/fortress/core/ldap/LdapConnectionProvider.java",
"license": "apache-2.0",
"size": 15358
} | [
"org.apache.directory.api.ldap.model.exception.LdapException",
"org.apache.directory.ldap.client.api.LdapConnection"
] | import org.apache.directory.api.ldap.model.exception.LdapException; import org.apache.directory.ldap.client.api.LdapConnection; | import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.ldap.client.api.*; | [
"org.apache.directory"
] | org.apache.directory; | 1,755,052 |
@Override
public Object put(Object name, Object value) throws IllegalArgumentException, ClassCastException {
if ( bean != null ) {
Object oldValue = get( name );
Method method = getWriteMethod( name );
if ( method == null ) {
throw new IllegalArgumentException( "The bean of type: "+
bean.getClass().getName() + " has no property called: " + name );
}
try {
Object[] arguments = createWriteMethodArguments( method, value );
method.invoke( bean, arguments );
Object newValue = get( name );
firePropertyChange( name, oldValue, newValue );
}
catch ( InvocationTargetException e ) {
IllegalArgumentException iae = new IllegalArgumentException(e.getMessage());
if (BeanUtils.initCause(iae, e) == false) {
logInfo(e);
}
throw iae;
}
catch ( IllegalAccessException e ) {
IllegalArgumentException iae = new IllegalArgumentException(e.getMessage());
if (BeanUtils.initCause(iae, e) == false) {
logInfo(e);
}
throw iae;
}
return oldValue;
}
return null;
} | Object function(Object name, Object value) throws IllegalArgumentException, ClassCastException { if ( bean != null ) { Object oldValue = get( name ); Method method = getWriteMethod( name ); if ( method == null ) { throw new IllegalArgumentException( STR+ bean.getClass().getName() + STR + name ); } try { Object[] arguments = createWriteMethodArguments( method, value ); method.invoke( bean, arguments ); Object newValue = get( name ); firePropertyChange( name, oldValue, newValue ); } catch ( InvocationTargetException e ) { IllegalArgumentException iae = new IllegalArgumentException(e.getMessage()); if (BeanUtils.initCause(iae, e) == false) { logInfo(e); } throw iae; } catch ( IllegalAccessException e ) { IllegalArgumentException iae = new IllegalArgumentException(e.getMessage()); if (BeanUtils.initCause(iae, e) == false) { logInfo(e); } throw iae; } return oldValue; } return null; } | /**
* Sets the bean property with the given name to the given value.
*
* @param name the name of the property to set
* @param value the value to set that property to
* @return the previous value of that property
* @throws IllegalArgumentException if the given name is null;
* if the given name is not a {@link String}; if the bean doesn't
* define a property with that name; or if the bean property with
* that name is read-only
* @throws ClassCastException if an error occurs creating the method args
*/ | Sets the bean property with the given name to the given value | put | {
"repo_name": "77ilogin/training",
"path": "src/main/java/org/apache/commons/beanutils/BeanMap.java",
"license": "apache-2.0",
"size": 32245
} | [
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method"
] | import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,673,184 |
public User login(String username, String password) throws RemoteException, InvalidCredentialsException, UnexistingUserException;
| User function(String username, String password) throws RemoteException, InvalidCredentialsException, UnexistingUserException; | /**
* Esegue il login di un utente, usando le credenziali fornite.
*
* @param username: L'Username da utilizzare
* @param password: La password (in chiaro) da utilizzare
* @return Un User che rappresenta l'utente autenticato, se il login è riuscito
* @throws RemoteException
* @throws InvalidCredentialsException in caso di credenziali (username o password) non valide
* @throws UnexistingUserException in caso di utente non esistente
*/ | Esegue il login di un utente, usando le credenziali fornite | login | {
"repo_name": "MrAsterisco/Phoenix",
"path": "Phoenix-Base/src/phoenix/base/Server.java",
"license": "gpl-2.0",
"size": 5745
} | [
"java.rmi.RemoteException"
] | import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
] | java.rmi; | 491,688 |
@Override
public byte[] getData() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = baos;
SWFOutputStream sos = new SWFOutputStream(os, getVersion());
try {
sos.writeUB(1, reserved1 ? 1 : 0); //reserved
sos.writeUB(1, useDirectBlit ? 1 : 0);
sos.writeUB(1, useGPU ? 1 : 0);
sos.writeUB(1, hasMetadata ? 1 : 0);
sos.writeUB(1, actionScript3 ? 1 : 0);
sos.writeUB(1, noCrossDomainCache ? 1 : 0);
sos.writeUB(1, reserved2 ? 1 : 0); //reserved
sos.writeUB(1, useNetwork ? 1 : 0);
sos.writeUB(24, reserved3); //reserved
} catch (IOException e) {
throw new Error("This should never happen.", e);
}
return baos.toByteArray();
} | byte[] function() { ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStream os = baos; SWFOutputStream sos = new SWFOutputStream(os, getVersion()); try { sos.writeUB(1, reserved1 ? 1 : 0); sos.writeUB(1, useDirectBlit ? 1 : 0); sos.writeUB(1, useGPU ? 1 : 0); sos.writeUB(1, hasMetadata ? 1 : 0); sos.writeUB(1, actionScript3 ? 1 : 0); sos.writeUB(1, noCrossDomainCache ? 1 : 0); sos.writeUB(1, reserved2 ? 1 : 0); sos.writeUB(1, useNetwork ? 1 : 0); sos.writeUB(24, reserved3); } catch (IOException e) { throw new Error(STR, e); } return baos.toByteArray(); } | /**
* Gets data bytes
*
* @return Bytes of data
*/ | Gets data bytes | getData | {
"repo_name": "izstas/jpexs-decompiler",
"path": "libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FileAttributesTag.java",
"license": "gpl-3.0",
"size": 3756
} | [
"com.jpexs.decompiler.flash.SWFOutputStream",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.OutputStream"
] | import com.jpexs.decompiler.flash.SWFOutputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; | import com.jpexs.decompiler.flash.*; import java.io.*; | [
"com.jpexs.decompiler",
"java.io"
] | com.jpexs.decompiler; java.io; | 1,598,294 |
SupportsListing<Provider>,
SupportsGettingByName<Provider> {
Provider unregister(String resourceProviderNamespace); | SupportsListing<Provider>, SupportsGettingByName<Provider> { Provider unregister(String resourceProviderNamespace); | /**
* Unregisters provider from a subscription.
*
* @param resourceProviderNamespace Namespace of the resource provider
* @return the ProviderInner object wrapped in {@link ServiceResponse} if successful
*/ | Unregisters provider from a subscription | unregister | {
"repo_name": "anudeepsharma/azure-sdk-for-java",
"path": "azure-mgmt-resources/src/main/java/com/microsoft/azure/management/resources/Providers.java",
"license": "mit",
"size": 3277
} | [
"com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName",
"com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing"
] | import com.microsoft.azure.management.resources.fluentcore.arm.collection.SupportsGettingByName; import com.microsoft.azure.management.resources.fluentcore.collection.SupportsListing; | import com.microsoft.azure.management.resources.fluentcore.arm.collection.*; import com.microsoft.azure.management.resources.fluentcore.collection.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,909,368 |
protected Resource getTestingFrameworkBundlesConfiguration() {
return new InputStreamResource(AbstractDependencyManagerTests.class.getResourceAsStream(TEST_FRAMEWORK_BUNDLES_CONF_FILE));
}
/**
* {@inheritDoc}
| Resource function() { return new InputStreamResource(AbstractDependencyManagerTests.class.getResourceAsStream(TEST_FRAMEWORK_BUNDLES_CONF_FILE)); } /** * {@inheritDoc} | /**
* Returns the location of the test framework bundles configuration.
*
* @return the location of the test framework bundles configuration
*/ | Returns the location of the test framework bundles configuration | getTestingFrameworkBundlesConfiguration | {
"repo_name": "eclipse/gemini.blueprint",
"path": "test-support/src/main/java/org/eclipse/gemini/blueprint/test/AbstractDependencyManagerTests.java",
"license": "apache-2.0",
"size": 11254
} | [
"org.springframework.core.io.InputStreamResource",
"org.springframework.core.io.Resource"
] | import org.springframework.core.io.InputStreamResource; import org.springframework.core.io.Resource; | import org.springframework.core.io.*; | [
"org.springframework.core"
] | org.springframework.core; | 1,446,301 |
public void exec(TreeLogger logger) throws UnableToCompleteException {
this.logger = logger;
// Trace execution from entry points.
for (JMethod entryMethod : program.getEntryMethods()) {
flowInto(entryMethod);
}
// Trace execution from compiler code gen types.
for (JClassType type : program.codeGenTypes) {
for (JMethod method : type.getMethods()) {
flowInto(method);
}
}
// String literals.
instantiate(program.getTypeJavaLangString());
// ControlFlowAnalyzer.rescueByConcat().
flowInto(program.getIndexedMethod("Object.toString"));
mapApi(program.getTypeJavaLangString());
flowInto(methodMap.get("java.lang.String.valueOf(C)Ljava/lang/String;"));
// Additional pre-optimization code gen.
// TODO: roll these into this class?
// EnumNameObfuscator
flowInto(program.getIndexedMethod("Enum.obfuscatedName"));
// FixAssignmentToUnbox
AutoboxUtils autoboxUtils = new AutoboxUtils(program);
for (JMethod method : autoboxUtils.getBoxMethods()) {
flowInto(method);
}
for (JMethod method : autoboxUtils.getUnboxMethods()) {
flowInto(method);
}
// ReplaceRunAsyncs
if (options.isRunAsyncEnabled()) {
flowInto(program.getIndexedMethod("AsyncFragmentLoader.onLoad"));
flowInto(program.getIndexedMethod("AsyncFragmentLoader.runAsync"));
}
// ImplementClassLiteralsAsFields
staticInitialize(program.getTypeClassLiteralHolder());
for (JMethod method : program.getTypeJavaLangClass().getMethods()) {
if (method.isStatic() && method.getName().startsWith("createFor")) {
flowInto(method);
}
}
mainLoop();
// Post-stitching clean-ups.
// Prune any untranslated types, fields, and methods.
for (Iterator<JDeclaredType> it = program.getDeclaredTypes().iterator(); it.hasNext();) {
JDeclaredType type = it.next();
boolean isInstantiated = instantiatedTypes.contains(type);
for (int i = 0; i < type.getFields().size(); ++i) {
JField field = type.getFields().get(i);
if (!liveFieldsAndMethods.contains(field) || (!field.isStatic() && !isInstantiated)) {
type.removeField(i);
--i;
}
}
// Special clinit handling.
JMethod clinit = type.getClinitMethod();
if (!liveFieldsAndMethods.contains(clinit)) {
clinit.setBody(new JMethodBody(SourceOrigin.UNKNOWN));
}
for (int i = 1; i < type.getMethods().size(); ++i) {
JMethod method = type.getMethods().get(i);
if (!liveFieldsAndMethods.contains(method) || (!method.isStatic() && !isInstantiated)) {
type.removeMethod(i);
--i;
}
}
}
computeOverrides();
if (errorsFound) {
throw new UnableToCompleteException();
}
} | void function(TreeLogger logger) throws UnableToCompleteException { this.logger = logger; for (JMethod entryMethod : program.getEntryMethods()) { flowInto(entryMethod); } for (JClassType type : program.codeGenTypes) { for (JMethod method : type.getMethods()) { flowInto(method); } } instantiate(program.getTypeJavaLangString()); flowInto(program.getIndexedMethod(STR)); mapApi(program.getTypeJavaLangString()); flowInto(methodMap.get(STR)); flowInto(program.getIndexedMethod(STR)); AutoboxUtils autoboxUtils = new AutoboxUtils(program); for (JMethod method : autoboxUtils.getBoxMethods()) { flowInto(method); } for (JMethod method : autoboxUtils.getUnboxMethods()) { flowInto(method); } if (options.isRunAsyncEnabled()) { flowInto(program.getIndexedMethod(STR)); flowInto(program.getIndexedMethod(STR)); } staticInitialize(program.getTypeClassLiteralHolder()); for (JMethod method : program.getTypeJavaLangClass().getMethods()) { if (method.isStatic() && method.getName().startsWith(STR)) { flowInto(method); } } mainLoop(); for (Iterator<JDeclaredType> it = program.getDeclaredTypes().iterator(); it.hasNext();) { JDeclaredType type = it.next(); boolean isInstantiated = instantiatedTypes.contains(type); for (int i = 0; i < type.getFields().size(); ++i) { JField field = type.getFields().get(i); if (!liveFieldsAndMethods.contains(field) (!field.isStatic() && !isInstantiated)) { type.removeField(i); --i; } } JMethod clinit = type.getClinitMethod(); if (!liveFieldsAndMethods.contains(clinit)) { clinit.setBody(new JMethodBody(SourceOrigin.UNKNOWN)); } for (int i = 1; i < type.getMethods().size(); ++i) { JMethod method = type.getMethods().get(i); if (!liveFieldsAndMethods.contains(method) (!method.isStatic() && !isInstantiated)) { type.removeMethod(i); --i; } } } computeOverrides(); if (errorsFound) { throw new UnableToCompleteException(); } } | /**
* For normal compilation, only translate and stitch types reachable from
* entry points. This reduces memory and improves compile speed. Any
* unreachable elements are pruned.
*/ | For normal compilation, only translate and stitch types reachable from entry points. This reduces memory and improves compile speed. Any unreachable elements are pruned | exec | {
"repo_name": "syntelos/gwtcc",
"path": "src/com/google/gwt/dev/jjs/impl/UnifyAst.java",
"license": "apache-2.0",
"size": 37320
} | [
"com.google.gwt.core.ext.TreeLogger",
"com.google.gwt.core.ext.UnableToCompleteException",
"com.google.gwt.dev.jjs.SourceOrigin",
"com.google.gwt.dev.jjs.ast.JClassType",
"com.google.gwt.dev.jjs.ast.JDeclaredType",
"com.google.gwt.dev.jjs.ast.JField",
"com.google.gwt.dev.jjs.ast.JMethod",
"com.google.gwt.dev.jjs.ast.JMethodBody",
"java.util.Iterator"
] | import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.UnableToCompleteException; import com.google.gwt.dev.jjs.SourceOrigin; import com.google.gwt.dev.jjs.ast.JClassType; import com.google.gwt.dev.jjs.ast.JDeclaredType; import com.google.gwt.dev.jjs.ast.JField; import com.google.gwt.dev.jjs.ast.JMethod; import com.google.gwt.dev.jjs.ast.JMethodBody; import java.util.Iterator; | import com.google.gwt.core.ext.*; import com.google.gwt.dev.jjs.*; import com.google.gwt.dev.jjs.ast.*; import java.util.*; | [
"com.google.gwt",
"java.util"
] | com.google.gwt; java.util; | 2,662,625 |
@Test
public void testListenerBasicSocket()
{
EventDriverFactory factory = new EventDriverFactory(WebSocketPolicy.newClientPolicy());
ListenerBasicSocket socket = new ListenerBasicSocket();
EventDriver driver = factory.wrap(socket);
String classId = ListenerBasicSocket.class.getSimpleName();
Assert.assertThat("EventDriver for " + classId,driver,instanceOf(JettyListenerEventDriver.class));
} | void function() { EventDriverFactory factory = new EventDriverFactory(WebSocketPolicy.newClientPolicy()); ListenerBasicSocket socket = new ListenerBasicSocket(); EventDriver driver = factory.wrap(socket); String classId = ListenerBasicSocket.class.getSimpleName(); Assert.assertThat(STR + classId,driver,instanceOf(JettyListenerEventDriver.class)); } | /**
* Test Case for no exceptions and 5 methods (implement WebSocketListener)
*/ | Test Case for no exceptions and 5 methods (implement WebSocketListener) | testListenerBasicSocket | {
"repo_name": "sdw2330976/Research-jetty-9.2.5",
"path": "jetty-websocket/websocket-common/src/test/java/org/eclipse/jetty/websocket/common/events/EventDriverFactoryTest.java",
"license": "apache-2.0",
"size": 3277
} | [
"org.eclipse.jetty.websocket.api.WebSocketPolicy",
"org.junit.Assert"
] | import org.eclipse.jetty.websocket.api.WebSocketPolicy; import org.junit.Assert; | import org.eclipse.jetty.websocket.api.*; import org.junit.*; | [
"org.eclipse.jetty",
"org.junit"
] | org.eclipse.jetty; org.junit; | 1,048,913 |
private static BitsTypeDefinition.Bit parseBit(final Bit_stmtContext ctx, final long highestPosition,
final SchemaPath actualPath, final String moduleName) {
String name = stringFromNode(ctx);
Long position = null;
String description = null;
String reference = null;
Status status = Status.CURRENT;
SchemaPath schemaPath = createBaseTypePath(actualPath, name);
for (int i = 0; i < ctx.getChildCount(); i++) {
ParseTree child = ctx.getChild(i);
if (child instanceof Position_stmtContext) {
String positionStr = stringFromNode(child);
position = Long.valueOf(positionStr);
} else if (child instanceof Description_stmtContext) {
description = stringFromNode(child);
} else if (child instanceof Reference_stmtContext) {
reference = stringFromNode(child);
} else if (child instanceof Status_stmtContext) {
status = parseStatus((Status_stmtContext) child);
}
}
if (position == null) {
position = highestPosition + 1;
}
if (position < 0 || position > 4294967295L) {
throw new YangParseException(moduleName, ctx.getStart().getLine(), "Error on bit '" + name
+ "': the position value MUST be in the range 0 to 4294967295");
}
final List<UnknownSchemaNode> unknownNodes = Collections.emptyList();
return new BitImpl(position, schemaPath.getPathTowardsRoot().iterator().next(), schemaPath,
description, reference, status, unknownNodes);
} | static BitsTypeDefinition.Bit function(final Bit_stmtContext ctx, final long highestPosition, final SchemaPath actualPath, final String moduleName) { String name = stringFromNode(ctx); Long position = null; String description = null; String reference = null; Status status = Status.CURRENT; SchemaPath schemaPath = createBaseTypePath(actualPath, name); for (int i = 0; i < ctx.getChildCount(); i++) { ParseTree child = ctx.getChild(i); if (child instanceof Position_stmtContext) { String positionStr = stringFromNode(child); position = Long.valueOf(positionStr); } else if (child instanceof Description_stmtContext) { description = stringFromNode(child); } else if (child instanceof Reference_stmtContext) { reference = stringFromNode(child); } else if (child instanceof Status_stmtContext) { status = parseStatus((Status_stmtContext) child); } } if (position == null) { position = highestPosition + 1; } if (position < 0 position > 4294967295L) { throw new YangParseException(moduleName, ctx.getStart().getLine(), STR + name + STR); } final List<UnknownSchemaNode> unknownNodes = Collections.emptyList(); return new BitImpl(position, schemaPath.getPathTowardsRoot().iterator().next(), schemaPath, description, reference, status, unknownNodes); } | /**
* Internal helper method for parsing bit context.
*
* @param ctx
* bit statement context to parse
* @param highestPosition
* current highest position in bits type
* @param actualPath
* current position in YANG model
* @param moduleName
* current module name
* @return Bit object parsed from this context
*/ | Internal helper method for parsing bit context | parseBit | {
"repo_name": "522986491/yangtools",
"path": "yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/impl/ParserListenerUtils.java",
"license": "epl-1.0",
"size": 73469
} | [
"java.util.Collections",
"java.util.List",
"org.antlr.v4.runtime.tree.ParseTree",
"org.opendaylight.yangtools.yang.model.api.SchemaPath",
"org.opendaylight.yangtools.yang.model.api.Status",
"org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode",
"org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition",
"org.opendaylight.yangtools.yang.model.util.BitImpl",
"org.opendaylight.yangtools.yang.parser.util.YangParseException"
] | import java.util.Collections; import java.util.List; import org.antlr.v4.runtime.tree.ParseTree; import org.opendaylight.yangtools.yang.model.api.SchemaPath; import org.opendaylight.yangtools.yang.model.api.Status; import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode; import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition; import org.opendaylight.yangtools.yang.model.util.BitImpl; import org.opendaylight.yangtools.yang.parser.util.YangParseException; | import java.util.*; import org.antlr.v4.runtime.tree.*; import org.opendaylight.yangtools.yang.model.api.*; import org.opendaylight.yangtools.yang.model.api.type.*; import org.opendaylight.yangtools.yang.model.util.*; import org.opendaylight.yangtools.yang.parser.util.*; | [
"java.util",
"org.antlr.v4",
"org.opendaylight.yangtools"
] | java.util; org.antlr.v4; org.opendaylight.yangtools; | 2,601,420 |
private BufferedImage createImage(byte[] values) throws Exception {
ByteArrayInputStream stream = new ByteArrayInputStream(values);
return ImageIO.read(stream);
} | BufferedImage function(byte[] values) throws Exception { ByteArrayInputStream stream = new ByteArrayInputStream(values); return ImageIO.read(stream); } | /**
* Creates an image from the passed values.
*
* @param values
* The values to handle.
* @return See above.
* @throws Exception
* Thrown if an error occurred.
*/ | Creates an image from the passed values | createImage | {
"repo_name": "dpwrussell/openmicroscopy",
"path": "components/tools/OmeroJava/test/integration/RenderingEngineTest.java",
"license": "gpl-2.0",
"size": 131845
} | [
"java.awt.image.BufferedImage",
"java.io.ByteArrayInputStream",
"javax.imageio.ImageIO"
] | import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; | import java.awt.image.*; import java.io.*; import javax.imageio.*; | [
"java.awt",
"java.io",
"javax.imageio"
] | java.awt; java.io; javax.imageio; | 2,807,620 |
@Override
public void render(float delta) {
Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
//OpenGL nonsense
//First instruction sets background colour
if (engine.state() == GameEngine.State.RUN) {
drawRectangles();
gameStage.act(delta);
gameStage.draw();
//Draw the stage onto the screen
if (engine.phase() == 4)
{
if (engine.chancellorGame != null){
engine.chancellorGame.update(delta);}
else
engine.timer().setTime(0, 0);
}
// Draw owned tile's border
for (Tile tile : engine.tiles())
{
tile.drawBorder();
}
// Draw animation.
renderAnimation(delta, IAnimation.AnimationType.Tile);
// Draw
if (!upgradeOverlayVisible) {
for (Tile tile : engine.tiles())
{
tile.drawTooltip(); //If any of the tiles' tooltips are deemed "active", render them to the screen too
chancellor(tile);
}
}
else {
upgradeOverlay.act(delta);
upgradeOverlay.draw();
}
if (drawRoboticonIcon) {
drawer.drawRoboticon(selectedTile.getRoboticonStored(),
tableRight.getX() + selectedTileRoboticonIcon.getX(),
selectedTileRoboticonIcon.getY()
);
}
if (eventMessageOverlayVisible) {
eventMessageOverlay.act(delta);
eventMessageOverlay.draw();
}
if (tradeOverlayVisible) {
tradeOverlay.act(delta);
tradeOverlay.draw();
}
if (tooExpensiveOverlayVisible) {
tooExpensiveOverlay.act(delta);
tooExpensiveOverlay.draw();
}
for (Tile tile : engine.tiles())
chancellor(tile);
//Draw the roboticon upgrade overlay to the screen if the "upgrade" button has been selected
} else if (engine.state() == GameEngine.State.PAUSE) {
drawer.filledRectangle(Color.WHITE, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
//If the game is paused, render a white background...
pauseStage.act(delta);
pauseStage.draw();
//...followed by the menu itself
}
renderAnimation(delta, IAnimation.AnimationType.Overlay);
}
| void function(float delta) { Gdx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (engine.state() == GameEngine.State.RUN) { drawRectangles(); gameStage.act(delta); gameStage.draw(); if (engine.phase() == 4) { if (engine.chancellorGame != null){ engine.chancellorGame.update(delta);} else engine.timer().setTime(0, 0); } for (Tile tile : engine.tiles()) { tile.drawBorder(); } renderAnimation(delta, IAnimation.AnimationType.Tile); if (!upgradeOverlayVisible) { for (Tile tile : engine.tiles()) { tile.drawTooltip(); chancellor(tile); } } else { upgradeOverlay.act(delta); upgradeOverlay.draw(); } if (drawRoboticonIcon) { drawer.drawRoboticon(selectedTile.getRoboticonStored(), tableRight.getX() + selectedTileRoboticonIcon.getX(), selectedTileRoboticonIcon.getY() ); } if (eventMessageOverlayVisible) { eventMessageOverlay.act(delta); eventMessageOverlay.draw(); } if (tradeOverlayVisible) { tradeOverlay.act(delta); tradeOverlay.draw(); } if (tooExpensiveOverlayVisible) { tooExpensiveOverlay.act(delta); tooExpensiveOverlay.draw(); } for (Tile tile : engine.tiles()) chancellor(tile); } else if (engine.state() == GameEngine.State.PAUSE) { drawer.filledRectangle(Color.WHITE, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); pauseStage.act(delta); pauseStage.draw(); } renderAnimation(delta, IAnimation.AnimationType.Overlay); } | /**
* Renders all visual elements (set up in the [show()] subroutine and all of its subsiduaries) to the window
* This is called to prepare each and every frame that the game deploys
*
* @param delta Change of time since previous render
*/ | Renders all visual elements (set up in the [show()] subroutine and all of its subsiduaries) to the window This is called to prepare each and every frame that the game deploys | render | {
"repo_name": "SEPR-York/Assessment4",
"path": "core/src/com/mygdx/game/GameScreen.java",
"license": "gpl-3.0",
"size": 52367
} | [
"com.badlogic.gdx.Gdx",
"com.badlogic.gdx.graphics.Color",
"io.github.teamfractal.animation.IAnimation"
] | import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import io.github.teamfractal.animation.IAnimation; | import com.badlogic.gdx.*; import com.badlogic.gdx.graphics.*; import io.github.teamfractal.animation.*; | [
"com.badlogic.gdx",
"io.github.teamfractal"
] | com.badlogic.gdx; io.github.teamfractal; | 1,620,413 |
public static Object decodeToObject( String encodedObject )
throws java.io.IOException, java.lang.ClassNotFoundException {
return decodeToObject(encodedObject,NO_OPTIONS,null);
} | static Object function( String encodedObject ) throws java.io.IOException, java.lang.ClassNotFoundException { return decodeToObject(encodedObject,NO_OPTIONS,null); } | /**
* Attempts to decode Base64 data and deserialize a Java
* Object within. Returns <tt>null</tt> if there was an error.
*
* @param encodedObject The Base64 data to decode
* @return The decoded and deserialized object
* @throws NullPointerException if encodedObject is null
* @throws java.io.IOException if there is a general error
* @throws ClassNotFoundException if the decoded object is of a
* class that cannot be found by the JVM
* @since 1.5
*/ | Attempts to decode Base64 data and deserialize a Java Object within. Returns null if there was an error | decodeToObject | {
"repo_name": "mwambler/webshell-xpages-ext-lib",
"path": "com.tc.utils/src/com/tc/utils/Base64.java",
"license": "apache-2.0",
"size": 84149
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,605,567 |
private void resolveDropInSlot( TableGroup group, int groupLevel,
LayoutSlot layoutGH )
{
ContainerSlot groupHeader = group
.getSlot( IGroupElementModel.HEADER_SLOT );
if ( groupHeader.getCount( ) < 1 )
return;
int rowId = groupHeader.getCount( ) - 1;
TableRow row = (TableRow) groupHeader.getContent( rowId );
resolveDropInRow( row, rowId, groupLevel, layoutGH.getLayoutRow( rowId ) );
} | void function( TableGroup group, int groupLevel, LayoutSlot layoutGH ) { ContainerSlot groupHeader = group .getSlot( IGroupElementModel.HEADER_SLOT ); if ( groupHeader.getCount( ) < 1 ) return; int rowId = groupHeader.getCount( ) - 1; TableRow row = (TableRow) groupHeader.getContent( rowId ); resolveDropInRow( row, rowId, groupLevel, layoutGH.getLayoutRow( rowId ) ); } | /**
* Resolves drop in the given group header slot.
*
* @param group
* the table group
* @param groupLevel
* the group level
* @param layoutGH
* the layout slot that maps the corresponding group header slot
*/ | Resolves drop in the given group header slot | resolveDropInSlot | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/elements/table/DropStrategy.java",
"license": "epl-1.0",
"size": 11360
} | [
"org.eclipse.birt.report.model.core.ContainerSlot",
"org.eclipse.birt.report.model.elements.TableGroup",
"org.eclipse.birt.report.model.elements.TableRow",
"org.eclipse.birt.report.model.elements.interfaces.IGroupElementModel"
] | import org.eclipse.birt.report.model.core.ContainerSlot; import org.eclipse.birt.report.model.elements.TableGroup; import org.eclipse.birt.report.model.elements.TableRow; import org.eclipse.birt.report.model.elements.interfaces.IGroupElementModel; | import org.eclipse.birt.report.model.core.*; import org.eclipse.birt.report.model.elements.*; import org.eclipse.birt.report.model.elements.interfaces.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 363,352 |
@RolesAllowed(value = {"ROLE_ADMIN", "ROLE_USER"})
@RequestMapping(value = "/{taskId}/release", method = RequestMethod.POST)
public void releaseTask(@PathVariable Long taskId, HttpServletRequest request) {
taskManagement.assignTask(taskId, null, request.getUserPrincipal().getName());
} | @RolesAllowed(value = {STR, STR}) @RequestMapping(value = STR, method = RequestMethod.POST) void function(@PathVariable Long taskId, HttpServletRequest request) { taskManagement.assignTask(taskId, null, request.getUserPrincipal().getName()); } | /**
* Release Task
*
* @param taskId Task id.
* @param request Do nothing.
*/ | Release Task | releaseTask | {
"repo_name": "abada-investigacion/cleia",
"path": "cleia/cleia-rest/src/main/java/com/abada/cleia/rest/process/task/TaskController.java",
"license": "gpl-3.0",
"size": 8053
} | [
"javax.annotation.security.RolesAllowed",
"javax.servlet.http.HttpServletRequest",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod"
] | import javax.annotation.security.RolesAllowed; import javax.servlet.http.HttpServletRequest; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import javax.annotation.security.*; import javax.servlet.http.*; import org.springframework.web.bind.annotation.*; | [
"javax.annotation",
"javax.servlet",
"org.springframework.web"
] | javax.annotation; javax.servlet; org.springframework.web; | 451,769 |
public static RGB resolveColor(ResourceResolver resources, ResourceValue color) {
color = resources.resolveResValue(color);
if (color == null) {
return null;
}
String value = color.getValue();
while (value != null) {
if (value.startsWith("#")) { //$NON-NLS-1$
try {
int rgba = ImageUtils.getColor(value);
// Drop alpha channel
return ImageUtils.intToRgb(rgba);
} catch (NumberFormatException nfe) {
// Pass
}
return null;
}
if (value.startsWith(PREFIX_RESOURCE_REF)) {
boolean isFramework = color.isFramework();
color = resources.findResValue(value, isFramework);
if (color != null) {
value = color.getValue();
} else {
break;
}
} else {
File file = new File(value);
if (file.exists() && file.getName().endsWith(DOT_XML)) {
// Parse
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
BufferedInputStream bis = null;
try {
bis = new BufferedInputStream(new FileInputStream(file));
InputSource is = new InputSource(bis);
factory.setNamespaceAware(true);
factory.setValidating(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(is);
NodeList items = document.getElementsByTagName(TAG_ITEM);
value = findColorValue(items);
continue;
} catch (Exception e) {
AdtPlugin.log(e, "Failed parsing color file %1$s", file.getName());
} finally {
if (bis != null) {
try {
bis.close();
} catch (IOException e) {
// Nothing useful can be done here
}
}
}
}
return null;
}
}
return null;
} | static RGB function(ResourceResolver resources, ResourceValue color) { color = resources.resolveResValue(color); if (color == null) { return null; } String value = color.getValue(); while (value != null) { if (value.startsWith("#")) { try { int rgba = ImageUtils.getColor(value); return ImageUtils.intToRgb(rgba); } catch (NumberFormatException nfe) { } return null; } if (value.startsWith(PREFIX_RESOURCE_REF)) { boolean isFramework = color.isFramework(); color = resources.findResValue(value, isFramework); if (color != null) { value = color.getValue(); } else { break; } } else { File file = new File(value); if (file.exists() && file.getName().endsWith(DOT_XML)) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); BufferedInputStream bis = null; try { bis = new BufferedInputStream(new FileInputStream(file)); InputSource is = new InputSource(bis); factory.setNamespaceAware(true); factory.setValidating(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(is); NodeList items = document.getElementsByTagName(TAG_ITEM); value = findColorValue(items); continue; } catch (Exception e) { AdtPlugin.log(e, STR, file.getName()); } finally { if (bis != null) { try { bis.close(); } catch (IOException e) { } } } } return null; } } return null; } | /**
* Tries to resolve the given resource value to an actual RGB color. For state lists
* it will pick the simplest/fallback color.
*
* @param resources the resource resolver to use to follow color references
* @param color the color to resolve
* @return the corresponding {@link RGB} color, or null
*/ | Tries to resolve the given resource value to an actual RGB color. For state lists it will pick the simplest/fallback color | resolveColor | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/ResourceHelper.java",
"license": "gpl-2.0",
"size": 28614
} | [
"com.android.ide.common.rendering.api.ResourceValue",
"com.android.ide.common.resources.ResourceResolver",
"com.android.ide.eclipse.adt.AdtPlugin",
"com.android.ide.eclipse.adt.internal.editors.layout.gle2.ImageUtils",
"java.io.BufferedInputStream",
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"org.w3c.dom.Document",
"org.w3c.dom.NodeList",
"org.xml.sax.InputSource"
] | import com.android.ide.common.rendering.api.ResourceValue; import com.android.ide.common.resources.ResourceResolver; import com.android.ide.eclipse.adt.AdtPlugin; import com.android.ide.eclipse.adt.internal.editors.layout.gle2.ImageUtils; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; | import com.android.ide.common.rendering.api.*; import com.android.ide.common.resources.*; import com.android.ide.eclipse.adt.*; import com.android.ide.eclipse.adt.internal.editors.layout.gle2.*; import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"com.android.ide",
"java.io",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | com.android.ide; java.io; javax.xml; org.w3c.dom; org.xml.sax; | 2,320,518 |
public void setHost(String p_host) throws MalformedURIException
{
if (p_host == null || p_host.trim().length() == 0)
{
m_host = p_host;
m_userinfo = null;
m_port = -1;
}
else if (!isWellFormedAddress(p_host))
{
throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); //"Host is not a well formed address!");
}
m_host = p_host;
} | void function(String p_host) throws MalformedURIException { if (p_host == null p_host.trim().length() == 0) { m_host = p_host; m_userinfo = null; m_port = -1; } else if (!isWellFormedAddress(p_host)) { throw new MalformedURIException(XMLMessages.createXMLMessage(XMLErrorResources.ER_HOST_ADDRESS_NOT_WELLFORMED, null)); } m_host = p_host; } | /**
* Set the host for this URI. If null is passed in, the userinfo
* field is also set to null and the port is set to -1.
*
* @param p_host the host for this URI
*
* @throws MalformedURIException if p_host is not a valid IP
* address or DNS hostname.
*/ | Set the host for this URI. If null is passed in, the userinfo field is also set to null and the port is set to -1 | setHost | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jaxp/src/com/sun/org/apache/xml/internal/utils/URI.java",
"license": "mit",
"size": 47767
} | [
"com.sun.org.apache.xml.internal.res.XMLErrorResources",
"com.sun.org.apache.xml.internal.res.XMLMessages"
] | import com.sun.org.apache.xml.internal.res.XMLErrorResources; import com.sun.org.apache.xml.internal.res.XMLMessages; | import com.sun.org.apache.xml.internal.res.*; | [
"com.sun.org"
] | com.sun.org; | 2,855,966 |
@Override
public Set<String> getWindowHandles() {
return driver.getWindowHandles();
} | Set<String> function() { return driver.getWindowHandles(); } | /**
* Method to return all window handles contained within a given current driver
* @return Set of string window handles
* @see https://selenium.googlecode.com/git/docs/api/java/org/openqa/selenium/WebDriver.html#getWindowHandles--
*/ | Method to return all window handles contained within a given current driver | getWindowHandles | {
"repo_name": "Orasi/Xeeva",
"path": "src/main/java/com/orasi/utils/OrasiDriver.java",
"license": "bsd-3-clause",
"size": 52445
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,061,835 |
return Val.chkStr(_abstract);
}
| return Val.chkStr(_abstract); } | /**
* Gets the abstract.
* @return the abstract (trimmed, never null)
*/ | Gets the abstract | getAbstract | {
"repo_name": "usgin/usgin-geoportal",
"path": "src/com/esri/gpt/catalog/search/SearchResultRecord.java",
"license": "apache-2.0",
"size": 10000
} | [
"com.esri.gpt.framework.util.Val"
] | import com.esri.gpt.framework.util.Val; | import com.esri.gpt.framework.util.*; | [
"com.esri.gpt"
] | com.esri.gpt; | 426,567 |
@Test
public void labelUpdateMessageTest2() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] labelUpdate = new byte[]{0x20, (byte) 0xE2, 0x00, 0x30, // common header
0x21, 0x10, 0x00, 0x0C, // SRP Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
0x20, 0x10, 0x00, 0x08, // LSP Object Header
0x00, 0x01, 0x00, 0x00,
(byte) 0xE1, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x44, 0x00, 0x00,
(byte) 0xE1, 0x10, 0x00, 0x0C, // LABEL Object Header
0x00, 0x00, 0x00, 0x00,
0x00, 0x79, 0x00, 0x00};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(labelUpdate);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
byte[] testLabelUpdateMsg = {0};
assertThat(message, instanceOf(PcepLabelUpdateMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex();
testLabelUpdateMsg = new byte[readLen];
buf.readBytes(testLabelUpdateMsg, 0, readLen);
assertThat(testLabelUpdateMsg, is(labelUpdate));
} | void function() throws PcepParseException, PcepOutOfBoundMessageException { byte[] labelUpdate = new byte[]{0x20, (byte) 0xE2, 0x00, 0x30, 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x20, 0x10, 0x00, 0x08, 0x00, 0x01, 0x00, 0x00, (byte) 0xE1, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, (byte) 0xE1, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x00, 0x00}; ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(labelUpdate); PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); PcepMessage message = null; message = reader.readFrom(buffer); byte[] testLabelUpdateMsg = {0}; assertThat(message, instanceOf(PcepLabelUpdateMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); int readLen = buf.writerIndex(); testLabelUpdateMsg = new byte[readLen]; buf.readBytes(testLabelUpdateMsg, 0, readLen); assertThat(testLabelUpdateMsg, is(labelUpdate)); } | /**
* This test case checks for
* <pce-label-download> SRP, LSP, LABEL Object, LABEL Object.
* in PcepLabelUpdate message.
*/ | This test case checks for SRP, LSP, LABEL Object, LABEL Object. in PcepLabelUpdate message | labelUpdateMessageTest2 | {
"repo_name": "kuujo/onos",
"path": "protocols/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepLabelUpdateMsgTest.java",
"license": "apache-2.0",
"size": 15869
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers",
"org.jboss.netty.buffer.ChannelBuffer",
"org.jboss.netty.buffer.ChannelBuffers",
"org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException",
"org.onosproject.pcepio.exceptions.PcepParseException"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException; import org.onosproject.pcepio.exceptions.PcepParseException; | import org.hamcrest.*; import org.jboss.netty.buffer.*; import org.onosproject.pcepio.exceptions.*; | [
"org.hamcrest",
"org.jboss.netty",
"org.onosproject.pcepio"
] | org.hamcrest; org.jboss.netty; org.onosproject.pcepio; | 803,933 |
public HandlerRegistration addSelectAllHandler(SelectAllHandler<T> handler) {
return addHandler(handler, SelectAllEvent.getType());
} | HandlerRegistration function(SelectAllHandler<T> handler) { return addHandler(handler, SelectAllEvent.getType()); } | /**
* Register a GWT event handler for a select all event. This handler gets
* called whenever Grid needs all rows selected.
*
* @param handler
* a select all event handler
*/ | Register a GWT event handler for a select all event. This handler gets called whenever Grid needs all rows selected | addSelectAllHandler | {
"repo_name": "Peppe/vaadin",
"path": "client/src/com/vaadin/client/widgets/Grid.java",
"license": "apache-2.0",
"size": 306271
} | [
"com.google.gwt.event.shared.HandlerRegistration",
"com.vaadin.client.widget.grid.events.SelectAllEvent",
"com.vaadin.client.widget.grid.events.SelectAllHandler"
] | import com.google.gwt.event.shared.HandlerRegistration; import com.vaadin.client.widget.grid.events.SelectAllEvent; import com.vaadin.client.widget.grid.events.SelectAllHandler; | import com.google.gwt.event.shared.*; import com.vaadin.client.widget.grid.events.*; | [
"com.google.gwt",
"com.vaadin.client"
] | com.google.gwt; com.vaadin.client; | 1,832,315 |
@Override
public OutputWidthExpression visitVarLenReadExpr(VarLenReadExpr varLenReadExpr, OutputWidthVisitorState state)
throws RuntimeException {
String columnName = varLenReadExpr.getName();
if (columnName == null) {
TypedFieldId fieldId = varLenReadExpr.getReadExpression().getTypedFieldId();
columnName = TypedFieldId.getPath(fieldId, state.manager.getIncomingBatch());
}
final RecordBatchSizer.ColumnSize columnSize = state.manager.getColumnSize(columnName);
int columnWidth = columnSize.getNetSizePerEntry();
return new FixedLenExpr(columnWidth);
} | OutputWidthExpression function(VarLenReadExpr varLenReadExpr, OutputWidthVisitorState state) throws RuntimeException { String columnName = varLenReadExpr.getName(); if (columnName == null) { TypedFieldId fieldId = varLenReadExpr.getReadExpression().getTypedFieldId(); columnName = TypedFieldId.getPath(fieldId, state.manager.getIncomingBatch()); } final RecordBatchSizer.ColumnSize columnSize = state.manager.getColumnSize(columnName); int columnWidth = columnSize.getNetSizePerEntry(); return new FixedLenExpr(columnWidth); } | /**
* Converts the {@link VarLenReadExpr} to a {@link FixedLenExpr} by getting the size for the corresponding column
* from the RecordBatchSizer.
* @param varLenReadExpr
* @param state
* @return
* @throws RuntimeException
*/ | Converts the <code>VarLenReadExpr</code> to a <code>FixedLenExpr</code> by getting the size for the corresponding column from the RecordBatchSizer | visitVarLenReadExpr | {
"repo_name": "ppadma/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/OutputWidthVisitor.java",
"license": "apache-2.0",
"size": 12724
} | [
"org.apache.drill.exec.physical.impl.project.OutputWidthExpression",
"org.apache.drill.exec.record.RecordBatchSizer",
"org.apache.drill.exec.record.TypedFieldId"
] | import org.apache.drill.exec.physical.impl.project.OutputWidthExpression; import org.apache.drill.exec.record.RecordBatchSizer; import org.apache.drill.exec.record.TypedFieldId; | import org.apache.drill.exec.physical.impl.project.*; import org.apache.drill.exec.record.*; | [
"org.apache.drill"
] | org.apache.drill; | 1,451,919 |
public void testWithGlobalWalChange() throws Exception {
// Prepare some data.
IgniteEx crd = (IgniteEx) startGrids(3);
crd.cluster().active(true);
final int entryCnt = PARTS_CNT * 10;
{
IgniteCache<Object, Object> cache = crd.cache(CACHE_NAME);
for (int k = 0; k < entryCnt; k++)
cache.put(k, new IndexedObject(k - 1));
}
stopAllGrids();
// Rewrite data with globally disabled WAL.
crd = (IgniteEx) startGrids(2);
crd.cluster().active(true);
crd.cluster().disableWal(CACHE_NAME);
IgniteCache<Object, Object> cache = crd.cache(CACHE_NAME);
int grpId = crd.cachex(CACHE_NAME).context().groupId();
for (int k = 0; k < entryCnt; k++)
cache.put(k, new IndexedObject(k));
crd.cluster().enableWal(CACHE_NAME);
// This node shouldn't rebalance data using WAL, because it was disabled on other nodes.
IgniteEx ignite = startGrid(2);
awaitPartitionMapExchange();
Set<Long> topVers = ((WalRebalanceCheckingCommunicationSpi) ignite.configuration().getCommunicationSpi())
.walRebalanceVersions(grpId);
Assert.assertFalse(topVers.contains(ignite.cluster().topologyVersion()));
stopGrid(2);
// Fix actual state to have start point in WAL to rebalance from.
forceCheckpoint();
// After another rewriting data with enabled WAL, node should rebalance this diff using WAL rebalance.
for (int k = 0; k < entryCnt; k++)
cache.put(k, new IndexedObject(k + 1));
ignite = startGrid(2);
awaitPartitionMapExchange();
topVers = ((WalRebalanceCheckingCommunicationSpi) ignite.configuration().getCommunicationSpi())
.walRebalanceVersions(grpId);
Assert.assertTrue(topVers.contains(ignite.cluster().topologyVersion()));
// Check data consistency.
for (Ignite ig : G.allGrids()) {
IgniteCache<Object, Object> cache1 = ig.cache(CACHE_NAME);
for (int k = 0; k < entryCnt; k++)
assertEquals(new IndexedObject(k + 1), cache1.get(k));
}
}
private static class IndexedObject {
@QuerySqlField(index = true)
private int iVal;
private byte[] payload = new byte[1024];
private IndexedObject(int iVal) {
this.iVal = iVal;
} | void function() throws Exception { IgniteEx crd = (IgniteEx) startGrids(3); crd.cluster().active(true); final int entryCnt = PARTS_CNT * 10; { IgniteCache<Object, Object> cache = crd.cache(CACHE_NAME); for (int k = 0; k < entryCnt; k++) cache.put(k, new IndexedObject(k - 1)); } stopAllGrids(); crd = (IgniteEx) startGrids(2); crd.cluster().active(true); crd.cluster().disableWal(CACHE_NAME); IgniteCache<Object, Object> cache = crd.cache(CACHE_NAME); int grpId = crd.cachex(CACHE_NAME).context().groupId(); for (int k = 0; k < entryCnt; k++) cache.put(k, new IndexedObject(k)); crd.cluster().enableWal(CACHE_NAME); IgniteEx ignite = startGrid(2); awaitPartitionMapExchange(); Set<Long> topVers = ((WalRebalanceCheckingCommunicationSpi) ignite.configuration().getCommunicationSpi()) .walRebalanceVersions(grpId); Assert.assertFalse(topVers.contains(ignite.cluster().topologyVersion())); stopGrid(2); forceCheckpoint(); for (int k = 0; k < entryCnt; k++) cache.put(k, new IndexedObject(k + 1)); ignite = startGrid(2); awaitPartitionMapExchange(); topVers = ((WalRebalanceCheckingCommunicationSpi) ignite.configuration().getCommunicationSpi()) .walRebalanceVersions(grpId); Assert.assertTrue(topVers.contains(ignite.cluster().topologyVersion())); for (Ignite ig : G.allGrids()) { IgniteCache<Object, Object> cache1 = ig.cache(CACHE_NAME); for (int k = 0; k < entryCnt; k++) assertEquals(new IndexedObject(k + 1), cache1.get(k)); } } private static class IndexedObject { @QuerySqlField(index = true) private int iVal; private byte[] payload = new byte[1024]; private IndexedObject(int iVal) { this.iVal = iVal; } | /**
* Test that WAL rebalance is not invoked if there are gaps in WAL history due to global WAL disabling.
*
* @throws Exception If failed.
*/ | Test that WAL rebalance is not invoked if there are gaps in WAL history due to global WAL disabling | testWithGlobalWalChange | {
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalRebalanceTest.java",
"license": "apache-2.0",
"size": 15572
} | [
"java.util.Set",
"org.apache.ignite.Ignite",
"org.apache.ignite.IgniteCache",
"org.apache.ignite.cache.query.annotations.QuerySqlField",
"org.apache.ignite.internal.IgniteEx",
"org.apache.ignite.internal.util.typedef.G",
"org.junit.Assert"
] | import java.util.Set; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; import org.apache.ignite.cache.query.annotations.QuerySqlField; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.util.typedef.G; import org.junit.Assert; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.cache.query.annotations.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.*; import org.junit.*; | [
"java.util",
"org.apache.ignite",
"org.junit"
] | java.util; org.apache.ignite; org.junit; | 136,998 |
@Test
public void testFilterDraftsForUnit() {
RestAssured.sessionId = getAuthSession(DEFAULT_LAKARE);
String utkastId = createUtkast("ts-bas", DEFAULT_PATIENT_PERSONNUMMER);
QueryIntygResponse queryResponse = spec()
.param("savedBy", DEFAULT_LAKARE.getHsaId()).param("enhetsId", DEFAULT_LAKARE.getEnhetId())
.expect().statusCode(200).when().get("api/utkast")
.then().body(matchesJsonSchemaInClasspath("jsonschema/webcert-query-utkast-response-schema.json"))
.body("totalCount", equalTo(1)).extract().response().as(QueryIntygResponse.class);
// The only result should match the utkast we created in the setup
Assert.assertEquals(utkastId, queryResponse.getResults().get(0).getIntygId());
Assert.assertEquals("ts-bas", queryResponse.getResults().get(0).getIntygType());
Assert.assertEquals(formatPersonnummer(DEFAULT_PATIENT_PERSONNUMMER),
queryResponse.getResults().get(0).getPatientId().getPersonnummer());
} | void function() { RestAssured.sessionId = getAuthSession(DEFAULT_LAKARE); String utkastId = createUtkast(STR, DEFAULT_PATIENT_PERSONNUMMER); QueryIntygResponse queryResponse = spec() .param(STR, DEFAULT_LAKARE.getHsaId()).param(STR, DEFAULT_LAKARE.getEnhetId()) .expect().statusCode(200).when().get(STR) .then().body(matchesJsonSchemaInClasspath(STR)) .body(STR, equalTo(1)).extract().response().as(QueryIntygResponse.class); Assert.assertEquals(utkastId, queryResponse.getResults().get(0).getIntygId()); Assert.assertEquals(STR, queryResponse.getResults().get(0).getIntygType()); Assert.assertEquals(formatPersonnummer(DEFAULT_PATIENT_PERSONNUMMER), queryResponse.getResults().get(0).getPatientId().getPersonnummer()); } | /**
* Verify that filtering by enhetId and hsaId returns expected results.
*/ | Verify that filtering by enhetId and hsaId returns expected results | testFilterDraftsForUnit | {
"repo_name": "sklintyg/webcert",
"path": "web/src/test/java/se/inera/intyg/webcert/web/web/controller/integrationtest/api/UtkastApiControllerIT.java",
"license": "gpl-3.0",
"size": 13019
} | [
"io.restassured.RestAssured",
"org.hamcrest.core.IsEqual",
"org.junit.Assert",
"se.inera.intyg.webcert.web.web.controller.api.dto.QueryIntygResponse"
] | import io.restassured.RestAssured; import org.hamcrest.core.IsEqual; import org.junit.Assert; import se.inera.intyg.webcert.web.web.controller.api.dto.QueryIntygResponse; | import io.restassured.*; import org.hamcrest.core.*; import org.junit.*; import se.inera.intyg.webcert.web.web.controller.api.dto.*; | [
"io.restassured",
"org.hamcrest.core",
"org.junit",
"se.inera.intyg"
] | io.restassured; org.hamcrest.core; org.junit; se.inera.intyg; | 2,666,277 |
public Builder numberMap(Map<String, Integer> numberMap) {
this.numberMap = numberMap;
return this;
} | Builder function(Map<String, Integer> numberMap) { this.numberMap = numberMap; return this; } | /**
* Sets the numberMap.
* @param numberMap the new value
* @return this, for chaining, not null
*/ | Sets the numberMap | numberMap | {
"repo_name": "JodaOrg/joda-beans",
"path": "src/test/java/org/joda/beans/sample/MutableListFinalBean.java",
"license": "apache-2.0",
"size": 13367
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,218,934 |
protected void fireEndElem(String name)
throws SAXException
{
if (m_tracer != null)
{
flushMyWriter();
m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDELEMENT,name, (Attributes)null);
}
} | void function(String name) throws SAXException { if (m_tracer != null) { flushMyWriter(); m_tracer.fireGenerateEvent(SerializerTrace.EVENTTYPE_ENDELEMENT,name, (Attributes)null); } } | /**
* To fire off the end element trace event
* @param name Name of element
*/ | To fire off the end element trace event | fireEndElem | {
"repo_name": "wangsongpeng/jdk-src",
"path": "src/main/java/com/sun/org/apache/xml/internal/serializer/SerializerBase.java",
"license": "apache-2.0",
"size": 43712
} | [
"org.xml.sax.Attributes",
"org.xml.sax.SAXException"
] | import org.xml.sax.Attributes; import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 641,760 |
public void assertEquals(String failMessage, Document expectedDOM, XMLObject xmlObject) {
Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject);
if (marshaller == null) {
fail("Unable to locate marshaller for " + xmlObject.getElementQName()
+ " can not perform equality check assertion");
}
try {
Element generatedDOM = marshaller.marshall(xmlObject, parser.newDocument());
if (log.isDebugEnabled()) {
log.debug("Marshalled DOM was " + XMLHelper.nodeToString(generatedDOM));
}
assertXMLEqual(failMessage, expectedDOM, generatedDOM.getOwnerDocument());
} catch (Exception e) {
log.error("Marshalling failed with the following error:", e);
fail("Marshalling failed with the following error: " + e);
}
} | void function(String failMessage, Document expectedDOM, XMLObject xmlObject) { Marshaller marshaller = marshallerFactory.getMarshaller(xmlObject); if (marshaller == null) { fail(STR + xmlObject.getElementQName() + STR); } try { Element generatedDOM = marshaller.marshall(xmlObject, parser.newDocument()); if (log.isDebugEnabled()) { log.debug(STR + XMLHelper.nodeToString(generatedDOM)); } assertXMLEqual(failMessage, expectedDOM, generatedDOM.getOwnerDocument()); } catch (Exception e) { log.error(STR, e); fail(STR + e); } } | /**
* Asserts a given XMLObject is equal to an expected DOM. The XMLObject is marshalled and the resulting DOM object
* is compared against the expected DOM object for equality.
*
* @param failMessage the message to display if the DOMs are not equal
* @param expectedDOM the expected DOM
* @param xmlObject the XMLObject to be marshalled and compared against the expected DOM
*/ | Asserts a given XMLObject is equal to an expected DOM. The XMLObject is marshalled and the resulting DOM object is compared against the expected DOM object for equality | assertEquals | {
"repo_name": "willnorris/java-openxrd",
"path": "src/test/java/org/openxrd/common/BaseTestCase.java",
"license": "apache-2.0",
"size": 6301
} | [
"org.opensaml.xml.XMLObject",
"org.opensaml.xml.io.Marshaller",
"org.opensaml.xml.util.XMLHelper",
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] | import org.opensaml.xml.XMLObject; import org.opensaml.xml.io.Marshaller; import org.opensaml.xml.util.XMLHelper; import org.w3c.dom.Document; import org.w3c.dom.Element; | import org.opensaml.xml.*; import org.opensaml.xml.io.*; import org.opensaml.xml.util.*; import org.w3c.dom.*; | [
"org.opensaml.xml",
"org.w3c.dom"
] | org.opensaml.xml; org.w3c.dom; | 1,666,635 |
public BluetoothLeAdapter getAdapter(); | BluetoothLeAdapter function(); | /**
* Get the bluetooth adapter this advertiser is associated to.
*
* @return BluetoothLeAdapter
*/ | Get the bluetooth adapter this advertiser is associated to | getAdapter | {
"repo_name": "nicolatimeus/kura",
"path": "kura/org.eclipse.kura.api/src/main/java/org/eclipse/kura/bluetooth/le/beacon/BluetoothLeBeaconScanner.java",
"license": "epl-1.0",
"size": 2268
} | [
"org.eclipse.kura.bluetooth.le.BluetoothLeAdapter"
] | import org.eclipse.kura.bluetooth.le.BluetoothLeAdapter; | import org.eclipse.kura.bluetooth.le.*; | [
"org.eclipse.kura"
] | org.eclipse.kura; | 2,270,411 |
public Builder setAlipay(EmptyParam alipay) {
this.alipay = alipay;
return this;
} | Builder function(EmptyParam alipay) { this.alipay = alipay; return this; } | /**
* If this is a {@code alipay} PaymentMethod, this sub-hash contains details about the Alipay
* payment method options.
*/ | If this is a alipay PaymentMethod, this sub-hash contains details about the Alipay payment method options | setAlipay | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/PaymentIntentUpdateParams.java",
"license": "mit",
"size": 323121
} | [
"com.stripe.param.common.EmptyParam"
] | import com.stripe.param.common.EmptyParam; | import com.stripe.param.common.*; | [
"com.stripe.param"
] | com.stripe.param; | 495,743 |
UpdateSettingsRequestBuilder prepareUpdateSettings(String... indices); | UpdateSettingsRequestBuilder prepareUpdateSettings(String... indices); | /**
* Update indices settings.
*/ | Update indices settings | prepareUpdateSettings | {
"repo_name": "strapdata/elassandra-test",
"path": "core/src/main/java/org/elasticsearch/client/IndicesAdminClient.java",
"license": "apache-2.0",
"size": 34405
} | [
"org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder"
] | import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequestBuilder; | import org.elasticsearch.action.admin.indices.settings.put.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 2,741,523 |
@Override
public ExceptionListener getExceptionListener() throws JMSException {
if (ActiveMQRALogger.LOGGER.isTraceEnabled()) {
ActiveMQRALogger.LOGGER.trace("getExceptionListener()");
}
throw new IllegalStateException(ISE);
} | ExceptionListener function() throws JMSException { if (ActiveMQRALogger.LOGGER.isTraceEnabled()) { ActiveMQRALogger.LOGGER.trace(STR); } throw new IllegalStateException(ISE); } | /**
* Get the exception listener -- throws IllegalStateException
*
* @return The exception listener
* @throws JMSException Thrown if an error occurs
*/ | Get the exception listener -- throws IllegalStateException | getExceptionListener | {
"repo_name": "jbertram/activemq-artemis",
"path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java",
"license": "apache-2.0",
"size": 32037
} | [
"javax.jms.ExceptionListener",
"javax.jms.IllegalStateException",
"javax.jms.JMSException"
] | import javax.jms.ExceptionListener; import javax.jms.IllegalStateException; import javax.jms.JMSException; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 2,756,192 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.