method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public String getItemText(int index) {
checkIndex(index);
final Element optionElement = (Element) optionsPanel.getElement().getChild(index);
final InputElement labelElement =
(InputElement) optionElement.getElementsByTagName("input").getItem(0);
return labelElement.getValue();
} | String function(int index) { checkIndex(index); final Element optionElement = (Element) optionsPanel.getElement().getChild(index); final InputElement labelElement = (InputElement) optionElement.getElementsByTagName("input").getItem(0); return labelElement.getValue(); } | /**
* Gets the text associated with the item at the specified index.
*
* @param index the index of the item whose text is to be retrieved
* @return the text associated with the item
* @throws IndexOutOfBoundsException if the index is out of range
*/ | Gets the text associated with the item at the specified index | getItemText | {
"repo_name": "sleshchenko/che",
"path": "ide/commons-gwt/src/main/java/org/eclipse/che/ide/ui/listbox/CustomComboBox.java",
"license": "epl-1.0",
"size": 14902
} | [
"com.google.gwt.dom.client.Element",
"com.google.gwt.dom.client.InputElement"
] | import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.InputElement; | import com.google.gwt.dom.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 742,147 |
public void send(Send send) {
KafkaChannel channel = channelOrFail(send.destination());
try {
channel.setSend(send);
} catch (CancelledKeyException e) {
this.failedSends.add(send.destination());
close(channel);
}
} | void function(Send send) { KafkaChannel channel = channelOrFail(send.destination()); try { channel.setSend(send); } catch (CancelledKeyException e) { this.failedSends.add(send.destination()); close(channel); } } | /**
* Queue the given request for sending in the subsequent {@poll(long)} calls
* @param send The request to send
*/ | Queue the given request for sending in the subsequent calls | send | {
"repo_name": "samaitra/kafka",
"path": "clients/src/main/java/org/apache/kafka/common/network/Selector.java",
"license": "apache-2.0",
"size": 31598
} | [
"java.nio.channels.CancelledKeyException"
] | import java.nio.channels.CancelledKeyException; | import java.nio.channels.*; | [
"java.nio"
] | java.nio; | 614,648 |
@Subscribe
public void handleInitializationEvent(InitializationEvent event) {
if (!tsHandler.getTestsystems().isEmpty()) {
tsHandler.getTestsystems().forEach(
element -> listView.getItems().add(element));
eventBus.post(new ShowSelectedTestsystemEvent(tsHandler.getTestsystems().get(0).getId()));
LOGGER.info("initialization finished");
} else {
eventBus.post(new ShowWizardDialogEvent(true));
}
} | void function(InitializationEvent event) { if (!tsHandler.getTestsystems().isEmpty()) { tsHandler.getTestsystems().forEach( element -> listView.getItems().add(element)); eventBus.post(new ShowSelectedTestsystemEvent(tsHandler.getTestsystems().get(0).getId())); LOGGER.info(STR); } else { eventBus.post(new ShowWizardDialogEvent(true)); } } | /**
* handles an InitializationEvent.
* loads all stored testsystems
* and show them in the NavigationView
* and posts an event to select the
* first testsystem in the view
*
* @param event is an InitializationEvent
*/ | handles an InitializationEvent. loads all stored testsystems and show them in the NavigationView and posts an event to select the first testsystem in the view | handleInitializationEvent | {
"repo_name": "encoway/ecasta",
"path": "src/main/java/com/encoway/ecasta/systems/controller/NavigationViewController.java",
"license": "mit",
"size": 5124
} | [
"com.encoway.ecasta.commons.events.InitializationEvent",
"com.encoway.ecasta.commons.events.ShowWizardDialogEvent",
"com.encoway.ecasta.systems.events.ShowSelectedTestsystemEvent"
] | import com.encoway.ecasta.commons.events.InitializationEvent; import com.encoway.ecasta.commons.events.ShowWizardDialogEvent; import com.encoway.ecasta.systems.events.ShowSelectedTestsystemEvent; | import com.encoway.ecasta.commons.events.*; import com.encoway.ecasta.systems.events.*; | [
"com.encoway.ecasta"
] | com.encoway.ecasta; | 961,970 |
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> stopTriggerWithResponse(String triggerName) {
return this.serviceClient.stopTriggerWithResponseAsync(triggerName);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Void>> function(String triggerName) { return this.serviceClient.stopTriggerWithResponseAsync(triggerName); } | /**
* Stops a trigger.
*
* @param triggerName The trigger name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CloudErrorAutoGeneratedException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link Response} on successful completion of {@link Mono}.
*/ | Stops a trigger | stopTriggerWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/synapse/azure-analytics-synapse-artifacts/src/main/java/com/azure/analytics/synapse/artifacts/TriggerAsyncClient.java",
"license": "mit",
"size": 15777
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; | [
"com.azure.core"
] | com.azure.core; | 721,847 |
public void setFocusedWindow(View view) {
mFocusLock.writeLock().lock();
try {
mFocusedWindow = view == null ? null : view.getRootView();
} finally {
mFocusLock.writeLock().unlock();
}
fireFocusChangedEvent();
} | void function(View view) { mFocusLock.writeLock().lock(); try { mFocusedWindow = view == null ? null : view.getRootView(); } finally { mFocusLock.writeLock().unlock(); } fireFocusChangedEvent(); } | /**
* Invoke this method to change the currently focused window.
*
* @param view A view that belongs to the view hierarchy/window that has focus,
* or null to remove focus
*/ | Invoke this method to change the currently focused window | setFocusedWindow | {
"repo_name": "antew/RedditInPictures",
"path": "src/main/java/com/android/debug/hv/ViewServer.java",
"license": "apache-2.0",
"size": 27091
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,741,170 |
public static File getClinicalGuideDirectory() {
File f = new File(Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/ClinicalGuide");
// create directory if it does not exist
f.mkdirs();
return f;
}
| static File function() { File f = new File(Environment.getExternalStorageDirectory() .getAbsolutePath() + STR); f.mkdirs(); return f; } | /**
* Returns the base directory for the xml
* TODO use FileUtils function
*/ | Returns the base directory for the xml TODO use FileUtils function | getClinicalGuideDirectory | {
"repo_name": "ecemgroup/clinicalguide",
"path": "src/org/get/oxicam/clinicalguide/ClinicalGuideActivity.java",
"license": "apache-2.0",
"size": 6463
} | [
"android.os.Environment",
"java.io.File"
] | import android.os.Environment; import java.io.File; | import android.os.*; import java.io.*; | [
"android.os",
"java.io"
] | android.os; java.io; | 1,616,674 |
public void whileHeld(final Command command) {
whileActive(command);
} | void function(final Command command) { whileActive(command); } | /**
* Constantly starts the given command while the button is held.
*
* {@link Command#start()} will be called repeatedly while the button is held,
* and will be canceled when the button is released.
*
* @param command the command to start
*/ | Constantly starts the given command while the button is held. <code>Command#start()</code> will be called repeatedly while the button is held, and will be canceled when the button is released | whileHeld | {
"repo_name": "Beachbot330/WPILib-2014",
"path": "src/edu/wpi/first/wpilibj/buttons/Button.java",
"license": "bsd-3-clause",
"size": 2368
} | [
"edu.wpi.first.wpilibj.command.Command"
] | import edu.wpi.first.wpilibj.command.Command; | import edu.wpi.first.wpilibj.command.*; | [
"edu.wpi.first"
] | edu.wpi.first; | 587,061 |
private void zoomToAddress() {
if (!"".equals(getText())) {
add(getText());
final IAddress address = new CAddress(Long.parseLong(getText(), 16));
m_textField.setSuccessful(ZyZoomHelpers.zoomToAddress(m_graph, address, m_modules.get(0),
true));
}
} | void function() { if (!"".equals(getText())) { add(getText()); final IAddress address = new CAddress(Long.parseLong(getText(), 16)); m_textField.setSuccessful(ZyZoomHelpers.zoomToAddress(m_graph, address, m_modules.get(0), true)); } } | /**
* Zooms to the current address.
*/ | Zooms to the current address | zoomToAddress | {
"repo_name": "guiquanz/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Gui/GraphWindows/Searchers/Goto/CGotoAddressField.java",
"license": "apache-2.0",
"size": 5192
} | [
"com.google.security.zynamics.binnavi.ZyGraph",
"com.google.security.zynamics.zylib.disassembly.CAddress",
"com.google.security.zynamics.zylib.disassembly.IAddress"
] | import com.google.security.zynamics.binnavi.ZyGraph; import com.google.security.zynamics.zylib.disassembly.CAddress; import com.google.security.zynamics.zylib.disassembly.IAddress; | import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.zylib.disassembly.*; | [
"com.google.security"
] | com.google.security; | 2,360,797 |
@SuppressWarnings("deprecation")
public void setNavigationBarTintDrawable(Drawable drawable) {
if (mNavBarAvailable) {
mNavBarTintView.setBackgroundDrawable(drawable);
}
} | @SuppressWarnings(STR) void function(Drawable drawable) { if (mNavBarAvailable) { mNavBarTintView.setBackgroundDrawable(drawable); } } | /**
* Apply the specified drawable to the system navigation bar.
*
* @param drawable The drawable to use as the background, or null to remove it.
*/ | Apply the specified drawable to the system navigation bar | setNavigationBarTintDrawable | {
"repo_name": "woniukeji/jianguo",
"path": "app/src/main/java/com/woniukeji/jianguo/widget/SystemBarTintManager.java",
"license": "apache-2.0",
"size": 20000
} | [
"android.graphics.drawable.Drawable"
] | import android.graphics.drawable.Drawable; | import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 1,711,628 |
private boolean areCompatible(Type target, Type source) {
if ( target.equals( source ) ) {
// if the types report logical equivalence, return true...
return true;
}
// otherwise, doAfterTransactionCompletion a "deep equivalence" check...
if ( !target.getReturnedClass().isAssignableFrom( source.getReturnedClass() ) ) {
return false;
}
int[] targetDatatypes = target.sqlTypes( getSessionFactoryHelper().getFactory() );
int[] sourceDatatypes = source.sqlTypes( getSessionFactoryHelper().getFactory() );
if ( targetDatatypes.length != sourceDatatypes.length ) {
return false;
}
for ( int i = 0; i < targetDatatypes.length; i++ ) {
if ( !areSqlTypesCompatible( targetDatatypes[i], sourceDatatypes[i] ) ) {
return false;
}
}
return true;
} | boolean function(Type target, Type source) { if ( target.equals( source ) ) { return true; } if ( !target.getReturnedClass().isAssignableFrom( source.getReturnedClass() ) ) { return false; } int[] targetDatatypes = target.sqlTypes( getSessionFactoryHelper().getFactory() ); int[] sourceDatatypes = source.sqlTypes( getSessionFactoryHelper().getFactory() ); if ( targetDatatypes.length != sourceDatatypes.length ) { return false; } for ( int i = 0; i < targetDatatypes.length; i++ ) { if ( !areSqlTypesCompatible( targetDatatypes[i], sourceDatatypes[i] ) ) { return false; } } return true; } | /**
* Determine whether the two types are "assignment compatible".
*
* @param target The type defined in the into-clause.
* @param source The type defined in the select clause.
* @return True if they are assignment compatible.
*/ | Determine whether the two types are "assignment compatible" | areCompatible | {
"repo_name": "HerrB92/obp",
"path": "OpenBeaconPackage/libraries/hibernate-release-4.2.7.SP1/project/hibernate-core/src/main/java/org/hibernate/hql/internal/ast/tree/IntoClause.java",
"license": "mit",
"size": 8959
} | [
"org.hibernate.type.Type"
] | import org.hibernate.type.Type; | import org.hibernate.type.*; | [
"org.hibernate.type"
] | org.hibernate.type; | 1,601,421 |
public static boolean confirm(HashMap<PackageDescriptor, HashSet<PackageDescriptor>> dependency, HashMap<String, String> licenseNameToLicenseTextMap) {
ConfirmLicensesDialog d = new ConfirmLicensesDialog(dependency, licenseNameToLicenseTextMap);
d.setInitialSelection();
d.setVisible(true);
return d.wasConfirmed();
}
private class LicenseListSelectionListener implements ListSelectionListener {
private JList otherList;
public LicenseListSelectionListener(JList otherList) {
this.otherList = otherList;
} | static boolean function(HashMap<PackageDescriptor, HashSet<PackageDescriptor>> dependency, HashMap<String, String> licenseNameToLicenseTextMap) { ConfirmLicensesDialog d = new ConfirmLicensesDialog(dependency, licenseNameToLicenseTextMap); d.setInitialSelection(); d.setVisible(true); return d.wasConfirmed(); } private class LicenseListSelectionListener implements ListSelectionListener { private JList otherList; public LicenseListSelectionListener(JList otherList) { this.otherList = otherList; } | /** Returns true iff the user chooses to confirm the license.
* @param licenseNameToLicenseTextMap2
* @param numberOfTotalPackages
* @param updateModel */ | Returns true iff the user chooses to confirm the license | confirm | {
"repo_name": "rapidminer/rapidminer-5",
"path": "src/com/rapid_i/deployment/update/client/ConfirmLicensesDialog.java",
"license": "agpl-3.0",
"size": 12079
} | [
"com.rapidminer.deployment.client.wsimport.PackageDescriptor",
"java.util.HashMap",
"java.util.HashSet",
"javax.swing.JList",
"javax.swing.event.ListSelectionListener"
] | import com.rapidminer.deployment.client.wsimport.PackageDescriptor; import java.util.HashMap; import java.util.HashSet; import javax.swing.JList; import javax.swing.event.ListSelectionListener; | import com.rapidminer.deployment.client.wsimport.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; | [
"com.rapidminer.deployment",
"java.util",
"javax.swing"
] | com.rapidminer.deployment; java.util; javax.swing; | 2,915,290 |
public MultipleCurrencyParameterSensitivity calculateSensitivity(final InstrumentDerivative instrument, final DATA_TYPE parameterMulticurves,
final Set<String> curvesSet) {
ArgumentChecker.notNull(instrument, "derivative");
ArgumentChecker.notNull(parameterMulticurves, "Black data");
ArgumentChecker.notNull(curvesSet, "curves");
final MultipleCurrencyMulticurveSensitivity sensitivity = instrument.accept(_curveSensitivityCalculator, parameterMulticurves);
return pointToParameterSensitivity(sensitivity, parameterMulticurves, curvesSet);
} | MultipleCurrencyParameterSensitivity function(final InstrumentDerivative instrument, final DATA_TYPE parameterMulticurves, final Set<String> curvesSet) { ArgumentChecker.notNull(instrument, STR); ArgumentChecker.notNull(parameterMulticurves, STR); ArgumentChecker.notNull(curvesSet, STR); final MultipleCurrencyMulticurveSensitivity sensitivity = instrument.accept(_curveSensitivityCalculator, parameterMulticurves); return pointToParameterSensitivity(sensitivity, parameterMulticurves, curvesSet); } | /**
* Computes the sensitivity with respect to the parameters for the supplied curve names.
*
* @param instrument
* The instrument. Not null.
* @param parameterMulticurves
* The parameters and multi-curves provider.
* @param curvesSet
* The set of curves for which the sensitivity will be computed. The multi-curve may contain more curves and other curves can be in the instrument
* sensitivity but only the one in the set will be in the output. The curve order in the output is the set order.
* @return The sensitivity (as a ParameterSensitivity).
*/ | Computes the sensitivity with respect to the parameters for the supplied curve names | calculateSensitivity | {
"repo_name": "McLeodMoores/starling",
"path": "projects/analytics/src/main/java/com/opengamma/analytics/financial/provider/sensitivity/parameter/AbstractParameterSensitivityParameterCalculator.java",
"license": "apache-2.0",
"size": 5676
} | [
"com.opengamma.analytics.financial.interestrate.InstrumentDerivative",
"com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity",
"com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyParameterSensitivity",
"com.opengamma.util.Argume... | import com.opengamma.analytics.financial.interestrate.InstrumentDerivative; import com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity; import com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyParameterSensitivity; import com.opengamma.util.ArgumentChecker; import java.util.Set; | import com.opengamma.analytics.financial.interestrate.*; import com.opengamma.analytics.financial.provider.sensitivity.multicurve.*; import com.opengamma.util.*; import java.util.*; | [
"com.opengamma.analytics",
"com.opengamma.util",
"java.util"
] | com.opengamma.analytics; com.opengamma.util; java.util; | 1,607,079 |
private void logExtraIndexRowAndUpdateCounters(List<Mutation> actualIndexMutationList,
IndexToolVerificationResult.PhaseResult verificationPhaseResult, boolean isBeforeRebuild) throws IOException {
for (Mutation m : actualIndexMutationList) {
// this extra row in the index table has already been deleted
if ((m instanceof Delete)) {
return;
}
// check the empty column status of latest (most recent) put mutation
if (isVerified((Put) m)) {
verificationPhaseResult.setExtraVerifiedIndexRowCount(
verificationPhaseResult.getExtraVerifiedIndexRowCount() + 1);
} else {
verificationPhaseResult.setExtraUnverifiedIndexRowCount(
verificationPhaseResult.getExtraUnverifiedIndexRowCount() + 1);
}
byte[] indexKey = m.getRow();
byte[] dataKey = indexMaintainer.buildDataRowKey(new ImmutableBytesWritable(indexKey), viewConstants);
String errorMsg = ERROR_MESSAGE_EXTRA_INDEX_ROW;
IndexVerificationOutputRepository.IndexVerificationErrorType errorType = EXTRA_ROW;
logToIndexToolOutputTable(dataKey, indexKey, 0, getTimestamp(m), errorMsg,
isBeforeRebuild, errorType);
break;
}
} | void function(List<Mutation> actualIndexMutationList, IndexToolVerificationResult.PhaseResult verificationPhaseResult, boolean isBeforeRebuild) throws IOException { for (Mutation m : actualIndexMutationList) { if ((m instanceof Delete)) { return; } if (isVerified((Put) m)) { verificationPhaseResult.setExtraVerifiedIndexRowCount( verificationPhaseResult.getExtraVerifiedIndexRowCount() + 1); } else { verificationPhaseResult.setExtraUnverifiedIndexRowCount( verificationPhaseResult.getExtraUnverifiedIndexRowCount() + 1); } byte[] indexKey = m.getRow(); byte[] dataKey = indexMaintainer.buildDataRowKey(new ImmutableBytesWritable(indexKey), viewConstants); String errorMsg = ERROR_MESSAGE_EXTRA_INDEX_ROW; IndexVerificationOutputRepository.IndexVerificationErrorType errorType = EXTRA_ROW; logToIndexToolOutputTable(dataKey, indexKey, 0, getTimestamp(m), errorMsg, isBeforeRebuild, errorType); break; } } | /**
* actualIndexMutationList is the list of all the mutations of a single extra index row (i.e. not referenced by data row)
* ordered by decreasing order of timestamps with Deletes before Puts
*/ | actualIndexMutationList is the list of all the mutations of a single extra index row (i.e. not referenced by data row) ordered by decreasing order of timestamps with Deletes before Puts | logExtraIndexRowAndUpdateCounters | {
"repo_name": "apache/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/coprocessor/GlobalIndexRegionScanner.java",
"license": "apache-2.0",
"size": 77775
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hbase.client.Delete",
"org.apache.hadoop.hbase.client.Mutation",
"org.apache.hadoop.hbase.client.Put",
"org.apache.hadoop.hbase.io.ImmutableBytesWritable",
"org.apache.phoenix.mapreduce.index.IndexVerificationOutputRepository"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.phoenix.mapreduce.index.IndexVerificationOutputRepository; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.io.*; import org.apache.phoenix.mapreduce.index.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.apache.phoenix"
] | java.io; java.util; org.apache.hadoop; org.apache.phoenix; | 906,990 |
public boolean isFileSystem(File f)
{
return (f.isFile() || f.isDirectory());
} | boolean function(File f) { return (f.isFile() f.isDirectory()); } | /**
* Returns <code>true</code> if <code>f</code> is a file or directory, and
* <code>false</code> otherwise.
*
* @param f the file/directory.
*
* @return <code>true</code> if <code>f</code> is a file or directory, and
* <code>false</code> otherwise.
*/ | Returns <code>true</code> if <code>f</code> is a file or directory, and <code>false</code> otherwise | isFileSystem | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/swing/filechooser/FileSystemView.java",
"license": "gpl-2.0",
"size": 11554
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,060,210 |
public static boolean containsAll(Collection self, Object[] items) {
return self.containsAll(Arrays.asList(items));
} | static boolean function(Collection self, Object[] items) { return self.containsAll(Arrays.asList(items)); } | /**
* Returns <tt>true</tt> if this collection contains all of the elements
* in the specified array.
*
* @param self a Collection to be checked for containment
* @param items array to be checked for containment in this collection
* @return <tt>true</tt> if this collection contains all of the elements
* in the specified array
* @see Collection#containsAll(Collection)
* @since 1.7.2
*/ | Returns true if this collection contains all of the elements in the specified array | containsAll | {
"repo_name": "mv2a/yajsw",
"path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 704164
} | [
"java.util.Arrays",
"java.util.Collection"
] | import java.util.Arrays; import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,565,429 |
private PortletMode getPortletMode(PortletRequest portletReq,
String portletMode) {
PortletMode mode = portletReq.getPortletMode();
if (StringUtils.isNotEmpty(portletMode)) {
if (PORTLETMODE_NAME_EDIT.equalsIgnoreCase(portletMode)) {
mode = PortletMode.EDIT;
} else if (PORTLETMODE_NAME_VIEW.equalsIgnoreCase(portletMode)) {
mode = PortletMode.VIEW;
} else if (PORTLETMODE_NAME_HELP.equalsIgnoreCase(portletMode)) {
mode = PortletMode.HELP;
}
}
if(mode == null) {
mode = PortletMode.VIEW;
}
return mode;
} | PortletMode function(PortletRequest portletReq, String portletMode) { PortletMode mode = portletReq.getPortletMode(); if (StringUtils.isNotEmpty(portletMode)) { if (PORTLETMODE_NAME_EDIT.equalsIgnoreCase(portletMode)) { mode = PortletMode.EDIT; } else if (PORTLETMODE_NAME_VIEW.equalsIgnoreCase(portletMode)) { mode = PortletMode.VIEW; } else if (PORTLETMODE_NAME_HELP.equalsIgnoreCase(portletMode)) { mode = PortletMode.HELP; } } if(mode == null) { mode = PortletMode.VIEW; } return mode; } | /**
* Convert the given String to a PortletMode object.
*
* @param portletReq The PortletRequest.
* @param portletMode The PortletMode as a String.
* @return The PortletMode that mathces the <tt>portletMode</tt> String, or if
* the String is blank, the current PortletMode.
*/ | Convert the given String to a PortletMode object | getPortletMode | {
"repo_name": "yuzhongyousida/struts-2.3.1.2",
"path": "src/plugins/portlet/src/main/java/org/apache/struts2/portlet/util/PortletUrlHelper.java",
"license": "apache-2.0",
"size": 13626
} | [
"javax.portlet.PortletMode",
"javax.portlet.PortletRequest",
"org.apache.commons.lang.StringUtils"
] | import javax.portlet.PortletMode; import javax.portlet.PortletRequest; import org.apache.commons.lang.StringUtils; | import javax.portlet.*; import org.apache.commons.lang.*; | [
"javax.portlet",
"org.apache.commons"
] | javax.portlet; org.apache.commons; | 93,141 |
private void setFactoryConfiguration() {
if(useUrl && url != null){
// If the log4j file says to use the AMQP URL, and one was found
// by the Discovery class, use it
try {
factory.setUri(url);
return;
} catch (NoSuchAlgorithmException | KeyManagementException | URISyntaxException e) {
System.err.println("Exception connecting via URL, falling back to other properties");
e.printStackTrace();
}
}
// If URL is not set/requested or failed, fall back to this
factory.setHost(this.host);
factory.setPort(this.port);
factory.setVirtualHost(this.virtualHost);
factory.setUsername(this.username);
factory.setPassword(this.password);
} | void function() { if(useUrl && url != null){ try { factory.setUri(url); return; } catch (NoSuchAlgorithmException KeyManagementException URISyntaxException e) { System.err.println(STR); e.printStackTrace(); } } factory.setHost(this.host); factory.setPort(this.port); factory.setVirtualHost(this.virtualHost); factory.setUsername(this.username); factory.setPassword(this.password); } | /**
* Sets the ConnectionFactory parameters
*/ | Sets the ConnectionFactory parameters | setFactoryConfiguration | {
"repo_name": "uw-dims/tupelo",
"path": "logging/src/main/java/edu/uw/apl/tupelo/logging/RabbitMQAppender.java",
"license": "bsd-3-clause",
"size": 12812
} | [
"java.net.URISyntaxException",
"java.security.KeyManagementException",
"java.security.NoSuchAlgorithmException"
] | import java.net.URISyntaxException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; | import java.net.*; import java.security.*; | [
"java.net",
"java.security"
] | java.net; java.security; | 293,878 |
public static I_CmsVfsServiceAsync getVfsService() {
if (VFS_SERVICE == null) {
VFS_SERVICE = GWT.create(I_CmsVfsService.class);
String serviceUrl = CmsCoreProvider.get().link("org.opencms.gwt.CmsVfsService.gwt");
((ServiceDefTarget)VFS_SERVICE).setServiceEntryPoint(serviceUrl);
}
return VFS_SERVICE;
} | static I_CmsVfsServiceAsync function() { if (VFS_SERVICE == null) { VFS_SERVICE = GWT.create(I_CmsVfsService.class); String serviceUrl = CmsCoreProvider.get().link(STR); ((ServiceDefTarget)VFS_SERVICE).setServiceEntryPoint(serviceUrl); } return VFS_SERVICE; } | /**
* Returns the vfs service instance.<p>
*
* @return the vfs service instance
*/ | Returns the vfs service instance | getVfsService | {
"repo_name": "sbonoc/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/CmsCoreProvider.java",
"license": "lgpl-2.1",
"size": 22330
} | [
"com.google.gwt.core.client.GWT",
"com.google.gwt.user.client.rpc.ServiceDefTarget"
] | import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.ServiceDefTarget; | import com.google.gwt.core.client.*; import com.google.gwt.user.client.rpc.*; | [
"com.google.gwt"
] | com.google.gwt; | 204,223 |
public static void rename(
List<ResourceId> srcResourceIds, List<ResourceId> destResourceIds, MoveOptions... moveOptions)
throws IOException {
Set<MoveOptions> moveOptionSet = Sets.newHashSet(moveOptions);
validateSrcDestLists(srcResourceIds, destResourceIds);
if (srcResourceIds.isEmpty()) {
// Short-circuit.
return;
}
List<ResourceId> srcToRename = srcResourceIds;
List<ResourceId> destToRename = destResourceIds;
if (moveOptionSet.size() > 0) {
KV<List<ResourceId>, List<ResourceId>> existings =
filterFiles(srcResourceIds, destResourceIds, moveOptions);
srcToRename = existings.getKey();
destToRename = existings.getValue();
}
if (srcToRename.isEmpty()) {
return;
}
getFileSystemInternal(srcToRename.iterator().next().getScheme())
.rename(srcToRename, destToRename);
} | static void function( List<ResourceId> srcResourceIds, List<ResourceId> destResourceIds, MoveOptions... moveOptions) throws IOException { Set<MoveOptions> moveOptionSet = Sets.newHashSet(moveOptions); validateSrcDestLists(srcResourceIds, destResourceIds); if (srcResourceIds.isEmpty()) { return; } List<ResourceId> srcToRename = srcResourceIds; List<ResourceId> destToRename = destResourceIds; if (moveOptionSet.size() > 0) { KV<List<ResourceId>, List<ResourceId>> existings = filterFiles(srcResourceIds, destResourceIds, moveOptions); srcToRename = existings.getKey(); destToRename = existings.getValue(); } if (srcToRename.isEmpty()) { return; } getFileSystemInternal(srcToRename.iterator().next().getScheme()) .rename(srcToRename, destToRename); } | /**
* Renames a {@link List} of file-like resources from one location to another.
*
* <p>The number of source resources must equal the number of destination resources. Destination
* resources will be created recursively.
*
* <p>{@code srcResourceIds} and {@code destResourceIds} must have the same scheme.
*
* <p>It doesn't support renaming globs.
*
* @param srcResourceIds the references of the source resources
* @param destResourceIds the references of the destination resources
*/ | Renames a <code>List</code> of file-like resources from one location to another. The number of source resources must equal the number of destination resources. Destination resources will be created recursively. srcResourceIds and destResourceIds must have the same scheme. It doesn't support renaming globs | rename | {
"repo_name": "lukecwik/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/io/FileSystems.java",
"license": "apache-2.0",
"size": 24811
} | [
"java.io.IOException",
"java.util.List",
"java.util.Set",
"org.apache.beam.sdk.io.fs.MoveOptions",
"org.apache.beam.sdk.io.fs.ResourceId",
"org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Sets"
] | import java.io.IOException; import java.util.List; import java.util.Set; import org.apache.beam.sdk.io.fs.MoveOptions; import org.apache.beam.sdk.io.fs.ResourceId; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.Sets; | import java.io.*; import java.util.*; import org.apache.beam.sdk.io.fs.*; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.*; | [
"java.io",
"java.util",
"org.apache.beam"
] | java.io; java.util; org.apache.beam; | 2,737,244 |
public boolean createCompany(CompanyBO companyBO, int userID) throws CrownException; | boolean function(CompanyBO companyBO, int userID) throws CrownException; | /**
* adds a company to the application
*/ | adds a company to the application | createCompany | {
"repo_name": "gvgreat/hrillekha",
"path": "crown/retail/crown-jpa/src/main/java/com/techlords/crown/service/CompanyService.java",
"license": "apache-2.0",
"size": 827
} | [
"com.techlords.crown.business.exception.CrownException",
"com.techlords.crown.business.model.CompanyBO"
] | import com.techlords.crown.business.exception.CrownException; import com.techlords.crown.business.model.CompanyBO; | import com.techlords.crown.business.exception.*; import com.techlords.crown.business.model.*; | [
"com.techlords.crown"
] | com.techlords.crown; | 1,767,626 |
@SuppressFBWarnings("NP_BOOLEAN_RETURN_NULL")
public static Boolean dispatchKeyEvent(KeyEvent event, ChromeActivity activity,
boolean uiInitialized) {
int keyCode = event.getKeyCode();
if (!uiInitialized) {
if (keyCode == KeyEvent.KEYCODE_SEARCH || keyCode == KeyEvent.KEYCODE_MENU) return true;
return null;
}
switch (keyCode) {
case KeyEvent.KEYCODE_SEARCH:
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
activity.onMenuOrKeyboardAction(R.id.focus_url_bar, false);
}
// Always consume the SEARCH key events to prevent android from showing
// the default app search UI, which locks up Chrome.
return true;
case KeyEvent.KEYCODE_MENU:
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
activity.onMenuOrKeyboardAction(R.id.show_menu, false);
}
return true;
case KeyEvent.KEYCODE_ESCAPE:
if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) {
return activity.exitFullscreenIfShowing();
}
case KeyEvent.KEYCODE_TV:
case KeyEvent.KEYCODE_GUIDE:
case KeyEvent.KEYCODE_DVR:
case KeyEvent.KEYCODE_AVR_INPUT:
case KeyEvent.KEYCODE_AVR_POWER:
case KeyEvent.KEYCODE_STB_INPUT:
case KeyEvent.KEYCODE_STB_POWER:
case KeyEvent.KEYCODE_TV_INPUT:
case KeyEvent.KEYCODE_TV_POWER:
case KeyEvent.KEYCODE_WINDOW:
// Do not consume the AV device-related keys so that the system will take
// an appropriate action, such as switching to TV mode.
return false;
}
return null;
} | @SuppressFBWarnings(STR) static Boolean function(KeyEvent event, ChromeActivity activity, boolean uiInitialized) { int keyCode = event.getKeyCode(); if (!uiInitialized) { if (keyCode == KeyEvent.KEYCODE_SEARCH keyCode == KeyEvent.KEYCODE_MENU) return true; return null; } switch (keyCode) { case KeyEvent.KEYCODE_SEARCH: if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { activity.onMenuOrKeyboardAction(R.id.focus_url_bar, false); } return true; case KeyEvent.KEYCODE_MENU: if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { activity.onMenuOrKeyboardAction(R.id.show_menu, false); } return true; case KeyEvent.KEYCODE_ESCAPE: if (event.getAction() == KeyEvent.ACTION_DOWN && event.getRepeatCount() == 0) { return activity.exitFullscreenIfShowing(); } case KeyEvent.KEYCODE_TV: case KeyEvent.KEYCODE_GUIDE: case KeyEvent.KEYCODE_DVR: case KeyEvent.KEYCODE_AVR_INPUT: case KeyEvent.KEYCODE_AVR_POWER: case KeyEvent.KEYCODE_STB_INPUT: case KeyEvent.KEYCODE_STB_POWER: case KeyEvent.KEYCODE_TV_INPUT: case KeyEvent.KEYCODE_TV_POWER: case KeyEvent.KEYCODE_WINDOW: return false; } return null; } | /**
* This should be called from the Activity's dispatchKeyEvent() to handle keyboard shortcuts.
*
* Note: dispatchKeyEvent() is called before the active view or web page gets a chance to handle
* the key event. So the keys handled here cannot be overridden by any view or web page.
*
* @param event The KeyEvent to handle.
* @param activity The ChromeActivity in which the key was pressed.
* @param uiInitialized Whether the UI has been initialized. If this is false, most keys will
* not be handled.
* @return True if the event was handled. False if the event was ignored. Null if the event
* should be handled by the activity's parent class.
*/ | This should be called from the Activity's dispatchKeyEvent() to handle keyboard shortcuts. Note: dispatchKeyEvent() is called before the active view or web page gets a chance to handle the key event. So the keys handled here cannot be overridden by any view or web page | dispatchKeyEvent | {
"repo_name": "danakj/chromium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java",
"license": "bsd-3-clause",
"size": 12586
} | [
"android.view.KeyEvent",
"org.chromium.base.annotations.SuppressFBWarnings"
] | import android.view.KeyEvent; import org.chromium.base.annotations.SuppressFBWarnings; | import android.view.*; import org.chromium.base.annotations.*; | [
"android.view",
"org.chromium.base"
] | android.view; org.chromium.base; | 977,446 |
@Override
public String readUtf8() {
return new String(array, StandardCharsets.UTF_8);
} | String function() { return new String(array, StandardCharsets.UTF_8); } | /**
* Reads the source, converting to UTF-8.
*
* @return the UTF-8 string
*/ | Reads the source, converting to UTF-8 | readUtf8 | {
"repo_name": "OpenGamma/Strata",
"path": "modules/collect/src/main/java/com/opengamma/strata/collect/io/ArrayByteSource.java",
"license": "apache-2.0",
"size": 22539
} | [
"java.nio.charset.StandardCharsets"
] | import java.nio.charset.StandardCharsets; | import java.nio.charset.*; | [
"java.nio"
] | java.nio; | 1,495,854 |
private Predicate<Relatable> addDateRangeFilter(
Predicate<Relatable> pHistory)
{
StandardDateRange eSelectedDateRange =
getParameter(ENTITY_HISTORY_DATE);
if (eSelectedDateRange != null &&
eSelectedDateRange != StandardDateRange.NONE)
{
DateRange aDateRange = DateRange.calculateFor(eSelectedDateRange);
pHistory =
pHistory.and(HistoryRecord.TIME.is(greaterOrEqual(aDateRange
.getStart()))
.and(HistoryRecord.TIME.is(lessThan(aDateRange
.getEnd()))));
}
return pHistory;
} | Predicate<Relatable> function( Predicate<Relatable> pHistory) { StandardDateRange eSelectedDateRange = getParameter(ENTITY_HISTORY_DATE); if (eSelectedDateRange != null && eSelectedDateRange != StandardDateRange.NONE) { DateRange aDateRange = DateRange.calculateFor(eSelectedDateRange); pHistory = pHistory.and(HistoryRecord.TIME.is(greaterOrEqual(aDateRange .getStart())) .and(HistoryRecord.TIME.is(lessThan(aDateRange .getEnd())))); } return pHistory; } | /***************************************
* Adds a date range filter if the corresponding parameter is set.
*
* @param pHistory The filter predicate to amend
*
* @return The predicate, modified if necessary
*/ | Adds a date range filter if the corresponding parameter is set | addDateRangeFilter | {
"repo_name": "esoco/esoco-business",
"path": "src/main/java/de/esoco/process/step/entity/DisplayEntityHistory.java",
"license": "apache-2.0",
"size": 29989
} | [
"de.esoco.history.HistoryRecord",
"de.esoco.lib.datatype.DateRange",
"de.esoco.lib.expression.Predicate",
"org.obrel.core.Relatable"
] | import de.esoco.history.HistoryRecord; import de.esoco.lib.datatype.DateRange; import de.esoco.lib.expression.Predicate; import org.obrel.core.Relatable; | import de.esoco.history.*; import de.esoco.lib.datatype.*; import de.esoco.lib.expression.*; import org.obrel.core.*; | [
"de.esoco.history",
"de.esoco.lib",
"org.obrel.core"
] | de.esoco.history; de.esoco.lib; org.obrel.core; | 2,803,602 |
public static void await(final BooleanSupplier conditionSupplier)
{
while (!conditionSupplier.getAsBoolean())
{
Tests.yield();
}
} | static void function(final BooleanSupplier conditionSupplier) { while (!conditionSupplier.getAsBoolean()) { Tests.yield(); } } | /**
* Await a condition with a check for thread interrupt.
*
* @param conditionSupplier for the condition to be awaited.
*/ | Await a condition with a check for thread interrupt | await | {
"repo_name": "mikeb01/Aeron",
"path": "aeron-test-support/src/main/java/io/aeron/test/Tests.java",
"license": "apache-2.0",
"size": 22271
} | [
"java.util.function.BooleanSupplier"
] | import java.util.function.BooleanSupplier; | import java.util.function.*; | [
"java.util"
] | java.util; | 2,247,826 |
private boolean readyForAuth(UserAuth userAuth) {
// isDone indicates that the last auth finished and a new one can commence.
while (!this.authFuture.isDone()) {
log.debug("waiting to send authentication");
try {
this.authFuture.await();
} catch (InterruptedException e) {
log.debug("Unexpected interrupt", e);
throw new RuntimeException(e);
}
}
if (this.authFuture.isSuccess()) {
log.debug("already authenticated");
throw new IllegalStateException("Already authenticated");
}
if (this.authFuture.getException() != null) {
log.debug("probably closed", this.authFuture.getException());
return false;
}
if (!this.authFuture.isFailure()) {
log.debug("unexpected state");
throw new IllegalStateException("Unexpected authentication state");
}
if (this.userAuth != null) {
log.debug("authentication already in progress");
throw new IllegalStateException("Authentication already in progress?");
}
// Set up the next round of authentication. Each round gets a new lock.
this.userAuth = userAuth;
// The new future !isDone() - i.e., in progress blocking out other waits.
this.authFuture = new DefaultAuthFuture(lock);
log.debug("ready to try authentication with new lock");
return true;
} | boolean function(UserAuth userAuth) { while (!this.authFuture.isDone()) { log.debug(STR); try { this.authFuture.await(); } catch (InterruptedException e) { log.debug(STR, e); throw new RuntimeException(e); } } if (this.authFuture.isSuccess()) { log.debug(STR); throw new IllegalStateException(STR); } if (this.authFuture.getException() != null) { log.debug(STR, this.authFuture.getException()); return false; } if (!this.authFuture.isFailure()) { log.debug(STR); throw new IllegalStateException(STR); } if (this.userAuth != null) { log.debug(STR); throw new IllegalStateException(STR); } this.userAuth = userAuth; this.authFuture = new DefaultAuthFuture(lock); log.debug(STR); return true; } | /**
* return true if/when ready for auth; false if never ready.
* @return server is ready and waiting for auth
*/ | return true if/when ready for auth; false if never ready | readyForAuth | {
"repo_name": "kohsuke/mina-sshd",
"path": "sshd-core/src/main/java/org/apache/sshd/client/session/ClientUserAuthServiceOld.java",
"license": "apache-2.0",
"size": 7042
} | [
"org.apache.sshd.client.auth.deprecated.UserAuth",
"org.apache.sshd.client.future.DefaultAuthFuture"
] | import org.apache.sshd.client.auth.deprecated.UserAuth; import org.apache.sshd.client.future.DefaultAuthFuture; | import org.apache.sshd.client.auth.deprecated.*; import org.apache.sshd.client.future.*; | [
"org.apache.sshd"
] | org.apache.sshd; | 1,628,492 |
protected FloatingActionButton assembleFab(String title,
Drawable iconDrawable,
int fabNormalColor,
int fabPressedColor) {
this.childFabNormalColor = fabNormalColor;
this.childFabPressedColor = fabPressedColor;
return assembleFabByDefault(title, iconDrawable);
} | FloatingActionButton function(String title, Drawable iconDrawable, int fabNormalColor, int fabPressedColor) { this.childFabNormalColor = fabNormalColor; this.childFabPressedColor = fabPressedColor; return assembleFabByDefault(title, iconDrawable); } | /**
* User can customize their fabNormalColor, and fabPressedColor. And based on these info,
* it will create a fab and add into menu.
* @param title
* @param iconDrawable
* @param fabNormalColor
* @param fabPressedColor
* @return
*/ | User can customize their fabNormalColor, and fabPressedColor. And based on these info, it will create a fab and add into menu | assembleFab | {
"repo_name": "wingjay/jayAndroid",
"path": "app/src/main/java/com/wingjay/jayandroid/fab/AbsFloatingActionsMenu.java",
"license": "apache-2.0",
"size": 11915
} | [
"android.graphics.drawable.Drawable",
"com.getbase.floatingactionbutton.FloatingActionButton"
] | import android.graphics.drawable.Drawable; import com.getbase.floatingactionbutton.FloatingActionButton; | import android.graphics.drawable.*; import com.getbase.floatingactionbutton.*; | [
"android.graphics",
"com.getbase.floatingactionbutton"
] | android.graphics; com.getbase.floatingactionbutton; | 805,495 |
ArtifactVersion getNewestUpdate( UpdateScope updateScope, boolean includeSnapshots ); | ArtifactVersion getNewestUpdate( UpdateScope updateScope, boolean includeSnapshots ); | /**
* Returns the newest version newer than the specified current version, but within the the specified update scope or
* <code>null</code> if no such version exists.
*
* @param updateScope the update scope to include.
* @param includeSnapshots <code>true</code> if snapshots are to be included.
* @return the newest version after currentVersion within the specified update scope or <code>null</code> if no
* version is available.
* @since 1.0-beta-1
*/ | Returns the newest version newer than the specified current version, but within the the specified update scope or <code>null</code> if no such version exists | getNewestUpdate | {
"repo_name": "prostagma/versions-maven-plugin",
"path": "src/main/java/org/codehaus/mojo/versions/api/VersionDetails.java",
"license": "apache-2.0",
"size": 28383
} | [
"org.apache.maven.artifact.versioning.ArtifactVersion"
] | import org.apache.maven.artifact.versioning.ArtifactVersion; | import org.apache.maven.artifact.versioning.*; | [
"org.apache.maven"
] | org.apache.maven; | 878,195 |
Collection<Host> getHosts(); | Collection<Host> getHosts(); | /**
* Get all hosts associated with this cluster.
*
* @return collection of hosts that are associated with this cluster
*/ | Get all hosts associated with this cluster | getHosts | {
"repo_name": "zouzhberk/ambaridemo",
"path": "demo-server/src/main/java/org/apache/ambari/server/state/Cluster.java",
"license": "apache-2.0",
"size": 18966
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,076,687 |
@Order(2)
public int cacheId() {
return tbl.cacheId();
} | @Order(2) int function() { return tbl.cacheId(); } | /**
* Returns cache ID.
* @return Cache ID.
*/ | Returns cache ID | cacheId | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/indexing/src/main/java/org/apache/ignite/spi/systemview/view/SqlIndexView.java",
"license": "apache-2.0",
"size": 3730
} | [
"org.apache.ignite.internal.managers.systemview.walker.Order"
] | import org.apache.ignite.internal.managers.systemview.walker.Order; | import org.apache.ignite.internal.managers.systemview.walker.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,848,155 |
public void setLibdir(File libdir) {
this.libdir = libdir;
}
| void function(File libdir) { this.libdir = libdir; } | /**
* Sets the libdir.
*
* @param libdir
* the new libdir
*/ | Sets the libdir | setLibdir | {
"repo_name": "synergynet/synergynet2.5",
"path": "synergynet2.5/src/main/java/synergynetframework/appsystem/launcher/distbuilder/CommandLineOptsMaker.java",
"license": "bsd-3-clause",
"size": 5996
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 759,832 |
public static void sqlleft(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
if (parsedArgs.size() != 2) {
throw new PSQLException(GT.tr("{0} function takes two and only two arguments.", "left"),
PSQLState.SYNTAX_ERROR);
}
appendCall(buf, "substring(", " for ", ")", parsedArgs);
} | static void function(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { if (parsedArgs.size() != 2) { throw new PSQLException(GT.tr(STR, "left"), PSQLState.SYNTAX_ERROR); } appendCall(buf, STR, STR, ")", parsedArgs); } | /**
* left to substring translation
*
* @param buf The buffer to append into
* @param parsedArgs arguments
* @throws SQLException if something wrong happens
*/ | left to substring translation | sqlleft | {
"repo_name": "golovnin/pgjdbc",
"path": "pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java",
"license": "bsd-2-clause",
"size": 25169
} | [
"java.sql.SQLException",
"java.util.List",
"org.postgresql.util.GT",
"org.postgresql.util.PSQLException",
"org.postgresql.util.PSQLState"
] | import java.sql.SQLException; import java.util.List; import org.postgresql.util.GT; import org.postgresql.util.PSQLException; import org.postgresql.util.PSQLState; | import java.sql.*; import java.util.*; import org.postgresql.util.*; | [
"java.sql",
"java.util",
"org.postgresql.util"
] | java.sql; java.util; org.postgresql.util; | 1,012,306 |
public String createSnapshot(final String path, String snapshotName
) throws IOException {
INodeDirectorySnapshottable srcRoot = getSnapshottableRoot(path);
if (snapshotCounter == getMaxSnapshotID()) {
// We have reached the maximum allowable snapshot ID and since we don't
// handle rollover we will fail all subsequent snapshot creation
// requests.
//
throw new SnapshotException(
"Failed to create the snapshot. The FileSystem has run out of " +
"snapshot IDs and ID rollover is not supported.");
}
srcRoot.addSnapshot(snapshotCounter, snapshotName);
//create success, update id
snapshotCounter++;
numSnapshots.getAndIncrement();
return Snapshot.getSnapshotPath(path, snapshotName);
} | String function(final String path, String snapshotName ) throws IOException { INodeDirectorySnapshottable srcRoot = getSnapshottableRoot(path); if (snapshotCounter == getMaxSnapshotID()) { STR + STR); } srcRoot.addSnapshot(snapshotCounter, snapshotName); snapshotCounter++; numSnapshots.getAndIncrement(); return Snapshot.getSnapshotPath(path, snapshotName); } | /**
* Create a snapshot of the given path.
* It is assumed that the caller will perform synchronization.
*
* @param path
* The directory path where the snapshot will be taken.
* @param snapshotName
* The name of the snapshot.
* @throws IOException
* Throw IOException when 1) the given path does not lead to an
* existing snapshottable directory, and/or 2) there exists a
* snapshot with the given name for the directory, and/or 3)
* snapshot number exceeds quota
*/ | Create a snapshot of the given path. It is assumed that the caller will perform synchronization | createSnapshot | {
"repo_name": "jsrudani/HadoopHDFSProject",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java",
"license": "apache-2.0",
"size": 14144
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,290,856 |
Credentials addThirdPartyCredentials(Credentials creds) throws KeyException, IllegalAccessException {
//retrieve scheduler key pair
String privateKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PRIVKEY_PATH.getValueAsString());
String publicKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PUBKEY_PATH.getValueAsString());
//get keys from task
PrivateKey privateKey = Credentials.getPrivateKey(privateKeyPath);
PublicKey publicKey = Credentials.getPublicKey(publicKeyPath);
//retrieve the current creData from task
CredData credData = creds.decrypt(privateKey);
//retrive database to get third party credentials from
SchedulerDBManager dbManager = getInfrastructure().getDBManager();
if (dbManager != null) {
Map<String, HybridEncryptedData> thirdPartyCredentials = dbManager.thirdPartyCredentialsMap(credData.getLogin());
if (thirdPartyCredentials == null) {
logger.error("Failed to retrieve Third Party Credentials!");
throw new KeyException("Failed to retrieve thirdPartyCredentials!");
} else {
//cycle third party credentials, add one-by-one to the decrypter
for (Map.Entry<String, HybridEncryptedData> thirdPartyCredential : thirdPartyCredentials.entrySet()) {
String decryptedValue = HybridEncryptionUtil.decryptString(thirdPartyCredential.getValue(),
privateKey);
credData.addThirdPartyCredential(thirdPartyCredential.getKey(), decryptedValue);
}
}
}
return Credentials.createCredentials(credData, publicKey);
} | Credentials addThirdPartyCredentials(Credentials creds) throws KeyException, IllegalAccessException { String privateKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PRIVKEY_PATH.getValueAsString()); String publicKeyPath = PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_AUTH_PUBKEY_PATH.getValueAsString()); PrivateKey privateKey = Credentials.getPrivateKey(privateKeyPath); PublicKey publicKey = Credentials.getPublicKey(publicKeyPath); CredData credData = creds.decrypt(privateKey); SchedulerDBManager dbManager = getInfrastructure().getDBManager(); if (dbManager != null) { Map<String, HybridEncryptedData> thirdPartyCredentials = dbManager.thirdPartyCredentialsMap(credData.getLogin()); if (thirdPartyCredentials == null) { logger.error(STR); throw new KeyException(STR); } else { for (Map.Entry<String, HybridEncryptedData> thirdPartyCredential : thirdPartyCredentials.entrySet()) { String decryptedValue = HybridEncryptionUtil.decryptString(thirdPartyCredential.getValue(), privateKey); credData.addThirdPartyCredential(thirdPartyCredential.getKey(), decryptedValue); } } } return Credentials.createCredentials(credData, publicKey); } | /**
* Create a new Credential object containing users' 3rd Party Credentials.
*
* @param creds credentials for specific user
* @return in case of success new object containing the 3rd party credentials used to create bindings
* at clean script
*/ | Create a new Credential object containing users' 3rd Party Credentials | addThirdPartyCredentials | {
"repo_name": "tobwiens/scheduling",
"path": "scheduler/scheduler-server/src/main/java/org/ow2/proactive/scheduler/core/SchedulingService.java",
"license": "agpl-3.0",
"size": 45835
} | [
"java.security.KeyException",
"java.security.PrivateKey",
"java.security.PublicKey",
"java.util.Map",
"org.ow2.proactive.authentication.crypto.CredData",
"org.ow2.proactive.authentication.crypto.Credentials",
"org.ow2.proactive.authentication.crypto.HybridEncryptionUtil",
"org.ow2.proactive.scheduler.... | import java.security.KeyException; import java.security.PrivateKey; import java.security.PublicKey; import java.util.Map; import org.ow2.proactive.authentication.crypto.CredData; import org.ow2.proactive.authentication.crypto.Credentials; import org.ow2.proactive.authentication.crypto.HybridEncryptionUtil; import org.ow2.proactive.scheduler.core.db.SchedulerDBManager; import org.ow2.proactive.scheduler.core.properties.PASchedulerProperties; | import java.security.*; import java.util.*; import org.ow2.proactive.authentication.crypto.*; import org.ow2.proactive.scheduler.core.db.*; import org.ow2.proactive.scheduler.core.properties.*; | [
"java.security",
"java.util",
"org.ow2.proactive"
] | java.security; java.util; org.ow2.proactive; | 761,901 |
public List<PersistenceContextRefType<InterceptorType<T>>> getAllPersistenceContextRef()
{
List<PersistenceContextRefType<InterceptorType<T>>> list = new ArrayList<PersistenceContextRefType<InterceptorType<T>>>();
List<Node> nodeList = childNode.get("persistence-context-ref");
for(Node node: nodeList)
{
PersistenceContextRefType<InterceptorType<T>> type = new PersistenceContextRefTypeImpl<InterceptorType<T>>(this, "persistence-context-ref", childNode, node);
list.add(type);
}
return list;
} | List<PersistenceContextRefType<InterceptorType<T>>> function() { List<PersistenceContextRefType<InterceptorType<T>>> list = new ArrayList<PersistenceContextRefType<InterceptorType<T>>>(); List<Node> nodeList = childNode.get(STR); for(Node node: nodeList) { PersistenceContextRefType<InterceptorType<T>> type = new PersistenceContextRefTypeImpl<InterceptorType<T>>(this, STR, childNode, node); list.add(type); } return list; } | /**
* Returns all <code>persistence-context-ref</code> elements
* @return list of <code>persistence-context-ref</code>
*/ | Returns all <code>persistence-context-ref</code> elements | getAllPersistenceContextRef | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar32/InterceptorTypeImpl.java",
"license": "epl-1.0",
"size": 60039
} | [
"java.util.ArrayList",
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.ejbjar32.InterceptorType",
"org.jboss.shrinkwrap.descriptor.api.javaee7.PersistenceContextRefType",
"org.jboss.shrinkwrap.descriptor.impl.javaee7.PersistenceContextRefTypeImpl",
"org.jboss.shrinkwrap.descriptor.spi.node.Node"
] | import java.util.ArrayList; import java.util.List; import org.jboss.shrinkwrap.descriptor.api.ejbjar32.InterceptorType; import org.jboss.shrinkwrap.descriptor.api.javaee7.PersistenceContextRefType; import org.jboss.shrinkwrap.descriptor.impl.javaee7.PersistenceContextRefTypeImpl; import org.jboss.shrinkwrap.descriptor.spi.node.Node; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.ejbjar32.*; import org.jboss.shrinkwrap.descriptor.api.javaee7.*; import org.jboss.shrinkwrap.descriptor.impl.javaee7.*; import org.jboss.shrinkwrap.descriptor.spi.node.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 2,413,887 |
@Override public void exitAnyAll(@NotNull PQLParser.AnyAllContext ctx) { } | @Override public void exitAnyAll(@NotNull PQLParser.AnyAllContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | enterAnyAll | {
"repo_name": "processquerying/PQL",
"path": "src/org/pql/antlr/PQLBaseListener.java",
"license": "lgpl-3.0",
"size": 23062
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,651,886 |
public Optional<String> commandLine(); | Optional<String> function(); | /**
* Returns the command line of the process.
* <p>
* If {@link #command command()} and {@link #arguments arguments()} return
* non-empty optionals, this is simply a convenience method which concatenates
* the values of the two functions separated by spaces. Otherwise it will return a
* best-effort, platform dependent representation of the command line.
*
* @apiNote Note that the returned executable pathname and the
* arguments may be truncated on some platforms due to system
* limitations.
* <p>
* The executable pathname may contain only the
* name of the executable without the full path information.
* It is undecideable whether white space separates different
* arguments or is part of a single argument.
*
* @return an {@code Optional<String>} of the command line
* of the process
*/ | Returns the command line of the process. If <code>#command command()</code> and <code>#arguments arguments()</code> return non-empty optionals, this is simply a convenience method which concatenates the values of the two functions separated by spaces. Otherwise it will return a best-effort, platform dependent representation of the command line | commandLine | {
"repo_name": "md-5/jdk10",
"path": "src/java.base/share/classes/java/lang/ProcessHandle.java",
"license": "gpl-2.0",
"size": 19736
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,314,995 |
private NavigableSet<Integer> populatedSet(int n) {
TreeSet<Integer> q = new TreeSet<Integer>();
assertTrue(q.isEmpty());
for (int i = n - 1; i >= 0; i -= 2)
assertTrue(q.add(new Integer(i)));
for (int i = (n & 1); i < n; i += 2)
assertTrue(q.add(new Integer(i)));
assertTrue(q.add(new Integer(-n)));
assertTrue(q.add(new Integer(n)));
NavigableSet s = q.subSet(new Integer(0), true, new Integer(n), false);
assertFalse(s.isEmpty());
assertEquals(n, s.size());
return s;
} | NavigableSet<Integer> function(int n) { TreeSet<Integer> q = new TreeSet<Integer>(); assertTrue(q.isEmpty()); for (int i = n - 1; i >= 0; i -= 2) assertTrue(q.add(new Integer(i))); for (int i = (n & 1); i < n; i += 2) assertTrue(q.add(new Integer(i))); assertTrue(q.add(new Integer(-n))); assertTrue(q.add(new Integer(n))); NavigableSet s = q.subSet(new Integer(0), true, new Integer(n), false); assertFalse(s.isEmpty()); assertEquals(n, s.size()); return s; } | /**
* Returns a new set of given size containing consecutive
* Integers 0 ... n.
*/ | Returns a new set of given size containing consecutive Integers 0 ... n | populatedSet | {
"repo_name": "debian-pkg-android-tools/android-platform-libcore",
"path": "jsr166-tests/src/test/java/jsr166/TreeSubSetTest.java",
"license": "gpl-2.0",
"size": 30800
} | [
"java.util.NavigableSet",
"java.util.TreeSet"
] | import java.util.NavigableSet; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,396,924 |
public Vector4f set(FloatBuffer buffer) {
return set(buffer.position(), buffer);
}
| Vector4f function(FloatBuffer buffer) { return set(buffer.position(), buffer); } | /**
* Read this vector from the supplied {@link FloatBuffer} at the current
* buffer {@link FloatBuffer#position() position}.
* <p>
* This method will not increment the position of the given FloatBuffer.
* <p>
* In order to specify the offset into the FloatBuffer at which
* the vector is read, use {@link #set(int, FloatBuffer)}, taking
* the absolute position as parameter.
*
* @param buffer
* values will be read in <tt>x, y, z, w</tt> order
* @return this
* @see #set(int, FloatBuffer)
*/ | Read this vector from the supplied <code>FloatBuffer</code> at the current buffer <code>FloatBuffer#position() position</code>. This method will not increment the position of the given FloatBuffer. In order to specify the offset into the FloatBuffer at which the vector is read, use <code>#set(int, FloatBuffer)</code>, taking the absolute position as parameter | set | {
"repo_name": "FortressBuilder/JOML",
"path": "src/org/joml/Vector4f.java",
"license": "mit",
"size": 42415
} | [
"java.nio.FloatBuffer"
] | import java.nio.FloatBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 10,554 |
@SuppressWarnings("unused")
public void dumpLocked(Context context, PrintWriter pw, int flags, int reqUid, long histStart) {
prepareForDumpLocked();
final boolean filtering = (flags
& (DUMP_HISTORY_ONLY|DUMP_CHARGED_ONLY|DUMP_DAILY_ONLY)) != 0;
if ((flags&DUMP_HISTORY_ONLY) != 0 || !filtering) {
final long historyTotalSize = getHistoryTotalSize();
final long historyUsedSize = getHistoryUsedSize();
if (startIteratingHistoryLocked()) {
try {
pw.print("Battery History (");
pw.print((100*historyUsedSize)/historyTotalSize);
pw.print("% used, ");
printSizeValue(pw, historyUsedSize);
pw.print(" used of ");
printSizeValue(pw, historyTotalSize);
pw.print(", ");
pw.print(getHistoryStringPoolSize());
pw.print(" strings using ");
printSizeValue(pw, getHistoryStringPoolBytes());
pw.println("):");
dumpHistoryLocked(pw, flags, histStart, false);
pw.println();
} finally {
finishIteratingHistoryLocked();
}
}
if (startIteratingOldHistoryLocked()) {
try {
final HistoryItem rec = new HistoryItem();
pw.println("Old battery History:");
HistoryPrinter hprinter = new HistoryPrinter();
long baseTime = -1;
while (getNextOldHistoryLocked(rec)) {
if (baseTime < 0) {
baseTime = rec.time;
}
hprinter.printNextItem(pw, rec, baseTime, false, (flags&DUMP_VERBOSE) != 0);
}
pw.println();
} finally {
finishIteratingOldHistoryLocked();
}
}
}
if (filtering && (flags&(DUMP_CHARGED_ONLY|DUMP_DAILY_ONLY)) == 0) {
return;
}
if (!filtering) {
SparseArray<? extends Uid> uidStats = getUidStats();
final int NU = uidStats.size();
boolean didPid = false;
long nowRealtime = SystemClock.elapsedRealtime();
for (int i=0; i<NU; i++) {
Uid uid = uidStats.valueAt(i);
SparseArray<? extends Uid.Pid> pids = uid.getPidStats();
if (pids != null) {
for (int j=0; j<pids.size(); j++) {
Uid.Pid pid = pids.valueAt(j);
if (!didPid) {
pw.println("Per-PID Stats:");
didPid = true;
}
long time = pid.mWakeSumMs + (pid.mWakeNesting > 0
? (nowRealtime - pid.mWakeStartMs) : 0);
pw.print(" PID "); pw.print(pids.keyAt(j));
pw.print(" wake time: ");
TimeUtils.formatDuration(time, pw);
pw.println("");
}
}
}
if (didPid) {
pw.println();
}
}
if (!filtering || (flags&DUMP_CHARGED_ONLY) != 0) {
if (dumpDurationSteps(pw, " ", "Discharge step durations:",
getDischargeLevelStepTracker(), false)) {
long timeRemaining = computeBatteryTimeRemaining(SystemClock.elapsedRealtime());
if (timeRemaining >= 0) {
pw.print(" Estimated discharge time remaining: ");
TimeUtils.formatDuration(timeRemaining / 1000, pw);
pw.println();
}
final LevelStepTracker steps = getDischargeLevelStepTracker();
for (int i=0; i< STEP_LEVEL_MODES_OF_INTEREST.length; i++) {
dumpTimeEstimate(pw, " Estimated ", STEP_LEVEL_MODE_LABELS[i], " time: ",
steps.computeTimeEstimate(STEP_LEVEL_MODES_OF_INTEREST[i],
STEP_LEVEL_MODE_VALUES[i], null));
}
pw.println();
}
if (dumpDurationSteps(pw, " ", "Charge step durations:",
getChargeLevelStepTracker(), false)) {
long timeRemaining = computeChargeTimeRemaining(SystemClock.elapsedRealtime());
if (timeRemaining >= 0) {
pw.print(" Estimated charge time remaining: ");
TimeUtils.formatDuration(timeRemaining / 1000, pw);
pw.println();
}
pw.println();
}
}
if (!filtering || (flags&(DUMP_CHARGED_ONLY|DUMP_DAILY_ONLY)) != 0) {
pw.println("Daily stats:");
pw.print(" Current start time: ");
pw.println(DateFormat.format("yyyy-MM-dd-HH-mm-ss",
getCurrentDailyStartTime()).toString());
pw.print(" Next min deadline: ");
pw.println(DateFormat.format("yyyy-MM-dd-HH-mm-ss",
getNextMinDailyDeadline()).toString());
pw.print(" Next max deadline: ");
pw.println(DateFormat.format("yyyy-MM-dd-HH-mm-ss",
getNextMaxDailyDeadline()).toString());
StringBuilder sb = new StringBuilder(64);
int[] outInt = new int[1];
LevelStepTracker dsteps = getDailyDischargeLevelStepTracker();
LevelStepTracker csteps = getDailyChargeLevelStepTracker();
ArrayList<PackageChange> pkgc = getDailyPackageChanges();
if (dsteps.mNumStepDurations > 0 || csteps.mNumStepDurations > 0 || pkgc != null) {
if ((flags&DUMP_DAILY_ONLY) != 0 || !filtering) {
if (dumpDurationSteps(pw, " ", " Current daily discharge step durations:",
dsteps, false)) {
dumpDailyLevelStepSummary(pw, " ", "Discharge", dsteps,
sb, outInt);
}
if (dumpDurationSteps(pw, " ", " Current daily charge step durations:",
csteps, false)) {
dumpDailyLevelStepSummary(pw, " ", "Charge", csteps,
sb, outInt);
}
dumpDailyPackageChanges(pw, " ", pkgc);
} else {
pw.println(" Current daily steps:");
dumpDailyLevelStepSummary(pw, " ", "Discharge", dsteps,
sb, outInt);
dumpDailyLevelStepSummary(pw, " ", "Charge", csteps,
sb, outInt);
}
}
DailyItem dit;
int curIndex = 0;
while ((dit=getDailyItemLocked(curIndex)) != null) {
curIndex++;
if ((flags&DUMP_DAILY_ONLY) != 0) {
pw.println();
}
pw.print(" Daily from ");
pw.print(DateFormat.format("yyyy-MM-dd-HH-mm-ss", dit.mStartTime).toString());
pw.print(" to ");
pw.print(DateFormat.format("yyyy-MM-dd-HH-mm-ss", dit.mEndTime).toString());
pw.println(":");
if ((flags&DUMP_DAILY_ONLY) != 0 || !filtering) {
if (dumpDurationSteps(pw, " ",
" Discharge step durations:", dit.mDischargeSteps, false)) {
dumpDailyLevelStepSummary(pw, " ", "Discharge", dit.mDischargeSteps,
sb, outInt);
}
if (dumpDurationSteps(pw, " ",
" Charge step durations:", dit.mChargeSteps, false)) {
dumpDailyLevelStepSummary(pw, " ", "Charge", dit.mChargeSteps,
sb, outInt);
}
dumpDailyPackageChanges(pw, " ", dit.mPackageChanges);
} else {
dumpDailyLevelStepSummary(pw, " ", "Discharge", dit.mDischargeSteps,
sb, outInt);
dumpDailyLevelStepSummary(pw, " ", "Charge", dit.mChargeSteps,
sb, outInt);
}
}
pw.println();
}
if (!filtering || (flags&DUMP_CHARGED_ONLY) != 0) {
pw.println("Statistics since last charge:");
pw.println(" System starts: " + getStartCount()
+ ", currently on battery: " + getIsOnBattery());
dumpLocked(context, pw, "", STATS_SINCE_CHARGED, reqUid,
(flags&DUMP_DEVICE_WIFI_ONLY) != 0);
pw.println();
}
} | @SuppressWarnings(STR) void function(Context context, PrintWriter pw, int flags, int reqUid, long histStart) { prepareForDumpLocked(); final boolean filtering = (flags & (DUMP_HISTORY_ONLY DUMP_CHARGED_ONLY DUMP_DAILY_ONLY)) != 0; if ((flags&DUMP_HISTORY_ONLY) != 0 !filtering) { final long historyTotalSize = getHistoryTotalSize(); final long historyUsedSize = getHistoryUsedSize(); if (startIteratingHistoryLocked()) { try { pw.print(STR); pw.print((100*historyUsedSize)/historyTotalSize); pw.print(STR); printSizeValue(pw, historyUsedSize); pw.print(STR); printSizeValue(pw, historyTotalSize); pw.print(STR); pw.print(getHistoryStringPoolSize()); pw.print(STR); printSizeValue(pw, getHistoryStringPoolBytes()); pw.println("):"); dumpHistoryLocked(pw, flags, histStart, false); pw.println(); } finally { finishIteratingHistoryLocked(); } } if (startIteratingOldHistoryLocked()) { try { final HistoryItem rec = new HistoryItem(); pw.println(STR); HistoryPrinter hprinter = new HistoryPrinter(); long baseTime = -1; while (getNextOldHistoryLocked(rec)) { if (baseTime < 0) { baseTime = rec.time; } hprinter.printNextItem(pw, rec, baseTime, false, (flags&DUMP_VERBOSE) != 0); } pw.println(); } finally { finishIteratingOldHistoryLocked(); } } } if (filtering && (flags&(DUMP_CHARGED_ONLY DUMP_DAILY_ONLY)) == 0) { return; } if (!filtering) { SparseArray<? extends Uid> uidStats = getUidStats(); final int NU = uidStats.size(); boolean didPid = false; long nowRealtime = SystemClock.elapsedRealtime(); for (int i=0; i<NU; i++) { Uid uid = uidStats.valueAt(i); SparseArray<? extends Uid.Pid> pids = uid.getPidStats(); if (pids != null) { for (int j=0; j<pids.size(); j++) { Uid.Pid pid = pids.valueAt(j); if (!didPid) { pw.println(STR); didPid = true; } long time = pid.mWakeSumMs + (pid.mWakeNesting > 0 ? (nowRealtime - pid.mWakeStartMs) : 0); pw.print(STR); pw.print(pids.keyAt(j)); pw.print(STR); TimeUtils.formatDuration(time, pw); pw.println(STR STRDischarge step durations:STR Estimated discharge time remaining: STR Estimated STR time: STR STRCharge step durations:STR Estimated charge time remaining: STRDaily stats:STR Current start time: STRyyyy-MM-dd-HH-mm-ssSTR Next min deadline: STRyyyy-MM-dd-HH-mm-ssSTR Next max deadline: STRyyyy-MM-dd-HH-mm-ssSTR STR Current daily discharge step durations:STR STRDischargeSTR STR Current daily charge step durations:STR STRChargeSTR STR Current daily steps:STR STRDischargeSTR STRChargeSTR Daily from STRyyyy-MM-dd-HH-mm-ssSTR to STRyyyy-MM-dd-HH-mm-ssSTR:STR STR Discharge step durations:STR STRDischargeSTR STR Charge step durations:STR STRChargeSTR STR STRDischargeSTR STRChargeSTRStatistics since last charge:STR System starts: STR, currently on battery: STR", STATS_SINCE_CHARGED, reqUid, (flags&DUMP_DEVICE_WIFI_ONLY) != 0); pw.println(); } } | /**
* Dumps a human-readable summary of the battery statistics to the given PrintWriter.
*
* @param pw a Printer to receive the dump output.
*/ | Dumps a human-readable summary of the battery statistics to the given PrintWriter | dumpLocked | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/os/BatteryStats.java",
"license": "gpl-3.0",
"size": 221210
} | [
"android.content.Context",
"android.util.SparseArray",
"android.util.TimeUtils",
"java.io.PrintWriter"
] | import android.content.Context; import android.util.SparseArray; import android.util.TimeUtils; import java.io.PrintWriter; | import android.content.*; import android.util.*; import java.io.*; | [
"android.content",
"android.util",
"java.io"
] | android.content; android.util; java.io; | 2,493,843 |
public ItemStack getCurrentItem()
{
return this.currentItem < 9 && this.currentItem >= 0 ? this.mainInventory[this.currentItem] : null;
} | ItemStack function() { return this.currentItem < 9 && this.currentItem >= 0 ? this.mainInventory[this.currentItem] : null; } | /**
* Returns the item stack currently held by the player.
*/ | Returns the item stack currently held by the player | getCurrentItem | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/entity/player/InventoryPlayer.java",
"license": "mit",
"size": 23532
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 2,404,111 |
public URL getURL() {
try {
return new URL(url);
} catch (MalformedURLException ex) {
return null;
}
} | URL function() { try { return new URL(url); } catch (MalformedURLException ex) { return null; } } | /**
* Returns the url of the user
*
* @return the url of the user
*/ | Returns the url of the user | getURL | {
"repo_name": "sunbeansoft/weibo4android",
"path": "src/weibo4andriod/User.java",
"license": "bsd-3-clause",
"size": 21829
} | [
"java.net.MalformedURLException"
] | import java.net.MalformedURLException; | import java.net.*; | [
"java.net"
] | java.net; | 1,797,446 |
private static void nonCachingRecursion(final Formula formula, final Map<Variable, Integer> map) {
if (formula.type() == FType.LITERAL) {
final Literal lit = (Literal) formula;
map.merge(lit.variable(), 1, Integer::sum);
} else if (formula.type() == FType.PBC) {
for (final Literal l : formula.literals()) {
nonCachingRecursion(l.variable(), map);
}
} else {
for (final Formula op : formula) {
nonCachingRecursion(op, map);
}
}
} | static void function(final Formula formula, final Map<Variable, Integer> map) { if (formula.type() == FType.LITERAL) { final Literal lit = (Literal) formula; map.merge(lit.variable(), 1, Integer::sum); } else if (formula.type() == FType.PBC) { for (final Literal l : formula.literals()) { nonCachingRecursion(l.variable(), map); } } else { for (final Formula op : formula) { nonCachingRecursion(op, map); } } } | /**
* Recursive function for the non-caching variable profile computation.
* @param formula the formula
* @param map the variable profile
*/ | Recursive function for the non-caching variable profile computation | nonCachingRecursion | {
"repo_name": "logic-ng/LogicNG",
"path": "src/main/java/org/logicng/functions/VariableProfileFunction.java",
"license": "apache-2.0",
"size": 5737
} | [
"java.util.Map",
"org.logicng.formulas.FType",
"org.logicng.formulas.Formula",
"org.logicng.formulas.Literal",
"org.logicng.formulas.Variable"
] | import java.util.Map; import org.logicng.formulas.FType; import org.logicng.formulas.Formula; import org.logicng.formulas.Literal; import org.logicng.formulas.Variable; | import java.util.*; import org.logicng.formulas.*; | [
"java.util",
"org.logicng.formulas"
] | java.util; org.logicng.formulas; | 2,332,290 |
public static int getAvailablePort() {
for (int i = 0; i < 50; i++) {
try (ServerSocket serverSocket = new ServerSocket(0)) {
int port = serverSocket.getLocalPort();
if (port != 0) {
return port;
}
} catch (IOException ignored) {
}
}
throw new RuntimeException("Could not find a free permitted port on the machine.");
}
// ------------------------------------------------------------------------
// Encoding of IP addresses for URLs
// ------------------------------------------------------------------------ | static int function() { for (int i = 0; i < 50; i++) { try (ServerSocket serverSocket = new ServerSocket(0)) { int port = serverSocket.getLocalPort(); if (port != 0) { return port; } } catch (IOException ignored) { } } throw new RuntimeException(STR); } | /**
* Find a non-occupied port.
*
* @return A non-occupied port.
*/ | Find a non-occupied port | getAvailablePort | {
"repo_name": "StephanEwen/incubator-flink",
"path": "flink-core/src/main/java/org/apache/flink/util/NetUtils.java",
"license": "apache-2.0",
"size": 20085
} | [
"java.io.IOException",
"java.net.ServerSocket"
] | import java.io.IOException; import java.net.ServerSocket; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 1,809,199 |
private int queryNumFileChunks(long contentID) throws SolrServerException, IOException {
String id = KeywordSearchUtil.escapeLuceneQuery(Long.toString(contentID));
final SolrQuery q
= new SolrQuery(Server.Schema.ID + ":" + id + Server.CHUNK_ID_SEPARATOR + "*");
q.setRows(0);
return (int) query(q).getResults().getNumFound();
}
}
class ServerAction extends AbstractAction {
private static final long serialVersionUID = 1L; | int function(long contentID) throws SolrServerException, IOException { String id = KeywordSearchUtil.escapeLuceneQuery(Long.toString(contentID)); final SolrQuery q = new SolrQuery(Server.Schema.ID + ":" + id + Server.CHUNK_ID_SEPARATOR + "*"); q.setRows(0); return (int) query(q).getResults().getNumFound(); } } class ServerAction extends AbstractAction { private static final long serialVersionUID = 1L; | /**
* Execute query that gets number of indexed file chunks for a file
*
* @param contentID file id of the original file broken into chunks and
* indexed
*
* @return int representing number of indexed file chunks, 0 if there is
* no chunks
*
* @throws SolrServerException
*/ | Execute query that gets number of indexed file chunks for a file | queryNumFileChunks | {
"repo_name": "eugene7646/autopsy",
"path": "KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java",
"license": "apache-2.0",
"size": 101731
} | [
"java.io.IOException",
"javax.swing.AbstractAction",
"org.apache.solr.client.solrj.SolrQuery",
"org.apache.solr.client.solrj.SolrServerException"
] | import java.io.IOException; import javax.swing.AbstractAction; import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrServerException; | import java.io.*; import javax.swing.*; import org.apache.solr.client.solrj.*; | [
"java.io",
"javax.swing",
"org.apache.solr"
] | java.io; javax.swing; org.apache.solr; | 1,563 |
public static void closeQuietly(Statement stmt) {
if( stmt != null ) {
try {
stmt.close();
} catch(SQLException ignore) {
}
}
} | static void function(Statement stmt) { if( stmt != null ) { try { stmt.close(); } catch(SQLException ignore) { } } } | /**
* Close a Statement and ignore any errors during closing.
*/ | Close a Statement and ignore any errors during closing | closeQuietly | {
"repo_name": "phillipross/pgjdbc",
"path": "org/postgresql/test/TestUtil.java",
"license": "bsd-3-clause",
"size": 19106
} | [
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 103,129 |
public static Document createDocument(String rootTag) throws ParserConfigurationException {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
DOMImplementation domImpl = builder.getDOMImplementation();
Document doc = domImpl.createDocument(null, rootTag, null);
return doc;
} | static Document function(String rootTag) throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation domImpl = builder.getDOMImplementation(); Document doc = domImpl.createDocument(null, rootTag, null); return doc; } | /**
* create an empty DOM <code>Document</code> with root tag as given in the parameter <code>rootTag</code>
*
* @param rootTag
* @return
* @throws ParserConfigurationException
*/ | create an empty DOM <code>Document</code> with root tag as given in the parameter <code>rootTag</code> | createDocument | {
"repo_name": "icedeer/command-base",
"path": "src/main/java/com/icedeer/common/util/xml/DomHelper.java",
"license": "mit",
"size": 11923
} | [
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.DOMImplementation",
"org.w3c.dom.Document"
] | import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; | import javax.xml.parsers.*; import org.w3c.dom.*; | [
"javax.xml",
"org.w3c.dom"
] | javax.xml; org.w3c.dom; | 2,812,776 |
Method testMethod = testContext.getTestMethod();
Assert.notNull(testMethod, "The test method of the supplied TestContext must not be null");
boolean dirtiesContext = testMethod.isAnnotationPresent(DirtiesContext.class);
if (logger.isDebugEnabled()) {
logger.debug("After test method: context [" + testContext + "], dirtiesContext [" + dirtiesContext + "].");
}
if (dirtiesContext) {
testContext.markApplicationContextDirty();
testContext.setAttribute(DependencyInjectionTestExecutionListener.REINJECT_DEPENDENCIES_ATTRIBUTE,
Boolean.TRUE);
}
}
| Method testMethod = testContext.getTestMethod(); Assert.notNull(testMethod, STR); boolean dirtiesContext = testMethod.isAnnotationPresent(DirtiesContext.class); if (logger.isDebugEnabled()) { logger.debug(STR + testContext + STR + dirtiesContext + "]."); } if (dirtiesContext) { testContext.markApplicationContextDirty(); testContext.setAttribute(DependencyInjectionTestExecutionListener.REINJECT_DEPENDENCIES_ATTRIBUTE, Boolean.TRUE); } } | /**
* If the current test method of the supplied
* {@link TestContext test context} has been annotated with
* {@link DirtiesContext @DirtiesContext}, the
* {@link ApplicationContext application context} of the test context will
* be {@link TestContext#markApplicationContextDirty() marked as dirty},
* and the
* {@link DependencyInjectionTestExecutionListener#REINJECT_DEPENDENCIES_ATTRIBUTE}
* will be set to <code>true</code> in the test context.
*/ | If the current test method of the supplied <code>TestContext test context</code> has been annotated with <code>DirtiesContext @DirtiesContext</code>, the <code>ApplicationContext application context</code> of the test context will be <code>TestContext#markApplicationContextDirty() marked as dirty</code>, and the <code>DependencyInjectionTestExecutionListener#REINJECT_DEPENDENCIES_ATTRIBUTE</code> will be set to <code>true</code> in the test context | afterTestMethod | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/tiger/mock/org/springframework/test/context/support/DirtiesContextTestExecutionListener.java",
"license": "unlicense",
"size": 2632
} | [
"java.lang.reflect.Method",
"org.springframework.test.annotation.DirtiesContext",
"org.springframework.util.Assert"
] | import java.lang.reflect.Method; import org.springframework.test.annotation.DirtiesContext; import org.springframework.util.Assert; | import java.lang.reflect.*; import org.springframework.test.annotation.*; import org.springframework.util.*; | [
"java.lang",
"org.springframework.test",
"org.springframework.util"
] | java.lang; org.springframework.test; org.springframework.util; | 1,157,739 |
T convert(int statusCode, Headers headers, HttpEntity httpEntity) throws IOException; | T convert(int statusCode, Headers headers, HttpEntity httpEntity) throws IOException; | /**
* from http Body to result with type T
*/ | from http Body to result with type T | convert | {
"repo_name": "powerjava/requests",
"path": "src/main/java/org/power/requests/ResponseProcessor.java",
"license": "apache-2.0",
"size": 548
} | [
"java.io.IOException",
"org.apache.http.HttpEntity",
"org.power.requests.struct.Headers"
] | import java.io.IOException; import org.apache.http.HttpEntity; import org.power.requests.struct.Headers; | import java.io.*; import org.apache.http.*; import org.power.requests.struct.*; | [
"java.io",
"org.apache.http",
"org.power.requests"
] | java.io; org.apache.http; org.power.requests; | 898,934 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(CtrlUnit10.class)) {
case WTSpecPackage.CTRL_UNIT10__BHV_PARAM_BP_OPERATION:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(CtrlUnit10.class)) { case WTSpecPackage.CTRL_UNIT10__BHV_PARAM_BP_OPERATION: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "FTSRG/mondo-collab-framework",
"path": "archive/mondo-access-control/CollaborationIncQuery/WTSpec.edit/src/WTSpec/provider/CtrlUnit10ItemProvider.java",
"license": "epl-1.0",
"size": 9916
} | [
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification"
] | import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; | import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 558,848 |
public static TasksEntry findByUserId_First(long userId,
OrderByComparator<TasksEntry> orderByComparator)
throws com.liferay.tasks.exception.NoSuchTasksEntryException {
return getPersistence().findByUserId_First(userId, orderByComparator);
} | static TasksEntry function(long userId, OrderByComparator<TasksEntry> orderByComparator) throws com.liferay.tasks.exception.NoSuchTasksEntryException { return getPersistence().findByUserId_First(userId, orderByComparator); } | /**
* Returns the first tasks entry in the ordered set where userId = ?.
*
* @param userId the user ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the first matching tasks entry
* @throws NoSuchTasksEntryException if a matching tasks entry could not be found
*/ | Returns the first tasks entry in the ordered set where userId = ? | findByUserId_First | {
"repo_name": "gamerson/blade",
"path": "test-resources/projects/tasks-plugins-sdk/portlets/tasks-portlet/docroot/WEB-INF/service/com/liferay/tasks/service/persistence/TasksEntryUtil.java",
"license": "apache-2.0",
"size": 94635
} | [
"com.liferay.portal.kernel.util.OrderByComparator",
"com.liferay.tasks.model.TasksEntry"
] | import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.tasks.model.TasksEntry; | import com.liferay.portal.kernel.util.*; import com.liferay.tasks.model.*; | [
"com.liferay.portal",
"com.liferay.tasks"
] | com.liferay.portal; com.liferay.tasks; | 75,540 |
public static Class<?> resolveType(Type genericType, Map<TypeVariable, Type> typeVariableMap) {
Type resolvedType = getRawType(genericType, typeVariableMap);
if (resolvedType instanceof GenericArrayType) {
Type componentType = ((GenericArrayType) resolvedType).getGenericComponentType();
Class<?> componentClass = resolveType(componentType, typeVariableMap);
resolvedType = Array.newInstance(componentClass, 0).getClass();
}
return (resolvedType instanceof Class ? (Class) resolvedType : Object.class);
} | static Class<?> function(Type genericType, Map<TypeVariable, Type> typeVariableMap) { Type resolvedType = getRawType(genericType, typeVariableMap); if (resolvedType instanceof GenericArrayType) { Type componentType = ((GenericArrayType) resolvedType).getGenericComponentType(); Class<?> componentClass = resolveType(componentType, typeVariableMap); resolvedType = Array.newInstance(componentClass, 0).getClass(); } return (resolvedType instanceof Class ? (Class) resolvedType : Object.class); } | /**
* Resolve the specified generic type against the given TypeVariable map.
* @param genericType the generic type to resolve
* @param typeVariableMap the TypeVariable Map to resolved against
* @return the type if it resolves to a Class, or {@code Object.class} otherwise
*/ | Resolve the specified generic type against the given TypeVariable map | resolveType | {
"repo_name": "niaoge/spring-dynamic",
"path": "2-hi-spring-dynamic/override/org/springframework/core/GenericTypeResolver.java",
"license": "apache-2.0",
"size": 20653
} | [
"java.lang.reflect.Array",
"java.lang.reflect.GenericArrayType",
"java.lang.reflect.Type",
"java.lang.reflect.TypeVariable",
"java.util.Map"
] | import java.lang.reflect.Array; import java.lang.reflect.GenericArrayType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.util.Map; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,105,798 |
public static Collection<BlockPack> getListPacks()
{
return packs.values();
} | static Collection<BlockPack> function() { return packs.values(); } | /**
* Gets the list of registered <code>BlockPack</code>.
*
* @return the list packs
*/ | Gets the list of registered <code>BlockPack</code> | getListPacks | {
"repo_name": "Ordinastie/DIYDecorativeBlocks",
"path": "src/main/java/net/malisis/ddb/DDB.java",
"license": "lgpl-3.0",
"size": 4777
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,048,818 |
public Observable<ServiceResponse<BastionHostInner>> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String bastionHostName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (bastionHostName == null) {
throw new IllegalArgumentException("Parameter bastionHostName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<BastionHostInner>> function(String resourceGroupName, String bastionHostName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (bastionHostName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* Gets the specified Bastion Host.
*
* @param resourceGroupName The name of the resource group.
* @param bastionHostName The name of the Bastion Host.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the BastionHostInner object
*/ | Gets the specified Bastion Host | getByResourceGroupWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/BastionHostsInner.java",
"license": "mit",
"size": 53514
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,292,342 |
protected Color installColorFill(final Graphics g) {
return this.m_colorFill.applyColorUnconditionally(g);
} | Color function(final Graphics g) { return this.m_colorFill.applyColorUnconditionally(g); } | /**
* Installs the fill color to the graphics context if and only if a fill color
* has been set.
* <p>
*
* @see #setColorFill(Color)
*
* @param g
* the graphics context to use.
*
* @return the previous color of the graphics context or <code>null</code> if
* no action was taken.
*/ | Installs the fill color to the graphics context if and only if a fill color has been set. | installColorFill | {
"repo_name": "cheshirekow/codebase",
"path": "third_party/lcm/lcm-java/jchart2d-code/src/info/monitorenter/gui/chart/pointpainters/APointPainter.java",
"license": "gpl-3.0",
"size": 8295
} | [
"java.awt.Color",
"java.awt.Graphics"
] | import java.awt.Color; import java.awt.Graphics; | import java.awt.*; | [
"java.awt"
] | java.awt; | 210,227 |
public static RegionInfo getRegionInfoForFs(RegionInfo regionInfo) {
if (regionInfo == null) {
return null;
}
return RegionReplicaUtil.getRegionInfoForDefaultReplica(regionInfo);
} | static RegionInfo function(RegionInfo regionInfo) { if (regionInfo == null) { return null; } return RegionReplicaUtil.getRegionInfoForDefaultReplica(regionInfo); } | /**
* Returns the regionInfo object to use for interacting with the file system.
* @return An RegionInfo object to interact with the filesystem
*/ | Returns the regionInfo object to use for interacting with the file system | getRegionInfoForFs | {
"repo_name": "HubSpot/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/ServerRegionReplicaUtil.java",
"license": "apache-2.0",
"size": 10346
} | [
"org.apache.hadoop.hbase.client.RegionInfo",
"org.apache.hadoop.hbase.client.RegionReplicaUtil"
] | import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.RegionReplicaUtil; | import org.apache.hadoop.hbase.client.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,177,057 |
public HashMap<IItem, Vector2f> getContentDimensions()
{
return contentDimensions;
}
| HashMap<IItem, Vector2f> function() { return contentDimensions; } | /**
* Gets the content dimensions.
*
* @return the content dimensions
*/ | Gets the content dimensions | getContentDimensions | {
"repo_name": "synergynet/synergynet3.1",
"path": "synergynet3.1-parent/synergynet3-appsystem-core/src/main/java/synergynet3/projector/network/ProjectorTransferUtilities.java",
"license": "bsd-3-clause",
"size": 12821
} | [
"com.jme3.math.Vector2f",
"java.util.HashMap"
] | import com.jme3.math.Vector2f; import java.util.HashMap; | import com.jme3.math.*; import java.util.*; | [
"com.jme3.math",
"java.util"
] | com.jme3.math; java.util; | 2,656,298 |
int updateByPrimaryKey(Project record); | int updateByPrimaryKey(Project record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table project
*
* @mbggenerated Sat Jan 09 15:57:07 CST 2016
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table project | updateByPrimaryKey | {
"repo_name": "c5487614/DailyReport",
"path": "src/cn/org/hbca/daily/dao/ProjectMapper.java",
"license": "apache-2.0",
"size": 2941
} | [
"cn.org.hbca.daily.model.Project"
] | import cn.org.hbca.daily.model.Project; | import cn.org.hbca.daily.model.*; | [
"cn.org.hbca"
] | cn.org.hbca; | 2,534,766 |
public MultiValueMap<String, String> getTargetRequestParams() {
return this.targetRequestParams;
} | MultiValueMap<String, String> function() { return this.targetRequestParams; } | /**
* Return the parameters identifying the target request, or an empty map.
*/ | Return the parameters identifying the target request, or an empty map | getTargetRequestParams | {
"repo_name": "kingtang/spring-learn",
"path": "spring-webmvc/src/main/java/org/springframework/web/servlet/FlashMap.java",
"license": "gpl-3.0",
"size": 5223
} | [
"org.springframework.util.MultiValueMap"
] | import org.springframework.util.MultiValueMap; | import org.springframework.util.*; | [
"org.springframework.util"
] | org.springframework.util; | 592,312 |
private void expireExample(AerospikeClient client, Parameters params) throws Exception {
Key key = new Key(params.namespace, params.set, "expirekey ");
Bin bin = new Bin(params.getBinName("expirebin"), "expirevalue");
console.info("Put: namespace=%s set=%s key=%s bin=%s value=%s expiration=2",
key.namespace, key.setName, key.userKey, bin.name, bin.value);
// Specify that record expires 2 seconds after it's written.
WritePolicy writePolicy = new WritePolicy();
writePolicy.expiration = 2;
client.put(writePolicy, key, bin);
// Read the record before it expires, showing it is there.
console.info("Get: namespace=%s set=%s key=%s",
key.namespace, key.setName, key.userKey);
Record record = client.get(params.policy, key, bin.name);
if (record == null) {
throw new Exception(String.format(
"Failed to get record: namespace=%s set=%s key=%s",
key.namespace, key.setName, key.userKey));
}
Object received = record.getValue(bin.name);
String expected = bin.value.toString();
if (received.equals(expected)) {
console.info("Get record successful: namespace=%s set=%s key=%s bin=%s value=%s",
key.namespace, key.setName, key.userKey, bin.name, received);
}
else {
throw new Exception(String.format("Expire record mismatch: Expected %s. Received %s.",
expected, received));
}
// Read the record after it expires, showing it's gone.
console.info("Sleeping for 3 seconds ...");
Thread.sleep(3 * 1000);
record = client.get(params.policy, key, bin.name);
if (record == null) {
console.info("Expiry of record successful. Record not found.");
}
else {
console.error("Found record when it should have expired.");
}
} // end expireExample()
| void function(AerospikeClient client, Parameters params) throws Exception { Key key = new Key(params.namespace, params.set, STR); Bin bin = new Bin(params.getBinName(STR), STR); console.info(STR, key.namespace, key.setName, key.userKey, bin.name, bin.value); WritePolicy writePolicy = new WritePolicy(); writePolicy.expiration = 2; client.put(writePolicy, key, bin); console.info(STR, key.namespace, key.setName, key.userKey); Record record = client.get(params.policy, key, bin.name); if (record == null) { throw new Exception(String.format( STR, key.namespace, key.setName, key.userKey)); } Object received = record.getValue(bin.name); String expected = bin.value.toString(); if (received.equals(expected)) { console.info(STR, key.namespace, key.setName, key.userKey, bin.name, received); } else { throw new Exception(String.format(STR, expected, received)); } console.info(STR); Thread.sleep(3 * 1000); record = client.get(params.policy, key, bin.name); if (record == null) { console.info(STR); } else { console.error(STR); } } | /**
* Write and twice read an expiration record.
*/ | Write and twice read an expiration record | expireExample | {
"repo_name": "Stratio/aerospike-client-java",
"path": "examples/src/com/aerospike/examples/Expire.java",
"license": "apache-2.0",
"size": 5230
} | [
"com.aerospike.client.AerospikeClient",
"com.aerospike.client.Bin",
"com.aerospike.client.Key",
"com.aerospike.client.Record",
"com.aerospike.client.policy.WritePolicy"
] | import com.aerospike.client.AerospikeClient; import com.aerospike.client.Bin; import com.aerospike.client.Key; import com.aerospike.client.Record; import com.aerospike.client.policy.WritePolicy; | import com.aerospike.client.*; import com.aerospike.client.policy.*; | [
"com.aerospike.client"
] | com.aerospike.client; | 1,872,029 |
public void shutdown(long delay) throws XMLDBException; | void function(long delay) throws XMLDBException; | /**
* Shutdown the current database instance after the specified
* delay (in milliseconds).
* This current user should be a member of the "dba" group
* or an exception will be thrown.
*
* @throws XMLDBException
*/ | Shutdown the current database instance after the specified delay (in milliseconds). This current user should be a member of the "dba" group or an exception will be thrown | shutdown | {
"repo_name": "kingargyle/exist-1.4.x",
"path": "src/org/exist/xmldb/DatabaseInstanceManager.java",
"license": "lgpl-2.1",
"size": 1447
} | [
"org.xmldb.api.base.XMLDBException"
] | import org.xmldb.api.base.XMLDBException; | import org.xmldb.api.base.*; | [
"org.xmldb.api"
] | org.xmldb.api; | 725,830 |
protected void setVmTable(Map<String, Host> vmTable) {
this.vmTable = vmTable;
} | void function(Map<String, Host> vmTable) { this.vmTable = vmTable; } | /**
* Sets the vm table.
*
* @param vmTable the vm table
*/ | Sets the vm table | setVmTable | {
"repo_name": "CagataySonmez/EdgeCloudSim",
"path": "src/edu/boun/edgecloudsim/edge_client/mobile_processing_unit/MobileVmAllocationPolicy_Custom.java",
"license": "gpl-3.0",
"size": 3624
} | [
"java.util.Map",
"org.cloudbus.cloudsim.Host"
] | import java.util.Map; import org.cloudbus.cloudsim.Host; | import java.util.*; import org.cloudbus.cloudsim.*; | [
"java.util",
"org.cloudbus.cloudsim"
] | java.util; org.cloudbus.cloudsim; | 123,753 |
public void removeListObjectSomeday(ListObject listObject) {
if (somedayEventList.contains(listObject)) {
somedayEventList.remove(listObject);
removeLoAssociatedCats(listObject);
this.notifyDataSetChanged();
}
} | void function(ListObject listObject) { if (somedayEventList.contains(listObject)) { somedayEventList.remove(listObject); removeLoAssociatedCats(listObject); this.notifyDataSetChanged(); } } | /**
* Remove a event from someday.
*
* @param listObject
* the listObject to remove
*/ | Remove a event from someday | removeListObjectSomeday | {
"repo_name": "simonjrp/ESCAPE",
"path": "ESCAPE/src/se/chalmers/dat255/group22/escape/adapters/CustomExpandableListAdapter.java",
"license": "gpl-3.0",
"size": 25615
} | [
"se.chalmers.dat255.group22.escape.objects.ListObject"
] | import se.chalmers.dat255.group22.escape.objects.ListObject; | import se.chalmers.dat255.group22.escape.objects.*; | [
"se.chalmers.dat255"
] | se.chalmers.dat255; | 1,706,121 |
@Override
public void looseMarshal(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException {
ProducerId info = (ProducerId) o;
super.looseMarshal(wireFormat, o, dataOut);
looseMarshalString(info.getConnectionId(), dataOut);
looseMarshalLong(wireFormat, info.getValue(), dataOut);
looseMarshalLong(wireFormat, info.getSessionId(), dataOut);
} | void function(OpenWireFormat wireFormat, Object o, DataOutput dataOut) throws IOException { ProducerId info = (ProducerId) o; super.looseMarshal(wireFormat, o, dataOut); looseMarshalString(info.getConnectionId(), dataOut); looseMarshalLong(wireFormat, info.getValue(), dataOut); looseMarshalLong(wireFormat, info.getSessionId(), dataOut); } | /**
* Write the booleans that this object uses to a BooleanStream
*/ | Write the booleans that this object uses to a BooleanStream | looseMarshal | {
"repo_name": "apache/activemq-openwire",
"path": "openwire-legacy/src/main/java/org/apache/activemq/openwire/codec/v2/ProducerIdMarshaller.java",
"license": "apache-2.0",
"size": 4804
} | [
"java.io.DataOutput",
"java.io.IOException",
"org.apache.activemq.openwire.codec.OpenWireFormat",
"org.apache.activemq.openwire.commands.ProducerId"
] | import java.io.DataOutput; import java.io.IOException; import org.apache.activemq.openwire.codec.OpenWireFormat; import org.apache.activemq.openwire.commands.ProducerId; | import java.io.*; import org.apache.activemq.openwire.codec.*; import org.apache.activemq.openwire.commands.*; | [
"java.io",
"org.apache.activemq"
] | java.io; org.apache.activemq; | 77,824 |
@Override
public FileObject getBaseTestFolder(final FileSystemManager manager) throws Exception {
String uri = getSystemTestUriOverride();
if (uri == null) {
uri = ConnectionUri;
}
return manager.resolveFile(uri);
} | FileObject function(final FileSystemManager manager) throws Exception { String uri = getSystemTestUriOverride(); if (uri == null) { uri = ConnectionUri; } return manager.resolveFile(uri); } | /**
* Returns the base folder for tests.
*/ | Returns the base folder for tests | getBaseTestFolder | {
"repo_name": "seeburger-ag/commons-vfs",
"path": "commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/test/UrlProviderHttpTestCase.java",
"license": "apache-2.0",
"size": 3709
} | [
"org.apache.commons.vfs2.FileObject",
"org.apache.commons.vfs2.FileSystemManager"
] | import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemManager; | import org.apache.commons.vfs2.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,874,346 |
public static SubmitAddEntryDistributionBuilder submitAdd(int id, boolean submitWhenReady) {
return new SubmitAddEntryDistributionBuilder(id, submitWhenReady);
}
public static class SubmitDeleteEntryDistributionBuilder extends RequestBuilder<EntryDistribution, EntryDistribution.Tokenizer, SubmitDeleteEntryDistributionBuilder> {
public SubmitDeleteEntryDistributionBuilder(int id) {
super(EntryDistribution.class, "contentdistribution_entrydistribution", "submitDelete");
params.add("id", id);
}
| static SubmitAddEntryDistributionBuilder function(int id, boolean submitWhenReady) { return new SubmitAddEntryDistributionBuilder(id, submitWhenReady); } public static class SubmitDeleteEntryDistributionBuilder extends RequestBuilder<EntryDistribution, EntryDistribution.Tokenizer, SubmitDeleteEntryDistributionBuilder> { public SubmitDeleteEntryDistributionBuilder(int id) { super(EntryDistribution.class, STR, STR); params.add("id", id); } | /**
* Submits Entry Distribution to the remote destination
*
* @param id
* @param submitWhenReady
*/ | Submits Entry Distribution to the remote destination | submitAdd | {
"repo_name": "kaltura/KalturaGeneratedAPIClientsJava",
"path": "src/main/java/com/kaltura/client/services/EntryDistributionService.java",
"license": "agpl-3.0",
"size": 11708
} | [
"com.kaltura.client.types.EntryDistribution",
"com.kaltura.client.utils.request.RequestBuilder"
] | import com.kaltura.client.types.EntryDistribution; import com.kaltura.client.utils.request.RequestBuilder; | import com.kaltura.client.types.*; import com.kaltura.client.utils.request.*; | [
"com.kaltura.client"
] | com.kaltura.client; | 1,881,483 |
public Collection<String> getMultiValues() {
if (isMultiValueSelected()) {
return ((PathConstraintMultiValue) con).getValues();
}
return null;
} | Collection<String> function() { if (isMultiValueSelected()) { return ((PathConstraintMultiValue) con).getValues(); } return null; } | /**
* Returns the value collection if the constraint is a multivalue, otherwise return null.
*
* @return a Collection of Strings
*/ | Returns the value collection if the constraint is a multivalue, otherwise return null | getMultiValues | {
"repo_name": "julie-sullivan/phytomine",
"path": "intermine/web/main/src/org/intermine/web/logic/query/DisplayConstraint.java",
"license": "lgpl-2.1",
"size": 33676
} | [
"java.util.Collection",
"org.intermine.pathquery.PathConstraintMultiValue"
] | import java.util.Collection; import org.intermine.pathquery.PathConstraintMultiValue; | import java.util.*; import org.intermine.pathquery.*; | [
"java.util",
"org.intermine.pathquery"
] | java.util; org.intermine.pathquery; | 353,315 |
public void getTenLatestEntries(
AsyncCallback<List<GuestbookEntryTransferObject>> async); | void function( AsyncCallback<List<GuestbookEntryTransferObject>> async); | /**
* Gets the ten latest guest entries from the data store.
*
* @param async the asynchronous callback to be invoked by the GWT RPC
* subsystem
*/ | Gets the ten latest guest entries from the data store | getTenLatestEntries | {
"repo_name": "googlearchive/appengine-gwtguestbook-namespaces-java",
"path": "src/com/google/gwt/sample/gwtguestbook/client/GuestServiceAsync.java",
"license": "apache-2.0",
"size": 1565
} | [
"com.google.gwt.user.client.rpc.AsyncCallback",
"java.util.List"
] | import com.google.gwt.user.client.rpc.AsyncCallback; import java.util.List; | import com.google.gwt.user.client.rpc.*; import java.util.*; | [
"com.google.gwt",
"java.util"
] | com.google.gwt; java.util; | 1,952,461 |
public void testLongChain3() {
FlowScope chainA = localEntry.createChildFlowScope();
FlowScope chainB = localEntry.createChildFlowScope();
for (int i = 0; i < LONG_CHAIN_LENGTH * 7; i++) {
if (i % 7 == 0) {
int j = i / 7;
localScope.declare("local" + j, null, null, null);
chainA.inferSlotType("local" + j,
j % 2 == 0 ? NUMBER_TYPE : BOOLEAN_TYPE);
chainB.inferSlotType("local" + j,
j % 3 == 0 ? STRING_TYPE : BOOLEAN_TYPE);
}
chainA = chainA.createChildFlowScope();
chainB = chainB.createChildFlowScope();
}
verifyLongChains(chainA, chainB);
} | void function() { FlowScope chainA = localEntry.createChildFlowScope(); FlowScope chainB = localEntry.createChildFlowScope(); for (int i = 0; i < LONG_CHAIN_LENGTH * 7; i++) { if (i % 7 == 0) { int j = i / 7; localScope.declare("local" + j, null, null, null); chainA.inferSlotType("local" + j, j % 2 == 0 ? NUMBER_TYPE : BOOLEAN_TYPE); chainB.inferSlotType("local" + j, j % 3 == 0 ? STRING_TYPE : BOOLEAN_TYPE); } chainA = chainA.createChildFlowScope(); chainB = chainB.createChildFlowScope(); } verifyLongChains(chainA, chainB); } | /**
* Create a long chain of flow scopes where every 4 links in the chain
* contain a slot.
*/ | Create a long chain of flow scopes where every 4 links in the chain contain a slot | testLongChain3 | {
"repo_name": "h4ck3rm1k3/javascript-closure-compiler-git",
"path": "test/com/google/javascript/jscomp/LinkedFlowScopeTest.java",
"license": "apache-2.0",
"size": 11050
} | [
"com.google.javascript.jscomp.type.FlowScope"
] | import com.google.javascript.jscomp.type.FlowScope; | import com.google.javascript.jscomp.type.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,595,248 |
public static void eachCombination(Iterable self, Closure<?> function) {
each(GroovyCollections.combinations(self), function);
} | static void function(Iterable self, Closure<?> function) { each(GroovyCollections.combinations(self), function); } | /**
* Applies a function on each combination of the input lists.
* <p>
* Example usage:
* <pre class="groovyTestCase">[[2, 3],[4, 5, 6]].eachCombination { println "Found $it" }</pre>
*
* @param self a Collection of lists
* @param function a closure to be called on each combination
* @see groovy.util.GroovyCollections#combinations(Iterable)
* @since 2.2.0
*/ | Applies a function on each combination of the input lists. Example usage: [[2, 3],[4, 5, 6]].eachCombination { println "Found $it" }</code> | eachCombination | {
"repo_name": "armsargis/groovy",
"path": "src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 698233
} | [
"groovy.lang.Closure",
"groovy.util.GroovyCollections"
] | import groovy.lang.Closure; import groovy.util.GroovyCollections; | import groovy.lang.*; import groovy.util.*; | [
"groovy.lang",
"groovy.util"
] | groovy.lang; groovy.util; | 2,497,034 |
private synchronized void processLine(String line, OnLineListener listener) {
if (listener != null) {
if (handler != null) {
final String fLine = line;
final OnLineListener fListener = listener; | synchronized void function(String line, OnLineListener listener) { if (listener != null) { if (handler != null) { final String fLine = line; final OnLineListener fListener = listener; | /**
* Process a normal STDOUT/STDERR line
*
* @param line Line to process
* @param listener Callback to call or null
*/ | Process a normal STDOUT/STDERR line | processLine | {
"repo_name": "ycdev-fork/libsuperuser",
"path": "libsuperuser/src/eu/chainfire/libsuperuser/Shell.java",
"license": "apache-2.0",
"size": 69442
} | [
"eu.chainfire.libsuperuser.StreamGobbler"
] | import eu.chainfire.libsuperuser.StreamGobbler; | import eu.chainfire.libsuperuser.*; | [
"eu.chainfire.libsuperuser"
] | eu.chainfire.libsuperuser; | 311,912 |
public boolean relinquishControl(MMCommand command) {
System.out.println(this + ": Relinquishing control from " + command + " if it's " + controllingCommand);
if (controllingCommand == command) {
takeControl(null);
return true;
}
return false;
} | boolean function(MMCommand command) { System.out.println(this + STR + command + STR + controllingCommand); if (controllingCommand == command) { takeControl(null); return true; } return false; } | /**
* Relinquish control of Subsystem, only of it was previously controlled by command. More specifically, will call
* takeControl(null), so Subsystems may override takeControl, and this method will obey that. Will not relinquish
* control if the subsystem is being controlled by the commands
* {@link MMCommand#parent parent}.
*
* @return If the subsystem was previously controlled by this command AND control has been relinquished
*/ | Relinquish control of Subsystem, only of it was previously controlled by command. More specifically, will call takeControl(null), so Subsystems may override takeControl, and this method will obey that. Will not relinquish control if the subsystem is being controlled by the commands <code>MMCommand#parent parent</code> | relinquishControl | {
"repo_name": "tupperkion/Steamworks",
"path": "src/main/java/com/midcoastmaineiacs/Steamworks/MMSubsystem.java",
"license": "mit",
"size": 4527
} | [
"com.midcoastmaineiacs.Steamworks"
] | import com.midcoastmaineiacs.Steamworks; | import com.midcoastmaineiacs.*; | [
"com.midcoastmaineiacs"
] | com.midcoastmaineiacs; | 249,710 |
public static final void wtf(final String tag, final String msg) {
Log.v(tag, getLinkedMessage(msg));
}
| static final void function(final String tag, final String msg) { Log.v(tag, getLinkedMessage(msg)); } | /**
* Send a {@link Log#VERBOSE} log message, linking to the line in the source
* code calling this method.
*
* @param tag
* Used to identify the source of a log message. It usually
* identifies the class or activity where the log call occurs.
* @param msg
* The message you would like logged.
*/ | Send a <code>Log#VERBOSE</code> log message, linking to the line in the source code calling this method | wtf | {
"repo_name": "Moderbord/Droidforce-UserInterface",
"path": "androidLib/src/main/java/fr/xgouchet/androidlib/common/LogUtils.java",
"license": "lgpl-2.1",
"size": 5975
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 763,919 |
public ArrayList<String> telephony_GET() throws IOException {
String qPath = "/order/telephony";
StringBuilder sb = path(qPath);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | ArrayList<String> function() throws IOException { String qPath = STR; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); } | /**
* List available services
*
* REST: GET /order/telephony
*/ | List available services | telephony_GET | {
"repo_name": "UrielCh/ovh-java-sdk",
"path": "ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java",
"license": "bsd-3-clause",
"size": 511080
} | [
"java.io.IOException",
"java.util.ArrayList"
] | import java.io.IOException; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,423,077 |
private static String createV2WikiURL(WikiPageKey key) {
ValidateArgument.required(key, "key");
return String.format(WIKI_ID_URI_TEMPLATE_V2, key.getOwnerObjectType()
.name().toLowerCase(), key.getOwnerObjectId(),
key.getWikiPageId());
} | static String function(WikiPageKey key) { ValidateArgument.required(key, "key"); return String.format(WIKI_ID_URI_TEMPLATE_V2, key.getOwnerObjectType() .name().toLowerCase(), key.getOwnerObjectId(), key.getWikiPageId()); } | /**
* Helper to build a URL for a V2 Wiki page, with ID
*
* @param key
* @return
*/ | Helper to build a URL for a V2 Wiki page, with ID | createV2WikiURL | {
"repo_name": "zimingd/Synapse-Repository-Services",
"path": "client/synapseJavaClient/src/main/java/org/sagebionetworks/client/SynapseClientImpl.java",
"license": "apache-2.0",
"size": 229293
} | [
"org.sagebionetworks.repo.model.dao.WikiPageKey",
"org.sagebionetworks.util.ValidateArgument"
] | import org.sagebionetworks.repo.model.dao.WikiPageKey; import org.sagebionetworks.util.ValidateArgument; | import org.sagebionetworks.repo.model.dao.*; import org.sagebionetworks.util.*; | [
"org.sagebionetworks.repo",
"org.sagebionetworks.util"
] | org.sagebionetworks.repo; org.sagebionetworks.util; | 698,385 |
synchronized (mLock) {
if (mSensor == null) {
Log.w(TAG, "Cannot detect sensors. Not enabled");
return;
}
if (mEnabled == false) {
if (LOG) {
Log.d(TAG, "WindowOrientationListener enabled");
}
mSensorEventListener.resetLocked();
mSensorManager.registerListener(mSensorEventListener, mSensor, mRate, mHandler);
mEnabled = true;
}
}
} | synchronized (mLock) { if (mSensor == null) { Log.w(TAG, STR); return; } if (mEnabled == false) { if (LOG) { Log.d(TAG, STR); } mSensorEventListener.resetLocked(); mSensorManager.registerListener(mSensorEventListener, mSensor, mRate, mHandler); mEnabled = true; } } } | /**
* Enables the WindowOrientationListener so it will monitor the sensor and call
* {@link #onProposedRotationChanged(int)} when the device orientation changes.
*/ | Enables the WindowOrientationListener so it will monitor the sensor and call <code>#onProposedRotationChanged(int)</code> when the device orientation changes | enable | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/internal/policy/impl/WindowOrientationListener.java",
"license": "apache-2.0",
"size": 34657
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,170,739 |
public static Class getCollectionReturnType(Method method) {
return getGenericReturnType(method, Collection.class, 0, 1);
} | static Class function(Method method) { return getGenericReturnType(method, Collection.class, 0, 1); } | /**
* Determine the generic element type of the given Collection return type.
* @param method the method to check the return type for
* @return the generic type, or <code>null</code> if none
*/ | Determine the generic element type of the given Collection return type | getCollectionReturnType | {
"repo_name": "cbeams-archive/spring-framework-2.5.x",
"path": "src/org/springframework/core/GenericCollectionTypeResolver.java",
"license": "apache-2.0",
"size": 17219
} | [
"java.lang.reflect.Method",
"java.util.Collection"
] | import java.lang.reflect.Method; import java.util.Collection; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 1,937,964 |
private boolean tryRelocateShard(ModelNode minNode, ModelNode maxNode, String idx) {
final ModelIndex index = maxNode.getIndex(idx);
if (index != null) {
logger.trace("Try relocating shard of [{}] from [{}] to [{}]", idx, maxNode.getNodeId(), minNode.getNodeId());
final Iterable<ShardRouting> shardRoutings = StreamSupport.stream(index.spliterator(), false)
.filter(ShardRouting::started) // cannot rebalance unassigned, initializing or relocating shards anyway
.filter(maxNode::containsShard)
.sorted(BY_DESCENDING_SHARD_ID) // check in descending order of shard id so that the decision is deterministic
::iterator;
final AllocationDeciders deciders = allocation.deciders();
for (ShardRouting shard : shardRoutings) {
final Decision rebalanceDecision = deciders.canRebalance(shard, allocation);
if (rebalanceDecision.type() == Type.NO) {
continue;
}
final Decision allocationDecision = deciders.canAllocate(shard, minNode.getRoutingNode(), allocation);
if (allocationDecision.type() == Type.NO) {
continue;
}
final Decision decision = new Decision.Multi().add(allocationDecision).add(rebalanceDecision);
maxNode.removeShard(shard);
long shardSize = allocation.clusterInfo().getShardSize(shard, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE);
if (decision.type() == Type.YES) {
logger.debug("Relocate [{}] from [{}] to [{}]", shard, maxNode.getNodeId(), minNode.getNodeId());
minNode.addShard(routingNodes.relocateShard(shard, minNode.getNodeId(), shardSize, allocation.changes()).v1());
return true;
} else {
logger.debug("Simulate relocation of [{}] from [{}] to [{}]", shard, maxNode.getNodeId(), minNode.getNodeId());
assert decision.type() == Type.THROTTLE;
minNode.addShard(shard.relocate(minNode.getNodeId(), shardSize));
return false;
}
}
}
logger.trace("No shards of [{}] can relocate from [{}] to [{}]", idx, maxNode.getNodeId(), minNode.getNodeId());
return false;
}
}
static class ModelNode implements Iterable<ModelIndex> {
private final Map<String, ModelIndex> indices = new HashMap<>();
private int numShards = 0;
private final RoutingNode routingNode;
ModelNode(RoutingNode routingNode) {
this.routingNode = routingNode;
} | boolean function(ModelNode minNode, ModelNode maxNode, String idx) { final ModelIndex index = maxNode.getIndex(idx); if (index != null) { logger.trace(STR, idx, maxNode.getNodeId(), minNode.getNodeId()); final Iterable<ShardRouting> shardRoutings = StreamSupport.stream(index.spliterator(), false) .filter(ShardRouting::started) .filter(maxNode::containsShard) .sorted(BY_DESCENDING_SHARD_ID) ::iterator; final AllocationDeciders deciders = allocation.deciders(); for (ShardRouting shard : shardRoutings) { final Decision rebalanceDecision = deciders.canRebalance(shard, allocation); if (rebalanceDecision.type() == Type.NO) { continue; } final Decision allocationDecision = deciders.canAllocate(shard, minNode.getRoutingNode(), allocation); if (allocationDecision.type() == Type.NO) { continue; } final Decision decision = new Decision.Multi().add(allocationDecision).add(rebalanceDecision); maxNode.removeShard(shard); long shardSize = allocation.clusterInfo().getShardSize(shard, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE); if (decision.type() == Type.YES) { logger.debug(STR, shard, maxNode.getNodeId(), minNode.getNodeId()); minNode.addShard(routingNodes.relocateShard(shard, minNode.getNodeId(), shardSize, allocation.changes()).v1()); return true; } else { logger.debug(STR, shard, maxNode.getNodeId(), minNode.getNodeId()); assert decision.type() == Type.THROTTLE; minNode.addShard(shard.relocate(minNode.getNodeId(), shardSize)); return false; } } } logger.trace(STR, idx, maxNode.getNodeId(), minNode.getNodeId()); return false; } } static class ModelNode implements Iterable<ModelIndex> { private final Map<String, ModelIndex> indices = new HashMap<>(); private int numShards = 0; private final RoutingNode routingNode; ModelNode(RoutingNode routingNode) { this.routingNode = routingNode; } | /**
* Tries to find a relocation from the max node to the minimal node for an arbitrary shard of the given index on the
* balance model. Iff this method returns a <code>true</code> the relocation has already been executed on the
* simulation model as well as on the cluster.
*/ | Tries to find a relocation from the max node to the minimal node for an arbitrary shard of the given index on the balance model. Iff this method returns a <code>true</code> the relocation has already been executed on the simulation model as well as on the cluster | tryRelocateShard | {
"repo_name": "HonzaKral/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/cluster/routing/allocation/allocator/BalancedShardsAllocator.java",
"license": "apache-2.0",
"size": 63579
} | [
"java.util.HashMap",
"java.util.Map",
"java.util.stream.StreamSupport",
"org.elasticsearch.cluster.routing.RoutingNode",
"org.elasticsearch.cluster.routing.ShardRouting",
"org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders",
"org.elasticsearch.cluster.routing.allocation.decider.Deci... | import java.util.HashMap; import java.util.Map; import java.util.stream.StreamSupport; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.cluster.routing.allocation.decider.Decision; | import java.util.*; import java.util.stream.*; import org.elasticsearch.cluster.routing.*; import org.elasticsearch.cluster.routing.allocation.decider.*; | [
"java.util",
"org.elasticsearch.cluster"
] | java.util; org.elasticsearch.cluster; | 1,391,696 |
public void testRegionIdleInvalidate()
throws InterruptedException, CacheException {
if (getRegionAttributes().getPartitionAttributes() != null) {
// PR does not support INVALID ExpirationAction
return;
}
final String name = this.getUniqueName();
final String subname = this.getUniqueName() + "-SUB";
final int timeout = 22; // ms
final Object key = "KEY";
final Object value = "VALUE";
| void function() throws InterruptedException, CacheException { if (getRegionAttributes().getPartitionAttributes() != null) { return; } final String name = this.getUniqueName(); final String subname = this.getUniqueName() + "-SUB"; final int timeout = 22; final Object key = "KEY"; final Object value = "VALUE"; | /**
* Tests that a region that remains idle for a given amount of
* time is invalidated. Also tests that accessing an entry of a
* region or a subregion counts as an access.
*/ | Tests that a region that remains idle for a given amount of time is invalidated. Also tests that accessing an entry of a region or a subregion counts as an access | testRegionIdleInvalidate | {
"repo_name": "nchandrappa/incubator-geode",
"path": "gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java",
"license": "apache-2.0",
"size": 127762
} | [
"com.gemstone.gemfire.cache.CacheException"
] | import com.gemstone.gemfire.cache.CacheException; | import com.gemstone.gemfire.cache.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 1,335,960 |
@Override
protected boolean isEnabled(Level level, Marker marker, String data, Throwable t) {
return this.jul.isLoggable(Util.levelToJUL(level));
} | boolean function(Level level, Marker marker, String data, Throwable t) { return this.jul.isLoggable(Util.levelToJUL(level)); } | /**
* Determine if logging is enabled for the specified level.
*
* @param level the logging Level to check.
* @param marker a Marker, not checked
* @param data the Message, not checked
* @param t a Throwable, not checked
* @return true if logging is enabled, false otherwise
*/ | Determine if logging is enabled for the specified level | isEnabled | {
"repo_name": "Wolf480pl/log4j2-to-jul",
"path": "src/main/java/com/github/wolf480pl/log4j2_to_jul/context/JULLogger.java",
"license": "mit",
"size": 10500
} | [
"com.github.wolf480pl.log4j2_to_jul.Util",
"org.apache.logging.log4j.Level",
"org.apache.logging.log4j.Marker"
] | import com.github.wolf480pl.log4j2_to_jul.Util; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Marker; | import com.github.wolf480pl.log4j2_to_jul.*; import org.apache.logging.log4j.*; | [
"com.github.wolf480pl",
"org.apache.logging"
] | com.github.wolf480pl; org.apache.logging; | 2,768,625 |
return Generics.getTypeParameter(getClass(), Configuration.class);
} | return Generics.getTypeParameter(getClass(), Configuration.class); } | /**
* Returns the {@link Class} of the configuration type.
*
* @return the {@link Class} of the configuration type
*/ | Returns the <code>Class</code> of the configuration type | getConfigurationClass | {
"repo_name": "AnuchitPrasertsang/dropwizard",
"path": "dropwizard-core/src/main/java/io/dropwizard/cli/ConfiguredCommand.java",
"license": "apache-2.0",
"size": 4575
} | [
"io.dropwizard.Configuration",
"io.dropwizard.util.Generics"
] | import io.dropwizard.Configuration; import io.dropwizard.util.Generics; | import io.dropwizard.*; import io.dropwizard.util.*; | [
"io.dropwizard",
"io.dropwizard.util"
] | io.dropwizard; io.dropwizard.util; | 1,426,832 |
private static <T> boolean pointIsInActualBounds(JList<T> list, int index,
Point point) {
ListCellRenderer<? super T> renderer = list.getCellRenderer();
T value = list.getModel().getElementAt(index);
Component item = renderer.getListCellRendererComponent(list,
value, index, false, false);
Dimension itemSize = item.getPreferredSize();
Rectangle cellBounds = list.getCellBounds(index, index);
if (!item.getComponentOrientation().isLeftToRight()) {
cellBounds.x += (cellBounds.width - itemSize.width);
}
cellBounds.width = itemSize.width;
return cellBounds.contains(point);
} | static <T> boolean function(JList<T> list, int index, Point point) { ListCellRenderer<? super T> renderer = list.getCellRenderer(); T value = list.getModel().getElementAt(index); Component item = renderer.getListCellRendererComponent(list, value, index, false, false); Dimension itemSize = item.getPreferredSize(); Rectangle cellBounds = list.getCellBounds(index, index); if (!item.getComponentOrientation().isLeftToRight()) { cellBounds.x += (cellBounds.width - itemSize.width); } cellBounds.width = itemSize.width; return cellBounds.contains(point); } | /**
* Returns true if the given point is within the actual bounds of the
* JList item at index (not just inside the cell).
*/ | Returns true if the given point is within the actual bounds of the JList item at index (not just inside the cell) | pointIsInActualBounds | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/sun/swing/SwingUtilities2.java",
"license": "apache-2.0",
"size": 89457
} | [
"java.awt.Component",
"java.awt.Dimension",
"java.awt.Point",
"java.awt.Rectangle",
"javax.swing.JList",
"javax.swing.ListCellRenderer"
] | import java.awt.Component; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; import javax.swing.JList; import javax.swing.ListCellRenderer; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 2,537,564 |
public Optional<Text> getDisplayName() {
return Optional.ofNullable(displayname);
}
private Text displayname = null; | Optional<Text> function() { return Optional.ofNullable(displayname); } private Text displayname = null; | /**
* Return the textual displayname of the player
*/ | Return the textual displayname of the player | getDisplayName | {
"repo_name": "Wundero/Ray",
"path": "src/main/java/me/Wundero/Ray/framework/player/RayPlayer.java",
"license": "mit",
"size": 12192
} | [
"java.util.Optional",
"org.spongepowered.api.text.Text"
] | import java.util.Optional; import org.spongepowered.api.text.Text; | import java.util.*; import org.spongepowered.api.text.*; | [
"java.util",
"org.spongepowered.api"
] | java.util; org.spongepowered.api; | 2,219,949 |
public void addAminoAcidSequence(String sequence) {
addAnnotation(new Annotation<>(AnnotationType.AMINO_ACID_SEQUENCE, sequence));
} | void function(String sequence) { addAnnotation(new Annotation<>(AnnotationType.AMINO_ACID_SEQUENCE, sequence)); } | /**
* Adds an amino acid sequence as an annotation.
*
* @param sequence The amino acid sequence.
*/ | Adds an amino acid sequence as an annotation | addAminoAcidSequence | {
"repo_name": "cleberecht/singa",
"path": "singa-chemistry/src/main/java/bio/singa/chemistry/model/Protein.java",
"license": "gpl-3.0",
"size": 5734
} | [
"bio.singa.chemistry.annotations.Annotation",
"bio.singa.chemistry.annotations.AnnotationType"
] | import bio.singa.chemistry.annotations.Annotation; import bio.singa.chemistry.annotations.AnnotationType; | import bio.singa.chemistry.annotations.*; | [
"bio.singa.chemistry"
] | bio.singa.chemistry; | 951,083 |
protected void filterApply(String columnId, List<Interval> intervalList) {
if (!displayerSettings.isFilterEnabled()) return;
// For string column filters, init the group interval selection operation.
DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);
groupOp.setSelectedIntervalList(intervalList);
// Notify to those interested parties the selection event.
if (displayerSettings.isFilterNotificationEnabled()) {
for (DisplayerListener listener : listenerList) {
listener.onFilterEnabled(this, groupOp);
}
}
// Drill-down support
if (displayerSettings.isFilterSelfApplyEnabled()) {
dataSetHandler.drillDown(groupOp);
redraw();
}
} | void function(String columnId, List<Interval> intervalList) { if (!displayerSettings.isFilterEnabled()) return; DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId); groupOp.setSelectedIntervalList(intervalList); if (displayerSettings.isFilterNotificationEnabled()) { for (DisplayerListener listener : listenerList) { listener.onFilterEnabled(this, groupOp); } } if (displayerSettings.isFilterSelfApplyEnabled()) { dataSetHandler.drillDown(groupOp); redraw(); } } | /**
* Filter the values of the given column.
*
* @param columnId The name of the column to filter.
* @param intervalList A list of interval selections to filter for.
*/ | Filter the values of the given column | filterApply | {
"repo_name": "cristianonicolai/dashbuilder",
"path": "dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractDisplayer.java",
"license": "apache-2.0",
"size": 21074
} | [
"java.util.List",
"org.dashbuilder.dataset.group.DataSetGroup",
"org.dashbuilder.dataset.group.Interval"
] | import java.util.List; import org.dashbuilder.dataset.group.DataSetGroup; import org.dashbuilder.dataset.group.Interval; | import java.util.*; import org.dashbuilder.dataset.group.*; | [
"java.util",
"org.dashbuilder.dataset"
] | java.util; org.dashbuilder.dataset; | 906,305 |
MockEndpoint result = getMockEndpoint("mock:result");
result.expectedMessageCount(1); | MockEndpoint result = getMockEndpoint(STR); result.expectedMessageCount(1); | /**
* When the setting useMessageIdAsCorrelationid is false and
* a correlation id is set on the message then we expect the reply
* to contain the same correlation id.
*/ | When the setting useMessageIdAsCorrelationid is false and a correlation id is set on the message then we expect the reply to contain the same correlation id | testRequestReplyCorrelationByGivenCorrelationId | {
"repo_name": "kevinearls/camel",
"path": "components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRequestReplyCorrelationTest.java",
"license": "apache-2.0",
"size": 11005
} | [
"org.apache.camel.component.mock.MockEndpoint"
] | import org.apache.camel.component.mock.MockEndpoint; | import org.apache.camel.component.mock.*; | [
"org.apache.camel"
] | org.apache.camel; | 399,918 |
public Destination getJMSReplyTo() throws JMSException
{
if (ActiveMQRAMessage.trace)
{
ActiveMQRALogger.LOGGER.trace("getJMSReplyTo()");
}
return message.getJMSReplyTo();
} | Destination function() throws JMSException { if (ActiveMQRAMessage.trace) { ActiveMQRALogger.LOGGER.trace(STR); } return message.getJMSReplyTo(); } | /**
* Get reply to destination
*
* @return The value
* @throws JMSException Thrown if an error occurs
*/ | Get reply to destination | getJMSReplyTo | {
"repo_name": "jbertram/activemq-artemis-old",
"path": "artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAMessage.java",
"license": "apache-2.0",
"size": 21155
} | [
"javax.jms.Destination",
"javax.jms.JMSException"
] | import javax.jms.Destination; import javax.jms.JMSException; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 1,917,935 |
void updateWith(@Nullable PaymentDetails details) {
if (mBrowserPaymentRequest == null) return;
if (mIsShowWaitingForUpdatedDetails) {
// Under this condition, updateWith() is called in response to the resolution of
// show()'s PaymentDetailsUpdate promise.
String error = continueShowWithUpdatedDetails(details);
if (error != null) {
onShowFailed(error);
return;
}
return;
}
if (!mIsShowCalled) {
mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER);
disconnectFromClientWithDebugMessage(
ErrorStrings.CANNOT_UPDATE_WITHOUT_SHOW, PaymentErrorReason.USER_CANCEL);
return;
}
boolean hasNotifiedInvokedPaymentApp =
mInvokedPaymentApp != null && mInvokedPaymentApp.isWaitingForPaymentDetailsUpdate();
if (!PaymentOptionsUtils.requestAnyInformation(mPaymentOptions)
&& !hasNotifiedInvokedPaymentApp) {
mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER);
disconnectFromClientWithDebugMessage(
ErrorStrings.INVALID_STATE, PaymentErrorReason.USER_CANCEL);
return;
}
if (details == null || !isPaymentDetailsUpdateValid(details)) {
mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER);
disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS,
PaymentErrorReason.INVALID_DATA_FROM_RENDERER);
return;
}
mSpec.updateWith(details);
if (hasNotifiedInvokedPaymentApp) {
// After a payment app has been invoked, all of the merchant's calls to update the price
// via updateWith() should be forwarded to the invoked app, so it can reflect the
// updated price in its UI.
mInvokedPaymentApp.updateWith(
PaymentDetailsConverter.convertToPaymentRequestDetailsUpdate(details,
this, mInvokedPaymentApp));
}
mBrowserPaymentRequest.onPaymentDetailsUpdated(
mSpec.getPaymentDetails(), hasNotifiedInvokedPaymentApp);
} | void updateWith(@Nullable PaymentDetails details) { if (mBrowserPaymentRequest == null) return; if (mIsShowWaitingForUpdatedDetails) { String error = continueShowWithUpdatedDetails(details); if (error != null) { onShowFailed(error); return; } return; } if (!mIsShowCalled) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); disconnectFromClientWithDebugMessage( ErrorStrings.CANNOT_UPDATE_WITHOUT_SHOW, PaymentErrorReason.USER_CANCEL); return; } boolean hasNotifiedInvokedPaymentApp = mInvokedPaymentApp != null && mInvokedPaymentApp.isWaitingForPaymentDetailsUpdate(); if (!PaymentOptionsUtils.requestAnyInformation(mPaymentOptions) && !hasNotifiedInvokedPaymentApp) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); disconnectFromClientWithDebugMessage( ErrorStrings.INVALID_STATE, PaymentErrorReason.USER_CANCEL); return; } if (details == null !isPaymentDetailsUpdateValid(details)) { mJourneyLogger.setAborted(AbortReason.INVALID_DATA_FROM_RENDERER); disconnectFromClientWithDebugMessage(ErrorStrings.INVALID_PAYMENT_DETAILS, PaymentErrorReason.INVALID_DATA_FROM_RENDERER); return; } mSpec.updateWith(details); if (hasNotifiedInvokedPaymentApp) { mInvokedPaymentApp.updateWith( PaymentDetailsConverter.convertToPaymentRequestDetailsUpdate(details, this, mInvokedPaymentApp)); } mBrowserPaymentRequest.onPaymentDetailsUpdated( mSpec.getPaymentDetails(), hasNotifiedInvokedPaymentApp); } | /**
* The component part of the {@link PaymentRequest#updateWith} implementation.
* @param details The details that the merchant provides to update the payment request, can be
* null.
*/ | The component part of the <code>PaymentRequest#updateWith</code> implementation | updateWith | {
"repo_name": "scheib/chromium",
"path": "components/payments/content/android/java/src/org/chromium/components/payments/PaymentRequestService.java",
"license": "bsd-3-clause",
"size": 80595
} | [
"androidx.annotation.Nullable",
"org.chromium.payments.mojom.PaymentDetails",
"org.chromium.payments.mojom.PaymentErrorReason"
] | import androidx.annotation.Nullable; import org.chromium.payments.mojom.PaymentDetails; import org.chromium.payments.mojom.PaymentErrorReason; | import androidx.annotation.*; import org.chromium.payments.mojom.*; | [
"androidx.annotation",
"org.chromium.payments"
] | androidx.annotation; org.chromium.payments; | 2,761,249 |
protected SVGItem initializeImpl(Object newItem)
throws DOMException, SVGException {
checkItemType(newItem);
// Clear the list, creating it if it doesn't exist yet.
if (itemList == null) {
itemList = new ArrayList(1);
} else {
clear(itemList);
}
SVGItem item = removeIfNeeded(newItem);
// Add the item.
itemList.add(item);
// Set the item's parent.
item.setParent(this);
// Update the DOM attribute.
resetAttribute();
return item;
} | SVGItem function(Object newItem) throws DOMException, SVGException { checkItemType(newItem); if (itemList == null) { itemList = new ArrayList(1); } else { clear(itemList); } SVGItem item = removeIfNeeded(newItem); itemList.add(item); item.setParent(this); resetAttribute(); return item; } | /**
* Removes all items from the list and adds the specified item to
* the list.
*
* @param newItem the item which should become the only member of the list.
* @return the item being inserted into the list.
* @exception DOMException NO_MODIFICATION_ALLOWED_ERR:
* Raised when the list cannot be modified.
* @exception SVGException SVG_WRONG_TYPE_ERR:
* Raised if parameter newItem is the wrong type of object for the given
* list.
*/ | Removes all items from the list and adds the specified item to the list | initializeImpl | {
"repo_name": "apache/batik",
"path": "batik-svg-dom/src/main/java/org/apache/batik/dom/svg/AbstractSVGList.java",
"license": "apache-2.0",
"size": 15338
} | [
"java.util.ArrayList",
"org.w3c.dom.DOMException",
"org.w3c.dom.svg.SVGException"
] | import java.util.ArrayList; import org.w3c.dom.DOMException; import org.w3c.dom.svg.SVGException; | import java.util.*; import org.w3c.dom.*; import org.w3c.dom.svg.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 1,801,951 |
public static UnassignRegionRequest buildUnassignRegionRequest(
final byte [] regionName, final boolean force) {
UnassignRegionRequest.Builder builder = UnassignRegionRequest.newBuilder();
builder.setRegion(buildRegionSpecifier(RegionSpecifierType.REGION_NAME,regionName));
builder.setForce(force);
return builder.build();
} | static UnassignRegionRequest function( final byte [] regionName, final boolean force) { UnassignRegionRequest.Builder builder = UnassignRegionRequest.newBuilder(); builder.setRegion(buildRegionSpecifier(RegionSpecifierType.REGION_NAME,regionName)); builder.setForce(force); return builder.build(); } | /**
* Creates a protocol buffer UnassignRegionRequest
*
* @param regionName
* @param force
* @return an UnassignRegionRequest
*/ | Creates a protocol buffer UnassignRegionRequest | buildUnassignRegionRequest | {
"repo_name": "lshmouse/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/RequestConverter.java",
"license": "apache-2.0",
"size": 65486
} | [
"org.apache.hadoop.hbase.protobuf.generated.HBaseProtos",
"org.apache.hadoop.hbase.protobuf.generated.MasterProtos"
] | import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; import org.apache.hadoop.hbase.protobuf.generated.MasterProtos; | import org.apache.hadoop.hbase.protobuf.generated.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 83,648 |
public boolean isLeftToRight() {
aci.first();
int bidiLevel =
((Integer)aci.getAttribute
(GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL))
.intValue();
// Check if low bit is set if not then we are left to right
// (even bidi level).
return ((bidiLevel&0x01) == 0);
} | boolean function() { aci.first(); int bidiLevel = ((Integer)aci.getAttribute (GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL)) .intValue(); return ((bidiLevel&0x01) == 0); } | /**
* Returns true if the text direction in this layout is from left to right.
*/ | Returns true if the text direction in this layout is from left to right | isLeftToRight | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/gvt/text/GlyphLayout.java",
"license": "apache-2.0",
"size": 79479
} | [
"java.awt.font.TextAttribute"
] | import java.awt.font.TextAttribute; | import java.awt.font.*; | [
"java.awt"
] | java.awt; | 1,892,770 |
public Api getPluginApi(XWikiPluginInterface plugin, XWikiContext context) {
return new CurrikiActivityStreamPluginApi((CurrikiActivityStreamPlugin) plugin, context);
} | Api function(XWikiPluginInterface plugin, XWikiContext context) { return new CurrikiActivityStreamPluginApi((CurrikiActivityStreamPlugin) plugin, context); } | /**
* Gets the activity plugin Api
* @param plugin The plugin interface
* @param context Xwiki context
* @return
*/ | Gets the activity plugin Api | getPluginApi | {
"repo_name": "xwiki-contrib/currikiorg",
"path": "plugins/currikiactivitystream/src/main/java/org/curriki/plugin/activitystream/plugin/CurrikiActivityStreamPlugin.java",
"license": "lgpl-2.1",
"size": 2184
} | [
"com.xpn.xwiki.XWikiContext",
"com.xpn.xwiki.api.Api",
"com.xpn.xwiki.plugin.XWikiPluginInterface"
] | import com.xpn.xwiki.XWikiContext; import com.xpn.xwiki.api.Api; import com.xpn.xwiki.plugin.XWikiPluginInterface; | import com.xpn.xwiki.*; import com.xpn.xwiki.api.*; import com.xpn.xwiki.plugin.*; | [
"com.xpn.xwiki"
] | com.xpn.xwiki; | 1,650,878 |
private void decodeParms( String parms, Properties p )
throws InterruptedException
{
if ( parms == null )
return;
StringTokenizer st = new StringTokenizer( parms, "&" );
while ( st.hasMoreTokens())
{
String e = st.nextToken();
int sep = e.indexOf( '=' );
if ( sep >= 0 )
p.put( decodePercent( e.substring( 0, sep )).trim().toLowerCase(),
decodePercent( e.substring( sep+1 )));
}
} | void function( String parms, Properties p ) throws InterruptedException { if ( parms == null ) return; StringTokenizer st = new StringTokenizer( parms, "&" ); while ( st.hasMoreTokens()) { String e = st.nextToken(); int sep = e.indexOf( '=' ); if ( sep >= 0 ) p.put( decodePercent( e.substring( 0, sep )).trim().toLowerCase(), decodePercent( e.substring( sep+1 ))); } } | /**
* Decodes parameters in percent-encoded URI-format
* ( e.g. "name=Jack%20Daniels&pass=Single%20Malt" ) and
* adds them to given Properties. NOTE: this doesn't support multiple
* identical keys due to the simplicity of Properties -- if you need multiples,
* you might want to replace the Properties with a Hashtable of Vectors or such.
*/ | Decodes parameters in percent-encoded URI-format ( e.g. "name=Jack%20Daniels&pass=Single%20Malt" ) and identical keys due to the simplicity of Properties -- if you need multiples, you might want to replace the Properties with a Hashtable of Vectors or such | decodeParms | {
"repo_name": "jeo/jeo",
"path": "contrib/nano/src/main/java/io/jeo/nano/NanoHTTPD.java",
"license": "apache-2.0",
"size": 39958
} | [
"java.util.Properties",
"java.util.StringTokenizer"
] | import java.util.Properties; import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 2,464,474 |
void setInputFromSavedData() {
if (0 >= userBufLen) {
return;
}
finished = false;
uncompressedDirectBufLen = Math.min(userBufLen, directBufferSize);
((ByteBuffer) uncompressedDirectBuf).put(userBuf, userBufOff,
uncompressedDirectBufLen);
// Note how much data is being fed to snappy
userBufOff += uncompressedDirectBufLen;
userBufLen -= uncompressedDirectBufLen;
} | void setInputFromSavedData() { if (0 >= userBufLen) { return; } finished = false; uncompressedDirectBufLen = Math.min(userBufLen, directBufferSize); ((ByteBuffer) uncompressedDirectBuf).put(userBuf, userBufOff, uncompressedDirectBufLen); userBufOff += uncompressedDirectBufLen; userBufLen -= uncompressedDirectBufLen; } | /**
* If a write would exceed the capacity of the direct buffers, it is set
* aside to be loaded by this function while the compressed data are
* consumed.
*/ | If a write would exceed the capacity of the direct buffers, it is set aside to be loaded by this function while the compressed data are consumed | setInputFromSavedData | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/snappy/SnappyCompressor.java",
"license": "apache-2.0",
"size": 8276
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 366,047 |
protected void fillMetadataPass3(MetadataStore store) throws FormatException, IOException {
} | void function(MetadataStore store) throws FormatException, IOException { } | /**
* Read and store basic dimensions in model
* @param store
* @throws FormatException
* @throws IOException
*/ | Read and store basic dimensions in model | fillMetadataPass3 | {
"repo_name": "Intelligent-Imaging/bioformats",
"path": "components/formats-gpl/src/loci/formats/in/BaseZeissReader.java",
"license": "gpl-2.0",
"size": 88639
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,383,064 |
public static org.opennms.netmgt.config.views.Member unmarshal(
final java.io.Reader reader)
throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException {
return (org.opennms.netmgt.config.views.Member) Unmarshaller.unmarshal(org.opennms.netmgt.config.views.Member.class, reader);
} | static org.opennms.netmgt.config.views.Member function( final java.io.Reader reader) throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException { return (org.opennms.netmgt.config.views.Member) Unmarshaller.unmarshal(org.opennms.netmgt.config.views.Member.class, reader); } | /**
* Method unmarshal.
*
* @param reader
* @throws org.exolab.castor.xml.MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws org.exolab.castor.xml.ValidationException if this
* object is an invalid instance according to the schema
* @return the unmarshaled org.opennms.netmgt.config.views.Membe
*/ | Method unmarshal | unmarshal | {
"repo_name": "vishwaAbhinav/OpenNMS",
"path": "opennms-config/target/generated-sources/castor/org/opennms/netmgt/config/views/Member.java",
"license": "gpl-2.0",
"size": 6154
} | [
"org.exolab.castor.xml.Unmarshaller"
] | import org.exolab.castor.xml.Unmarshaller; | import org.exolab.castor.xml.*; | [
"org.exolab.castor"
] | org.exolab.castor; | 1,387,685 |
Executions<Set<V>> smembers(K key); | Executions<Set<V>> smembers(K key); | /**
* Get all the members in a set.
*
* @param key the key
* @return Set<V> array-reply all elements of the set.
*/ | Get all the members in a set | smembers | {
"repo_name": "mp911de/lettuce",
"path": "src/main/java/io/lettuce/core/cluster/api/sync/NodeSelectionSetCommands.java",
"license": "apache-2.0",
"size": 10150
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,671,327 |
public void setOverlays(List<Overlay> overlays, Overlay activeOverlay,
final ImagePlus imp)
{
final Roi roi = createRoi(activeOverlay);
final ij.gui.Overlay o = createIJ1Overlay(overlays, activeOverlay);
imp.setRoi(roi);
imp.setOverlay(o);
// TODO: do the rois in the IJ1 Overlay belong in the manager? In IJ1 if you
// load a file that has a saved overlay it does not auto fill into Roi Mgr.
// However when you select ROIs in Mgr and run Overlay > From ROI Manager
// the rois go into the overlay and stay in the Roi Mgr. Decide later.
// NB 4-18-13 - BDZ and CTR discussed and we'd eventually like to translate
// all overlays into the ROI Manager and not translate any ROIs into the
// Overlay of any ImagePlus. Haven't yet thought this through.
}
// -- Helper methods - legacy Roi creation -- | void function(List<Overlay> overlays, Overlay activeOverlay, final ImagePlus imp) { final Roi roi = createRoi(activeOverlay); final ij.gui.Overlay o = createIJ1Overlay(overlays, activeOverlay); imp.setRoi(roi); imp.setOverlay(o); } | /**
* Assigns a list of {@link Overlay}s to the given {@link ImagePlus}. The
* active overlay becomes the {@link Roi} of the ImagePlus. The other overlays
* become Roi's in the Overlay of the ImagePlus. Also populates legacy
* ImageJ's RoiManager.
*/ | Assigns a list of <code>Overlay</code>s to the given <code>ImagePlus</code>. The active overlay becomes the <code>Roi</code> of the ImagePlus. The other overlays become Roi's in the Overlay of the ImagePlus. Also populates legacy ImageJ's RoiManager | setOverlays | {
"repo_name": "imagej/imagej-legacy",
"path": "src/main/java/net/imagej/legacy/translate/OverlayHarmonizer.java",
"license": "bsd-2-clause",
"size": 27042
} | [
"java.util.List",
"net.imagej.overlay.Overlay"
] | import java.util.List; import net.imagej.overlay.Overlay; | import java.util.*; import net.imagej.overlay.*; | [
"java.util",
"net.imagej.overlay"
] | java.util; net.imagej.overlay; | 103,081 |
protected Packet nextReceivedPacket(boolean remove) {
if (remove) {
return remainingPackets.poll();
} else {
return remainingPackets.peek();
}
} | Packet function(boolean remove) { if (remove) { return remainingPackets.poll(); } else { return remainingPackets.peek(); } } | /**
* Returns the packet which should be processed next.
*
* @param remove True if the returned packet should be removed from the queue.
* @return The packet which should be processed next.
*/ | Returns the packet which should be processed next | nextReceivedPacket | {
"repo_name": "QuarterCode/Disconnected",
"path": "src/main/java/com/quartercode/disconnected/sim/comp/program/ProgramExecutor.java",
"license": "gpl-3.0",
"size": 7030
} | [
"com.quartercode.disconnected.sim.comp.net.Packet"
] | import com.quartercode.disconnected.sim.comp.net.Packet; | import com.quartercode.disconnected.sim.comp.net.*; | [
"com.quartercode.disconnected"
] | com.quartercode.disconnected; | 1,688,981 |
@Override
public Clob createClob() throws SQLException {
return realConnection.createClob();
} | Clob function() throws SQLException { return realConnection.createClob(); } | /**
* Constructs an object that implements the <code>Clob</code> interface. The object
* returned initially contains no data. The <code>setAsciiStream</code>,
* <code>setCharacterStream</code> and <code>setString</code> methods of
* the <code>Clob</code> interface may be used to add data to the <code>Clob</code>.
*
* @return An object that implements the <code>Clob</code> interface
* @throws SQLException if an object that implements the
* <code>Clob</code> interface can not be constructed, this method is
* called on a closed connection or a database access error occurs.
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support
* this data type
* @since 1.6
*/ | Constructs an object that implements the <code>Clob</code> interface. The object returned initially contains no data. The <code>setAsciiStream</code>, <code>setCharacterStream</code> and <code>setString</code> methods of the <code>Clob</code> interface may be used to add data to the <code>Clob</code> | createClob | {
"repo_name": "mattyb149/pdi-presto-jdbc",
"path": "src/main/java/org/pentaho/community/di/plugins/database/presto/delegate/DelegateConnection.java",
"license": "apache-2.0",
"size": 77271
} | [
"java.sql.Clob",
"java.sql.SQLException"
] | import java.sql.Clob; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,354,409 |
public void run()
{
log.fine("work starting");
while (_isActive) {
log.fine("work adding count");
_resource.addCount();
try {
synchronized (this) {
wait(_resource.getSleepTime());
}
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
}
}
log.fine("work complete");
} | void function() { log.fine(STR); while (_isActive) { log.fine(STR); _resource.addCount(); try { synchronized (this) { wait(_resource.getSleepTime()); } } catch (Throwable e) { log.log(Level.WARNING, e.toString(), e); } } log.fine(STR); } | /**
* The method called to execute the task, like Runnable
*/ | The method called to execute the task, like Runnable | run | {
"repo_name": "dlitz/resin",
"path": "resin-doc/examples/jca-work/WEB-INF/classes/example/WorkTask.java",
"license": "gpl-2.0",
"size": 1206
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 2,884,001 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.