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
|
---|---|---|---|---|---|---|---|---|---|---|---|
@Test
public void testMyApplication(TestContext context) {
// This test is asynchronous, so get an async handler to inform the test when we are done.
final Async async = context.async();
// We create a HTTP client and query our application. When we get the response we check it contains the 'Hello'
// message. Then, we call the `complete` method on the async handler to declare this async (and here the test) done.
// Notice that the assertions are made on the 'context' object and are not Junit assert. This ways it manage the
// async aspect of the test the right way.
vertx.createHttpClient().getNow(port, "localhost", "/", response -> {
response.handler(body -> {
context.assertTrue(body.toString().contains("Hello"));
async.complete();
});
});
} | void function(TestContext context) { final Async async = context.async(); vertx.createHttpClient().getNow(port, STR, "/", response -> { response.handler(body -> { context.assertTrue(body.toString().contains("Hello")); async.complete(); }); }); } | /**
* Let's ensure that our application behaves correctly.
*
* @param context the test context
*/ | Let's ensure that our application behaves correctly | testMyApplication | {
"repo_name": "Yufan-l/vertx-playground",
"path": "vertx-java/src/test/java/vertx/playground/java/api/ServerTest.java",
"license": "apache-2.0",
"size": 2764
} | [
"io.vertx.ext.unit.Async",
"io.vertx.ext.unit.TestContext"
] | import io.vertx.ext.unit.Async; import io.vertx.ext.unit.TestContext; | import io.vertx.ext.unit.*; | [
"io.vertx.ext"
] | io.vertx.ext; | 731,562 |
private void addSubregionSerialNumbers(Map map) {
// iterate over all subregions to gather serialNumbers and recurse
for (Object entryObject : subregions.entrySet()) {
Map.Entry entry = (Map.Entry) entryObject;
LocalRegion subregion = (LocalRegion) entry.getValue();
map.put(subregion.getFullPath(), subregion.getSerialNumber());
// recursively call down into each subregion tree
subregion.addSubregionSerialNumbers(map);
}
} | void function(Map map) { for (Object entryObject : subregions.entrySet()) { Map.Entry entry = (Map.Entry) entryObject; LocalRegion subregion = (LocalRegion) entry.getValue(); map.put(subregion.getFullPath(), subregion.getSerialNumber()); subregion.addSubregionSerialNumbers(map); } } | /**
* Iterates over all subregions to put the full path and serial number into the provided map.
*
* @param map the map to put the full path and serial number into for each subregion
*/ | Iterates over all subregions to put the full path and serial number into the provided map | addSubregionSerialNumbers | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/LocalRegion.java",
"license": "apache-2.0",
"size": 395944
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 970,428 |
Map<AvailabilityZone, VmTypes> vmTypesPerAvailabilityZones(Boolean extended); | Map<AvailabilityZone, VmTypes> vmTypesPerAvailabilityZones(Boolean extended); | /**
* Virtual machine types of a platform in availability zones.
*
* @return the {@link AvailabilityZone}, {@link VmTypes} map of a platform
*/ | Virtual machine types of a platform in availability zones | vmTypesPerAvailabilityZones | {
"repo_name": "sequenceiq/cloudbreak",
"path": "cloud-api/src/main/java/com/sequenceiq/cloudbreak/cloud/PlatformParameters.java",
"license": "apache-2.0",
"size": 5929
} | [
"com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone",
"com.sequenceiq.cloudbreak.cloud.model.VmTypes",
"java.util.Map"
] | import com.sequenceiq.cloudbreak.cloud.model.AvailabilityZone; import com.sequenceiq.cloudbreak.cloud.model.VmTypes; import java.util.Map; | import com.sequenceiq.cloudbreak.cloud.model.*; import java.util.*; | [
"com.sequenceiq.cloudbreak",
"java.util"
] | com.sequenceiq.cloudbreak; java.util; | 857,256 |
private void notifyGlobalPropertyDelete(String propertyName) {
for (GlobalPropertyListener listener : eventListeners.getGlobalPropertyListeners()) {
if (listener.supportsPropertyName(propertyName)) {
listener.globalPropertyDeleted(propertyName);
}
}
}
| void function(String propertyName) { for (GlobalPropertyListener listener : eventListeners.getGlobalPropertyListeners()) { if (listener.supportsPropertyName(propertyName)) { listener.globalPropertyDeleted(propertyName); } } } | /**
* Calls global property listeners registered for this delete
*
* @param propertyName
*/ | Calls global property listeners registered for this delete | notifyGlobalPropertyDelete | {
"repo_name": "milankarunarathne/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/impl/AdministrationServiceImpl.java",
"license": "mpl-2.0",
"size": 41300
} | [
"org.openmrs.api.GlobalPropertyListener"
] | import org.openmrs.api.GlobalPropertyListener; | import org.openmrs.api.*; | [
"org.openmrs.api"
] | org.openmrs.api; | 834,885 |
public int NetGetDCName(String serverName, String domainName,
PointerByReference bufptr);
| int function(String serverName, String domainName, PointerByReference bufptr); | /**
* Returns the name of the primary domain controller (PDC).
*
* @param serverName
* Specifies the DNS or NetBIOS name of the remote server on which the function is
* to execute. If this parameter is NULL, the local computer is used.
* @param domainName
* Specifies the name of the domain.
* @param bufptr
* Receives a string that specifies the server name of the PDC of the domain.
* @return
* If the function succeeds, the return value is NERR_Success.
*/ | Returns the name of the primary domain controller (PDC) | NetGetDCName | {
"repo_name": "neo4j/windows-wrapper",
"path": "src/main/java/com/sun/jna/platform/win32/Netapi32.java",
"license": "gpl-3.0",
"size": 20611
} | [
"com.sun.jna.ptr.PointerByReference"
] | import com.sun.jna.ptr.PointerByReference; | import com.sun.jna.ptr.*; | [
"com.sun.jna"
] | com.sun.jna; | 78,275 |
public ResourceSkuRestrictions withValues(List<String> values) {
this.values = values;
return this;
} | ResourceSkuRestrictions function(List<String> values) { this.values = values; return this; } | /**
* Set gets the value of restrictions. If the restriction type is set to
location. This would be different locations where the SKU is restricted.
*
* @param values the values value to set
* @return the ResourceSkuRestrictions object itself.
*/ | Set gets the value of restrictions. If the restriction type is set to | withValues | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/appplatform/mgmt-v2020_07_01/src/main/java/com/microsoft/azure/management/appplatform/v2020_07_01/ResourceSkuRestrictions.java",
"license": "mit",
"size": 3908
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 844,963 |
public long readLong() throws IOException {
return in.readLong();
} | long function() throws IOException { return in.readLong(); } | /**
* Reads the long following a <code>Type.LONG</code> code.
*
* @return the obtained long
* @throws IOException
*/ | Reads the long following a <code>Type.LONG</code> code | readLong | {
"repo_name": "cschenyuan/hive-hack",
"path": "contrib/src/java/org/apache/hadoop/hive/contrib/util/typedbytes/TypedBytesInput.java",
"license": "apache-2.0",
"size": 12164
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,242,086 |
public int doStartTag() throws JspException {
return SKIP_BODY;
} | int function() throws JspException { return SKIP_BODY; } | /**
* Instructs web container to skip the tag's body.
*
* @see javax.servlet.jsp.tagext.Tag#doStartTag()
* @return <code>SKIP_BODY</code>
* @throws JspException to communicate error
*/ | Instructs web container to skip the tag's body | doStartTag | {
"repo_name": "UCSFMemoryAndAging/lava",
"path": "uitags/uitags-main/src/main/java/net/sf/uitags/tag/panel/StickTag.java",
"license": "bsd-2-clause",
"size": 3031
} | [
"javax.servlet.jsp.JspException"
] | import javax.servlet.jsp.JspException; | import javax.servlet.jsp.*; | [
"javax.servlet"
] | javax.servlet; | 244,119 |
protected WaveletDelta maybeTransformSubmittedDelta(WaveletDelta delta)
throws InvalidHashException, OperationException {
HashedVersion targetVersion = delta.getTargetVersion();
HashedVersion currentVersion = getCurrentVersion();
if (targetVersion.equals(currentVersion)) {
// Applied version is the same, we're submitting against head, don't need to do OT
return delta;
} else {
// Not submitting against head, we need to do OT, but check the versions really are different
if (targetVersion.getVersion() == currentVersion.getVersion()) {
LOG.warning("Mismatched hash, expected " + currentVersion + ") but delta targets (" +
targetVersion + ")");
throw new InvalidHashException(currentVersion, targetVersion);
} else {
return transformSubmittedDelta(delta);
}
}
} | WaveletDelta function(WaveletDelta delta) throws InvalidHashException, OperationException { HashedVersion targetVersion = delta.getTargetVersion(); HashedVersion currentVersion = getCurrentVersion(); if (targetVersion.equals(currentVersion)) { return delta; } else { if (targetVersion.getVersion() == currentVersion.getVersion()) { LOG.warning(STR + currentVersion + STR + targetVersion + ")"); throw new InvalidHashException(currentVersion, targetVersion); } else { return transformSubmittedDelta(delta); } } } | /**
* Transform a wavelet delta if it has been submitted against a different head (currentVersion).
* Must be called with write lock held.
*
* @param delta to possibly transform
* @return the transformed delta and the version it was applied at
* (the version is the current version of the wavelet, unless the delta is
* a duplicate in which case it is the version at which it was originally
* applied)
* @throws InvalidHashException if submitting against same version but different hash
* @throws OperationException if transformation fails
*/ | Transform a wavelet delta if it has been submitted against a different head (currentVersion). Must be called with write lock held | maybeTransformSubmittedDelta | {
"repo_name": "somehume/wavefu",
"path": "src/org/waveprotocol/box/server/waveserver/WaveletContainerImpl.java",
"license": "apache-2.0",
"size": 21164
} | [
"org.waveprotocol.wave.model.operation.OperationException",
"org.waveprotocol.wave.model.operation.wave.WaveletDelta",
"org.waveprotocol.wave.model.version.HashedVersion"
] | import org.waveprotocol.wave.model.operation.OperationException; import org.waveprotocol.wave.model.operation.wave.WaveletDelta; import org.waveprotocol.wave.model.version.HashedVersion; | import org.waveprotocol.wave.model.operation.*; import org.waveprotocol.wave.model.operation.wave.*; import org.waveprotocol.wave.model.version.*; | [
"org.waveprotocol.wave"
] | org.waveprotocol.wave; | 81,597 |
private void processGroupSubTotal(LineItemGroup lineItemGroup, LineItemRow parentRow, String cssClass) {
ScaleTwoDecimal total = new ScaleTwoDecimal(0);
if (!lineItemGroup.isCalculateGroupSubTotal()) {
return;
}
for (LineItemObject subLineItem : lineItemGroup.getLineItems()) {
total = total.add(subLineItem.getAmount());
}
LineItemRow row = findRow(parentRow.getChildRows(), parentRow.getId() + "_subTotal");
// Create a new row if a group sub total row is not found
if (row == null) {
row = new LineItemRow(parentRow.getId() + "_subTotal");
row.setLineItemId(parentRow.getId() + "_subTotal");
row.setCssClass(cssClass);
row.getCellContent().add(lineItemGroup.getGroupName() + " Subtotal");
parentRow.getChildRows().add(row);
lineIndex++;
}
// Add the total as value for that row
row.getValues().add(total);
currencyEditor.setValue(total);
row.getCellContent().add(currencyEditor.getAsText());
} | void function(LineItemGroup lineItemGroup, LineItemRow parentRow, String cssClass) { ScaleTwoDecimal total = new ScaleTwoDecimal(0); if (!lineItemGroup.isCalculateGroupSubTotal()) { return; } for (LineItemObject subLineItem : lineItemGroup.getLineItems()) { total = total.add(subLineItem.getAmount()); } LineItemRow row = findRow(parentRow.getChildRows(), parentRow.getId() + STR); if (row == null) { row = new LineItemRow(parentRow.getId() + STR); row.setLineItemId(parentRow.getId() + STR); row.setCssClass(cssClass); row.getCellContent().add(lineItemGroup.getGroupName() + STR); parentRow.getChildRows().add(row); lineIndex++; } row.getValues().add(total); currencyEditor.setValue(total); row.getCellContent().add(currencyEditor.getAsText()); } | /**
* Calculate the sub total for the lineItemGroup passed in.
*
* @param lineItemGroup the group to calculate
* @param parentRow the row to add the subototal row to
* @param cssClass the css class to use for this row
*/ | Calculate the sub total for the lineItemGroup passed in | processGroupSubTotal | {
"repo_name": "sanjupolus/kc-coeus-1508.3",
"path": "coeus-impl/src/main/java/org/kuali/coeus/common/framework/impl/LineItemTable.java",
"license": "agpl-3.0",
"size": 17381
} | [
"org.kuali.coeus.sys.api.model.ScaleTwoDecimal"
] | import org.kuali.coeus.sys.api.model.ScaleTwoDecimal; | import org.kuali.coeus.sys.api.model.*; | [
"org.kuali.coeus"
] | org.kuali.coeus; | 2,581,624 |
public CppLinkActionBuilder addLinkParams(
CcLinkParams linkParams, RuleErrorConsumer errorListener) {
addLinkopts(linkParams.flattenedLinkopts());
addLibraries(linkParams.getLibraries());
ExtraLinkTimeLibraries extraLinkTimeLibraries = linkParams.getExtraLinkTimeLibraries();
if (extraLinkTimeLibraries != null) {
for (ExtraLinkTimeLibrary extraLibrary : extraLinkTimeLibraries.getExtraLibraries()) {
addLibraries(extraLibrary.buildLibraries(ruleContext));
}
}
addLinkstamps(CppHelper.resolveLinkstamps(errorListener, linkParams));
return this;
} | CppLinkActionBuilder function( CcLinkParams linkParams, RuleErrorConsumer errorListener) { addLinkopts(linkParams.flattenedLinkopts()); addLibraries(linkParams.getLibraries()); ExtraLinkTimeLibraries extraLinkTimeLibraries = linkParams.getExtraLinkTimeLibraries(); if (extraLinkTimeLibraries != null) { for (ExtraLinkTimeLibrary extraLibrary : extraLinkTimeLibraries.getExtraLibraries()) { addLibraries(extraLibrary.buildLibraries(ruleContext)); } } addLinkstamps(CppHelper.resolveLinkstamps(errorListener, linkParams)); return this; } | /**
* Merges the given link params into this builder by calling {@link #addLinkopts}, {@link
* #addLibraries}, and {@link #addLinkstamps}.
*/ | Merges the given link params into this builder by calling <code>#addLinkopts</code>, <code>#addLibraries</code>, and <code>#addLinkstamps</code> | addLinkParams | {
"repo_name": "mikelalcon/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppLinkActionBuilder.java",
"license": "apache-2.0",
"size": 35701
} | [
"com.google.devtools.build.lib.packages.RuleErrorConsumer"
] | import com.google.devtools.build.lib.packages.RuleErrorConsumer; | import com.google.devtools.build.lib.packages.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,616,986 |
public void run() {
synchronized (this) {
m_status = RUNNING;
}
if (log().isDebugEnabled())
log().debug("Scheduler.run: scheduler running");
// Loop until a fatal exception occurs or until
// the thread is interrupted.
//
boolean firstPass = true;
for (;;) {
// Status check
//
synchronized (this) {
if (m_status != RUNNING && m_status != PAUSED && m_status != PAUSE_PENDING && m_status != RESUME_PENDING) {
if (log().isDebugEnabled())
log().debug("Scheduler.run: status = " + m_status + ", time to exit");
break;
}
}
// If this is the first pass we want to pause momentarily
// This allows the rest of the background processes to come
// up and stabilize before we start generating events from rescans.
//
if (firstPass) {
firstPass = false;
synchronized (this) {
try {
if (log().isDebugEnabled())
log().debug("Scheduler.run: initial sleep configured for " + m_initialSleep + "ms...sleeping...");
wait(m_initialSleep);
} catch (InterruptedException ex) {
if (log().isDebugEnabled())
log().debug("Scheduler.run: interrupted exception during initial sleep...exiting.");
break; // exit for loop
}
}
}
// iterate over the known node list, add any
// nodes ready for rescan to the rescan queue
// for processing.
//
int added = 0;
synchronized (m_knownNodes) {
if (log().isDebugEnabled())
log().debug("Scheduler.run: iterating over known nodes list to schedule...");
Iterator<NodeInfo> iter = m_knownNodes.iterator();
while (iter.hasNext()) {
NodeInfo node = iter.next();
// Don't schedule if already scheduled
if (node.isScheduled())
continue;
// Don't schedule if its not time for rescan yet
if (!node.timeForRescan())
continue;
// Must be time for a rescan!
//
try {
node.setScheduled(true); // Mark node as scheduled
// Special Case...perform SMB reparenting if nodeid
// of the scheduled node is -1
//
if (node.getNodeId() == SMB_REPARENTING_IDENTIFIER) {
if (log().isDebugEnabled())
log().debug("Scheduler.run: time for reparenting via SMB...");
Connection db = null;
try {
db = DataSourceFactory.getInstance().getConnection();
ReparentViaSmb reparenter = new ReparentViaSmb(db);
try {
reparenter.sync();
} catch (SQLException sqlE) {
log().error("Unexpected database error during SMB reparenting", sqlE);
} catch (Throwable t) {
log().error("Unexpected error during SMB reparenting", t);
}
} catch (SQLException sqlE) {
log().error("Unable to get database connection from the factory.", sqlE);
} finally {
if (db != null) {
try {
db.close();
} catch (Throwable e) {
}
}
}
// Update the schedule information for the SMB
// reparenting node
//
node.setLastScanned(new Date());
node.setScheduled(false);
if (log().isDebugEnabled())
log().debug("Scheduler.run: SMB reparenting completed...");
}
// Otherwise just add the NodeInfo to the queue which will create
// a rescanProcessor and run it
//
else {
if (log().isDebugEnabled())
log().debug("Scheduler.run: adding node " + node.getNodeId() + " to the rescan queue.");
m_rescanQ.execute(node);
added++;
}
} catch (RejectedExecutionException e) {
log().info("Scheduler.schedule: failed to add new node to rescan queue", e);
throw new UndeclaredThrowableException(e);
}
}
}
// Wait for 60 seconds if there were no nodes
// added to the rescan queue during this loop,
// otherwise just start over.
//
synchronized (this) {
if (added == 0) {
try {
wait(60000);
} catch (InterruptedException ex) {
break; // exit for loop
}
}
}
} // end for(;;)
log().debug("Scheduler.run: scheduler exiting, state = STOPPED");
synchronized (this) {
m_status = STOPPED;
}
} // end run | void function() { synchronized (this) { m_status = RUNNING; } if (log().isDebugEnabled()) log().debug(STR); for (;;) { if (m_status != RUNNING && m_status != PAUSED && m_status != PAUSE_PENDING && m_status != RESUME_PENDING) { if (log().isDebugEnabled()) log().debug(STR + m_status + STR); break; } } firstPass = false; synchronized (this) { try { if (log().isDebugEnabled()) log().debug(STR + m_initialSleep + STR); wait(m_initialSleep); } catch (InterruptedException ex) { if (log().isDebugEnabled()) log().debug(STR); break; } } } synchronized (m_knownNodes) { if (log().isDebugEnabled()) log().debug(STR); Iterator<NodeInfo> iter = m_knownNodes.iterator(); while (iter.hasNext()) { NodeInfo node = iter.next(); if (node.isScheduled()) continue; if (!node.timeForRescan()) continue; node.setScheduled(true); if (log().isDebugEnabled()) log().debug(STR); Connection db = null; try { db = DataSourceFactory.getInstance().getConnection(); ReparentViaSmb reparenter = new ReparentViaSmb(db); try { reparenter.sync(); } catch (SQLException sqlE) { log().error(STR, sqlE); } catch (Throwable t) { log().error(STR, t); } } catch (SQLException sqlE) { log().error(STR, sqlE); } finally { if (db != null) { try { db.close(); } catch (Throwable e) { } } } node.setLastScanned(new Date()); node.setScheduled(false); if (log().isDebugEnabled()) log().debug(STR); } if (log().isDebugEnabled()) log().debug(STR + node.getNodeId() + STR); m_rescanQ.execute(node); added++; } } catch (RejectedExecutionException e) { log().info(STR, e); throw new UndeclaredThrowableException(e); } } } if (added == 0) { try { wait(60000); } catch (InterruptedException ex) { break; } } } } log().debug(STR); synchronized (this) { m_status = STOPPED; } } | /**
* The main method of the scheduler. This method is responsible for checking
* the runnable queues for ready objects and then enqueuing them into the
* thread pool for execution.
*/ | The main method of the scheduler. This method is responsible for checking the runnable queues for ready objects and then enqueuing them into the thread pool for execution | run | {
"repo_name": "bugcy013/opennms-tmp-tools",
"path": "opennms-services/src/main/java/org/opennms/netmgt/capsd/Scheduler.java",
"license": "gpl-2.0",
"size": 21993
} | [
"java.lang.reflect.UndeclaredThrowableException",
"java.sql.Connection",
"java.sql.SQLException",
"java.util.Date",
"java.util.Iterator",
"java.util.concurrent.RejectedExecutionException",
"org.opennms.core.db.DataSourceFactory"
] | import java.lang.reflect.UndeclaredThrowableException; import java.sql.Connection; import java.sql.SQLException; import java.util.Date; import java.util.Iterator; import java.util.concurrent.RejectedExecutionException; import org.opennms.core.db.DataSourceFactory; | import java.lang.reflect.*; import java.sql.*; import java.util.*; import java.util.concurrent.*; import org.opennms.core.db.*; | [
"java.lang",
"java.sql",
"java.util",
"org.opennms.core"
] | java.lang; java.sql; java.util; org.opennms.core; | 2,701,519 |
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
{
if( customFlavor != null )
return new java.awt.datatransfer.DataFlavor[]
{ customFlavor,
DATA_FLAVOR,
java.awt.datatransfer.DataFlavor.stringFlavor
}; // end flavors array
else
return new java.awt.datatransfer.DataFlavor[]
{ DATA_FLAVOR,
java.awt.datatransfer.DataFlavor.stringFlavor
}; // end flavors array
} // end getTransferDataFlavors
| java.awt.datatransfer.DataFlavor[] function() { if( customFlavor != null ) return new java.awt.datatransfer.DataFlavor[] { customFlavor, DATA_FLAVOR, java.awt.datatransfer.DataFlavor.stringFlavor }; else return new java.awt.datatransfer.DataFlavor[] { DATA_FLAVOR, java.awt.datatransfer.DataFlavor.stringFlavor }; } | /**
* Returns a two- or three-element array containing first
* the custom data flavor, if one was created in the constructors,
* second the default {@link #DATA_FLAVOR} associated with
* {@link TransferableObject}, and third the
* {@link java.awt.datatransfer.DataFlavor.stringFlavor}.
*
* @return An array of supported data flavors
* @since 1.1
*/ | Returns a two- or three-element array containing first the custom data flavor, if one was created in the constructors, second the default <code>#DATA_FLAVOR</code> associated with <code>TransferableObject</code>, and third the <code>java.awt.datatransfer.DataFlavor.stringFlavor</code> | getTransferDataFlavors | {
"repo_name": "OSUCartography/PyramidShader",
"path": "src/edu/oregonstate/cartography/gui/FileDrop.java",
"license": "gpl-3.0",
"size": 38302
} | [
"java.awt.datatransfer.DataFlavor"
] | import java.awt.datatransfer.DataFlavor; | import java.awt.datatransfer.*; | [
"java.awt"
] | java.awt; | 1,162,561 |
public static String random(int count, int start, int end, boolean letters, boolean numbers, char... chars) {
return random(count, start, end, letters, numbers, chars, RANDOM);
}
/**
* <p>Creates a random string based on a variety of options, using
* supplied source of randomness.</p>
*
* <p>If start and end are both {@code 0}, start and end are set
* to {@code ' '} and {@code 'z'}, the ASCII printable
* characters, will be used, unless letters and numbers are both
* {@code false}, in which case, start and end are set to
* {@code 0} and {@code Integer.MAX_VALUE}.
*
* <p>If set is not {@code null}, characters between start and
* end are chosen.</p>
*
* <p>This method accepts a user-supplied {@link Random} | static String function(int count, int start, int end, boolean letters, boolean numbers, char... chars) { return random(count, start, end, letters, numbers, chars, RANDOM); } /** * <p>Creates a random string based on a variety of options, using * supplied source of randomness.</p> * * <p>If start and end are both {@code 0}, start and end are set * to {@code ' '} and {@code 'z'}, the ASCII printable * characters, will be used, unless letters and numbers are both * {@code false}, in which case, start and end are set to * {@code 0} and {@code Integer.MAX_VALUE}. * * <p>If set is not {@code null}, characters between start and * end are chosen.</p> * * <p>This method accepts a user-supplied {@link Random} | /**
* <p>Creates a random string based on a variety of options, using
* default source of randomness.</p>
*
* <p>This method has exactly the same semantics as
* {@link #random(int,int,int,boolean,boolean,char[],Random)}, but
* instead of using an externally supplied source of randomness, it uses
* the internal static {@link Random} instance.</p>
*
* @param count the length of random string to create
* @param start the position in set of chars to start at
* @param end the position in set of chars to end before
* @param letters only allow letters?
* @param numbers only allow numbers?
* @param chars the set of chars to choose randoms from.
* If {@code null}, then it will use the set of all chars.
* @return the random string
* @throws ArrayIndexOutOfBoundsException if there are not
* {@code (end - start) + 1} characters in the set array.
*/ | Creates a random string based on a variety of options, using default source of randomness. This method has exactly the same semantics as <code>#random(int,int,int,boolean,boolean,char[],Random)</code>, but instead of using an externally supplied source of randomness, it uses the internal static <code>Random</code> instance | random | {
"repo_name": "0x90sled/droidtowers",
"path": "main/source/org/apach3/commons/lang3/RandomStringUtils.java",
"license": "mit",
"size": 12226
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,074,680 |
@Override
public Response getWSDLOfAPI(String apiId, String ifNoneMatch, MessageContext messageContext)
throws APIManagementException {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
String tenantDomain = RestApiCommonUtil.getLoggedInUserTenantDomain();
//this will fail if user does not have access to the API or the API does not exist
//APIIdentifier apiIdentifier = APIMappingUtil.getAPIIdentifierFromUUID(apiId, tenantDomain);
ResourceFile resource = apiProvider.getWSDL(apiId, tenantDomain);
return RestApiUtil.getResponseFromResourceFile(resource.getName(), resource);
} catch (APIManagementException e) {
//Auth failure occurs when cross tenant accessing APIs. Sends 404, since we don't need
// to expose the existence of the resource
if (RestApiUtil.isDueToResourceNotFound(e) || RestApiUtil.isDueToAuthorizationFailure(e)) {
RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_API, apiId, e, log);
} else if (isAuthorizationFailure(e)) {
RestApiUtil
.handleAuthorizationFailure("Authorization failure while retrieving wsdl of API: "
+ apiId, e, log);
} else {
throw e;
}
}
return null;
} | Response function(String apiId, String ifNoneMatch, MessageContext messageContext) throws APIManagementException { try { APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider(); String tenantDomain = RestApiCommonUtil.getLoggedInUserTenantDomain(); ResourceFile resource = apiProvider.getWSDL(apiId, tenantDomain); return RestApiUtil.getResponseFromResourceFile(resource.getName(), resource); } catch (APIManagementException e) { if (RestApiUtil.isDueToResourceNotFound(e) RestApiUtil.isDueToAuthorizationFailure(e)) { RestApiUtil.handleResourceNotFoundError(RestApiConstants.RESOURCE_API, apiId, e, log); } else if (isAuthorizationFailure(e)) { RestApiUtil .handleAuthorizationFailure(STR + apiId, e, log); } else { throw e; } } return null; } | /**
* Retrieve the WSDL of an API
*
* @param apiId UUID of the API
* @param ifNoneMatch If-None-Match header value
* @return the WSDL of the API (can be a file or zip archive)
* @throws APIManagementException when error occurred while trying to retrieve the WSDL
*/ | Retrieve the WSDL of an API | getWSDLOfAPI | {
"repo_name": "uvindra/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher.v1/src/main/java/org/wso2/carbon/apimgt/rest/api/publisher/v1/impl/ApisApiServiceImpl.java",
"license": "apache-2.0",
"size": 274405
} | [
"javax.ws.rs.core.Response",
"org.apache.cxf.jaxrs.ext.MessageContext",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.APIProvider",
"org.wso2.carbon.apimgt.api.model.ResourceFile",
"org.wso2.carbon.apimgt.rest.api.common.RestApiCommonUtil",
"org.wso2.carbon.apimgt.rest.api.common.RestApiConstants",
"org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil"
] | import javax.ws.rs.core.Response; import org.apache.cxf.jaxrs.ext.MessageContext; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.model.ResourceFile; import org.wso2.carbon.apimgt.rest.api.common.RestApiCommonUtil; import org.wso2.carbon.apimgt.rest.api.common.RestApiConstants; import org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil; | import javax.ws.rs.core.*; import org.apache.cxf.jaxrs.ext.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.rest.api.common.*; import org.wso2.carbon.apimgt.rest.api.util.utils.*; | [
"javax.ws",
"org.apache.cxf",
"org.wso2.carbon"
] | javax.ws; org.apache.cxf; org.wso2.carbon; | 198,104 |
public static PlayerShop loadShop(String owner) {
try {
File data = new File("./data/world/shops/player/" + owner + ".dat");
ObjectInputStream in = new ObjectInputStream(new FileInputStream(data));
PlayerShop shop = null;
shop = (PlayerShop) in.readObject();
in.close();
return shop;
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
} | static PlayerShop function(String owner) { try { File data = new File(STR + owner + ".dat"); ObjectInputStream in = new ObjectInputStream(new FileInputStream(data)); PlayerShop shop = null; shop = (PlayerShop) in.readObject(); in.close(); return shop; } catch (Exception ex) { ex.printStackTrace(); } return null; } | /**
* Loads a player shop.
* @param owner The owner of the shop to load.
*/ | Loads a player shop | loadShop | {
"repo_name": "ubjelly/Derithium",
"path": "src/main/java/org/hyperion/rs2/content/shops/PlayerShop.java",
"license": "gpl-2.0",
"size": 2100
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.ObjectInputStream"
] | import java.io.File; import java.io.FileInputStream; import java.io.ObjectInputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,277,596 |
public void testAutoRange2() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.setValue(100.0, "Row 1", "Column 1");
dataset.setValue(200.0, "Row 1", "Column 2");
JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
"Value", dataset, PlotOrientation.VERTICAL, false, false,
false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setAutoRangeIncludesZero(false);
assertEquals(axis.getLowerBound(), 95.0, EPSILON);
assertEquals(axis.getUpperBound(), 205.0, EPSILON);
} | void function() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(100.0, STR, STR); dataset.setValue(200.0, STR, STR); JFreeChart chart = ChartFactory.createLineChart("Test", STR, "Value", dataset, PlotOrientation.VERTICAL, false, false, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis axis = (NumberAxis) plot.getRangeAxis(); axis.setAutoRangeIncludesZero(false); assertEquals(axis.getLowerBound(), 95.0, EPSILON); assertEquals(axis.getUpperBound(), 205.0, EPSILON); } | /**
* A simple test for the auto-range calculation looking at a
* NumberAxis used as the range axis for a CategoryPlot. In this
* case, the 'autoRangeIncludesZero' flag is set to false.
*/ | A simple test for the auto-range calculation looking at a NumberAxis used as the range axis for a CategoryPlot. In this case, the 'autoRangeIncludesZero' flag is set to false | testAutoRange2 | {
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/jfreechart-1.0.5/tests/org/jfree/chart/axis/junit/NumberAxisTests.java",
"license": "gpl-2.0",
"size": 17075
} | [
"junit.framework.Test",
"org.jfree.chart.ChartFactory",
"org.jfree.chart.JFreeChart",
"org.jfree.chart.axis.NumberAxis",
"org.jfree.chart.plot.CategoryPlot",
"org.jfree.chart.plot.PlotOrientation",
"org.jfree.data.category.DefaultCategoryDataset"
] | import junit.framework.Test; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; import org.jfree.chart.axis.NumberAxis; import org.jfree.chart.plot.CategoryPlot; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.DefaultCategoryDataset; | import junit.framework.*; import org.jfree.chart.*; import org.jfree.chart.axis.*; import org.jfree.chart.plot.*; import org.jfree.data.category.*; | [
"junit.framework",
"org.jfree.chart",
"org.jfree.data"
] | junit.framework; org.jfree.chart; org.jfree.data; | 1,995,715 |
private boolean isQueryMethodCandidate(Method method) {
return !method.isBridge() && !method.isDefault() && !Modifier.isStatic(method.getModifiers());
} | boolean function(Method method) { return !method.isBridge() && !method.isDefault() && !Modifier.isStatic(method.getModifiers()); } | /**
* Checks whether the given method is a query method candidate.
*
* @param method
* @return
*/ | Checks whether the given method is a query method candidate | isQueryMethodCandidate | {
"repo_name": "lettuce-io/lettuce-core",
"path": "src/main/java/io/lettuce/core/dynamic/DefaultRedisCommandsMetadata.java",
"license": "apache-2.0",
"size": 5746
} | [
"java.lang.reflect.Method",
"java.lang.reflect.Modifier"
] | import java.lang.reflect.Method; import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,589,469 |
public void completeNonChunked() {
try {
for (InterfaceHttpData data : decoder.getBodyHttpDatas()) {
processHttpData(data);
}
} catch (Exception e) {
getLog().error("Error while completing HTTP chunked POST data", e);
}
} | void function() { try { for (InterfaceHttpData data : decoder.getBodyHttpDatas()) { processHttpData(data); } } catch (Exception e) { getLog().error(STR, e); } } | /**
* Complete processing of the file upload.
*/ | Complete processing of the file upload | completeNonChunked | {
"repo_name": "kmhughes/robotbrains-examples",
"path": "data/cloud/scala/org.robotbrains.data.cloud.timeseries.server/src/main/scala/org/robotbrains/support/web/server/netty/NettyHttpFileUpload.java",
"license": "apache-2.0",
"size": 7735
} | [
"io.netty.handler.codec.http.multipart.InterfaceHttpData"
] | import io.netty.handler.codec.http.multipart.InterfaceHttpData; | import io.netty.handler.codec.http.multipart.*; | [
"io.netty.handler"
] | io.netty.handler; | 2,415,397 |
public InputStream getInputStream() throws IOException {
return this.resource.getInputStream();
} | InputStream function() throws IOException { return this.resource.getInputStream(); } | /**
* Open an {@code java.io.InputStream} for the specified resource,
* typically assuming that there is no specific encoding to use.
* @throws IOException if opening the InputStream failed
* @see #requiresReader()
*/ | Open an java.io.InputStream for the specified resource, typically assuming that there is no specific encoding to use | getInputStream | {
"repo_name": "deathspeeder/class-guard",
"path": "spring-framework-3.2.x/spring-core/src/main/java/org/springframework/core/io/support/EncodedResource.java",
"license": "gpl-2.0",
"size": 4627
} | [
"java.io.IOException",
"java.io.InputStream"
] | import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,481,512 |
@FIXVersion(introduced="4.2", retired="4.3")
@TagNumRef(tagNum=TagNum.UnderlyingMaturityDay)
public Integer getUnderlyingMaturityDay() {
throw new UnsupportedOperationException(getUnsupportedTagMessage());
} | @FIXVersion(introduced="4.2", retired="4.3") @TagNumRef(tagNum=TagNum.UnderlyingMaturityDay) Integer function() { throw new UnsupportedOperationException(getUnsupportedTagMessage()); } | /**
* Message field getter.
* @return field value
*/ | Message field getter | getUnderlyingMaturityDay | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/group/QuoteSetGroup.java",
"license": "gpl-3.0",
"size": 37469
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.TagNum"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum; | import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*; | [
"net.hades.fix"
] | net.hades.fix; | 1,620,304 |
protected void addAnonymousPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_EndPoint_anonymous_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_EndPoint_anonymous_feature", "_UI_EndPoint_type"),
EsbPackage.Literals.END_POINT__ANONYMOUS,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.END_POINT__ANONYMOUS, true, false, false, ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Anonymous feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Anonymous feature. | addAnonymousPropertyDescriptor | {
"repo_name": "chanakaudaya/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EndPointItemProvider.java",
"license": "apache-2.0",
"size": 8667
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; | import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*; | [
"org.eclipse.emf",
"org.wso2.developerstudio"
] | org.eclipse.emf; org.wso2.developerstudio; | 468,233 |
JFrame getShipInputFrame1(); | JFrame getShipInputFrame1(); | /**
* Returns a reference to player 1's input frame.
*
* @return a reference to frame1
*/ | Returns a reference to player 1's input frame | getShipInputFrame1 | {
"repo_name": "daniyar-artykov/battleship",
"path": "src/main/java/kz/kbtu/battleship/BattleshipViewInterface.java",
"license": "apache-2.0",
"size": 5325
} | [
"javax.swing.JFrame"
] | import javax.swing.JFrame; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,830,965 |
public ExtensionId createExtensionId(String id, String version)
{
return new ExtensionId(id, version);
}
// Actions
/**
* Create an {@link InstallRequest} instance based on passed parameters.
*
* @param id the identifier of the extension to install
* @param version the version to install
* @param namespace the (optional) namespace where to install the extension; if {@code null} or empty, the extension
* will be installed in root namespace (globally)
* @return the {@link InstallRequest} | ExtensionId function(String id, String version) { return new ExtensionId(id, version); } /** * Create an {@link InstallRequest} instance based on passed parameters. * * @param id the identifier of the extension to install * @param version the version to install * @param namespace the (optional) namespace where to install the extension; if {@code null} or empty, the extension * will be installed in root namespace (globally) * @return the {@link InstallRequest} | /**
* Create an instance of {@link ExtensionId}.
*
* @param id the id of the extension
* @param version the version of the extension
* @return the {@link ExtensionId} instance
* @since 9.3RC1
*/ | Create an instance of <code>ExtensionId</code> | createExtensionId | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-script/src/main/java/org/xwiki/extension/script/ExtensionManagerScriptService.java",
"license": "lgpl-2.1",
"size": 44384
} | [
"org.xwiki.extension.ExtensionId",
"org.xwiki.extension.job.InstallRequest"
] | import org.xwiki.extension.ExtensionId; import org.xwiki.extension.job.InstallRequest; | import org.xwiki.extension.*; import org.xwiki.extension.job.*; | [
"org.xwiki.extension"
] | org.xwiki.extension; | 2,508,687 |
@Override
public void add(final int index, final Date value) {
final long date = value.getTime();
if (date2 == Long.MIN_VALUE) {
switch (index) {
case 0: {
date2 = date1;
date1 = date;
modCount++;
return;
}
case 1: {
if (date1 == Long.MIN_VALUE) {
break; // Exception will be thrown below.
}
date2 = date;
modCount++;
return;
}
}
}
throw new IndexOutOfBoundsException(Errors.format(Errors.Keys.IndexOutOfBounds_1, index));
} | void function(final int index, final Date value) { final long date = value.getTime(); if (date2 == Long.MIN_VALUE) { switch (index) { case 0: { date2 = date1; date1 = date; modCount++; return; } case 1: { if (date1 == Long.MIN_VALUE) { break; } date2 = date; modCount++; return; } } } throw new IndexOutOfBoundsException(Errors.format(Errors.Keys.IndexOutOfBounds_1, index)); } | /**
* Adds a date at the given position.
* Null values are not allowed.
*/ | Adds a date at the given position. Null values are not allowed | add | {
"repo_name": "Geomatys/sis",
"path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/quality/AbstractElement.java",
"license": "apache-2.0",
"size": 21085
} | [
"java.util.Date",
"org.apache.sis.util.resources.Errors"
] | import java.util.Date; import org.apache.sis.util.resources.Errors; | import java.util.*; import org.apache.sis.util.resources.*; | [
"java.util",
"org.apache.sis"
] | java.util; org.apache.sis; | 1,384,174 |
private void addDeps(Set<JSModule> deps, JSModule m) {
for (JSModule dep : m.getDependencies()) {
deps.add(dep);
addDeps(deps, dep);
}
} | void function(Set<JSModule> deps, JSModule m) { for (JSModule dep : m.getDependencies()) { deps.add(dep); addDeps(deps, dep); } } | /**
* Adds a module's transitive dependencies to a set.
*/ | Adds a module's transitive dependencies to a set | addDeps | {
"repo_name": "bramstein/closure-compiler-inline",
"path": "src/com/google/javascript/jscomp/JSModuleGraph.java",
"license": "apache-2.0",
"size": 15270
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 878,059 |
public void waitForClusterToStop() throws
IOException {
List<Thread> chkDaemonStop = new ArrayList<Thread>();
for (List<AbstractDaemonClient> set : daemons.values()) {
for (AbstractDaemonClient daemon : set) {
DaemonStopThread dmStop = new DaemonStopThread(daemon);
chkDaemonStop.add(dmStop);
dmStop.start();
}
}
for (Thread daemonThread : chkDaemonStop){
try {
daemonThread.join();
} catch(InterruptedException intExp) {
LOG.warn("Interrupted while thread is joining." + intExp.getMessage());
}
}
} | void function() throws IOException { List<Thread> chkDaemonStop = new ArrayList<Thread>(); for (List<AbstractDaemonClient> set : daemons.values()) { for (AbstractDaemonClient daemon : set) { DaemonStopThread dmStop = new DaemonStopThread(daemon); chkDaemonStop.add(dmStop); dmStop.start(); } } for (Thread daemonThread : chkDaemonStop){ try { daemonThread.join(); } catch(InterruptedException intExp) { LOG.warn(STR + intExp.getMessage()); } } } | /**
* It uses to wait until the cluster is stopped.<br/>
* @throws IOException if an I/O error occurs.
*/ | It uses to wait until the cluster is stopped | waitForClusterToStop | {
"repo_name": "YuMatsuzawa/HadoopEclipseProject",
"path": "src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonCluster.java",
"license": "apache-2.0",
"size": 18165
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,839,022 |
private void saveSelectedMessages(Bundle outState) {
long[] selected = new long[mSelected.size()];
int i = 0;
for (Long id : mSelected) {
selected[i++] = id;
}
outState.putLongArray(STATE_SELECTED_MESSAGES, selected);
} | void function(Bundle outState) { long[] selected = new long[mSelected.size()]; int i = 0; for (Long id : mSelected) { selected[i++] = id; } outState.putLongArray(STATE_SELECTED_MESSAGES, selected); } | /**
* Write the unique IDs of selected messages to a {@link Bundle}.
*/ | Write the unique IDs of selected messages to a <code>Bundle</code> | saveSelectedMessages | {
"repo_name": "torte71/k-9",
"path": "k9mail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java",
"license": "bsd-3-clause",
"size": 127649
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 1,964,788 |
protected Socket newSocket() throws IOException {
return (dnConf.socketWriteTimeout > 0) ?
SocketChannel.open().socket() : new Socket();
} | Socket function() throws IOException { return (dnConf.socketWriteTimeout > 0) ? SocketChannel.open().socket() : new Socket(); } | /**
* Creates either NIO or regular depending on socketWriteTimeout.
*/ | Creates either NIO or regular depending on socketWriteTimeout | newSocket | {
"repo_name": "jth/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java",
"license": "apache-2.0",
"size": 120321
} | [
"java.io.IOException",
"java.net.Socket",
"java.nio.channels.SocketChannel"
] | import java.io.IOException; import java.net.Socket; import java.nio.channels.SocketChannel; | import java.io.*; import java.net.*; import java.nio.channels.*; | [
"java.io",
"java.net",
"java.nio"
] | java.io; java.net; java.nio; | 1,337,139 |
public FeatureOfInterest getOrInsertFeatureOfInterest(final String identifier, final String url,
final Session session) {
final FeatureOfInterest feature = getFeatureOfInterest(identifier, session);
if (feature == null) {
throw new RuntimeException("Adding features of interest not supported yet.");
}
return feature;
} | FeatureOfInterest function(final String identifier, final String url, final Session session) { final FeatureOfInterest feature = getFeatureOfInterest(identifier, session); if (feature == null) { throw new RuntimeException(STR); } return feature; } | /**
* Insert and/or get featureOfInterest object for identifier
*
* @param identifier
* FeatureOfInterest identifier
* @param url
* FeatureOfInterest URL, if defined as link
* @param session
* Hibernate session
* @return FeatureOfInterest object
*/ | Insert and/or get featureOfInterest object for identifier | getOrInsertFeatureOfInterest | {
"repo_name": "impulze/newSOS",
"path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/FeatureOfInterestDAO.java",
"license": "gpl-2.0",
"size": 11599
} | [
"org.hibernate.Session",
"org.n52.sos.ds.hibernate.entities.FeatureOfInterest"
] | import org.hibernate.Session; import org.n52.sos.ds.hibernate.entities.FeatureOfInterest; | import org.hibernate.*; import org.n52.sos.ds.hibernate.entities.*; | [
"org.hibernate",
"org.n52.sos"
] | org.hibernate; org.n52.sos; | 1,283,684 |
public View getContent() {
return mViewAbove.getContent();
} | View function() { return mViewAbove.getContent(); } | /**
* Retrieves the current content.
* @return the current content
*/ | Retrieves the current content | getContent | {
"repo_name": "Douvi/FragmentTransactionManager",
"path": "SlidingMenu/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java",
"license": "apache-2.0",
"size": 28865
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,478,435 |
public void put(String name, Data val) {
localMap.put( name, val );
}
| void function(String name, Data val) { localMap.put( name, val ); } | /**
* Adds a new (name, value) pair to the variable map, or replaces an old pair with
* the same name. Several different variable names may refer to the same value.
*
* @param name the variable name for the data value
* @param val the data value object (such as envelope)
*/ | Adds a new (name, value) pair to the variable map, or replaces an old pair with the same name. Several different variable names may refer to the same value | put | {
"repo_name": "dhutchis/systemml",
"path": "src/main/java/org/apache/sysml/runtime/controlprogram/LocalVariableMap.java",
"license": "apache-2.0",
"size": 4451
} | [
"org.apache.sysml.runtime.instructions.cp.Data"
] | import org.apache.sysml.runtime.instructions.cp.Data; | import org.apache.sysml.runtime.instructions.cp.*; | [
"org.apache.sysml"
] | org.apache.sysml; | 733,774 |
JSONObject json = new JSONObject();
for (Field field : getClass().getDeclaredFields()) {
json.put(field.getName(), getValueFromField(field));
}
return json;
}
/**
* Gets the value for the given {@link Field field}, if the {@link Field fields}
* value is another instance of an {@link Evalable evalable} object, the
* {@link #toEvalableString()} method will be called for that object.
*
* @param field The field that the value should be retried from.
* @return The value of the given field, or {@link JSONObject#NULL null} | JSONObject json = new JSONObject(); for (Field field : getClass().getDeclaredFields()) { json.put(field.getName(), getValueFromField(field)); } return json; } /** * Gets the value for the given {@link Field field}, if the {@link Field fields} * value is another instance of an {@link Evalable evalable} object, the * {@link #toEvalableString()} method will be called for that object. * * @param field The field that the value should be retried from. * @return The value of the given field, or {@link JSONObject#NULL null} | /**
* Creates a {@link JSONObject JSON object} out of all the declared fields of the class
* instance, if one of the classes extends from the {@link Evalable Evalable class},
* the {@link #toEvalableString()} method will be called for that object and
* added onto the main {@link JSONObject JSON object}.
*
* @return The {@link JSONObject JSON object} with all the names and values
* of properties for the current class instance.
*/ | Creates a <code>JSONObject JSON object</code> out of all the declared fields of the class instance, if one of the classes extends from the <code>Evalable Evalable class</code>, the <code>#toEvalableString()</code> method will be called for that object and added onto the main <code>JSONObject JSON object</code> | toEvalableString | {
"repo_name": "avaire/orion",
"path": "src/main/java/com/avairebot/contracts/debug/Evalable.java",
"license": "gpl-3.0",
"size": 2851
} | [
"java.lang.reflect.Field",
"org.json.JSONObject"
] | import java.lang.reflect.Field; import org.json.JSONObject; | import java.lang.reflect.*; import org.json.*; | [
"java.lang",
"org.json"
] | java.lang; org.json; | 360,772 |
public void createDataBase() throws IOException{
boolean db_exist = checkDataBase();
if(db_exist){
//do nothing - database already exist
}else{
//By calling this method and empty database will be created into the default system path
//of your application so we are gonna be able to overwrite that database with our database.
this.getReadableDatabase();
try {
//File out_db_path = context.getDir("data", 0); // output folder with result database
//File out_db_file = new File(out_db_path, "enwikt_mean_semrel_sqlite");
File out_db_file = new File(DB_PATH, DB_NAME);
JoinerFiles.joinDatabaseChunks(context, out_db_file);
//copyDataBase();
} catch (IOException e) {
throw new Error("Error copying database");
}
}
}
| void function() throws IOException{ boolean db_exist = checkDataBase(); if(db_exist){ }else{ this.getReadableDatabase(); try { File out_db_file = new File(DB_PATH, DB_NAME); JoinerFiles.joinDatabaseChunks(context, out_db_file); } catch (IOException e) { throw new Error(STR); } } } | /**
* Creates an empty database on the system and rewrites it with your own database.
* */ | Creates an empty database on the system and rewrites it with your own database | createDataBase | {
"repo_name": "componavt/wikokit",
"path": "android/magnetowordik/src/wordik/magneto/db/DataBaseHelper.java",
"license": "apache-2.0",
"size": 4887
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,251,116 |
private void fadeOut() {
if (fadeOutTimer == null) {
fadeOutTimer = new Timer(80, new ActionListener() { | void function() { if (fadeOutTimer == null) { fadeOutTimer = new Timer(80, new ActionListener() { | /**
* Start the timer to fade out the window.
*/ | Start the timer to fade out the window | fadeOut | {
"repo_name": "Javaec/ChattyRus",
"path": "src/chatty/gui/notifications/Notification.java",
"license": "apache-2.0",
"size": 12678
} | [
"java.awt.event.ActionListener",
"javax.swing.Timer"
] | import java.awt.event.ActionListener; import javax.swing.Timer; | import java.awt.event.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,604,845 |
@Override
protected String getScopes() {
return StringUtils.join(new String[]{
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile"
}, " ");
} | String function() { return StringUtils.join(new String[]{ STRhttps: }, " "); } | /**
* List of scopes that we need from google.
*
* @return A static list of scopes.
*/ | List of scopes that we need from google | getScopes | {
"repo_name": "kangaroo-server/kangaroo",
"path": "kangaroo-server-authz/src/main/java/net/krotscheck/kangaroo/authz/common/authenticator/google/GoogleAuthenticator.java",
"license": "apache-2.0",
"size": 4539
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,836,704 |
private void processImport(DetailAST ast) {
final FullIdent name = FullIdent.createFullIdentBelow(ast);
if (!name.getText().endsWith(STAR_IMPORT_SUFFIX)) {
imports.add(name);
}
} | void function(DetailAST ast) { final FullIdent name = FullIdent.createFullIdentBelow(ast); if (!name.getText().endsWith(STAR_IMPORT_SUFFIX)) { imports.add(name); } } | /**
* Collects the details of imports.
* @param ast node containing the import details
*/ | Collects the details of imports | processImport | {
"repo_name": "liscju/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java",
"license": "lgpl-2.1",
"size": 10724
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.FullIdent"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 1,475,744 |
public DropTargetHandler createDropTargetHandler( Component component ); | DropTargetHandler function( Component component ); | /**
* Creates a drop handler for a given component.
* <p>
* The drop handler is returned so that clients may dispose of the handler when they are
* done using it. This is recommended in order to cleanup resources.
*
* @param component The component onto which a drop handler should be installed.
* @return The new drop handler.
*/ | Creates a drop handler for a given component. The drop handler is returned so that clients may dispose of the handler when they are done using it. This is recommended in order to cleanup resources | createDropTargetHandler | {
"repo_name": "NationalSecurityAgency/ghidra",
"path": "Ghidra/Framework/Docking/src/main/java/docking/DropTargetFactory.java",
"license": "apache-2.0",
"size": 1212
} | [
"java.awt.Component"
] | import java.awt.Component; | import java.awt.*; | [
"java.awt"
] | java.awt; | 42,248 |
protected Collection<IAction> generateCreateSiblingActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor));
}
}
return actions;
} | Collection<IAction> function(Collection<?> descriptors, ISelection selection) { Collection<IAction> actions = new ArrayList<IAction>(); if (descriptors != null) { for (Object descriptor : descriptors) { actions.add(new CreateSiblingAction(activeEditorPart, selection, descriptor)); } } return actions; } | /**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateSiblingAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This generates a <code>org.eclipse.emf.edit.ui.action.CreateSiblingAction</code> for each object in <code>descriptors</code>, and returns the collection of these actions. | generateCreateSiblingActions | {
"repo_name": "ObeoNetwork/EAST-ADL-Designer",
"path": "plugins/org.obeonetwork.dsl.eastadl.editor/src/org/obeonetwork/dsl/east_adl/structure/common/presentation/CommonActionBarContributor.java",
"license": "epl-1.0",
"size": 14132
} | [
"java.util.ArrayList",
"java.util.Collection",
"org.eclipse.emf.edit.ui.action.CreateSiblingAction",
"org.eclipse.jface.action.IAction",
"org.eclipse.jface.viewers.ISelection"
] | import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.edit.ui.action.CreateSiblingAction; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; | import java.util.*; import org.eclipse.emf.edit.ui.action.*; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.jface"
] | java.util; org.eclipse.emf; org.eclipse.jface; | 109,653 |
Map<String, ColumnHandle> getColumnHandles(TableHandle tableHandle); | Map<String, ColumnHandle> getColumnHandles(TableHandle tableHandle); | /**
* Gets all of the columns on the specified table, or an empty map if the columns can not be enumerated.
*
* @throws RuntimeException if table handle is no longer valid
*/ | Gets all of the columns on the specified table, or an empty map if the columns can not be enumerated | getColumnHandles | {
"repo_name": "sdgdsffdsfff/presto",
"path": "presto-spi/src/main/java/com/facebook/presto/spi/ConnectorMetadata.java",
"license": "apache-2.0",
"size": 3743
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,626,133 |
private Query readInitialQuery(BinaryRawReaderEx reader) throws IgniteCheckedException {
int typ = reader.readInt();
switch (typ) {
case -1:
return null;
case OP_QRY_SCAN:
return readScanQuery(reader);
case OP_QRY_SQL:
return readSqlQuery(reader);
case OP_QRY_TXT:
return readTextQuery(reader);
case OP_QRY_SQL_FIELDS:
return readFieldsQuery(reader);
}
throw new IgniteCheckedException("Unsupported query type: " + typ);
} | Query function(BinaryRawReaderEx reader) throws IgniteCheckedException { int typ = reader.readInt(); switch (typ) { case -1: return null; case OP_QRY_SCAN: return readScanQuery(reader); case OP_QRY_SQL: return readSqlQuery(reader); case OP_QRY_TXT: return readTextQuery(reader); case OP_QRY_SQL_FIELDS: return readFieldsQuery(reader); } throw new IgniteCheckedException(STR + typ); } | /**
* Reads the query of specified type.
*
* @param reader Binary reader.
* @return Query.
* @throws IgniteCheckedException On error.
*/ | Reads the query of specified type | readInitialQuery | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java",
"license": "apache-2.0",
"size": 57640
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.cache.query.Query",
"org.apache.ignite.internal.binary.BinaryRawReaderEx"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cache.query.Query; import org.apache.ignite.internal.binary.BinaryRawReaderEx; | import org.apache.ignite.*; import org.apache.ignite.cache.query.*; import org.apache.ignite.internal.binary.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,853,325 |
public void setSamplerController(LoopController c) {
c.setContinueForever(false);
setProperty(new TestElementProperty(MAIN_CONTROLLER, c));
}
| void function(LoopController c) { c.setContinueForever(false); setProperty(new TestElementProperty(MAIN_CONTROLLER, c)); } | /**
* Set the sampler controller.
*
* @param c
* the sampler controller.
*/ | Set the sampler controller | setSamplerController | {
"repo_name": "saketh7/Jmeter",
"path": "src/core/org/apache/jmeter/threads/AbstractThreadGroup.java",
"license": "apache-2.0",
"size": 8665
} | [
"org.apache.jmeter.control.LoopController",
"org.apache.jmeter.testelement.property.TestElementProperty"
] | import org.apache.jmeter.control.LoopController; import org.apache.jmeter.testelement.property.TestElementProperty; | import org.apache.jmeter.control.*; import org.apache.jmeter.testelement.property.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 1,496,750 |
public boolean isBlanked() {
String xml = this.toString();
Pattern regexp = Pattern.compile("__+");
Matcher matcher = regexp.matcher(xml);
if (matcher.find()) {
return false;
}
return true;
} | boolean function() { String xml = this.toString(); Pattern regexp = Pattern.compile("__+"); Matcher matcher = regexp.matcher(xml); if (matcher.find()) { return false; } return true; } | /**
* Check whether the data contains any unconverted underscore blanks.
*
* @return true if the data contains any blanks represented by multiple
* underscores instead of a single <blank /> element. False if all
* blanks are represented by a <blank /> element.
*/ | Check whether the data contains any unconverted underscore blanks | isBlanked | {
"repo_name": "martian-a/cards-against-humanity",
"path": "src/main/java/com/kaikoda/cah/Deck.java",
"license": "gpl-3.0",
"size": 13423
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 446,158 |
@SuppressWarnings("unchecked")
public <P extends Policy> void queue(Behaviour behaviour, PolicyDefinition<P> definition, P policyInterface, Method method, Object[] args)
{
// Construct queue context, if required
QueueContext queueContext = (QueueContext)AlfrescoTransactionSupport.getResource(QUEUE_CONTEXT_KEY);
if (queueContext == null)
{
queueContext = new QueueContext();
AlfrescoTransactionSupport.bindResource(QUEUE_CONTEXT_KEY, queueContext);
AlfrescoTransactionSupport.bindListener(this);
}
// Determine if behaviour instance has already been queued
// Identity of ExecutionContext is Behaviour + KEY argument(s)
ExecutionInstanceKey key = new ExecutionInstanceKey(behaviour, definition.getArguments(), args);
ExecutionContext executionContext = queueContext.index.get(key);
if (executionContext == null)
{
// Context does not exist
// Create execution context for behaviour
executionContext = new ExecutionContext<P>();
executionContext.method = method;
executionContext.args = args;
executionContext.policyInterface = policyInterface;
// Defer or execute now?
if (!queueContext.committed)
{
// queue behaviour for deferred execution
queueContext.queue.offer(executionContext);
}
else
{
// execute now
execute(executionContext);
}
queueContext.index.put(key, executionContext);
}
else
{
// Context does already exist
// Update behaviour instance execution context, in particular, argument state that is marked END_TRANSACTION
Arg[] argDefs = definition.getArguments();
for (int i = 0; i < argDefs.length; i++)
{
if (argDefs[i].equals(Arg.END_VALUE))
{
executionContext.args[i] = args[i];
}
}
}
}
| @SuppressWarnings(STR) <P extends Policy> void function(Behaviour behaviour, PolicyDefinition<P> definition, P policyInterface, Method method, Object[] args) { QueueContext queueContext = (QueueContext)AlfrescoTransactionSupport.getResource(QUEUE_CONTEXT_KEY); if (queueContext == null) { queueContext = new QueueContext(); AlfrescoTransactionSupport.bindResource(QUEUE_CONTEXT_KEY, queueContext); AlfrescoTransactionSupport.bindListener(this); } ExecutionInstanceKey key = new ExecutionInstanceKey(behaviour, definition.getArguments(), args); ExecutionContext executionContext = queueContext.index.get(key); if (executionContext == null) { executionContext = new ExecutionContext<P>(); executionContext.method = method; executionContext.args = args; executionContext.policyInterface = policyInterface; if (!queueContext.committed) { queueContext.queue.offer(executionContext); } else { execute(executionContext); } queueContext.index.put(key, executionContext); } else { Arg[] argDefs = definition.getArguments(); for (int i = 0; i < argDefs.length; i++) { if (argDefs[i].equals(Arg.END_VALUE)) { executionContext.args[i] = args[i]; } } } } | /**
* Queue a behaviour for end-of-transaction execution
*
* @param <P> P extends Policy
* @param behaviour Behaviour
* @param definition PolicyDefinition<P>
* @param policyInterface P
* @param method Method
* @param args Object[]
*/ | Queue a behaviour for end-of-transaction execution | queue | {
"repo_name": "Alfresco/alfresco-repository",
"path": "src/main/java/org/alfresco/repo/policy/TransactionBehaviourQueue.java",
"license": "lgpl-3.0",
"size": 10211
} | [
"java.lang.reflect.Method",
"org.alfresco.repo.policy.Policy",
"org.alfresco.repo.transaction.AlfrescoTransactionSupport"
] | import java.lang.reflect.Method; import org.alfresco.repo.policy.Policy; import org.alfresco.repo.transaction.AlfrescoTransactionSupport; | import java.lang.reflect.*; import org.alfresco.repo.policy.*; import org.alfresco.repo.transaction.*; | [
"java.lang",
"org.alfresco.repo"
] | java.lang; org.alfresco.repo; | 1,256,184 |
@Nullable
ModuleComponentResolveMetadata getProcessedMetadata(); | ModuleComponentResolveMetadata getProcessedMetadata(); | /**
* The metadata after being processed by component metadata rules.
* Will be null the first time an entry is read from the filesystem cache during a build invocation.
*/ | The metadata after being processed by component metadata rules. Will be null the first time an entry is read from the filesystem cache during a build invocation | getProcessedMetadata | {
"repo_name": "lsmaira/gradle",
"path": "subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/modulecache/ModuleMetadataCache.java",
"license": "apache-2.0",
"size": 2186
} | [
"org.gradle.internal.component.external.model.ModuleComponentResolveMetadata"
] | import org.gradle.internal.component.external.model.ModuleComponentResolveMetadata; | import org.gradle.internal.component.external.model.*; | [
"org.gradle.internal"
] | org.gradle.internal; | 1,398,264 |
public void setParentAdapterFactory(ComposedAdapterFactory parentAdapterFactory) {
this.parentAdapterFactory = parentAdapterFactory;
} | void function(ComposedAdapterFactory parentAdapterFactory) { this.parentAdapterFactory = parentAdapterFactory; } | /**
* This sets the composed adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This sets the composed adapter factory that contains this factory. | setParentAdapterFactory | {
"repo_name": "OpenSemanticsIO/semiotics-main",
"path": "bundles/io.opensemantics.semiotics.model.assessment.edit/src-gen/io/opensemantics/semiotics/model/assessment/provider/AssessmentItemProviderAdapterFactory.java",
"license": "apache-2.0",
"size": 24848
} | [
"org.eclipse.emf.edit.provider.ComposedAdapterFactory"
] | import org.eclipse.emf.edit.provider.ComposedAdapterFactory; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,865,502 |
FeatureMap getPeople(); | FeatureMap getPeople(); | /**
* Returns the value of the '<em><b>People</b></em>' attribute list.
* The list contents are of type {@link org.eclipse.emf.ecore.util.FeatureMap.Entry}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the value of the '<em>People</em>' attribute list.
* @see org.eclipse.emf.examples.extlibrary.EXTLibraryPackage#getLibrary_People()
* @model dataType="org.eclipse.emf.ecore.EFeatureMapEntry" many="true"
* extendedMetaData="kind='group'"
* @generated
*/ | Returns the value of the 'People' attribute list. The list contents are of type <code>org.eclipse.emf.ecore.util.FeatureMap.Entry</code>. | getPeople | {
"repo_name": "ohaegi/emfshell",
"path": "tests/org.eclipse.emf.examples.library/src/org/eclipse/emf/examples/extlibrary/Library.java",
"license": "epl-1.0",
"size": 7393
} | [
"org.eclipse.emf.ecore.util.FeatureMap"
] | import org.eclipse.emf.ecore.util.FeatureMap; | import org.eclipse.emf.ecore.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 643,746 |
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
} | Builder function(Map<String, Object> map) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.putAll(map); return this; } | /**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original
* map. See {@link TokenCreateParams.Account.Company#extraParams} for the field
* documentation.
*/ | Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>TokenCreateParams.Account.Company#extraParams</code> for the field documentation | putAllExtraParam | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/TokenCreateParams.java",
"license": "mit",
"size": 191322
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 987,470 |
private Class<?>[] resolveClassName(String className) {
if (className.startsWith("[")) {
// If we're looking for an array, then the name is automatically fully qualified.
try {
return new Class<?>[] { Class.forName(className) };
} catch (ClassNotFoundException ex) {
// That's ok, class was not found.
return new Class<?>[0];
} catch (Exception ex) {
ex.printStackTrace();
return new Class<?>[0];
}
}
// Looks like we're looking for an unqualified class name.
// Iterate over each package and try to complete the name.
List<Class<?>> classes = new ArrayList<Class<?>>();
Package[] packages = Package.getPackages();
for (final Package aPackage : packages) {
String fullClassName = aPackage.getName() + "." + className;
try {
Class<?> classForName = Class.forName(fullClassName);
if (Modifier.isPublic(classForName.getModifiers())) {
classes.add(classForName);
}
} catch (ClassNotFoundException ex) {
// That's ok, class was not found.
} catch (NoClassDefFoundError ex) {
// This seems to be thrown when the class does not exist, but a class does exist with different case.
// eg. type in "Gemcutter" (the name of the class is "GemCutter").
// TODO: It would be nice to suggest a correction in this situation.
} catch (Exception ex) {
ex.printStackTrace();
}
}
return classes.toArray(new Class<?>[0]);
}
| Class<?>[] function(String className) { if (className.startsWith("[")) { try { return new Class<?>[] { Class.forName(className) }; } catch (ClassNotFoundException ex) { return new Class<?>[0]; } catch (Exception ex) { ex.printStackTrace(); return new Class<?>[0]; } } List<Class<?>> classes = new ArrayList<Class<?>>(); Package[] packages = Package.getPackages(); for (final Package aPackage : packages) { String fullClassName = aPackage.getName() + "." + className; try { Class<?> classForName = Class.forName(fullClassName); if (Modifier.isPublic(classForName.getModifiers())) { classes.add(classForName); } } catch (ClassNotFoundException ex) { } catch (NoClassDefFoundError ex) { } catch (Exception ex) { ex.printStackTrace(); } } return classes.toArray(new Class<?>[0]); } | /**
* Resolves an unqualified or array class name by returning the classes it resolves to,
* or an empty array if the name cannot be resolved to a class.
* @param className the *unqualified* class name or array class name to resolve
* @return the classes it resolves to or an empty array if no classes can be resolved
*/ | Resolves an unqualified or array class name by returning the classes it resolves to, or an empty array if the name cannot be resolved to a class | resolveClassName | {
"repo_name": "levans/Open-Quark",
"path": "src/Quark_Gems/src/org/openquark/gems/client/generators/JavaGemGenerator.java",
"license": "bsd-3-clause",
"size": 71676
} | [
"java.lang.reflect.Modifier",
"java.util.ArrayList",
"java.util.List"
] | import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 990,410 |
public AutoCompleteTextView getEditText() {
return mEditText;
} | AutoCompleteTextView function() { return mEditText; } | /**
* Returns the {@link EditText} widget that will be shown in the dialog.
*
* @return The {@link EditText} widget that will be shown in the dialog.
*/ | Returns the <code>EditText</code> widget that will be shown in the dialog | getEditText | {
"repo_name": "pdvrieze/ProcessManager",
"path": "PMEditor/src/main/java/nl/adaptivity/android/preference/AutoCompletePreference.java",
"license": "lgpl-3.0",
"size": 8241
} | [
"android.widget.AutoCompleteTextView"
] | import android.widget.AutoCompleteTextView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 930,401 |
public Job getInternalJob() {
delegatedJob.jobInited = true;
return delegatedJob;
} | Job function() { delegatedJob.jobInited = true; return delegatedJob; } | /**
* Be very cautious when using this method as it returns the internal job
* of {@link GiraphJob}. This should only be used for methods that require
* access to the actual {@link Job}, i.e. FileInputFormat#addInputPath().
*
* @return Internal job that will actually be submitted to Hadoop.
*/ | Be very cautious when using this method as it returns the internal job of <code>GiraphJob</code>. This should only be used for methods that require access to the actual <code>Job</code>, i.e. FileInputFormat#addInputPath() | getInternalJob | {
"repo_name": "mmaro/giraph",
"path": "giraph-core/src/main/java/org/apache/giraph/job/GiraphJob.java",
"license": "apache-2.0",
"size": 8497
} | [
"org.apache.hadoop.mapreduce.Job"
] | import org.apache.hadoop.mapreduce.Job; | import org.apache.hadoop.mapreduce.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 873,378 |
protected boolean isColumnIncluded(@NotNull final String column, @NotNull final List<Property<String>> properties)
{
boolean result = false;
for (@Nullable final Property<String> property : properties)
{
if ( (property != null)
&& (column.equalsIgnoreCase(property.getColumnName())))
{
result = true;
break;
}
}
return result;
} | boolean function(@NotNull final String column, @NotNull final List<Property<String>> properties) { boolean result = false; for (@Nullable final Property<String> property : properties) { if ( (property != null) && (column.equalsIgnoreCase(property.getColumnName()))) { result = true; break; } } return result; } | /**
* Checks whether given column is included in the property list.
* @param column the column name.
* @param properties the properties.
* @return {@code true} in such case.
*/ | Checks whether given column is included in the property list | isColumnIncluded | {
"repo_name": "rydnr/queryj-rt",
"path": "queryj-core/src/main/java/org/acmsl/queryj/customsql/handlers/customsqlvalidation/ReportMissingPropertiesHandler.java",
"license": "gpl-2.0",
"size": 7261
} | [
"java.util.List",
"org.acmsl.queryj.customsql.Property",
"org.jetbrains.annotations.NotNull",
"org.jetbrains.annotations.Nullable"
] | import java.util.List; import org.acmsl.queryj.customsql.Property; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.acmsl.queryj.customsql.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.acmsl.queryj",
"org.jetbrains.annotations"
] | java.util; org.acmsl.queryj; org.jetbrains.annotations; | 1,534,833 |
private void registerSingleReport(JsonNode node) {
server.registerPaginatedItem(reportsUri, "reports", node);
} | void function(JsonNode node) { server.registerPaginatedItem(reportsUri, STR, node); } | /**
* Tells the server to return the specified node as the only report node in
* a <tt>reports</tt> array.
*
* @param node the node to return
*/ | Tells the server to return the specified node as the only report node in a reports array | registerSingleReport | {
"repo_name": "BellaDati/belladati-sdk-android",
"path": "test/com/belladati/sdk/impl/ReportsTest.java",
"license": "apache-2.0",
"size": 12480
} | [
"com.fasterxml.jackson.databind.JsonNode"
] | import com.fasterxml.jackson.databind.JsonNode; | import com.fasterxml.jackson.databind.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,048,870 |
private Thread startDisplayUpdater(GraphEnvironmentController graphController) {
if (this.displayUpdater==null) {
this.displayUpdater = new DisplayAgentNotificationThread(this, graphController);
this.displayUpdater.start();
}
return this.displayUpdater;
} | Thread function(GraphEnvironmentController graphController) { if (this.displayUpdater==null) { this.displayUpdater = new DisplayAgentNotificationThread(this, graphController); this.displayUpdater.start(); } return this.displayUpdater; } | /**
* Gets the display updater.
* @see DisplayAgentNotificationThread
* @return the display updater
*/ | Gets the display updater | startDisplayUpdater | {
"repo_name": "EnFlexIT/AgentWorkbench",
"path": "eclipseProjects/org.agentgui/bundles/org.awb.env.networkModel/src/org/awb/env/networkModel/visualisation/DisplayAgentNotificationHandler.java",
"license": "lgpl-2.1",
"size": 16716
} | [
"org.awb.env.networkModel.controller.GraphEnvironmentController"
] | import org.awb.env.networkModel.controller.GraphEnvironmentController; | import org.awb.env.*; | [
"org.awb.env"
] | org.awb.env; | 2,468,459 |
public synchronized boolean setTrust(String address, boolean value) {
if (!BluetoothAdapter.checkBluetoothAddress(address)) {
mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM,
"Need BLUETOOTH_ADMIN permission");
return false;
}
if (!isEnabledInternal()) return false;
return setDevicePropertyBooleanNative(
getObjectPathFromAddress(address), "Trusted", value ? 1 : 0);
} | synchronized boolean function(String address, boolean value) { if (!BluetoothAdapter.checkBluetoothAddress(address)) { mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, STR); return false; } if (!isEnabledInternal()) return false; return setDevicePropertyBooleanNative( getObjectPathFromAddress(address), STR, value ? 1 : 0); } | /**
* Sets the remote device trust state.
*
* @return boolean to indicate operation success or fail
*/ | Sets the remote device trust state | setTrust | {
"repo_name": "aloksinha2001/picuntu-3.0.8-alok",
"path": "RK30_MT5931_MT6622/bt/android/frameworks/base/core/java/android/server/BluetoothService.java",
"license": "gpl-2.0",
"size": 117512
} | [
"android.bluetooth.BluetoothAdapter"
] | import android.bluetooth.BluetoothAdapter; | import android.bluetooth.*; | [
"android.bluetooth"
] | android.bluetooth; | 2,343,955 |
private void createOrJoinChatRoom(String name) {
Utils.logv("create or join chat room " + name);
currentChatRoom = new ChatRoom(name); | void function(String name) { Utils.logv(STR + name); currentChatRoom = new ChatRoom(name); | /**
* Creates a given chat room if it does not exist and joins it
* Works asynchronously.
*/ | Creates a given chat room if it does not exist and joins it Works asynchronously | createOrJoinChatRoom | {
"repo_name": "DerGenaue/TumCampusApp",
"path": "app/src/main/java/de/tum/in/tumcampus/activities/ChatRoomsActivity.java",
"license": "gpl-2.0",
"size": 19104
} | [
"de.tum.in.tumcampus.auxiliary.Utils",
"de.tum.in.tumcampus.models.ChatRoom"
] | import de.tum.in.tumcampus.auxiliary.Utils; import de.tum.in.tumcampus.models.ChatRoom; | import de.tum.in.tumcampus.auxiliary.*; import de.tum.in.tumcampus.models.*; | [
"de.tum.in"
] | de.tum.in; | 546,927 |
public static java.util.List extractPatientNoAlertInfoList(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.PatientNoAlertInfoForTriageVoCollection voCollection)
{
return extractPatientNoAlertInfoList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.PatientNoAlertInfoForTriageVoCollection voCollection) { return extractPatientNoAlertInfoList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.core.clinical.domain.objects.PatientNoAlertInfo list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.core.clinical.domain.objects.PatientNoAlertInfo list from the value object collection | extractPatientNoAlertInfoList | {
"repo_name": "open-health-hub/openmaxims-linux",
"path": "openmaxims_workspace/ValueObjects/src/ims/core/vo/domain/PatientNoAlertInfoForTriageVoAssembler.java",
"license": "agpl-3.0",
"size": 23010
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 253,682 |
@Test
public void testCloning() throws CloneNotSupportedException {
IntervalCategoryItemLabelGenerator g1
= new IntervalCategoryItemLabelGenerator();
IntervalCategoryItemLabelGenerator g2
= (IntervalCategoryItemLabelGenerator) g1.clone();
assertTrue(g1 != g2);
assertTrue(g1.getClass() == g2.getClass());
assertTrue(g1.equals(g2));
} | void function() throws CloneNotSupportedException { IntervalCategoryItemLabelGenerator g1 = new IntervalCategoryItemLabelGenerator(); IntervalCategoryItemLabelGenerator g2 = (IntervalCategoryItemLabelGenerator) g1.clone(); assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); } | /**
* Confirm that cloning works.
*/ | Confirm that cloning works | testCloning | {
"repo_name": "ceabie/jfreechart",
"path": "tests/org/jfree/chart/labels/IntervalCategoryItemLabelGeneratorTest.java",
"license": "lgpl-2.1",
"size": 4800
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,980,263 |
public static String md5Hex(XtextResource resource) {
final IParseResult parseResult = resource.getParseResult();
final INode rootNode = parseResult != null ? parseResult.getRootNode() : null;
final String source = rootNode != null ? rootNode.getText() : null;
if (source == null) {
throw new IllegalStateException("resource does not have a valid parse result: " + resource.getURI());
}
return Hashing.md5().hashString(source, Charsets.UTF_8).toString();
} | static String function(XtextResource resource) { final IParseResult parseResult = resource.getParseResult(); final INode rootNode = parseResult != null ? parseResult.getRootNode() : null; final String source = rootNode != null ? rootNode.getText() : null; if (source == null) { throw new IllegalStateException(STR + resource.getURI()); } return Hashing.md5().hashString(source, Charsets.UTF_8).toString(); } | /**
* Computes an MD5 hash from the given resource's source code (the actual source text), as stored in
* {@link TModule#getAstMD5()}. Will fail with an exception if the given resource does not have a valid
* {@link XtextResource#getParseResult() parse result}, as created by Xtext during parsing.
*/ | Computes an MD5 hash from the given resource's source code (the actual source text), as stored in <code>TModule#getAstMD5()</code>. Will fail with an exception if the given resource does not have a valid <code>XtextResource#getParseResult() parse result</code>, as created by Xtext during parsing | md5Hex | {
"repo_name": "lbeurerkellner/n4js",
"path": "plugins/org.eclipse.n4js.model/src/org/eclipse/n4js/n4JS/N4JSASTUtils.java",
"license": "epl-1.0",
"size": 17105
} | [
"com.google.common.base.Charsets",
"com.google.common.hash.Hashing",
"org.eclipse.xtext.nodemodel.INode",
"org.eclipse.xtext.parser.IParseResult",
"org.eclipse.xtext.resource.XtextResource"
] | import com.google.common.base.Charsets; import com.google.common.hash.Hashing; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.parser.IParseResult; import org.eclipse.xtext.resource.XtextResource; | import com.google.common.base.*; import com.google.common.hash.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.parser.*; import org.eclipse.xtext.resource.*; | [
"com.google.common",
"org.eclipse.xtext"
] | com.google.common; org.eclipse.xtext; | 508,891 |
@Override
protected boolean compare(ReferenceValue value1, ReferenceValue value2) {
if (value1 instanceof Objectref && value2 instanceof Objectref) {
// impossible to have the same object representing the <array>.getclass, so fake here
Objectref o1 = (Objectref) value1;
Objectref o2 = (Objectref) value2;
if (o1.isMirroredMugglIsArray() && o2.isMirroredMugglIsArray()) {
return o1.getMirroredMugglArray().getReferenceValue().getInitializedClass().getClassFile() != o2
.getMirroredMugglArray().getReferenceValue().getInitializedClass().getClassFile();
}
}
if (value1 != value2) return true;
return false;
}
| boolean function(ReferenceValue value1, ReferenceValue value2) { if (value1 instanceof Objectref && value2 instanceof Objectref) { Objectref o1 = (Objectref) value1; Objectref o2 = (Objectref) value2; if (o1.isMirroredMugglIsArray() && o2.isMirroredMugglIsArray()) { return o1.getMirroredMugglArray().getReferenceValue().getInitializedClass().getClassFile() != o2 .getMirroredMugglArray().getReferenceValue().getInitializedClass().getClassFile(); } } if (value1 != value2) return true; return false; } | /**
* Compare two reference values. Return true if the expected condition is met, false otherwise.
*
* @param value1 The first reference value.
* @param value2 The second reference value.
* @return true If the expected condition is met, false otherwise.
*/ | Compare two reference values. Return true if the expected condition is met, false otherwise | compare | {
"repo_name": "wwu-pi/muggl",
"path": "muggl-core/src/de/wwu/muggl/instructions/bytecode/If_acmpne.java",
"license": "gpl-3.0",
"size": 2564
} | [
"de.wwu.muggl.vm.initialization.Objectref",
"de.wwu.muggl.vm.initialization.ReferenceValue"
] | import de.wwu.muggl.vm.initialization.Objectref; import de.wwu.muggl.vm.initialization.ReferenceValue; | import de.wwu.muggl.vm.initialization.*; | [
"de.wwu.muggl"
] | de.wwu.muggl; | 2,712,606 |
public Builder addExternalId(ExternalId extId) {
return addExternalIds(ImmutableSet.of(extId));
} | Builder function(ExternalId extId) { return addExternalIds(ImmutableSet.of(extId)); } | /**
* Adds a new external ID for the account.
*
* <p>The account ID of the external ID must match the account ID of the account that is
* updated.
*
* <p>If an external ID with the same ID already exists the account update will fail with {@link
* DuplicateExternalIdKeyException}.
*
* @param extId external ID that should be added
* @return the builder
*/ | Adds a new external ID for the account. The account ID of the external ID must match the account ID of the account that is updated. If an external ID with the same ID already exists the account update will fail with <code>DuplicateExternalIdKeyException</code> | addExternalId | {
"repo_name": "GerritCodeReview/gerrit",
"path": "java/com/google/gerrit/server/account/AccountDelta.java",
"license": "apache-2.0",
"size": 21143
} | [
"com.google.common.collect.ImmutableSet",
"com.google.gerrit.server.account.externalids.ExternalId"
] | import com.google.common.collect.ImmutableSet; import com.google.gerrit.server.account.externalids.ExternalId; | import com.google.common.collect.*; import com.google.gerrit.server.account.externalids.*; | [
"com.google.common",
"com.google.gerrit"
] | com.google.common; com.google.gerrit; | 1,812,824 |
public RepositoryData getRepositoryData(final String repositoryName) {
Repository repository = repositoriesService.repository(repositoryName);
assert repository != null; // should only be called once we've validated the repository exists
return repository.getRepositoryData();
} | RepositoryData function(final String repositoryName) { Repository repository = repositoriesService.repository(repositoryName); assert repository != null; return repository.getRepositoryData(); } | /**
* Gets the {@link RepositoryData} for the given repository.
*
* @param repositoryName repository name
* @return repository data
*/ | Gets the <code>RepositoryData</code> for the given repository | getRepositoryData | {
"repo_name": "masaruh/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java",
"license": "apache-2.0",
"size": 86289
} | [
"org.elasticsearch.repositories.Repository",
"org.elasticsearch.repositories.RepositoryData"
] | import org.elasticsearch.repositories.Repository; import org.elasticsearch.repositories.RepositoryData; | import org.elasticsearch.repositories.*; | [
"org.elasticsearch.repositories"
] | org.elasticsearch.repositories; | 2,067,678 |
public boolean isSame(StoreFileMetaData md) {
if (checksum == null || md.checksum() == null) {
return false;
}
return length == md.length() && checksum.equals(md.checksum());
}
static final class Fields {
static final XContentBuilderString NAME = new XContentBuilderString("name");
static final XContentBuilderString PHYSICAL_NAME = new XContentBuilderString("physical_name");
static final XContentBuilderString LENGTH = new XContentBuilderString("length");
static final XContentBuilderString CHECKSUM = new XContentBuilderString("checksum");
static final XContentBuilderString PART_SIZE = new XContentBuilderString("part_size");
} | boolean function(StoreFileMetaData md) { if (checksum == null md.checksum() == null) { return false; } return length == md.length() && checksum.equals(md.checksum()); } static final class Fields { static final XContentBuilderString NAME = new XContentBuilderString("name"); static final XContentBuilderString PHYSICAL_NAME = new XContentBuilderString(STR); static final XContentBuilderString LENGTH = new XContentBuilderString(STR); static final XContentBuilderString CHECKSUM = new XContentBuilderString(STR); static final XContentBuilderString PART_SIZE = new XContentBuilderString(STR); } | /**
* Checks if a file in a store is the same file
*
* @param md file in a store
* @return true if file in a store this this file have the same checksum and length
*/ | Checks if a file in a store is the same file | isSame | {
"repo_name": "alexksikes/elasticsearch",
"path": "src/main/java/org/elasticsearch/index/snapshots/blobstore/BlobStoreIndexShardSnapshot.java",
"license": "apache-2.0",
"size": 14108
} | [
"org.elasticsearch.common.xcontent.XContentBuilderString",
"org.elasticsearch.index.store.StoreFileMetaData"
] | import org.elasticsearch.common.xcontent.XContentBuilderString; import org.elasticsearch.index.store.StoreFileMetaData; | import org.elasticsearch.common.xcontent.*; import org.elasticsearch.index.store.*; | [
"org.elasticsearch.common",
"org.elasticsearch.index"
] | org.elasticsearch.common; org.elasticsearch.index; | 2,549,441 |
List<ItemStack> extractItems(CorporeaRequest request); | List<ItemStack> extractItems(CorporeaRequest request); | /**
* Extracts items matching request from the inventory.<br/>
* {@link CorporeaRequest#count} is updated to reflect how many items are
* yet to be extracted.<br/>
* {@link CorporeaRequest#foundItems} and
* {@link CorporeaRequest#extractedItems} are updated to reflect how many
* items were found and extracted.
*
* @param request
* @return List of ItemStacks to be delivered to the destination.
*/ | Extracts items matching request from the inventory. <code>CorporeaRequest#count</code> is updated to reflect how many items are yet to be extracted. <code>CorporeaRequest#foundItems</code> and <code>CorporeaRequest#extractedItems</code> are updated to reflect how many items were found and extracted | extractItems | {
"repo_name": "rolandoislas/PeripheralsPlusPlus",
"path": "src/api/java/vazkii/botania/api/corporea/IWrappedInventory.java",
"license": "gpl-2.0",
"size": 1616
} | [
"java.util.List",
"net.minecraft.item.ItemStack"
] | import java.util.List; import net.minecraft.item.ItemStack; | import java.util.*; import net.minecraft.item.*; | [
"java.util",
"net.minecraft.item"
] | java.util; net.minecraft.item; | 910,231 |
public Set<String> getRequestParameterSet() {
return requestParams.keySet();
} | Set<String> function() { return requestParams.keySet(); } | /**
* Return the form parameter set. This takes care if a multipart form has been used or a normal form.
* <p>
* LiveCycle scope: only within one call of evalFormRequest() !
*
* @return the Set of parameters
*/ | Return the form parameter set. This takes care if a multipart form has been used or a normal form. LiveCycle scope: only within one call of evalFormRequest() | getRequestParameterSet | {
"repo_name": "huihoo/olat",
"path": "OLAT-LMS/src/main/java/org/olat/presentation/framework/core/components/form/flexible/impl/Form.java",
"license": "apache-2.0",
"size": 36248
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,592,304 |
public ProcessGroupStatusSnapshotDTO getProcessGroupStatusSnapshot() {
return processGroupStatusSnapshot;
} | ProcessGroupStatusSnapshotDTO function() { return processGroupStatusSnapshot; } | /**
* The ProcessGroupStatusSnapshotDTO that is being serialized.
*
* @return The ProcessGroupStatusSnapshotDTO object
*/ | The ProcessGroupStatusSnapshotDTO that is being serialized | getProcessGroupStatusSnapshot | {
"repo_name": "jtstorck/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-client-dto/src/main/java/org/apache/nifi/web/api/entity/ProcessGroupStatusSnapshotEntity.java",
"license": "apache-2.0",
"size": 2641
} | [
"org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO"
] | import org.apache.nifi.web.api.dto.status.ProcessGroupStatusSnapshotDTO; | import org.apache.nifi.web.api.dto.status.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 2,175,336 |
EReference getAlignedColumn_RightNodes(); | EReference getAlignedColumn_RightNodes(); | /**
* Returns the meta object for the reference list '{@link guizmo.layout.AlignedColumn#getRightNodes <em>Right Nodes</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Right Nodes</em>'.
* @see guizmo.layout.AlignedColumn#getRightNodes()
* @see #getAlignedColumn()
* @generated
*/ | Returns the meta object for the reference list '<code>guizmo.layout.AlignedColumn#getRightNodes Right Nodes</code>'. | getAlignedColumn_RightNodes | {
"repo_name": "osanchezUM/guizmo",
"path": "src/guizmo/layout/LayoutPackage.java",
"license": "apache-2.0",
"size": 87190
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 629,330 |
@BeforeAll
public static void beforeTests()
{
Graphics.setFactoryGraphic(new FactoryGraphicAwt());
}
| static void function() { Graphics.setFactoryGraphic(new FactoryGraphicAwt()); } | /**
* Prepare tests.
*/ | Prepare tests | beforeTests | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-core-awt/src/test/java/com/b3dgs/lionengine/awt/graphic/GraphicAwtTest.java",
"license": "gpl-3.0",
"size": 1617
} | [
"com.b3dgs.lionengine.graphic.Graphics"
] | import com.b3dgs.lionengine.graphic.Graphics; | import com.b3dgs.lionengine.graphic.*; | [
"com.b3dgs.lionengine"
] | com.b3dgs.lionengine; | 2,638,069 |
@Transactional
public List<Enrollment> findByExternalId(String externalId) {
return enrollmentDataService.findByExternalId(externalId);
} | List<Enrollment> function(String externalId) { return enrollmentDataService.findByExternalId(externalId); } | /**
* Returns the list of enrollments with the given external id.
*
* @param externalId the external id
* @return the list of the enrollments which satisfy the search conditions
*/ | Returns the list of enrollments with the given external id | findByExternalId | {
"repo_name": "wstrzelczyk/modules",
"path": "schedule-tracking/src/main/java/org/motechproject/scheduletracking/repository/AllEnrollments.java",
"license": "bsd-3-clause",
"size": 3468
} | [
"java.util.List",
"org.motechproject.scheduletracking.domain.Enrollment"
] | import java.util.List; import org.motechproject.scheduletracking.domain.Enrollment; | import java.util.*; import org.motechproject.scheduletracking.domain.*; | [
"java.util",
"org.motechproject.scheduletracking"
] | java.util; org.motechproject.scheduletracking; | 210,285 |
private void getImageData()
{
try
{
sagaConnector.getImageData(DataType.IMAGE, 3, new MainThreadCallback<ImageAnnotationData>()
{
@Override
public void onSuccessInMainThread(ImageAnnotationData result) { setData(result); } | void function() { try { sagaConnector.getImageData(DataType.IMAGE, 3, new MainThreadCallback<ImageAnnotationData>() { public void onSuccessInMainThread(ImageAnnotationData result) { setData(result); } | /**
* PRIVATE METHOD : This method gets the image data from the server.
* THIS IS CALLED EVERY TIME THAT UNDO IS PRESSED (As the entire class)
* @return the image data as ImageAnnotationData type.
*/ | PRIVATE METHOD : This method gets the image data from the server. THIS IS CALLED EVERY TIME THAT UNDO IS PRESSED (As the entire class) | getImageData | {
"repo_name": "PetriccaRcc/SillyMonkeySolitaire",
"path": "core/src/it/uniroma1/sms/screen/menuscreen/PurposeMenuScreen.java",
"license": "gpl-3.0",
"size": 12804
} | [
"it.uniroma1.lcl.saga.api.DataType",
"it.uniroma1.lcl.saga.api.ImageAnnotationData",
"it.uniroma1.lcl.saga.api.MainThreadCallback"
] | import it.uniroma1.lcl.saga.api.DataType; import it.uniroma1.lcl.saga.api.ImageAnnotationData; import it.uniroma1.lcl.saga.api.MainThreadCallback; | import it.uniroma1.lcl.saga.api.*; | [
"it.uniroma1.lcl"
] | it.uniroma1.lcl; | 243,417 |
public void setRowSorter(RowSorter<? extends ListModel> sorter) {
RowSorter<? extends ListModel> oldRowSorter = getRowSorter();
this.rowSorter = sorter;
configureSorterProperties();
firePropertyChange("rowSorter", oldRowSorter, sorter);
} | void function(RowSorter<? extends ListModel> sorter) { RowSorter<? extends ListModel> oldRowSorter = getRowSorter(); this.rowSorter = sorter; configureSorterProperties(); firePropertyChange(STR, oldRowSorter, sorter); } | /**
* Sets the <code>RowSorter</code>. <code>RowSorter</code> is used
* to provide sorting and filtering to a <code>JXList</code>.
* <p>
* This method clears the selection and resets any variable row heights.
* <p>
* If the underlying model of the <code>RowSorter</code> differs from
* that of this <code>JXList</code> undefined behavior will result.
*
* @param sorter the <code>RowSorter</code>; <code>null</code> turns
* sorting off
*/ | Sets the <code>RowSorter</code>. <code>RowSorter</code> is used to provide sorting and filtering to a <code>JXList</code>. This method clears the selection and resets any variable row heights. If the underlying model of the <code>RowSorter</code> differs from that of this <code>JXList</code> undefined behavior will result | setRowSorter | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/JXList.java",
"license": "lgpl-2.1",
"size": 57097
} | [
"javax.swing.ListModel",
"javax.swing.RowSorter"
] | import javax.swing.ListModel; import javax.swing.RowSorter; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,696,333 |
Template template = this.getTemplate();
StringWriter writer = new StringWriter();
template.merge(this.getContext(), writer);
writer.close();
return writer.toString();
}
| Template template = this.getTemplate(); StringWriter writer = new StringWriter(); template.merge(this.getContext(), writer); writer.close(); return writer.toString(); } | /**
* Build mail content
* @return the mail content.
* @throws Exception
*/ | Build mail content | buildContent | {
"repo_name": "Sankore/Editeur_Sankore---LENUOS-",
"path": "sources/lenuos/editor/src/com/paraschool/editor/server/mail/VelocityMailContext.java",
"license": "lgpl-3.0",
"size": 2346
} | [
"java.io.StringWriter",
"org.apache.velocity.Template"
] | import java.io.StringWriter; import org.apache.velocity.Template; | import java.io.*; import org.apache.velocity.*; | [
"java.io",
"org.apache.velocity"
] | java.io; org.apache.velocity; | 651,885 |
public void removeElements(String xpathExpression)
{
int[] nodes = XPath.getMatchingNodes(xpathExpression, new XPathMetaInfo(), rootNode);
for (int node : nodes)
{
Node.delete(node);
}
}
| void function(String xpathExpression) { int[] nodes = XPath.getMatchingNodes(xpathExpression, new XPathMetaInfo(), rootNode); for (int node : nodes) { Node.delete(node); } } | /**
* Remove nodes as found per the given xpathExpression
*
* @param xpathExpression
*/ | Remove nodes as found per the given xpathExpression | removeElements | {
"repo_name": "kekema/cordysuseradmin",
"path": "src/cws/UserAdmin/com-cordys-coe/useradmin/java/source/com/cordys/coe/tools/useradmin/util/NestedXMLObject.java",
"license": "apache-2.0",
"size": 4946
} | [
"com.eibus.xml.nom.Node",
"com.eibus.xml.xpath.XPath",
"com.eibus.xml.xpath.XPathMetaInfo"
] | import com.eibus.xml.nom.Node; import com.eibus.xml.xpath.XPath; import com.eibus.xml.xpath.XPathMetaInfo; | import com.eibus.xml.nom.*; import com.eibus.xml.xpath.*; | [
"com.eibus.xml"
] | com.eibus.xml; | 2,711,074 |
@Override
public Map<JobId, TaskStatus> getTaskStatuses() {
final Map<JobId, TaskStatus> statuses = Maps.newHashMap();
for (Map.Entry<String, byte[]> entry : this.taskStatuses.entrySet()) {
try {
final JobId id = JobId.fromString(entry.getKey());
final TaskStatus status = Json.read(entry.getValue(), TaskStatus.class);
statuses.put(id, status);
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
return statuses;
} | Map<JobId, TaskStatus> function() { final Map<JobId, TaskStatus> statuses = Maps.newHashMap(); for (Map.Entry<String, byte[]> entry : this.taskStatuses.entrySet()) { try { final JobId id = JobId.fromString(entry.getKey()); final TaskStatus status = Json.read(entry.getValue(), TaskStatus.class); statuses.put(id, status); } catch (IOException e) { throw Throwables.propagate(e); } } return statuses; } | /**
* Returns the {@link TaskStatus}es for all tasks assigned to the current agent.
*/ | Returns the <code>TaskStatus</code>es for all tasks assigned to the current agent | getTaskStatuses | {
"repo_name": "dflemstr/helios",
"path": "helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java",
"license": "apache-2.0",
"size": 8737
} | [
"com.google.common.base.Throwables",
"com.google.common.collect.Maps",
"com.spotify.helios.common.Json",
"com.spotify.helios.common.descriptors.JobId",
"com.spotify.helios.common.descriptors.TaskStatus",
"java.io.IOException",
"java.util.Map"
] | import com.google.common.base.Throwables; import com.google.common.collect.Maps; import com.spotify.helios.common.Json; import com.spotify.helios.common.descriptors.JobId; import com.spotify.helios.common.descriptors.TaskStatus; import java.io.IOException; import java.util.Map; | import com.google.common.base.*; import com.google.common.collect.*; import com.spotify.helios.common.*; import com.spotify.helios.common.descriptors.*; import java.io.*; import java.util.*; | [
"com.google.common",
"com.spotify.helios",
"java.io",
"java.util"
] | com.google.common; com.spotify.helios; java.io; java.util; | 72,437 |
public static ext1Type fromPerUnaligned(byte[] encodedBytes) {
ext1Type result = new ext1Type();
result.decodePerUnaligned(new BitStreamReader(encodedBytes));
return result;
} | static ext1Type function(byte[] encodedBytes) { ext1Type result = new ext1Type(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new ext1Type from encoded stream.
*/ | Creates a new ext1Type from encoded stream | fromPerUnaligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/lpp/RequestLocationInformation_r9_IEs.java",
"license": "apache-2.0",
"size": 28329
} | [
"com.google.location.suplclient.asn1.base.BitStreamReader"
] | import com.google.location.suplclient.asn1.base.BitStreamReader; | import com.google.location.suplclient.asn1.base.*; | [
"com.google.location"
] | com.google.location; | 1,892,493 |
List<TRoleBean> loadVisible();
| List<TRoleBean> loadVisible(); | /**
* Loads all visible RoleBeans
* @return
*/ | Loads all visible RoleBeans | loadVisible | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/dao/RoleDAO.java",
"license": "gpl-3.0",
"size": 3074
} | [
"com.aurel.track.beans.TRoleBean",
"java.util.List"
] | import com.aurel.track.beans.TRoleBean; import java.util.List; | import com.aurel.track.beans.*; import java.util.*; | [
"com.aurel.track",
"java.util"
] | com.aurel.track; java.util; | 2,743,009 |
public void processChange(Database currentModel,
CreationParameters params,
RemovePrimaryKeyChange change) throws IOException
{
Table changedTable = findChangedTable(currentModel, change);
((MSSqlBuilder)getSqlBuilder()).dropPrimaryKey(changedTable);
change.apply(currentModel, isDelimitedIdentifierModeOn());
}
| void function(Database currentModel, CreationParameters params, RemovePrimaryKeyChange change) throws IOException { Table changedTable = findChangedTable(currentModel, change); ((MSSqlBuilder)getSqlBuilder()).dropPrimaryKey(changedTable); change.apply(currentModel, isDelimitedIdentifierModeOn()); } | /**
* Processes the removal of a primary key from a table.
*
* @param currentModel The current database schema
* @param params The parameters used in the creation of new tables. Note that for existing
* tables, the parameters won't be applied
* @param change The change object
*/ | Processes the removal of a primary key from a table | processChange | {
"repo_name": "9ci/ddlutils",
"path": "src/main/java/org/apache/ddlutils/platform/mssql/MSSqlPlatform.java",
"license": "apache-2.0",
"size": 14670
} | [
"java.io.IOException",
"org.apache.ddlutils.alteration.RemovePrimaryKeyChange",
"org.apache.ddlutils.model.Database",
"org.apache.ddlutils.model.Table",
"org.apache.ddlutils.platform.CreationParameters"
] | import java.io.IOException; import org.apache.ddlutils.alteration.RemovePrimaryKeyChange; import org.apache.ddlutils.model.Database; import org.apache.ddlutils.model.Table; import org.apache.ddlutils.platform.CreationParameters; | import java.io.*; import org.apache.ddlutils.alteration.*; import org.apache.ddlutils.model.*; import org.apache.ddlutils.platform.*; | [
"java.io",
"org.apache.ddlutils"
] | java.io; org.apache.ddlutils; | 2,306,553 |
public ArrayList<Integer> getRanges() {
return this.ranges;
} | ArrayList<Integer> function() { return this.ranges; } | /**
* Get values range.
* @return int array
*/ | Get values range | getRanges | {
"repo_name": "maximignashov/mignashov",
"path": "chapter_002/src/main/java/ru/job4j/tracker/start/MenuTracker.java",
"license": "apache-2.0",
"size": 9389
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,568,785 |
public Component getControlComponent() {
return controlComponent;
} | Component function() { return controlComponent; } | /**
* Return the control component.
*
* @return java.awt.Component
*/ | Return the control component | getControlComponent | {
"repo_name": "champtar/fmj-sourceforge-mirror",
"path": "src.examples.ejmf/ejmf/toolkit/controls/TimeDisplayControl.java",
"license": "lgpl-2.1",
"size": 6692
} | [
"java.awt.Component"
] | import java.awt.Component; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,561,729 |
public static void saveBitmap(final Bitmap bitmap, final String filename) {
final String root =
Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "tensorflow";
final File myDir = new File(root);
if (!myDir.mkdirs()) {
Log.i("IMAGE_UTILS", "Make dir failed");
}
final String fname = filename;
final File file = new File(myDir, fname);
if (file.exists()) {
file.delete();
}
try {
final FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 99, out);
out.flush();
out.close();
} catch (final Exception e) {
Log.e("Exception!", e.toString());
}
}
// This value is 2 ^ 18 - 1, and is used to clamp the RGB values before their ranges
// are normalized to eight bits.
static final int kMaxChannelValue = 262143;
// Always prefer the native implementation if available.
private static boolean useNativeConversion = true; | static void function(final Bitmap bitmap, final String filename) { final String root = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + STR; final File myDir = new File(root); if (!myDir.mkdirs()) { Log.i(STR, STR); } final String fname = filename; final File file = new File(myDir, fname); if (file.exists()) { file.delete(); } try { final FileOutputStream out = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.PNG, 99, out); out.flush(); out.close(); } catch (final Exception e) { Log.e(STR, e.toString()); } } static final int kMaxChannelValue = 262143; private static boolean useNativeConversion = true; | /**
* Saves a Bitmap object to disk for analysis.
*
* @param bitmap The bitmap to save.
* @param filename The location to save the bitmap to.
*/ | Saves a Bitmap object to disk for analysis | saveBitmap | {
"repo_name": "GoogleCloudPlatform/next18-ai-in-motion",
"path": "Human_Freeze_Tag/app/src/main/java/com/example/freeze_tag/object_detection/env/ImageUtils.java",
"license": "apache-2.0",
"size": 11505
} | [
"android.graphics.Bitmap",
"android.os.Environment",
"android.util.Log",
"java.io.File",
"java.io.FileOutputStream"
] | import android.graphics.Bitmap; import android.os.Environment; import android.util.Log; import java.io.File; import java.io.FileOutputStream; | import android.graphics.*; import android.os.*; import android.util.*; import java.io.*; | [
"android.graphics",
"android.os",
"android.util",
"java.io"
] | android.graphics; android.os; android.util; java.io; | 476,355 |
public static <E> List<E> getBackupList(HazelcastInstance backupInstance, String listName) {
NodeEngineImpl nodeEngine = getNodeEngineImpl(backupInstance);
CollectionService service = nodeEngine.getService(ListService.SERVICE_NAME);
CollectionContainer collectionContainer = service.getContainerMap().get(listName);
if (collectionContainer == null) {
return emptyList();
}
// the replica items are retrieved via `getMap()`, the primary items via `getCollection()`
Map<Long, CollectionItem> map = collectionContainer.getMap();
List<E> backupList = new ArrayList<E>(map.size());
SerializationService serializationService = nodeEngine.getSerializationService();
for (CollectionItem collectionItem : map.values()) {
E value = serializationService.toObject(collectionItem.getValue());
backupList.add(value);
}
return backupList;
} | static <E> List<E> function(HazelcastInstance backupInstance, String listName) { NodeEngineImpl nodeEngine = getNodeEngineImpl(backupInstance); CollectionService service = nodeEngine.getService(ListService.SERVICE_NAME); CollectionContainer collectionContainer = service.getContainerMap().get(listName); if (collectionContainer == null) { return emptyList(); } Map<Long, CollectionItem> map = collectionContainer.getMap(); List<E> backupList = new ArrayList<E>(map.size()); SerializationService serializationService = nodeEngine.getSerializationService(); for (CollectionItem collectionItem : map.values()) { E value = serializationService.toObject(collectionItem.getValue()); backupList.add(value); } return backupList; } | /**
* Returns all backup items of an {@link IList} by a given list name.
* <p>
* Note: You have to provide the {@link HazelcastInstance} you want to retrieve the backups from.
* Use {@link getBackupInstance} to retrieve the backup instance for a given replica index.
*
* @param backupInstance the {@link HazelcastInstance} to retrieve the backups from
* @param listName the list name
* @return a {@link List} with the backup items
*/ | Returns all backup items of an <code>IList</code> by a given list name. Note: You have to provide the <code>HazelcastInstance</code> you want to retrieve the backups from. Use <code>getBackupInstance</code> to retrieve the backup instance for a given replica index | getBackupList | {
"repo_name": "emre-aydin/hazelcast",
"path": "hazelcast/src/test/java/com/hazelcast/collection/impl/CollectionTestUtil.java",
"license": "apache-2.0",
"size": 8080
} | [
"com.hazelcast.collection.impl.collection.CollectionContainer",
"com.hazelcast.collection.impl.collection.CollectionItem",
"com.hazelcast.collection.impl.collection.CollectionService",
"com.hazelcast.collection.impl.list.ListService",
"com.hazelcast.core.HazelcastInstance",
"com.hazelcast.internal.serialization.SerializationService",
"com.hazelcast.spi.impl.NodeEngineImpl",
"com.hazelcast.test.Accessors",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.Map"
] | import com.hazelcast.collection.impl.collection.CollectionContainer; import com.hazelcast.collection.impl.collection.CollectionItem; import com.hazelcast.collection.impl.collection.CollectionService; import com.hazelcast.collection.impl.list.ListService; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.internal.serialization.SerializationService; import com.hazelcast.spi.impl.NodeEngineImpl; import com.hazelcast.test.Accessors; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; | import com.hazelcast.collection.impl.collection.*; import com.hazelcast.collection.impl.list.*; import com.hazelcast.core.*; import com.hazelcast.internal.serialization.*; import com.hazelcast.spi.impl.*; import com.hazelcast.test.*; import java.util.*; | [
"com.hazelcast.collection",
"com.hazelcast.core",
"com.hazelcast.internal",
"com.hazelcast.spi",
"com.hazelcast.test",
"java.util"
] | com.hazelcast.collection; com.hazelcast.core; com.hazelcast.internal; com.hazelcast.spi; com.hazelcast.test; java.util; | 61,293 |
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void showProgress(final boolean show) {
mLoginFormView.setEnabled(!show); | @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) void function(final boolean show) { mLoginFormView.setEnabled(!show); | /**
* Shows the progress UI and hides the login form.
*/ | Shows the progress UI and hides the login form | showProgress | {
"repo_name": "rtgarg1991/Android",
"path": "Cashon/app/src/main/java/net/fireballlabs/cashguru/LoginActivity.java",
"license": "gpl-2.0",
"size": 9171
} | [
"android.annotation.TargetApi",
"android.os.Build"
] | import android.annotation.TargetApi; import android.os.Build; | import android.annotation.*; import android.os.*; | [
"android.annotation",
"android.os"
] | android.annotation; android.os; | 1,350,988 |
public void testManyToOne() throws Exception {
SynonymMap.Builder b = new SynonymMap.Builder(true);
add(b, "a b c", "z", true);
Analyzer a = getAnalyzer(b, true);
assertAnalyzesTo(a, "a b c d", new String[]{"z", "a", "b", "c", "d"}, new int[]{0, 0, 2, 4, 6}, new int[]{5, 1, 3, 5, 7}, new
String[]{"SYNONYM", "word", "word", "word", "word"}, new int[]{1, 0, 1, 1, 1}, new int[]{3, 1, 1, 1, 1});
a.close();
} | void function() throws Exception { SynonymMap.Builder b = new SynonymMap.Builder(true); add(b, STR, "z", true); Analyzer a = getAnalyzer(b, true); assertAnalyzesTo(a, STR, new String[]{"z", "a", "b", "c", "d"}, new int[]{0, 0, 2, 4, 6}, new int[]{5, 1, 3, 5, 7}, new String[]{STR, "word", "word", "word", "word"}, new int[]{1, 0, 1, 1, 1}, new int[]{3, 1, 1, 1, 1}); a.close(); } | /**
* Multiple input tokens map to a single output token
*/ | Multiple input tokens map to a single output token | testManyToOne | {
"repo_name": "henakamaMSFT/elasticsearch",
"path": "core/src/test/java/org/apache/lucene/analysis/synonym/SynonymGraphFilterTests.java",
"license": "apache-2.0",
"size": 43553
} | [
"org.apache.lucene.analysis.Analyzer"
] | import org.apache.lucene.analysis.Analyzer; | import org.apache.lucene.analysis.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 1,333,966 |
void updateStats(Job job, long doStart, long origStartAfter, long duration) {
if (_context.router() == null) return;
String key = job.getName();
long lag = doStart - origStartAfter; // how long were we ready and waiting?
MessageHistory hist = _context.messageHistory();
long uptime = _context.router().getUptime();
if (lag < 0) lag = 0;
if (duration < 0) duration = 0;
JobStats stats = _jobStats.get(key);
if (stats == null) {
stats = new JobStats(key);
_jobStats.put(key, stats);
// yes, if two runners finish the same job at the same time, this could
// create an extra object. but, who cares, its pushed out of the map
// immediately anyway.
}
stats.jobRan(duration, lag);
String dieMsg = null;
if (lag > _lagWarning) {
dieMsg = "Lag too long for job " + job.getName() + " [" + lag + "ms and a run time of " + duration + "ms]";
} else if (duration > _runWarning) {
dieMsg = "Job run too long for job " + job.getName() + " [" + lag + "ms lag and run time of " + duration + "ms]";
}
if (dieMsg != null) {
if (_log.shouldLog(Log.WARN))
_log.warn(dieMsg);
if (hist != null)
hist.messageProcessingError(-1, JobQueue.class.getName(), dieMsg);
}
if ( (lag > _lagFatal) && (uptime > _warmupTime) ) {
// this is fscking bad - the network at this size shouldn't have this much real contention
// so we're going to DIE DIE DIE
if (_log.shouldLog(Log.WARN))
_log.log(Log.WARN, "The router is either incredibly overloaded or (more likely) there's an error.", new Exception("ttttooooo mmmuuuccccchhhh llllaaagggg"));
//try { Thread.sleep(5000); } catch (InterruptedException ie) {}
//Router.getInstance().shutdown();
return;
}
if ( (uptime > _warmupTime) && (duration > _runFatal) ) {
// slow CPUs can get hosed with ElGamal, but 10s is too much.
if (_log.shouldLog(Log.WARN))
_log.log(Log.WARN, "The router is incredibly overloaded - either you have a 386, or (more likely) there's an error. ", new Exception("ttttooooo sssllloooowww"));
//try { Thread.sleep(5000); } catch (InterruptedException ie) {}
//Router.getInstance().shutdown();
return;
}
}
private static final int POISON_ID = -99999;
private static class PoisonJob implements Job {
public String getName() { return null; } | void updateStats(Job job, long doStart, long origStartAfter, long duration) { if (_context.router() == null) return; String key = job.getName(); long lag = doStart - origStartAfter; MessageHistory hist = _context.messageHistory(); long uptime = _context.router().getUptime(); if (lag < 0) lag = 0; if (duration < 0) duration = 0; JobStats stats = _jobStats.get(key); if (stats == null) { stats = new JobStats(key); _jobStats.put(key, stats); } stats.jobRan(duration, lag); String dieMsg = null; if (lag > _lagWarning) { dieMsg = STR + job.getName() + STR + lag + STR + duration + "ms]"; } else if (duration > _runWarning) { dieMsg = STR + job.getName() + STR + lag + STR + duration + "ms]"; } if (dieMsg != null) { if (_log.shouldLog(Log.WARN)) _log.warn(dieMsg); if (hist != null) hist.messageProcessingError(-1, JobQueue.class.getName(), dieMsg); } if ( (lag > _lagFatal) && (uptime > _warmupTime) ) { if (_log.shouldLog(Log.WARN)) _log.log(Log.WARN, STR, new Exception(STR)); return; } if ( (uptime > _warmupTime) && (duration > _runFatal) ) { if (_log.shouldLog(Log.WARN)) _log.log(Log.WARN, STR, new Exception(STR)); return; } } private static final int POISON_ID = -99999; private static class PoisonJob implements Job { public String getName() { return null; } | /**
* calculate and update the job timings
* if it was lagged too much or took too long to run, spit out
* a warning (and if its really excessive, kill the router)
*/ | calculate and update the job timings if it was lagged too much or took too long to run, spit out a warning (and if its really excessive, kill the router) | updateStats | {
"repo_name": "oakes/Nightweb",
"path": "common/java/router/net/i2p/router/JobQueue.java",
"license": "unlicense",
"size": 30413
} | [
"net.i2p.util.Log"
] | import net.i2p.util.Log; | import net.i2p.util.*; | [
"net.i2p.util"
] | net.i2p.util; | 318,696 |
protected Tc getColumnOfRow(Tr row, int index) {
int i = 0;
for (Object rowContent : row.getContent()) {
if (rowContent instanceof JAXBElement<?>
&& ((JAXBElement<?>) rowContent).getValue() instanceof Tc) {
if (i == index) {
return (Tc) ((JAXBElement<?>) rowContent).getValue();
}
i++;
}
}
return null;
} | Tc function(Tr row, int index) { int i = 0; for (Object rowContent : row.getContent()) { if (rowContent instanceof JAXBElement<?> && ((JAXBElement<?>) rowContent).getValue() instanceof Tc) { if (i == index) { return (Tc) ((JAXBElement<?>) rowContent).getValue(); } i++; } } return null; } | /**
* Returns a specific table of the row.
*
* @param row
* Row
* @param index
* Index of column
* @return Column referenced by index
*/ | Returns a specific table of the row | getColumnOfRow | {
"repo_name": "matthiaszimmermann/jOOQ-and-EclipseScout",
"path": "application/application.docx4j/src/main/java/org/eclipse/scout/docx4j/DocxAdapter.java",
"license": "epl-1.0",
"size": 39990
} | [
"javax.xml.bind.JAXBElement",
"org.docx4j.wml.Tc",
"org.docx4j.wml.Tr"
] | import javax.xml.bind.JAXBElement; import org.docx4j.wml.Tc; import org.docx4j.wml.Tr; | import javax.xml.bind.*; import org.docx4j.wml.*; | [
"javax.xml",
"org.docx4j.wml"
] | javax.xml; org.docx4j.wml; | 1,991,904 |
public void setErrorHandler(ErrorHandler eh) {
this.errorHandler = eh;
} | void function(ErrorHandler eh) { this.errorHandler = eh; } | /**
* Sets the error handler.
*
* @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler)
*/ | Sets the error handler | setErrorHandler | {
"repo_name": "gerv/slic",
"path": "test/data/identification/Tokenizer.java",
"license": "mpl-2.0",
"size": 312648
} | [
"org.xml.sax.ErrorHandler"
] | import org.xml.sax.ErrorHandler; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 2,411,772 |
public static double[] getOLSRegression(XYDataset data, int series) {
int n = data.getItemCount(series);
if (n < 2) {
throw new IllegalArgumentException("Not enough data.");
}
double sumX = 0;
double sumY = 0;
double sumXX = 0;
double sumXY = 0;
for (int i = 0; i < n; i++) {
double x = data.getXValue(series, i);
double y = data.getYValue(series, i);
sumX += x;
sumY += y;
double xx = x * x;
sumXX += xx;
double xy = x * y;
sumXY += xy;
}
double sxx = sumXX - (sumX * sumX) / n;
double sxy = sumXY - (sumX * sumY) / n;
double xbar = sumX / n;
double ybar = sumY / n;
double[] result = new double[2];
result[1] = sxy / sxx;
result[0] = ybar - result[1] * xbar;
return result;
} | static double[] function(XYDataset data, int series) { int n = data.getItemCount(series); if (n < 2) { throw new IllegalArgumentException(STR); } double sumX = 0; double sumY = 0; double sumXX = 0; double sumXY = 0; for (int i = 0; i < n; i++) { double x = data.getXValue(series, i); double y = data.getYValue(series, i); sumX += x; sumY += y; double xx = x * x; sumXX += xx; double xy = x * y; sumXY += xy; } double sxx = sumXX - (sumX * sumX) / n; double sxy = sumXY - (sumX * sumY) / n; double xbar = sumX / n; double ybar = sumY / n; double[] result = new double[2]; result[1] = sxy / sxx; result[0] = ybar - result[1] * xbar; return result; } | /**
* Returns the parameters 'a' and 'b' for an equation y = a + bx, fitted to
* the data using ordinary least squares regression. The result is returned
* as a double[], where result[0] --> a, and result[1] --> b.
*
* @param data the data.
* @param series the series (zero-based index).
*
* @return The parameters.
*/ | Returns the parameters 'a' and 'b' for an equation y = a + bx, fitted to the data using ordinary least squares regression. The result is returned as a double[], where result[0] --> a, and result[1] --> b | getOLSRegression | {
"repo_name": "raedle/univis",
"path": "lib/jfreechart-1.0.1/src/org/jfree/data/statistics/Regression.java",
"license": "lgpl-2.1",
"size": 6982
} | [
"org.jfree.data.xy.XYDataset"
] | import org.jfree.data.xy.XYDataset; | import org.jfree.data.xy.*; | [
"org.jfree.data"
] | org.jfree.data; | 2,786,844 |
public static void unmarshal(Reader reader, ProfileManager profileManager,
ObjectStoreWriter osw, boolean abortOnError) {
try {
ProfileManagerHandler profileManagerHandler =
new ProfileManagerHandler(profileManager, osw, abortOnError);
SAXParser.parse(new InputSource(reader), profileManagerHandler);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
} | static void function(Reader reader, ProfileManager profileManager, ObjectStoreWriter osw, boolean abortOnError) { try { ProfileManagerHandler profileManagerHandler = new ProfileManagerHandler(profileManager, osw, abortOnError); SAXParser.parse(new InputSource(reader), profileManagerHandler); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException(e); } } | /**
* Read a ProfileManager from an XML stream Reader
* @param reader contains the ProfileManager XML
* @param profileManager the ProfileManager to store the unmarshalled Profiles to
* @param osw ObjectStoreWriter used to resolve object ids and write bags
* correspond to object in old bags.
* @param abortOnError if true, throw an exception if there is a problem. If false, log the
* problem and continue if possible (used by read-userprofile-xml).
*/ | Read a ProfileManager from an XML stream Reader | unmarshal | {
"repo_name": "JoeCarlson/intermine",
"path": "intermine/api/main/src/org/intermine/api/xml/ProfileManagerBinding.java",
"license": "lgpl-2.1",
"size": 13752
} | [
"java.io.Reader",
"org.intermine.api.profile.ProfileManager",
"org.intermine.objectstore.ObjectStoreWriter",
"org.intermine.util.SAXParser",
"org.xml.sax.InputSource"
] | import java.io.Reader; import org.intermine.api.profile.ProfileManager; import org.intermine.objectstore.ObjectStoreWriter; import org.intermine.util.SAXParser; import org.xml.sax.InputSource; | import java.io.*; import org.intermine.api.profile.*; import org.intermine.objectstore.*; import org.intermine.util.*; import org.xml.sax.*; | [
"java.io",
"org.intermine.api",
"org.intermine.objectstore",
"org.intermine.util",
"org.xml.sax"
] | java.io; org.intermine.api; org.intermine.objectstore; org.intermine.util; org.xml.sax; | 1,222,699 |
@Test(timeout = 60000)
public void testLockReacquireFailureAfterCheckWriteLock() throws Exception {
testLockReacquireFailure(true);
} | @Test(timeout = 60000) void function() throws Exception { testLockReacquireFailure(true); } | /**
* If lock is acquired between session expired and re-acquisition, check write lock will be failed.
* @throws Exception
*/ | If lock is acquired between session expired and re-acquisition, check write lock will be failed | testLockReacquireFailureAfterCheckWriteLock | {
"repo_name": "sijie/incubator-distributedlog",
"path": "distributedlog-core/src/test/java/org/apache/distributedlog/lock/TestDistributedLock.java",
"license": "apache-2.0",
"size": 34663
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,243,979 |
private void startStreaming() {
Uri videoLink = XMLRPCDownloadManager.getInstance().getVideoUri();
if (videoLink != null) {
Intent intent = new Intent(Intent.ACTION_VIEW,
XMLRPCDownloadManager.getInstance().getVideoUri(),
mActivity.getApplicationContext(),
VideoPlayerActivity.class);
mActivity.startActivity(intent);
aDialog.cancel();
} else
aDialog.setMessage("No video file could be found in the torrent");
mPoller.stop();
} | void function() { Uri videoLink = XMLRPCDownloadManager.getInstance().getVideoUri(); if (videoLink != null) { Intent intent = new Intent(Intent.ACTION_VIEW, XMLRPCDownloadManager.getInstance().getVideoUri(), mActivity.getApplicationContext(), VideoPlayerActivity.class); mActivity.startActivity(intent); aDialog.cancel(); } else aDialog.setMessage(STR); mPoller.stop(); } | /**
* Starts streaming the video with VLC and cleans up the dialog and poller
*/ | Starts streaming the video with VLC and cleans up the dialog and poller | startStreaming | {
"repo_name": "wtud/tsap",
"path": "tsap/src/org/tribler/tsap/streaming/PlayButtonListener.java",
"license": "gpl-3.0",
"size": 5041
} | [
"android.content.Intent",
"android.net.Uri",
"org.tribler.tsap.downloads.XMLRPCDownloadManager",
"org.videolan.vlc.gui.video.VideoPlayerActivity"
] | import android.content.Intent; import android.net.Uri; import org.tribler.tsap.downloads.XMLRPCDownloadManager; import org.videolan.vlc.gui.video.VideoPlayerActivity; | import android.content.*; import android.net.*; import org.tribler.tsap.downloads.*; import org.videolan.vlc.gui.video.*; | [
"android.content",
"android.net",
"org.tribler.tsap",
"org.videolan.vlc"
] | android.content; android.net; org.tribler.tsap; org.videolan.vlc; | 489,514 |
protected void insert(Object[] row, boolean commitIndex) throws SQLException {
//## LUCENE3 ##
String query = getQuery(row);
Document doc = new Document();
doc.add(new Field(LUCENE_FIELD_QUERY, query,
Field.Store.YES, Field.Index.NOT_ANALYZED));
long time = System.currentTimeMillis();
doc.add(new Field(LUCENE_FIELD_MODIFIED,
DateTools.timeToString(time, DateTools.Resolution.SECOND),
Field.Store.YES, Field.Index.NOT_ANALYZED));
StatementBuilder buff = new StatementBuilder();
for (int index : indexColumns) {
String columnName = columns[index];
String data = asString(row[index], columnTypes[index]);
// column names that start with _
// must be escaped to avoid conflicts
// with internal field names (_DATA, _QUERY, _modified)
if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) {
columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName;
}
doc.add(new Field(columnName, data,
Field.Store.NO, Field.Index.ANALYZED));
buff.appendExceptFirst(" ");
buff.append(data);
}
Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ?
Field.Store.YES : Field.Store.NO;
doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText,
Field.Index.ANALYZED));
try {
indexAccess.writer.addDocument(doc);
if (commitIndex) {
indexAccess.writer.commit();
// recreate Searcher with the IndexWriter's reader.
indexAccess.searcher.close();
indexAccess.reader.close();
IndexReader reader = indexAccess.writer.getReader();
indexAccess.reader = reader;
indexAccess.searcher = new IndexSearcher(reader);
}
} catch (IOException e) {
throw convertException(e);
}
//*/
} | void function(Object[] row, boolean commitIndex) throws SQLException { String query = getQuery(row); Document doc = new Document(); doc.add(new Field(LUCENE_FIELD_QUERY, query, Field.Store.YES, Field.Index.NOT_ANALYZED)); long time = System.currentTimeMillis(); doc.add(new Field(LUCENE_FIELD_MODIFIED, DateTools.timeToString(time, DateTools.Resolution.SECOND), Field.Store.YES, Field.Index.NOT_ANALYZED)); StatementBuilder buff = new StatementBuilder(); for (int index : indexColumns) { String columnName = columns[index]; String data = asString(row[index], columnTypes[index]); if (columnName.startsWith(LUCENE_FIELD_COLUMN_PREFIX)) { columnName = LUCENE_FIELD_COLUMN_PREFIX + columnName; } doc.add(new Field(columnName, data, Field.Store.NO, Field.Index.ANALYZED)); buff.appendExceptFirst(" "); buff.append(data); } Field.Store storeText = STORE_DOCUMENT_TEXT_IN_INDEX ? Field.Store.YES : Field.Store.NO; doc.add(new Field(LUCENE_FIELD_DATA, buff.toString(), storeText, Field.Index.ANALYZED)); try { indexAccess.writer.addDocument(doc); if (commitIndex) { indexAccess.writer.commit(); indexAccess.searcher.close(); indexAccess.reader.close(); IndexReader reader = indexAccess.writer.getReader(); indexAccess.reader = reader; indexAccess.searcher = new IndexSearcher(reader); } } catch (IOException e) { throw convertException(e); } } | /**
* Add a row to the index.
*
* @param row the row
* @param commitIndex whether to commit the changes to the Lucene index
*/ | Add a row to the index | insert | {
"repo_name": "titus08/frostwire-desktop",
"path": "lib/jars-src/h2-1.3.164/org/h2/fulltext/FullTextLucene.java",
"license": "gpl-3.0",
"size": 29744
} | [
"java.io.IOException",
"java.sql.SQLException",
"org.apache.lucene.document.DateTools",
"org.apache.lucene.document.Document",
"org.apache.lucene.document.Field",
"org.apache.lucene.index.IndexReader",
"org.apache.lucene.search.IndexSearcher",
"org.h2.util.StatementBuilder"
] | import java.io.IOException; import java.sql.SQLException; import org.apache.lucene.document.DateTools; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexReader; import org.apache.lucene.search.IndexSearcher; import org.h2.util.StatementBuilder; | import java.io.*; import java.sql.*; import org.apache.lucene.document.*; import org.apache.lucene.index.*; import org.apache.lucene.search.*; import org.h2.util.*; | [
"java.io",
"java.sql",
"org.apache.lucene",
"org.h2.util"
] | java.io; java.sql; org.apache.lucene; org.h2.util; | 81,148 |
private static String getFileName(Node document) {
Element element = (Element) document;
return element.getAttribute("title");
} | static String function(Node document) { Element element = (Element) document; return element.getAttribute("title"); } | /**
* Extracts the filename of the uploaded image
* @param document
* @return
*/ | Extracts the filename of the uploaded image | getFileName | {
"repo_name": "whym/apps-android-commons",
"path": "app/src/main/java/fr/free/nrw/commons/category/CategoryImageUtils.java",
"license": "apache-2.0",
"size": 6535
} | [
"org.w3c.dom.Element",
"org.w3c.dom.Node"
] | import org.w3c.dom.Element; import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,463,809 |
@Generated
@Selector("setPlayer:")
public native void setPlayer(AVPlayer value); | @Selector(STR) native void function(AVPlayer value); | /**
* [@property] player
* <p>
* Indicates the instance of AVPlayer for which the AVPlayerLayer displays visual output
*/ | [@property] player Indicates the instance of AVPlayer for which the AVPlayerLayer displays visual output | setPlayer | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/avfoundation/AVPlayerLayer.java",
"license": "apache-2.0",
"size": 10017
} | [
"org.moe.natj.objc.ann.Selector"
] | import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
] | org.moe.natj; | 2,471,098 |
void init(int dataStartPosition, long dataEndPosition) throws ParserException; | void init(int dataStartPosition, long dataEndPosition) throws ParserException; | /**
* Initializes the writer.
*
* <p>Must be called once, before any calls to {@link #sampleData(ExtractorInput, long)}.
*
* @param dataStartPosition The byte position (inclusive) in the stream at which data starts.
* @param dataEndPosition The end position (exclusive) in the stream at which data ends.
* @throws ParserException If an error occurs initializing the writer.
*/ | Initializes the writer. Must be called once, before any calls to <code>#sampleData(ExtractorInput, long)</code> | init | {
"repo_name": "stari4ek/ExoPlayer",
"path": "library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java",
"license": "apache-2.0",
"size": 22416
} | [
"com.google.android.exoplayer2.ParserException"
] | import com.google.android.exoplayer2.ParserException; | import com.google.android.exoplayer2.*; | [
"com.google.android"
] | com.google.android; | 1,477,707 |
OutputStream m_outputStream;
public OutputStream getOutputStream()
{
return m_outputStream;
}
// Implement DeclHandler
| OutputStream m_outputStream; OutputStream function() { return m_outputStream; } | /**
* Get the output stream where the events will be serialized to.
*
* @return reference to the result stream, or null of only a writer was
* set.
*/ | Get the output stream where the events will be serialized to | getOutputStream | {
"repo_name": "srnsw/xena",
"path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xml/serializer/ToStream.java",
"license": "gpl-3.0",
"size": 128094
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,302,976 |
public int read(byte[] b, int off, int len) throws IOException
{
if (inf == null)
throw new IOException("stream closed");
if (len == 0)
return 0;
int count = 0;
for (;;)
{
try
{
count = inf.inflate(b, off, len);
}
catch (DataFormatException dfe)
{
throw new ZipException(dfe.getMessage());
}
if (count > 0)
return count;
if (inf.needsDictionary()
| inf.finished())
return -1;
else if (inf.needsInput())
fill();
else
throw new InternalError("Don't know what to do");
}
} | int function(byte[] b, int off, int len) throws IOException { if (inf == null) throw new IOException(STR); if (len == 0) return 0; int count = 0; for (;;) { try { count = inf.inflate(b, off, len); } catch (DataFormatException dfe) { throw new ZipException(dfe.getMessage()); } if (count > 0) return count; if (inf.needsDictionary() inf.finished()) return -1; else if (inf.needsInput()) fill(); else throw new InternalError(STR); } } | /**
* Decompresses data into the byte array
*
* @param b the array to read and decompress data into
* @param off the offset indicating where the data should be placed
* @param len the number of bytes to decompress
*/ | Decompresses data into the byte array | read | {
"repo_name": "arcao/handygeocaching",
"path": "src/gnu/classpath/util/zip/InflaterInputStream.java",
"license": "gpl-2.0",
"size": 6788
} | [
"gnu.classpath.lang.InternalError",
"java.io.IOException"
] | import gnu.classpath.lang.InternalError; import java.io.IOException; | import gnu.classpath.lang.*; import java.io.*; | [
"gnu.classpath.lang",
"java.io"
] | gnu.classpath.lang; java.io; | 2,745,997 |
public void setPKIXValidationOptions(PKIXValidationOptions newOptions) {
pkixOptions = newOptions;
} | void function(PKIXValidationOptions newOptions) { pkixOptions = newOptions; } | /**
* Set the PKIX validation options.
*
* @param newOptions the new set of validation options
*/ | Set the PKIX validation options | setPKIXValidationOptions | {
"repo_name": "brainysmith/shibboleth-common",
"path": "src/main/java/edu/internet2/middleware/shibboleth/common/config/security/StaticPKIXSignatureTrustEngineFactoryBean.java",
"license": "apache-2.0",
"size": 4860
} | [
"org.opensaml.xml.security.x509.PKIXValidationOptions"
] | import org.opensaml.xml.security.x509.PKIXValidationOptions; | import org.opensaml.xml.security.x509.*; | [
"org.opensaml.xml"
] | org.opensaml.xml; | 1,297,888 |
private void refreshRecordingStatus(int stateOverride) {
int recorderState = FmRecorder.STATE_INVALID;
recorderState = (stateOverride == FmRecorder.STATE_INVALID ? mService
.getRecorderState() : stateOverride);
Log.d(TAG, "refreshRecordingStatus: state=" + recorderState);
switch (recorderState) {
case FmRecorder.STATE_IDLE:
long recordTime = mService.getRecordTime();
if (recordTime > 0) {
if (isRecordFileExist()) {
mButtonPlayback.setEnabled(true);
}
if (FmRecorder.STATE_RECORDING == mPrevRecorderState) {
Log.d(TAG, "need show recorder dialog.mPrevRecorderState:" +
mPrevRecorderState);
if (mIsActivityForeground) {
showSaveRecordingDialog();
} else {
mIsNeedShowRecordDlg = true;
}
}
} else {
mButtonPlayback.setEnabled(false);
}
refreshPlaybackIdle((recordTime > 0) && isRecordFileExist());
mRLRecordInfo.setVisibility(View.GONE);
break;
case FmRecorder.STATE_RECORDING:
mTxtRecInfoLeft.setText("");
mTxtRecInfoRight.setText("");
mTxtRecInfoLeft.setSelected(false);
refreshRecording();
mRLRecordInfo.setVisibility(View.VISIBLE);
break;
case FmRecorder.STATE_PLAYBACK:
String recordingName = mService.getRecordingName();
if (null == recordingName) {
recordingName = "";
}
mTxtRecInfoLeft.setText(recordingName);
mTxtRecInfoRight.setText("");
mTxtRecInfoLeft.setSelected(true);
refreshPlaybacking();
mRLRecordInfo.setVisibility(View.VISIBLE);
break;
case FmRecorder.STATE_INVALID:
refreshRecordIdle();
mRLRecordInfo.setVisibility(View.GONE);
break;
default:
Log.d(TAG, "invalid record status");
break;
}
mPrevRecorderState = recorderState;
Log.d(TAG, "refreshRecordingStatus.mPrevRecorderState:" + mPrevRecorderState);
} | void function(int stateOverride) { int recorderState = FmRecorder.STATE_INVALID; recorderState = (stateOverride == FmRecorder.STATE_INVALID ? mService .getRecorderState() : stateOverride); Log.d(TAG, STR + recorderState); switch (recorderState) { case FmRecorder.STATE_IDLE: long recordTime = mService.getRecordTime(); if (recordTime > 0) { if (isRecordFileExist()) { mButtonPlayback.setEnabled(true); } if (FmRecorder.STATE_RECORDING == mPrevRecorderState) { Log.d(TAG, STR + mPrevRecorderState); if (mIsActivityForeground) { showSaveRecordingDialog(); } else { mIsNeedShowRecordDlg = true; } } } else { mButtonPlayback.setEnabled(false); } refreshPlaybackIdle((recordTime > 0) && isRecordFileExist()); mRLRecordInfo.setVisibility(View.GONE); break; case FmRecorder.STATE_RECORDING: mTxtRecInfoLeft.setText(STRSTRSTRSTRinvalid record statusSTRrefreshRecordingStatus.mPrevRecorderState:" + mPrevRecorderState); } | /**
* Update recording UI according record state
*
* @param stateOverride The recording state
*/ | Update recording UI according record state | refreshRecordingStatus | {
"repo_name": "darklord4822/android_device_smart_sprint4g",
"path": "mtk/FmRadio/src/com/mediatek/fmradio/FmRadioActivity.java",
"license": "gpl-2.0",
"size": 84998
} | [
"android.util.Log",
"android.view.View"
] | import android.util.Log; import android.view.View; | import android.util.*; import android.view.*; | [
"android.util",
"android.view"
] | android.util; android.view; | 1,582,049 |
public Set<TurmaFile> buildTurmaFiles(Set<ProfFile> profFiles) throws TurmaFileBuilderException {
files = new HashSet<TurmaFile>();
for (ProfFile profFile: profFiles) {
for (ProfSheet profSheet: profFile.getSheets()) {
for (Tarjeta tarj: profSheet.getTarjetas()) {
this.process(tarj, profSheet, profFile);
}
}
}
// calcula média final para cada turma
FinalSheetGenerator generator = new FinalSheetGenerator();
for (TurmaFile file: files) {
generator.generateFinalSheet(file);
}
return files;
} | Set<TurmaFile> function(Set<ProfFile> profFiles) throws TurmaFileBuilderException { files = new HashSet<TurmaFile>(); for (ProfFile profFile: profFiles) { for (ProfSheet profSheet: profFile.getSheets()) { for (Tarjeta tarj: profSheet.getTarjetas()) { this.process(tarj, profSheet, profFile); } } } FinalSheetGenerator generator = new FinalSheetGenerator(); for (TurmaFile file: files) { generator.generateFinalSheet(file); } return files; } | /**
* Gera as planilhas das turmas com base nas planilhas dos professores
* @param profFiles planilhas dos professores (uma planilha por professor)
* @return planilhas das turmas (um arquivo por turma)
*/ | Gera as planilhas das turmas com base nas planilhas dos professores | buildTurmaFiles | {
"repo_name": "leonardofl/notificador",
"path": "src/main/java/sp/alvaro/TurmaFileBuilder.java",
"license": "gpl-3.0",
"size": 3952
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 390,547 |
private void addWordChars(GlyphMapping wordMapping) {
int s = wordMapping.startIndex;
int e = wordMapping.endIndex;
if (wordMapping.mapping != null) {
wordChars.append(wordMapping.mapping);
addWordLevels(getMappingBidiLevels(wordMapping));
} else {
for (int i = s; i < e; i++) {
wordChars.append(foText.charAt(i));
}
addWordLevels(foText.getBidiLevels(s, e));
}
wordIPD += wordMapping.areaIPD.getOpt();
} | void function(GlyphMapping wordMapping) { int s = wordMapping.startIndex; int e = wordMapping.endIndex; if (wordMapping.mapping != null) { wordChars.append(wordMapping.mapping); addWordLevels(getMappingBidiLevels(wordMapping)); } else { for (int i = s; i < e; i++) { wordChars.append(foText.charAt(i)); } addWordLevels(foText.getBidiLevels(s, e)); } wordIPD += wordMapping.areaIPD.getOpt(); } | /**
* Given a word area info associated with a word fragment,
* (1) concatenate (possibly mapped) word characters to word character buffer;
* (2) concatenante (possibly mapped) word bidi levels to levels buffer;
* (3) update word's IPD with optimal IPD of fragment.
* @param wordMapping fragment info
*/ | Given a word area info associated with a word fragment, (1) concatenate (possibly mapped) word characters to word character buffer; (2) concatenante (possibly mapped) word bidi levels to levels buffer; (3) update word's IPD with optimal IPD of fragment | addWordChars | {
"repo_name": "chunlinyao/fop",
"path": "fop-core/src/main/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java",
"license": "apache-2.0",
"size": 67717
} | [
"org.apache.fop.fonts.GlyphMapping"
] | import org.apache.fop.fonts.GlyphMapping; | import org.apache.fop.fonts.*; | [
"org.apache.fop"
] | org.apache.fop; | 122,163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.