method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
protected void verifyInterval(double lower, double upper) throws
IllegalArgumentException {
if (lower >= upper) {
throw MathRuntimeException.createIllegalArgumentException(
"endpoints do not specify an interval: [{0}, {1}]",
lower, upper);
}
}
| void function(double lower, double upper) throws IllegalArgumentException { if (lower >= upper) { throw MathRuntimeException.createIllegalArgumentException( STR, lower, upper); } } | /**
* Verifies that the endpoints specify an interval.
*
* @param lower lower endpoint
* @param upper upper endpoint
* @throws IllegalArgumentException if not interval
*/ | Verifies that the endpoints specify an interval | verifyInterval | {
"repo_name": "SpoonLabs/astor",
"path": "examples/Math-issue-288/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegratorImpl.java",
"license": "gpl-2.0",
"size": 6435
} | [
"org.apache.commons.math.MathRuntimeException"
] | import org.apache.commons.math.MathRuntimeException; | import org.apache.commons.math.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,122,596 |
ThreadSafeOutputFormatterCallback<Target> createStreamCallback(
OutputStream out, QueryOptions options, QueryEnvironment<?> env); | ThreadSafeOutputFormatterCallback<Target> createStreamCallback( OutputStream out, QueryOptions options, QueryEnvironment<?> env); | /**
* Returns a {@link ThreadSafeOutputFormatterCallback} whose
* {@link OutputFormatterCallback#process} outputs formatted {@link Target}s to the given
* {@code out}.
*
* <p>Takes any options specified via the most recent call to {@link #setOptions} into
* consideration.
*
* <p>Intended to be use for streaming out during evaluation of a query.
*/ | Returns a <code>ThreadSafeOutputFormatterCallback</code> whose <code>OutputFormatterCallback#process</code> outputs formatted <code>Target</code>s to the given out. Takes any options specified via the most recent call to <code>#setOptions</code> into consideration. Intended to be use for streaming out during evaluation of a query | createStreamCallback | {
"repo_name": "variac/bazel",
"path": "src/main/java/com/google/devtools/build/lib/query2/output/OutputFormatter.java",
"license": "apache-2.0",
"size": 31631
} | [
"com.google.devtools.build.lib.packages.Target",
"com.google.devtools.build.lib.query2.engine.QueryEnvironment",
"com.google.devtools.build.lib.query2.engine.ThreadSafeOutputFormatterCallback",
"java.io.OutputStream"
] | import com.google.devtools.build.lib.packages.Target; import com.google.devtools.build.lib.query2.engine.QueryEnvironment; import com.google.devtools.build.lib.query2.engine.ThreadSafeOutputFormatterCallback; import java.io.OutputStream; | import com.google.devtools.build.lib.packages.*; import com.google.devtools.build.lib.query2.engine.*; import java.io.*; | [
"com.google.devtools",
"java.io"
] | com.google.devtools; java.io; | 675,788 |
public boolean isOffHeap() {
return false;
}
private static class MyFixedPartitionResolver implements FixedPartitionResolver {
private final List<String> allPartitions;
public MyFixedPartitionResolver(final List<String> allPartitions) {
this.allPartitions = allPartitions;
} | boolean function() { return false; } private static class MyFixedPartitionResolver implements FixedPartitionResolver { private final List<String> allPartitions; public MyFixedPartitionResolver(final List<String> allPartitions) { this.allPartitions = allPartitions; } | /**
* Returns true if the test should create off-heap regions. OffHeap tests should over-ride this
* method and return false.
*/ | Returns true if the test should create off-heap regions. OffHeap tests should over-ride this method and return false | isOffHeap | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-dunit/src/main/java/org/apache/geode/internal/cache/wan/AsyncEventQueueTestBase.java",
"license": "apache-2.0",
"size": 65746
} | [
"java.util.List",
"org.apache.geode.cache.FixedPartitionResolver"
] | import java.util.List; import org.apache.geode.cache.FixedPartitionResolver; | import java.util.*; import org.apache.geode.cache.*; | [
"java.util",
"org.apache.geode"
] | java.util; org.apache.geode; | 2,321,274 |
protected void customValidate(ValidationContext validationContext, Collection<ValidationResult> results) {
} | void function(ValidationContext validationContext, Collection<ValidationResult> results) { } | /**
* If sub-classes needs to implement any custom validation, override this method then add validation result to the results.
*/ | If sub-classes needs to implement any custom validation, override this method then add validation result to the results | customValidate | {
"repo_name": "jtstorck/nifi",
"path": "nifi-nar-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/storage/AbstractGCSProcessor.java",
"license": "apache-2.0",
"size": 4477
} | [
"java.util.Collection",
"org.apache.nifi.components.ValidationContext",
"org.apache.nifi.components.ValidationResult"
] | import java.util.Collection; import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; | import java.util.*; import org.apache.nifi.components.*; | [
"java.util",
"org.apache.nifi"
] | java.util; org.apache.nifi; | 2,339,534 |
public void setProperties(Properties properties) {
this.properties = properties;
}
| void function(Properties properties) { this.properties = properties; } | /**
* Sets the configuration properties.
*
* @param properties The properties to set.
*/ | Sets the configuration properties | setProperties | {
"repo_name": "Xylus/pinpoint",
"path": "commons-hbase/src/main/java/com/navercorp/pinpoint/common/hbase/HbaseConfigurationFactoryBean.java",
"license": "apache-2.0",
"size": 3133
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,159,415 |
public BigDecimal getNetValue() {
return this.netValue;
} | BigDecimal function() { return this.netValue; } | /**
* getter for netValue
*/ | getter for netValue | getNetValue | {
"repo_name": "krisjin/common-base",
"path": "luban-common/src/test/java/org/luban/common/test/FundNetValue.java",
"license": "mit",
"size": 1029
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 8,667 |
public Date getDate() {
return date == null ? null : new Date(date.getTime());
} | Date function() { return date == null ? null : new Date(date.getTime()); } | /**
* Returns a defensive copy of date if not null.
* @return a defensive copy of date if not null.
*/ | Returns a defensive copy of date if not null | getDate | {
"repo_name": "kevinglenny/FieldWorkerBigData",
"path": "src/main/java/com/google/devrel/training/conference/domain/Job.java",
"license": "apache-2.0",
"size": 6695
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,357,151 |
private Collection getColumnQueryKeyPairsForTopLink() {
return new TreeSet(this.columnQueryKeyPairs);
} | Collection function() { return new TreeSet(this.columnQueryKeyPairs); } | /**
* sort the collection for TopLink
*/ | sort the collection for TopLink | getColumnQueryKeyPairsForTopLink | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "utils/eclipselink.utils.workbench/mappingsmodel/source/org/eclipse/persistence/tools/workbench/mappingsmodel/mapping/relational/MWVariableOneToOneMapping.java",
"license": "epl-1.0",
"size": 22725
} | [
"java.util.Collection",
"java.util.TreeSet"
] | import java.util.Collection; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,941,579 |
public AccessibleContext getAccessibleContext() {
return ProgressMonitor.this.getAccessibleContext();
} | AccessibleContext function() { return ProgressMonitor.this.getAccessibleContext(); } | /**
* Gets the AccessibleContext for the ProgressOptionPane
*
* @return the AccessibleContext for the ProgressOptionPane
* @since 1.5
*/ | Gets the AccessibleContext for the ProgressOptionPane | getAccessibleContext | {
"repo_name": "tobiasschulz/voipcall",
"path": "src/call/gui/ProgressMonitor.java",
"license": "gpl-3.0",
"size": 29465
} | [
"javax.accessibility.AccessibleContext"
] | import javax.accessibility.AccessibleContext; | import javax.accessibility.*; | [
"javax.accessibility"
] | javax.accessibility; | 695,995 |
private void doValidateClass(Class<?> proxySuperClass) {
if (logger.isWarnEnabled()) {
Method[] methods = proxySuperClass.getMethods();
for (Method method : methods) {
if (!Object.class.equals(method.getDeclaringClass()) && !Modifier.isStatic(method.getModifiers()) &&
Modifier.isFinal(method.getModifiers())) {
logger.warn("Unable to proxy method [" + method + "] because it is final: " +
"All calls to this method via a proxy will NOT be routed to the target instance.");
}
}
}
} | void function(Class<?> proxySuperClass) { if (logger.isWarnEnabled()) { Method[] methods = proxySuperClass.getMethods(); for (Method method : methods) { if (!Object.class.equals(method.getDeclaringClass()) && !Modifier.isStatic(method.getModifiers()) && Modifier.isFinal(method.getModifiers())) { logger.warn(STR + method + STR + STR); } } } } | /**
* Checks for final methods on the {@code Class} and writes warnings to the log
* for each one found.
*/ | Checks for final methods on the Class and writes warnings to the log for each one found | doValidateClass | {
"repo_name": "kingtang/spring-learn",
"path": "spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java",
"license": "gpl-3.0",
"size": 33359
} | [
"java.lang.reflect.Method",
"java.lang.reflect.Modifier"
] | import java.lang.reflect.Method; import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 755,468 |
public void testUniqueIndexColumnIncreaseSize()
{
if (!getPlatformInfo().isIndicesSupported())
{
return;
}
final String model1Xml =
"<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
"<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='roundtriptest'>\n"+
" <table name='roundtrip'>\n"+
" <column name='pk' type='INTEGER' primaryKey='true' required='true'/>\n"+
" <column name='avalue1' type='INTEGER'/>\n"+
" <column name='avalue2' type='CHAR' size='16'/>\n"+
" <index name='testindex'>\n"+
" <index-column name='avalue1'/>\n"+
" <index-column name='avalue2'/>\n"+
" </index>\n"+
" </table>\n"+
"</database>";
final String model2Xml =
"<?xml version='1.0' encoding='ISO-8859-1'?>\n"+
"<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='roundtriptest'>\n"+
" <table name='roundtrip'>\n"+
" <column name='pk' type='INTEGER' primaryKey='true' required='true'/>\n"+
" <column name='avalue1' type='INTEGER'/>\n"+
" <column name='avalue2' type='CHAR' size='20'/>\n"+
" <index name='testindex'>\n"+
" <index-column name='avalue1'/>\n"+
" <index-column name='avalue2'/>\n"+
" </index>\n"+
" </table>\n"+
"</database>";
createDatabase(model1Xml);
insertRow("roundtrip", new Object[] { new Integer(1), new Integer(2), "text" });
alterDatabase(model2Xml);
assertEquals(getAdjustedModel(),
readModelFromDatabase("roundtriptest"));
List beans = getRows("roundtrip");
DynaBean bean = (DynaBean)beans.get(0);
assertEquals(new Integer(1), bean, "pk");
assertEquals(new Integer(2), bean, "avalue1");
assertEquals((Object)"text", ((String)bean.get("avalue2")).trim());
}
| void function() { if (!getPlatformInfo().isIndicesSupported()) { return; } final String model1Xml = STR+ STR + DatabaseIO.DDLUTILS_NAMESPACE + STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR; final String model2Xml = STR+ STR + DatabaseIO.DDLUTILS_NAMESPACE + STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR; createDatabase(model1Xml); insertRow(STR, new Object[] { new Integer(1), new Integer(2), "text" }); alterDatabase(model2Xml); assertEquals(getAdjustedModel(), readModelFromDatabase(STR)); List beans = getRows(STR); DynaBean bean = (DynaBean)beans.get(0); assertEquals(new Integer(1), bean, "pk"); assertEquals(new Integer(2), bean, STR); assertEquals((Object)"text", ((String)bean.get(STR)).trim()); } | /**
* Tests increasing the size of an indexed column.
*/ | Tests increasing the size of an indexed column | testUniqueIndexColumnIncreaseSize | {
"repo_name": "ramizul/ddlutilsplus",
"path": "src/test/java/org/apache/ddlutils/io/TestChangeColumn.java",
"license": "apache-2.0",
"size": 184741
} | [
"java.util.List",
"org.apache.commons.beanutils.DynaBean"
] | import java.util.List; import org.apache.commons.beanutils.DynaBean; | import java.util.*; import org.apache.commons.beanutils.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 738,710 |
public String toPrettyString() throws IOException {
if (jsonFactory != null) {
return jsonFactory.toPrettyString(this);
}
return super.toString();
} | String function() throws IOException { if (jsonFactory != null) { return jsonFactory.toPrettyString(this); } return super.toString(); } | /**
* Returns a pretty-printed serialized JSON string representation or {@link #toString()} if {@link
* #getFactory()} is {@code null}.
*
* @since 1.6
*/ | Returns a pretty-printed serialized JSON string representation or <code>#toString()</code> if <code>#getFactory()</code> is null | toPrettyString | {
"repo_name": "googleapis/google-http-java-client",
"path": "google-http-client/src/main/java/com/google/api/client/json/GenericJson.java",
"license": "apache-2.0",
"size": 2675
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,150,882 |
protected boolean isSameTimezoneDatabaseVersion() {
String timezoneDatabaseVersion = mCalendarCache.readTimezoneDatabaseVersion();
if (timezoneDatabaseVersion == null) {
return false;
}
return TextUtils.equals(timezoneDatabaseVersion, TimeUtils.getTimeZoneDatabaseVersion());
} | boolean function() { String timezoneDatabaseVersion = mCalendarCache.readTimezoneDatabaseVersion(); if (timezoneDatabaseVersion == null) { return false; } return TextUtils.equals(timezoneDatabaseVersion, TimeUtils.getTimeZoneDatabaseVersion()); } | /**
* Check if the time zone database version is the same as the cached one
*/ | Check if the time zone database version is the same as the cached one | isSameTimezoneDatabaseVersion | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/providers/CalendarProvider/src/com/android/providers/calendar/CalendarProvider2.java",
"license": "gpl-3.0",
"size": 236608
} | [
"android.text.TextUtils",
"android.util.TimeUtils"
] | import android.text.TextUtils; import android.util.TimeUtils; | import android.text.*; import android.util.*; | [
"android.text",
"android.util"
] | android.text; android.util; | 1,887,542 |
@Test
public void testConstructorReader() throws IOException {
Reader reader = new FileReader(file);
PlateReaderBigInteger plateReader = new PlateReaderBigInteger(reader);
assertTrue(plateReader != null);
plateReader.close();
} | void function() throws IOException { Reader reader = new FileReader(file); PlateReaderBigInteger plateReader = new PlateReaderBigInteger(reader); assertTrue(plateReader != null); plateReader.close(); } | /**
* Tests the reader constructor.
* @throws IOException
*/ | Tests the reader constructor | testConstructorReader | {
"repo_name": "jessemull/MicroFlex",
"path": "src/test/java/com/github/jessemull/microflex/io/iobiginteger/PlateReaderBigIntegerTest.java",
"license": "apache-2.0",
"size": 11213
} | [
"com.github.jessemull.microflex.bigintegerflex.io.PlateReaderBigInteger",
"java.io.FileReader",
"java.io.IOException",
"java.io.Reader",
"org.junit.Assert"
] | import com.github.jessemull.microflex.bigintegerflex.io.PlateReaderBigInteger; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import org.junit.Assert; | import com.github.jessemull.microflex.bigintegerflex.io.*; import java.io.*; import org.junit.*; | [
"com.github.jessemull",
"java.io",
"org.junit"
] | com.github.jessemull; java.io; org.junit; | 687,693 |
void deploymentList(List<DeploymentModel> deploymentModels); | void deploymentList(List<DeploymentModel> deploymentModels); | /**
* Displays deployment list so users can select a deployment then login.
*
* @param deploymentModels The {@link DeploymentModel} to be listed
*/ | Displays deployment list so users can select a deployment then login | deploymentList | {
"repo_name": "malikov/platform-android",
"path": "ushahidi/src/main/java/com/ushahidi/android/presentation/view/account/LoginView.java",
"license": "agpl-3.0",
"size": 1455
} | [
"com.ushahidi.android.presentation.model.DeploymentModel",
"java.util.List"
] | import com.ushahidi.android.presentation.model.DeploymentModel; import java.util.List; | import com.ushahidi.android.presentation.model.*; import java.util.*; | [
"com.ushahidi.android",
"java.util"
] | com.ushahidi.android; java.util; | 2,813,566 |
private void handleSubscribeSuccess() {
Log.d(TAG, ".handleSubscribeSuccess() entered");
if (token.getTopics() != null) {
for (String topic : token.getTopics()) {
if (topic.contains(topicFactory.getPassengerInboxTopic())) {
// get current location from the LocationUtils
Location location = LocationUtils.getInstance(context).getLocation();
// publish the setup messages
mqttHandler.publish(topicFactory.getPassengerTopLevelTopic(), messageFactory.getConnectionMessage(), true, 0);
if (location == null) {
// location service is not available - perhaps we're running in an emulator?
location = new Location("");
location.setLongitude(Constants.DEFAULT_LONGITUDE);
location.setLatitude(Constants.DEFAULT_LATITUDE);
}
mqttHandler.publish(topicFactory.getParingTopic(), messageFactory.getPairingMessage(location.getLatitude(), location.getLongitude()), true, 1);
mqttHandler.publish(topicFactory.getPassengerLocationTopic(), messageFactory.getLocationMessage(location.getLatitude(), location.getLongitude()), true, 0);
// publish the passenger's selfie to the passenger's photo topic
mqttHandler.publish(topicFactory.getPassengerPhotoTopic(), messageFactory.getPassengerPhotoMessage(), true, 0);
}
}
}
} | void function() { Log.d(TAG, STR); if (token.getTopics() != null) { for (String topic : token.getTopics()) { if (topic.contains(topicFactory.getPassengerInboxTopic())) { Location location = LocationUtils.getInstance(context).getLocation(); mqttHandler.publish(topicFactory.getPassengerTopLevelTopic(), messageFactory.getConnectionMessage(), true, 0); if (location == null) { location = new Location(""); location.setLongitude(Constants.DEFAULT_LONGITUDE); location.setLatitude(Constants.DEFAULT_LATITUDE); } mqttHandler.publish(topicFactory.getParingTopic(), messageFactory.getPairingMessage(location.getLatitude(), location.getLongitude()), true, 1); mqttHandler.publish(topicFactory.getPassengerLocationTopic(), messageFactory.getLocationMessage(location.getLatitude(), location.getLongitude()), true, 0); mqttHandler.publish(topicFactory.getPassengerPhotoTopic(), messageFactory.getPassengerPhotoMessage(), true, 0); } } } } | /**
* Called on successful subscription to the MQTT topic. In case of the initial subscription,
* this method will publish Last Will and Testament, current location and paring messages.
*/ | Called on successful subscription to the MQTT topic. In case of the initial subscription, this method will publish Last Will and Testament, current location and paring messages | handleSubscribeSuccess | {
"repo_name": "francoj22/mqtt-PickMeUp",
"path": "PickMeUp-Android/app/src/main/java/com/ibm/pickmeup/utils/ActionListener.java",
"license": "epl-1.0",
"size": 5704
} | [
"android.location.Location",
"android.util.Log"
] | import android.location.Location; import android.util.Log; | import android.location.*; import android.util.*; | [
"android.location",
"android.util"
] | android.location; android.util; | 2,651,682 |
public void addPrefixNsPair(String prefix, String ns)
{
// update prefix-to-namespace mapping
String prevNs = mPrefix2NsMap.get(prefix);
if (prevNs != null)
{
mNs2PrefixMap.get(prevNs).remove(prefix);
}
mPrefix2NsMap.put(prefix, ns);
// update namespace-to-prefix mapping
TreeSet<String> prefixes = mNs2PrefixMap.get(ns);
if (prefixes == null)
{
prefixes = new TreeSet<String>();
mNs2PrefixMap.put(ns, prefixes);
}
prefixes.add(prefix);
}
| void function(String prefix, String ns) { String prevNs = mPrefix2NsMap.get(prefix); if (prevNs != null) { mNs2PrefixMap.get(prevNs).remove(prefix); } mPrefix2NsMap.put(prefix, ns); TreeSet<String> prefixes = mNs2PrefixMap.get(ns); if (prefixes == null) { prefixes = new TreeSet<String>(); mNs2PrefixMap.put(ns, prefixes); } prefixes.add(prefix); } | /**
* Inserts a prefix-to-namespace mapping to the context.
* @param prefix Prefix string.
* @param ns Matching namespace string.
*/ | Inserts a prefix-to-namespace mapping to the context | addPrefixNsPair | {
"repo_name": "balthorium/xmpptrace",
"path": "src/xmpptrace/model/XmppNamespaceContext.java",
"license": "apache-2.0",
"size": 5507
} | [
"java.util.TreeSet"
] | import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 260,054 |
public void actionPerformed(ActionEvent g) {
ActionEvent e = new ActionEvent(this,1,this.getActionCommand() + "_menu");
this.actionListener.actionPerformed(e);
}
| void function(ActionEvent g) { ActionEvent e = new ActionEvent(this,1,this.getActionCommand() + "_menu"); this.actionListener.actionPerformed(e); } | /**
* Event handler for menu button
*/ | Event handler for menu button | actionPerformed | {
"repo_name": "rob-work/iwbcff",
"path": "src/becta/viewer/controls/ToolbarButton.java",
"license": "bsd-2-clause",
"size": 21526
} | [
"java.awt.event.ActionEvent"
] | import java.awt.event.ActionEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,196,618 |
//pre-processing
limit = limit != null ? limit : RestApiConstants.PAGINATION_LIMIT_DEFAULT;
offset = offset != null ? offset : RestApiConstants.PAGINATION_OFFSET_DEFAULT;
String requestedTenantDomain = RestApiUtil.getRequestedTenantDomain(xWSO2Tenant);
Set<Tag> tagSet;
List<Tag> tagList = new ArrayList<>();
try {
if (!RestApiUtil.isTenantAvailable(requestedTenantDomain)) {
RestApiUtil.handleBadRequest("Provided tenant domain '" + xWSO2Tenant + "' is invalid", log);
}
String username = RestApiUtil.getLoggedInUsername();
APIConsumer apiConsumer = RestApiUtil.getConsumer(username);
tagSet = apiConsumer.getAllTags(requestedTenantDomain);
if (tagSet != null)
tagList.addAll(tagSet);
TagListDTO tagListDTO = TagMappingUtil.fromTagListToDTO(tagList, limit, offset);
TagMappingUtil.setPaginationParams(tagListDTO, limit, offset, tagList.size());
return Response.ok().entity(tagListDTO).build();
} catch (APIManagementException e) {
RestApiUtil.handleInternalServerError("Error while retrieving tags", e, log);
} catch (UserStoreException e) {
String errorMessage = "Error while checking availability of tenant " + requestedTenantDomain;
RestApiUtil.handleInternalServerError(errorMessage, e, log);
}
return null;
} | limit = limit != null ? limit : RestApiConstants.PAGINATION_LIMIT_DEFAULT; offset = offset != null ? offset : RestApiConstants.PAGINATION_OFFSET_DEFAULT; String requestedTenantDomain = RestApiUtil.getRequestedTenantDomain(xWSO2Tenant); Set<Tag> tagSet; List<Tag> tagList = new ArrayList<>(); try { if (!RestApiUtil.isTenantAvailable(requestedTenantDomain)) { RestApiUtil.handleBadRequest(STR + xWSO2Tenant + STR, log); } String username = RestApiUtil.getLoggedInUsername(); APIConsumer apiConsumer = RestApiUtil.getConsumer(username); tagSet = apiConsumer.getAllTags(requestedTenantDomain); if (tagSet != null) tagList.addAll(tagSet); TagListDTO tagListDTO = TagMappingUtil.fromTagListToDTO(tagList, limit, offset); TagMappingUtil.setPaginationParams(tagListDTO, limit, offset, tagList.size()); return Response.ok().entity(tagListDTO).build(); } catch (APIManagementException e) { RestApiUtil.handleInternalServerError(STR, e, log); } catch (UserStoreException e) { String errorMessage = STR + requestedTenantDomain; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; } | /**
* Retrieves all tags
*
* @param limit max number of objects returns
* @param offset starting index
* @param accept accepted media type of the client
* @param ifNoneMatch If-None-Match header value
* @return Response object containing resulted tags
*/ | Retrieves all tags | tagsGet | {
"repo_name": "hevayo/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.store/src/main/java/org/wso2/carbon/apimgt/rest/api/store/impl/TagsApiServiceImpl.java",
"license": "apache-2.0",
"size": 3754
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Set",
"javax.ws.rs.core.Response",
"org.wso2.carbon.apimgt.api.APIConsumer",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.Tag",
"org.wso2.carbon.apimgt.rest.api.store.dto.TagListDTO",
"org.wso2.carbon.apimg... | import java.util.ArrayList; import java.util.List; import java.util.Set; import javax.ws.rs.core.Response; import org.wso2.carbon.apimgt.api.APIConsumer; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Tag; import org.wso2.carbon.apimgt.rest.api.store.dto.TagListDTO; import org.wso2.carbon.apimgt.rest.api.store.utils.mappings.TagMappingUtil; import org.wso2.carbon.apimgt.rest.api.util.RestApiConstants; import org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil; import org.wso2.carbon.user.api.UserStoreException; | import java.util.*; import javax.ws.rs.core.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.rest.api.store.dto.*; import org.wso2.carbon.apimgt.rest.api.store.utils.mappings.*; import org.wso2.carbon.apimgt.rest.api.util.*; import org.wso2.carbon.apimgt.rest.api.util.utils.*; import org.wso2.carbon.user.api.*; | [
"java.util",
"javax.ws",
"org.wso2.carbon"
] | java.util; javax.ws; org.wso2.carbon; | 596,113 |
private void testDirAcls() throws Exception {
if ( isLocalFS() ) {
return;
}
final String defUser1 = "default:user:glarch:r-x";
FileSystem proxyFs = FileSystem.get(getProxiedFSConf());
FileSystem httpfs = getHttpFSFileSystem();
Path dir = getProxiedFSTestDir();
AclStatus proxyAclStat = proxyFs.getAclStatus(dir);
AclStatus httpfsAclStat = httpfs.getAclStatus(dir);
assertSameAcls(httpfsAclStat, proxyAclStat);
assertSameAcls(httpfs, proxyFs, dir);
httpfs.setAcl(dir, (AclEntry.parseAclSpec(defUser1,true)));
proxyAclStat = proxyFs.getAclStatus(dir);
httpfsAclStat = httpfs.getAclStatus(dir);
assertSameAcls(httpfsAclStat, proxyAclStat);
assertSameAcls(httpfs, proxyFs, dir);
httpfs.removeDefaultAcl(dir);
proxyAclStat = proxyFs.getAclStatus(dir);
httpfsAclStat = httpfs.getAclStatus(dir);
assertSameAcls(httpfsAclStat, proxyAclStat);
assertSameAcls(httpfs, proxyFs, dir);
} | void function() throws Exception { if ( isLocalFS() ) { return; } final String defUser1 = STR; FileSystem proxyFs = FileSystem.get(getProxiedFSConf()); FileSystem httpfs = getHttpFSFileSystem(); Path dir = getProxiedFSTestDir(); AclStatus proxyAclStat = proxyFs.getAclStatus(dir); AclStatus httpfsAclStat = httpfs.getAclStatus(dir); assertSameAcls(httpfsAclStat, proxyAclStat); assertSameAcls(httpfs, proxyFs, dir); httpfs.setAcl(dir, (AclEntry.parseAclSpec(defUser1,true))); proxyAclStat = proxyFs.getAclStatus(dir); httpfsAclStat = httpfs.getAclStatus(dir); assertSameAcls(httpfsAclStat, proxyAclStat); assertSameAcls(httpfs, proxyFs, dir); httpfs.removeDefaultAcl(dir); proxyAclStat = proxyFs.getAclStatus(dir); httpfsAclStat = httpfs.getAclStatus(dir); assertSameAcls(httpfsAclStat, proxyAclStat); assertSameAcls(httpfs, proxyFs, dir); } | /**
* Simple acl tests on a directory: set a default acl, remove default acls.
* @throws Exception
*/ | Simple acl tests on a directory: set a default acl, remove default acls | testDirAcls | {
"repo_name": "ucare-uchicago/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-httpfs/src/test/java/org/apache/hadoop/fs/http/client/BaseTestHttpFSWith.java",
"license": "apache-2.0",
"size": 57216
} | [
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.permission.AclEntry",
"org.apache.hadoop.fs.permission.AclStatus"
] | import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.AclEntry; import org.apache.hadoop.fs.permission.AclStatus; | import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 647,911 |
public SuperActivityToast setButtonDividerColor(@ColorInt int buttonDividerColor) {
this.mStyle.buttonDividerColor = buttonDividerColor;
return this;
}
| SuperActivityToast function(@ColorInt int buttonDividerColor) { this.mStyle.buttonDividerColor = buttonDividerColor; return this; } | /**
* Set the color of the divider between the text and the Button in a TYPE_BUTTON
* SuperActivityToast.
*
* @param buttonDividerColor The desired divider color
* @return The current SuperActivityToast instance
*/ | Set the color of the divider between the text and the Button in a TYPE_BUTTON SuperActivityToast | setButtonDividerColor | {
"repo_name": "JohnPersano/SuperToasts",
"path": "library/src/main/java/com/github/johnpersano/supertoasts/library/SuperActivityToast.java",
"license": "apache-2.0",
"size": 40720
} | [
"android.support.annotation.ColorInt"
] | import android.support.annotation.ColorInt; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 1,233,422 |
public synchronized static void shutdown() {
synchronized (THREAD_CONTROL_LOCK) {
if (autoProvThread != null) {
ZimbraLog.autoprov.info("Shutting down auto provision thread");
autoProvThread.requestShutdown();
autoProvThread.interrupt();
autoProvThread = null;
} else {
ZimbraLog.autoprov.info("shutdown() called, but auto provision thread is not running.");
}
}
} | synchronized static void function() { synchronized (THREAD_CONTROL_LOCK) { if (autoProvThread != null) { ZimbraLog.autoprov.info(STR); autoProvThread.requestShutdown(); autoProvThread.interrupt(); autoProvThread = null; } else { ZimbraLog.autoprov.info(STR); } } } | /**
* Shuts down the auto provision thread. Does nothing if it is not running.
*/ | Shuts down the auto provision thread. Does nothing if it is not running | shutdown | {
"repo_name": "nico01f/z-pec",
"path": "ZimbraServer/src/java/com/zimbra/cs/account/AutoProvisionThread.java",
"license": "mit",
"size": 8439
} | [
"com.zimbra.common.util.ZimbraLog"
] | import com.zimbra.common.util.ZimbraLog; | import com.zimbra.common.util.*; | [
"com.zimbra.common"
] | com.zimbra.common; | 1,601,496 |
public Read withMaxReadTime(Duration maxReadTime) {
checkArgument(maxNumRecords() == Long.MAX_VALUE,
"maxNumRecord and maxReadTime are exclusive");
return builder().setMaxReadTime(maxReadTime).build();
} | Read function(Duration maxReadTime) { checkArgument(maxNumRecords() == Long.MAX_VALUE, STR); return builder().setMaxReadTime(maxReadTime).build(); } | /**
* Define the max read time (duration) while the {@link Read} will receive messages.
* When this max read time is not null, the {@link Read} will provide a bounded
* {@link PCollection}.
*/ | Define the max read time (duration) while the <code>Read</code> will receive messages. When this max read time is not null, the <code>Read</code> will provide a bounded <code>PCollection</code> | withMaxReadTime | {
"repo_name": "vikkyrk/incubator-beam",
"path": "sdks/java/io/mqtt/src/main/java/org/apache/beam/sdk/io/mqtt/MqttIO.java",
"license": "apache-2.0",
"size": 20040
} | [
"com.google.common.base.Preconditions",
"org.joda.time.Duration"
] | import com.google.common.base.Preconditions; import org.joda.time.Duration; | import com.google.common.base.*; import org.joda.time.*; | [
"com.google.common",
"org.joda.time"
] | com.google.common; org.joda.time; | 1,827,445 |
private void createJavadoc(ConnectorStatement nabuccoConnector, TypeDeclaration type) {
Node application = nabuccoConnector.getParent().getParent().getParent().getParent();
if (application instanceof ApplicationStatement) {
JavaAstSupport.convertJavadocAnnotations(((ApplicationStatement) application).annotationDeclaration, type);
}
} | void function(ConnectorStatement nabuccoConnector, TypeDeclaration type) { Node application = nabuccoConnector.getParent().getParent().getParent().getParent(); if (application instanceof ApplicationStatement) { JavaAstSupport.convertJavadocAnnotations(((ApplicationStatement) application).annotationDeclaration, type); } } | /**
* Create the class javadoc depending on the application information.
*
* @param nabuccoConnector
* the connector holding the annotations
* @param type
* the java type to create the javadoc for
*/ | Create the class javadoc depending on the application information | createJavadoc | {
"repo_name": "NABUCCO/org.nabucco.framework.generator",
"path": "org.nabucco.framework.generator.compiler/src/main/org/nabucco/framework/generator/compiler/transformation/java/application/connector/NabuccoToJavaServiceConnectorVisitor.java",
"license": "epl-1.0",
"size": 11739
} | [
"org.eclipse.jdt.internal.compiler.ast.TypeDeclaration",
"org.nabucco.framework.generator.compiler.transformation.java.common.ast.JavaAstSupport",
"org.nabucco.framework.generator.parser.syntaxtree.ApplicationStatement",
"org.nabucco.framework.generator.parser.syntaxtree.ConnectorStatement",
"org.nabucco.fr... | import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.nabucco.framework.generator.compiler.transformation.java.common.ast.JavaAstSupport; import org.nabucco.framework.generator.parser.syntaxtree.ApplicationStatement; import org.nabucco.framework.generator.parser.syntaxtree.ConnectorStatement; import org.nabucco.framework.generator.parser.syntaxtree.Node; | import org.eclipse.jdt.internal.compiler.ast.*; import org.nabucco.framework.generator.compiler.transformation.java.common.ast.*; import org.nabucco.framework.generator.parser.syntaxtree.*; | [
"org.eclipse.jdt",
"org.nabucco.framework"
] | org.eclipse.jdt; org.nabucco.framework; | 1,805,734 |
@Nonnull
public List<SInstance> getFields() {
return (fields == null) ? Collections.emptyList() : fields.getFields();
} | List<SInstance> function() { return (fields == null) ? Collections.emptyList() : fields.getFields(); } | /**
* List only those fields already instantiated.
* OBS: field instantiation occurs automatically when its value is set for the first time.
*
* @return field instances
*/ | List only those fields already instantiated | getFields | {
"repo_name": "opensingular/singular-core",
"path": "form/core/src/main/java/org/opensingular/form/SIComposite.java",
"license": "apache-2.0",
"size": 11570
} | [
"java.util.Collections",
"java.util.List"
] | import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,165,478 |
public void endSummarizeItem(Type aggReturnType, String aggResultName) {
// Extend with aggResultName
outerExtend.addExtendItem(aggResultName, aggReturnType);
} | void function(Type aggReturnType, String aggResultName) { outerExtend.addExtendItem(aggResultName, aggReturnType); } | /**
* End a SUMMARIZE item.
*
* This must appear after invocation of the aggregate operator.
*/ | End a SUMMARIZE item. This must appear after invocation of the aggregate operator | endSummarizeItem | {
"repo_name": "DaveVoorhis/Rel",
"path": "ServerV0000/src/org/reldb/rel/v0/generator/Generator.java",
"license": "apache-2.0",
"size": 121534
} | [
"org.reldb.rel.v0.types.Type"
] | import org.reldb.rel.v0.types.Type; | import org.reldb.rel.v0.types.*; | [
"org.reldb.rel"
] | org.reldb.rel; | 349,044 |
EClass getControl(); | EClass getControl(); | /**
* Returns the meta object for class '{@link CIM.IEC61970.Meas.Control <em>Control</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Control</em>'.
* @see CIM.IEC61970.Meas.Control
* @generated
*/ | Returns the meta object for class '<code>CIM.IEC61970.Meas.Control Control</code>'. | getControl | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Meas/MeasPackage.java",
"license": "mit",
"size": 215537
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,164,652 |
@VisibleForTesting
protected synchronized ServerName createRegionServerStatusStub(boolean refresh) {
if (rssStub != null) {
return masterAddressTracker.getMasterAddress();
}
ServerName sn = null;
long previousLogTime = 0;
RegionServerStatusService.BlockingInterface intRssStub = null;
LockService.BlockingInterface intLockStub = null;
boolean interrupted = false;
try {
while (keepLooping()) {
sn = this.masterAddressTracker.getMasterAddress(refresh);
if (sn == null) {
if (!keepLooping()) {
// give up with no connection.
LOG.debug("No master found and cluster is stopped; bailing out");
return null;
}
if (System.currentTimeMillis() > (previousLogTime + 1000)) {
LOG.debug("No master found; retry");
previousLogTime = System.currentTimeMillis();
}
refresh = true; // let's try pull it from ZK directly
if (sleep(200)) {
interrupted = true;
}
continue;
}
// If we are on the active master, use the shortcut
if (this instanceof HMaster && sn.equals(getServerName())) {
intRssStub = ((HMaster)this).getMasterRpcServices();
intLockStub = ((HMaster)this).getMasterRpcServices();
break;
}
try {
BlockingRpcChannel channel =
this.rpcClient.createBlockingRpcChannel(sn, userProvider.getCurrent(),
shortOperationTimeout);
intRssStub = RegionServerStatusService.newBlockingStub(channel);
intLockStub = LockService.newBlockingStub(channel);
break;
} catch (IOException e) {
if (System.currentTimeMillis() > (previousLogTime + 1000)) {
e = e instanceof RemoteException ?
((RemoteException)e).unwrapRemoteException() : e;
if (e instanceof ServerNotRunningYetException) {
LOG.info("Master isn't available yet, retrying");
} else {
LOG.warn("Unable to connect to master. Retrying. Error was:", e);
}
previousLogTime = System.currentTimeMillis();
}
if (sleep(200)) {
interrupted = true;
}
}
}
} finally {
if (interrupted) {
Thread.currentThread().interrupt();
}
}
this.rssStub = intRssStub;
this.lockStub = intLockStub;
return sn;
} | synchronized ServerName function(boolean refresh) { if (rssStub != null) { return masterAddressTracker.getMasterAddress(); } ServerName sn = null; long previousLogTime = 0; RegionServerStatusService.BlockingInterface intRssStub = null; LockService.BlockingInterface intLockStub = null; boolean interrupted = false; try { while (keepLooping()) { sn = this.masterAddressTracker.getMasterAddress(refresh); if (sn == null) { if (!keepLooping()) { LOG.debug(STR); return null; } if (System.currentTimeMillis() > (previousLogTime + 1000)) { LOG.debug(STR); previousLogTime = System.currentTimeMillis(); } refresh = true; if (sleep(200)) { interrupted = true; } continue; } if (this instanceof HMaster && sn.equals(getServerName())) { intRssStub = ((HMaster)this).getMasterRpcServices(); intLockStub = ((HMaster)this).getMasterRpcServices(); break; } try { BlockingRpcChannel channel = this.rpcClient.createBlockingRpcChannel(sn, userProvider.getCurrent(), shortOperationTimeout); intRssStub = RegionServerStatusService.newBlockingStub(channel); intLockStub = LockService.newBlockingStub(channel); break; } catch (IOException e) { if (System.currentTimeMillis() > (previousLogTime + 1000)) { e = e instanceof RemoteException ? ((RemoteException)e).unwrapRemoteException() : e; if (e instanceof ServerNotRunningYetException) { LOG.info(STR); } else { LOG.warn(STR, e); } previousLogTime = System.currentTimeMillis(); } if (sleep(200)) { interrupted = true; } } } } finally { if (interrupted) { Thread.currentThread().interrupt(); } } this.rssStub = intRssStub; this.lockStub = intLockStub; return sn; } | /**
* Get the current master from ZooKeeper and open the RPC connection to it. To get a fresh
* connection, the current rssStub must be null. Method will block until a master is available.
* You can break from this block by requesting the server stop.
* @param refresh If true then master address will be read from ZK, otherwise use cached data
* @return master + port, or null if server has been stopped
*/ | Get the current master from ZooKeeper and open the RPC connection to it. To get a fresh connection, the current rssStub must be null. Method will block until a master is available. You can break from this block by requesting the server stop | createRegionServerStatusStub | {
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java",
"license": "apache-2.0",
"size": 143925
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.ServerName",
"org.apache.hadoop.hbase.ipc.ServerNotRunningYetException",
"org.apache.hadoop.hbase.master.HMaster",
"org.apache.hadoop.hbase.shaded.com.google.protobuf.BlockingRpcChannel",
"org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos",... | import java.io.IOException; import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.ipc.ServerNotRunningYetException; import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.shaded.com.google.protobuf.BlockingRpcChannel; import org.apache.hadoop.hbase.shaded.protobuf.generated.LockServiceProtos; import org.apache.hadoop.hbase.shaded.protobuf.generated.RegionServerStatusProtos; import org.apache.hadoop.ipc.RemoteException; | import java.io.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.ipc.*; import org.apache.hadoop.hbase.master.*; import org.apache.hadoop.hbase.shaded.com.google.protobuf.*; import org.apache.hadoop.hbase.shaded.protobuf.generated.*; import org.apache.hadoop.ipc.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,849,533 |
private Node<OWLClass> nodeToOwlClassNode(au.csiro.ontology.Node n) {
if(n == null) return new OWLClassNode();
final Set<OWLClass> classes = new HashSet<>();
for (Object eq : n.getEquivalentConcepts()) {
classes.add(getOWLClass(eq));
}
return new OWLClassNode(classes);
}
| Node<OWLClass> function(au.csiro.ontology.Node n) { if(n == null) return new OWLClassNode(); final Set<OWLClass> classes = new HashSet<>(); for (Object eq : n.getEquivalentConcepts()) { classes.add(getOWLClass(eq)); } return new OWLClassNode(classes); } | /**
* Transforms a {@link ClassNode} into a {@link Node} of {@link OWLClass}es.
*
* @param n may be null, in which case an empty Node is returned
* @return
*/ | Transforms a <code>ClassNode</code> into a <code>Node</code> of <code>OWLClass</code>es | nodeToOwlClassNode | {
"repo_name": "aehrc/snorocket",
"path": "snorocket-owlapi/src/main/java/au/csiro/snorocket/owlapi/SnorocketOWLReasoner.java",
"license": "apache-2.0",
"size": 98531
} | [
"java.util.HashSet",
"java.util.Set",
"org.semanticweb.owlapi.model.OWLClass",
"org.semanticweb.owlapi.reasoner.Node",
"org.semanticweb.owlapi.reasoner.impl.OWLClassNode"
] | import java.util.HashSet; import java.util.Set; import org.semanticweb.owlapi.model.OWLClass; import org.semanticweb.owlapi.reasoner.Node; import org.semanticweb.owlapi.reasoner.impl.OWLClassNode; | import java.util.*; import org.semanticweb.owlapi.model.*; import org.semanticweb.owlapi.reasoner.*; import org.semanticweb.owlapi.reasoner.impl.*; | [
"java.util",
"org.semanticweb.owlapi"
] | java.util; org.semanticweb.owlapi; | 133,665 |
final StringBuffer encoded = new StringBuffer();
try {
final MessageDigest digester = MessageDigest.getInstance("SHA-1");
final byte[] digest = digester.digest(input.getBytes("UTF-8"));
for (final byte d : digest) {
encoded.append(Integer.toHexString(d & 0xFF));
}
} catch (final Exception e) {
LOG.error("makeSHA: " + e.toString());
}
return encoded.toString();
}
| final StringBuffer encoded = new StringBuffer(); try { final MessageDigest digester = MessageDigest.getInstance("SHA-1"); final byte[] digest = digester.digest(input.getBytes("UTF-8")); for (final byte d : digest) { encoded.append(Integer.toHexString(d & 0xFF)); } } catch (final Exception e) { LOG.error(STR + e.toString()); } return encoded.toString(); } | /**
* Erstellt aus einem String den SHA-1 Hash.
*
* @param input
* @return
*/ | Erstellt aus einem String den SHA-1 Hash | makeSHA | {
"repo_name": "gbv/doctor-doc",
"path": "source/util/Encrypt.java",
"license": "gpl-2.0",
"size": 1782
} | [
"java.security.MessageDigest"
] | import java.security.MessageDigest; | import java.security.*; | [
"java.security"
] | java.security; | 355,475 |
public CurrentTransformerInfo getCTInfo() {
if (ctInfo != null && ctInfo.eIsProxy()) {
InternalEObject oldCTInfo = (InternalEObject)ctInfo;
ctInfo = (CurrentTransformerInfo)eResolveProxy(oldCTInfo);
if (ctInfo != oldCTInfo) {
}
}
return ctInfo;
} | CurrentTransformerInfo function() { if (ctInfo != null && ctInfo.eIsProxy()) { InternalEObject oldCTInfo = (InternalEObject)ctInfo; ctInfo = (CurrentTransformerInfo)eResolveProxy(oldCTInfo); if (ctInfo != oldCTInfo) { } } return ctInfo; } | /**
* Returns the value of the '<em><b>CT Info</b></em>' reference.
* It is bidirectional and its opposite is '{@link CIM15.IEC61970.Informative.InfAssets.CurrentTransformerInfo#getCTs <em>CTs</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>CT Info</em>' reference isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>CT Info</em>' reference.
* @see #setCTInfo(CurrentTransformerInfo)
* @see CIM15.IEC61970.Informative.InfAssets.CurrentTransformerInfo#getCTs
* @generated
*/ | Returns the value of the 'CT Info' reference. It is bidirectional and its opposite is '<code>CIM15.IEC61970.Informative.InfAssets.CurrentTransformerInfo#getCTs CTs</code>'. If the meaning of the 'CT Info' reference isn't clear, there really should be more of a description here... | getCTInfo | {
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61970/AuxiliaryEquipment/CurrentTransformer.java",
"license": "apache-2.0",
"size": 24799
} | [
"org.eclipse.emf.ecore.InternalEObject"
] | import org.eclipse.emf.ecore.InternalEObject; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 913,234 |
public static GQuery $(Element element) {
return new GQuery(element);
} | public static GQuery $(Element element) { return new GQuery(element); } | /**
* Wrap a GQuery around an existing element.
*/ | Wrap a GQuery around an existing element | $ | {
"repo_name": "stori-es/stori_es",
"path": "dashboard/src/main/java/com/google/gwt/query/client/GQuery.java",
"license": "apache-2.0",
"size": 177285
} | [
"com.google.gwt.dom.client.Element"
] | import com.google.gwt.dom.client.Element; | import com.google.gwt.dom.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,364,236 |
public AffineTransform cloneTransform() {
return new AffineTransform(transform);
} | AffineTransform function() { return new AffineTransform(transform); } | /**
* Returns the current Transform ignoring the "constrain"
* rectangle.
*/ | Returns the current Transform ignoring the "constrain" rectangle | cloneTransform | {
"repo_name": "openjdk/jdk7u",
"path": "jdk/src/share/classes/sun/java2d/SunGraphics2D.java",
"license": "gpl-2.0",
"size": 133716
} | [
"java.awt.geom.AffineTransform"
] | import java.awt.geom.AffineTransform; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,406,672 |
public synchronized void processRequest(HttpSession session)
throws IOException, IllegalStateException {
try {
HttpMessage request = session.getRequestMessage();
HttpHeaders header = request.getHeaders();
logR.debug("Read \n" + header.toString());
ByteArrayOutputStream out = new ByteArrayOutputStream();
if (header.getContentLength() > 0) {
StreamUtil.copyStream(request.getInputStream(), out, header
.getContentLength());
}
logR.debug("Read Data portion\n" + out);
HttpResponse httpResponse = session.getResponseLine();
httpResponse.setResponseCode(HttpURLConnection.HTTP_OK);
httpResponse.setResponseMessage("OK");
HttpMessage msg = session.getResponseMessage();
msg.getOutputStream().write(responseBytes);
msg.getOutputStream().flush();
}
catch (HttpException e) {
IOException ioe = new IOException(e.getMessage());
ioe.initCause(e);
throw ioe;
}
return;
} | synchronized void function(HttpSession session) throws IOException, IllegalStateException { try { HttpMessage request = session.getRequestMessage(); HttpHeaders header = request.getHeaders(); logR.debug(STR + header.toString()); ByteArrayOutputStream out = new ByteArrayOutputStream(); if (header.getContentLength() > 0) { StreamUtil.copyStream(request.getInputStream(), out, header .getContentLength()); } logR.debug(STR + out); HttpResponse httpResponse = session.getResponseLine(); httpResponse.setResponseCode(HttpURLConnection.HTTP_OK); httpResponse.setResponseMessage("OK"); HttpMessage msg = session.getResponseMessage(); msg.getOutputStream().write(responseBytes); msg.getOutputStream().flush(); } catch (HttpException e) { IOException ioe = new IOException(e.getMessage()); ioe.initCause(e); throw ioe; } return; } | /**
* Process in the request in some fashion
*
* @param session the HttpSession.
*
*/ | Process in the request in some fashion | processRequest | {
"repo_name": "mcwarman/interlok",
"path": "adapter/src/test/java/com/adaptris/http/test/DefaultProcessor.java",
"license": "apache-2.0",
"size": 2329
} | [
"com.adaptris.http.HttpException",
"com.adaptris.http.HttpHeaders",
"com.adaptris.http.HttpMessage",
"com.adaptris.http.HttpResponse",
"com.adaptris.http.HttpSession",
"com.adaptris.util.stream.StreamUtil",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.net.HttpURLConnection"
] | import com.adaptris.http.HttpException; import com.adaptris.http.HttpHeaders; import com.adaptris.http.HttpMessage; import com.adaptris.http.HttpResponse; import com.adaptris.http.HttpSession; import com.adaptris.util.stream.StreamUtil; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.HttpURLConnection; | import com.adaptris.http.*; import com.adaptris.util.stream.*; import java.io.*; import java.net.*; | [
"com.adaptris.http",
"com.adaptris.util",
"java.io",
"java.net"
] | com.adaptris.http; com.adaptris.util; java.io; java.net; | 1,842,342 |
void penalize(RuleContext kcontext, long[] hardWeightsMultiplier, long[] softWeightsMultiplier); | void penalize(RuleContext kcontext, long[] hardWeightsMultiplier, long[] softWeightsMultiplier); | /**
* Penalize a match by the {@link ConstraintWeight} negated and multiplied with the specific weightMultiplier per score
* level.
* Slower than {@link #penalize(RuleContext, long)}.
*
* @param kcontext never null, the magic variable in DRL
* @param hardWeightsMultiplier elements at least 0
* @param softWeightsMultiplier elements at least 0
*/ | Penalize a match by the <code>ConstraintWeight</code> negated and multiplied with the specific weightMultiplier per score level. Slower than <code>#penalize(RuleContext, long)</code> | penalize | {
"repo_name": "tkobayas/optaplanner",
"path": "optaplanner-core/src/main/java/org/optaplanner/core/api/score/buildin/bendablelong/BendableLongScoreHolder.java",
"license": "apache-2.0",
"size": 3937
} | [
"org.kie.api.runtime.rule.RuleContext"
] | import org.kie.api.runtime.rule.RuleContext; | import org.kie.api.runtime.rule.*; | [
"org.kie.api"
] | org.kie.api; | 512,947 |
@Test
public void testGetSkewness_1()
throws Exception {
SummaryData fixture = new SummaryData();
fixture.setPercentile10(1.0);
fixture.setJobId(1);
fixture.setVarience(1.0);
fixture.setPercentile60(1.0);
fixture.setPercentile95(1.0);
fixture.setSkewness(1.0);
fixture.setPercentile40(1.0);
fixture.setPercentile90(1.0);
fixture.setMax(1.0);
fixture.setPercentile20(1.0);
fixture.setSampleSize(1);
fixture.setPercentile80(1.0);
fixture.setMean(1.0);
fixture.setKurtosis(1.0);
fixture.setPercentile70(1.0);
fixture.setMin(1.0);
fixture.setPageId("");
fixture.setPercentile30(1.0);
fixture.setSttDev(1.0);
fixture.setPercentile99(1.0);
fixture.setPercentile50(1.0);
double result = fixture.getSkewness();
assertEquals(1.0, result, 0.1);
} | void function() throws Exception { SummaryData fixture = new SummaryData(); fixture.setPercentile10(1.0); fixture.setJobId(1); fixture.setVarience(1.0); fixture.setPercentile60(1.0); fixture.setPercentile95(1.0); fixture.setSkewness(1.0); fixture.setPercentile40(1.0); fixture.setPercentile90(1.0); fixture.setMax(1.0); fixture.setPercentile20(1.0); fixture.setSampleSize(1); fixture.setPercentile80(1.0); fixture.setMean(1.0); fixture.setKurtosis(1.0); fixture.setPercentile70(1.0); fixture.setMin(1.0); fixture.setPageId(""); fixture.setPercentile30(1.0); fixture.setSttDev(1.0); fixture.setPercentile99(1.0); fixture.setPercentile50(1.0); double result = fixture.getSkewness(); assertEquals(1.0, result, 0.1); } | /**
* Run the double getSkewness() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 12/15/14 1:34 PM
*/ | Run the double getSkewness() method test | testGetSkewness_1 | {
"repo_name": "intuit/Tank",
"path": "data_model/src/test/java/com/intuit/tank/project/SummaryDataTest.java",
"license": "epl-1.0",
"size": 52876
} | [
"com.intuit.tank.project.SummaryData",
"org.junit.jupiter.api.Assertions"
] | import com.intuit.tank.project.SummaryData; import org.junit.jupiter.api.Assertions; | import com.intuit.tank.project.*; import org.junit.jupiter.api.*; | [
"com.intuit.tank",
"org.junit.jupiter"
] | com.intuit.tank; org.junit.jupiter; | 520,389 |
public void removeRow(final int rowIndex) {
final int internalRowNumber = convertToInternalRowNumber(rowIndex);
final Iterator<Integer> keys = addedRows.keySet().iterator();
final Row row = getRow(rowIndex);
if (row != null) {
sheet.removeRow(row);
} else {
logger.error("row " + rowIndex + " with internal number " + internalRowNumber
+ "cannot be deleted, because it doesn't exist.");
}
while (keys.hasNext()) {
final Integer key = keys.next();
final Integer value = addedRows.get(key);
if (value > internalRowNumber) {
addedRows.put(key, value - 1);
}
}
addedRows.remove(rowIndex);
} | void function(final int rowIndex) { final int internalRowNumber = convertToInternalRowNumber(rowIndex); final Iterator<Integer> keys = addedRows.keySet().iterator(); final Row row = getRow(rowIndex); if (row != null) { sheet.removeRow(row); } else { logger.error(STR + rowIndex + STR + internalRowNumber + STR); } while (keys.hasNext()) { final Integer key = keys.next(); final Integer value = addedRows.get(key); if (value > internalRowNumber) { addedRows.put(key, value - 1); } } addedRows.remove(rowIndex); } | /**
* DOCUMENT ME!
*
* @param rowIndex DOCUMENT ME!
*/ | DOCUMENT ME | removeRow | {
"repo_name": "cismet/report-api",
"path": "src/main/java/de/cismet/projecttracker/report/excel/ReportSheetWrapper.java",
"license": "lgpl-3.0",
"size": 5058
} | [
"java.util.Iterator",
"org.apache.poi.ss.usermodel.Row"
] | import java.util.Iterator; import org.apache.poi.ss.usermodel.Row; | import java.util.*; import org.apache.poi.ss.usermodel.*; | [
"java.util",
"org.apache.poi"
] | java.util; org.apache.poi; | 2,460,009 |
XYStepAreaRenderer r1 = new XYStepAreaRenderer();
XYStepAreaRenderer r2 = new XYStepAreaRenderer();
assertEquals(r1, r2);
r1.setOutline(true);
assertFalse(r1.equals(r2));
r2.setOutline(true);
assertTrue(r1.equals(r2));
r1.setShapesVisible(true);
assertFalse(r1.equals(r2));
r2.setShapesVisible(true);
assertTrue(r1.equals(r2));
r1.setShapesFilled(true);
assertFalse(r1.equals(r2));
r2.setShapesFilled(true);
assertTrue(r1.equals(r2));
r1.setPlotArea(false);
assertFalse(r1.equals(r2));
r2.setPlotArea(false);
assertTrue(r1.equals(r2));
r1.setRangeBase(-1.0);
assertFalse(r1.equals(r2));
r2.setRangeBase(-1.0);
assertTrue(r1.equals(r2));
r1.setStepPoint(0.33);
assertFalse(r1.equals(r2));
r2.setStepPoint(0.33);
assertTrue(r1.equals(r2));
} | XYStepAreaRenderer r1 = new XYStepAreaRenderer(); XYStepAreaRenderer r2 = new XYStepAreaRenderer(); assertEquals(r1, r2); r1.setOutline(true); assertFalse(r1.equals(r2)); r2.setOutline(true); assertTrue(r1.equals(r2)); r1.setShapesVisible(true); assertFalse(r1.equals(r2)); r2.setShapesVisible(true); assertTrue(r1.equals(r2)); r1.setShapesFilled(true); assertFalse(r1.equals(r2)); r2.setShapesFilled(true); assertTrue(r1.equals(r2)); r1.setPlotArea(false); assertFalse(r1.equals(r2)); r2.setPlotArea(false); assertTrue(r1.equals(r2)); r1.setRangeBase(-1.0); assertFalse(r1.equals(r2)); r2.setRangeBase(-1.0); assertTrue(r1.equals(r2)); r1.setStepPoint(0.33); assertFalse(r1.equals(r2)); r2.setStepPoint(0.33); assertTrue(r1.equals(r2)); } | /**
* Check that the equals() method distinguishes all fields.
*/ | Check that the equals() method distinguishes all fields | testEquals | {
"repo_name": "simon04/jfreechart",
"path": "src/test/java/org/jfree/chart/renderer/xy/XYStepAreaRendererTest.java",
"license": "lgpl-2.1",
"size": 6035
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,366,488 |
public String toStringEx() {
Calendar t1 = (_cValue != null)
? _cValue
: _cDefValue;
java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("dd MMM yyyy");
return df.format(t1.getTime());
}
| String function() { Calendar t1 = (_cValue != null) ? _cValue : _cDefValue; java.text.SimpleDateFormat df = new java.text.SimpleDateFormat(STR); return df.format(t1.getTime()); } | /**
* Converts the object to a string in "dd MMM yyyy" format
*
* @return The time
*/ | Converts the object to a string in "dd MMM yyyy" format | toStringEx | {
"repo_name": "appnativa/rare",
"path": "source/spot/src/com/appnativa/spot/SPOTDate.java",
"license": "gpl-3.0",
"size": 7526
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,733,612 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> disableAzureMonitorWithResponseAsync(
String resourceGroupName, String clusterName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (clusterName == null) {
return Mono.error(new IllegalArgumentException("Parameter clusterName is required and cannot be null."));
}
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.disableAzureMonitor(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
clusterName,
this.client.getApiVersion(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String clusterName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (clusterName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String accept = STR; return FluxUtil .withContext( context -> service .disableAzureMonitor( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, clusterName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Disables the Azure Monitor on the HDInsight cluster.
*
* @param resourceGroupName The name of the resource group.
* @param clusterName The name of the cluster.
* @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.
*/ | Disables the Azure Monitor on the HDInsight cluster | disableAzureMonitorWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/hdinsight/azure-resourcemanager-hdinsight/src/main/java/com/azure/resourcemanager/hdinsight/implementation/ExtensionsClientImpl.java",
"license": "mit",
"size": 117529
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import java.nio.*; | [
"com.azure.core",
"java.nio"
] | com.azure.core; java.nio; | 381,427 |
ListenableFuture<? extends Response> handleAsync(Request request); | ListenableFuture<? extends Response> handleAsync(Request request); | /**
* Main handle method for the AsyncRequestHandler that returns a ListenableFuture. This method
* should not make any blocking calls so that the calling thread is reliquished quickly.
*
* @param request Request to handle
* @return A ListenableFuture representing the result of the request handling.
*/ | Main handle method for the AsyncRequestHandler that returns a ListenableFuture. This method should not make any blocking calls so that the calling thread is reliquished quickly | handleAsync | {
"repo_name": "uber/tchannel-java",
"path": "tchannel-core/src/main/java/com/uber/tchannel/api/handlers/AsyncRequestHandler.java",
"license": "mit",
"size": 1893
} | [
"com.google.common.util.concurrent.ListenableFuture",
"com.uber.tchannel.messages.Request",
"com.uber.tchannel.messages.Response"
] | import com.google.common.util.concurrent.ListenableFuture; import com.uber.tchannel.messages.Request; import com.uber.tchannel.messages.Response; | import com.google.common.util.concurrent.*; import com.uber.tchannel.messages.*; | [
"com.google.common",
"com.uber.tchannel"
] | com.google.common; com.uber.tchannel; | 1,067,634 |
public Vector<UsenetUser> getUsenetUsersFilter() {
return this.usenetUsersFilter;
} | Vector<UsenetUser> function() { return this.usenetUsersFilter; } | /**
* Gets the usenet users filter.
*
* @return the usenet users filter
*/ | Gets the usenet users filter | getUsenetUsersFilter | {
"repo_name": "leonarduk/unison",
"path": "src/main/java/uk/co/sleonard/unison/NewsGroupFilter.java",
"license": "apache-2.0",
"size": 7581
} | [
"java.util.Vector",
"uk.co.sleonard.unison.datahandling.DAO"
] | import java.util.Vector; import uk.co.sleonard.unison.datahandling.DAO; | import java.util.*; import uk.co.sleonard.unison.datahandling.*; | [
"java.util",
"uk.co.sleonard"
] | java.util; uk.co.sleonard; | 696,411 |
public void setOwner(PrivateOwners owner) {
this.owner = owner;
} | void function(PrivateOwners owner) { this.owner = owner; } | /**
* Sets the owner.
*
* @param owner the new owner
*/ | Sets the owner | setOwner | {
"repo_name": "valmas/ideal-house-dbms",
"path": "src/main/java/com/ntua/db/beans/PrivateOwnersBean.java",
"license": "apache-2.0",
"size": 10816
} | [
"com.ntua.db.jpa.PrivateOwners"
] | import com.ntua.db.jpa.PrivateOwners; | import com.ntua.db.jpa.*; | [
"com.ntua.db"
] | com.ntua.db; | 1,922,634 |
@Test
public void testAutocorrelation() {
logger.info("autocorrelation");
FlatDataList flatDataList = generateFlatDataCollection().toFlatDataList();
int lags = 1;
double expResult = -0.014242212135952;
double result = Descriptives.autocorrelation(flatDataList, lags);
assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH);
} | void function() { logger.info(STR); FlatDataList flatDataList = generateFlatDataCollection().toFlatDataList(); int lags = 1; double expResult = -0.014242212135952; double result = Descriptives.autocorrelation(flatDataList, lags); assertEquals(expResult, result, Constants.DOUBLE_ACCURACY_HIGH); } | /**
* Test of autocorrelation method, of class Descriptives.
*/ | Test of autocorrelation method, of class Descriptives | testAutocorrelation | {
"repo_name": "datumbox/datumbox-framework",
"path": "datumbox-framework-core/src/test/java/com/datumbox/framework/core/statistics/descriptivestatistics/DescriptivesTest.java",
"license": "apache-2.0",
"size": 14323
} | [
"com.datumbox.framework.common.dataobjects.FlatDataList",
"com.datumbox.framework.tests.Constants",
"org.junit.Assert"
] | import com.datumbox.framework.common.dataobjects.FlatDataList; import com.datumbox.framework.tests.Constants; import org.junit.Assert; | import com.datumbox.framework.common.dataobjects.*; import com.datumbox.framework.tests.*; import org.junit.*; | [
"com.datumbox.framework",
"org.junit"
] | com.datumbox.framework; org.junit; | 2,248,061 |
public Map<String, Object> unstashMap(Map<String, Object> map) throws IOException {
Map<String, Object> copy = new HashMap<>(map);
unstashObject(copy);
return copy;
} | Map<String, Object> function(Map<String, Object> map) throws IOException { Map<String, Object> copy = new HashMap<>(map); unstashObject(copy); return copy; } | /**
* Recursively unstashes map values if needed
*/ | Recursively unstashes map values if needed | unstashMap | {
"repo_name": "camilojd/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/rest/Stash.java",
"license": "apache-2.0",
"size": 4973
} | [
"java.io.IOException",
"java.util.HashMap",
"java.util.Map"
] | import java.io.IOException; import java.util.HashMap; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 582,176 |
final void shutdown() throws ReflectiveOperationException {
try {
switch (dialect) {
case HSQL: {
try (Connection c = source.getConnection(); Statement stmt = c.createStatement()) {
stmt.execute(create ? "SHUTDOWN COMPACT" : "SHUTDOWN");
}
break;
}
case DERBY: {
source.getClass().getMethod("setShutdownDatabase", String.class).invoke(source, "shutdown");
source.getConnection().close(); // Does the actual shutdown.
break;
}
}
} catch (SQLException e) { // This is the expected exception.
final LogRecord record = new LogRecord(Level.FINE, e.getMessage());
if (dialect != Dialect.DERBY || !isSuccessfulShutdown(e)) {
record.setLevel(Level.WARNING);
record.setThrown(e);
}
record.setLoggerName(Loggers.SQL);
Logging.log(LocalDataSource.class, "shutdown", record);
}
} | final void shutdown() throws ReflectiveOperationException { try { switch (dialect) { case HSQL: { try (Connection c = source.getConnection(); Statement stmt = c.createStatement()) { stmt.execute(create ? STR : STR); } break; } case DERBY: { source.getClass().getMethod(STR, String.class).invoke(source, STR); source.getConnection().close(); break; } } } catch (SQLException e) { final LogRecord record = new LogRecord(Level.FINE, e.getMessage()); if (dialect != Dialect.DERBY !isSuccessfulShutdown(e)) { record.setLevel(Level.WARNING); record.setThrown(e); } record.setLoggerName(Loggers.SQL); Logging.log(LocalDataSource.class, STR, record); } } | /**
* Shutdowns the database used by this data source.
*
* @throws ReflectiveOperationException if an error occurred while
* setting the shutdown property on the Derby data source.
*/ | Shutdowns the database used by this data source | shutdown | {
"repo_name": "apache/sis",
"path": "core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java",
"license": "apache-2.0",
"size": 19814
} | [
"java.sql.Connection",
"java.sql.SQLException",
"java.sql.Statement",
"java.util.logging.Level",
"java.util.logging.LogRecord",
"org.apache.sis.internal.system.Loggers",
"org.apache.sis.util.logging.Logging"
] | import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.util.logging.Level; import java.util.logging.LogRecord; import org.apache.sis.internal.system.Loggers; import org.apache.sis.util.logging.Logging; | import java.sql.*; import java.util.logging.*; import org.apache.sis.internal.system.*; import org.apache.sis.util.logging.*; | [
"java.sql",
"java.util",
"org.apache.sis"
] | java.sql; java.util; org.apache.sis; | 287,185 |
public void replace(File file, String text) {
replace(file, true, text);
} | void function(File file, String text) { replace(file, true, text); } | /**
* Replace the contents of a file with a different text.
* @param file The file for which to replace the content
* @param text The new content to include in the ZIP
*/ | Replace the contents of a file with a different text | replace | {
"repo_name": "kovaloid/infoarchive-sip-sdk",
"path": "yaml/src/main/java/com/opentext/ia/yaml/configuration/zip/ZipBuilder.java",
"license": "mpl-2.0",
"size": 6835
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,840,065 |
void setBottomSheet(BottomSheet sheet); | void setBottomSheet(BottomSheet sheet); | /**
* Set the {@link BottomSheet} for triggering animations. This can be null if Chrome Home is
* disabled.
* @param sheet The {@link BottomSheet}.
*/ | Set the <code>BottomSheet</code> for triggering animations. This can be null if Chrome Home is disabled | setBottomSheet | {
"repo_name": "mogoweb/365browser",
"path": "app/src/main/java/org/chromium/chrome/browser/toolbar/Toolbar.java",
"license": "apache-2.0",
"size": 4345
} | [
"org.chromium.chrome.browser.widget.bottomsheet.BottomSheet"
] | import org.chromium.chrome.browser.widget.bottomsheet.BottomSheet; | import org.chromium.chrome.browser.widget.bottomsheet.*; | [
"org.chromium.chrome"
] | org.chromium.chrome; | 457,840 |
public static void createStripedFile(MiniDFSCluster cluster, Path file,
Path dir, int numBlocks, int numStripesPerBlk, boolean toMkdir)
throws Exception {
createStripedFile(cluster, file, dir, numBlocks, numStripesPerBlk,
toMkdir, StripedFileTestUtil.getDefaultECPolicy());
} | static void function(MiniDFSCluster cluster, Path file, Path dir, int numBlocks, int numStripesPerBlk, boolean toMkdir) throws Exception { createStripedFile(cluster, file, dir, numBlocks, numStripesPerBlk, toMkdir, StripedFileTestUtil.getDefaultECPolicy()); } | /**
* Creates the metadata of a file in striped layout. This method only
* manipulates the NameNode state without injecting data to DataNode.
* You should disable periodical heartbeat before use this.
* @param file Path of the file to create
* @param dir Parent path of the file
* @param numBlocks Number of striped block groups to add to the file
* @param numStripesPerBlk Number of striped cells in each block
* @param toMkdir
*/ | Creates the metadata of a file in striped layout. This method only manipulates the NameNode state without injecting data to DataNode. You should disable periodical heartbeat before use this | createStripedFile | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/DFSTestUtil.java",
"license": "apache-2.0",
"size": 90485
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,901,782 |
private void toggleRead(Set<Long> selectedSet) {
toggleMultiple(selectedSet, new MultiToggleHelper() { | void function(Set<Long> selectedSet) { toggleMultiple(selectedSet, new MultiToggleHelper() { | /**
* Toggles a set read/unread states. Note, the default behavior is "mark unread", so the
* sense of the helper methods is "true=unread"; this may be called from the UI thread
*
* @param selectedSet The current list of selected items
*/ | Toggles a set read/unread states. Note, the default behavior is "mark unread", so the sense of the helper methods is "true=unread"; this may be called from the UI thread | toggleRead | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Email/src/com/android/email/activity/MessageListFragment.java",
"license": "gpl-2.0",
"size": 89286
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,527,313 |
private void startRootElement(final String qName, final Attributes attributes)
throws SAXException, ObjectDescriptionException {
if (qName.equals(ClassModelTags.INCLUDE_TAG)) {
if (this.isInclude) {
Log.warn("Ignored nested include tag.");
return;
}
final String src = attributes.getValue(ClassModelTags.SOURCE_ATTR);
try {
final URL url = new URL(this.resource, src);
startIncludeHandling(url);
parseXmlDocument(url, true);
endIncludeHandling();
}
catch (Exception ioe) {
throw new ElementDefinitionException
(ioe, "Unable to include file from " + src);
}
}
else if (qName.equals(ClassModelTags.OBJECT_TAG)) {
setState(IN_OBJECT);
final String className = attributes.getValue(ClassModelTags.CLASS_ATTR);
String register = attributes.getValue(ClassModelTags.REGISTER_NAMES_ATTR);
if (register != null && register.length() == 0) {
register = null;
}
final boolean ignored = "true".equals(attributes.getValue(ClassModelTags.IGNORE_ATTR));
if (!startObjectDefinition(className, register, ignored)) {
setState(IGNORE_OBJECT);
}
}
else if (qName.equals(ClassModelTags.MANUAL_TAG)) {
final String className = attributes.getValue(ClassModelTags.CLASS_ATTR);
final String readHandler = attributes.getValue(ClassModelTags.READ_HANDLER_ATTR);
final String writeHandler = attributes.getValue(ClassModelTags.WRITE_HANDLER_ATTR);
handleManualMapping(className, readHandler, writeHandler);
}
else if (qName.equals(ClassModelTags.MAPPING_TAG)) {
setState(MAPPING_STATE);
final String typeAttr = attributes.getValue(ClassModelTags.TYPE_ATTR);
final String baseClass = attributes.getValue(ClassModelTags.BASE_CLASS_ATTR);
startMultiplexMapping(baseClass, typeAttr);
}
} | void function(final String qName, final Attributes attributes) throws SAXException, ObjectDescriptionException { if (qName.equals(ClassModelTags.INCLUDE_TAG)) { if (this.isInclude) { Log.warn(STR); return; } final String src = attributes.getValue(ClassModelTags.SOURCE_ATTR); try { final URL url = new URL(this.resource, src); startIncludeHandling(url); parseXmlDocument(url, true); endIncludeHandling(); } catch (Exception ioe) { throw new ElementDefinitionException (ioe, STR + src); } } else if (qName.equals(ClassModelTags.OBJECT_TAG)) { setState(IN_OBJECT); final String className = attributes.getValue(ClassModelTags.CLASS_ATTR); String register = attributes.getValue(ClassModelTags.REGISTER_NAMES_ATTR); if (register != null && register.length() == 0) { register = null; } final boolean ignored = "true".equals(attributes.getValue(ClassModelTags.IGNORE_ATTR)); if (!startObjectDefinition(className, register, ignored)) { setState(IGNORE_OBJECT); } } else if (qName.equals(ClassModelTags.MANUAL_TAG)) { final String className = attributes.getValue(ClassModelTags.CLASS_ATTR); final String readHandler = attributes.getValue(ClassModelTags.READ_HANDLER_ATTR); final String writeHandler = attributes.getValue(ClassModelTags.WRITE_HANDLER_ATTR); handleManualMapping(className, readHandler, writeHandler); } else if (qName.equals(ClassModelTags.MAPPING_TAG)) { setState(MAPPING_STATE); final String typeAttr = attributes.getValue(ClassModelTags.TYPE_ATTR); final String baseClass = attributes.getValue(ClassModelTags.BASE_CLASS_ATTR); startMultiplexMapping(baseClass, typeAttr); } } | /**
* Handles the include or object tag.
*
* @param qName The qualified name (with prefix), or the
* empty string if qualified names are not available.
* @param attributes The attributes attached to the element. If
* there are no attributes, it shall be an empty
* Attributes object.
* @throws SAXException if an parser error occured
* @throws ObjectDescriptionException if an object model related
* error occured.
*/ | Handles the include or object tag | startRootElement | {
"repo_name": "apetresc/JCommon",
"path": "src/main/java/org/jfree/xml/util/AbstractModelReader.java",
"license": "lgpl-2.1",
"size": 24646
} | [
"org.jfree.util.Log",
"org.jfree.xml.ElementDefinitionException",
"org.xml.sax.Attributes",
"org.xml.sax.SAXException"
] | import org.jfree.util.Log; import org.jfree.xml.ElementDefinitionException; import org.xml.sax.Attributes; import org.xml.sax.SAXException; | import org.jfree.util.*; import org.jfree.xml.*; import org.xml.sax.*; | [
"org.jfree.util",
"org.jfree.xml",
"org.xml.sax"
] | org.jfree.util; org.jfree.xml; org.xml.sax; | 1,099,867 |
public boolean removeAll(Collection<?> c) {
// Override AbstractSet version to avoid unnecessary call to size()
boolean modified = false;
for (Object e : c)
if (remove(e))
modified = true;
return modified;
}
/**
* @throws ClassCastException {@inheritDoc} | boolean function(Collection<?> c) { boolean modified = false; for (Object e : c) if (remove(e)) modified = true; return modified; } /** * @throws ClassCastException {@inheritDoc} | /**
* Removes from this set all of its elements that are contained in
* the specified collection. If the specified collection is also
* a set, this operation effectively modifies this set so that its
* value is the <i>asymmetric set difference</i> of the two sets.
*
* @param c collection containing elements to be removed from this set
* @return {@code true} if this set changed as a result of the call
* @throws ClassCastException if the types of one or more elements in this
* set are incompatible with the specified collection
* @throws NullPointerException if the specified collection or any
* of its elements are null
*/ | Removes from this set all of its elements that are contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets | removeAll | {
"repo_name": "upenn-acg/REMIX",
"path": "jvm-remix/openjdk/jdk/src/share/classes/java/util/concurrent/ConcurrentSkipListSet.java",
"license": "gpl-2.0",
"size": 19501
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 933,287 |
@Configurable
public void setShutdownWaitMax(Period waitTime)
{
_servletContainer.setShutdownWaitMax(waitTime);
} | void function(Period waitTime) { _servletContainer.setShutdownWaitMax(waitTime); } | /**
* Sets the max wait time for shutdown.
*/ | Sets the max wait time for shutdown | setShutdownWaitMax | {
"repo_name": "gruppo4/quercus-upstream",
"path": "modules/resin/src/com/caucho/server/cluster/ServletContainerConfig.java",
"license": "gpl-2.0",
"size": 18846
} | [
"com.caucho.config.types.Period"
] | import com.caucho.config.types.Period; | import com.caucho.config.types.*; | [
"com.caucho.config"
] | com.caucho.config; | 1,853,203 |
public String getMatricesAsHTML(StudyDesign studyDesign) {
return privateGetMatricesAsHTML(studyDesign);
} | String function(StudyDesign studyDesign) { return privateGetMatricesAsHTML(studyDesign); } | /**
* Get matrices used in the power calculation for a "guided" study design
* as an HTML formatted string.
* This is only called by test code.
* <p>
* This method uses the notation of Muller & Stewart 2007.
*
* @param studyDesign study design object
*
* @return html string with representation of matrices
*/ | Get matrices used in the power calculation for a "guided" study design as an HTML formatted string. This is only called by test code. This method uses the notation of Muller & Stewart 2007 | getMatricesAsHTML | {
"repo_name": "SampleSizeShop/PowerSvc",
"path": "src/edu/ucdenver/bios/powersvc/resource/PowerMatrixHTMLServerResource.java",
"license": "gpl-2.0",
"size": 23577
} | [
"edu.ucdenver.bios.webservice.common.domain.StudyDesign"
] | import edu.ucdenver.bios.webservice.common.domain.StudyDesign; | import edu.ucdenver.bios.webservice.common.domain.*; | [
"edu.ucdenver.bios"
] | edu.ucdenver.bios; | 1,138,907 |
public void setSeriesNegativeItemLabelPosition(int series,
ItemLabelPosition position) {
setSeriesNegativeItemLabelPosition(series, position, true);
} | void function(int series, ItemLabelPosition position) { setSeriesNegativeItemLabelPosition(series, position, true); } | /**
* Sets the item label position for negative values in a series and sends a
* {@link RendererChangeEvent} to all registered listeners.
*
* @param series the series index (zero-based).
* @param position the position (<code>null</code> permitted).
*/ | Sets the item label position for negative values in a series and sends a <code>RendererChangeEvent</code> to all registered listeners | setSeriesNegativeItemLabelPosition | {
"repo_name": "opensim-org/opensim-gui",
"path": "Gui/opensim/jfreechart/src/org/jfree/chart/renderer/AbstractRenderer.java",
"license": "apache-2.0",
"size": 98153
} | [
"org.jfree.chart.labels.ItemLabelPosition"
] | import org.jfree.chart.labels.ItemLabelPosition; | import org.jfree.chart.labels.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 1,950,274 |
public boolean isToggleButtonChecked(String text)
{
if(config.commandLogging){
Log.d(config.commandLoggingTag, "isToggleButtonChecked(\""+text+"\")");
}
return checker.isButtonChecked(ToggleButton.class, text);
} | boolean function(String text) { if(config.commandLogging){ Log.d(config.commandLoggingTag, STRSTR\")"); } return checker.isButtonChecked(ToggleButton.class, text); } | /**
* Checks if a ToggleButton displaying the specified text is checked.
*
* @param text the text that the {@link ToggleButton} displays, specified as a regular expression
* @return {@code true} if a {@link ToggleButton} matching the specified text is checked and {@code false} if it is not checked
*/ | Checks if a ToggleButton displaying the specified text is checked | isToggleButtonChecked | {
"repo_name": "darker50/robotium",
"path": "robotium-solo/src/main/java/com/robotium/solo/Solo.java",
"license": "apache-2.0",
"size": 124742
} | [
"android.util.Log",
"android.widget.ToggleButton"
] | import android.util.Log; import android.widget.ToggleButton; | import android.util.*; import android.widget.*; | [
"android.util",
"android.widget"
] | android.util; android.widget; | 1,972,545 |
if (obj == null) {
throw new IllegalStateException("Object provided must not be null");
}
Class<?> lookup = obj.getClass();
while (lookup.getSuperclass() != null) {
for (Field field : lookup.getDeclaredFields()) {
boolean accessible = field.isAccessible();
field.setAccessible(true);
if (field.getAnnotation(Inject.class) != null) {
Class<?> repositoryType = ReflectionUtils.getFieldType(field);
// make sure found field with Inject annotation is repository
if (repositoryType.getAnnotation(Repository.class) == null) {
throw new IllegalStateException("Wrongly placed " + Inject.class.getName() + " annotation. " +
"It should only be placed on classes mapped with: " + Repository.class.getName() + " annotation.");
}
try {
Object repository = field.get(obj);
// if repository is not injected inject it
if (repository == null) {
field.set(obj, databaseManager.getRepository(repositoryType));
}
} catch (IllegalAccessException e) {
throw new IllegalStateException("Could not access field value: " + field, e);
}
}
field.setAccessible(accessible);
}
lookup = lookup.getSuperclass();
}
} | if (obj == null) { throw new IllegalStateException(STR); } Class<?> lookup = obj.getClass(); while (lookup.getSuperclass() != null) { for (Field field : lookup.getDeclaredFields()) { boolean accessible = field.isAccessible(); field.setAccessible(true); if (field.getAnnotation(Inject.class) != null) { Class<?> repositoryType = ReflectionUtils.getFieldType(field); if (repositoryType.getAnnotation(Repository.class) == null) { throw new IllegalStateException(STR + Inject.class.getName() + STR + STR + Repository.class.getName() + STR); } try { Object repository = field.get(obj); if (repository == null) { field.set(obj, databaseManager.getRepository(repositoryType)); } } catch (IllegalAccessException e) { throw new IllegalStateException(STR + field, e); } } field.setAccessible(accessible); } lookup = lookup.getSuperclass(); } } | /**
* Method will lookup and inject repositories if found from given object. Repository should be
* mapped with {@link Repository} annotation and injected to objects field with {@link Inject}
* annotation.
*
* @param obj Object to look for Injectable repositories.
* @throws IllegalStateException if lookup injection will fail for number of reason.
*/ | Method will lookup and inject repositories if found from given object. Repository should be mapped with <code>Repository</code> annotation and injected to objects field with <code>Inject</code> annotation | lookupRepositories | {
"repo_name": "juhaku/juhakudb",
"path": "app/src/main/java/db/juhaku/juhakudb/core/android/RepositoryLookupInjector.java",
"license": "mit",
"size": 3947
} | [
"java.lang.reflect.Field"
] | import java.lang.reflect.Field; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 939,837 |
public List<String> getSupportedUriSchemes() {
return mSupportedUriSchemes;
} | List<String> function() { return mSupportedUriSchemes; } | /**
* The URI schemes supported by this {@code PhoneAccount}.
*
* @return The URI schemes.
*/ | The URI schemes supported by this PhoneAccount | getSupportedUriSchemes | {
"repo_name": "OmniEvo/android_frameworks_base",
"path": "telecomm/java/android/telecom/PhoneAccount.java",
"license": "gpl-3.0",
"size": 21058
} | [
"java.lang.String",
"java.util.List"
] | import java.lang.String; import java.util.List; | import java.lang.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,157,383 |
public static void main(String[] argv) {
int exitCode = -1;
ProgramDriver driver = new ProgramDriver();
try {
driver.addClass("wordcount", JaWordCounter.class, "A map/reduce "
+ "program that counts the words from Japnese document.");
driver.addClass("cooccurrence", JaCoOccurrence.class, "A map/reduce"
+ " program that count the co-occurrence word.");
driver.addClass("tokenize", TokenizerSample.class, "A Sample of"
+ " tokenizing Japanese document with map/reduce");
driver.driver(argv);
exitCode = 0;
} catch (Throwable e) {
e.printStackTrace();
}
System.exit(exitCode);
} | static void function(String[] argv) { int exitCode = -1; ProgramDriver driver = new ProgramDriver(); try { driver.addClass(STR, JaWordCounter.class, STR + STR); driver.addClass(STR, JaCoOccurrence.class, STR + STR); driver.addClass(STR, TokenizerSample.class, STR + STR); driver.driver(argv); exitCode = 0; } catch (Throwable e) { e.printStackTrace(); } System.exit(exitCode); } | /**
* A main method for this class.
* @param argv A arguments from command-line.
*/ | A main method for this class | main | {
"repo_name": "hohieukn/jatextmining",
"path": "src/net/java/jatextmining/JaTextminingDriver.java",
"license": "apache-2.0",
"size": 1791
} | [
"net.java.jatextmining.util.TokenizerSample",
"org.apache.hadoop.util.ProgramDriver"
] | import net.java.jatextmining.util.TokenizerSample; import org.apache.hadoop.util.ProgramDriver; | import net.java.jatextmining.util.*; import org.apache.hadoop.util.*; | [
"net.java.jatextmining",
"org.apache.hadoop"
] | net.java.jatextmining; org.apache.hadoop; | 2,762,519 |
@Test
public void testGroup() throws XapiParserException {
String description = "Correct parsing of group reference";
TestHelper.testStart(description);
Runner r = ArtificialDomain.runnerArtificialAutobiography();
XrefStatement xst =
(XrefStatement) r.agent.getXapiParser().parseLine(
"'Achilles' + 'Hector'/ exists.");
// TextUi.println(PrettyPrint.ppDetailed(entry.getValue(), r.agent));
Assert.assertTrue(xst.getSubject().getType() == XapiReference.XapiReferenceType.REF_GROUP);
TestHelper.testDone();
}
| void function() throws XapiParserException { String description = STR; TestHelper.testStart(description); Runner r = ArtificialDomain.runnerArtificialAutobiography(); XrefStatement xst = (XrefStatement) r.agent.getXapiParser().parseLine( STR); Assert.assertTrue(xst.getSubject().getType() == XapiReference.XapiReferenceType.REF_GROUP); TestHelper.testDone(); } | /**
* Tests whether group references (with +) are correctly parsed
* @throws XapiParserException
*/ | Tests whether group references (with +) are correctly parsed | testGroup | {
"repo_name": "Xapagy/Xapagy",
"path": "src/test/java/org/xapagy/xapi/testXapiParser.java",
"license": "agpl-3.0",
"size": 8139
} | [
"org.junit.Assert",
"org.xapagy.ArtificialDomain",
"org.xapagy.TestHelper",
"org.xapagy.debug.Runner",
"org.xapagy.xapi.reference.XapiReference",
"org.xapagy.xapi.reference.XrefStatement"
] | import org.junit.Assert; import org.xapagy.ArtificialDomain; import org.xapagy.TestHelper; import org.xapagy.debug.Runner; import org.xapagy.xapi.reference.XapiReference; import org.xapagy.xapi.reference.XrefStatement; | import org.junit.*; import org.xapagy.*; import org.xapagy.debug.*; import org.xapagy.xapi.reference.*; | [
"org.junit",
"org.xapagy",
"org.xapagy.debug",
"org.xapagy.xapi"
] | org.junit; org.xapagy; org.xapagy.debug; org.xapagy.xapi; | 915,251 |
public List<Configuracao> findAll() throws SystemException {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | List<Configuracao> function() throws SystemException { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } | /**
* Returns all the configuracaos.
*
* @return the configuracaos
* @throws SystemException if a system exception occurred
*/ | Returns all the configuracaos | findAll | {
"repo_name": "camaradosdeputadosoficial/edemocracia",
"path": "cd-priorizacao-portlet/src/main/java/br/gov/camara/edemocracia/portlets/priorizacao/service/persistence/ConfiguracaoPersistenceImpl.java",
"license": "lgpl-2.1",
"size": 33905
} | [
"br.gov.camara.edemocracia.portlets.priorizacao.model.Configuracao",
"com.liferay.portal.kernel.dao.orm.QueryUtil",
"com.liferay.portal.kernel.exception.SystemException",
"java.util.List"
] | import br.gov.camara.edemocracia.portlets.priorizacao.model.Configuracao; import com.liferay.portal.kernel.dao.orm.QueryUtil; import com.liferay.portal.kernel.exception.SystemException; import java.util.List; | import br.gov.camara.edemocracia.portlets.priorizacao.model.*; import com.liferay.portal.kernel.dao.orm.*; import com.liferay.portal.kernel.exception.*; import java.util.*; | [
"br.gov.camara",
"com.liferay.portal",
"java.util"
] | br.gov.camara; com.liferay.portal; java.util; | 498,353 |
public void writeListEnd()
throws IOException
{
flushIfFull();
_buffer[_offset++] = (byte) BC_END;
} | void function() throws IOException { flushIfFull(); _buffer[_offset++] = (byte) BC_END; } | /**
* Writes the tail of the list to the stream for a variable-length list.
*/ | Writes the tail of the list to the stream for a variable-length list | writeListEnd | {
"repo_name": "hhaip/langtaosha",
"path": "lts-hessian/src/main/java/com/caucho/hessian/io/Hessian2Output.java",
"license": "mit",
"size": 34747
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 783,567 |
protected void processInjectionBasedOnCurrentContext() {
Assert.notNull(this, "Target object must not be null");
WebApplicationContext appCtx = getApplicationContext();
if (appCtx != null) {
processInjection(appCtx);
}
else {
if (logger.isLoggable(Level.FINER)) {
logger.finer("Current WebApplicationContext is not available for processing of " +
ClassUtils.getShortName(this.getClass()) + ": " +
"Make sure this class gets constructed in a Spring web application. Proceeding without injection.");
}
}
} | void function() { Assert.notNull(this, STR); WebApplicationContext appCtx = getApplicationContext(); if (appCtx != null) { processInjection(appCtx); } else { if (logger.isLoggable(Level.FINER)) { logger.finer(STR + ClassUtils.getShortName(this.getClass()) + STR + STR); } } } | /**
* Process <code>@Autowired</code> injection for the given target object,
* based on the current web application context.
* <p>Intended for use as a delegate.
* @param target the target object to process
* @see org.springframework.web.context.ContextLoader#getCurrentWebApplicationContext()
*/ | Process <code>@Autowired</code> injection for the given target object, based on the current web application context. Intended for use as a delegate | processInjectionBasedOnCurrentContext | {
"repo_name": "navita-tecnologia/navita-mobile",
"path": "console/src/main/java/br/com/navita/mobile/console/util/NavitaAutowiringSupport.java",
"license": "apache-2.0",
"size": 3272
} | [
"java.util.logging.Level",
"org.springframework.util.Assert",
"org.springframework.util.ClassUtils",
"org.springframework.web.context.WebApplicationContext"
] | import java.util.logging.Level; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.web.context.WebApplicationContext; | import java.util.logging.*; import org.springframework.util.*; import org.springframework.web.context.*; | [
"java.util",
"org.springframework.util",
"org.springframework.web"
] | java.util; org.springframework.util; org.springframework.web; | 784,727 |
public Long getOrderTermNetDays() {
List<GenericValue> orderTerms = EntityUtil.filterByAnd(getOrderTerms(), UtilMisc.toMap("termTypeId", "FIN_PAYMENT_TERM"));
if (UtilValidate.isEmpty(orderTerms)) {
return null;
} else if (orderTerms.size() > 1) {
Debug.logWarning("Found " + orderTerms.size() + " FIN_PAYMENT_TERM order terms for orderId [" + getOrderId() + "], using the first one ", module);
}
return orderTerms.get(0).getLong("termDays");
} | Long function() { List<GenericValue> orderTerms = EntityUtil.filterByAnd(getOrderTerms(), UtilMisc.toMap(STR, STR)); if (UtilValidate.isEmpty(orderTerms)) { return null; } else if (orderTerms.size() > 1) { Debug.logWarning(STR + orderTerms.size() + STR + getOrderId() + STR, module); } return orderTerms.get(0).getLong(STR); } | /**
* Return the number of days from termDays of first FIN_PAYMENT_TERM
* @return number of days from termDays of first FIN_PAYMENT_TERM
*/ | Return the number of days from termDays of first FIN_PAYMENT_TERM | getOrderTermNetDays | {
"repo_name": "rohankarthik/Ofbiz",
"path": "applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReadHelper.java",
"license": "apache-2.0",
"size": 148273
} | [
"java.util.List",
"org.apache.ofbiz.base.util.Debug",
"org.apache.ofbiz.base.util.UtilMisc",
"org.apache.ofbiz.base.util.UtilValidate",
"org.apache.ofbiz.entity.GenericValue",
"org.apache.ofbiz.entity.util.EntityUtil"
] | import java.util.List; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.util.EntityUtil; | import java.util.*; import org.apache.ofbiz.base.util.*; import org.apache.ofbiz.entity.*; import org.apache.ofbiz.entity.util.*; | [
"java.util",
"org.apache.ofbiz"
] | java.util; org.apache.ofbiz; | 2,541,986 |
private void wrapComNode(OozieProgramNode node, CommonProgramWidget comWidget){
List<String> params = new LinkedList<String>();
List<String> files = new LinkedList<String>();
for (NodeShape shape : comWidget.getOutNodeShapes())
files.add(((OutNodeShape) shape).getFileId());
for (Parameter param : comWidget.getProgramConf()
.getParameters())
params.add(param.getIndex() + ":" + param.getParamValue());
node.initAsCommonNode(files, params);
} | void function(OozieProgramNode node, CommonProgramWidget comWidget){ List<String> params = new LinkedList<String>(); List<String> files = new LinkedList<String>(); for (NodeShape shape : comWidget.getOutNodeShapes()) files.add(((OutNodeShape) shape).getFileId()); for (Parameter param : comWidget.getProgramConf() .getParameters()) params.add(param.getIndex() + ":" + param.getParamValue()); node.initAsCommonNode(files, params); } | /**
* Wrap common program widget
* @param node
* @param comWidget
*/ | Wrap common program widget | wrapComNode | {
"repo_name": "ICT-BDA/EasyML",
"path": "src/main/java/eml/studio/client/graph/OozieGraphBuilder.java",
"license": "apache-2.0",
"size": 10956
} | [
"java.util.LinkedList",
"java.util.List"
] | import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,636,829 |
public String getTerminologyId(
SubsetMember<? extends ComponentHasAttributes, ? extends Subset> subsetMember)
throws Exception; | String function( SubsetMember<? extends ComponentHasAttributes, ? extends Subset> subsetMember) throws Exception; | /**
* Returns the terminology id.
*
* @param subsetMember the subset member
* @return the string
* @throws Exception the exception
*/ | Returns the terminology id | getTerminologyId | {
"repo_name": "WestCoastInformatics/UMLS-Terminology-Server",
"path": "services/src/main/java/com/wci/umls/server/services/handlers/IdentifierAssignmentHandler.java",
"license": "apache-2.0",
"size": 7022
} | [
"com.wci.umls.server.model.content.ComponentHasAttributes",
"com.wci.umls.server.model.content.Subset",
"com.wci.umls.server.model.content.SubsetMember"
] | import com.wci.umls.server.model.content.ComponentHasAttributes; import com.wci.umls.server.model.content.Subset; import com.wci.umls.server.model.content.SubsetMember; | import com.wci.umls.server.model.content.*; | [
"com.wci.umls"
] | com.wci.umls; | 636,346 |
private static final void createConfigDirectoryIfNeeded() {
try {
if (!Files.exists(getConfigDirectory())) {
Files.createDirectories(getConfigDirectory());
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
| static final void function() { try { if (!Files.exists(getConfigDirectory())) { Files.createDirectories(getConfigDirectory()); } } catch (IOException e) { e.printStackTrace(); } } | /**
* Creates the configuration directory if it does not exist.
*/ | Creates the configuration directory if it does not exist | createConfigDirectoryIfNeeded | {
"repo_name": "RobertZenz/jMathPaper",
"path": "src/org/bonsaimind/jmathpaper/core/configuration/Configuration.java",
"license": "lgpl-3.0",
"size": 8173
} | [
"java.io.IOException",
"java.nio.file.Files"
] | import java.io.IOException; import java.nio.file.Files; | import java.io.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,257,153 |
protected ClassLoader bindThread() {
ClassLoader oldContextClassLoader =
Thread.currentThread().getContextClassLoader();
if (getResources() == null)
return oldContextClassLoader;
if (getLoader().getClassLoader() != null) {
Thread.currentThread().setContextClassLoader
(getLoader().getClassLoader());
}
DirContextURLStreamHandler.bindThread(getResources());
if (isUseNaming()) {
try {
ContextBindings.bindThread(this, this);
} catch (NamingException e) {
// Silent catch, as this is a normal case during the early
// startup stages
}
}
return oldContextClassLoader;
} | ClassLoader function() { ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader(); if (getResources() == null) return oldContextClassLoader; if (getLoader().getClassLoader() != null) { Thread.currentThread().setContextClassLoader (getLoader().getClassLoader()); } DirContextURLStreamHandler.bindThread(getResources()); if (isUseNaming()) { try { ContextBindings.bindThread(this, this); } catch (NamingException e) { } } return oldContextClassLoader; } | /**
* Bind current thread, both for CL purposes and for JNDI ENC support
* during : startup, shutdown and realoading of the context.
*
* @return the previous context class loader
*/ | Bind current thread, both for CL purposes and for JNDI ENC support during : startup, shutdown and realoading of the context | bindThread | {
"repo_name": "WhiteBearSolutions/WBSAirback",
"path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/catalina/core/StandardContext.java",
"license": "apache-2.0",
"size": 198551
} | [
"javax.naming.NamingException",
"org.apache.naming.ContextBindings",
"org.apache.naming.resources.DirContextURLStreamHandler"
] | import javax.naming.NamingException; import org.apache.naming.ContextBindings; import org.apache.naming.resources.DirContextURLStreamHandler; | import javax.naming.*; import org.apache.naming.*; import org.apache.naming.resources.*; | [
"javax.naming",
"org.apache.naming"
] | javax.naming; org.apache.naming; | 1,555,217 |
Map<String, ? extends FeatureMetadatum> getMetadata(); | Map<String, ? extends FeatureMetadatum> getMetadata(); | /**
* Return the list of associated metadata, like age of onset or pace of progression.
*
* @return an unmodifiable map with the {@link FeatureMetadatum#getType() metadatum type} as the key and the actual
* {@link FeatureMetadatum metadatum} as the value, or an empty map if no metadata is recorded
*/ | Return the list of associated metadata, like age of onset or pace of progression | getMetadata | {
"repo_name": "mjshepherd/phenotips",
"path": "components/patient-data/api/src/main/java/org/phenotips/data/Feature.java",
"license": "agpl-3.0",
"size": 3274
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,627,842 |
public void printStats() {
System.out.println("============= TOPSEQRULES - STATS ========");
System.out.println("Max candidates: " + maxCandidateCount);
System.out.println("Sequential rules count: " + kRules.size());
System.out.println("-");
System.out.println("Total time: " + (((double)(timeEnd - timeStart))/1000d) + " s");
System.out.println("Max memory: " + MemoryLogger.getInstance().getMaxMemory());
System.out.println("Minsup relative: " + minsuppRelative);
System.out.println("==========================================");
} | void function() { System.out.println(STR); System.out.println(STR + maxCandidateCount); System.out.println(STR + kRules.size()); System.out.println("-"); System.out.println(STR + (((double)(timeEnd - timeStart))/1000d) + STR); System.out.println(STR + MemoryLogger.getInstance().getMaxMemory()); System.out.println(STR + minsuppRelative); System.out.println(STR); } | /**
* Print statistics about the last algorithm execution to System.out.
*/ | Print statistics about the last algorithm execution to System.out | printStats | {
"repo_name": "dragonzhou/humor",
"path": "src/ca/pfv/spmf/algorithms/sequential_rules/topseqrules_and_tns/AlgoTopSeqRules.java",
"license": "apache-2.0",
"size": 25942
} | [
"ca.pfv.spmf.tools.MemoryLogger"
] | import ca.pfv.spmf.tools.MemoryLogger; | import ca.pfv.spmf.tools.*; | [
"ca.pfv.spmf"
] | ca.pfv.spmf; | 244,004 |
public String readPropertyFromTemplate(CmsObject cms, CmsResource res, String propertyName, String fallbackValue) {
try {
CmsProperty templateProp = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TEMPLATE, true);
String templatePath = templateProp.getValue().trim();
if (hasPropertyPrefix(templatePath)) {
I_CmsTemplateContextProvider provider = getTemplateContextProvider(templatePath);
return provider.readCommonProperty(cms, propertyName, fallbackValue);
} else {
return cms.readPropertyObject(templatePath, propertyName, false).getValue(fallbackValue);
}
} catch (Exception e) {
LOG.error(e);
return fallbackValue;
}
}
| String function(CmsObject cms, CmsResource res, String propertyName, String fallbackValue) { try { CmsProperty templateProp = cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TEMPLATE, true); String templatePath = templateProp.getValue().trim(); if (hasPropertyPrefix(templatePath)) { I_CmsTemplateContextProvider provider = getTemplateContextProvider(templatePath); return provider.readCommonProperty(cms, propertyName, fallbackValue); } else { return cms.readPropertyObject(templatePath, propertyName, false).getValue(fallbackValue); } } catch (Exception e) { LOG.error(e); return fallbackValue; } } | /**
* Utility method which either reads a property from the template used for a specific resource, or from the template context provider used for the resource if available.<p>
*
* @param cms the CMS context to use
* @param res the resource from whose template or template context provider the property should be read
* @param propertyName the property name
* @param fallbackValue the fallback value
*
* @return the property value
*/ | Utility method which either reads a property from the template used for a specific resource, or from the template context provider used for the resource if available | readPropertyFromTemplate | {
"repo_name": "it-tavis/opencms-core",
"path": "src/org/opencms/loader/CmsTemplateContextManager.java",
"license": "lgpl-2.1",
"size": 17348
} | [
"org.opencms.file.CmsObject",
"org.opencms.file.CmsProperty",
"org.opencms.file.CmsPropertyDefinition",
"org.opencms.file.CmsResource"
] | import org.opencms.file.CmsObject; import org.opencms.file.CmsProperty; import org.opencms.file.CmsPropertyDefinition; import org.opencms.file.CmsResource; | import org.opencms.file.*; | [
"org.opencms.file"
] | org.opencms.file; | 2,258,053 |
public static Attribute getScaleFactorAttribute(Variable variable) {
Attribute attribute = null;
try {
attribute = NetCdfReader.getAttribute(variable, SCALE_FACTOR_ATTR_NAME);
} catch (NetCdfAttributeNotFoundException e) {
// Do nothing
}
return attribute;
} | static Attribute function(Variable variable) { Attribute attribute = null; try { attribute = NetCdfReader.getAttribute(variable, SCALE_FACTOR_ATTR_NAME); } catch (NetCdfAttributeNotFoundException e) { } return attribute; } | /**
* Gets the scale factor attribute.
*
* @param variable the variable
*
* @return the scale factor attribute
*/ | Gets the scale factor attribute | getScaleFactorAttribute | {
"repo_name": "clstoulouse/motu",
"path": "motu-web/src/main/java/fr/cls/atoll/motu/web/dal/request/netcdf/NetCdfReader.java",
"license": "lgpl-3.0",
"size": 74367
} | [
"fr.cls.atoll.motu.web.bll.exception.NetCdfAttributeNotFoundException"
] | import fr.cls.atoll.motu.web.bll.exception.NetCdfAttributeNotFoundException; | import fr.cls.atoll.motu.web.bll.exception.*; | [
"fr.cls.atoll"
] | fr.cls.atoll; | 1,242,894 |
@Test
public void entregarEntradas() throws CompraYaEntregadaException,
InstanceNotFoundException, SesionLlenaException,
BadArgumentException, TarjetaCaducadaException,
SesionPasadaException {
// Creamos los datos necesarios para realizar una compra
UserProfile userProfile = new UserProfile("daoUser2",
PasswordEncrypter.crypt("userPassword2"), "name2", "lastName2",
"user2@udc.es", TipoUsuario.ESPECTADOR);
userProfileDao.save(userProfile);
Provincia provincia = new Provincia("Lugo", new HashSet<Cine>());
provinciaDao.save(provincia);
Cine cine = new Cine("Filmax As Termas", new Float(9.80), provincia,
new HashSet<Sala>());
cineDao.save(cine);
Sala sala = new Sala(20, 30, cine);
salaDao.save(sala);
Pelicula pelicula = new Pelicula("No habra paz para los malvados",
Calendar.getInstance(), Calendar.getInstance(), 15,
"La pelicula que emociono a Spielberg");
peliculaDao.save(pelicula);
Calendar expsesion = Calendar.getInstance();
expsesion.add(Calendar.YEAR, 1);
Sesion sesion = new Sesion(new Float(13), expsesion, pelicula, sala, 0);
sesionDao.save(sesion);
// Añadimos una compra
Calendar exptarjeta = Calendar.getInstance();
exptarjeta.add(Calendar.YEAR, 1);
Long compraId = compraService.createCompra(
userProfile.getUserProfileId(), 3, "1234567889123456",
exptarjeta, sesion.getIdSesion());
Compra compra = compraService.findCompra(compraId);
// Comprobamos que las entregadas inicialmente no estan entregadas
assertFalse(compra.isEntregada());
// Entregamos entradas
compraService.entregarEntradas(compraId);
assertEquals(3, compra.getSesion().getnAsistentes());
// TODO La excepcion CompraYaEntregadaException
} | void function() throws CompraYaEntregadaException, InstanceNotFoundException, SesionLlenaException, BadArgumentException, TarjetaCaducadaException, SesionPasadaException { UserProfile userProfile = new UserProfile(STR, PasswordEncrypter.crypt(STR), "name2", STR, STR, TipoUsuario.ESPECTADOR); userProfileDao.save(userProfile); Provincia provincia = new Provincia("Lugo", new HashSet<Cine>()); provinciaDao.save(provincia); Cine cine = new Cine(STR, new Float(9.80), provincia, new HashSet<Sala>()); cineDao.save(cine); Sala sala = new Sala(20, 30, cine); salaDao.save(sala); Pelicula pelicula = new Pelicula(STR, Calendar.getInstance(), Calendar.getInstance(), 15, STR); peliculaDao.save(pelicula); Calendar expsesion = Calendar.getInstance(); expsesion.add(Calendar.YEAR, 1); Sesion sesion = new Sesion(new Float(13), expsesion, pelicula, sala, 0); sesionDao.save(sesion); Calendar exptarjeta = Calendar.getInstance(); exptarjeta.add(Calendar.YEAR, 1); Long compraId = compraService.createCompra( userProfile.getUserProfileId(), 3, STR, exptarjeta, sesion.getIdSesion()); Compra compra = compraService.findCompra(compraId); assertFalse(compra.isEntregada()); compraService.entregarEntradas(compraId); assertEquals(3, compra.getSesion().getnAsistentes()); } | /**
* Entregar entradas.
*
* @throws CompraYaEntregadaException
* the compra ya entregada exception
* @throws InstanceNotFoundException
* the instance not found exception
* @throws SesionLlenaException
* the sesion llena exception
* @throws BadArgumentException
* the bad argument exception
* @throws TarjetaCaducadaException
* the tarjeta caducada exception
* @throws SesionPasadaException
* the sesion pasada exception
*/ | Entregar entradas | entregarEntradas | {
"repo_name": "iago-suarez/pojo-cinema-app",
"path": "src/test/java/es/udc/pojo/test/model/compraservice/CompraServiceTest.java",
"license": "gpl-2.0",
"size": 26430
} | [
"es.udc.pojo.model.cine.Cine",
"es.udc.pojo.model.compra.Compra",
"es.udc.pojo.model.pelicula.Pelicula",
"es.udc.pojo.model.provincia.Provincia",
"es.udc.pojo.model.sala.Sala",
"es.udc.pojo.model.sesion.Sesion",
"es.udc.pojo.model.userprofile.TipoUsuario",
"es.udc.pojo.model.userprofile.UserProfile",
... | import es.udc.pojo.model.cine.Cine; import es.udc.pojo.model.compra.Compra; import es.udc.pojo.model.pelicula.Pelicula; import es.udc.pojo.model.provincia.Provincia; import es.udc.pojo.model.sala.Sala; import es.udc.pojo.model.sesion.Sesion; import es.udc.pojo.model.userprofile.TipoUsuario; import es.udc.pojo.model.userprofile.UserProfile; import es.udc.pojo.model.userservice.util.PasswordEncrypter; import es.udc.pojo.model.util.BadArgumentException; import es.udc.pojo.model.util.CompraYaEntregadaException; import es.udc.pojo.model.util.SesionLlenaException; import es.udc.pojo.model.util.SesionPasadaException; import es.udc.pojo.model.util.TarjetaCaducadaException; import es.udc.pojo.modelutil.exceptions.InstanceNotFoundException; import java.util.Calendar; import java.util.HashSet; import org.junit.Assert; | import es.udc.pojo.model.cine.*; import es.udc.pojo.model.compra.*; import es.udc.pojo.model.pelicula.*; import es.udc.pojo.model.provincia.*; import es.udc.pojo.model.sala.*; import es.udc.pojo.model.sesion.*; import es.udc.pojo.model.userprofile.*; import es.udc.pojo.model.userservice.util.*; import es.udc.pojo.model.util.*; import es.udc.pojo.modelutil.exceptions.*; import java.util.*; import org.junit.*; | [
"es.udc.pojo",
"java.util",
"org.junit"
] | es.udc.pojo; java.util; org.junit; | 518,218 |
public long getLong(String key, long defValue) {
Assert.NOT_IMPLEMENTED();
return 0;
}
| long function(String key, long defValue) { Assert.NOT_IMPLEMENTED(); return 0; } | /**
* Retrieve a long value from the preferences.
*/ | Retrieve a long value from the preferences | getLong | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/src/android2iphone/android/content/SharedPreferences.java",
"license": "gpl-2.0",
"size": 7072
} | [
"android.internal.Assert"
] | import android.internal.Assert; | import android.internal.*; | [
"android.internal"
] | android.internal; | 952,246 |
@Test
public void testReadIfCreateRecordReaderFails() throws Exception {
thrown.expect(Exception.class);
thrown.expectMessage("Exception in creating RecordReader");
InputFormat<Text, Employee> mockInputFormat = Mockito.mock(EmployeeInputFormat.class);
Mockito.when(
mockInputFormat.createRecordReader(
Mockito.any(InputSplit.class), Mockito.any(TaskAttemptContext.class)))
.thenThrow(new IOException("Exception in creating RecordReader"));
HadoopInputFormatBoundedSource<Text, Employee> boundedSource =
new HadoopInputFormatBoundedSource<>(
serConf,
WritableCoder.of(Text.class),
AvroCoder.of(Employee.class),
null, // No key translation required.
null, // No value translation required.
new SerializableSplit(),
false,
false);
boundedSource.setInputFormatObj(mockInputFormat);
SourceTestUtils.readFromSource(boundedSource, p.getOptions());
} | void function() throws Exception { thrown.expect(Exception.class); thrown.expectMessage(STR); InputFormat<Text, Employee> mockInputFormat = Mockito.mock(EmployeeInputFormat.class); Mockito.when( mockInputFormat.createRecordReader( Mockito.any(InputSplit.class), Mockito.any(TaskAttemptContext.class))) .thenThrow(new IOException(STR)); HadoopInputFormatBoundedSource<Text, Employee> boundedSource = new HadoopInputFormatBoundedSource<>( serConf, WritableCoder.of(Text.class), AvroCoder.of(Employee.class), null, null, new SerializableSplit(), false, false); boundedSource.setInputFormatObj(mockInputFormat); SourceTestUtils.readFromSource(boundedSource, p.getOptions()); } | /**
* This test validates behavior of {@link HadoopInputFormatBoundedSource} if RecordReader object
* creation fails.
*/ | This test validates behavior of <code>HadoopInputFormatBoundedSource</code> if RecordReader object creation fails | testReadIfCreateRecordReaderFails | {
"repo_name": "lukecwik/incubator-beam",
"path": "sdks/java/io/hadoop-format/src/test/java/org/apache/beam/sdk/io/hadoop/format/HadoopFormatIOReadTest.java",
"license": "apache-2.0",
"size": 46759
} | [
"java.io.IOException",
"org.apache.beam.sdk.coders.AvroCoder",
"org.apache.beam.sdk.io.hadoop.WritableCoder",
"org.apache.beam.sdk.io.hadoop.format.HadoopFormatIO",
"org.apache.beam.sdk.testing.SourceTestUtils",
"org.apache.hadoop.io.Text",
"org.apache.hadoop.mapreduce.InputFormat",
"org.apache.hadoop... | import java.io.IOException; import org.apache.beam.sdk.coders.AvroCoder; import org.apache.beam.sdk.io.hadoop.WritableCoder; import org.apache.beam.sdk.io.hadoop.format.HadoopFormatIO; import org.apache.beam.sdk.testing.SourceTestUtils; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.InputFormat; import org.apache.hadoop.mapreduce.InputSplit; import org.apache.hadoop.mapreduce.TaskAttemptContext; import org.mockito.Mockito; | import java.io.*; import org.apache.beam.sdk.coders.*; import org.apache.beam.sdk.io.hadoop.*; import org.apache.beam.sdk.io.hadoop.format.*; import org.apache.beam.sdk.testing.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.*; import org.mockito.*; | [
"java.io",
"org.apache.beam",
"org.apache.hadoop",
"org.mockito"
] | java.io; org.apache.beam; org.apache.hadoop; org.mockito; | 1,375,882 |
private Path getTerraformBin() {
return getHome().resolve(getOsValue(bins));
} | Path function() { return getHome().resolve(getOsValue(bins)); } | /**
* Return the Terraform binary file reference.
*/ | Return the Terraform binary file reference | getTerraformBin | {
"repo_name": "ligoj/plugin-prov",
"path": "src/main/java/org/ligoj/app/plugin/prov/terraform/TerraformUtils.java",
"license": "mit",
"size": 14701
} | [
"java.nio.file.Path"
] | import java.nio.file.Path; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 1,703,479 |
public final Rectangle2D getBounds2D (Raster src) {
return src.getBounds();
} | final Rectangle2D function (Raster src) { return src.getBounds(); } | /**
* Returns the bounding box of the filtered destination Raster. Since
* this is not a geometric operation, the bounding box does not
* change.
* @param src the <code>Raster</code> to be filtered
* @return the bounds of the filtered definition <code>Raster</code>.
*/ | Returns the bounding box of the filtered destination Raster. Since this is not a geometric operation, the bounding box does not change | getBounds2D | {
"repo_name": "isaacl/openjdk-jdk",
"path": "src/share/classes/java/awt/image/LookupOp.java",
"license": "gpl-2.0",
"size": 22973
} | [
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,844,158 |
@Override
public List<String> getMatchingIndices(Metadata metadata) {
return metadata.indices().keySet().stream().filter(this::matchesIndexPattern).collect(Collectors.toUnmodifiableList());
} | List<String> function(Metadata metadata) { return metadata.indices().keySet().stream().filter(this::matchesIndexPattern).collect(Collectors.toUnmodifiableList()); } | /**
* Retrieves a list of all indices which match this descriptor's pattern.
*
* This cannot be done via {@link org.elasticsearch.cluster.metadata.IndexNameExpressionResolver} because that class can only handle
* simple wildcard expressions, but system index name patterns may use full Lucene regular expression syntax,
*
* @param metadata The current metadata to get the list of matching indices from
* @return A list of index names that match this descriptor
*/ | Retrieves a list of all indices which match this descriptor's pattern. This cannot be done via <code>org.elasticsearch.cluster.metadata.IndexNameExpressionResolver</code> because that class can only handle simple wildcard expressions, but system index name patterns may use full Lucene regular expression syntax | getMatchingIndices | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/indices/SystemIndexDescriptor.java",
"license": "apache-2.0",
"size": 32558
} | [
"java.util.List",
"java.util.stream.Collectors",
"org.elasticsearch.cluster.metadata.Metadata"
] | import java.util.List; import java.util.stream.Collectors; import org.elasticsearch.cluster.metadata.Metadata; | import java.util.*; import java.util.stream.*; import org.elasticsearch.cluster.metadata.*; | [
"java.util",
"org.elasticsearch.cluster"
] | java.util; org.elasticsearch.cluster; | 1,710,389 |
public static ims.core.clinical.domain.objects.ReferralLetterDetails extractReferralLetterDetails(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.ReferralLetterDetailsBookingVo valueObject)
{
return extractReferralLetterDetails(domainFactory, valueObject, new HashMap());
}
| static ims.core.clinical.domain.objects.ReferralLetterDetails function(ims.domain.ILightweightDomainFactory domainFactory, ims.careuk.vo.ReferralLetterDetailsBookingVo valueObject) { return extractReferralLetterDetails(domainFactory, valueObject, new HashMap()); } | /**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/ | Create the domain object from the value object | extractReferralLetterDetails | {
"repo_name": "open-health-hub/openmaxims-linux",
"path": "openmaxims_workspace/ValueObjects/src/ims/careuk/vo/domain/ReferralLetterDetailsBookingVoAssembler.java",
"license": "agpl-3.0",
"size": 18328
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 312,132 |
public long getFreeDiskSpace() throws IOException, InterruptedException {
return act(new GetFreeDiskSpace());
} | long function() throws IOException, InterruptedException { return act(new GetFreeDiskSpace()); } | /**
* Returns the number of unallocated bytes in the partition of that file.
* @since 1.542
*/ | Returns the number of unallocated bytes in the partition of that file | getFreeDiskSpace | {
"repo_name": "pjanouse/jenkins",
"path": "core/src/main/java/hudson/FilePath.java",
"license": "mit",
"size": 148331
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,868,094 |
public File getOutput() {
return this.output;
} | File function() { return this.output; } | /** Replies the output file.
*
* @return the output
*/ | Replies the output file | getOutput | {
"repo_name": "sarl/sarl",
"path": "main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/config/SARLConfiguration.java",
"license": "apache-2.0",
"size": 5435
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 814,728 |
public void addBaseCastConsumer(IBaseCastConsumer listener) {
if (null != listener) {
synchronized (mBaseCastConsumers) {
if (mBaseCastConsumers.add(listener)) {
LOGD(TAG, "Successfully added the new BaseCastConsumer listener " + listener);
}
}
}
} | void function(IBaseCastConsumer listener) { if (null != listener) { synchronized (mBaseCastConsumers) { if (mBaseCastConsumers.add(listener)) { LOGD(TAG, STR + listener); } } } } | /**
* Registers an {@link IBaseCastConsumer} interface with this class. Registered listeners will
* be notified of changes to a variety of lifecycle callbacks that the interface provides.
*
* @see BaseCastConsumerImpl
* @param listener
*/ | Registers an <code>IBaseCastConsumer</code> interface with this class. Registered listeners will be notified of changes to a variety of lifecycle callbacks that the interface provides | addBaseCastConsumer | {
"repo_name": "hanspeide/CastSupportLib",
"path": "src/com/google/sample/castcompanionlibrary/cast/BaseCastManager.java",
"license": "apache-2.0",
"size": 43986
} | [
"com.google.sample.castcompanionlibrary.cast.callbacks.IBaseCastConsumer"
] | import com.google.sample.castcompanionlibrary.cast.callbacks.IBaseCastConsumer; | import com.google.sample.castcompanionlibrary.cast.callbacks.*; | [
"com.google.sample"
] | com.google.sample; | 2,557,968 |
public final T add(final Collection<Link> links) {
return this.add(links, Direction.ANY);
}
| final T function(final Collection<Link> links) { return this.add(links, Direction.ANY); } | /**
* Add a step to the path.
*
* @param links links from the current end of this path to another table.
* @return an instance with the step added.
* @throws IllegalArgumentException if <code>links</code> are not all between the current end
* and the same other table.
*/ | Add a step to the path | add | {
"repo_name": "mbshopM/openconcerto",
"path": "OpenConcerto/src/org/openconcerto/sql/model/graph/AbstractPath.java",
"license": "gpl-3.0",
"size": 9503
} | [
"java.util.Collection",
"org.openconcerto.sql.model.graph.Link"
] | import java.util.Collection; import org.openconcerto.sql.model.graph.Link; | import java.util.*; import org.openconcerto.sql.model.graph.*; | [
"java.util",
"org.openconcerto.sql"
] | java.util; org.openconcerto.sql; | 1,515,963 |
public GreylistConfig getGreyListConfig() {
return (GreylistConfig)configurations.get(ConfigType.GREYLIST);
}
| GreylistConfig function() { return (GreylistConfig)configurations.get(ConfigType.GREYLIST); } | /**
* returns the greylist configuration
*
* @author xize
* @return GreylistConfig
*/ | returns the greylist configuration | getGreyListConfig | {
"repo_name": "xEssentials/xEssentials",
"path": "src/tv/mineinthebox/essentials/GlobalConfiguration.java",
"license": "gpl-3.0",
"size": 10967
} | [
"tv.mineinthebox.essentials.configurations.GreylistConfig",
"tv.mineinthebox.essentials.enums.ConfigType"
] | import tv.mineinthebox.essentials.configurations.GreylistConfig; import tv.mineinthebox.essentials.enums.ConfigType; | import tv.mineinthebox.essentials.configurations.*; import tv.mineinthebox.essentials.enums.*; | [
"tv.mineinthebox.essentials"
] | tv.mineinthebox.essentials; | 960,134 |
public TreeSet<String> values(final Document document, final boolean checkAllItems) {
return DACL.values(document, this, checkAllItems);
}
| TreeSet<String> function(final Document document, final boolean checkAllItems) { return DACL.values(document, this, checkAllItems); } | /**
* Gets the DACL Member values from the source document.
*
* Conditionally retreives values from ALL DACL items or ONLY from the item defined by {@link DACL#getItemname()}.
*
* @param document
* Document from which to retreive the Member values.
*
* @param checkAllItems
* Flag indicating if all items should be checked. If false then only the {@link DACL#getItemname()} will be checked.
*
* @return DACL Member values. Null if not present or empty.
*/ | Gets the DACL Member values from the source document. Conditionally retreives values from ALL DACL items or ONLY from the item defined by <code>DACL#getItemname()</code> | values | {
"repo_name": "mariusj/org.openntf.domino",
"path": "domino/core/src/main/java/org/openntf/domino/utils/DACL.java",
"license": "apache-2.0",
"size": 37947
} | [
"java.util.TreeSet",
"org.openntf.domino.Document"
] | import java.util.TreeSet; import org.openntf.domino.Document; | import java.util.*; import org.openntf.domino.*; | [
"java.util",
"org.openntf.domino"
] | java.util; org.openntf.domino; | 1,938,241 |
// This can be inlined. Package visible, for use by iterator.
void checkMod()
{
if (data != backingList.data)
throw new ConcurrentModificationException();
} | void checkMod() { if (data != backingList.data) throw new ConcurrentModificationException(); } | /**
* This method checks the two modCount fields to ensure that there has
* not been a concurrent modification, returning if all is okay.
*
* @throws ConcurrentModificationException if the backing list has been
* modified externally to this sublist
*/ | This method checks the two modCount fields to ensure that there has not been a concurrent modification, returning if all is okay | checkMod | {
"repo_name": "cfriedt/classpath",
"path": "java/util/concurrent/CopyOnWriteArrayList.java",
"license": "gpl-2.0",
"size": 45081
} | [
"java.util.ConcurrentModificationException"
] | import java.util.ConcurrentModificationException; | import java.util.*; | [
"java.util"
] | java.util; | 2,405,876 |
public void setpartOtherCost(BudgetDecimal partOtherCost) {
this.partOtherCost = partOtherCost;
} | void function(BudgetDecimal partOtherCost) { this.partOtherCost = partOtherCost; } | /**
* Setter for property partOtherCost.
*
* @param partOtherCost New value of property partOtherCost.
*/ | Setter for property partOtherCost | setpartOtherCost | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/s2s/generator/bo/BudgetSummaryInfo.java",
"license": "apache-2.0",
"size": 18827
} | [
"org.kuali.kra.budget.BudgetDecimal"
] | import org.kuali.kra.budget.BudgetDecimal; | import org.kuali.kra.budget.*; | [
"org.kuali.kra"
] | org.kuali.kra; | 2,101,859 |
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object)
{
super.collectNewChildDescriptors(newChildDescriptors, object);
}
protected ItemPropertyDescriptor receptorsPropertyDescriptor; | void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); } protected ItemPropertyDescriptor receptorsPropertyDescriptor; | /**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object. | collectNewChildDescriptors | {
"repo_name": "roboidstudio/embedded",
"path": "org.roboid.robot.model.edit/src/org/roboid/robot/provider/SensoryDeviceItemProvider.java",
"license": "lgpl-2.1",
"size": 7116
} | [
"java.util.Collection",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import java.util.Collection; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import java.util.*; import org.eclipse.emf.edit.provider.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 1,025,143 |
@Override
protected void onPreExecute() {
Dialog = new ProgressDialog(padre);
Dialog.setMessage("Cargando equipos...");
Dialog.show();
} | void function() { Dialog = new ProgressDialog(padre); Dialog.setMessage(STR); Dialog.show(); } | /**
* Metodo que se ejecuta antes de ejecutar la tarea. Muestra el mensaje de 'Cargando...'
*/ | Metodo que se ejecuta antes de ejecutar la tarea. Muestra el mensaje de 'Cargando...' | onPreExecute | {
"repo_name": "jjramos-dev/DeportesUGRApp",
"path": "src/es/ugr/deportesugrapp/misequipos/EleccionEquipoActivity.java",
"license": "gpl-3.0",
"size": 9044
} | [
"android.app.ProgressDialog"
] | import android.app.ProgressDialog; | import android.app.*; | [
"android.app"
] | android.app; | 1,533,831 |
private void navigateToUrl(String url) {
// Needed to hide toolbars properly.
mUrlEditText.clearFocus();
if ((url != null) && (url.length() > 0)) {
if (UrlUtils.isUrl(url)) {
url = UrlUtils.checkUrl(url);
} else {
url = UrlUtils.getSearchUrl(this, url);
}
hideKeyboard(true);
if (url.equals(Constants.URL_ABOUT_START)) {
mCurrentWebView.loadDataWithBaseURL("file:///android_asset/startpage/",
ApplicationUtils.getStartPage(this), "text/html", "UTF-8",
Constants.URL_ABOUT_START);
} else {
// If the url is not from GWT mobile view, and is in the mobile
// view url list, then load it with GWT.
if ((!url.startsWith(Constants.URL_GOOGLE_MOBILE_VIEW_NO_FORMAT))
&& (UrlUtils.checkInMobileViewUrlList(this, url))) {
url = String.format(Constants.URL_GOOGLE_MOBILE_VIEW, url);
}
mCurrentWebView.loadUrl(url);
}
}
} | void function(String url) { mUrlEditText.clearFocus(); if ((url != null) && (url.length() > 0)) { if (UrlUtils.isUrl(url)) { url = UrlUtils.checkUrl(url); } else { url = UrlUtils.getSearchUrl(this, url); } hideKeyboard(true); if (url.equals(Constants.URL_ABOUT_START)) { mCurrentWebView.loadDataWithBaseURL(STRtext/htmlSTRUTF-8", Constants.URL_ABOUT_START); } else { if ((!url.startsWith(Constants.URL_GOOGLE_MOBILE_VIEW_NO_FORMAT)) && (UrlUtils.checkInMobileViewUrlList(this, url))) { url = String.format(Constants.URL_GOOGLE_MOBILE_VIEW, url); } mCurrentWebView.loadUrl(url); } } } | /**
* Navigate to the given url.
*
* @param url
* The url.
*/ | Navigate to the given url | navigateToUrl | {
"repo_name": "udo-tech-team/ShadowsocksProxy",
"path": "src/org/shadowsocks/zirco/ui/activities/MainActivity.java",
"license": "gpl-3.0",
"size": 55388
} | [
"org.shadowsocks.zirco.utils.Constants",
"org.shadowsocks.zirco.utils.UrlUtils"
] | import org.shadowsocks.zirco.utils.Constants; import org.shadowsocks.zirco.utils.UrlUtils; | import org.shadowsocks.zirco.utils.*; | [
"org.shadowsocks.zirco"
] | org.shadowsocks.zirco; | 1,713,242 |
public void setTextAnchor(TextAnchor anchor) {
if (anchor == null) {
throw new IllegalArgumentException("Null 'anchor' argument.");
}
this.textAnchor = anchor;
fireAnnotationChanged();
} | void function(TextAnchor anchor) { if (anchor == null) { throw new IllegalArgumentException(STR); } this.textAnchor = anchor; fireAnnotationChanged(); } | /**
* Sets the text anchor (the point on the text bounding rectangle that is
* aligned to the (x, y) coordinate of the annotation) and sends an
* {@link AnnotationChangeEvent} to all registered listeners.
*
* @param anchor the anchor point (<code>null</code> not permitted).
*
* @see #getTextAnchor()
*/ | Sets the text anchor (the point on the text bounding rectangle that is aligned to the (x, y) coordinate of the annotation) and sends an <code>AnnotationChangeEvent</code> to all registered listeners | setTextAnchor | {
"repo_name": "greearb/jfreechart-fse-ct",
"path": "src/main/java/org/jfree/chart/annotations/TextAnnotation.java",
"license": "lgpl-2.1",
"size": 11381
} | [
"org.jfree.chart.ui.TextAnchor"
] | import org.jfree.chart.ui.TextAnchor; | import org.jfree.chart.ui.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,838,502 |
public Map<String, NXuser> getAllUser();
| Map<String, NXuser> function(); | /**
* Get all NXuser nodes:
* <ul>
* <li></li>
* </ul>
*
* @return a map from node names to the NXuser for that node.
*/ | Get all NXuser nodes: | getAllUser | {
"repo_name": "xen-0/dawnsci",
"path": "org.eclipse.dawnsci.nexus/autogen/org/eclipse/dawnsci/nexus/NXsubentry.java",
"license": "epl-1.0",
"size": 30808
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,824,276 |
public TLAbsChatFull getFullChat() {
return this.fullChat;
} | TLAbsChatFull function() { return this.fullChat; } | /**
* Gets full chat.
*
* @return the full chat
*/ | Gets full chat | getFullChat | {
"repo_name": "rubenlagus/TelegramApi",
"path": "src/main/java/org/telegram/api/messages/TLMessagesChatFull.java",
"license": "mit",
"size": 2628
} | [
"org.telegram.api.chat.TLAbsChatFull"
] | import org.telegram.api.chat.TLAbsChatFull; | import org.telegram.api.chat.*; | [
"org.telegram.api"
] | org.telegram.api; | 1,230,698 |
public HighlightBuilder field(String name, int fragmentSize, int numberOfFragments) {
if (fields == null) {
fields = newArrayList();
}
fields.add(new Field(name).fragmentSize(fragmentSize).numOfFragments(numberOfFragments));
return this;
} | HighlightBuilder function(String name, int fragmentSize, int numberOfFragments) { if (fields == null) { fields = newArrayList(); } fields.add(new Field(name).fragmentSize(fragmentSize).numOfFragments(numberOfFragments)); return this; } | /**
* Adds a field to be highlighted with a provided fragment size (in characters), and
* a provided (maximum) number of fragments.
*
* @param name The field to highlight
* @param fragmentSize The size of a fragment in characters
* @param numberOfFragments The (maximum) number of fragments
*/ | Adds a field to be highlighted with a provided fragment size (in characters), and a provided (maximum) number of fragments | field | {
"repo_name": "lmenezes/elasticsearch",
"path": "src/main/java/org/elasticsearch/search/highlight/HighlightBuilder.java",
"license": "apache-2.0",
"size": 14397
} | [
"com.google.common.collect.Lists"
] | import com.google.common.collect.Lists; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 1,103,641 |
public void setValueAt(Object value, int row, int column)
{
getModel().setDataAt(value, row, convertColumnIndexToModel(column));
if(value instanceof IDColumn)
{
IDColumn id = (IDColumn) value;
boolean selected = id.isSelected();
ListItem listItem = this.getItemAtIndex(row);
if (listItem != null && !listItem.isSelected() && selected) {
listItem.setSelected(true);
}
}
} | void function(Object value, int row, int column) { getModel().setDataAt(value, row, convertColumnIndexToModel(column)); if(value instanceof IDColumn) { IDColumn id = (IDColumn) value; boolean selected = id.isSelected(); ListItem listItem = this.getItemAtIndex(row); if (listItem != null && !listItem.isSelected() && selected) { listItem.setSelected(true); } } } | /**
* Set the cell value at <code>row</code> and <code>column</code>.
*
* @param value The value to set
* @param row the index of the row whose value is to be set
* @param column the index of the column whose value is to be set
*/ | Set the cell value at <code>row</code> and <code>column</code> | setValueAt | {
"repo_name": "neuroidss/adempiere",
"path": "zkwebui/WEB-INF/src/org/adempiere/webui/component/WListbox.java",
"license": "gpl-2.0",
"size": 37836
} | [
"org.compiere.minigrid.IDColumn"
] | import org.compiere.minigrid.IDColumn; | import org.compiere.minigrid.*; | [
"org.compiere.minigrid"
] | org.compiere.minigrid; | 123,045 |
@Override
public Polynomial toPolynomial() {
throw new InternalError();
}
| Polynomial function() { throw new InternalError(); } | /**
* Throws an error because modulo expressions can not be transformed to
* polynomials without trnasforming the whole constraint this modulo operation
* is member of. Please transform the constraint into an arithmetic equivalent
* constraint without having any modulo operations in it before generating
* polynomials out of it.
* @return <i>nothing</i>.
* @throws InternalError
*/ | Throws an error because modulo expressions can not be transformed to polynomials without trnasforming the whole constraint this modulo operation is member of. Please transform the constraint into an arithmetic equivalent constraint without having any modulo operations in it before generating polynomials out of it | toPolynomial | {
"repo_name": "wwu-pi/muggl",
"path": "muggl-solvers/src/de/wwu/muggl/solvers/expressions/Modulo.java",
"license": "gpl-3.0",
"size": 7214
} | [
"de.wwu.muggl.solvers.solver.constraints.Polynomial"
] | import de.wwu.muggl.solvers.solver.constraints.Polynomial; | import de.wwu.muggl.solvers.solver.constraints.*; | [
"de.wwu.muggl"
] | de.wwu.muggl; | 2,275,436 |
protected double updateCloudetProcessingWithoutSchedulingFutureEventsForce() {
double currentTime = CloudSim.clock();
double minTime = Double.MAX_VALUE;
double timeDiff = currentTime - getLastProcessTime();
double timeFrameDatacenterEnergy = 0.0;
Log.printLine("\n\n--------------------------------------------------------------\n\n");
Log.formatLine("New resource usage for the time frame starting at %.2f:", currentTime);
for (PowerHost host : this.<PowerHost> getHostList()) {
Log.printLine();
double time = host.updateVmsProcessing(currentTime); // inform VMs to update processing
if (time < minTime) {
minTime = time;
}
Log.formatLine(
"%.2f: [Host #%d] utilization is %.2f%%",
currentTime,
host.getId(),
host.getUtilizationOfCpu() * 100);
}
if (timeDiff > 0) {
Log.formatLine(
"\nEnergy consumption for the last time frame from %.2f to %.2f:",
getLastProcessTime(),
currentTime);
for (PowerHost host : this.<PowerHost> getHostList()) {
double previousUtilizationOfCpu = host.getPreviousUtilizationOfCpu();
double utilizationOfCpu = host.getUtilizationOfCpu();
double timeFrameHostEnergy = host.getEnergyLinearInterpolation(
previousUtilizationOfCpu,
utilizationOfCpu,
timeDiff);
timeFrameDatacenterEnergy += timeFrameHostEnergy;
Log.printLine();
Log.formatLine(
"%.2f: [Host #%d] utilization at %.2f was %.2f%%, now is %.2f%%",
currentTime,
host.getId(),
getLastProcessTime(),
previousUtilizationOfCpu * 100,
utilizationOfCpu * 100);
Log.formatLine(
"%.2f: [Host #%d] energy is %.2f W*sec",
currentTime,
host.getId(),
timeFrameHostEnergy);
}
Log.formatLine(
"\n%.2f: Data center's energy is %.2f W*sec\n",
currentTime,
timeFrameDatacenterEnergy);
}
setPower(getPower() + timeFrameDatacenterEnergy);
checkCloudletCompletion();
for (PowerHost host : this.<PowerHost> getHostList()) {
for (Vm vm : host.getCompletedVms()) {
getVmAllocationPolicy().deallocateHostForVm(vm);
getVmList().remove(vm);
Log.printLine("VM #" + vm.getId() + " has been deallocated from host #" + host.getId());
}
}
Log.printLine();
setLastProcessTime(currentTime);
return minTime;
} | double function() { double currentTime = CloudSim.clock(); double minTime = Double.MAX_VALUE; double timeDiff = currentTime - getLastProcessTime(); double timeFrameDatacenterEnergy = 0.0; Log.printLine(STR); Log.formatLine(STR, currentTime); for (PowerHost host : this.<PowerHost> getHostList()) { Log.printLine(); double time = host.updateVmsProcessing(currentTime); if (time < minTime) { minTime = time; } Log.formatLine( STR, currentTime, host.getId(), host.getUtilizationOfCpu() * 100); } if (timeDiff > 0) { Log.formatLine( STR, getLastProcessTime(), currentTime); for (PowerHost host : this.<PowerHost> getHostList()) { double previousUtilizationOfCpu = host.getPreviousUtilizationOfCpu(); double utilizationOfCpu = host.getUtilizationOfCpu(); double timeFrameHostEnergy = host.getEnergyLinearInterpolation( previousUtilizationOfCpu, utilizationOfCpu, timeDiff); timeFrameDatacenterEnergy += timeFrameHostEnergy; Log.printLine(); Log.formatLine( STR, currentTime, host.getId(), getLastProcessTime(), previousUtilizationOfCpu * 100, utilizationOfCpu * 100); Log.formatLine( STR, currentTime, host.getId(), timeFrameHostEnergy); } Log.formatLine( STR, currentTime, timeFrameDatacenterEnergy); } setPower(getPower() + timeFrameDatacenterEnergy); checkCloudletCompletion(); for (PowerHost host : this.<PowerHost> getHostList()) { for (Vm vm : host.getCompletedVms()) { getVmAllocationPolicy().deallocateHostForVm(vm); getVmList().remove(vm); Log.printLine(STR + vm.getId() + STR + host.getId()); } } Log.printLine(); setLastProcessTime(currentTime); return minTime; } | /**
* Update cloudet processing without scheduling future events.
*
* @return expected time of completion of the next cloudlet in all VMs of all hosts or
* {@link Double#MAX_VALUE} if there is no future events expected in this host
*/ | Update cloudet processing without scheduling future events | updateCloudetProcessingWithoutSchedulingFutureEventsForce | {
"repo_name": "mhe504/MigSim",
"path": "src/org/cloudbus/cloudsim/power/PowerDatacenter.java",
"license": "mit",
"size": 10458
} | [
"org.cloudbus.cloudsim.Log",
"org.cloudbus.cloudsim.Vm",
"org.cloudbus.cloudsim.core.CloudSim"
] | import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.Vm; import org.cloudbus.cloudsim.core.CloudSim; | import org.cloudbus.cloudsim.*; import org.cloudbus.cloudsim.core.*; | [
"org.cloudbus.cloudsim"
] | org.cloudbus.cloudsim; | 1,660,857 |
public Object setValue(Object value)
{
if (value == this)
{
throw new IllegalArgumentException("Cannot set value to this map entry");
}
return map.put(key, value);
}
/**
* Compares this Map Entry with another Map Entry.
* <p/>
* Implemented per API documentation of {@link java.util.Map.Entry#equals(Object)}
| Object function(Object value) { if (value == this) { throw new IllegalArgumentException(STR); } return map.put(key, value); } /** * Compares this Map Entry with another Map Entry. * <p/> * Implemented per API documentation of {@link java.util.Map.Entry#equals(Object)} | /**
* Sets the value associated with the key direct onto the map.
*
* @param value the new value
* @return the old value
* @throws IllegalArgumentException if the value is set to this map entry
*/ | Sets the value associated with the key direct onto the map | setValue | {
"repo_name": "stefandmn/AREasy",
"path": "src/java/org/areasy/common/data/type/map/keyvalue/TiedMapEntry.java",
"license": "lgpl-3.0",
"size": 3454
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,152,090 |
@Override
public String toString() {
return RntbdObjectMapper.toString(this);
}
@JsonPropertyOrder({ "name", "startTimeUTC", "durationInMicroSec" })
public static final class Event {
@JsonIgnore
private final Duration duration;
@JsonProperty
private final long durationInMicroSec;
@JsonProperty("eventName")
private final String name;
@JsonSerialize(using = ToStringSerializer.class)
@JsonProperty("startTimeUTC")
private final Instant startTime;
public Event(final String name, final Instant from, final Instant to) {
checkNotNull(name, "expected non-null name");
this.name = name;
this.startTime = from;
if (from == null) {
this.duration = null;
} else if (to == null) {
this.duration = Duration.ZERO;
} else {
this.duration = Duration.between(from, to);
}
if (duration != null) {
this.durationInMicroSec = duration.toNanos()/1000L;
} else {
this.durationInMicroSec = 0;
}
} | String function() { return RntbdObjectMapper.toString(this); } @JsonPropertyOrder({ "name", STR, STR }) public static final class Event { private final Duration duration; private final long durationInMicroSec; @JsonProperty(STR) private final String name; @JsonSerialize(using = ToStringSerializer.class) @JsonProperty(STR) private final Instant startTime; public Event(final String name, final Instant from, final Instant to) { checkNotNull(name, STR); this.name = name; this.startTime = from; if (from == null) { this.duration = null; } else if (to == null) { this.duration = Duration.ZERO; } else { this.duration = Duration.between(from, to); } if (duration != null) { this.durationInMicroSec = duration.toNanos()/1000L; } else { this.durationInMicroSec = 0; } } | /**
* Returns a textual representation of this {@link RequestTimeline}.
* <p>
* The textual representation returned is a string of the form {@code RequestTimeline(}<i> <event-array></i>
* {@code )}.
*/ | Returns a textual representation of this <code>RequestTimeline</code>. The textual representation returned is a string of the form RequestTimeline( <event-array> ) | toString | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestTimeline.java",
"license": "mit",
"size": 7202
} | [
"com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdObjectMapper",
"com.azure.cosmos.implementation.guava25.base.Preconditions",
"com.fasterxml.jackson.annotation.JsonProperty",
"com.fasterxml.jackson.annotation.JsonPropertyOrder",
"com.fasterxml.jackson.databind.annotation.JsonSerialize",
"com... | import com.azure.cosmos.implementation.directconnectivity.rntbd.RntbdObjectMapper; import com.azure.cosmos.implementation.guava25.base.Preconditions; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import java.time.Duration; import java.time.Instant; | import com.azure.cosmos.implementation.directconnectivity.rntbd.*; import com.azure.cosmos.implementation.guava25.base.*; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import com.fasterxml.jackson.databind.ser.std.*; import java.time.*; | [
"com.azure.cosmos",
"com.fasterxml.jackson",
"java.time"
] | com.azure.cosmos; com.fasterxml.jackson; java.time; | 758,701 |
private List<Object> readArray() throws JSONFormatException{
List<Object> array = new ArrayList<Object>();
Object next = parse();
while(!next.equals(ARRAY_END)){
array.add(next);
next = parse();
// if next is COMMA read the next Element
if(next.equals(COMMA)){
next = parse();
}else if(!next.equals(ARRAY_END)){
throw new JSONFormatException("No array end character");
}
}
return array;
}
| List<Object> function() throws JSONFormatException{ List<Object> array = new ArrayList<Object>(); Object next = parse(); while(!next.equals(ARRAY_END)){ array.add(next); next = parse(); if(next.equals(COMMA)){ next = parse(); }else if(!next.equals(ARRAY_END)){ throw new JSONFormatException(STR); } } return array; } | /**
* read an array object from json string
* @return a List represent an array in json Object
* @throws JSONFormatException
*/ | read an array object from json string | readArray | {
"repo_name": "lifengyuan/csc207-hw6",
"path": "edu.grinnell.csc207.lifengyuan.json/edu.grinnell.csc207.lifengyuan.json/src/JSONParser.java",
"license": "mit",
"size": 6701
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,850,482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.