method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void killWorkers(Set<ContainerPlan> containers) {
for (ContainerPlan container : containers) {
LOG.log(Level.INFO, "Find and kill container for worker {0}", container.getId());
Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(container.getId());
if (worker.isPresent()) {
LOG.log(Level.INFO, "Killing container {0} for worker {1}",
new Object[]{worker.get().evaluator.getId(), worker.get().workerId});
AllocatedEvaluator evaluator = multiKeyWorkerMap.detachEvaluatorAndRemove(worker.get());
evaluator.close();
} else {
LOG.log(Level.WARNING, "Did not find worker for {0}", container.getId());
}
containerPlans.remove(container.getId());
}
} | void function(Set<ContainerPlan> containers) { for (ContainerPlan container : containers) { LOG.log(Level.INFO, STR, container.getId()); Optional<HeronWorker> worker = multiKeyWorkerMap.lookupByWorkerId(container.getId()); if (worker.isPresent()) { LOG.log(Level.INFO, STR, new Object[]{worker.get().evaluator.getId(), worker.get().workerId}); AllocatedEvaluator evaluator = multiKeyWorkerMap.detachEvaluatorAndRemove(worker.get()); evaluator.close(); } else { LOG.log(Level.WARNING, STR, container.getId()); } containerPlans.remove(container.getId()); } } | /**
* Terminates any yarn containers associated with the given containers.
*/ | Terminates any yarn containers associated with the given containers | killWorkers | {
"repo_name": "twitter/heron",
"path": "heron/schedulers/src/java/org/apache/heron/scheduler/yarn/HeronMasterDriver.java",
"license": "apache-2.0",
"size": 28238
} | [
"com.google.common.base.Optional",
"java.util.Set",
"java.util.logging.Level",
"org.apache.heron.spi.packing.PackingPlan",
"org.apache.reef.driver.evaluator.AllocatedEvaluator"
] | import com.google.common.base.Optional; import java.util.Set; import java.util.logging.Level; import org.apache.heron.spi.packing.PackingPlan; import org.apache.reef.driver.evaluator.AllocatedEvaluator; | import com.google.common.base.*; import java.util.*; import java.util.logging.*; import org.apache.heron.spi.packing.*; import org.apache.reef.driver.evaluator.*; | [
"com.google.common",
"java.util",
"org.apache.heron",
"org.apache.reef"
] | com.google.common; java.util; org.apache.heron; org.apache.reef; | 385,216 |
@Deprecated
public static LimitOrder adaptLimitOrder(BTCChinaOrder order) {
return adaptLimitOrder(order, CurrencyPair.BTC_CNY);
}
| static LimitOrder function(BTCChinaOrder order) { return adaptLimitOrder(order, CurrencyPair.BTC_CNY); } | /**
* Adapts BTCChinaOrder to LimitOrder.
*
* @deprecated Use {@link #adaptLimitOrder(BTCChinaOrder, CurrencyPair)} instead.
*/ | Adapts BTCChinaOrder to LimitOrder | adaptLimitOrder | {
"repo_name": "Achterhoeker/XChange",
"path": "xchange-btcchina/src/main/java/com/xeiam/xchange/btcchina/BTCChinaAdapters.java",
"license": "mit",
"size": 14960
} | [
"com.xeiam.xchange.btcchina.dto.trade.BTCChinaOrder",
"com.xeiam.xchange.currency.CurrencyPair",
"com.xeiam.xchange.dto.trade.LimitOrder"
] | import com.xeiam.xchange.btcchina.dto.trade.BTCChinaOrder; import com.xeiam.xchange.currency.CurrencyPair; import com.xeiam.xchange.dto.trade.LimitOrder; | import com.xeiam.xchange.btcchina.dto.trade.*; import com.xeiam.xchange.currency.*; import com.xeiam.xchange.dto.trade.*; | [
"com.xeiam.xchange"
] | com.xeiam.xchange; | 2,270,131 |
public static void init() {
init(LogManager.getLogManager());
} | static void function() { init(LogManager.getLogManager()); } | /**
* Initialize the {@code VmRuntimeLogHandler} by installing it on the root logger. After this call
* all log messages are forwarded to {@code ApiProxy.log(ApiProxy.LogRecord)} so they can be
* attached to the runtime response.
*/ | Initialize the VmRuntimeLogHandler by installing it on the root logger. After this call all log messages are forwarded to ApiProxy.log(ApiProxy.LogRecord) so they can be attached to the runtime response | init | {
"repo_name": "aglne/appengine-java-vm-runtime",
"path": "appengine-managed-runtime/src/main/java/com/google/apphosting/vmruntime/VmRuntimeLogHandler.java",
"license": "apache-2.0",
"size": 7603
} | [
"java.util.logging.LogManager"
] | import java.util.logging.LogManager; | import java.util.logging.*; | [
"java.util"
] | java.util; | 667,422 |
void onTestingStarted(@NotNull SMTestProxy.SMRootTestProxy testsRoot);
/**
* Called before {@link #onTestingFinished(SMTestProxy.SMRootTestProxy)} | void onTestingStarted(@NotNull SMTestProxy.SMRootTestProxy testsRoot); /** * Called before {@link #onTestingFinished(SMTestProxy.SMRootTestProxy)} | /**
* On start testing, before tests and suits launching
* @param testsRoot
*/ | On start testing, before tests and suits launching | onTestingStarted | {
"repo_name": "siosio/intellij-community",
"path": "platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTRunnerEventsListener.java",
"license": "apache-2.0",
"size": 3842
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 2,351,090 |
protected Connection createObject() {
try {
jdbcDataSource dataSource = new jdbcDataSource();
dataSource.setDatabase("jdbc:hsqldb:/hsql/test/test");
return dataSource.getConnection("sa", "");
} catch (Exception ex) {
ex.printStackTrace();
}
return null;
} | Connection function() { try { jdbcDataSource dataSource = new jdbcDataSource(); dataSource.setDatabase(STR); return dataSource.getConnection("sa", ""); } catch (Exception ex) { ex.printStackTrace(); } return null; } | /**
* create a connection and wait
*/ | create a connection and wait | createObject | {
"repo_name": "minghao7896321/canyin",
"path": "hsqldb/src/org/hsqldb/test/TestMultipleConnections.java",
"license": "apache-2.0",
"size": 3379
} | [
"java.sql.Connection",
"org.hsqldb.jdbc.jdbcDataSource"
] | import java.sql.Connection; import org.hsqldb.jdbc.jdbcDataSource; | import java.sql.*; import org.hsqldb.jdbc.*; | [
"java.sql",
"org.hsqldb.jdbc"
] | java.sql; org.hsqldb.jdbc; | 1,186,032 |
public Builder engineSettings(final Map<String, EngineSettings> settings) {
this.settings = settings;
return this;
} | Builder function(final Map<String, EngineSettings> settings) { this.settings = settings; return this; } | /**
* Replaces any settings provided by {@link #engineSettings(java.util.Map)}.
*/ | Replaces any settings provided by <code>#engineSettings(java.util.Map)</code> | engineSettings | {
"repo_name": "mpollmeier/tinkerpop3",
"path": "gremlin-groovy/src/main/java/com/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java",
"license": "apache-2.0",
"size": 18966
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 133,991 |
@Nullable
public static AuthorizationException fromIntent(Intent data) {
checkNotNull(data);
if (!data.hasExtra(EXTRA_EXCEPTION)) {
return null;
}
try {
return fromJson(data.getStringExtra(EXTRA_EXCEPTION));
} catch (JSONException ex) {
throw new IllegalArgumentException("Intent contains malformed exception data", ex);
}
} | static AuthorizationException function(Intent data) { checkNotNull(data); if (!data.hasExtra(EXTRA_EXCEPTION)) { return null; } try { return fromJson(data.getStringExtra(EXTRA_EXCEPTION)); } catch (JSONException ex) { throw new IllegalArgumentException(STR, ex); } } | /**
* Extracts an {@link AuthorizationException} from an intent produced by {@link #toIntent()}.
* This is used to retrieve an error response in the handler registered for a call to
* {@link AuthorizationService#performAuthorizationRequest}.
*/ | Extracts an <code>AuthorizationException</code> from an intent produced by <code>#toIntent()</code>. This is used to retrieve an error response in the handler registered for a call to <code>AuthorizationService#performAuthorizationRequest</code> | fromIntent | {
"repo_name": "openid/AppAuth-Android",
"path": "library/java/net/openid/appauth/AuthorizationException.java",
"license": "apache-2.0",
"size": 26759
} | [
"android.content.Intent",
"net.openid.appauth.Preconditions",
"org.json.JSONException"
] | import android.content.Intent; import net.openid.appauth.Preconditions; import org.json.JSONException; | import android.content.*; import net.openid.appauth.*; import org.json.*; | [
"android.content",
"net.openid.appauth",
"org.json"
] | android.content; net.openid.appauth; org.json; | 112,749 |
@SuppressWarnings("unchecked")
public static List<Integer> getAt(int[] array, Range range) {
return primitiveArrayGet(array, range);
} | @SuppressWarnings(STR) static List<Integer> function(int[] array, Range range) { return primitiveArrayGet(array, range); } | /**
* Support the subscript operator with a range for an int array
*
* @param array an int array
* @param range a range indicating the indices for the items to retrieve
* @return list of the ints at the given indices
* @since 1.0
*/ | Support the subscript operator with a range for an int array | getAt | {
"repo_name": "xien777/yajsw",
"path": "yajsw/wrapper/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "lgpl-2.1",
"size": 704150
} | [
"groovy.lang.Range",
"java.util.List"
] | import groovy.lang.Range; import java.util.List; | import groovy.lang.*; import java.util.*; | [
"groovy.lang",
"java.util"
] | groovy.lang; java.util; | 2,415,895 |
public static synchronized
Collator getInstance(Locale desiredLocale)
{
Collator result = (Collator) cache.get(desiredLocale);
if (result != null) {
return (Collator)result.clone(); // make the world safe
}
// Check whether a provider can provide an implementation that's closer
// to the requested locale than what the Java runtime itself can provide.
LocaleServiceProviderPool pool =
LocaleServiceProviderPool.getPool(CollatorProvider.class);
if (pool.hasProviders()) {
Collator providersInstance = pool.getLocalizedObject(
CollatorGetter.INSTANCE,
desiredLocale,
desiredLocale);
if (providersInstance != null) {
return providersInstance;
}
}
// Load the resource of the desired locale from resource
// manager.
String colString = "";
try {
ResourceBundle resource = LocaleData.getCollationData(desiredLocale);
colString = resource.getString("Rule");
} catch (MissingResourceException e) {
// Use default values
}
try
{
result = new RuleBasedCollator( CollationRules.DEFAULTRULES +
colString,
CANONICAL_DECOMPOSITION );
}
catch(ParseException foo)
{
// predefined tables should contain correct grammar
try {
result = new RuleBasedCollator( CollationRules.DEFAULTRULES );
} catch (ParseException bar) {
// do nothing
}
}
// Now that RuleBasedCollator adds expansions for pre-composed characters
// into their decomposed equivalents, the default collators don't need
// to have decomposition turned on. Laura, 5/5/98, bug 4114077
result.setDecomposition(NO_DECOMPOSITION);
cache.put(desiredLocale,result);
return (Collator)result.clone();
} | static synchronized Collator function(Locale desiredLocale) { Collator result = (Collator) cache.get(desiredLocale); if (result != null) { return (Collator)result.clone(); } LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(CollatorProvider.class); if (pool.hasProviders()) { Collator providersInstance = pool.getLocalizedObject( CollatorGetter.INSTANCE, desiredLocale, desiredLocale); if (providersInstance != null) { return providersInstance; } } String colString = STRRule"); } catch (MissingResourceException e) { } try { result = new RuleBasedCollator( CollationRules.DEFAULTRULES + colString, CANONICAL_DECOMPOSITION ); } catch(ParseException foo) { try { result = new RuleBasedCollator( CollationRules.DEFAULTRULES ); } catch (ParseException bar) { } } result.setDecomposition(NO_DECOMPOSITION); cache.put(desiredLocale,result); return (Collator)result.clone(); } | /**
* Gets the Collator for the desired locale.
* @param desiredLocale the desired locale.
* @return the Collator for the desired locale.
* @see java.util.Locale
* @see java.util.ResourceBundle
*/ | Gets the Collator for the desired locale | getInstance | {
"repo_name": "jgaltidor/VarJ",
"path": "analyzed_libs/jdk1.6.0_06_src/java/text/Collator.java",
"license": "mit",
"size": 21807
} | [
"java.text.spi.CollatorProvider",
"java.util.Locale",
"java.util.MissingResourceException"
] | import java.text.spi.CollatorProvider; import java.util.Locale; import java.util.MissingResourceException; | import java.text.spi.*; import java.util.*; | [
"java.text",
"java.util"
] | java.text; java.util; | 137,708 |
TextRange getTextRangeForLine(int line); | TextRange getTextRangeForLine(int line); | /**
* Returns the {@link TextRange} that defines the line.
*
* @param line line index
* @return the text range
*/ | Returns the <code>TextRange</code> that defines the line | getTextRangeForLine | {
"repo_name": "jonahkichwacoders/che",
"path": "ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/editor/document/ReadOnlyDocument.java",
"license": "epl-1.0",
"size": 3114
} | [
"org.eclipse.che.ide.api.editor.text.TextRange"
] | import org.eclipse.che.ide.api.editor.text.TextRange; | import org.eclipse.che.ide.api.editor.text.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 58,968 |
public Reduction getCST() {
return this.cst;
} | Reduction function() { return this.cst; } | /**
* Returns the Concrete Syntax Tree produced during parse()ing.
*/ | Returns the Concrete Syntax Tree produced during parse()ing | getCST | {
"repo_name": "avafanasiev/groovy",
"path": "src/main/org/codehaus/groovy/control/SourceUnit.java",
"license": "apache-2.0",
"size": 12446
} | [
"org.codehaus.groovy.syntax.Reduction"
] | import org.codehaus.groovy.syntax.Reduction; | import org.codehaus.groovy.syntax.*; | [
"org.codehaus.groovy"
] | org.codehaus.groovy; | 849,921 |
public String getUserUuid() throws SystemException; | String function() throws SystemException; | /**
* Returns the user uuid of this event.
*
* @return the user uuid of this event
* @throws SystemException if a system exception occurred
*/ | Returns the user uuid of this event | getUserUuid | {
"repo_name": "bnguyen82/stuff-projects",
"path": "PortletInAction/event-listing-portlet/event-listing-portlet-portlet-service/src/main/java/com/nosester/portlet/eventlisting/model/EventModel.java",
"license": "mit",
"size": 6253
} | [
"com.liferay.portal.kernel.exception.SystemException"
] | import com.liferay.portal.kernel.exception.SystemException; | import com.liferay.portal.kernel.exception.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 402,756 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(String resourceGroupName, String accountName, Context context) {
return beginDeleteAsync(resourceGroupName, accountName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function(String resourceGroupName, String accountName, Context context) { return beginDeleteAsync(resourceGroupName, accountName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } | /**
* Deletes an existing Azure Cosmos DB database account.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Deletes an existing Azure Cosmos DB database account | deleteAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/DatabaseAccountsClientImpl.java",
"license": "mit",
"size": 206207
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; | import com.azure.core.annotation.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 1,062,864 |
public List<Presence> addOwners(List<JID> newOwners, MUCRole senderRole)
throws ForbiddenException; | List<Presence> function(List<JID> newOwners, MUCRole senderRole) throws ForbiddenException; | /**
* Adds a list of users to the list of owners.
*
* @param newOwners the list of bare JIDs of the users to add to the list of existing owners (cannot be <tt>null</tt>).
* @param senderRole the role of the user that is trying to modify the owners list (cannot be <tt>null</tt>).
* @return the list of updated presences of all the clients resources that the clients used to
* join the room.
* @throws ForbiddenException If the user is not allowed to modify the owner list.
*/ | Adds a list of users to the list of owners | addOwners | {
"repo_name": "qyj415/openfire",
"path": "src/java/org/jivesoftware/openfire/muc/MUCRoom.java",
"license": "apache-2.0",
"size": 42794
} | [
"java.util.List",
"org.xmpp.packet.Presence"
] | import java.util.List; import org.xmpp.packet.Presence; | import java.util.*; import org.xmpp.packet.*; | [
"java.util",
"org.xmpp.packet"
] | java.util; org.xmpp.packet; | 2,459,135 |
private void registerForNotifications() {
if (PlayServicesUtils.checkPlayServices(this)) {
// Start IntentService to register this application with GCM.
Intent intent = new Intent(this, GcmRegistrationService.class);
intent.setAction(GcmRegistrationService.INTENT_ACTION_REGISTER_NOTIFICATIONS);
startService(intent);
}
} | void function() { if (PlayServicesUtils.checkPlayServices(this)) { Intent intent = new Intent(this, GcmRegistrationService.class); intent.setAction(GcmRegistrationService.INTENT_ACTION_REGISTER_NOTIFICATIONS); startService(intent); } } | /**
* Start service to register for notifications
*/ | Start service to register for notifications | registerForNotifications | {
"repo_name": "T-MAPY/IREDOViewer",
"path": "app/src/main/java/cz/tmapy/android/iredoviewer/MainActivity.java",
"license": "apache-2.0",
"size": 36126
} | [
"android.content.Intent",
"cz.tmapy.android.iredoviewer.gcm.GcmRegistrationService",
"cz.tmapy.android.iredoviewer.utils.PlayServicesUtils"
] | import android.content.Intent; import cz.tmapy.android.iredoviewer.gcm.GcmRegistrationService; import cz.tmapy.android.iredoviewer.utils.PlayServicesUtils; | import android.content.*; import cz.tmapy.android.iredoviewer.gcm.*; import cz.tmapy.android.iredoviewer.utils.*; | [
"android.content",
"cz.tmapy.android"
] | android.content; cz.tmapy.android; | 1,645,797 |
@JsonProperty("nomeRepresentado")
public String getNomeRepresentado() {
return nomeRepresentado;
} | @JsonProperty(STR) String function() { return nomeRepresentado; } | /**
* Nome do representado<br/>Tamanho: 100
* @return nomeRepresentado
**/ | Nome do representado<br/>Tamanho: 100 | getNomeRepresentado | {
"repo_name": "samuelfac/portalunico.siscomex.gov.br",
"path": "src/main/java/br/gov/siscomex/portalunico/rcnt/model/DadosRepresentante.java",
"license": "mit",
"size": 25889
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 948,288 |
public ExpandMsixImageInner withPackageDependencies(List<MsixPackageDependencies> packageDependencies) {
if (this.innerProperties() == null) {
this.innerProperties = new ExpandMsixImageProperties();
}
this.innerProperties().withPackageDependencies(packageDependencies);
return this;
} | ExpandMsixImageInner function(List<MsixPackageDependencies> packageDependencies) { if (this.innerProperties() == null) { this.innerProperties = new ExpandMsixImageProperties(); } this.innerProperties().withPackageDependencies(packageDependencies); return this; } | /**
* Set the packageDependencies property: List of package dependencies.
*
* @param packageDependencies the packageDependencies value to set.
* @return the ExpandMsixImageInner object itself.
*/ | Set the packageDependencies property: List of package dependencies | withPackageDependencies | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/desktopvirtualization/azure-resourcemanager-desktopvirtualization/src/main/java/com/azure/resourcemanager/desktopvirtualization/fluent/models/ExpandMsixImageInner.java",
"license": "mit",
"size": 12270
} | [
"com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies",
"java.util.List"
] | import com.azure.resourcemanager.desktopvirtualization.models.MsixPackageDependencies; import java.util.List; | import com.azure.resourcemanager.desktopvirtualization.models.*; import java.util.*; | [
"com.azure.resourcemanager",
"java.util"
] | com.azure.resourcemanager; java.util; | 163,361 |
@Test
void testComputerSystem() {
SystemInfo si = new SystemInfo();
ComputerSystem cs = si.getHardware().getComputerSystem();
assertThat("Computer System's manufacturer shouldn't be null", cs.getManufacturer(), is(notNullValue()));
assertThat("Computer System's model shouldn't be null", cs.getModel(), is(notNullValue()));
assertThat("Computer System's serial number shouldn't be null", cs.getSerialNumber(), is(notNullValue()));
assertThat("Computer System's UUID should be in UUID format or unknown", cs.getHardwareUUID(),
matchesPattern(UUID_PATTERN));
Firmware fw = cs.getFirmware();
assertThat("Firmware shouldn't be null", fw, is(notNullValue()));
assertThat("Firmware's manufacturer shouldn't be null", fw.getManufacturer(), is(notNullValue()));
assertThat("Firmware's name shouldn't be null", fw.getName(), is(notNullValue()));
assertThat("Firmware's description shouldn't be null", fw.getDescription(), is(notNullValue()));
assertThat("Firmware's version shouldn't be null", fw.getVersion(), is(notNullValue()));
assertThat("Firmware's release date shouldn't be null", fw.getReleaseDate(), is(notNullValue()));
assertThat("Firmware's tostring value should contain manufacturer's name", fw.toString(),
containsString(fw.getManufacturer()));
Baseboard bb = cs.getBaseboard();
assertThat("Baseboard shouldn't be null", bb, is(notNullValue()));
assertThat("Baseboard's manufacturer shouldn't be null", bb.getManufacturer(), is(notNullValue()));
assertThat("Baseboard's model shouldn't be null", bb.getModel(), is(notNullValue()));
assertThat("Baseboard's version shouldn't be null", bb.getVersion(), is(notNullValue()));
assertThat("Baseboard's serial number shouldn't be null", bb.getSerialNumber(), is(notNullValue()));
} | void testComputerSystem() { SystemInfo si = new SystemInfo(); ComputerSystem cs = si.getHardware().getComputerSystem(); assertThat(STR, cs.getManufacturer(), is(notNullValue())); assertThat(STR, cs.getModel(), is(notNullValue())); assertThat(STR, cs.getSerialNumber(), is(notNullValue())); assertThat(STR, cs.getHardwareUUID(), matchesPattern(UUID_PATTERN)); Firmware fw = cs.getFirmware(); assertThat(STR, fw, is(notNullValue())); assertThat(STR, fw.getManufacturer(), is(notNullValue())); assertThat(STR, fw.getName(), is(notNullValue())); assertThat(STR, fw.getDescription(), is(notNullValue())); assertThat(STR, fw.getVersion(), is(notNullValue())); assertThat(STR, fw.getReleaseDate(), is(notNullValue())); assertThat(STR, fw.toString(), containsString(fw.getManufacturer())); Baseboard bb = cs.getBaseboard(); assertThat(STR, bb, is(notNullValue())); assertThat(STR, bb.getManufacturer(), is(notNullValue())); assertThat(STR, bb.getModel(), is(notNullValue())); assertThat(STR, bb.getVersion(), is(notNullValue())); assertThat(STR, bb.getSerialNumber(), is(notNullValue())); } | /**
* Test Computer System
*/ | Test Computer System | testComputerSystem | {
"repo_name": "hazendaz/oshi",
"path": "oshi-core/src/test/java/oshi/hardware/ComputerSystemTest.java",
"license": "mit",
"size": 3781
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import org.hamcrest.*; | [
"org.hamcrest"
] | org.hamcrest; | 826,680 |
//------------//
// checkPitch //
//------------//
public static boolean checkPitch (SystemInfo system,
Point2D center,
int profile)
{
final double pp = system.estimatedPitch(center);
final double pitchDif = Math.abs(Math.abs(pp) - 1);
final double maxDif = RepeatDotBarRelation.getYGapMaximum(profile).getValue();
return pitchDif <= (2 * maxDif);
}
| static boolean function (SystemInfo system, Point2D center, int profile) { final double pp = system.estimatedPitch(center); final double pitchDif = Math.abs(Math.abs(pp) - 1); final double maxDif = RepeatDotBarRelation.getYGapMaximum(profile).getValue(); return pitchDif <= (2 * maxDif); } | /**
* Verify that the provided dot center corresponds to a valid pitch value
* (close to +1 or -1).
*
*
* @param system containing system
* @param center dot center
* @param profile desired profile level
* @return true if OK
*/ | Verify that the provided dot center corresponds to a valid pitch value (close to +1 or -1) | checkPitch | {
"repo_name": "Audiveris/audiveris",
"path": "src/main/org/audiveris/omr/sig/inter/RepeatDotInter.java",
"license": "agpl-3.0",
"size": 11013
} | [
"java.awt.geom.Point2D",
"org.audiveris.omr.sheet.SystemInfo",
"org.audiveris.omr.sig.relation.RepeatDotBarRelation"
] | import java.awt.geom.Point2D; import org.audiveris.omr.sheet.SystemInfo; import org.audiveris.omr.sig.relation.RepeatDotBarRelation; | import java.awt.geom.*; import org.audiveris.omr.sheet.*; import org.audiveris.omr.sig.relation.*; | [
"java.awt",
"org.audiveris.omr"
] | java.awt; org.audiveris.omr; | 1,724,397 |
protected void addAuthorList(Element citationElement, MatchItem item)
{
String firstAuthor;
NodeList authorList;
Element element;
firstAuthor = null;
element = DomUtils.getElementNS(NS_CS, citationElement, "normalizedData");
if (element != null)
{
firstAuthor = DomUtils.getTextNS(NS_DC, element, "creator");
}
authorList = DomUtils.getElementListNS(NS_DC, citationElement, "creator");
if (authorList.getLength() == 0)
{
if (firstAuthor != null)
{
addPartStructure(item,
CreatorPartStructure.getPartStructureId(),
firstAuthor);
return;
}
}
for (int i = 0; i < authorList.getLength(); i++)
{
String author = DomUtils.getText(authorList.item(i));
if (StringUtils.isNull(author))
{
continue;
}
if ((firstAuthor == null) || (!firstAuthor.equalsIgnoreCase(author)))
{
addPartStructure(item,
CreatorPartStructure.getPartStructureId(),
author);
}
}
} | void function(Element citationElement, MatchItem item) { String firstAuthor; NodeList authorList; Element element; firstAuthor = null; element = DomUtils.getElementNS(NS_CS, citationElement, STR); if (element != null) { firstAuthor = DomUtils.getTextNS(NS_DC, element, STR); } authorList = DomUtils.getElementListNS(NS_DC, citationElement, STR); if (authorList.getLength() == 0) { if (firstAuthor != null) { addPartStructure(item, CreatorPartStructure.getPartStructureId(), firstAuthor); return; } } for (int i = 0; i < authorList.getLength(); i++) { String author = DomUtils.getText(authorList.item(i)); if (StringUtils.isNull(author)) { continue; } if ((firstAuthor == null) (!firstAuthor.equalsIgnoreCase(author))) { addPartStructure(item, CreatorPartStructure.getPartStructureId(), author); } } } | /**
* Locate (and save) the authors (omit the normalized "first author")
* @param citationElement The root element of this citation
* @param item A MatchItem (eg Asset) object
*/ | Locate (and save) the authors (omit the normalized "first author") | addAuthorList | {
"repo_name": "OpenCollabZA/sakai",
"path": "citations/citations-osid/web2bridge/src/java/edu/indiana/lib/twinpeaks/search/sru/ss360search/Response.java",
"license": "apache-2.0",
"size": 16737
} | [
"edu.indiana.lib.osid.base.repository.http.CreatorPartStructure",
"edu.indiana.lib.twinpeaks.search.MatchItem",
"edu.indiana.lib.twinpeaks.util.DomUtils",
"edu.indiana.lib.twinpeaks.util.StringUtils",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
] | import edu.indiana.lib.osid.base.repository.http.CreatorPartStructure; import edu.indiana.lib.twinpeaks.search.MatchItem; import edu.indiana.lib.twinpeaks.util.DomUtils; import edu.indiana.lib.twinpeaks.util.StringUtils; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import edu.indiana.lib.osid.base.repository.http.*; import edu.indiana.lib.twinpeaks.search.*; import edu.indiana.lib.twinpeaks.util.*; import org.w3c.dom.*; | [
"edu.indiana.lib",
"org.w3c.dom"
] | edu.indiana.lib; org.w3c.dom; | 43,559 |
private void setupHiddenLayer()
{
StringTokenizer tok = new StringTokenizer(m_hiddenLayers, ",");
int val = 0; //num of nodes in a layer
int prev = 0; //used to remember the previous layer
int num = tok.countTokens(); //number of layers
String c;
for (int noa = 0; noa < num; noa++) {
//note that I am using the Double to get the value rather than the
//Integer class, because for some reason the Double implementation can
//handle leading white space and the integer version can't!?!
c = tok.nextToken().trim();
if (c.equals("a")) {
val = (m_numAttributes + m_numClasses) / 2;
}
else if (c.equals("i")) {
val = m_numAttributes;
}
else if (c.equals("o")) {
val = m_numClasses;
}
else if (c.equals("t")) {
val = m_numAttributes + m_numClasses;
}
else {
val = Double.valueOf(c).intValue();
}
for (int nob = 0; nob < val; nob++) {
NeuralNode temp = new NeuralNode(String.valueOf(m_nextId), m_random,
m_sigmoidUnit);
m_nextId++;
temp.setX(.5 / (num) * noa + .25);
temp.setY((nob + 1.0) / (val + 1));
addNode(temp);
if (noa > 0) {
//then do connections
for (int noc = m_neuralNodes.length - nob - 1 - prev;
noc < m_neuralNodes.length - nob - 1; noc++) {
NeuralConnection.connect(m_neuralNodes[noc], temp);
}
}
}
prev = val;
}
tok = new StringTokenizer(m_hiddenLayers, ",");
c = tok.nextToken();
if (c.equals("a")) {
val = (m_numAttributes + m_numClasses) / 2;
}
else if (c.equals("i")) {
val = m_numAttributes;
}
else if (c.equals("o")) {
val = m_numClasses;
}
else if (c.equals("t")) {
val = m_numAttributes + m_numClasses;
}
else {
val = Double.valueOf(c).intValue();
}
if (val == 0) {
for (int noa = 0; noa < m_numAttributes; noa++) {
for (int nob = 0; nob < m_numClasses; nob++) {
NeuralConnection.connect(m_inputs[noa], m_neuralNodes[nob]);
}
}
}
else {
for (int noa = 0; noa < m_numAttributes; noa++) {
for (int nob = m_numClasses; nob < m_numClasses + val; nob++) {
NeuralConnection.connect(m_inputs[noa], m_neuralNodes[nob]);
}
}
for (int noa = m_neuralNodes.length - prev; noa < m_neuralNodes.length;
noa++) {
for (int nob = 0; nob < m_numClasses; nob++) {
NeuralConnection.connect(m_neuralNodes[noa], m_neuralNodes[nob]);
}
}
}
} | void function() { StringTokenizer tok = new StringTokenizer(m_hiddenLayers, ","); int val = 0; int prev = 0; int num = tok.countTokens(); String c; for (int noa = 0; noa < num; noa++) { c = tok.nextToken().trim(); if (c.equals("a")) { val = (m_numAttributes + m_numClasses) / 2; } else if (c.equals("i")) { val = m_numAttributes; } else if (c.equals("o")) { val = m_numClasses; } else if (c.equals("t")) { val = m_numAttributes + m_numClasses; } else { val = Double.valueOf(c).intValue(); } for (int nob = 0; nob < val; nob++) { NeuralNode temp = new NeuralNode(String.valueOf(m_nextId), m_random, m_sigmoidUnit); m_nextId++; temp.setX(.5 / (num) * noa + .25); temp.setY((nob + 1.0) / (val + 1)); addNode(temp); if (noa > 0) { for (int noc = m_neuralNodes.length - nob - 1 - prev; noc < m_neuralNodes.length - nob - 1; noc++) { NeuralConnection.connect(m_neuralNodes[noc], temp); } } } prev = val; } tok = new StringTokenizer(m_hiddenLayers, ","); c = tok.nextToken(); if (c.equals("a")) { val = (m_numAttributes + m_numClasses) / 2; } else if (c.equals("i")) { val = m_numAttributes; } else if (c.equals("o")) { val = m_numClasses; } else if (c.equals("t")) { val = m_numAttributes + m_numClasses; } else { val = Double.valueOf(c).intValue(); } if (val == 0) { for (int noa = 0; noa < m_numAttributes; noa++) { for (int nob = 0; nob < m_numClasses; nob++) { NeuralConnection.connect(m_inputs[noa], m_neuralNodes[nob]); } } } else { for (int noa = 0; noa < m_numAttributes; noa++) { for (int nob = m_numClasses; nob < m_numClasses + val; nob++) { NeuralConnection.connect(m_inputs[noa], m_neuralNodes[nob]); } } for (int noa = m_neuralNodes.length - prev; noa < m_neuralNodes.length; noa++) { for (int nob = 0; nob < m_numClasses; nob++) { NeuralConnection.connect(m_neuralNodes[noa], m_neuralNodes[nob]); } } } } | /**
* Call this function to automatically generate the hidden units
*/ | Call this function to automatically generate the hidden units | setupHiddenLayer | {
"repo_name": "goddesss/DataModeling",
"path": "src/weka/classifiers/functions/MultilayerPerceptron.java",
"license": "gpl-2.0",
"size": 82654
} | [
"java.util.StringTokenizer"
] | import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 1,999,966 |
public void setUseFunctionPointers(boolean value) {
this.useFunctionPointers = value;
}
}
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"datatype"
})
public static class Datatypes {
protected List<TypeArchitectureType.Datatypes.Datatype> datatype;
/**
* Gets the value of the datatype property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the datatype property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDatatype().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TypeArchitectureType.Datatypes.Datatype } | void function(boolean value) { this.useFunctionPointers = value; } } @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = STRdatatype" }) public static class Datatypes { protected List<TypeArchitectureType.Datatypes.Datatype> datatype; /** * Gets the value of the datatype property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the datatype property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDatatype().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TypeArchitectureType.Datatypes.Datatype } | /**
* Sets the value of the useFunctionPointers property.
*
*/ | Sets the value of the useFunctionPointers property | setUseFunctionPointers | {
"repo_name": "bcosenza/patus",
"path": "src/ch/unibas/cs/hpwc/patus/arch/TypeArchitectureType.java",
"license": "lgpl-2.1",
"size": 73527
} | [
"java.util.List",
"javax.xml.bind.annotation.XmlAccessType",
"javax.xml.bind.annotation.XmlAccessorType",
"javax.xml.bind.annotation.XmlType"
] | import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; | import java.util.*; import javax.xml.bind.annotation.*; | [
"java.util",
"javax.xml"
] | java.util; javax.xml; | 1,961,775 |
@Test
public void testRenameDirAndDeleteSnapshot_4() throws Exception {
final Path sdir1 = new Path("/dir1");
final Path sdir2 = new Path("/dir2");
final Path foo = new Path(sdir1, "foo");
final Path bar = new Path(foo, "bar");
DFSTestUtil.createFile(hdfs, bar, BLOCKSIZE, REPL, SEED);
hdfs.mkdirs(sdir2);
SnapshotTestHelper.createSnapshot(hdfs, sdir1, "s1");
SnapshotTestHelper.createSnapshot(hdfs, sdir2, "s2");
final Path foo2 = new Path(sdir2, "foo");
hdfs.rename(foo, foo2);
// create two new files under foo2
final Path bar2 = new Path(foo2, "bar2");
DFSTestUtil.createFile(hdfs, bar2, BLOCKSIZE, REPL, SEED);
final Path bar3 = new Path(foo2, "bar3");
DFSTestUtil.createFile(hdfs, bar3, BLOCKSIZE, REPL, SEED);
// create a new snapshot on sdir2
hdfs.createSnapshot(sdir2, "s3");
// rename foo2 again
hdfs.rename(foo2, foo);
// delete snapshot s3
hdfs.deleteSnapshot(sdir2, "s3");
// check
final INodeDirectory dir1Node = fsdir.getINode4Write(sdir1.toString())
.asDirectory();
// sdir1 + s1 + foo_s1 (foo) + foo (foo + s1 + bar~bar3)
QuotaCounts q1 = dir1Node.getDirectoryWithQuotaFeature().getSpaceConsumed();
assertEquals(7, q1.getNameSpace());
final INodeDirectory dir2Node = fsdir.getINode4Write(sdir2.toString())
.asDirectory();
QuotaCounts q2 = dir2Node.getDirectoryWithQuotaFeature().getSpaceConsumed();
assertEquals(1, q2.getNameSpace());
final Path foo_s1 = SnapshotTestHelper.getSnapshotPath(sdir1, "s1",
foo.getName());
final INode fooRef = fsdir.getINode(foo_s1.toString());
assertTrue(fooRef instanceof INodeReference.WithName);
INodeReference.WithCount wc =
(WithCount) fooRef.asReference().getReferredINode();
assertEquals(2, wc.getReferenceCount());
INodeDirectory fooNode = wc.getReferredINode().asDirectory();
ReadOnlyList<INode> children = fooNode
.getChildrenList(Snapshot.CURRENT_STATE_ID);
assertEquals(3, children.size());
assertEquals(bar.getName(), children.get(0).getLocalName());
assertEquals(bar2.getName(), children.get(1).getLocalName());
assertEquals(bar3.getName(), children.get(2).getLocalName());
List<DirectoryDiff> diffList = fooNode.getDiffs().asList();
assertEquals(1, diffList.size());
Snapshot s1 = dir1Node.getSnapshot(DFSUtil.string2Bytes("s1"));
assertEquals(s1.getId(), diffList.get(0).getSnapshotId());
ChildrenDiff diff = diffList.get(0).getChildrenDiff();
// bar2 and bar3 in the created list
assertEquals(2, diff.getList(ListType.CREATED).size());
assertEquals(0, diff.getList(ListType.DELETED).size());
final INode fooRef2 = fsdir.getINode4Write(foo.toString());
assertTrue(fooRef2 instanceof INodeReference.DstReference);
INodeReference.WithCount wc2 =
(WithCount) fooRef2.asReference().getReferredINode();
assertSame(wc, wc2);
assertSame(fooRef2, wc.getParentReference());
restartClusterAndCheckImage(true);
}
/**
* This test demonstrates that
* {@link INodeDirectory#removeChild}
* and
* {@link INodeDirectory#addChild} | void function() throws Exception { final Path sdir1 = new Path("/dir1"); final Path sdir2 = new Path("/dir2"); final Path foo = new Path(sdir1, "foo"); final Path bar = new Path(foo, "bar"); DFSTestUtil.createFile(hdfs, bar, BLOCKSIZE, REPL, SEED); hdfs.mkdirs(sdir2); SnapshotTestHelper.createSnapshot(hdfs, sdir1, "s1"); SnapshotTestHelper.createSnapshot(hdfs, sdir2, "s2"); final Path foo2 = new Path(sdir2, "foo"); hdfs.rename(foo, foo2); final Path bar2 = new Path(foo2, "bar2"); DFSTestUtil.createFile(hdfs, bar2, BLOCKSIZE, REPL, SEED); final Path bar3 = new Path(foo2, "bar3"); DFSTestUtil.createFile(hdfs, bar3, BLOCKSIZE, REPL, SEED); hdfs.createSnapshot(sdir2, "s3"); hdfs.rename(foo2, foo); hdfs.deleteSnapshot(sdir2, "s3"); final INodeDirectory dir1Node = fsdir.getINode4Write(sdir1.toString()) .asDirectory(); QuotaCounts q1 = dir1Node.getDirectoryWithQuotaFeature().getSpaceConsumed(); assertEquals(7, q1.getNameSpace()); final INodeDirectory dir2Node = fsdir.getINode4Write(sdir2.toString()) .asDirectory(); QuotaCounts q2 = dir2Node.getDirectoryWithQuotaFeature().getSpaceConsumed(); assertEquals(1, q2.getNameSpace()); final Path foo_s1 = SnapshotTestHelper.getSnapshotPath(sdir1, "s1", foo.getName()); final INode fooRef = fsdir.getINode(foo_s1.toString()); assertTrue(fooRef instanceof INodeReference.WithName); INodeReference.WithCount wc = (WithCount) fooRef.asReference().getReferredINode(); assertEquals(2, wc.getReferenceCount()); INodeDirectory fooNode = wc.getReferredINode().asDirectory(); ReadOnlyList<INode> children = fooNode .getChildrenList(Snapshot.CURRENT_STATE_ID); assertEquals(3, children.size()); assertEquals(bar.getName(), children.get(0).getLocalName()); assertEquals(bar2.getName(), children.get(1).getLocalName()); assertEquals(bar3.getName(), children.get(2).getLocalName()); List<DirectoryDiff> diffList = fooNode.getDiffs().asList(); assertEquals(1, diffList.size()); Snapshot s1 = dir1Node.getSnapshot(DFSUtil.string2Bytes("s1")); assertEquals(s1.getId(), diffList.get(0).getSnapshotId()); ChildrenDiff diff = diffList.get(0).getChildrenDiff(); assertEquals(2, diff.getList(ListType.CREATED).size()); assertEquals(0, diff.getList(ListType.DELETED).size()); final INode fooRef2 = fsdir.getINode4Write(foo.toString()); assertTrue(fooRef2 instanceof INodeReference.DstReference); INodeReference.WithCount wc2 = (WithCount) fooRef2.asReference().getReferredINode(); assertSame(wc, wc2); assertSame(fooRef2, wc.getParentReference()); restartClusterAndCheckImage(true); } /** * This test demonstrates that * {@link INodeDirectory#removeChild} * and * {@link INodeDirectory#addChild} | /**
* After the following operations:
* Rename a dir -> create a snapshot s on dst tree -> rename the renamed dir
* again -> delete snapshot s on dst tree
*
* Make sure we only delete the snapshot s under the renamed dir.
*/ | After the following operations: Rename a dir -> create a snapshot s on dst tree -> rename the renamed dir again -> delete snapshot s on dst tree Make sure we only delete the snapshot s under the renamed dir | testRenameDirAndDeleteSnapshot_4 | {
"repo_name": "myeoje/PhillyYarn",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestRenameWithSnapshots.java",
"license": "apache-2.0",
"size": 96626
} | [
"java.util.List",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hdfs.DFSTestUtil",
"org.apache.hadoop.hdfs.DFSUtil",
"org.apache.hadoop.hdfs.server.namenode.INode",
"org.apache.hadoop.hdfs.server.namenode.INodeDirectory",
"org.apache.hadoop.hdfs.server.namenode.INodeReference",
"org.apache.hadoop.hdfs.server.namenode.QuotaCounts",
"org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature",
"org.apache.hadoop.hdfs.util.Diff",
"org.apache.hadoop.hdfs.util.ReadOnlyList",
"org.junit.Assert"
] | import java.util.List; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSTestUtil; import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.server.namenode.INode; import org.apache.hadoop.hdfs.server.namenode.INodeDirectory; import org.apache.hadoop.hdfs.server.namenode.INodeReference; import org.apache.hadoop.hdfs.server.namenode.QuotaCounts; import org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature; import org.apache.hadoop.hdfs.util.Diff; import org.apache.hadoop.hdfs.util.ReadOnlyList; import org.junit.Assert; | import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.server.namenode.*; import org.apache.hadoop.hdfs.server.namenode.snapshot.*; import org.apache.hadoop.hdfs.util.*; import org.junit.*; | [
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.util; org.apache.hadoop; org.junit; | 1,533,357 |
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PollResult<ContainerInner>, ContainerInner> beginCreateOrUpdate(
String deviceName,
String storageAccountName,
String containerName,
String resourceGroupName,
ContainerInner container) {
return beginCreateOrUpdateAsync(deviceName, storageAccountName, containerName, resourceGroupName, container)
.getSyncPoller();
} | @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<ContainerInner>, ContainerInner> function( String deviceName, String storageAccountName, String containerName, String resourceGroupName, ContainerInner container) { return beginCreateOrUpdateAsync(deviceName, storageAccountName, containerName, resourceGroupName, container) .getSyncPoller(); } | /**
* Creates a new container or updates an existing container on the device.
*
* @param deviceName The device name.
* @param storageAccountName The Storage Account Name.
* @param containerName The container name.
* @param resourceGroupName The resource group name.
* @param container The container properties.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return represents a container on the Data Box Edge/Gateway device.
*/ | Creates a new container or updates an existing container on the device | beginCreateOrUpdate | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/databoxedge/azure-resourcemanager-databoxedge/src/main/java/com/azure/resourcemanager/databoxedge/implementation/ContainersClientImpl.java",
"license": "mit",
"size": 73548
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.SyncPoller",
"com.azure.resourcemanager.databoxedge.fluent.models.ContainerInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.databoxedge.fluent.models.ContainerInner; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.databoxedge.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 96,557 |
public int getMaxBuildHeight() {
return Math.max(64, Math.min(256, config.getInt(Key.MAX_BUILD_HEIGHT)));
} | int function() { return Math.max(64, Math.min(256, config.getInt(Key.MAX_BUILD_HEIGHT))); } | /**
* Gets the max building height of the server.
*
* @return the max building height of the server, in blocks.
*/ | Gets the max building height of the server | getMaxBuildHeight | {
"repo_name": "GlowstonePlusPlus/GlowstonePlusPlus",
"path": "src/main/java/net/glowstone/GlowServer.java",
"license": "mit",
"size": 107961
} | [
"net.glowstone.util.config.ServerConfig"
] | import net.glowstone.util.config.ServerConfig; | import net.glowstone.util.config.*; | [
"net.glowstone.util"
] | net.glowstone.util; | 911,369 |
public void setMaxHighlightDistance(float distDp) {
mMaxHighlightDistance = Utils.convertDpToPixel(distDp);
} | void function(float distDp) { mMaxHighlightDistance = Utils.convertDpToPixel(distDp); } | /**
* Sets the maximum distance in screen dp a touch can be away from an entry to cause it to get highlighted.
* Default: 500dp
*
* @param distDp
*/ | Sets the maximum distance in screen dp a touch can be away from an entry to cause it to get highlighted. Default: 500dp | setMaxHighlightDistance | {
"repo_name": "xyjincan/snore-test",
"path": "Snore/MPChartLib/src/main/java/com/github/mikephil/charting/charts/Chart.java",
"license": "apache-2.0",
"size": 51713
} | [
"com.github.mikephil.charting.utils.Utils"
] | import com.github.mikephil.charting.utils.Utils; | import com.github.mikephil.charting.utils.*; | [
"com.github.mikephil"
] | com.github.mikephil; | 1,096,948 |
@Override
public Date getDate(String columnLabel) throws SQLException {
return getDate(findColumn(columnLabel));
} | Date function(String columnLabel) throws SQLException { return getDate(findColumn(columnLabel)); } | /**
* Returns the value as a java.sql.Date.
*
* @param columnLabel the column label
* @return the value
*/ | Returns the value as a java.sql.Date | getDate | {
"repo_name": "ferquies/2dam",
"path": "AD/Tema 2/h2/src/main/org/h2/tools/SimpleResultSet.java",
"license": "gpl-3.0",
"size": 53505
} | [
"java.sql.Date",
"java.sql.SQLException"
] | import java.sql.Date; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 407,689 |
public String getUserResourceInstanceUri(final String path, final String instanceId){
if(StringUtils.isEmpty(path) || StringUtils.isEmpty(instanceId)) {
throw new IllegalArgumentException("Path and Instance Id cannot be null");
}
return getUserResourceUri(path) + "/" + instanceId;
} | String function(final String path, final String instanceId){ if(StringUtils.isEmpty(path) StringUtils.isEmpty(instanceId)) { throw new IllegalArgumentException(STR); } return getUserResourceUri(path) + "/" + instanceId; } | /**
* Convenience method that returns the resource instance uri. E.g.
*
* @param path the path.
* @param instanceId the instance id.
* @return The user Instance URI.
*/ | Convenience method that returns the resource instance uri. E.g | getUserResourceInstanceUri | {
"repo_name": "bandwidthcom/java-bandwidth",
"path": "src/main/java/com/bandwidth/sdk/BandwidthClient.java",
"license": "mit",
"size": 29341
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,394,406 |
public static void writeMBID(final String mBID, final CoverArtArchiveTagInfo tagInfo) {
boolean trace = LOGGER.isTraceEnabled();
try (Connection connection = database.getConnection()) {
String query = "SELECT * FROM " + TABLE_NAME + constructTagWhere(tagInfo, true);
if (trace) {
LOGGER.trace("Searching for release MBID with \"{}\" before update", query);
}
tableLock.writeLock().lock();
try (Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)){
connection.setAutoCommit(false);
try (ResultSet result = statement.executeQuery(query)){
if (result.next()) {
if (StringUtil.hasValue(mBID) || !StringUtil.hasValue(result.getString("MBID"))) {
if (trace) {
LOGGER.trace("Updating row {} to MBID \"{}\"", result.getInt("ID"), mBID);
}
result.updateTimestamp("MODIFIED", new Timestamp(System.currentTimeMillis()));
if (StringUtil.hasValue(mBID)) {
result.updateString("MBID", mBID);
} else {
result.updateNull("MBID");
}
result.updateRow();
} else if (trace) {
LOGGER.trace("Leaving row {} alone since previous information seems better", result.getInt("ID"));
}
} else {
if (trace) {
LOGGER.trace(
"Inserting new row for MBID \"{}\":\n" +
" Artist \"{}\"\n" +
" Album \"{}\"\n" +
" Title \"{}\"\n" +
" Year \"{}\"\n" +
" Artist ID \"{}\"\n" +
" Track ID \"{}\"\n",
mBID, tagInfo.artist, tagInfo.album,
tagInfo.title, tagInfo.year,
tagInfo.artistId, tagInfo.trackId
);
}
result.moveToInsertRow();
result.updateTimestamp("MODIFIED", new Timestamp(System.currentTimeMillis()));
if (StringUtil.hasValue(mBID)) {
result.updateString("MBID", mBID);
}
if (StringUtil.hasValue(tagInfo.album)) {
result.updateString("ALBUM", tagInfo.album);
}
if (StringUtil.hasValue(tagInfo.artist)) {
result.updateString("ARTIST", tagInfo.artist);
}
if (StringUtil.hasValue(tagInfo.title)) {
result.updateString("TITLE", tagInfo.title);
}
if (StringUtil.hasValue(tagInfo.year)) {
result.updateString("YEAR", tagInfo.year.substring(0, Math.min(4, tagInfo.year.length())));
}
if (StringUtil.hasValue(tagInfo.artistId)) {
result.updateString("ARTIST_ID", tagInfo.artistId);
}
if (StringUtil.hasValue(tagInfo.trackId)) {
result.updateString("TRACK_ID", tagInfo.trackId);
}
result.insertRow();
}
} finally {
connection.commit();
}
} finally {
tableLock.writeLock().unlock();
}
} catch (SQLException e) {
LOGGER.error(
"Database error while writing Music Brainz ID \"{}\" for \"{}\": {}",
mBID,
tagInfo,
e.getMessage()
);
LOGGER.trace("", e);
}
} | static void function(final String mBID, final CoverArtArchiveTagInfo tagInfo) { boolean trace = LOGGER.isTraceEnabled(); try (Connection connection = database.getConnection()) { String query = STR + TABLE_NAME + constructTagWhere(tagInfo, true); if (trace) { LOGGER.trace(STR{}\STR, query); } tableLock.writeLock().lock(); try (Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE)){ connection.setAutoCommit(false); try (ResultSet result = statement.executeQuery(query)){ if (result.next()) { if (StringUtil.hasValue(mBID) !StringUtil.hasValue(result.getString("MBID"))) { if (trace) { LOGGER.trace(STR{}\STRIDSTRMODIFIEDSTRMBIDSTRMBIDSTRLeaving row {} alone since previous information seems betterSTRIDSTRInserting new row for MBID \"{}\":\nSTR Artist \"{}\"\nSTR Album \"{}\"\nSTR Title \"{}\"\nSTR Year \"{}\"\nSTR Artist ID \"{}\"\nSTR Track ID \"{}\"\nSTRMODIFIEDSTRMBIDSTRALBUMSTRARTISTSTRTITLESTRYEARSTRARTIST_IDSTRTRACK_IDSTRDatabase error while writing Music Brainz ID \"{}\" for \"{}\": {}STR", e); } } | /**
* Stores the MBID with information from this {@link Tag} in the database
*
* @param mBID the MBID to store
* @param tag the {@link Tag} who's information should be associated with
* the given MBID
*/ | Stores the MBID with information from this <code>Tag</code> in the database | writeMBID | {
"repo_name": "Sami32/UniversalMediaServer",
"path": "src/main/java/net/pms/database/TableMusicBrainzReleases.java",
"license": "gpl-2.0",
"size": 12737
} | [
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.Statement",
"net.pms.util.CoverArtArchiveUtil",
"net.pms.util.StringUtil"
] | import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import net.pms.util.CoverArtArchiveUtil; import net.pms.util.StringUtil; | import java.sql.*; import net.pms.util.*; | [
"java.sql",
"net.pms.util"
] | java.sql; net.pms.util; | 1,734,095 |
public Point2D getAdvance2D() {
adjustTextSpacing();
return advance;
} | Point2D function() { adjustTextSpacing(); return advance; } | /**
* Returns the current text position at the completion
* of glyph layout.
*/ | Returns the current text position at the completion of glyph layout | getAdvance2D | {
"repo_name": "srnsw/xena",
"path": "plugins/image/ext/src/batik-1.7/sources/org/apache/batik/gvt/text/GlyphLayout.java",
"license": "gpl-3.0",
"size": 79475
} | [
"java.awt.geom.Point2D"
] | import java.awt.geom.Point2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,327,543 |
Class<?> loadClass(String name) throws ClassNotFoundException {
// First, try to find the class by name.
ServiceReference<DeserializationClassProvider> provider = classProviders.getReference(name);
if (provider != null) {
return loadClass(provider, name);
}
// Next, try to find the class by package.
int index = name.lastIndexOf('.');
if (index != -1) {
String pkg = name.substring(0, index);
provider = packageProviders.getReference(pkg);
if (provider != null) {
return loadClass(provider, name);
}
}
// Check for classes to convert between Java EE and Jakarta EE.
String retryName;
if (name.startsWith("javax."))
retryName = "jakarta." + name.substring(6);
else if (name.startsWith("jakarta."))
retryName = "javax." + name.substring(8);
else
retryName = null;
if (retryName != null) {
// First, try to find the class by name.
provider = classProviders.getReference(retryName);
if (provider != null) {
return loadClass(provider, retryName);
}
// Next, try to find the class by package.
index = retryName.lastIndexOf('.');
if (index != -1) {
String pkg = retryName.substring(0, index);
provider = packageProviders.getReference(pkg);
if (provider != null) {
return loadClass(provider, retryName);
}
}
}
return null;
} | Class<?> loadClass(String name) throws ClassNotFoundException { ServiceReference<DeserializationClassProvider> provider = classProviders.getReference(name); if (provider != null) { return loadClass(provider, name); } int index = name.lastIndexOf('.'); if (index != -1) { String pkg = name.substring(0, index); provider = packageProviders.getReference(pkg); if (provider != null) { return loadClass(provider, name); } } String retryName; if (name.startsWith(STR)) retryName = STR + name.substring(6); else if (name.startsWith(STR)) retryName = STR + name.substring(8); else retryName = null; if (retryName != null) { provider = classProviders.getReference(retryName); if (provider != null) { return loadClass(provider, retryName); } index = retryName.lastIndexOf('.'); if (index != -1) { String pkg = retryName.substring(0, index); provider = packageProviders.getReference(pkg); if (provider != null) { return loadClass(provider, retryName); } } } return null; } | /**
* Attempts to resolve a class from registered class providers.
*
* @param name the class name
* @return the class, or null if not found
* @throws ClassNotFoundException if a class provider claimed to provide a
* class or package, but its bundle did not contain the class
*/ | Attempts to resolve a class from registered class providers | loadClass | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.serialization/src/com/ibm/ws/serialization/internal/SerializationServiceImpl.java",
"license": "epl-1.0",
"size": 13025
} | [
"com.ibm.ws.serialization.DeserializationClassProvider",
"org.osgi.framework.ServiceReference"
] | import com.ibm.ws.serialization.DeserializationClassProvider; import org.osgi.framework.ServiceReference; | import com.ibm.ws.serialization.*; import org.osgi.framework.*; | [
"com.ibm.ws",
"org.osgi.framework"
] | com.ibm.ws; org.osgi.framework; | 2,763,266 |
public DrawerBuilder withActionBarDrawerToggle(@NonNull ActionBarDrawerToggle actionBarDrawerToggle) {
this.mActionBarDrawerToggleEnabled = true;
this.mActionBarDrawerToggle = actionBarDrawerToggle;
return this;
}
// defines if the drawer should scroll to top after click
protected boolean mScrollToTopAfterClick = false; | DrawerBuilder function(@NonNull ActionBarDrawerToggle actionBarDrawerToggle) { this.mActionBarDrawerToggleEnabled = true; this.mActionBarDrawerToggle = actionBarDrawerToggle; return this; } protected boolean mScrollToTopAfterClick = false; | /**
* Add a custom ActionBarDrawerToggle which will be used in combination with this drawer.
*
* @param actionBarDrawerToggle
* @return
*/ | Add a custom ActionBarDrawerToggle which will be used in combination with this drawer | withActionBarDrawerToggle | {
"repo_name": "democedes/MaterialDrawer",
"path": "library/src/main/java/com/mikepenz/materialdrawer/DrawerBuilder.java",
"license": "apache-2.0",
"size": 61635
} | [
"android.support.annotation.NonNull",
"android.support.v7.app.ActionBarDrawerToggle"
] | import android.support.annotation.NonNull; import android.support.v7.app.ActionBarDrawerToggle; | import android.support.annotation.*; import android.support.v7.app.*; | [
"android.support"
] | android.support; | 875,780 |
public void setMonthEndDateDao(MonthEndDateDao monthEndDateDao) {
this.monthEndDateDao = monthEndDateDao;
} | void function(MonthEndDateDao monthEndDateDao) { this.monthEndDateDao = monthEndDateDao; } | /**
* Sets the monthEndDateDao
*
* @param monthEndDateDao
*/ | Sets the monthEndDateDao | setMonthEndDateDao | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/module/endow/document/service/impl/MonthEndDateServiceImpl.java",
"license": "apache-2.0",
"size": 6879
} | [
"org.kuali.kfs.module.endow.dataaccess.MonthEndDateDao"
] | import org.kuali.kfs.module.endow.dataaccess.MonthEndDateDao; | import org.kuali.kfs.module.endow.dataaccess.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,979,244 |
@ManagedAttribute(description = "Timer Name")
public void setTimerName(String timerName) {
this.timerName = timerName;
} | @ManagedAttribute(description = STR) void function(String timerName) { this.timerName = timerName; } | /**
* The name of the timer
*/ | The name of the timer | setTimerName | {
"repo_name": "ramonmaruko/camel",
"path": "camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java",
"license": "apache-2.0",
"size": 7543
} | [
"org.apache.camel.api.management.ManagedAttribute"
] | import org.apache.camel.api.management.ManagedAttribute; | import org.apache.camel.api.management.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,865,200 |
public ServiceFuture<GatewayRouteListResultInner> beginGetLearnedRoutesAsync(String resourceGroupName, String virtualNetworkGatewayName, final ServiceCallback<GatewayRouteListResultInner> serviceCallback) {
return ServiceFuture.fromResponse(beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName), serviceCallback);
} | ServiceFuture<GatewayRouteListResultInner> function(String resourceGroupName, String virtualNetworkGatewayName, final ServiceCallback<GatewayRouteListResultInner> serviceCallback) { return ServiceFuture.fromResponse(beginGetLearnedRoutesWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName), serviceCallback); } | /**
* This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | This operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers | beginGetLearnedRoutesAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/VirtualNetworkGatewaysInner.java",
"license": "mit",
"size": 283551
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,140,004 |
public char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
int startCharacter = this.character;
int startLine = this.line;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c == 0) {
reader.reset();
this.index = startIndex;
this.character = startCharacter;
this.line = startLine;
return c;
}
} while (c != to);
} catch (IOException exc) {
throw new JSONException(exc);
}
back();
return c;
}
| char function(char to) throws JSONException { char c; try { int startIndex = this.index; int startCharacter = this.character; int startLine = this.line; reader.mark(Integer.MAX_VALUE); do { c = next(); if (c == 0) { reader.reset(); this.index = startIndex; this.character = startCharacter; this.line = startLine; return c; } } while (c != to); } catch (IOException exc) { throw new JSONException(exc); } back(); return c; } | /**
* Skip characters until the next character is the requested character.
* If the requested character is not found, no characters are skipped.
* @param to A character to skip to.
* @return The requested character, or zero if the requested character
* is not found.
*/ | Skip characters until the next character is the requested character. If the requested character is not found, no characters are skipped | skipTo | {
"repo_name": "spyhunter99/mil-sym-android",
"path": "renderer/src/main/java/sec/web/json/utilities/JSONTokener.java",
"license": "apache-2.0",
"size": 12714
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,792,225 |
private static void deleteFolder(File folder) {
File[] files = folder.listFiles();
if (files != null) { // some JVMs return null for empty dirs
for (File f : files) {
if (f.isDirectory()) {
deleteFolder(f);
} else {
f.delete();
}
}
}
folder.delete();
} | static void function(File folder) { File[] files = folder.listFiles(); if (files != null) { for (File f : files) { if (f.isDirectory()) { deleteFolder(f); } else { f.delete(); } } } folder.delete(); } | /**
* Function for deleting an entire database folder. USE WITH CARE!!!
*
* @param folder
*/ | Function for deleting an entire database folder. USE WITH CARE!! | deleteFolder | {
"repo_name": "lindareijnhoudt/neo4j-ehri-plugin",
"path": "ehri-extension/src/test/java/eu/ehri/extension/test/utils/ServerRunner.java",
"license": "gpl-3.0",
"size": 5120
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,866,381 |
Method[] methods = classFixed.getMethods();
int numNotMatched = 0;
int numPassed = 0;
int numFailed = 0;
for( Method fixedM : methods ) {
if( !isValid(fixedM))
continue;
Method commonM = null;
for( Method m : CommonOps.class.getMethods()) {
if( isMatch(fixedM,m)) {
commonM = m;
break;
}
}
if( commonM == null ) {
// System.out.println("not matched: "+fixedM.getName());
numNotMatched++;
continue;
}
if( compareToCommon(fixedM,commonM) ) {
numPassed++;
} else {
numFailed++;
System.out.println("Failed comparision to common: "+fixedM);
}
}
int numExpected = 28;
if( N > GenerateFixedOps.maxInverseSize ) {
numExpected -= 2;
}
assertEquals(0,numFailed);
assertEquals(2,numNotMatched);
assertEquals(numExpected,numPassed);
} | Method[] methods = classFixed.getMethods(); int numNotMatched = 0; int numPassed = 0; int numFailed = 0; for( Method fixedM : methods ) { if( !isValid(fixedM)) continue; Method commonM = null; for( Method m : CommonOps.class.getMethods()) { if( isMatch(fixedM,m)) { commonM = m; break; } } if( commonM == null ) { numNotMatched++; continue; } if( compareToCommon(fixedM,commonM) ) { numPassed++; } else { numFailed++; System.out.println(STR+fixedM); } } int numExpected = 28; if( N > GenerateFixedOps.maxInverseSize ) { numExpected -= 2; } assertEquals(0,numFailed); assertEquals(2,numNotMatched); assertEquals(numExpected,numPassed); } | /**
* Compares equivalent functions in FixedOps to CommonOps. Inputs are randomly generated
*/ | Compares equivalent functions in FixedOps to CommonOps. Inputs are randomly generated | compareToCommonOps | {
"repo_name": "sizuest/EMod",
"path": "ch.ethz.inspire.emod/ejml-v0.26-src/main/core/test/org/ejml/alg/fixed/CompareFixedToCommonOps.java",
"license": "gpl-3.0",
"size": 8177
} | [
"java.lang.reflect.Method",
"org.ejml.ops.CommonOps",
"org.junit.Assert"
] | import java.lang.reflect.Method; import org.ejml.ops.CommonOps; import org.junit.Assert; | import java.lang.reflect.*; import org.ejml.ops.*; import org.junit.*; | [
"java.lang",
"org.ejml.ops",
"org.junit"
] | java.lang; org.ejml.ops; org.junit; | 37,560 |
protected String getTitle(String text, FontMetrics fm, int availableWidth)
{
Rectangle vr = new Rectangle(0, 0, availableWidth, fm.getHeight());
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
String value = SwingUtilities.layoutCompoundLabel(this, fm, text, null,
SwingConstants.CENTER,
SwingConstants.LEFT,
SwingConstants.CENTER,
SwingConstants.LEFT, vr,
ir, tr, 0);
return value;
} | String function(String text, FontMetrics fm, int availableWidth) { Rectangle vr = new Rectangle(0, 0, availableWidth, fm.getHeight()); Rectangle ir = new Rectangle(); Rectangle tr = new Rectangle(); String value = SwingUtilities.layoutCompoundLabel(this, fm, text, null, SwingConstants.CENTER, SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.LEFT, vr, ir, tr, 0); return value; } | /**
* This method returns the title string based on the available width and the
* font metrics.
*
* @param text The desired title.
* @param fm The FontMetrics of the font used.
* @param availableWidth The available width.
*
* @return The allowable string.
*/ | This method returns the title string based on the available width and the font metrics | getTitle | {
"repo_name": "aosm/gcc_40",
"path": "libjava/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java",
"license": "gpl-2.0",
"size": 26610
} | [
"java.awt.FontMetrics",
"java.awt.Rectangle",
"javax.swing.SwingConstants",
"javax.swing.SwingUtilities"
] | import java.awt.FontMetrics; import java.awt.Rectangle; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 644,371 |
public AddressProblems getAddressProblems() {
AddressProblems problems = new AddressProblems();
AddressData addressData = getAddressData();
verifier.verify(addressData, problems);
return problems;
} | AddressProblems function() { AddressProblems problems = new AddressProblems(); AddressData addressData = getAddressData(); verifier.verify(addressData, problems); return problems; } | /**
* Get problems found in the address data entered by the user.
*/ | Get problems found in the address data entered by the user | getAddressProblems | {
"repo_name": "dlyongemallo/libaddressinput",
"path": "android/src/main/java/com/android/i18n/addressinput/AddressWidget.java",
"license": "apache-2.0",
"size": 31448
} | [
"com.google.i18n.addressinput.common.AddressData",
"com.google.i18n.addressinput.common.AddressProblems"
] | import com.google.i18n.addressinput.common.AddressData; import com.google.i18n.addressinput.common.AddressProblems; | import com.google.i18n.addressinput.common.*; | [
"com.google.i18n"
] | com.google.i18n; | 155,461 |
public static void setServicesEnabled(Context context) {
int acctLength = Preferences.getPreferences(context).getAvailableAccounts().size();
setServicesEnabled(context, acctLength > 0, null);
} | static void function(Context context) { int acctLength = Preferences.getPreferences(context).getAvailableAccounts().size(); setServicesEnabled(context, acctLength > 0, null); } | /**
* Called throughout the application when the number of accounts has changed. This method
* enables or disables the Compose activity, the boot receiver and the service based on
* whether any accounts are configured.
*/ | Called throughout the application when the number of accounts has changed. This method enables or disables the Compose activity, the boot receiver and the service based on whether any accounts are configured | setServicesEnabled | {
"repo_name": "sanderbaas/k-9",
"path": "k9mail/src/main/java/com/fsck/k9/K9.java",
"license": "bsd-3-clause",
"size": 52902
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 328,513 |
public PDDocument getDestination()
{
return this.destination;
} | PDDocument function() { return this.destination; } | /**
* Returns the destination PDF document this cloner instance is set up for.
* @return the destination PDF document
*/ | Returns the destination PDF document this cloner instance is set up for | getDestination | {
"repo_name": "ChunghwaTelecom/pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/multipdf/PDFCloneUtility.java",
"license": "apache-2.0",
"size": 8516
} | [
"org.apache.pdfbox.pdmodel.PDDocument"
] | import org.apache.pdfbox.pdmodel.PDDocument; | import org.apache.pdfbox.pdmodel.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 1,412,845 |
public byte[] bytes() {
return Arrays.copyOf(this._bytes, this._bytes.length);
} | byte[] function() { return Arrays.copyOf(this._bytes, this._bytes.length); } | /**
* Getter for the sequence's bytes
*
* @return array of bytes
*/ | Getter for the sequence's bytes | bytes | {
"repo_name": "Johennes/jEXIF",
"path": "src/main/java/jExif/core/ByteSequence.java",
"license": "mit",
"size": 5804
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 275,253 |
public final List<ExchangeRate> getExchangeRateChain() {
return this.chain;
} | final List<ExchangeRate> function() { return this.chain; } | /**
* Access the chain of exchange rates.
*
* @return the chain of rates, in case of a derived rate, this may be
* several instances. For a direct exchange rate, this equals to
* <code>new ExchangeRate[]{this}</code>.
*/ | Access the chain of exchange rates | getExchangeRateChain | {
"repo_name": "JavaMoney/jsr354-ri-bp",
"path": "src/main/java/org/javamoney/moneta/convert/DefaultExchangeRate.java",
"license": "apache-2.0",
"size": 11042
} | [
"java.util.List",
"javax.money.convert.ExchangeRate"
] | import java.util.List; import javax.money.convert.ExchangeRate; | import java.util.*; import javax.money.convert.*; | [
"java.util",
"javax.money"
] | java.util; javax.money; | 2,390,909 |
@Test
@SuppressWarnings("rawtypes")
@Ignore
public void testReduceFastProcessingTime() throws Exception {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setStreamTimeCharacteristic(TimeCharacteristic.ProcessingTime);
DataStream<Tuple2<String, Integer>> source = env.fromElements(Tuple2.of("hello", 1), Tuple2.of("hello", 2));
DataStream<Tuple2<String, Integer>> window = source
.windowAll(SlidingProcessingTimeWindows.of(Time.of(1, TimeUnit.SECONDS), Time.of(100, TimeUnit.MILLISECONDS)))
.reduce(new DummyReducer());
OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>> transform =
(OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>>) window.getTransformation();
OneInputStreamOperator<Tuple2<String, Integer>, Tuple2<String, Integer>> operator = transform.getOperator();
Assert.assertTrue(operator instanceof AggregatingProcessingTimeWindowOperator);
processElementAndEnsureOutput(operator, null, BasicTypeInfo.STRING_TYPE_INFO, new Tuple2<>("hello", 1));
} | @SuppressWarnings(STR) void function() throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); env.setStreamTimeCharacteristic(TimeCharacteristic.ProcessingTime); DataStream<Tuple2<String, Integer>> source = env.fromElements(Tuple2.of("hello", 1), Tuple2.of("hello", 2)); DataStream<Tuple2<String, Integer>> window = source .windowAll(SlidingProcessingTimeWindows.of(Time.of(1, TimeUnit.SECONDS), Time.of(100, TimeUnit.MILLISECONDS))) .reduce(new DummyReducer()); OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>> transform = (OneInputTransformation<Tuple2<String, Integer>, Tuple2<String, Integer>>) window.getTransformation(); OneInputStreamOperator<Tuple2<String, Integer>, Tuple2<String, Integer>> operator = transform.getOperator(); Assert.assertTrue(operator instanceof AggregatingProcessingTimeWindowOperator); processElementAndEnsureOutput(operator, null, BasicTypeInfo.STRING_TYPE_INFO, new Tuple2<>("hello", 1)); } | /**
* Ignored because we currently don't have the fast processing-time window operator.
*/ | Ignored because we currently don't have the fast processing-time window operator | testReduceFastProcessingTime | {
"repo_name": "fanyon/flink",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/AllWindowTranslationTest.java",
"license": "apache-2.0",
"size": 77653
} | [
"java.util.concurrent.TimeUnit",
"org.apache.flink.api.common.typeinfo.BasicTypeInfo",
"org.apache.flink.api.java.tuple.Tuple2",
"org.apache.flink.streaming.api.TimeCharacteristic",
"org.apache.flink.streaming.api.datastream.DataStream",
"org.apache.flink.streaming.api.environment.StreamExecutionEnvironment",
"org.apache.flink.streaming.api.operators.OneInputStreamOperator",
"org.apache.flink.streaming.api.transformations.OneInputTransformation",
"org.apache.flink.streaming.api.windowing.assigners.SlidingProcessingTimeWindows",
"org.apache.flink.streaming.api.windowing.time.Time",
"org.junit.Assert"
] | import java.util.concurrent.TimeUnit; import org.apache.flink.api.common.typeinfo.BasicTypeInfo; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.streaming.api.TimeCharacteristic; import org.apache.flink.streaming.api.datastream.DataStream; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.api.operators.OneInputStreamOperator; import org.apache.flink.streaming.api.transformations.OneInputTransformation; import org.apache.flink.streaming.api.windowing.assigners.SlidingProcessingTimeWindows; import org.apache.flink.streaming.api.windowing.time.Time; import org.junit.Assert; | import java.util.concurrent.*; import org.apache.flink.api.common.typeinfo.*; import org.apache.flink.api.java.tuple.*; import org.apache.flink.streaming.api.*; import org.apache.flink.streaming.api.datastream.*; import org.apache.flink.streaming.api.environment.*; import org.apache.flink.streaming.api.operators.*; import org.apache.flink.streaming.api.transformations.*; import org.apache.flink.streaming.api.windowing.assigners.*; import org.apache.flink.streaming.api.windowing.time.*; import org.junit.*; | [
"java.util",
"org.apache.flink",
"org.junit"
] | java.util; org.apache.flink; org.junit; | 57,086 |
public static void instantiateSelf(File project, Map<String, Object> arguments)
throws PersistenceException, VilException {
// This is the usual way:
VilArgumentProvider provider = createArgumentProvider(arguments);
LowlevelCommands.loadProject(project);
String projectName = ProjectNameMapper.getInstance().getName(project);
PLPInfo plp = LowlevelCommands.getProject(projectName);
if (null != plp) {
InstantiationListener listener = new InstantiationListener();
plp.addVilExecutionListener(listener);
plp.instantiate(ProgressObserver.NO_OBSERVER, true);
if (null != listener.exc) {
throw listener.exc;
}
} else {
throw new PersistenceException("Project \"" + projectName + "\" could not be loaded.");
}
VilArgumentProvider.remove(provider); // works with null as argument
} | static void function(File project, Map<String, Object> arguments) throws PersistenceException, VilException { VilArgumentProvider provider = createArgumentProvider(arguments); LowlevelCommands.loadProject(project); String projectName = ProjectNameMapper.getInstance().getName(project); PLPInfo plp = LowlevelCommands.getProject(projectName); if (null != plp) { InstantiationListener listener = new InstantiationListener(); plp.addVilExecutionListener(listener); plp.instantiate(ProgressObserver.NO_OBSERVER, true); if (null != listener.exc) { throw listener.exc; } } else { throw new PersistenceException(STRSTR\STR); } VilArgumentProvider.remove(provider); } | /**
* Instantiates the given project.
* The project must:
* <ul>
* <li>be a valid EASy project with the usual configuration files and folders.</li>
* <li>contain a frozen configuration</li>
* <li>contain VIL script which can be applied to itself</li>
* </ul>
*
* @param project The toplevel absolute folder of the project (must have a valid EASy structure)
* @param arguments a name-element mapping specifying the top-level parameter of a VIL instantiation (may
* be <b>null</b>)
*
* @throws PersistenceException Will be thrown if the project could not be loaded, e.g. if the project has no
* valid EASy structure.
* @throws VilException In case that artifact operations or script execution fails
*/ | Instantiates the given project. The project must: be a valid EASy project with the usual configuration files and folders. contain a frozen configuration contain VIL script which can be applied to itself | instantiateSelf | {
"repo_name": "SSEHUB/EASyProducer",
"path": "EASy-Standalone/EASyCommandLine/src/net/ssehub/easy/standalone/cmd/InstantiationCommands.java",
"license": "apache-2.0",
"size": 38211
} | [
"java.io.File",
"java.util.Map",
"net.ssehub.easy.basics.progress.ProgressObserver",
"net.ssehub.easy.instantiation.core.model.common.VilException",
"net.ssehub.easy.producer.core.mgmt.PLPInfo",
"net.ssehub.easy.producer.core.mgmt.VilArgumentProvider",
"net.ssehub.easy.producer.core.persistence.PersistenceException"
] | import java.io.File; import java.util.Map; import net.ssehub.easy.basics.progress.ProgressObserver; import net.ssehub.easy.instantiation.core.model.common.VilException; import net.ssehub.easy.producer.core.mgmt.PLPInfo; import net.ssehub.easy.producer.core.mgmt.VilArgumentProvider; import net.ssehub.easy.producer.core.persistence.PersistenceException; | import java.io.*; import java.util.*; import net.ssehub.easy.basics.progress.*; import net.ssehub.easy.instantiation.core.model.common.*; import net.ssehub.easy.producer.core.mgmt.*; import net.ssehub.easy.producer.core.persistence.*; | [
"java.io",
"java.util",
"net.ssehub.easy"
] | java.io; java.util; net.ssehub.easy; | 1,654,614 |
T visitNumberBuiltin_distanceTo(@NotNull SofaLangParser.NumberBuiltin_distanceToContext ctx); | T visitNumberBuiltin_distanceTo(@NotNull SofaLangParser.NumberBuiltin_distanceToContext ctx); | /**
* Visit a parse tree produced by {@link SofaLangParser#numberBuiltin_distanceTo}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>SofaLangParser#numberBuiltin_distanceTo</code> | visitNumberBuiltin_distanceTo | {
"repo_name": "mockillo/sofa",
"path": "sofa/src/com/tehforce/sofa/parser/SofaLangVisitor.java",
"license": "mit",
"size": 10535
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,875,752 |
public Map<AbstractProject,Integer> getDependencies() {
return getDependencies(false);
} | Map<AbstractProject,Integer> function() { return getDependencies(false); } | /**
* Gets the dependency to other existing builds in a map.
*/ | Gets the dependency to other existing builds in a map | getDependencies | {
"repo_name": "ErikVerheul/jenkins",
"path": "core/src/main/java/hudson/tasks/Fingerprinter.java",
"license": "mit",
"size": 16680
} | [
"hudson.model.AbstractProject",
"java.util.Map"
] | import hudson.model.AbstractProject; import java.util.Map; | import hudson.model.*; import java.util.*; | [
"hudson.model",
"java.util"
] | hudson.model; java.util; | 1,195,342 |
public PyJavaPackage makeJavaPackage(String name, String classes,
String jarfile) {
PyJavaPackage p = this.topLevelPackage;
if (name.length() != 0) {
p = p.addPackage(name, jarfile);
}
if (classes != null) {
p.addPlaceholders(classes);
}
return p;
}
private static class AccessVisitor extends ClassVisitor {
private int class_access;
public AccessVisitor() throws IOException {
super(Opcodes.ASM5);
} | PyJavaPackage function(String name, String classes, String jarfile) { PyJavaPackage p = this.topLevelPackage; if (name.length() != 0) { p = p.addPackage(name, jarfile); } if (classes != null) { p.addPlaceholders(classes); } return p; } private static class AccessVisitor extends ClassVisitor { private int class_access; public AccessVisitor() throws IOException { super(Opcodes.ASM5); } | /**
* Creates package/updates statically known classes info. Uses
* {@link PyJavaPackage#addPackage(java.lang.String, java.lang.String) },
* {@link PyJavaPackage#addPlaceholders}.
*
* @param name package name
* @param classes comma-separated string
* @param jarfile involved jarfile; can be null
* @return created/updated package
*/ | Creates package/updates statically known classes info. Uses <code>PyJavaPackage#addPackage(java.lang.String, java.lang.String) </code>, <code>PyJavaPackage#addPlaceholders</code> | makeJavaPackage | {
"repo_name": "tunneln/CarnotKE",
"path": "jyhton/src/org/python/core/packagecache/PackageManager.java",
"license": "apache-2.0",
"size": 6291
} | [
"java.io.IOException",
"org.objectweb.asm.ClassVisitor",
"org.objectweb.asm.Opcodes",
"org.python.core.PyJavaPackage"
] | import java.io.IOException; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.Opcodes; import org.python.core.PyJavaPackage; | import java.io.*; import org.objectweb.asm.*; import org.python.core.*; | [
"java.io",
"org.objectweb.asm",
"org.python.core"
] | java.io; org.objectweb.asm; org.python.core; | 2,096,336 |
public List<File> getInitScripts() {
return Collections.unmodifiableList(initScripts);
} | List<File> function() { return Collections.unmodifiableList(initScripts); } | /**
* Returns all explicitly added init scripts that will be run before the build starts. This list does not contain the user init script located in ${user.home}/.gradle/init.gradle, even though
* that init script will also be run.
*
* @return list of all explicitly added init scripts.
*/ | Returns all explicitly added init scripts that will be run before the build starts. This list does not contain the user init script located in ${user.home}/.gradle/init.gradle, even though that init script will also be run | getInitScripts | {
"repo_name": "robinverduijn/gradle",
"path": "subprojects/core-api/src/main/java/org/gradle/StartParameter.java",
"license": "apache-2.0",
"size": 27616
} | [
"java.io.File",
"java.util.Collections",
"java.util.List"
] | import java.io.File; import java.util.Collections; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,012,873 |
public void resizeDisplay(int w, int h) throws IOException;
| void function(int w, int h) throws IOException; | /**
* Resizes the screen without resetting the display
*
* @param w the width
* @param h the height
*/ | Resizes the screen without resetting the display | resizeDisplay | {
"repo_name": "appnativa/rare",
"path": "source/tenletd/com/appnativa/rare/terminal/iDisplay.java",
"license": "gpl-3.0",
"size": 15301
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,282,685 |
public Application_EntitlementService getApplication_EntitlementService() {
return application_EntitlementService;
} | Application_EntitlementService function() { return application_EntitlementService; } | /**
* Returns the application_ entitlement remote service.
*
* @return the application_ entitlement remote service
*/ | Returns the application_ entitlement remote service | getApplication_EntitlementService | {
"repo_name": "fraunhoferfokus/govapps",
"path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/base/CategoryLocalServiceBaseImpl.java",
"license": "bsd-3-clause",
"size": 42077
} | [
"de.fraunhofer.fokus.movepla.service.EntitlementService"
] | import de.fraunhofer.fokus.movepla.service.EntitlementService; | import de.fraunhofer.fokus.movepla.service.*; | [
"de.fraunhofer.fokus"
] | de.fraunhofer.fokus; | 2,022,477 |
public void changeHorizontalOffset() {
int windowWidth = com.google.gwt.user.client.Window.getClientWidth();
setLeft(windowWidth - ICON_WIDTH - OFFSET_RIGHT);//compensate for smargwt scrollbar, so subtract some more
} | void function() { int windowWidth = com.google.gwt.user.client.Window.getClientWidth(); setLeft(windowWidth - ICON_WIDTH - OFFSET_RIGHT); } | /**
* called on initiation, as well as window resize
* @param offset
*/ | called on initiation, as well as window resize | changeHorizontalOffset | {
"repo_name": "JervenBolleman/yasgui",
"path": "src/main/java/com/data2semantics/yasgui/client/tab/optionbar/LinkCreator.java",
"license": "mit",
"size": 8665
} | [
"com.smartgwt.client.widgets.Window"
] | import com.smartgwt.client.widgets.Window; | import com.smartgwt.client.widgets.*; | [
"com.smartgwt.client"
] | com.smartgwt.client; | 7,654 |
public Map<String, String> getQueryStringParameters() {
return queryStringParameters;
} | Map<String, String> function() { return queryStringParameters; } | /**
* Returns the query string parameters
*
* @return queryStringParameters The query string parameters
*/ | Returns the query string parameters | getQueryStringParameters | {
"repo_name": "tdsis/lambda-forest",
"path": "src/main/java/br/com/tdsis/lambda/forest/domain/LambdaRequestSpec.java",
"license": "mit",
"size": 4365
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 441,128 |
public static Image capture(final ImageCaptureService captureService, String timecode, final File file)
throws ImageCaptureException {
Image image = null;
if (log.isDebugEnabled()) {
log.debug("Grabbing a frame");
}
try {
image = captureService.capture(timecode);
Runnable saveRunnable = new SaveImageRunnable(ImageUtilities.toBufferedImage(image), file);
(new Thread(saveRunnable, "ImageIO-" + file.getName())).run();
}
catch (Exception ex) {
throw new ImageCaptureException("Failed to create " + file.getAbsolutePath(), ex);
}
return image;
} | static Image function(final ImageCaptureService captureService, String timecode, final File file) throws ImageCaptureException { Image image = null; if (log.isDebugEnabled()) { log.debug(STR); } try { image = captureService.capture(timecode); Runnable saveRunnable = new SaveImageRunnable(ImageUtilities.toBufferedImage(image), file); (new Thread(saveRunnable, STR + file.getName())).run(); } catch (Exception ex) { throw new ImageCaptureException(STR + file.getAbsolutePath(), ex); } return image; } | /**
* Capture and image from the grabber. The image is written to disk in a
* background thread so the method doesn't block while an image is written.
*
* @param captureService The grabber to use to capture the image
* @param timecode
* @param file The name of the file to save the image to.
* @return An AWT image object of the captured image.
*
*
* @throws ImageCaptureException
*/ | Capture and image from the grabber. The image is written to disk in a background thread so the method doesn't block while an image is written | capture | {
"repo_name": "sanyaade-mediadev/vars",
"path": "vars-annotation/src/main/java/vars/annotation/ui/video/ImageCaptureUtilities.java",
"license": "lgpl-2.1",
"size": 4798
} | [
"java.awt.Image",
"java.io.File",
"org.mbari.awt.image.ImageUtilities"
] | import java.awt.Image; import java.io.File; import org.mbari.awt.image.ImageUtilities; | import java.awt.*; import java.io.*; import org.mbari.awt.image.*; | [
"java.awt",
"java.io",
"org.mbari.awt"
] | java.awt; java.io; org.mbari.awt; | 874,585 |
public void write(byte[] bytes) {
try {
mmOutStream.write(bytes);
mHandler.sendBytesWritten(bytes);
} catch (IOException e) {
Log.e(TAG, "Exception during write", e);
}
} | void function(byte[] bytes) { try { mmOutStream.write(bytes); mHandler.sendBytesWritten(bytes); } catch (IOException e) { Log.e(TAG, STR, e); } } | /**
* Write to the connected OutStream.
*
* @param bytes The bytes to write
*/ | Write to the connected OutStream | write | {
"repo_name": "PeterIJia/android_xlight",
"path": "app/src/main/java/com/umarbhutta/xlightcompanion/SDK/BLE/BLEDeviceConnector.java",
"license": "apache-2.0",
"size": 11334
} | [
"android.util.Log",
"java.io.IOException"
] | import android.util.Log; import java.io.IOException; | import android.util.*; import java.io.*; | [
"android.util",
"java.io"
] | android.util; java.io; | 2,706,939 |
// If we're the client and we haven't given an output frame, we shouldn't be processing any
// bytes.
if (outputFrame == null && isClient) {
return true;
}
// If we already have bytes to write, just return.
if (outputFrame != null && outputFrame.hasRemaining()) {
return true;
}
int remaining = bytes.remaining();
// Call handshaker service to proceess the bytes.
if (outputFrame == null) {
checkState(!isClient, "Client handshaker should not process any frame at the beginning.");
outputFrame = handshaker.startServerHandshake(bytes);
} else {
logger.log(ChannelLogLevel.DEBUG, "Receive ALTS handshake from downstream");
outputFrame = handshaker.next(bytes);
}
// If handshake has finished or we already have bytes to write, just return true.
if (handshaker.isFinished() || outputFrame.hasRemaining()) {
return true;
}
// We have done processing input bytes, but no bytes to write. Thus we need more data.
if (!bytes.hasRemaining()) {
return false;
}
// There are still remaining bytes. Thus we need to continue processing the bytes.
// Prevent infinite loop by checking some bytes are consumed by handshaker.
checkState(bytes.remaining() < remaining, "Handshaker did not consume any bytes.");
return processBytesFromPeer(bytes);
} | if (outputFrame == null && isClient) { return true; } if (outputFrame != null && outputFrame.hasRemaining()) { return true; } int remaining = bytes.remaining(); if (outputFrame == null) { checkState(!isClient, STR); outputFrame = handshaker.startServerHandshake(bytes); } else { logger.log(ChannelLogLevel.DEBUG, STR); outputFrame = handshaker.next(bytes); } if (handshaker.isFinished() outputFrame.hasRemaining()) { return true; } if (!bytes.hasRemaining()) { return false; } checkState(bytes.remaining() < remaining, STR); return processBytesFromPeer(bytes); } | /**
* Process the bytes received from the peer.
*
* @param bytes The buffer containing the handshake bytes from the peer.
* @return true, if the handshake has all the data it needs to process and false, if the method
* must be called again to complete processing.
*/ | Process the bytes received from the peer | processBytesFromPeer | {
"repo_name": "dapengzhang0/grpc-java",
"path": "alts/src/main/java/io/grpc/alts/internal/AltsTsiHandshaker.java",
"license": "apache-2.0",
"size": 8365
} | [
"com.google.common.base.Preconditions",
"io.grpc.ChannelLogger"
] | import com.google.common.base.Preconditions; import io.grpc.ChannelLogger; | import com.google.common.base.*; import io.grpc.*; | [
"com.google.common",
"io.grpc"
] | com.google.common; io.grpc; | 2,626,172 |
public void run() {
try {
final ServerBootstrap bootstrap = createServerBootStrap();
bootstrap.setOption("reuseAddr", true);
bootstrap.setOption("child.keepAlive", true);
bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);
ChannelPipelineFactory pfact = new BGPPipelineFactory(bgpCtrlImpl, true);
bootstrap.setPipelineFactory(pfact);
InetSocketAddress sa = new InetSocketAddress(getBgpPortNum());
cg = new DefaultChannelGroup();
cg.add(bootstrap.bind(sa));
log.info("Listening for Peer connection on {}", sa);
} catch (Exception e) {
throw new RuntimeException(e);
}
} | void function() { try { final ServerBootstrap bootstrap = createServerBootStrap(); bootstrap.setOption(STR, true); bootstrap.setOption(STR, true); bootstrap.setOption(STR, true); bootstrap.setOption(STR, Controller.SEND_BUFFER_SIZE); ChannelPipelineFactory pfact = new BGPPipelineFactory(bgpCtrlImpl, true); bootstrap.setPipelineFactory(pfact); InetSocketAddress sa = new InetSocketAddress(getBgpPortNum()); cg = new DefaultChannelGroup(); cg.add(bootstrap.bind(sa)); log.info(STR, sa); } catch (Exception e) { throw new RuntimeException(e); } } | /**
* Tell controller that we're ready to accept bgp peer connections.
*/ | Tell controller that we're ready to accept bgp peer connections | run | {
"repo_name": "packet-tracker/onos-1.4.0-custom-build",
"path": "bgp/ctl/src/main/java/org/onosproject/bgp/controller/impl/Controller.java",
"license": "apache-2.0",
"size": 5600
} | [
"java.net.InetSocketAddress",
"org.jboss.netty.bootstrap.ServerBootstrap",
"org.jboss.netty.channel.ChannelPipelineFactory",
"org.jboss.netty.channel.group.DefaultChannelGroup"
] | import java.net.InetSocketAddress; import org.jboss.netty.bootstrap.ServerBootstrap; import org.jboss.netty.channel.ChannelPipelineFactory; import org.jboss.netty.channel.group.DefaultChannelGroup; | import java.net.*; import org.jboss.netty.bootstrap.*; import org.jboss.netty.channel.*; import org.jboss.netty.channel.group.*; | [
"java.net",
"org.jboss.netty"
] | java.net; org.jboss.netty; | 1,214,989 |
public List<Integer> findIllusIndexes(int image) {
List<Integer> result = new ArrayList<Integer>();
for (int i = 0; i < map.length; i++) {
if (map[i] == image) {
result.add(i);
}
}
return result;
} | List<Integer> function(int image) { List<Integer> result = new ArrayList<Integer>(); for (int i = 0; i < map.length; i++) { if (map[i] == image) { result.add(i); } } return result; } | /**
* Return illustration indexes for given image in a book.
*/ | Return illustration indexes for given image in a book | findIllusIndexes | {
"repo_name": "jhu-digital-manuscripts/rosa",
"path": "rosa-sharedcanvas-endpoint/src/main/java/rose/m3/RosaCollection.java",
"license": "apache-2.0",
"size": 12449
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 850,034 |
Collection<T> getWars(); | Collection<T> getWars(); | /**
* Gets wars
*
* @return the list
*/ | Gets wars | getWars | {
"repo_name": "MarcinWieczorek/NovaGuilds",
"path": "src/main/java/co/marcin/novaguilds/api/basic/NovaGuild.java",
"license": "gpl-3.0",
"size": 12616
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,075,990 |
@SimpleProperty(
category = PropertyCategory.APPEARANCE)
public int BackgroundColor() {
return backgroundColor;
} | @SimpleProperty( category = PropertyCategory.APPEARANCE) int function() { return backgroundColor; } | /**
* Returns the label's background color as an alpha-red-green-blue
* integer.
*
* @return background RGB color with alpha
*/ | Returns the label's background color as an alpha-red-green-blue integer | BackgroundColor | {
"repo_name": "shilpamagrawal15/appinventor-sources",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Label.java",
"license": "mit",
"size": 9456
} | [
"com.google.appinventor.components.annotations.PropertyCategory",
"com.google.appinventor.components.annotations.SimpleProperty"
] | import com.google.appinventor.components.annotations.PropertyCategory; import com.google.appinventor.components.annotations.SimpleProperty; | import com.google.appinventor.components.annotations.*; | [
"com.google.appinventor"
] | com.google.appinventor; | 2,654,793 |
public Method getReadMethod() {
if (m_Read != null)
return m_Read;
else
return m_Descriptor.getReadMethod();
} | Method function() { if (m_Read != null) return m_Read; else return m_Descriptor.getReadMethod(); } | /**
* Returns the read method.
*
* @return the method
*/ | Returns the read method | getReadMethod | {
"repo_name": "automenta/adams-core",
"path": "src/main/java/adams/gui/goe/PropertyPath.java",
"license": "gpl-3.0",
"size": 16580
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 286,184 |
@Test
public void testSetMany() {
final int MAX = 2000000;
BucketStack<Integer> bucket = new BucketStack<Integer>(10);
for (int i = 0; i < MAX; i++) {
bucket.push(i);
assertEquals(i+1, bucket.size());
assertEquals(i, (int)bucket.peek());
}
Iterator<Integer> iter = bucket.iterator();
for (int i = 0; i < MAX; i++) {
assertEquals(i, (int)iter.next());
}
} | void function() { final int MAX = 2000000; BucketStack<Integer> bucket = new BucketStack<Integer>(10); for (int i = 0; i < MAX; i++) { bucket.push(i); assertEquals(i+1, bucket.size()); assertEquals(i, (int)bucket.peek()); } Iterator<Integer> iter = bucket.iterator(); for (int i = 0; i < MAX; i++) { assertEquals(i, (int)iter.next()); } } | /**
* Test the set method sets the correct values.
*/ | Test the set method sets the correct values | testSetMany | {
"repo_name": "tzaeschke/zoodb",
"path": "tst/org/zoodb/test/util/BucketStackTest.java",
"license": "gpl-3.0",
"size": 8406
} | [
"java.util.Iterator",
"org.junit.Assert",
"org.zoodb.internal.util.BucketStack"
] | import java.util.Iterator; import org.junit.Assert; import org.zoodb.internal.util.BucketStack; | import java.util.*; import org.junit.*; import org.zoodb.internal.util.*; | [
"java.util",
"org.junit",
"org.zoodb.internal"
] | java.util; org.junit; org.zoodb.internal; | 1,507,002 |
@Test(timeout=60000)
public void testClear() throws Exception {
pool.setMaxTotal(2);
pool.setMaxTotalPerKey(2);
pool.setBlockWhenExhausted(false);
pool.addObject("one");
pool.addObject("one");
assertEquals(2, pool.getNumIdle());
pool.clear("one");
assertEquals(0, pool.getNumIdle());
assertEquals(0, pool.getNumIdle("one"));
String obj1 = pool.borrowObject("one");
String obj2 = pool.borrowObject("one");
pool.returnObject("one", obj1);
pool.returnObject("one", obj2);
pool.clear();
assertEquals(0, pool.getNumIdle());
assertEquals(0, pool.getNumIdle("one"));
pool.borrowObject("one");
pool.borrowObject("one");
pool.close();
} | @Test(timeout=60000) void function() throws Exception { pool.setMaxTotal(2); pool.setMaxTotalPerKey(2); pool.setBlockWhenExhausted(false); pool.addObject("one"); pool.addObject("one"); assertEquals(2, pool.getNumIdle()); pool.clear("one"); assertEquals(0, pool.getNumIdle()); assertEquals(0, pool.getNumIdle("one")); String obj1 = pool.borrowObject("one"); String obj2 = pool.borrowObject("one"); pool.returnObject("one", obj1); pool.returnObject("one", obj2); pool.clear(); assertEquals(0, pool.getNumIdle()); assertEquals(0, pool.getNumIdle("one")); pool.borrowObject("one"); pool.borrowObject("one"); pool.close(); } | /**
* POOL-192
* Verify that clear(key) does not leak capacity.
*
* @throws Exception May occur in some failure modes
*/ | POOL-192 Verify that clear(key) does not leak capacity | testClear | {
"repo_name": "hitwangyu/apache-common-pool2",
"path": "src/test/java/org/apache/commons/pool2/impl/TestGenericKeyedObjectPool.java",
"license": "apache-2.0",
"size": 90009
} | [
"org.junit.Assert",
"org.junit.Test"
] | import org.junit.Assert; import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,629,654 |
private void saveNotification(final GrapesNotification notification, final AbstractBuild<?, ?> build) {
final ResendBuildAction resendAction = new ResendBuildAction(notification);
// Check if the notification is valid before serializing it
if(!isValid(resendAction)){
GrapesPlugin.getLogger().log(Level.SEVERE, "[GRAPES] Malformed Grapes Notification: Grapes plugin is trying to serialize a notification provided by another plugin but failed to resolve the notification.");
return;
}
try{
final String serializedResend = JsonUtils.serialize(resendAction);
final File reportFolder = new File(GrapesPlugin.getBuildReportFolder(build).toURI());
FileUtils.serialize(reportFolder, serializedResend, getNotificationId(notification));
}catch (Exception e){
GrapesPlugin.getLogger().log(Level.SEVERE, "[GRAPES] Failed to serialized a resend action ", e);
}
} | void function(final GrapesNotification notification, final AbstractBuild<?, ?> build) { final ResendBuildAction resendAction = new ResendBuildAction(notification); if(!isValid(resendAction)){ GrapesPlugin.getLogger().log(Level.SEVERE, STR); return; } try{ final String serializedResend = JsonUtils.serialize(resendAction); final File reportFolder = new File(GrapesPlugin.getBuildReportFolder(build).toURI()); FileUtils.serialize(reportFolder, serializedResend, getNotificationId(notification)); }catch (Exception e){ GrapesPlugin.getLogger().log(Level.SEVERE, STR, e); } } | /**
* Serialize a resend action to be able to re-send the notification later
*
* @param notification GrapesNotification
* @param build AbstractBuild
*/ | Serialize a resend action to be able to re-send the notification later | saveNotification | {
"repo_name": "drautureau/grapes-jenkins-plugin",
"path": "src/main/java/org/axway/grapes/jenkins/notifications/NotificationHandler.java",
"license": "apache-2.0",
"size": 7079
} | [
"hudson.model.AbstractBuild",
"java.io.File",
"java.util.logging.Level",
"org.axway.grapes.commons.utils.FileUtils",
"org.axway.grapes.commons.utils.JsonUtils",
"org.axway.grapes.jenkins.GrapesPlugin",
"org.axway.grapes.jenkins.resend.ResendBuildAction"
] | import hudson.model.AbstractBuild; import java.io.File; import java.util.logging.Level; import org.axway.grapes.commons.utils.FileUtils; import org.axway.grapes.commons.utils.JsonUtils; import org.axway.grapes.jenkins.GrapesPlugin; import org.axway.grapes.jenkins.resend.ResendBuildAction; | import hudson.model.*; import java.io.*; import java.util.logging.*; import org.axway.grapes.commons.utils.*; import org.axway.grapes.jenkins.*; import org.axway.grapes.jenkins.resend.*; | [
"hudson.model",
"java.io",
"java.util",
"org.axway.grapes"
] | hudson.model; java.io; java.util; org.axway.grapes; | 1,214,918 |
private List sortStatistics(List statistics){
Comparator comparator = determineComparator();
Collections.sort(statistics, comparator);
return statistics;
}
| List function(List statistics){ Comparator comparator = determineComparator(); Collections.sort(statistics, comparator); return statistics; } | /**
* Sorting Utils
*/ | Sorting Utils | sortStatistics | {
"repo_name": "OpenCollabZA/sakai",
"path": "msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/ui/MessageForumStatisticsBean.java",
"license": "apache-2.0",
"size": 106347
} | [
"java.util.Collections",
"java.util.Comparator",
"java.util.List"
] | import java.util.Collections; import java.util.Comparator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,841,741 |
public void authorize(UserGroupInformation user, ConnectionHeader connection, InetAddress addr)
throws AuthorizationException {
if (authorize) {
Class<?> c = getServiceInterface(services, connection.getServiceName());
this.authManager.authorize(user != null ? user : null, c, getConf(), addr);
}
}
private static int NIO_BUFFER_LIMIT = 64 * 1024; //should not be more than 64KB. | void function(UserGroupInformation user, ConnectionHeader connection, InetAddress addr) throws AuthorizationException { if (authorize) { Class<?> c = getServiceInterface(services, connection.getServiceName()); this.authManager.authorize(user != null ? user : null, c, getConf(), addr); } } private static int NIO_BUFFER_LIMIT = 64 * 1024; | /**
* Authorize the incoming client connection.
*
* @param user client user
* @param connection incoming connection
* @param addr InetAddress of incoming connection
* @throws org.apache.hadoop.security.authorize.AuthorizationException when the client isn't authorized to talk the protocol
*/ | Authorize the incoming client connection | authorize | {
"repo_name": "narendragoyal/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java",
"license": "apache-2.0",
"size": 95004
} | [
"java.net.InetAddress",
"org.apache.hadoop.hbase.protobuf.generated.RPCProtos",
"org.apache.hadoop.security.UserGroupInformation",
"org.apache.hadoop.security.authorize.AuthorizationException"
] | import java.net.InetAddress; import org.apache.hadoop.hbase.protobuf.generated.RPCProtos; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.authorize.AuthorizationException; | import java.net.*; import org.apache.hadoop.hbase.protobuf.generated.*; import org.apache.hadoop.security.*; import org.apache.hadoop.security.authorize.*; | [
"java.net",
"org.apache.hadoop"
] | java.net; org.apache.hadoop; | 1,716,219 |
@Override
public InputStream getResourceAsStream(String name) {
log.debug("getResourceAsStream({})", name);
byte[] bytes = resources.get(name);
if (bytes != null) {
return new ByteArrayInputStream(bytes);
}
return null;
} | InputStream function(String name) { log.debug(STR, name); byte[] bytes = resources.get(name); if (bytes != null) { return new ByteArrayInputStream(bytes); } return null; } | /**
* Get resource input stream
*/ | Get resource input stream | getResourceAsStream | {
"repo_name": "Beau-M/document-management-system",
"path": "src/main/java/com/openkm/util/cl/BinaryClassLoader.java",
"license": "gpl-2.0",
"size": 4129
} | [
"java.io.ByteArrayInputStream",
"java.io.InputStream"
] | import java.io.ByteArrayInputStream; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 212,114 |
void postSchedule(ActionInfo actionInfo, ScheduleResult result); | void postSchedule(ActionInfo actionInfo, ScheduleResult result); | /**
* Called after and an Cmdlet get scheduled.
*
* @param actionInfo
* @param result
*/ | Called after and an Cmdlet get scheduled | postSchedule | {
"repo_name": "littlezhou/SSM-1",
"path": "smart-common/src/main/java/org/smartdata/model/action/ActionScheduler.java",
"license": "apache-2.0",
"size": 1907
} | [
"org.smartdata.model.ActionInfo"
] | import org.smartdata.model.ActionInfo; | import org.smartdata.model.*; | [
"org.smartdata.model"
] | org.smartdata.model; | 2,763,633 |
private boolean injectHibernateTransactionByAnnotation(Object targetObject,
Session defaultSession, boolean foundTarget) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, NoSuchFieldException {
Class testClass = targetObject.getClass();
while (isCandidadeClass(testClass)) {
Field[] campos = testClass.getDeclaredFields();
for (Field campo : campos) {
if (campo.isEnumConstant())
continue;
// test for "singletons"
campo.setAccessible(true);
Object fieldValue = campo.get(targetObject);
if ( (fieldValue!=null) && (campo.get(targetObject).equals(targetObject)) )
continue;
if (campo.getType().getName().equals(Transaction.class.getName())) {
if (campo.isAnnotationPresent(TransactionTarget.class)) {
String sessionName = campo.getAnnotation(TransactionTarget.class).value();
Transaction hibernateTransaction = null;
if ((sessionName==null) || (sessionName.equals("")) ) {
hibernateTransaction = defaultSession.getTransaction();
} else {
Session sessionObject = null;
try {
String sessionGetterName = getGetterName(sessionName);
Method sessionGetterMethod = targetObject.getClass().getDeclaredMethod(sessionGetterName, Session.class);
sessionObject = (Session) sessionGetterMethod.invoke(targetObject);
} catch (NoSuchMethodException e) {
Field sessionField = targetObject.getClass().getDeclaredField(sessionName);
sessionField.setAccessible(true);
sessionObject = (Session) sessionField.get(targetObject);
}
hibernateTransaction = sessionObject.getTransaction();
}
String setterName = getSetterName(campo.getName());
try {
Method setterMethod = targetObject.getClass().getDeclaredMethod(setterName, Transaction.class);
setterMethod.invoke(targetObject, hibernateTransaction);
foundTarget = true;
debugInfoTransactionInjectedByAnnotation(campo, testClass);
} catch (NoSuchMethodException e) {
campo.setAccessible(true);
campo.set(targetObject, hibernateTransaction);
foundTarget = true;
debugInfoTransactionInjectedByAnnotation(campo, testClass);
}
if (!hibernateTransaction.isActive())
hibernateTransaction.begin();
}
} else {
campo.setAccessible(true);
Object subField = campo.get(targetObject);
if (subField!=null) {
if (isCandidadeClass(campo.getType())) {
if (injectHibernateTransactionByAnnotation(subField, defaultSession, foundTarget))
foundTarget = true;
}
}
}
}
testClass = testClass.getSuperclass();
}
return foundTarget;
}
| boolean function(Object targetObject, Session defaultSession, boolean foundTarget) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, NoSuchFieldException { Class testClass = targetObject.getClass(); while (isCandidadeClass(testClass)) { Field[] campos = testClass.getDeclaredFields(); for (Field campo : campos) { if (campo.isEnumConstant()) continue; campo.setAccessible(true); Object fieldValue = campo.get(targetObject); if ( (fieldValue!=null) && (campo.get(targetObject).equals(targetObject)) ) continue; if (campo.getType().getName().equals(Transaction.class.getName())) { if (campo.isAnnotationPresent(TransactionTarget.class)) { String sessionName = campo.getAnnotation(TransactionTarget.class).value(); Transaction hibernateTransaction = null; if ((sessionName==null) (sessionName.equals("")) ) { hibernateTransaction = defaultSession.getTransaction(); } else { Session sessionObject = null; try { String sessionGetterName = getGetterName(sessionName); Method sessionGetterMethod = targetObject.getClass().getDeclaredMethod(sessionGetterName, Session.class); sessionObject = (Session) sessionGetterMethod.invoke(targetObject); } catch (NoSuchMethodException e) { Field sessionField = targetObject.getClass().getDeclaredField(sessionName); sessionField.setAccessible(true); sessionObject = (Session) sessionField.get(targetObject); } hibernateTransaction = sessionObject.getTransaction(); } String setterName = getSetterName(campo.getName()); try { Method setterMethod = targetObject.getClass().getDeclaredMethod(setterName, Transaction.class); setterMethod.invoke(targetObject, hibernateTransaction); foundTarget = true; debugInfoTransactionInjectedByAnnotation(campo, testClass); } catch (NoSuchMethodException e) { campo.setAccessible(true); campo.set(targetObject, hibernateTransaction); foundTarget = true; debugInfoTransactionInjectedByAnnotation(campo, testClass); } if (!hibernateTransaction.isActive()) hibernateTransaction.begin(); } } else { campo.setAccessible(true); Object subField = campo.get(targetObject); if (subField!=null) { if (isCandidadeClass(campo.getType())) { if (injectHibernateTransactionByAnnotation(subField, defaultSession, foundTarget)) foundTarget = true; } } } } testClass = testClass.getSuperclass(); } return foundTarget; } | /**
* Returns <b>true</b> if was found at least 1 annotated target for the Transaction in the ValueStack. Returns <b>false</b> instead.
* @param targetObject
* @param defaultSession - Default Hibernate Session Object for the annotated transaction object (if no value used in the @TransactionTarget)
* @param hibernateTransaction
* @param foundTarget
* @return
* @throws SecurityException
* @throws NoSuchMethodException
* @throws IllegalArgumentException
* @throws IllegalAccessException
* @throws InvocationTargetException
* @throws ClassNotFoundException
* @throws NoSuchFieldException
*/ | Returns true if was found at least 1 annotated target for the Transaction in the ValueStack. Returns false instead | injectHibernateTransactionByAnnotation | {
"repo_name": "javalover123/full-hibernate-plugin-for-struts2",
"path": "src/com/googlecode/s2hibernate/struts2/plugin/interceptors/SessionTransactionInjectorInterceptor.java",
"license": "apache-2.0",
"size": 35195
} | [
"com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget",
"java.lang.reflect.Field",
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method",
"org.hibernate.Session",
"org.hibernate.Transaction"
] | import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.hibernate.Session; import org.hibernate.Transaction; | import com.googlecode.s2hibernate.struts2.plugin.annotations.*; import java.lang.reflect.*; import org.hibernate.*; | [
"com.googlecode.s2hibernate",
"java.lang",
"org.hibernate"
] | com.googlecode.s2hibernate; java.lang; org.hibernate; | 547,816 |
public static double[] get(int nType, int nSize, boolean bNorm)
{
double[] aWin = new double[nSize];
double c = 2*Math.PI/(nSize-1);
switch (nType)
{
case TRIANGLE:
for (int i=0; i<nSize/2.; i++)
{
aWin[i ] = c*i;
aWin[nSize-1-i] = aWin[i];
}
break;
case BLACKMAN:
for (int i=0; i<nSize; i++)
aWin[i] = 0.42-0.5*Math.cos(i*c)+0.08*Math.cos(2*i*c);
break;
case HAMMING:
for (int i=0; i<nSize; i++)
aWin[i] = 0.54-0.46*Math.cos(i*c);
break;
case HANN:
for (int i=0; i<nSize; i++)
aWin[i] = 0.5-0.5*Math.cos(i*c);
break;
case GAUSS:
c = 1./(nSize/2);
for (int i=0; i<nSize/2.; i++)
{
aWin[(nSize/2)+i ] = Math.exp(-(2*Math.pow(i*c,2)));
aWin[(nSize/2)-1-i] = aWin[(nSize/2)+i];
}
break;
case SYMEXP:
c = 1./(nSize/2);
for (int i=0; i<nSize/2.; i++)
{
aWin[(nSize/2)+i ] = Math.exp(-(i*c));
aWin[(nSize/2)-1-i] = aWin[(nSize/2)+i];
}
break;
case BARTLETT:
for (int i=0; i<nSize/2; i++)
aWin[i] = (double)i/(double)(nSize/2);
for (int i=nSize/2; i<nSize; i++)
aWin[i] = (double)(nSize-1-i)/(double)(nSize/2);
break;
default:
for (int i=0; i<nSize; i++)
aWin[i]=1;
}
if (bNorm)
{
double nNorm = JlMath.rms(aWin);
for (int i=0; i<nSize; i++) aWin[i]/=nNorm;
// nNorm = 0.;
// for (int i=0; i<nSize; i++) nNorm+=aWin[i]*aWin[i];
// System.out.println("\n ::: Window eff. value: "+Math.sqrt(nNorm/nSize)+" :::");
}
return aWin;
}
| static double[] function(int nType, int nSize, boolean bNorm) { double[] aWin = new double[nSize]; double c = 2*Math.PI/(nSize-1); switch (nType) { case TRIANGLE: for (int i=0; i<nSize/2.; i++) { aWin[i ] = c*i; aWin[nSize-1-i] = aWin[i]; } break; case BLACKMAN: for (int i=0; i<nSize; i++) aWin[i] = 0.42-0.5*Math.cos(i*c)+0.08*Math.cos(2*i*c); break; case HAMMING: for (int i=0; i<nSize; i++) aWin[i] = 0.54-0.46*Math.cos(i*c); break; case HANN: for (int i=0; i<nSize; i++) aWin[i] = 0.5-0.5*Math.cos(i*c); break; case GAUSS: c = 1./(nSize/2); for (int i=0; i<nSize/2.; i++) { aWin[(nSize/2)+i ] = Math.exp(-(2*Math.pow(i*c,2))); aWin[(nSize/2)-1-i] = aWin[(nSize/2)+i]; } break; case SYMEXP: c = 1./(nSize/2); for (int i=0; i<nSize/2.; i++) { aWin[(nSize/2)+i ] = Math.exp(-(i*c)); aWin[(nSize/2)-1-i] = aWin[(nSize/2)+i]; } break; case BARTLETT: for (int i=0; i<nSize/2; i++) aWin[i] = (double)i/(double)(nSize/2); for (int i=nSize/2; i<nSize; i++) aWin[i] = (double)(nSize-1-i)/(double)(nSize/2); break; default: for (int i=0; i<nSize; i++) aWin[i]=1; } if (bNorm) { double nNorm = JlMath.rms(aWin); for (int i=0; i<nSize; i++) aWin[i]/=nNorm; } return aWin; } | /**
* Returns a windowing function.
*
* @param nType
* The window type, one of the <code>Window.XXX</code> constants.
* @param nSize
* The window size in samples.
* @param bNorm
* If <code>true</code>, the window's effective value will be normalized to 1, otherwise
* the window's maximal amplitude will be one
* @return An array with <code>nSize</code> elements containing the window.
*/ | Returns a windowing function | get | {
"repo_name": "matthias-wolff/jLab",
"path": "src/de/tucottbus/kt/jlab/signal/Window.java",
"license": "mit",
"size": 3676
} | [
"de.tucottbus.kt.jlab.kernel.JlMath"
] | import de.tucottbus.kt.jlab.kernel.JlMath; | import de.tucottbus.kt.jlab.kernel.*; | [
"de.tucottbus.kt"
] | de.tucottbus.kt; | 2,677,168 |
protected void addNamespacePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_TImport_namespace_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_TImport_namespace_feature", "_UI_TImport_type"),
ToscaPackage.Literals.TIMPORT__NAMESPACE,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), ToscaPackage.Literals.TIMPORT__NAMESPACE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Namespace feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Namespace feature. | addNamespacePropertyDescriptor | {
"repo_name": "patrickneubauer/XMLIntellEdit",
"path": "use-cases/TOSCA/eu.artist.tosca.edit/src/tosca/provider/TImportItemProvider.java",
"license": "mit",
"size": 5212
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 600,886 |
public void attachInput(Tuple t) {
input = t;
this.inputAttached = true;
} | void function(Tuple t) { input = t; this.inputAttached = true; } | /**
* Shorts the input path of this operator by providing the input tuple
* directly
*
* @param t -
* The tuple that should be used as input
*/ | Shorts the input path of this operator by providing the input tuple directly | attachInput | {
"repo_name": "miyakawataku/piggybank-ltsv",
"path": "src/org/apache/pig/backend/hadoop/executionengine/physicalLayer/PhysicalOperator.java",
"license": "apache-2.0",
"size": 17820
} | [
"org.apache.pig.data.Tuple"
] | import org.apache.pig.data.Tuple; | import org.apache.pig.data.*; | [
"org.apache.pig"
] | org.apache.pig; | 1,986,023 |
public void setMatParameter(String name, float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33) {
CGparameter p = CgGL.cgGetNamedParameter(currProgram, name);
if (p != null) {
float[] mat = new float[16];
mat[0] = m00;
mat[1] = m10;
mat[2] = m20;
mat[3] = m30;
mat[4] = m01;
mat[5] = m11;
mat[6] = m21;
mat[7] = m31;
mat[8] = m02;
mat[9] = m12;
mat[10] = m22;
mat[11] = m32;
mat[12] = m03;
mat[13] = m13;
mat[14] = m23;
mat[15] = m33;
CgGL.cgSetMatrixParameterfc(p, mat, 0);
}
} | void function(String name, float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) { CGparameter p = CgGL.cgGetNamedParameter(currProgram, name); if (p != null) { float[] mat = new float[16]; mat[0] = m00; mat[1] = m10; mat[2] = m20; mat[3] = m30; mat[4] = m01; mat[5] = m11; mat[6] = m21; mat[7] = m31; mat[8] = m02; mat[9] = m12; mat[10] = m22; mat[11] = m32; mat[12] = m03; mat[13] = m13; mat[14] = m23; mat[15] = m33; CgGL.cgSetMatrixParameterfc(p, mat, 0); } } | /**
* Sets the mat4 parameter with name to the given value
*
* @param name String
* @param m00 float
* ...
*/ | Sets the mat4 parameter with name to the given value | setMatParameter | {
"repo_name": "drakh/enterin_wodies",
"path": "processing_libraries/GLGraphics/src/codeanticode/glgraphics/GLCgShader.java",
"license": "cc0-1.0",
"size": 19659
} | [
"com.sun.opengl.cg.CGparameter",
"com.sun.opengl.cg.CgGL"
] | import com.sun.opengl.cg.CGparameter; import com.sun.opengl.cg.CgGL; | import com.sun.opengl.cg.*; | [
"com.sun.opengl"
] | com.sun.opengl; | 2,042,975 |
@Test
public void testToByteString() {
assertEquals(123, NumberUtils.toByte("123"), "toByte(String) 1 failed");
assertEquals(0, NumberUtils.toByte("abc"), "toByte(String) 2 failed");
assertEquals(0, NumberUtils.toByte(""), "toByte(empty) failed");
assertEquals(0, NumberUtils.toByte(null), "toByte(null) failed");
} | void function() { assertEquals(123, NumberUtils.toByte("123"), STR); assertEquals(0, NumberUtils.toByte("abc"), STR); assertEquals(0, NumberUtils.toByte(STRtoByte(empty) failedSTRtoByte(null) failed"); } | /**
* Test for {@link NumberUtils#toByte(String)}.
*/ | Test for <code>NumberUtils#toByte(String)</code> | testToByteString | {
"repo_name": "britter/commons-lang",
"path": "src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java",
"license": "apache-2.0",
"size": 85071
} | [
"org.junit.jupiter.api.Assertions"
] | import org.junit.jupiter.api.Assertions; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 1,351,408 |
public static MemoryUsage getSurvivorUsage() {
return getUsage(".*Survivor.*");
} | static MemoryUsage function() { return getUsage(STR); } | /**
* Get MemoryUsage of Survivor space.
*
* @return MemoryUsage
*/ | Get MemoryUsage of Survivor space | getSurvivorUsage | {
"repo_name": "FauxFaux/jdk9-hotspot",
"path": "test/testlibrary/jdk/test/lib/HeapRegionUsageTool.java",
"license": "gpl-2.0",
"size": 2984
} | [
"java.lang.management.MemoryUsage"
] | import java.lang.management.MemoryUsage; | import java.lang.management.*; | [
"java.lang"
] | java.lang; | 2,897,011 |
public OneResponse diskAttach(String diskTemplate)
{
return diskAttach(client, id, diskTemplate);
} | OneResponse function(String diskTemplate) { return diskAttach(client, id, diskTemplate); } | /**
* Attaches a disk to a running VM
*
* @param diskTemplate Template containing the new DISK definition
* @return If an error occurs the error message contains the reason.
*/ | Attaches a disk to a running VM | diskAttach | {
"repo_name": "fasrc/one",
"path": "src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java",
"license": "apache-2.0",
"size": 42810
} | [
"org.opennebula.client.OneResponse"
] | import org.opennebula.client.OneResponse; | import org.opennebula.client.*; | [
"org.opennebula.client"
] | org.opennebula.client; | 2,359,453 |
public static ZenodoDoiResult registerZenodoDOI(ApiClient zenodoClient, Workflow workflow,
WorkflowVersion workflowVersion, String workflowUrl, String dockstoreGA4GHBaseUrl,
String dockstoreUrl, EntryVersionHelper entryVersionHelper) {
DepositsApi depositApi = new DepositsApi(zenodoClient);
ActionsApi actionsApi = new ActionsApi(zenodoClient);
Deposit deposit = new Deposit();
Deposit returnDeposit;
checkForExistingDOIForWorkflowVersion(workflowVersion);
Optional<String> existingWorkflowVersionDOIURL = getAnExistingDOIForWorkflow(workflow);
int depositionID;
DepositMetadata depositMetadata;
String doiAlias;
if (existingWorkflowVersionDOIURL.isEmpty()) {
try {
// No DOI has been assigned to any version of the workflow yet
// So create a new deposit which will enable creation of a new
// concept DOI and new version DOI
returnDeposit = depositApi.createDeposit(deposit);
depositionID = returnDeposit.getId();
depositMetadata = returnDeposit.getMetadata();
// Set the attribute that will reserve a DOI before publishing
fillInMetadata(depositMetadata, workflow, workflowVersion);
depositMetadata.prereserveDoi(true);
// Put the deposit on Zenodo; the returned deposit will contain
// the reserved DOI which we can use to create a workflow alias
// Later on we will update the Zenodo deposit (put the deposit on
// Zenodo again in the call to putDepositionOnZenodo) so it contains the workflow version alias
// constructed with the DOI
Deposit newDeposit = putDepositionOnZenodo(depositApi, depositMetadata, depositionID);
depositMetadata.prereserveDoi(false);
// Retrieve the DOI so we can use it to create a Dockstore alias
// to the workflow; we will add that alias as a Zenodo related identifier
Map<String, String> doiMap = (Map<String, String>)newDeposit.getMetadata().getPrereserveDoi();
Map.Entry<String, String> doiEntry = doiMap.entrySet().iterator().next();
String doi = doiEntry.getValue();
doiAlias = createAliasUsingDoi(doi);
setMetadataRelatedIdentifiers(depositMetadata, dockstoreGA4GHBaseUrl,
dockstoreUrl, workflowUrl, workflow, workflowVersion, doiAlias);
} catch (ApiException e) {
LOG.error("Could not create deposition on Zenodo. Error is " + e.getMessage(), e);
throw new CustomWebApplicationException("Could not create deposition on Zenodo. "
+ "Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST);
}
} else {
String depositIdStr = existingWorkflowVersionDOIURL.get()
.substring(existingWorkflowVersionDOIURL.get().lastIndexOf(".") + 1).trim();
int depositId = Integer.parseInt(depositIdStr);
try {
// A DOI was previously assigned to a workflow version so we will
// use the ID associated with the workflow version DOI
// to create a new workflow version DOI
returnDeposit = actionsApi.newDepositVersion(depositId);
// The response body of this action is NOT the new version deposit,
// but the original resource. The new version deposition can be
// accessed through the "latest_draft" under "links" in the response body.
String depositURL = returnDeposit.getLinks().get("latest_draft");
String depositionIDStr = depositURL.substring(depositURL.lastIndexOf("/") + 1).trim();
// Get the deposit object for the new workflow version DOI
depositionID = Integer.parseInt(depositionIDStr);
returnDeposit = depositApi.getDeposit(depositionID);
depositMetadata = returnDeposit.getMetadata();
// Retrieve the DOI so we can use it to create a Dockstore alias
// to the workflow; we will add that alias as a Zenodo related identifier
String doi = depositMetadata.getDoi();
doiAlias = createAliasUsingDoi(doi);
setMetadataRelatedIdentifiers(depositMetadata, dockstoreGA4GHBaseUrl,
dockstoreUrl, workflowUrl, workflow, workflowVersion, doiAlias);
fillInMetadata(depositMetadata, workflow, workflowVersion);
} catch (ApiException e) {
LOG.error("Could not create new deposition version on Zenodo. Error is " + e.getMessage(), e);
throw new CustomWebApplicationException("Could not create new deposition version on Zenodo."
+ " Error is " + e.getMessage(), HttpStatus.SC_BAD_REQUEST);
}
}
provisionWorkflowVersionUploadFiles(zenodoClient, returnDeposit, depositionID,
workflow, workflowVersion, entryVersionHelper);
putDepositionOnZenodo(depositApi, depositMetadata, depositionID);
Deposit publishedDeposit = publishDepositOnZenodo(actionsApi, depositionID);
String conceptDoiUrl = publishedDeposit.getLinks().get("conceptdoi");
String conceptDoi = extractDoiFromDoiUrl(conceptDoiUrl);
return new ZenodoDoiResult(doiAlias, publishedDeposit.getMetadata().getDoi(), conceptDoi);
} | static ZenodoDoiResult function(ApiClient zenodoClient, Workflow workflow, WorkflowVersion workflowVersion, String workflowUrl, String dockstoreGA4GHBaseUrl, String dockstoreUrl, EntryVersionHelper entryVersionHelper) { DepositsApi depositApi = new DepositsApi(zenodoClient); ActionsApi actionsApi = new ActionsApi(zenodoClient); Deposit deposit = new Deposit(); Deposit returnDeposit; checkForExistingDOIForWorkflowVersion(workflowVersion); Optional<String> existingWorkflowVersionDOIURL = getAnExistingDOIForWorkflow(workflow); int depositionID; DepositMetadata depositMetadata; String doiAlias; if (existingWorkflowVersionDOIURL.isEmpty()) { try { returnDeposit = depositApi.createDeposit(deposit); depositionID = returnDeposit.getId(); depositMetadata = returnDeposit.getMetadata(); fillInMetadata(depositMetadata, workflow, workflowVersion); depositMetadata.prereserveDoi(true); Deposit newDeposit = putDepositionOnZenodo(depositApi, depositMetadata, depositionID); depositMetadata.prereserveDoi(false); Map<String, String> doiMap = (Map<String, String>)newDeposit.getMetadata().getPrereserveDoi(); Map.Entry<String, String> doiEntry = doiMap.entrySet().iterator().next(); String doi = doiEntry.getValue(); doiAlias = createAliasUsingDoi(doi); setMetadataRelatedIdentifiers(depositMetadata, dockstoreGA4GHBaseUrl, dockstoreUrl, workflowUrl, workflow, workflowVersion, doiAlias); } catch (ApiException e) { LOG.error(STR + e.getMessage(), e); throw new CustomWebApplicationException(STR + STR + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } } else { String depositIdStr = existingWorkflowVersionDOIURL.get() .substring(existingWorkflowVersionDOIURL.get().lastIndexOf(".") + 1).trim(); int depositId = Integer.parseInt(depositIdStr); try { returnDeposit = actionsApi.newDepositVersion(depositId); String depositURL = returnDeposit.getLinks().get(STR); String depositionIDStr = depositURL.substring(depositURL.lastIndexOf("/") + 1).trim(); depositionID = Integer.parseInt(depositionIDStr); returnDeposit = depositApi.getDeposit(depositionID); depositMetadata = returnDeposit.getMetadata(); String doi = depositMetadata.getDoi(); doiAlias = createAliasUsingDoi(doi); setMetadataRelatedIdentifiers(depositMetadata, dockstoreGA4GHBaseUrl, dockstoreUrl, workflowUrl, workflow, workflowVersion, doiAlias); fillInMetadata(depositMetadata, workflow, workflowVersion); } catch (ApiException e) { LOG.error(STR + e.getMessage(), e); throw new CustomWebApplicationException(STR + STR + e.getMessage(), HttpStatus.SC_BAD_REQUEST); } } provisionWorkflowVersionUploadFiles(zenodoClient, returnDeposit, depositionID, workflow, workflowVersion, entryVersionHelper); putDepositionOnZenodo(depositApi, depositMetadata, depositionID); Deposit publishedDeposit = publishDepositOnZenodo(actionsApi, depositionID); String conceptDoiUrl = publishedDeposit.getLinks().get(STR); String conceptDoi = extractDoiFromDoiUrl(conceptDoiUrl); return new ZenodoDoiResult(doiAlias, publishedDeposit.getMetadata().getDoi(), conceptDoi); } | /**
* Register a Zenodo DOI for the workflow version
* @param zenodoClient Client for interacting with Zenodo server
* @param workflow workflow for which DOI is registered
* @param workflowVersion workflow version for which DOI is registered
* @param workflowUrl Dockstore workflow URL (e.g. https://dockstore.org/workflows/github.com/DataBiosphere/topmed-workflows/UM_variant_caller_wdl)
* @param dockstoreGA4GHBaseUrl The baseURL for GA4GH tools endpoint (e.g. "http://localhost:8080/api/api/ga4gh/v2/tools/")
* @param dockstoreUrl URL for Dockstore (e.g. https://dockstore.org)
* @param entryVersionHelper provides interface for retrieving the files of versions
*/ | Register a Zenodo DOI for the workflow version | registerZenodoDOI | {
"repo_name": "ga4gh/dockstore",
"path": "dockstore-webservice/src/main/java/io/dockstore/webservice/helpers/ZenodoHelper.java",
"license": "apache-2.0",
"size": 27191
} | [
"io.dockstore.webservice.CustomWebApplicationException",
"io.dockstore.webservice.core.Workflow",
"io.dockstore.webservice.core.WorkflowVersion",
"io.swagger.zenodo.client.ApiClient",
"io.swagger.zenodo.client.ApiException",
"io.swagger.zenodo.client.api.ActionsApi",
"io.swagger.zenodo.client.api.DepositsApi",
"io.swagger.zenodo.client.model.Deposit",
"io.swagger.zenodo.client.model.DepositMetadata",
"java.util.Map",
"java.util.Optional",
"org.apache.http.HttpStatus"
] | import io.dockstore.webservice.CustomWebApplicationException; import io.dockstore.webservice.core.Workflow; import io.dockstore.webservice.core.WorkflowVersion; import io.swagger.zenodo.client.ApiClient; import io.swagger.zenodo.client.ApiException; import io.swagger.zenodo.client.api.ActionsApi; import io.swagger.zenodo.client.api.DepositsApi; import io.swagger.zenodo.client.model.Deposit; import io.swagger.zenodo.client.model.DepositMetadata; import java.util.Map; import java.util.Optional; import org.apache.http.HttpStatus; | import io.dockstore.webservice.*; import io.dockstore.webservice.core.*; import io.swagger.zenodo.client.*; import io.swagger.zenodo.client.api.*; import io.swagger.zenodo.client.model.*; import java.util.*; import org.apache.http.*; | [
"io.dockstore.webservice",
"io.swagger.zenodo",
"java.util",
"org.apache.http"
] | io.dockstore.webservice; io.swagger.zenodo; java.util; org.apache.http; | 65,850 |
public AbstractObservationDAO getObservationDAO()
throws OwsExceptionReport {
if (HibernateHelper.isEntitySupported(EReportingObservation.class)) {
return new EReportingObservationDAO();
} else if (HibernateHelper.isEntitySupported(SeriesObservation.class)) {
return new SeriesObservationDAO();
} else if (HibernateHelper.isEntitySupported(Observation.class)) {
return new ObservationDAO();
} else {
throw new NoApplicableCodeException()
.withMessage("Implemented observation DAO is missing!");
}
} | AbstractObservationDAO function() throws OwsExceptionReport { if (HibernateHelper.isEntitySupported(EReportingObservation.class)) { return new EReportingObservationDAO(); } else if (HibernateHelper.isEntitySupported(SeriesObservation.class)) { return new SeriesObservationDAO(); } else if (HibernateHelper.isEntitySupported(Observation.class)) { return new ObservationDAO(); } else { throw new NoApplicableCodeException() .withMessage(STR); } } | /**
* Get the currently supported Hibernate Observation data access
* implementation
*
* @return Currently supported Hibernate Observation data access
* implementation
*
* @throws OwsExceptionReport
* If no Hibernate Observation data access is supported
*/ | Get the currently supported Hibernate Observation data access implementation | getObservationDAO | {
"repo_name": "kinow/SOS",
"path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/DaoFactory.java",
"license": "gpl-2.0",
"size": 6522
} | [
"org.n52.sos.ds.hibernate.dao.ereporting.EReportingObservationDAO",
"org.n52.sos.ds.hibernate.dao.series.SeriesObservationDAO",
"org.n52.sos.ds.hibernate.entities.Observation",
"org.n52.sos.ds.hibernate.entities.ereporting.EReportingObservation",
"org.n52.sos.ds.hibernate.entities.series.SeriesObservation",
"org.n52.sos.ds.hibernate.util.HibernateHelper",
"org.n52.sos.exception.ows.NoApplicableCodeException",
"org.n52.sos.ogc.ows.OwsExceptionReport"
] | import org.n52.sos.ds.hibernate.dao.ereporting.EReportingObservationDAO; import org.n52.sos.ds.hibernate.dao.series.SeriesObservationDAO; import org.n52.sos.ds.hibernate.entities.Observation; import org.n52.sos.ds.hibernate.entities.ereporting.EReportingObservation; import org.n52.sos.ds.hibernate.entities.series.SeriesObservation; import org.n52.sos.ds.hibernate.util.HibernateHelper; import org.n52.sos.exception.ows.NoApplicableCodeException; import org.n52.sos.ogc.ows.OwsExceptionReport; | import org.n52.sos.ds.hibernate.dao.ereporting.*; import org.n52.sos.ds.hibernate.dao.series.*; import org.n52.sos.ds.hibernate.entities.*; import org.n52.sos.ds.hibernate.entities.ereporting.*; import org.n52.sos.ds.hibernate.entities.series.*; import org.n52.sos.ds.hibernate.util.*; import org.n52.sos.exception.ows.*; import org.n52.sos.ogc.ows.*; | [
"org.n52.sos"
] | org.n52.sos; | 1,946,038 |
long getRowCount(Session session); | long getRowCount(Session session); | /**
* Get the row count of this table, for the given session.
*
* @param session the session
* @return the row count
*/ | Get the row count of this table, for the given session | getRowCount | {
"repo_name": "miloszpiglas/h2mod",
"path": "src/main/org/h2/index/Index.java",
"license": "mpl-2.0",
"size": 6737
} | [
"org.h2.engine.Session"
] | import org.h2.engine.Session; | import org.h2.engine.*; | [
"org.h2.engine"
] | org.h2.engine; | 2,614,795 |
public void setMnemonic(AbstractButton b, String uiKey) {
// NOTE: Swing is misleading; it uses an integer value for the mnemonic
// but according to SwingUtilities.findDisplayedMnemonicIndex it is always
// the literal character for the mnemonic, and not anything fancy like
// an integer keycode
int mne = getI18NMnemonic(uiKey + ".mne");
if (mne != 0)
b.setMnemonic(mne);
}
//----------------------------------------------------------------------------
//
// check boxes | void function(AbstractButton b, String uiKey) { int mne = getI18NMnemonic(uiKey + ".mne"); if (mne != 0) b.setMnemonic(mne); } | /**
* Set the mnemonic a button.
* The resources used are:
* <table>
* <tr><td><i>uiKey</i>.mne <td>The keystroke to use
* </table>
* @param b the button to modify
* @param uiKey the base name of the resources to be used
* @see javax.swing.KeyStroke
*/ | Set the mnemonic a button. The resources used are: uiKey.mne The keystroke to use | setMnemonic | {
"repo_name": "otmarjr/jtreg-fork",
"path": "dist-with-aspectj/jtreg/lib/javatest/com/sun/javatest/tool/UIFactory.java",
"license": "gpl-2.0",
"size": 141944
} | [
"javax.swing.AbstractButton"
] | import javax.swing.AbstractButton; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,112,883 |
public static QuotaType toQuotaScope(final QuotaProtos.QuotaType proto) {
switch (proto) {
case THROTTLE: return QuotaType.THROTTLE;
}
throw new RuntimeException("Invalid QuotaType " + proto);
} | static QuotaType function(final QuotaProtos.QuotaType proto) { switch (proto) { case THROTTLE: return QuotaType.THROTTLE; } throw new RuntimeException(STR + proto); } | /**
* Convert a protocol buffer QuotaType to a client QuotaType
*
* @param proto
* @return the converted client QuotaType
*/ | Convert a protocol buffer QuotaType to a client QuotaType | toQuotaScope | {
"repo_name": "drewpope/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java",
"license": "apache-2.0",
"size": 114457
} | [
"org.apache.hadoop.hbase.protobuf.generated.QuotaProtos",
"org.apache.hadoop.hbase.quotas.QuotaType"
] | import org.apache.hadoop.hbase.protobuf.generated.QuotaProtos; import org.apache.hadoop.hbase.quotas.QuotaType; | import org.apache.hadoop.hbase.protobuf.generated.*; import org.apache.hadoop.hbase.quotas.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 106,074 |
Map<String, Object> parameters = null;
URI uriObj = new URI(uri);
if (query == null) {
parameters = URISupport.parseParameters(uriObj);
} else {
parameters = URISupport.parseQuery(query);
}
if (uriObj.getScheme().equals(GHTTPS_SCHEME)) {
uriObj = new URI(HTTPS_SCHEME + ":" + uriObj.getRawSchemeSpecificPart());
} else { // ghttp or anything else
uriObj = new URI(HTTP_SCHEME + ":" + uriObj.getRawSchemeSpecificPart());
}
return URISupport.createRemainingURI(uriObj, (Map)parameters).toURL();
} | Map<String, Object> parameters = null; URI uriObj = new URI(uri); if (query == null) { parameters = URISupport.parseParameters(uriObj); } else { parameters = URISupport.parseQuery(query); } if (uriObj.getScheme().equals(GHTTPS_SCHEME)) { uriObj = new URI(HTTPS_SCHEME + ":" + uriObj.getRawSchemeSpecificPart()); } else { uriObj = new URI(HTTP_SCHEME + ":" + uriObj.getRawSchemeSpecificPart()); } return URISupport.createRemainingURI(uriObj, (Map)parameters).toURL(); } | /**
* Constructs a {@link URL} from an <code>uri</code> and an optional
* <code>query</code> string. The encoding strategy follow those of the
* Camel HTTP component.
*
* @param uri
* must be encoded with
* {@link UnsafeUriCharactersEncoder#encode(String)}.
* @param query
* decoded query string. Replaces the query part of
* <code>uri</code> if not <code>null</code>.
*/ | Constructs a <code>URL</code> from an <code>uri</code> and an optional <code>query</code> string. The encoding strategy follow those of the Camel HTTP component | getEndpointUrl | {
"repo_name": "cexbrayat/camel",
"path": "components/camel-gae/src/main/java/org/apache/camel/component/gae/http/GHttpEndpoint.java",
"license": "apache-2.0",
"size": 6450
} | [
"java.util.Map",
"org.apache.camel.util.URISupport"
] | import java.util.Map; import org.apache.camel.util.URISupport; | import java.util.*; import org.apache.camel.util.*; | [
"java.util",
"org.apache.camel"
] | java.util; org.apache.camel; | 2,785,970 |
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
return args.length == 1 ? getListOfStringsMatchingLastWord(args, server.getPlayerList().getBannedIPs().getKeys()) : Collections.<String>emptyList();
} | List<String> function(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos) { return args.length == 1 ? getListOfStringsMatchingLastWord(args, server.getPlayerList().getBannedIPs().getKeys()) : Collections.<String>emptyList(); } | /**
* Get a list of options for when the user presses the TAB key
*/ | Get a list of options for when the user presses the TAB key | getTabCompletionOptions | {
"repo_name": "boredherobrine13/morefuelsmod-1.10",
"path": "build/tmp/recompileMc/sources/net/minecraft/command/server/CommandPardonIp.java",
"license": "lgpl-2.1",
"size": 2504
} | [
"java.util.Collections",
"java.util.List",
"javax.annotation.Nullable",
"net.minecraft.command.ICommandSender",
"net.minecraft.server.MinecraftServer",
"net.minecraft.util.math.BlockPos"
] | import java.util.Collections; import java.util.List; import javax.annotation.Nullable; import net.minecraft.command.ICommandSender; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; | import java.util.*; import javax.annotation.*; import net.minecraft.command.*; import net.minecraft.server.*; import net.minecraft.util.math.*; | [
"java.util",
"javax.annotation",
"net.minecraft.command",
"net.minecraft.server",
"net.minecraft.util"
] | java.util; javax.annotation; net.minecraft.command; net.minecraft.server; net.minecraft.util; | 2,894,846 |
private void assertDiscoCacheReuse(AffinityTopologyVersion v1, AffinityTopologyVersion v2) {
for (Ignite ignite : G.allGrids()) {
GridBoundedConcurrentLinkedHashMap<AffinityTopologyVersion, DiscoCache> discoCacheHist =
U.field(((IgniteEx) ignite).context().discovery(), "discoCacheHist");
DiscoCache discoCache1 = discoCacheHist.get(v1);
DiscoCache discoCache2 = discoCacheHist.get(v2);
assertEquals(v1, discoCache1.version());
assertEquals(v2, discoCache2.version());
String[] props = new String[] {
"state", "loc", "rmtNodes", "allNodes", "srvNodes", "daemonNodes", "rmtNodesWithCaches",
"allCacheNodes", "allCacheNodes", "cacheGrpAffNodes", "nodeMap", "minNodeVer"
};
for (String prop : props)
assertSame(U.field(discoCache1, prop), U.field(discoCache2, prop));
assertNotSame(U.field(discoCache1, "alives"), U.field(discoCache2, "alives"));
assertEquals(U.field(discoCache1, "alives"), U.field(discoCache2, "alives"));
}
} | void function(AffinityTopologyVersion v1, AffinityTopologyVersion v2) { for (Ignite ignite : G.allGrids()) { GridBoundedConcurrentLinkedHashMap<AffinityTopologyVersion, DiscoCache> discoCacheHist = U.field(((IgniteEx) ignite).context().discovery(), STR); DiscoCache discoCache1 = discoCacheHist.get(v1); DiscoCache discoCache2 = discoCacheHist.get(v2); assertEquals(v1, discoCache1.version()); assertEquals(v2, discoCache2.version()); String[] props = new String[] { "state", "loc", STR, STR, STR, STR, STR, STR, STR, STR, STR, STR }; for (String prop : props) assertSame(U.field(discoCache1, prop), U.field(discoCache2, prop)); assertNotSame(U.field(discoCache1, STR), U.field(discoCache2, STR)); assertEquals(U.field(discoCache1, STR), U.field(discoCache2, STR)); } } | /**
* Assert disco cache reuse.
*
* @param v1 First version.
* @param v2 Next version.
*/ | Assert disco cache reuse | assertDiscoCacheReuse | {
"repo_name": "ntikhonov/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/spi/discovery/IgniteDiscoveryCacheReuseSelfTest.java",
"license": "apache-2.0",
"size": 3739
} | [
"org.apache.ignite.Ignite",
"org.apache.ignite.internal.IgniteEx",
"org.apache.ignite.internal.managers.discovery.DiscoCache",
"org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion",
"org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap",
"org.apache.ignite.internal.util.typedef.G",
"org.apache.ignite.internal.util.typedef.internal.U"
] | import org.apache.ignite.Ignite; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.managers.discovery.DiscoCache; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.util.GridBoundedConcurrentLinkedHashMap; import org.apache.ignite.internal.util.typedef.G; import org.apache.ignite.internal.util.typedef.internal.U; | import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.managers.discovery.*; import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.util.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 581,083 |
@Schema(description = "User ID. Provide a value of `0` to operate the current session's user.")
public Integer getUserId() {
return userId;
} | @Schema(description = STR) Integer function() { return userId; } | /**
* User ID. Provide a value of `0` to operate the current session's user.
* @return userId
**/ | User ID. Provide a value of `0` to operate the current session's user | getUserId | {
"repo_name": "iterate-ch/cyberduck",
"path": "brick/src/main/java/ch/cyberduck/core/brick/io/swagger/client/model/ActionNotificationExportsBody.java",
"license": "gpl-3.0",
"size": 9218
} | [
"io.swagger.v3.oas.annotations.media.Schema"
] | import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.*; | [
"io.swagger.v3"
] | io.swagger.v3; | 206,409 |
Set<Consent> getMissingConsentsForPatient(String patientId);
/**
* Determines if the given ids are present in the system, and grants them on the given patient record. All other
* consents are revoked.
* @param patient record in which consents will be granted
* @param consents list of consent ids
* @return {@code true} if the operation was successful, otherwise {@code false} | Set<Consent> getMissingConsentsForPatient(String patientId); /** * Determines if the given ids are present in the system, and grants them on the given patient record. All other * consents are revoked. * @param patient record in which consents will be granted * @param consents list of consent ids * @return {@code true} if the operation was successful, otherwise {@code false} | /**
* Same as {@link #getMissingConsentsForPatient(Patient)}, for the exception that the patient record
* lookup happens internally.
*
* @param patientId for which a patient record is to be looked up
* @return same as {@link #getMissingConsentsForPatient(Patient)}. Returns null if patientId is not a valid id.
*/ | Same as <code>#getMissingConsentsForPatient(Patient)</code>, for the exception that the patient record lookup happens internally | getMissingConsentsForPatient | {
"repo_name": "phenotips/phenotips",
"path": "components/consents/api/src/main/java/org/phenotips/consents/ConsentManager.java",
"license": "agpl-3.0",
"size": 6114
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 15,072 |
public static com.iucn.whp.dbservice.model.active_conservation_projects remove(
long acpid)
throws com.iucn.whp.dbservice.NoSuchactive_conservation_projectsException,
com.liferay.portal.kernel.exception.SystemException {
return getPersistence().remove(acpid);
} | static com.iucn.whp.dbservice.model.active_conservation_projects function( long acpid) throws com.iucn.whp.dbservice.NoSuchactive_conservation_projectsException, com.liferay.portal.kernel.exception.SystemException { return getPersistence().remove(acpid); } | /**
* Removes the active_conservation_projects with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param acpid the primary key of the active_conservation_projects
* @return the active_conservation_projects that was removed
* @throws com.iucn.whp.dbservice.NoSuchactive_conservation_projectsException if a active_conservation_projects with the primary key could not be found
* @throws SystemException if a system exception occurred
*/ | Removes the active_conservation_projects with the primary key from the database. Also notifies the appropriate model listeners | remove | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/service/com/iucn/whp/dbservice/service/persistence/active_conservation_projectsUtil.java",
"license": "gpl-2.0",
"size": 21007
} | [
"com.liferay.portal.kernel.exception.SystemException"
] | import com.liferay.portal.kernel.exception.SystemException; | import com.liferay.portal.kernel.exception.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 863,915 |
public Type inOnly(String uri) {
return to(ExchangePattern.InOnly, uri);
} | Type function(String uri) { return to(ExchangePattern.InOnly, uri); } | /**
* Sends the message to the given endpoint using an
* <a href="http://camel.apache.org/event-message.html">Event Message</a> or
* <a href="http://camel.apache.org/exchange-pattern.html">InOnly exchange pattern</a>
* <p/>
* Notice the existing MEP is restored after the message has been sent to the given endpoint.
*
* @param uri The endpoint uri which is used for sending the exchange
* @return the builder
*/ | Sends the message to the given endpoint using an Event Message or InOnly exchange pattern Notice the existing MEP is restored after the message has been sent to the given endpoint | inOnly | {
"repo_name": "logzio/camel",
"path": "camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java",
"license": "apache-2.0",
"size": 139893
} | [
"org.apache.camel.ExchangePattern"
] | import org.apache.camel.ExchangePattern; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 841,215 |
protected void setUp() throws Exception {
super.setUp();
ll = new LinkedList();
for (int i = 0; i < objArray.length; i++) {
ll.add(objArray[i]);
}
} | void function() throws Exception { super.setUp(); ll = new LinkedList(); for (int i = 0; i < objArray.length; i++) { ll.add(objArray[i]); } } | /**
* Sets up the fixture, for example, open a network connection. This method
* is called before a test is executed.
*/ | Sets up the fixture, for example, open a network connection. This method is called before a test is executed | setUp | {
"repo_name": "weipoint/j2objc",
"path": "jre_emul/apache_harmony/classlib/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/util/LinkedListTest.java",
"license": "apache-2.0",
"size": 20289
} | [
"java.util.LinkedList"
] | import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 1,200,603 |
public static void resize(
final File imageSrc,
final File imageDst,
final float fraction)
throws IOException {
if (!imageDst.exists()) {
final ResampleOp resampleOp = new ResampleOp(DimensionConstrain.createRelativeDimension(fraction));
resampleOp.setFilter(ResampleFilters.getBiCubicHighFreqResponse());
resampleOp.setNumberOfThreads(NB_THREAD);
final BufferedImage image = ImageIO.read(imageSrc);
final BufferedImage imageResize =
resampleOp.filter(image, null);
ImageIO.write(
imageResize,
TactFileUtils.getExtension(imageDst),
imageDst);
}
} | static void function( final File imageSrc, final File imageDst, final float fraction) throws IOException { if (!imageDst.exists()) { final ResampleOp resampleOp = new ResampleOp(DimensionConstrain.createRelativeDimension(fraction)); resampleOp.setFilter(ResampleFilters.getBiCubicHighFreqResponse()); resampleOp.setNumberOfThreads(NB_THREAD); final BufferedImage image = ImageIO.read(imageSrc); final BufferedImage imageResize = resampleOp.filter(image, null); ImageIO.write( imageResize, TactFileUtils.getExtension(imageDst), imageDst); } } | /**
* Resize a image given a ratio.
* @param imageSrc Source image
* @param imageDst Destination file
* @param fraction Ratio for image resizing
* @throws IOException If image source doesn't exists
*/ | Resize a image given a ratio | resize | {
"repo_name": "TACTfactory/harmony-core",
"path": "src/com/tactfactory/harmony/utils/ImageUtils.java",
"license": "mit",
"size": 1722
} | [
"com.mortennobel.imagescaling.DimensionConstrain",
"com.mortennobel.imagescaling.ResampleFilters",
"com.mortennobel.imagescaling.ResampleOp",
"java.awt.image.BufferedImage",
"java.io.File",
"java.io.IOException",
"javax.imageio.ImageIO"
] | import com.mortennobel.imagescaling.DimensionConstrain; import com.mortennobel.imagescaling.ResampleFilters; import com.mortennobel.imagescaling.ResampleOp; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; | import com.mortennobel.imagescaling.*; import java.awt.image.*; import java.io.*; import javax.imageio.*; | [
"com.mortennobel.imagescaling",
"java.awt",
"java.io",
"javax.imageio"
] | com.mortennobel.imagescaling; java.awt; java.io; javax.imageio; | 571,065 |
private static boolean isMappedToGitProvider(ResourceMapping element) {
IProject[] projects = element.getProjects();
for (IProject project: projects) {
if (ResourceUtil.isSharedWithGit(project)) {
return true;
}
}
return false;
} | static boolean function(ResourceMapping element) { IProject[] projects = element.getProjects(); for (IProject project: projects) { if (ResourceUtil.isSharedWithGit(project)) { return true; } } return false; } | /**
* Copied from TeamAction#isMappedToProvider(ResourceMapping, String)
*
* @param element
* @return <code>true</code> if resource is mapped to Git provider,
* <code>false</code> otherwise
*/ | Copied from TeamAction#isMappedToProvider(ResourceMapping, String) | isMappedToGitProvider | {
"repo_name": "SmithAndr/egit",
"path": "org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/synchronize/GitModelSynchronize.java",
"license": "epl-1.0",
"size": 10241
} | [
"org.eclipse.core.resources.IProject",
"org.eclipse.core.resources.mapping.ResourceMapping",
"org.eclipse.egit.core.internal.util.ResourceUtil"
] | import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.mapping.ResourceMapping; import org.eclipse.egit.core.internal.util.ResourceUtil; | import org.eclipse.core.resources.*; import org.eclipse.core.resources.mapping.*; import org.eclipse.egit.core.internal.util.*; | [
"org.eclipse.core",
"org.eclipse.egit"
] | org.eclipse.core; org.eclipse.egit; | 1,347,728 |
public Builder classifierIds(String classifierId) {
if (classifierIds == null) {
classifierIds = new ArrayList<String>();
}
classifierIds.add(classifierId);
return this;
} | Builder function(String classifierId) { if (classifierIds == null) { classifierIds = new ArrayList<String>(); } classifierIds.add(classifierId); return this; } | /**
* Classifier ids.
*
* @param classifierId the classifier id
* @return the builder
*/ | Classifier ids | classifierIds | {
"repo_name": "supunucsc/java-sdk",
"path": "visual-recognition/src/main/java/com/ibm/watson/developer_cloud/visual_recognition/v3/model/ClassifyImagesOptions.java",
"license": "apache-2.0",
"size": 5366
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 276,655 |
public final PersistenceManagerFactory getPersistenceManagerFactory() {
return (this.jdoTemplate != null ? this.jdoTemplate.getPersistenceManagerFactory() : null);
} | final PersistenceManagerFactory function() { return (this.jdoTemplate != null ? this.jdoTemplate.getPersistenceManagerFactory() : null); } | /**
* Return the JDO PersistenceManagerFactory used by this DAO.
*/ | Return the JDO PersistenceManagerFactory used by this DAO | getPersistenceManagerFactory | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "src/org/springframework/orm/jdo/support/JdoDaoSupport.java",
"license": "apache-2.0",
"size": 7014
} | [
"javax.jdo.PersistenceManagerFactory"
] | import javax.jdo.PersistenceManagerFactory; | import javax.jdo.*; | [
"javax.jdo"
] | javax.jdo; | 1,030,431 |
public Bitmap getFrame(final int n) {
if (mFrameCount <= 0) {
return null;
}
return mFrames.get(n % mFrameCount).mImage;
} | Bitmap function(final int n) { if (mFrameCount <= 0) { return null; } return mFrames.get(n % mFrameCount).mImage; } | /**
* Gets the mImage contents of frame n.
*
* @param n the frame number.
* @return BufferedBitmap representation of frame, or null if n is invalid.
*/ | Gets the mImage contents of frame n | getFrame | {
"repo_name": "jeisfeld/RandomImage",
"path": "RandomImageIdea/randomImageLib/src/main/java/de/jeisfeld/randomimage/util/GifDecoder.java",
"license": "gpl-2.0",
"size": 17811
} | [
"android.graphics.Bitmap"
] | import android.graphics.Bitmap; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,292,603 |
private void createValueAxesTab(final TabFolder tab_folder)
{
final TabItem axes_tab = new TabItem(tab_folder, 0);
axes_tab.setText(Messages.ValueAxes);
final Composite parent = new Composite(tab_folder, 0);
parent.setLayout(new GridLayout());
// Rescale options
final Composite rescale = new Composite(parent, 0);
rescale.setLayout(new RowLayout());
rescale.setLayoutData(new GridData(SWT.FILL, 0, true, false));
final Label l = new Label(rescale, 0);
l.setText(Messages.ArchiveRescale_Label);
final ArchiveRescale rescale_items[] = ArchiveRescale.values();
rescales = new Button[rescale_items.length];
for (int i=0; i<rescales.length; ++i)
{
final ArchiveRescale item = rescale_items[i];
if (item.ordinal() != i)
throw new Error("ArchiveRescale items out of order"); //$NON-NLS-1$ | void function(final TabFolder tab_folder) { final TabItem axes_tab = new TabItem(tab_folder, 0); axes_tab.setText(Messages.ValueAxes); final Composite parent = new Composite(tab_folder, 0); parent.setLayout(new GridLayout()); final Composite rescale = new Composite(parent, 0); rescale.setLayout(new RowLayout()); rescale.setLayoutData(new GridData(SWT.FILL, 0, true, false)); final Label l = new Label(rescale, 0); l.setText(Messages.ArchiveRescale_Label); final ArchiveRescale rescale_items[] = ArchiveRescale.values(); rescales = new Button[rescale_items.length]; for (int i=0; i<rescales.length; ++i) { final ArchiveRescale item = rescale_items[i]; if (item.ordinal() != i) throw new Error(STR); | /** Create tab for traces (PVs, Formulas)
* @param tabs
*/ | Create tab for traces (PVs, Formulas) | createValueAxesTab | {
"repo_name": "kasemir/org.csstudio.display.builder",
"path": "databrowser3/databrowser-plugins/org.csstudio.trends.databrowser3/src/org/csstudio/trends/databrowser3/propsheet/DataBrowserPropertySheetPage.java",
"license": "epl-1.0",
"size": 39297
} | [
"org.csstudio.trends.databrowser3.Messages",
"org.csstudio.trends.databrowser3.model.ArchiveRescale",
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.layout.RowLayout",
"org.eclipse.swt.widgets.Button",
"org.eclipse.swt.widgets.Composite",
"org.eclipse.swt.widgets.Label",
"org.eclipse.swt.widgets.TabFolder",
"org.eclipse.swt.widgets.TabItem"
] | import org.csstudio.trends.databrowser3.Messages; import org.csstudio.trends.databrowser3.model.ArchiveRescale; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; | import org.csstudio.trends.databrowser3.*; import org.csstudio.trends.databrowser3.model.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.csstudio.trends",
"org.eclipse.swt"
] | org.csstudio.trends; org.eclipse.swt; | 2,818,834 |
@SuppressWarnings("rawtypes")
protected void handleEvent(GwtEvent event){
if(!MatContext.get().isLoading()){
this.onEvent(event);
}
else if(doAlert()){
Window.alert(getAlertMessage());
}
}
| @SuppressWarnings(STR) void function(GwtEvent event){ if(!MatContext.get().isLoading()){ this.onEvent(event); } else if(doAlert()){ Window.alert(getAlertMessage()); } } | /**
* do event behavior only if not loading.
*
* @param event
* the event
*/ | do event behavior only if not loading | handleEvent | {
"repo_name": "MeasureAuthoringTool/MeasureAuthoringTool_LatestSprint",
"path": "mat/src/main/java/mat/client/event/MATEventHandler.java",
"license": "cc0-1.0",
"size": 1428
} | [
"com.google.gwt.event.shared.GwtEvent",
"com.google.gwt.user.client.Window"
] | import com.google.gwt.event.shared.GwtEvent; import com.google.gwt.user.client.Window; | import com.google.gwt.event.shared.*; import com.google.gwt.user.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 1,463,883 |
@Override
public void notifyObjectResized(DianaDimension oldSize) {
notifyObservers(new ObjectResized(oldSize, getSize()));
} | void function(DianaDimension oldSize) { notifyObservers(new ObjectResized(oldSize, getSize())); } | /**
* Notify that the object just resized
*/ | Notify that the object just resized | notifyObjectResized | {
"repo_name": "openflexo-team/diana",
"path": "diana-core/src/main/java/org/openflexo/diana/impl/DrawingGraphicalRepresentationImpl.java",
"license": "gpl-3.0",
"size": 9942
} | [
"org.openflexo.diana.geom.DianaDimension",
"org.openflexo.diana.notifications.ObjectResized"
] | import org.openflexo.diana.geom.DianaDimension; import org.openflexo.diana.notifications.ObjectResized; | import org.openflexo.diana.geom.*; import org.openflexo.diana.notifications.*; | [
"org.openflexo.diana"
] | org.openflexo.diana; | 2,746,044 |
public void runnableInvoked(RunnableQueue rq, Runnable r) {
if (running && !(r instanceof NoRepaintRunnable)) {
repaint();
}
} | void function(RunnableQueue rq, Runnable r) { if (running && !(r instanceof NoRepaintRunnable)) { repaint(); } } | /**
* Called when the given Runnable has just been invoked and
* has returned.
*/ | Called when the given Runnable has just been invoked and has returned | runnableInvoked | {
"repo_name": "git-moss/Push2Display",
"path": "lib/batik-1.8/sources/org/apache/batik/bridge/UpdateManager.java",
"license": "lgpl-3.0",
"size": 29915
} | [
"org.apache.batik.util.RunnableQueue"
] | import org.apache.batik.util.RunnableQueue; | import org.apache.batik.util.*; | [
"org.apache.batik"
] | org.apache.batik; | 920,473 |
@Test(expected = UnsupportedOperationException.class)
public void canGetTrigger() {
this.task.getTrigger();
} | @Test(expected = UnsupportedOperationException.class) void function() { this.task.getTrigger(); } | /**
* Make sure the trigger is null.
*/ | Make sure the trigger is null | canGetTrigger | {
"repo_name": "irontable/genie",
"path": "genie-web/src/test/java/com/netflix/genie/web/tasks/leader/ClusterCheckerTaskUnitTests.java",
"license": "apache-2.0",
"size": 10065
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,075,813 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.