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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Override
public BufferedImage execute() throws Exception {
// Graphic object
BufferedImage img = getEmptyImage();
Graphics2D g = img.createGraphics();
g.setPaint(Color.GRAY);
// print frame
printFrame(g, getPageInfo().getFontSize());
// horizontal lines
printHorizontalLines(g);
// print lines
printAdditionalInfoLines(g);
// Calculate the distance between street, housnumber and lastname
calculateTheDistanceBetweenStreetHousenumberAndLastname();
printHeaderLines(g);
// print header
printHeader(g);
// print contact data
printContactData(g);
return img;
} | BufferedImage function() throws Exception { BufferedImage img = getEmptyImage(); Graphics2D g = img.createGraphics(); g.setPaint(Color.GRAY); printFrame(g, getPageInfo().getFontSize()); printHorizontalLines(g); printAdditionalInfoLines(g); calculateTheDistanceBetweenStreetHousenumberAndLastname(); printHeaderLines(g); printHeader(g); printContactData(g); return img; } | /**
* Executes printing of contacts
*/ | Executes printing of contacts | execute | {
"repo_name": "hydrogen2oxygen/Finalministry-Contacts",
"path": "src/main/java/net/hydrogen2oxygen/printing/image/impl/contacts/PrintContacts.java",
"license": "mit",
"size": 8854
} | [
"java.awt.Color",
"java.awt.Graphics2D",
"java.awt.image.BufferedImage"
] | import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferedImage; | import java.awt.*; import java.awt.image.*; | [
"java.awt"
] | java.awt; | 980,464 |
static Script getFilteredCollapsedScript(JFrame parent,Script script, String[] optionIds, String name) {
ExecutionReportImpl report = new ExecutionReportImpl();
Script ret = OptionsSubpath.getSubpathScript(script, optionIds, report);
// uuids need to match so last parameter values are saved
ret.setUuid(script.getUuid());
if (report.isFailed() == false) {
return ret;
}
report.setFailed("The script is corrupt and cannot be run.");
ExecutionUtils.showScriptFailureBox(parent,false, name, report);
return null;
} | static Script getFilteredCollapsedScript(JFrame parent,Script script, String[] optionIds, String name) { ExecutionReportImpl report = new ExecutionReportImpl(); Script ret = OptionsSubpath.getSubpathScript(script, optionIds, report); ret.setUuid(script.getUuid()); if (report.isFailed() == false) { return ret; } report.setFailed(STR); ExecutionUtils.showScriptFailureBox(parent,false, name, report); return null; } | /**
* Filters the script for the input options ids or just returns the root option on its own if no option ids provided.
*
* @param script
* @param optionIds
* @return
*/ | Filters the script for the input options ids or just returns the root option on its own if no option ids provided | getFilteredCollapsedScript | {
"repo_name": "PGWelch/com.opendoorlogistics",
"path": "com.opendoorlogistics.studio/src/com/opendoorlogistics/studio/scripts/execution/ExecutionUtils.java",
"license": "lgpl-3.0",
"size": 3596
} | [
"com.opendoorlogistics.core.scripts.elements.Script",
"com.opendoorlogistics.core.scripts.execution.ExecutionReportImpl",
"com.opendoorlogistics.core.scripts.execution.OptionsSubpath",
"javax.swing.JFrame"
] | import com.opendoorlogistics.core.scripts.elements.Script; import com.opendoorlogistics.core.scripts.execution.ExecutionReportImpl; import com.opendoorlogistics.core.scripts.execution.OptionsSubpath; import javax.swing.JFrame; | import com.opendoorlogistics.core.scripts.elements.*; import com.opendoorlogistics.core.scripts.execution.*; import javax.swing.*; | [
"com.opendoorlogistics.core",
"javax.swing"
] | com.opendoorlogistics.core; javax.swing; | 2,354,293 |
protected void createContextMenuFor(StructuredViewer viewer) {
MenuManager contextMenu = new MenuManager("#PopUp");
contextMenu.add(new Separator("additions"));
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(this);
Menu menu= contextMenu.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
} | void function(StructuredViewer viewer) { MenuManager contextMenu = new MenuManager(STR); contextMenu.add(new Separator(STR)); contextMenu.setRemoveAllWhenShown(true); contextMenu.addMenuListener(this); Menu menu= contextMenu.createContextMenu(viewer.getControl()); viewer.getControl().setMenu(menu); getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY DND.DROP_MOVE DND.DROP_LINK; Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } | /**
* This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates a context menu for the viewer and adds a listener as well registering the menu for extension. | createContextMenuFor | {
"repo_name": "KAMP-Research/KAMP",
"path": "bundles/Toometa/toometa.effects.editor/src/effects/presentation/EffectsEditor.java",
"license": "apache-2.0",
"size": 54859
} | [
"org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter",
"org.eclipse.emf.edit.ui.dnd.LocalTransfer",
"org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter",
"org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider",
"org.eclipse.jface.action.MenuManager",
"org.eclipse.jface.action.Separator",
"org.e... | import org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter; import org.eclipse.emf.edit.ui.dnd.LocalTransfer; import org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter; import org.eclipse.emf.edit.ui.provider.UnwrappingSelectionProvider; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.util.LocalSelectionTransfer; import org.eclipse.jface.viewers.StructuredViewer; import org.eclipse.swt.dnd.FileTransfer; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Menu; | import org.eclipse.emf.edit.ui.dnd.*; import org.eclipse.emf.edit.ui.provider.*; import org.eclipse.jface.action.*; import org.eclipse.jface.util.*; import org.eclipse.jface.viewers.*; import org.eclipse.swt.dnd.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.emf",
"org.eclipse.jface",
"org.eclipse.swt"
] | org.eclipse.emf; org.eclipse.jface; org.eclipse.swt; | 2,271,447 |
public Iterator<E> iterator();
}
private class PlainListenerList<E> implements java.io.Serializable, ListenerList<E> {
@SuppressWarnings("unchecked")
protected List list;
public PlainListenerList() {
list = new java.util.ArrayList<E>();
} | Iterator<E> function(); } private class PlainListenerList<E> implements java.io.Serializable, ListenerList<E> { @SuppressWarnings(STR) protected List list; public PlainListenerList() { list = new java.util.ArrayList<E>(); } | /**
* Returns an iterator on the listeners of the list
* @return an iterator on the listeners of the list
*/ | Returns an iterator on the listeners of the list | iterator | {
"repo_name": "jrochas/scale-proactive",
"path": "src/Core/org/objectweb/proactive/core/event/AbstractEventProducer.java",
"license": "agpl-3.0",
"size": 13990
} | [
"java.util.Iterator",
"java.util.List"
] | import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 728,618 |
static byte[] shortToBytes(short value) {
byte[] bytes = new byte[2];
if (PlatformDependent.BIG_ENDIAN_NATIVE_ORDER) {
bytes[1] = (byte) ((value >> 8) & 0xff);
bytes[0] = (byte) (value & 0xff);
} else {
bytes[0] = (byte) ((value >> 8) & 0xff);
bytes[1] = (byte) (value & 0xff);
}
return bytes;
} | static byte[] shortToBytes(short value) { byte[] bytes = new byte[2]; if (PlatformDependent.BIG_ENDIAN_NATIVE_ORDER) { bytes[1] = (byte) ((value >> 8) & 0xff); bytes[0] = (byte) (value & 0xff); } else { bytes[0] = (byte) ((value >> 8) & 0xff); bytes[1] = (byte) (value & 0xff); } return bytes; } | /**
* Returns a {@code byte[]} of {@code short} value. This is opposite of {@code makeShort()}.
*/ | Returns a byte[] of short value. This is opposite of makeShort() | shortToBytes | {
"repo_name": "NiteshKant/netty",
"path": "codec-redis/src/main/java/io/netty/handler/codec/redis/RedisCodecUtil.java",
"license": "apache-2.0",
"size": 1768
} | [
"io.netty.util.internal.PlatformDependent"
] | import io.netty.util.internal.PlatformDependent; | import io.netty.util.internal.*; | [
"io.netty.util"
] | io.netty.util; | 187,780 |
public ResolverUtil<T> findAnnotated(
Class<? extends Annotation> annotation,
String... packageNames) {
if (packageNames == null)
return this;
Test test = new AnnotatedWith(
annotation);
for (String pkg : packageNames) {
find(test, pkg);
}
return this;
}
/**
* Scans for classes starting at the package provided and descending into
* subpackages. Each class is offered up to the Test as it is discovered,
* and if the Test returns true the class is retained. Accumulated classes
* can be fetched by calling {@link #getClasses()}.
*
* @param test
* an instance of {@link Test} that will be used to filter
* classes
* @param packageName
* the name of the package from which to start scanning for
* classes, e.g. {@code net.sourceforge.stripes} | ResolverUtil<T> function( Class<? extends Annotation> annotation, String... packageNames) { if (packageNames == null) return this; Test test = new AnnotatedWith( annotation); for (String pkg : packageNames) { find(test, pkg); } return this; } /** * Scans for classes starting at the package provided and descending into * subpackages. Each class is offered up to the Test as it is discovered, * and if the Test returns true the class is retained. Accumulated classes * can be fetched by calling {@link #getClasses()}. * * @param test * an instance of {@link Test} that will be used to filter * classes * @param packageName * the name of the package from which to start scanning for * classes, e.g. {@code net.sourceforge.stripes} | /**
* Attempts to discover classes that are annotated with the annotation.
* Accumulated classes can be accessed by calling {@link #getClasses()}.
*
* @param annotation
* the annotation that should be present on matching classes
* @param packageNames
* one or more package names to scan (including subpackages) for
* classes
*/ | Attempts to discover classes that are annotated with the annotation. Accumulated classes can be accessed by calling <code>#getClasses()</code> | findAnnotated | {
"repo_name": "xiaoweige1101/chuangyeyuan",
"path": "src/main/java/org/apache/ibatis/io/ResolverUtil.java",
"license": "gpl-2.0",
"size": 10343
} | [
"java.lang.annotation.Annotation"
] | import java.lang.annotation.Annotation; | import java.lang.annotation.*; | [
"java.lang"
] | java.lang; | 1,773,201 |
@Override
public void setData(Map<String,Object> value) {
set(10, value);
} | void function(Map<String,Object> value) { set(10, value); } | /**
* Setter for <code>cattle.project_member.data</code>.
*/ | Setter for <code>cattle.project_member.data</code> | setData | {
"repo_name": "rancherio/cattle",
"path": "modules/model/src/main/java/io/cattle/platform/core/model/tables/records/ProjectMemberRecord.java",
"license": "apache-2.0",
"size": 17482
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,083,344 |
public static void showInternalMessageDialog(Component parentComponent,
Object message, String title,
int messageType)
{
JOptionPane pane = new JOptionPane(message, messageType);
JInternalFrame frame = pane.createInternalFrame(parentComponent, title);
startModal(frame);
} | static void function(Component parentComponent, Object message, String title, int messageType) { JOptionPane pane = new JOptionPane(message, messageType); JInternalFrame frame = pane.createInternalFrame(parentComponent, title); startModal(frame); } | /**
* This method shows an internal message dialog with the given message,
* title and message type. The internal message dialog is placed in the
* first JDesktopPane ancestor found in the given parent component.
*
* @param parentComponent The parent component to find a JDesktopPane in.
* @param message The message to display.
* @param title The title to display.
* @param messageType The message type.
*/ | This method shows an internal message dialog with the given message, title and message type. The internal message dialog is placed in the first JDesktopPane ancestor found in the given parent component | showInternalMessageDialog | {
"repo_name": "ivmai/JCGO",
"path": "goclsp/clsp_fix/javax/swing/JOptionPane.java",
"license": "gpl-2.0",
"size": 52689
} | [
"java.awt.Component"
] | import java.awt.Component; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,140,641 |
List<OSDataVO> list = new ArrayList<OSDataVO>();
for (OsData data : osListFromApiClient) {
OSDataVO osVo = new OSDataVO();
osVo.setOsName(data.getName());
osVo.setOsVersion(data.getVersion());
osVo.setOsDescription(data.getDescription());
list.add(osVo);
}
return list;
}
| List<OSDataVO> list = new ArrayList<OSDataVO>(); for (OsData data : osListFromApiClient) { OSDataVO osVo = new OSDataVO(); osVo.setOsName(data.getName()); osVo.setOsVersion(data.getVersion()); osVo.setOsDescription(data.getDescription()); list.add(osVo); } return list; } | /**
* Method convert OS List from Api CLient into List OS OSDataVO.
*
* @param osListFromApiClient
* @return
*/ | Method convert OS List from Api CLient into List OS OSDataVO | getListToOSDataVO | {
"repo_name": "xe1gyq/OpenAttestation",
"path": "portals/WhiteListPortal/src/main/java/com/intel/mountwilson/util/ConverterUtil.java",
"license": "bsd-3-clause",
"size": 7124
} | [
"com.intel.mountwilson.datamodel.OSDataVO",
"com.intel.mtwilson.datatypes.OsData",
"java.util.ArrayList",
"java.util.List"
] | import com.intel.mountwilson.datamodel.OSDataVO; import com.intel.mtwilson.datatypes.OsData; import java.util.ArrayList; import java.util.List; | import com.intel.mountwilson.datamodel.*; import com.intel.mtwilson.datatypes.*; import java.util.*; | [
"com.intel.mountwilson",
"com.intel.mtwilson",
"java.util"
] | com.intel.mountwilson; com.intel.mtwilson; java.util; | 2,445,027 |
@Override
protected void addBindings() {
install(InjectionFactoryUtils.asPrimitiveParameterModule(
"NUMBER_OF_FIRMS", numberOfFirms));
expose(Integer.class).annotatedWith(Names.named("NUMBER_OF_FIRMS"));
} | void function() { install(InjectionFactoryUtils.asPrimitiveParameterModule( STR, numberOfFirms)); expose(Integer.class).annotatedWith(Names.named(STR)); } | /**
* When overriding this method, call {@link super#addBindings()} as a
* last instruction.
*/ | When overriding this method, call <code>super#addBindings()</code> as a last instruction | addBindings | {
"repo_name": "crisis-economics/CRISIS",
"path": "CRISIS/src/eu/crisis_economics/abm/model/configuration/AbstractFirmsSubEconomy.java",
"license": "gpl-3.0",
"size": 11437
} | [
"com.google.inject.name.Names",
"eu.crisis_economics.abm.simulation.injection.factories.InjectionFactoryUtils"
] | import com.google.inject.name.Names; import eu.crisis_economics.abm.simulation.injection.factories.InjectionFactoryUtils; | import com.google.inject.name.*; import eu.crisis_economics.abm.simulation.injection.factories.*; | [
"com.google.inject",
"eu.crisis_economics.abm"
] | com.google.inject; eu.crisis_economics.abm; | 2,683,975 |
public void testNamedGoogBar() throws Exception {
// isXxx
assertFalse(namedGoogBar.isFunctionPrototypeType());
assertTrue(namedGoogBar.getImplicitPrototype().isFunctionPrototypeType());
// isSubtype
assertTrue(namedGoogBar.isSubtype(ALL_TYPE));
assertFalse(namedGoogBar.isSubtype(STRING_OBJECT_TYPE));
assertFalse(namedGoogBar.isSubtype(NUMBER_TYPE));
assertFalse(namedGoogBar.isSubtype(functionType));
assertFalse(namedGoogBar.isSubtype(NULL_TYPE));
assertTrue(namedGoogBar.isSubtype(OBJECT_TYPE));
assertFalse(namedGoogBar.isSubtype(DATE_TYPE));
assertTrue(namedGoogBar.isSubtype(namedGoogBar));
assertTrue(namedGoogBar.isSubtype(unresolvedNamedType));
assertFalse(namedGoogBar.isSubtype(REGEXP_TYPE));
assertFalse(namedGoogBar.isSubtype(ARRAY_TYPE));
// autoboxesTo
assertNull(namedGoogBar.autoboxesTo());
// properties
assertTypeEquals(DATE_TYPE, namedGoogBar.getPropertyType("date"));
assertFalse(namedGoogBar.isNativeObjectType());
assertFalse(namedGoogBar.getImplicitPrototype().isNativeObjectType());
JSType resolvedNamedGoogBar = Asserts.assertValidResolve(namedGoogBar);
assertNotSame(resolvedNamedGoogBar, namedGoogBar);
assertSame(resolvedNamedGoogBar, googBar.getInstanceType());
} | void function() throws Exception { assertFalse(namedGoogBar.isFunctionPrototypeType()); assertTrue(namedGoogBar.getImplicitPrototype().isFunctionPrototypeType()); assertTrue(namedGoogBar.isSubtype(ALL_TYPE)); assertFalse(namedGoogBar.isSubtype(STRING_OBJECT_TYPE)); assertFalse(namedGoogBar.isSubtype(NUMBER_TYPE)); assertFalse(namedGoogBar.isSubtype(functionType)); assertFalse(namedGoogBar.isSubtype(NULL_TYPE)); assertTrue(namedGoogBar.isSubtype(OBJECT_TYPE)); assertFalse(namedGoogBar.isSubtype(DATE_TYPE)); assertTrue(namedGoogBar.isSubtype(namedGoogBar)); assertTrue(namedGoogBar.isSubtype(unresolvedNamedType)); assertFalse(namedGoogBar.isSubtype(REGEXP_TYPE)); assertFalse(namedGoogBar.isSubtype(ARRAY_TYPE)); assertNull(namedGoogBar.autoboxesTo()); assertTypeEquals(DATE_TYPE, namedGoogBar.getPropertyType("date")); assertFalse(namedGoogBar.isNativeObjectType()); assertFalse(namedGoogBar.getImplicitPrototype().isNativeObjectType()); JSType resolvedNamedGoogBar = Asserts.assertValidResolve(namedGoogBar); assertNotSame(resolvedNamedGoogBar, namedGoogBar); assertSame(resolvedNamedGoogBar, googBar.getInstanceType()); } | /**
* Tests the named type goog.Bar.
*/ | Tests the named type goog.Bar | testNamedGoogBar | {
"repo_name": "lgeorgieff/closure-compiler",
"path": "test/com/google/javascript/rhino/jstype/JSTypeTest.java",
"license": "apache-2.0",
"size": 273346
} | [
"com.google.javascript.rhino.testing.Asserts"
] | import com.google.javascript.rhino.testing.Asserts; | import com.google.javascript.rhino.testing.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,165,644 |
public void connect()
throws UnknownHostException, IOException,
LoginFailedException, IncorrectPasswordException {
socket = new Socket(host, port);
socket.setTcpNoDelay(true);
socket.setKeepAlive(true);
inputStream = new PacketInputStream(socket.getInputStream());
outputStream = new PacketOutputStream(socket.getOutputStream());
writeQueue = new LinkedBlockingQueue<Packet>();
requestDispatcher = new RequestDispatcher(writeQueue);
| void function() throws UnknownHostException, IOException, LoginFailedException, IncorrectPasswordException { socket = new Socket(host, port); socket.setTcpNoDelay(true); socket.setKeepAlive(true); inputStream = new PacketInputStream(socket.getInputStream()); outputStream = new PacketOutputStream(socket.getOutputStream()); writeQueue = new LinkedBlockingQueue<Packet>(); requestDispatcher = new RequestDispatcher(writeQueue); | /**
* Connect to the LabRAD manager.
* @throws UnknownHostException if the host and port are not valid
* @throws IOException if a network error occurred
* @throws IncorrectPasswordException if the password was not correct
* @throws LoginFailedException if the login failed for some other reason
*/ | Connect to the LabRAD manager | connect | {
"repo_name": "martinisgroup/jlabrad",
"path": "JLabrad/src/org/labrad/Client.java",
"license": "gpl-2.0",
"size": 20606
} | [
"java.io.IOException",
"java.net.Socket",
"java.net.UnknownHostException",
"java.util.concurrent.LinkedBlockingQueue",
"org.labrad.data.Packet",
"org.labrad.data.PacketInputStream",
"org.labrad.data.PacketOutputStream",
"org.labrad.errors.IncorrectPasswordException",
"org.labrad.errors.LoginFailedEx... | import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; import java.util.concurrent.LinkedBlockingQueue; import org.labrad.data.Packet; import org.labrad.data.PacketInputStream; import org.labrad.data.PacketOutputStream; import org.labrad.errors.IncorrectPasswordException; import org.labrad.errors.LoginFailedException; | import java.io.*; import java.net.*; import java.util.concurrent.*; import org.labrad.data.*; import org.labrad.errors.*; | [
"java.io",
"java.net",
"java.util",
"org.labrad.data",
"org.labrad.errors"
] | java.io; java.net; java.util; org.labrad.data; org.labrad.errors; | 400,547 |
private void removetid(QJobRemoveTid qo) {
CSUser user = qo.getUser();
SharedMemory.getTopicManager().unregisterUser(user);
SharedMemory.getUserManager().syncRemoveTid(user);
} | void function(QJobRemoveTid qo) { CSUser user = qo.getUser(); SharedMemory.getTopicManager().unregisterUser(user); SharedMemory.getUserManager().syncRemoveTid(user); } | /**
* register tid only
* @param request
*/ | register tid only | removetid | {
"repo_name": "twopairs/websocketCollection",
"path": "wsc/mr/src/main/java/org/wsc/mr/service/queue/QWorker.java",
"license": "apache-2.0",
"size": 10681
} | [
"org.wsc.mr.entity.queue.job.QJobRemoveTid",
"org.wsc.mr.entity.shareddata.CSUser",
"org.wsc.mr.entity.shareddata.SharedMemory"
] | import org.wsc.mr.entity.queue.job.QJobRemoveTid; import org.wsc.mr.entity.shareddata.CSUser; import org.wsc.mr.entity.shareddata.SharedMemory; | import org.wsc.mr.entity.queue.job.*; import org.wsc.mr.entity.shareddata.*; | [
"org.wsc.mr"
] | org.wsc.mr; | 886,378 |
public Return generateReport(final Parameter _parameter)
throws EFapsException
{
final Return ret = new Return();
final AbstractDynamicReport dyRp = getReport(_parameter);
final String html = dyRp.getHtmlSnipplet(_parameter);
ret.put(ReturnValues.SNIPLETT, html);
return ret;
} | Return function(final Parameter _parameter) throws EFapsException { final Return ret = new Return(); final AbstractDynamicReport dyRp = getReport(_parameter); final String html = dyRp.getHtmlSnipplet(_parameter); ret.put(ReturnValues.SNIPLETT, html); return ret; } | /**
* Generate report.
*
* @param _parameter Parameter as passed by the eFasp API
* @return Return containing html snipplet
* @throws EFapsException on error
*/ | Generate report | generateReport | {
"repo_name": "eFaps/eFapsApp-Sales",
"path": "src/main/efaps/ESJP/org/efaps/esjp/sales/report/DocPositionReport_Base.java",
"license": "apache-2.0",
"size": 35473
} | [
"org.efaps.admin.event.Parameter",
"org.efaps.admin.event.Return",
"org.efaps.esjp.common.jasperreport.AbstractDynamicReport",
"org.efaps.util.EFapsException"
] | import org.efaps.admin.event.Parameter; import org.efaps.admin.event.Return; import org.efaps.esjp.common.jasperreport.AbstractDynamicReport; import org.efaps.util.EFapsException; | import org.efaps.admin.event.*; import org.efaps.esjp.common.jasperreport.*; import org.efaps.util.*; | [
"org.efaps.admin",
"org.efaps.esjp",
"org.efaps.util"
] | org.efaps.admin; org.efaps.esjp; org.efaps.util; | 617,625 |
EList<ConnectivityNode> getConnectivityNodes(); | EList<ConnectivityNode> getConnectivityNodes(); | /**
* Returns the value of the '<em><b>Connectivity Nodes</b></em>' reference list.
* The list contents are of type {@link gluemodel.CIM.IEC61970.Core.ConnectivityNode}.
* It is bidirectional and its opposite is '{@link gluemodel.CIM.IEC61970.Core.ConnectivityNode#getLossPenaltyFactors <em>Loss Penalty Factors</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Connectivity Nodes</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Connectivity Nodes</em>' reference list.
* @see gluemodel.CIM.IEC61970.Informative.MarketOperations.MarketOperationsPackage#getLossPenaltyFactor_ConnectivityNodes()
* @see gluemodel.CIM.IEC61970.Core.ConnectivityNode#getLossPenaltyFactors
* @model opposite="LossPenaltyFactors"
* @generated
*/ | Returns the value of the 'Connectivity Nodes' reference list. The list contents are of type <code>gluemodel.CIM.IEC61970.Core.ConnectivityNode</code>. It is bidirectional and its opposite is '<code>gluemodel.CIM.IEC61970.Core.ConnectivityNode#getLossPenaltyFactors Loss Penalty Factors</code>'. If the meaning of the 'Connectivity Nodes' reference list isn't clear, there really should be more of a description here... | getConnectivityNodes | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Informative/MarketOperations/LossPenaltyFactor.java",
"license": "mit",
"size": 3530
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,152,617 |
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
DiscoveryEvent info = (DiscoveryEvent)o;
tightMarshalString2(info.getServiceName(), dataOut, bs);
tightMarshalString2(info.getBrokerName(), dataOut, bs);
} | void function(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); DiscoveryEvent info = (DiscoveryEvent)o; tightMarshalString2(info.getServiceName(), dataOut, bs); tightMarshalString2(info.getBrokerName(), dataOut, bs); } | /**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stream
* @throws IOException thrown if an error occurs
*/ | Write a object instance to data output stream | tightMarshal2 | {
"repo_name": "chirino/fabric8",
"path": "gateway/gateway-core/src/main/java/io/fabric8/gateway/handlers/detecting/protocol/openwire/codec/v1/DiscoveryEventMarshaller.java",
"license": "apache-2.0",
"size": 4611
} | [
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.BooleanStream",
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat",
"io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DiscoveryEvent",
"java.io.IOException",
"org.fusesource.hawtbuf.DataByteArrayOutputS... | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.BooleanStream; import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat; import io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DiscoveryEvent; import java.io.IOException; import org.fusesource.hawtbuf.DataByteArrayOutputStream; | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.*; import io.fabric8.gateway.handlers.detecting.protocol.openwire.command.*; import java.io.*; import org.fusesource.hawtbuf.*; | [
"io.fabric8.gateway",
"java.io",
"org.fusesource.hawtbuf"
] | io.fabric8.gateway; java.io; org.fusesource.hawtbuf; | 670,033 |
public Vector<String> getAllSesionTime(){
Vector<String> sDates=new Vector<String>();
if(dbRead != null)
{
String rowQuerry="select sesiones.tiempo_total from sesiones";
Cursor cursor=dbRead.rawQuery(rowQuerry,null);
while(cursor.moveToNext()){
sDates.add(cursor.getString(0));
}
//Cerramos el cursor
cursor.close();
}
return sDates;
}
| Vector<String> function(){ Vector<String> sDates=new Vector<String>(); if(dbRead != null) { String rowQuerry=STR; Cursor cursor=dbRead.rawQuery(rowQuerry,null); while(cursor.moveToNext()){ sDates.add(cursor.getString(0)); } cursor.close(); } return sDates; } | /**
* return all the sessions times
*
* @return sDates the sessions dates
* */ | return all the sessions times | getAllSesionTime | {
"repo_name": "sanruigo/v_trainning",
"path": "src/project/database/DataBase_vTrainning.java",
"license": "epl-1.0",
"size": 18724
} | [
"android.database.Cursor",
"java.util.Vector"
] | import android.database.Cursor; import java.util.Vector; | import android.database.*; import java.util.*; | [
"android.database",
"java.util"
] | android.database; java.util; | 283,861 |
@Override
public List<Object[]> collectResultInRow(BlockletScannedResult scannedResult, int batchSize) {
// scan the record and add to list
List<Object[]> listBasedResult = new ArrayList<>(batchSize);
int rowCounter = 0;
boolean isStructQueryType = false;
for (Object obj : scannedResult.complexParentIndexToQueryMap.values()) {
if (obj instanceof StructQueryType) {
//if any one of the map elements contains struct,need to shift rows if contains null.
isStructQueryType = true;
break;
}
}
boolean[] isComplexChildColumn = null;
if (isStructQueryType) {
// need to identify complex child columns for shifting rows if contains null
isComplexChildColumn = new boolean[queryDimensions.length + queryMeasures.length];
for (ProjectionDimension dimension : queryDimensions) {
if (null != dimension.getDimension().getComplexParentDimension()) {
isComplexChildColumn[dimension.getOrdinal()] = true;
}
}
}
while (scannedResult.hasNext() && rowCounter < batchSize) {
scannedResult.incrementCounter();
if (readOnlyDelta) {
if (!scannedResult.containsDeletedRow(scannedResult.getCurrentRowId())) {
continue;
}
} else {
if (scannedResult.containsDeletedRow(scannedResult.getCurrentRowId())) {
continue;
}
}
Object[] row = new Object[queryDimensions.length + queryMeasures.length];
if (isDimensionExists) {
surrogateResult = scannedResult.getDictionaryKeyIntegerArray();
noDictionaryKeys = scannedResult.getNoDictionaryKeyArray();
complexTypeKeyArray = scannedResult.getComplexTypeKeyArray();
dictionaryColumnIndex = 0;
noDictionaryColumnIndex = 0;
complexTypeColumnIndex = 0;
// get the complex columns data of this row
fillComplexColumnDataBufferForThisRow();
for (int i = 0; i < queryDimensions.length; i++) {
fillDimensionData(scannedResult, surrogateResult, noDictionaryKeys, complexTypeKeyArray,
comlexDimensionInfoMap, row, i, queryDimensions[i].getDimension().getOrdinal());
}
}
fillMeasureData(scannedResult, row);
if (isStructQueryType) {
shiftNullForStruct(row, isComplexChildColumn);
}
listBasedResult.add(row);
rowCounter++;
}
return listBasedResult;
} | List<Object[]> function(BlockletScannedResult scannedResult, int batchSize) { List<Object[]> listBasedResult = new ArrayList<>(batchSize); int rowCounter = 0; boolean isStructQueryType = false; for (Object obj : scannedResult.complexParentIndexToQueryMap.values()) { if (obj instanceof StructQueryType) { isStructQueryType = true; break; } } boolean[] isComplexChildColumn = null; if (isStructQueryType) { isComplexChildColumn = new boolean[queryDimensions.length + queryMeasures.length]; for (ProjectionDimension dimension : queryDimensions) { if (null != dimension.getDimension().getComplexParentDimension()) { isComplexChildColumn[dimension.getOrdinal()] = true; } } } while (scannedResult.hasNext() && rowCounter < batchSize) { scannedResult.incrementCounter(); if (readOnlyDelta) { if (!scannedResult.containsDeletedRow(scannedResult.getCurrentRowId())) { continue; } } else { if (scannedResult.containsDeletedRow(scannedResult.getCurrentRowId())) { continue; } } Object[] row = new Object[queryDimensions.length + queryMeasures.length]; if (isDimensionExists) { surrogateResult = scannedResult.getDictionaryKeyIntegerArray(); noDictionaryKeys = scannedResult.getNoDictionaryKeyArray(); complexTypeKeyArray = scannedResult.getComplexTypeKeyArray(); dictionaryColumnIndex = 0; noDictionaryColumnIndex = 0; complexTypeColumnIndex = 0; fillComplexColumnDataBufferForThisRow(); for (int i = 0; i < queryDimensions.length; i++) { fillDimensionData(scannedResult, surrogateResult, noDictionaryKeys, complexTypeKeyArray, comlexDimensionInfoMap, row, i, queryDimensions[i].getDimension().getOrdinal()); } } fillMeasureData(scannedResult, row); if (isStructQueryType) { shiftNullForStruct(row, isComplexChildColumn); } listBasedResult.add(row); rowCounter++; } return listBasedResult; } | /**
* This method will add a record both key and value to list object
* it will keep track of how many record is processed, to handle limit scenario
*/ | This method will add a record both key and value to list object it will keep track of how many record is processed, to handle limit scenario | collectResultInRow | {
"repo_name": "jackylk/incubator-carbondata",
"path": "core/src/main/java/org/apache/carbondata/core/scan/collector/impl/DictionaryBasedResultCollector.java",
"license": "apache-2.0",
"size": 17780
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.carbondata.core.scan.complextypes.StructQueryType",
"org.apache.carbondata.core.scan.model.ProjectionDimension",
"org.apache.carbondata.core.scan.result.BlockletScannedResult"
] | import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.scan.complextypes.StructQueryType; import org.apache.carbondata.core.scan.model.ProjectionDimension; import org.apache.carbondata.core.scan.result.BlockletScannedResult; | import java.util.*; import org.apache.carbondata.core.scan.complextypes.*; import org.apache.carbondata.core.scan.model.*; import org.apache.carbondata.core.scan.result.*; | [
"java.util",
"org.apache.carbondata"
] | java.util; org.apache.carbondata; | 1,430,275 |
public void addSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
} | void function(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); } | /**
* This implements {@link org.eclipse.jface.viewers.ISelectionProvider}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This implements <code>org.eclipse.jface.viewers.ISelectionProvider</code>. | addSelectionChangedListener | {
"repo_name": "SpaceWireOS-Modeler/MetaModel",
"path": "jp.pizzafactory.model.spacewireos.editor/src/jp/pizzafactory/model/spacewireos/networkTopology/presentation/NetworkTopologyEditor.java",
"license": "epl-1.0",
"size": 55092
} | [
"org.eclipse.jface.viewers.ISelectionChangedListener"
] | import org.eclipse.jface.viewers.ISelectionChangedListener; | import org.eclipse.jface.viewers.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 1,896,423 |
public static List<OCFile> sortCloudFilesByFavourite(List<OCFile> files) {
Collections.sort(files, (o1, o2) -> {
if (o1.isFavorite() && o2.isFavorite()) {
return 0;
} else if (o1.isFavorite()) {
return -1;
} else if (o2.isFavorite()) {
return 1;
}
return 0;
});
return files;
} | static List<OCFile> function(List<OCFile> files) { Collections.sort(files, (o1, o2) -> { if (o1.isFavorite() && o2.isFavorite()) { return 0; } else if (o1.isFavorite()) { return -1; } else if (o2.isFavorite()) { return 1; } return 0; }); return files; } | /**
* Sorts list by Favourites.
*
* @param files files to sort
*/ | Sorts list by Favourites | sortCloudFilesByFavourite | {
"repo_name": "SpryServers/sprycloud-android",
"path": "src/main/java/com/owncloud/android/utils/FileSortOrder.java",
"license": "gpl-2.0",
"size": 3315
} | [
"com.owncloud.android.datamodel.OCFile",
"java.util.Collections",
"java.util.List"
] | import com.owncloud.android.datamodel.OCFile; import java.util.Collections; import java.util.List; | import com.owncloud.android.datamodel.*; import java.util.*; | [
"com.owncloud.android",
"java.util"
] | com.owncloud.android; java.util; | 2,220,015 |
ServiceResponse<Void> enumNull() throws ErrorException, IOException; | ServiceResponse<Void> enumNull() throws ErrorException, IOException; | /**
* Get null (no query parameter in url).
*
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the {@link ServiceResponse} object if successful.
*/ | Get null (no query parameter in url) | enumNull | {
"repo_name": "yaqiyang/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/Queries.java",
"license": "mit",
"size": 45760
} | [
"com.microsoft.rest.ServiceResponse",
"java.io.IOException"
] | import com.microsoft.rest.ServiceResponse; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 289,283 |
@Override
public void severe(StringId messageId, Throwable throwable) {
severe(messageId, null, throwable);
} | void function(StringId messageId, Throwable throwable) { severe(messageId, null, throwable); } | /**
* Writes both a message and exception to this writer. The message level is "severe".
*
* @since GemFire 6.0
*/ | Writes both a message and exception to this writer. The message level is "severe" | severe | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/logging/LogWriterImpl.java",
"license": "apache-2.0",
"size": 32318
} | [
"org.apache.geode.i18n.StringId"
] | import org.apache.geode.i18n.StringId; | import org.apache.geode.i18n.*; | [
"org.apache.geode"
] | org.apache.geode; | 202,321 |
public File getInputFile() {
return this.inputFile;
}
| File function() { return this.inputFile; } | /**
* Retrieves the input file path which is specified in command line options.
*
* @return the input file path
*/ | Retrieves the input file path which is specified in command line options | getInputFile | {
"repo_name": "slopjong/Erwiz",
"path": "src/de/slopjong/erwiz/cui/CommandLineOptions.java",
"license": "bsd-3-clause",
"size": 7742
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 219,144 |
protected void addGlobalI18nMessage(String bundleName, FacesMessage.Severity severity, String summaryKey, String detailKey) {
addI18nMessage(null, bundleName, severity, summaryKey, null, detailKey, null);
} | void function(String bundleName, FacesMessage.Severity severity, String summaryKey, String detailKey) { addI18nMessage(null, bundleName, severity, summaryKey, null, detailKey, null); } | /**
* Shortcut to addI18nMessage(): global message with specified severity and simple summary and detail messages.
*
* @param bundleName
* The name of the bundle where to look for the message.
* @param severity
* The severity of the message (one of the severity levels defined by JSF).
* @param summaryKey
* The key that identifies the message that will serve as summary in the resource bundle.
* @param detailKey
* The key that identifies the message that will serve as detail in the resource bundle.
*
* @see br.ufes.inf.nemo.jbutler.ejb.controller.JSFController#addI18nMessage(java.lang.String, java.lang.String,
* javax.faces.application.FacesMessage.Severity, java.lang.String, java.lang.Object[], java.lang.String,
* java.lang.Object[])
*/ | Shortcut to addI18nMessage(): global message with specified severity and simple summary and detail messages | addGlobalI18nMessage | {
"repo_name": "manzoli2122/Vip",
"path": "src/br/ufes/inf/nemo/jbutler/ejb/controller/JSFController.java",
"license": "apache-2.0",
"size": 27672
} | [
"javax.faces.application.FacesMessage"
] | import javax.faces.application.FacesMessage; | import javax.faces.application.*; | [
"javax.faces"
] | javax.faces; | 2,678,040 |
@Test
public void checkGetParentSeries() {
assertNull(series.getParentSeries());
}
| void function() { assertNull(series.getParentSeries()); } | /**
* Checks that the parent series cannot be retrieved.
*/ | Checks that the parent series cannot be retrieved | checkGetParentSeries | {
"repo_name": "eclipse/eavp",
"path": "org.eclipse.eavp.tests.viz.service/src/org/eclipse/eavp/tests/viz/service/AbstractSeriesTester.java",
"license": "epl-1.0",
"size": 3534
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,622,340 |
public LeaseAccessConditions leaseAccessConditions() {
return leaseAccessConditions;
} | LeaseAccessConditions function() { return leaseAccessConditions; } | /**
* By setting lease access conditions, requests will fail if the provided lease does not match the active lease on
* the blob.
*/ | By setting lease access conditions, requests will fail if the provided lease does not match the active lease on the blob | leaseAccessConditions | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/AppendBlobAccessConditions.java",
"license": "mit",
"size": 3584
} | [
"com.microsoft.azure.storage.blob.models.LeaseAccessConditions"
] | import com.microsoft.azure.storage.blob.models.LeaseAccessConditions; | import com.microsoft.azure.storage.blob.models.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,293,326 |
protected void initServerSocket(ServerSocket ssocket, boolean clientAuth)
{
SSLServerSocket socket = (SSLServerSocket) ssocket;
// Enable all available cipher suites when the socket is connected
String cipherSuites[] = socket.getSupportedCipherSuites();
socket.setEnabledCipherSuites(cipherSuites);
// Set client authentication if necessary
socket.setNeedClientAuth(clientAuth);
}
| void function(ServerSocket ssocket, boolean clientAuth) { SSLServerSocket socket = (SSLServerSocket) ssocket; String cipherSuites[] = socket.getSupportedCipherSuites(); socket.setEnabledCipherSuites(cipherSuites); socket.setNeedClientAuth(clientAuth); } | /**
* Set the requested properties for this server socket.
*
* @param ssocket The server socket to be configured
*/ | Set the requested properties for this server socket | initServerSocket | {
"repo_name": "awhitford/Resteasy",
"path": "tjws/src/main/java/Acme/Serve/SSLAcceptor.java",
"license": "apache-2.0",
"size": 10527
} | [
"java.net.ServerSocket",
"javax.net.ssl.SSLServerSocket"
] | import java.net.ServerSocket; import javax.net.ssl.SSLServerSocket; | import java.net.*; import javax.net.ssl.*; | [
"java.net",
"javax.net"
] | java.net; javax.net; | 1,851,626 |
@Test
public void testGetItemsbyGeoLocationRange() throws ServletException,
IOException {
final JSONArray geoUsage = this.setJsonParameters(
"/api/common/geolocation/search/all.json", "itemsByGeo");
Assert.assertEquals("Should be", 1, geoUsage.size());
}
| void function() throws ServletException, IOException { final JSONArray geoUsage = this.setJsonParameters( STR, STR); Assert.assertEquals(STR, 1, geoUsage.size()); } | /**
* Test retrieve all items around a geolocation point.
* @throws ServletException
* @throws IOException
*/ | Test retrieve all items around a geolocation point | testGetItemsbyGeoLocationRange | {
"repo_name": "cristiani/encuestame",
"path": "enme-mvc/json/json-api1/src/test/java/org/encuestame/mvc/test/json/GeoLocationJsonControllerTestCase.java",
"license": "apache-2.0",
"size": 6303
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"org.json.simple.JSONArray",
"org.junit.Assert"
] | import java.io.IOException; import javax.servlet.ServletException; import org.json.simple.JSONArray; import org.junit.Assert; | import java.io.*; import javax.servlet.*; import org.json.simple.*; import org.junit.*; | [
"java.io",
"javax.servlet",
"org.json.simple",
"org.junit"
] | java.io; javax.servlet; org.json.simple; org.junit; | 2,700,064 |
@SuppressWarnings("static-method")
@Test
public void testPostingIntInt() {
final int recordId = 1;
final int anotherRecordId = 2;
final int termFrequency = 3;
final int anotherTermFrequency = 4;
final Posting posting = new Posting(recordId, termFrequency);
final Posting anotherPosting =
new Posting(anotherRecordId, anotherTermFrequency);
Assert.assertEquals(recordId, posting.getId());
Assert.assertEquals(anotherRecordId, anotherPosting.getId());
Assert.assertEquals(termFrequency, posting.getTermFrequency());
Assert.assertEquals(anotherTermFrequency,
anotherPosting.getTermFrequency());
Assert.assertEquals(Posting.DEFAULT_SCORE, posting.getScore(), 0);
Assert.assertEquals(Posting.DEFAULT_SCORE, anotherPosting.getScore(), 0);
}
| @SuppressWarnings(STR) void function() { final int recordId = 1; final int anotherRecordId = 2; final int termFrequency = 3; final int anotherTermFrequency = 4; final Posting posting = new Posting(recordId, termFrequency); final Posting anotherPosting = new Posting(anotherRecordId, anotherTermFrequency); Assert.assertEquals(recordId, posting.getId()); Assert.assertEquals(anotherRecordId, anotherPosting.getId()); Assert.assertEquals(termFrequency, posting.getTermFrequency()); Assert.assertEquals(anotherTermFrequency, anotherPosting.getTermFrequency()); Assert.assertEquals(Posting.DEFAULT_SCORE, posting.getScore(), 0); Assert.assertEquals(Posting.DEFAULT_SCORE, anotherPosting.getScore(), 0); } | /**
* Test method for {@link Posting#Posting(int, int)}.
*/ | Test method for <code>Posting#Posting(int, int)</code> | testPostingIntInt | {
"repo_name": "ZabuzaW/LexiSearch",
"path": "test/de/zabuza/lexisearch/indexing/PostingTest.java",
"license": "gpl-3.0",
"size": 8020
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 912,779 |
@GET
@Path("/edges/{id}")
@Produces({MediaType.APPLICATION_JSON})
public Response getEdge(@PathParam("id") final String edgeId) {
LOG.info("Get vertex for edgeId= {}", edgeId);
validateInputs("Invalid argument: edge id passed is null or empty.", edgeId);
try {
Edge edge = getGraph().getEdge(edgeId);
if (edge == null) {
String message = "Edge with [" + edgeId + "] cannot be found.";
LOG.info(message);
throw FalconWebException.newMetadataResourceException(
JSONObject.quote(message), Response.Status.NOT_FOUND);
}
JSONObject response = new JSONObject();
response.put(RESULTS, GraphSONUtility.jsonFromElement(
edge, getEdgeIndexedKeys(), GraphSONMode.NORMAL));
return Response.ok(response).build();
} catch (JSONException e) {
throw FalconWebException.newException(e, Response.Status.INTERNAL_SERVER_ERROR);
}
} | @Path(STR) @Produces({MediaType.APPLICATION_JSON}) Response function(@PathParam("id") final String edgeId) { LOG.info(STR, edgeId); validateInputs(STR, edgeId); try { Edge edge = getGraph().getEdge(edgeId); if (edge == null) { String message = STR + edgeId + STR; LOG.info(message); throw FalconWebException.newMetadataResourceException( JSONObject.quote(message), Response.Status.NOT_FOUND); } JSONObject response = new JSONObject(); response.put(RESULTS, GraphSONUtility.jsonFromElement( edge, getEdgeIndexedKeys(), GraphSONMode.NORMAL)); return Response.ok(response).build(); } catch (JSONException e) { throw FalconWebException.newException(e, Response.Status.INTERNAL_SERVER_ERROR); } } | /**
* Get a single edge with a unique id.
*
* GET http://host/metadata/lineage/edges/id
* graph.getEdge(id);
* @param edgeId The unique id of the edge.
* @return Edge with the specified id.
*/ | Get a single edge with a unique id. GET HREF graph.getEdge(id) | getEdge | {
"repo_name": "pisaychuk/apache-falcon",
"path": "prism/src/main/java/org/apache/falcon/resource/metadata/LineageMetadataResource.java",
"license": "apache-2.0",
"size": 26622
} | [
"com.tinkerpop.blueprints.Edge",
"com.tinkerpop.blueprints.util.io.graphson.GraphSONMode",
"com.tinkerpop.blueprints.util.io.graphson.GraphSONUtility",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.apache.falcon.F... | import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.util.io.graphson.GraphSONMode; import com.tinkerpop.blueprints.util.io.graphson.GraphSONUtility; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.falcon.FalconWebException; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; | import com.tinkerpop.blueprints.*; import com.tinkerpop.blueprints.util.io.graphson.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.falcon.*; import org.codehaus.jettison.json.*; | [
"com.tinkerpop.blueprints",
"javax.ws",
"org.apache.falcon",
"org.codehaus.jettison"
] | com.tinkerpop.blueprints; javax.ws; org.apache.falcon; org.codehaus.jettison; | 2,512,774 |
static final Object convertIntegerToObject(int intValue, int valueLength, JDBCType jdbcType) {
switch (jdbcType) {
case INTEGER:
return intValue;
case SMALLINT: // 2.21 small and tinyint returned as short
case TINYINT:
return (short) intValue;
case BIT:
case BOOLEAN:
return 0 != intValue;
case BIGINT:
return (long) intValue;
case DECIMAL:
case NUMERIC:
case MONEY:
case SMALLMONEY:
return new BigDecimal(Integer.toString(intValue));
case FLOAT:
case DOUBLE:
return (double) intValue;
case REAL:
return (float) intValue;
case BINARY:
return convertIntToBytes(intValue, valueLength);
case SQL_VARIANT:
// return short or bit if the underlying datatype of sql_variant is tinyint, smallint or bit
// otherwise, return integer
// Longer datatypes such as double and float are handled by convertLongToObject instead.
if (valueLength == 1) {
return 0 != intValue;
} else if (valueLength == 3 || valueLength == 4) {
return (short) intValue;
} else {
return intValue;
}
default:
return Integer.toString(intValue);
}
} | static final Object convertIntegerToObject(int intValue, int valueLength, JDBCType jdbcType) { switch (jdbcType) { case INTEGER: return intValue; case SMALLINT: case TINYINT: return (short) intValue; case BIT: case BOOLEAN: return 0 != intValue; case BIGINT: return (long) intValue; case DECIMAL: case NUMERIC: case MONEY: case SMALLMONEY: return new BigDecimal(Integer.toString(intValue)); case FLOAT: case DOUBLE: return (double) intValue; case REAL: return (float) intValue; case BINARY: return convertIntToBytes(intValue, valueLength); case SQL_VARIANT: if (valueLength == 1) { return 0 != intValue; } else if (valueLength == 3 valueLength == 4) { return (short) intValue; } else { return intValue; } default: return Integer.toString(intValue); } } | /**
* Convert an Integer object to desired target user type.
*
* @param intValue
* the value to convert.
* @param valueLength
* the value to convert.
* @param jdbcType
* the jdbc type required.
* @param streamType
* the type of stream required.
* @return the required object.
*/ | Convert an Integer object to desired target user type | convertIntegerToObject | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos-encryption/src/main/java/com/azure/cosmos/encryption/implementation/mdesrc/cryptography/SqlSerializerUtil.java",
"license": "mit",
"size": 132985
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,383,237 |
public OperationsClient getOperations() {
return this.operations;
}
private final PrivateLinkResourcesClient privateLinkResources; | OperationsClient function() { return this.operations; } private final PrivateLinkResourcesClient privateLinkResources; | /**
* Gets the OperationsClient object to access its operations.
*
* @return the OperationsClient object.
*/ | Gets the OperationsClient object to access its operations | getOperations | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/databricks/azure-resourcemanager-databricks/src/main/java/com/azure/resourcemanager/databricks/implementation/AzureDatabricksManagementClientImpl.java",
"license": "mit",
"size": 12152
} | [
"com.azure.resourcemanager.databricks.fluent.OperationsClient",
"com.azure.resourcemanager.databricks.fluent.PrivateLinkResourcesClient"
] | import com.azure.resourcemanager.databricks.fluent.OperationsClient; import com.azure.resourcemanager.databricks.fluent.PrivateLinkResourcesClient; | import com.azure.resourcemanager.databricks.fluent.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 919,022 |
@Deprecated // Use getConvertedJsonPage instead
public <entityClass> Map<String, Object> getJsonPage(YadaDatatablesRequest yadaDatatablesRequest, Class<?> entityClass, Locale locale) {
Map<String, Object> json = new HashMap<String, Object>();
try {
List<entityClass> data = getPage(yadaDatatablesRequest, entityClass, locale);
// Eagerly fetching localized strings. This should not be a performance problem as DataTables is generally used in internal admin pages with a few lines.
YadaUtil.prefetchLocalizedStringList(data, entityClass);
json.put("draw", yadaDatatablesRequest.getDraw());
json.put("recordsTotal", yadaDatatablesRequest.getRecordsTotal());
json.put("recordsFiltered", yadaDatatablesRequest.getRecordsFiltered());
json.put("data", data);
} catch (Exception e) {
log.error("Can't retrieve data", e);
json.put("error", e.toString()); // TODO handle the error in javascript
}
return json;
}
| @Deprecated <entityClass> Map<String, Object> function(YadaDatatablesRequest yadaDatatablesRequest, Class<?> entityClass, Locale locale) { Map<String, Object> json = new HashMap<String, Object>(); try { List<entityClass> data = getPage(yadaDatatablesRequest, entityClass, locale); YadaUtil.prefetchLocalizedStringList(data, entityClass); json.put("draw", yadaDatatablesRequest.getDraw()); json.put(STR, yadaDatatablesRequest.getRecordsTotal()); json.put(STR, yadaDatatablesRequest.getRecordsFiltered()); json.put("data", data); } catch (Exception e) { log.error(STR, e); json.put("error", e.toString()); } return json; } | /**
* Returns a map with the result in the format needed by DataTables.
* All values that are included in the annotated json view (on the caller) will end up in the resulting json
* @param yadaDatatablesRequest
* @param entityClass
* @param locale
* @return
*/ | Returns a map with the result in the format needed by DataTables. All values that are included in the annotated json view (on the caller) will end up in the resulting json | getJsonPage | {
"repo_name": "xtianus/yadaframework",
"path": "YadaWeb/src/main/java/net/yadaframework/persistence/YadaDataTableDao.java",
"license": "mit",
"size": 22367
} | [
"java.util.HashMap",
"java.util.List",
"java.util.Locale",
"java.util.Map",
"net.yadaframework.components.YadaUtil",
"net.yadaframework.web.YadaDatatablesRequest"
] | import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import net.yadaframework.components.YadaUtil; import net.yadaframework.web.YadaDatatablesRequest; | import java.util.*; import net.yadaframework.components.*; import net.yadaframework.web.*; | [
"java.util",
"net.yadaframework.components",
"net.yadaframework.web"
] | java.util; net.yadaframework.components; net.yadaframework.web; | 656,095 |
public void setLocation(Point loc) {
setLocation(loc, true);
} | void function(Point loc) { setLocation(loc, true); } | /**
* Set icon location in device units
*/ | Set icon location in device units | setLocation | {
"repo_name": "kernsuite-debian/lofar",
"path": "JAVA/GUI/Plotter/src/gov/noaa/pmel/sgt/swing/UserIcon.java",
"license": "gpl-3.0",
"size": 9710
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,469,488 |
public void setCurrentDatabase(String databaseName) {
checkArgument(
!StringUtils.isNullOrWhitespaceOnly(databaseName),
"The database name cannot be null or empty.");
if (!catalogs.get(currentCatalogName).databaseExists(databaseName)) {
throw new CatalogException(
format(
"A database with name [%s] does not exist in the catalog: [%s].",
databaseName, currentCatalogName));
}
if (!currentDatabaseName.equals(databaseName)) {
currentDatabaseName = databaseName;
LOG.info(
"Set the current default database as [{}] in the current default catalog [{}].",
currentDatabaseName,
currentCatalogName);
}
} | void function(String databaseName) { checkArgument( !StringUtils.isNullOrWhitespaceOnly(databaseName), STR); if (!catalogs.get(currentCatalogName).databaseExists(databaseName)) { throw new CatalogException( format( STR, databaseName, currentCatalogName)); } if (!currentDatabaseName.equals(databaseName)) { currentDatabaseName = databaseName; LOG.info( STR, currentDatabaseName, currentCatalogName); } } | /**
* Sets the current database name that will be used when resolving a table path. The database
* has to exist in the current catalog.
*
* @param databaseName database name to set as current database name
* @throws CatalogException thrown if the database doesn't exist in the current catalog
* @see CatalogManager#qualifyIdentifier(UnresolvedIdentifier)
* @see CatalogManager#setCurrentCatalog(String)
*/ | Sets the current database name that will be used when resolving a table path. The database has to exist in the current catalog | setCurrentDatabase | {
"repo_name": "StephanEwen/incubator-flink",
"path": "flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/catalog/CatalogManager.java",
"license": "apache-2.0",
"size": 37631
} | [
"java.lang.String",
"org.apache.flink.table.catalog.exceptions.CatalogException",
"org.apache.flink.util.Preconditions",
"org.apache.flink.util.StringUtils"
] | import java.lang.String; import org.apache.flink.table.catalog.exceptions.CatalogException; import org.apache.flink.util.Preconditions; import org.apache.flink.util.StringUtils; | import java.lang.*; import org.apache.flink.table.catalog.exceptions.*; import org.apache.flink.util.*; | [
"java.lang",
"org.apache.flink"
] | java.lang; org.apache.flink; | 230,723 |
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (stopScrollWhenTouch) {
if (ev.getAction() == MotionEvent.ACTION_DOWN && isAutoScroll) {
isStopByTouch = true;
stopAutoScroll();
} else if (ev.getAction() == MotionEvent.ACTION_UP && isStopByTouch) {
startAutoScroll();
}
}
if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT || slideBorderMode == SLIDE_BORDER_MODE_CYCLE) {
touchX = ev.getX();
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
downX = touchX;
}
int currentItem = getCurrentItem();
PagerAdapter adapter = getAdapter();
int pageCount = adapter == null ? 0 : adapter.getCount();
if ((currentItem == 0 && downX <= touchX) || (currentItem == pageCount - 1 && downX >= touchX)) {
if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT) {
getParent().requestDisallowInterceptTouchEvent(false);
} else {
if (pageCount > 1) {
setCurrentItem(pageCount - currentItem - 1, isBorderAnimation);
}
getParent().requestDisallowInterceptTouchEvent(true);
}
return super.onTouchEvent(ev);
}
}
getParent().requestDisallowInterceptTouchEvent(true);
return super.onTouchEvent(ev);
}
private class MyHandler extends Handler { | boolean function(MotionEvent ev) { if (stopScrollWhenTouch) { if (ev.getAction() == MotionEvent.ACTION_DOWN && isAutoScroll) { isStopByTouch = true; stopAutoScroll(); } else if (ev.getAction() == MotionEvent.ACTION_UP && isStopByTouch) { startAutoScroll(); } } if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT slideBorderMode == SLIDE_BORDER_MODE_CYCLE) { touchX = ev.getX(); if (ev.getAction() == MotionEvent.ACTION_DOWN) { downX = touchX; } int currentItem = getCurrentItem(); PagerAdapter adapter = getAdapter(); int pageCount = adapter == null ? 0 : adapter.getCount(); if ((currentItem == 0 && downX <= touchX) (currentItem == pageCount - 1 && downX >= touchX)) { if (slideBorderMode == SLIDE_BORDER_MODE_TO_PARENT) { getParent().requestDisallowInterceptTouchEvent(false); } else { if (pageCount > 1) { setCurrentItem(pageCount - currentItem - 1, isBorderAnimation); } getParent().requestDisallowInterceptTouchEvent(true); } return super.onTouchEvent(ev); } } getParent().requestDisallowInterceptTouchEvent(true); return super.onTouchEvent(ev); } private class MyHandler extends Handler { | /**
* <ul>
* if stopScrollWhenTouch is true
* <li>if event is down, stop auto scroll.</li>
* <li>if event is up, start auto scroll again.</li>
* </ul>
*/ | if stopScrollWhenTouch is true if event is down, stop auto scroll. if event is up, start auto scroll again. | onTouchEvent | {
"repo_name": "sunxu3074/BannerWithIndicatorDemo",
"path": "app/src/main/java/io/github/sunxu3074/bannerwithindicator/AutoScrollViewPager.java",
"license": "mit",
"size": 11655
} | [
"android.os.Handler",
"android.support.v4.view.PagerAdapter",
"android.view.MotionEvent"
] | import android.os.Handler; import android.support.v4.view.PagerAdapter; import android.view.MotionEvent; | import android.os.*; import android.support.v4.view.*; import android.view.*; | [
"android.os",
"android.support",
"android.view"
] | android.os; android.support; android.view; | 1,120,996 |
public boolean updateSettings(Map<String, String> updatedSettings) {
return settings.saveSettings(updatedSettings);
}
| boolean function(Map<String, String> updatedSettings) { return settings.saveSettings(updatedSettings); } | /**
* Updates the list of server settings.
*
* @param settings
* @return true if the update succeeded
*/ | Updates the list of server settings | updateSettings | {
"repo_name": "BullShark/IRCBlit",
"path": "src/main/java/com/gitblit/GitBlit.java",
"license": "apache-2.0",
"size": 119961
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,491,059 |
protected String getUser(Exchange exchange) {
String user = getEndpoint().getUser();
if (exchange.getIn().getHeader(JcloudsConstants.USER) != null) {
user = (String) exchange.getIn().getHeader(JcloudsConstants.USER);
}
return user;
} | String function(Exchange exchange) { String user = getEndpoint().getUser(); if (exchange.getIn().getHeader(JcloudsConstants.USER) != null) { user = (String) exchange.getIn().getHeader(JcloudsConstants.USER); } return user; } | /**
* Retrieves the user from the URI or from the exchange headers. The header will take precedence over the URI.
*
* @param exchange
* @return
*/ | Retrieves the user from the URI or from the exchange headers. The header will take precedence over the URI | getUser | {
"repo_name": "aaronwalker/camel",
"path": "components/camel-jclouds/src/main/java/org/apache/camel/component/jclouds/JcloudsComputeProducer.java",
"license": "apache-2.0",
"size": 13637
} | [
"org.apache.camel.Exchange"
] | import org.apache.camel.Exchange; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,587,143 |
public static boolean checkCollatz(long number)
{
// all the odd numbers that were verified to converge
HashSet<Long> checked_numbers = new HashSet<Long>();
for (long i = 2; i <= number; i++)
{
// numbers encountered so far for the given value of i
HashSet<Long> sequence = new HashSet<Long>();
long current = i;
// all numbers up to i already tested
while (current >= i)
{
// the sequence falls into a loop, which is not 4-2-1
if (sequence.contains(current))
{
return false; // never happens :)
}
sequence.add(current);
// current number is odd
if ((current % 2) == 1)
{
// the number was already encountered
if (checked_numbers.contains(current))
{
break;
}
long next = current * 3 + 1;
// the next number is going to bee too big
if (next <= current)
{
throw new ArithmeticException("The number is too big");
}
checked_numbers.add(current);
current = next;
}
//current number is even
else
{
current /= 2;
}
}
}
return true;
} | static boolean function(long number) { HashSet<Long> checked_numbers = new HashSet<Long>(); for (long i = 2; i <= number; i++) { HashSet<Long> sequence = new HashSet<Long>(); long current = i; while (current >= i) { if (sequence.contains(current)) { return false; } sequence.add(current); if ((current % 2) == 1) { if (checked_numbers.contains(current)) { break; } long next = current * 3 + 1; if (next <= current) { throw new ArithmeticException(STR); } checked_numbers.add(current); current = next; } else { current /= 2; } } } return true; } | /**
* Tests the Collatz Conjecture for all numbers up to the specified number
*
* @param number the upper limit
* @return true, if conjecture holds for all the numbers up to the given one, otherwise false
* @throws ArithmeticException if the checked number is too big to be represented
*
* @see <a href="http://en.wikipedia.org/wiki/Collatz_conjecture">Collatz Conjecture</a>
*
* @time <i>Ω(n)</i>
* @space <i>Ω(n)</i>
**/ | Tests the Collatz Conjecture for all numbers up to the specified number | checkCollatz | {
"repo_name": "murick/Algorithms",
"path": "Java/src/main/java/hash/math/collatz/Solution1.java",
"license": "apache-2.0",
"size": 2268
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,291,176 |
public PreparedStatement getPreparedStatement() {
return preparedStmt;
} | PreparedStatement function() { return preparedStmt; } | /**
* Return the {@link PreparedStatement} currently associated with this
* statement.
*
* @return the prepared statement that is associated with this statement
*/ | Return the <code>PreparedStatement</code> currently associated with this statement | getPreparedStatement | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/engine/org/apache/derby/impl/sql/GenericStatement.java",
"license": "apache-2.0",
"size": 25717
} | [
"org.apache.derby.iapi.sql.PreparedStatement"
] | import org.apache.derby.iapi.sql.PreparedStatement; | import org.apache.derby.iapi.sql.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,022,287 |
private void acquire() {
ensureNotClosed();
long threadId = Thread.currentThread().getId();
if (threadId != currentThread.get() && !currentThread.compareAndSet(NO_CURRENT_THREAD, threadId))
throw new ConcurrentModificationException("KafkaConsumer is not safe for multi-threaded access");
refcount.incrementAndGet();
} | void function() { ensureNotClosed(); long threadId = Thread.currentThread().getId(); if (threadId != currentThread.get() && !currentThread.compareAndSet(NO_CURRENT_THREAD, threadId)) throw new ConcurrentModificationException(STR); refcount.incrementAndGet(); } | /**
* Acquire the light lock protecting this consumer from multi-threaded access. Instead of blocking
* when the lock is not available, however, we just throw an exception (since multi-threaded usage is not
* supported).
* @throws IllegalStateException if the consumer has been closed
* @throws ConcurrentModificationException if another thread already has the lock
*/ | Acquire the light lock protecting this consumer from multi-threaded access. Instead of blocking when the lock is not available, however, we just throw an exception (since multi-threaded usage is not supported) | acquire | {
"repo_name": "tempbottle/kafka",
"path": "clients/src/main/java/org/apache/kafka/clients/consumer/KafkaConsumer.java",
"license": "apache-2.0",
"size": 57754
} | [
"java.util.ConcurrentModificationException"
] | import java.util.ConcurrentModificationException; | import java.util.*; | [
"java.util"
] | java.util; | 982,653 |
void next(Long minPosition, final Callback<TimelineResult<T>> cb); | void next(Long minPosition, final Callback<TimelineResult<T>> cb); | /**
* Loads items with position greater than (above) minPosition. If minPosition is null, loads
* the newest items.
* @param minPosition minimum position of the items to load (exclusive).
* @param cb callback.
*/ | Loads items with position greater than (above) minPosition. If minPosition is null, loads the newest items | next | {
"repo_name": "twitter/twitter-kit-android",
"path": "tweet-ui/src/main/java/com/twitter/sdk/android/tweetui/Timeline.java",
"license": "apache-2.0",
"size": 1428
} | [
"com.twitter.sdk.android.core.Callback"
] | import com.twitter.sdk.android.core.Callback; | import com.twitter.sdk.android.core.*; | [
"com.twitter.sdk"
] | com.twitter.sdk; | 2,567,438 |
public void copyFolder(Long userId, Long folderId, Long destId, String destName)
throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException; | void function(Long userId, Long folderId, Long destId, String destName) throws ObjectNotFoundException, DuplicateNameException, InsufficientPermissionsException; | /**
* Copy the provided folder to the specified destination.
*
* @param userId the ID of the current user
* @param folderId the IF of the provided folder
* @param destId the ID of the destination folder
* @param destName the name of the new folder
* @throws ObjectNotFoundException if the user, folder or destination was not
* found, with the exception message mentioning the precise problem
* @throws DuplicateNameException if the specified name already exists in
* the destination folder, as either a folder or file
* @throws InsufficientPermissionsException InsufficientPermissionsException
* if the user does not have the appropriate privileges
*/ | Copy the provided folder to the specified destination | copyFolder | {
"repo_name": "andrewbissada/gss",
"path": "src/org/gss_project/gss/server/ejb/ExternalAPI.java",
"license": "gpl-3.0",
"size": 50977
} | [
"org.gss_project.gss.common.exceptions.DuplicateNameException",
"org.gss_project.gss.common.exceptions.InsufficientPermissionsException",
"org.gss_project.gss.common.exceptions.ObjectNotFoundException"
] | import org.gss_project.gss.common.exceptions.DuplicateNameException; import org.gss_project.gss.common.exceptions.InsufficientPermissionsException; import org.gss_project.gss.common.exceptions.ObjectNotFoundException; | import org.gss_project.gss.common.exceptions.*; | [
"org.gss_project.gss"
] | org.gss_project.gss; | 2,343,995 |
@Test
public void getMaximum() {
TestCase.assertEquals(19, (int) tree.getMaximum());
BinarySearchTree<Integer>.Node node = tree.get(-3);
TestCase.assertEquals(-1, (int) tree.getMaximum(node).comparable);
node = tree.get(6);
TestCase.assertEquals(9, (int) tree.getMaximum(node).comparable);
}
| void function() { TestCase.assertEquals(19, (int) tree.getMaximum()); BinarySearchTree<Integer>.Node node = tree.get(-3); TestCase.assertEquals(-1, (int) tree.getMaximum(node).comparable); node = tree.get(6); TestCase.assertEquals(9, (int) tree.getMaximum(node).comparable); } | /**
* Tests the getMaximum methods.
*/ | Tests the getMaximum methods | getMaximum | {
"repo_name": "satishbabusee/dyn4j",
"path": "junit/org/dyn4j/BalancedBinarySearchTreeTest.java",
"license": "bsd-3-clause",
"size": 8526
} | [
"junit.framework.TestCase",
"org.dyn4j.BinarySearchTree"
] | import junit.framework.TestCase; import org.dyn4j.BinarySearchTree; | import junit.framework.*; import org.dyn4j.*; | [
"junit.framework",
"org.dyn4j"
] | junit.framework; org.dyn4j; | 1,180,370 |
private void setupLocale(OptionsParam options) {
// Prompt for language if not set
String locale = options.getViewParam().getConfigLocale();
if (locale == null || locale.length() == 0) {
// Dont use a parent of the MainFrame - that will initialise it
// with English!
final Locale userloc = determineUsersSystemLocale();
if (userloc == null) {
// Only show the dialog, when the user's language can't be
// guessed.
setDefaultViewLocale(Constant.getSystemsLocale());
final LocaleDialog dialog = new LocaleDialog(null, true);
dialog.init(options);
dialog.setVisible(true);
} else {
options.getViewParam().setLocale(userloc);
}
setDefaultViewLocale(createLocale(options.getViewParam().getLocale().split("_")));
Constant.setLocale(Model.getSingleton().getOptionsParam().getViewParam().getLocale());
try {
options.getViewParam().getConfig().save();
} catch (ConfigurationException e) {
logger.warn("Failed to save locale: ", e);
}
}
} | void function(OptionsParam options) { String locale = options.getViewParam().getConfigLocale(); if (locale == null locale.length() == 0) { final Locale userloc = determineUsersSystemLocale(); if (userloc == null) { setDefaultViewLocale(Constant.getSystemsLocale()); final LocaleDialog dialog = new LocaleDialog(null, true); dialog.init(options); dialog.setVisible(true); } else { options.getViewParam().setLocale(userloc); } setDefaultViewLocale(createLocale(options.getViewParam().getLocale().split("_"))); Constant.setLocale(Model.getSingleton().getOptionsParam().getViewParam().getLocale()); try { options.getViewParam().getConfig().save(); } catch (ConfigurationException e) { logger.warn(STR, e); } } } | /**
* Setups ZAP's and GUI {@code Locale}, if not previously defined. Otherwise it's determined automatically or, if not
* possible, by asking the user to choose one of the supported locales.
*
* @param options ZAP's options, used to check if a locale was already defined and save it if not.
* @see #setDefaultViewLocale(Locale)
* @see Constant#setLocale(String)
*/ | Setups ZAP's and GUI Locale, if not previously defined. Otherwise it's determined automatically or, if not possible, by asking the user to choose one of the supported locales | setupLocale | {
"repo_name": "GillesMoris/OSS",
"path": "src/org/zaproxy/zap/GuiBootstrap.java",
"license": "apache-2.0",
"size": 20631
} | [
"java.util.Locale",
"org.apache.commons.configuration.ConfigurationException",
"org.parosproxy.paros.Constant",
"org.parosproxy.paros.model.Model",
"org.parosproxy.paros.model.OptionsParam",
"org.zaproxy.zap.view.LocaleDialog"
] | import java.util.Locale; import org.apache.commons.configuration.ConfigurationException; import org.parosproxy.paros.Constant; import org.parosproxy.paros.model.Model; import org.parosproxy.paros.model.OptionsParam; import org.zaproxy.zap.view.LocaleDialog; | import java.util.*; import org.apache.commons.configuration.*; import org.parosproxy.paros.*; import org.parosproxy.paros.model.*; import org.zaproxy.zap.view.*; | [
"java.util",
"org.apache.commons",
"org.parosproxy.paros",
"org.zaproxy.zap"
] | java.util; org.apache.commons; org.parosproxy.paros; org.zaproxy.zap; | 1,946,169 |
public void testFindByDescription() {
String testName = "findByDescription";
if (logger.isInfoEnabled()) {
logger.info("\n\t\tRunning Test: " + testName);
}
String desc = "MiN";
ItemDefinition result = getFixture().findByDescription(desc);
// verify
assertTrue(result != null);
assertTrue(result.getDescription().equalsIgnoreCase(desc));
if (logger.isInfoEnabled()) {
logger.info(testName + " verified type:" + desc);
}
}
}
/*
* $CPS$ This comment was generated by CodePro. Do not edit it. patternId =
* com.instantiations.assist.eclipse.pattern.testCasePattern strategyId =
* com.instantiations.assist.eclipse.pattern.testCasePattern.junitTestCase additionalTestNames =
* assertTrue = false callTestMethod = true createMain = false createSetUp = false createTearDown =
* false createTestFixture = true createTestStubs = true methods = package =
* org.cipres.treebase.dao.matrix package.sourceFolder = treebase-core/src/test/java superclassType =
* junit.framework.TestCase testCase = ItemDefinitionDAOTest testClassType =
* org.cipres.treebase.dao.matrix.ItemDefinitionDAO
| void function() { String testName = STR; if (logger.isInfoEnabled()) { logger.info(STR + testName); } String desc = "MiN"; ItemDefinition result = getFixture().findByDescription(desc); assertTrue(result != null); assertTrue(result.getDescription().equalsIgnoreCase(desc)); if (logger.isInfoEnabled()) { logger.info(testName + STR + desc); } } } /* * $CPS$ This comment was generated by CodePro. Do not edit it. patternId = * com.instantiations.assist.eclipse.pattern.testCasePattern strategyId = * com.instantiations.assist.eclipse.pattern.testCasePattern.junitTestCase additionalTestNames = * assertTrue = false callTestMethod = true createMain = false createSetUp = false createTearDown = * false createTestFixture = true createTestStubs = true methods = package = * org.cipres.treebase.dao.matrix package.sourceFolder = treebase-core/src/test/java superclassType = * junit.framework.TestCase testCase = ItemDefinitionDAOTest testClassType = * org.cipres.treebase.dao.matrix.ItemDefinitionDAO | /**
* Run the ItemDefinition findByDescription(String) method test
*/ | Run the ItemDefinition findByDescription(String) method test | testFindByDescription | {
"repo_name": "TreeBASE/treebasetest",
"path": "treebase-core/src/test/java/org/cipres/treebase/dao/matrix/ItemDefinitionDAOTest.java",
"license": "bsd-3-clause",
"size": 2823
} | [
"org.cipres.treebase.domain.matrix.ItemDefinition"
] | import org.cipres.treebase.domain.matrix.ItemDefinition; | import org.cipres.treebase.domain.matrix.*; | [
"org.cipres.treebase"
] | org.cipres.treebase; | 2,765,884 |
@TargetApi(19)
public static int getBitmapSize(BitmapDrawable value) {
Bitmap bitmap = value.getBitmap();
// From KitKat onward use getAllocationByteCount() as allocated bytes
// can potentially be
// larger than bitmap byte count.
// if (Utils.hasKitKat()) {
// return bitmap.getAllocationByteCount();
// }
if (Utils.hasHoneycombMR1()) {
return bitmap.getByteCount();
}
// Pre HC-MR1
return bitmap.getRowBytes() * bitmap.getHeight();
} | @TargetApi(19) static int function(BitmapDrawable value) { Bitmap bitmap = value.getBitmap(); if (Utils.hasHoneycombMR1()) { return bitmap.getByteCount(); } return bitmap.getRowBytes() * bitmap.getHeight(); } | /**
* Get the size in bytes of a bitmap in a BitmapDrawable. Note that from
* Android 4.4 (KitKat) onward this returns the allocated memory size of the
* bitmap which can be larger than the actual bitmap data byte count (in the
* case it was re-used).
*
* @param value
* @return size in bytes
*/ | Get the size in bytes of a bitmap in a BitmapDrawable. Note that from Android 4.4 (KitKat) onward this returns the allocated memory size of the bitmap which can be larger than the actual bitmap data byte count (in the case it was re-used) | getBitmapSize | {
"repo_name": "zhenyue007/Decrypt-The-Stranger",
"path": "src/com/zgsc/jmmsr/video/util/ImageCache.java",
"license": "gpl-2.0",
"size": 17547
} | [
"android.annotation.TargetApi",
"android.graphics.Bitmap",
"android.graphics.drawable.BitmapDrawable"
] | import android.annotation.TargetApi; import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; | import android.annotation.*; import android.graphics.*; import android.graphics.drawable.*; | [
"android.annotation",
"android.graphics"
] | android.annotation; android.graphics; | 2,061,481 |
public boolean deleteFile(String filename) throws IOException {
ElementDescriptor elem = pigContext.getDfs().asElement(filename);
elem.delete();
return true;
} | boolean function(String filename) throws IOException { ElementDescriptor elem = pigContext.getDfs().asElement(filename); elem.delete(); return true; } | /**
* Delete a file.
* @param filename to delete
* @return true
* @throws IOException
*/ | Delete a file | deleteFile | {
"repo_name": "twitter/pig",
"path": "src/org/apache/pig/PigServer.java",
"license": "apache-2.0",
"size": 70320
} | [
"java.io.IOException",
"org.apache.pig.backend.datastorage.ElementDescriptor"
] | import java.io.IOException; import org.apache.pig.backend.datastorage.ElementDescriptor; | import java.io.*; import org.apache.pig.backend.datastorage.*; | [
"java.io",
"org.apache.pig"
] | java.io; org.apache.pig; | 1,619,244 |
protected Signal<?, ?, ?> signal() {
return signal;
} | Signal<?, ?, ?> function() { return signal; } | /**
* Obtains the processed signal.
*/ | Obtains the processed signal | signal | {
"repo_name": "SpineEventEngine/gae-java",
"path": "stackdriver-trace/src/main/java/io/spine/server/trace/stackdriver/SignalSpan.java",
"license": "apache-2.0",
"size": 7569
} | [
"io.spine.core.Signal"
] | import io.spine.core.Signal; | import io.spine.core.*; | [
"io.spine.core"
] | io.spine.core; | 983,834 |
return EditorDataHolder
.getInstance()
.getClientBuilderService()
.build(username, password, CLIENT_CONNECTION_TIMEOUT, CLIENT_READ_TIMEOUT,
SiddhiStoreQueryServiceStub.class, url);
} | return EditorDataHolder .getInstance() .getClientBuilderService() .build(username, password, CLIENT_CONNECTION_TIMEOUT, CLIENT_READ_TIMEOUT, SiddhiStoreQueryServiceStub.class, url); } | /**
* Returns an HTTP client for executing Siddhi store queries.
*
* @param url HTTP URL of the Store API
* @param username Username
* @param password Password
* @return SiddhiStoreQueryServiceStub instance which acts as the HTTPS client
*/ | Returns an HTTP client for executing Siddhi store queries | getStoreQueryHTTPClient | {
"repo_name": "wso2/carbon-analytics",
"path": "components/org.wso2.carbon.siddhi.editor.core/src/main/java/org/wso2/carbon/siddhi/editor/core/util/restclients/storequery/SiddhiStoreQueryClientFactory.java",
"license": "apache-2.0",
"size": 1887
} | [
"org.wso2.carbon.siddhi.editor.core.internal.EditorDataHolder"
] | import org.wso2.carbon.siddhi.editor.core.internal.EditorDataHolder; | import org.wso2.carbon.siddhi.editor.core.internal.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,896,424 |
public void setTrackLengthm(long logid, double length) throws IOException; | void function(long logid, double length) throws IOException; | /**
* Re-sets the log (track) length.
*
* @param logid the log to change.
* @param length the length of the track log
* @throws IOException if something goes wrong.
*/ | Re-sets the log (track) length | setTrackLengthm | {
"repo_name": "tghoward/geopaparazzi",
"path": "geopaparazzilibrary/src/main/java/eu/geopaparazzi/library/database/IGpsLogDbHelper.java",
"license": "gpl-3.0",
"size": 3691
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,701,661 |
@Override
protected AndroidTestRunner getAndroidTestRunner() {
return androidTestRunner;
}
/**
* {@inheritDoc} | AndroidTestRunner function() { return androidTestRunner; } /** * {@inheritDoc} | /**
* Returns an {@link AndroidTestRunner} that is shared by this and super, such
* that we can add custom {@link TestListener}s.
*/ | Returns an <code>AndroidTestRunner</code> that is shared by this and super, such that we can add custom <code>TestListener</code>s | getAndroidTestRunner | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "external/droiddriver/src/com/google/android/droiddriver/runner/TestRunner.java",
"license": "gpl-3.0",
"size": 6715
} | [
"android.test.AndroidTestRunner"
] | import android.test.AndroidTestRunner; | import android.test.*; | [
"android.test"
] | android.test; | 1,050,888 |
public static <T> T getFieldValue(Object obj, Class cls, String fieldName) throws IgniteException {
assert obj != null;
assert fieldName != null;
try {
return (T)findField(cls, obj, fieldName);
}
catch (NoSuchFieldException | IllegalAccessException e) {
throw new IgniteException("Failed to get object field [obj=" + obj +
", fieldName=" + fieldName + ']', e);
}
} | static <T> T function(Object obj, Class cls, String fieldName) throws IgniteException { assert obj != null; assert fieldName != null; try { return (T)findField(cls, obj, fieldName); } catch (NoSuchFieldException IllegalAccessException e) { throw new IgniteException(STR + obj + STR + fieldName + ']', e); } } | /**
* Get object field value via reflection.
*
* @param obj Object or class to get field value from.
* @param cls Class.
* @param fieldName Field names to get value for.
* @param <T> Expected field class.
* @return Field value.
* @throws IgniteException In case of error.
*/ | Get object field value via reflection | getFieldValue | {
"repo_name": "BiryukovVA/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java",
"license": "apache-2.0",
"size": 69848
} | [
"org.apache.ignite.IgniteException"
] | import org.apache.ignite.IgniteException; | import org.apache.ignite.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 14,886 |
@Override
public void generateError(String response) {
final String errorInString = extractParameter(response, ERROR_REGEX_PATTERN, true);
final String errorDescription = extractParameter(response, ERROR_DESCRIPTION_REGEX_PATTERN, false);
OAuth2Error errorCode;
try {
errorCode = OAuth2Error.parseFrom(errorInString);
} catch (IllegalArgumentException iaE) {
//non oauth standard error code
errorCode = null;
}
throw new OAuth2AccessTokenErrorResponse(errorCode, errorDescription, null, response);
} | void function(String response) { final String errorInString = extractParameter(response, ERROR_REGEX_PATTERN, true); final String errorDescription = extractParameter(response, ERROR_DESCRIPTION_REGEX_PATTERN, false); OAuth2Error errorCode; try { errorCode = OAuth2Error.parseFrom(errorInString); } catch (IllegalArgumentException iaE) { errorCode = null; } throw new OAuth2AccessTokenErrorResponse(errorCode, errorDescription, null, response); } | /**
* Related documentation: https://dev.fitbit.com/build/reference/web-api/oauth2/
*/ | Related documentation: HREF | generateError | {
"repo_name": "fernandezpablo85/scribe-java",
"path": "scribejava-apis/src/main/java/com/github/scribejava/apis/fitbit/FitBitJsonTokenExtractor.java",
"license": "mit",
"size": 2087
} | [
"com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse",
"com.github.scribejava.core.oauth2.OAuth2Error"
] | import com.github.scribejava.core.model.OAuth2AccessTokenErrorResponse; import com.github.scribejava.core.oauth2.OAuth2Error; | import com.github.scribejava.core.model.*; import com.github.scribejava.core.oauth2.*; | [
"com.github.scribejava"
] | com.github.scribejava; | 1,442,329 |
Pair<DataBuffer, int[]> createShapeInformation(int[] shape); | Pair<DataBuffer, int[]> createShapeInformation(int[] shape); | /**
* This method creates shapeInformation buffer, based on shape being passed in
* @param shape
* @return
*/ | This method creates shapeInformation buffer, based on shape being passed in | createShapeInformation | {
"repo_name": "smarthi/nd4j",
"path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/ShapeInfoProvider.java",
"license": "apache-2.0",
"size": 1171
} | [
"org.nd4j.linalg.api.buffer.DataBuffer",
"org.nd4j.linalg.primitives.Pair"
] | import org.nd4j.linalg.api.buffer.DataBuffer; import org.nd4j.linalg.primitives.Pair; | import org.nd4j.linalg.api.buffer.*; import org.nd4j.linalg.primitives.*; | [
"org.nd4j.linalg"
] | org.nd4j.linalg; | 1,370,334 |
private int checkBackEdges(Map<Edge, PackColor> edges)
{
Set<Edge> keys = edges.keySet();
for (final Edge key : keys)
{
PackColor color = edges.get(key);
if (color == PackColor.GREY)
{
return -2;
}
}
return 0;
}
private class Edge
{
PackInfo u;
PackInfo v;
Edge(PackInfo u, PackInfo v)
{
this.u = u;
this.v = v;
}
} | int function(Map<Edge, PackColor> edges) { Set<Edge> keys = edges.keySet(); for (final Edge key : keys) { PackColor color = edges.get(key); if (color == PackColor.GREY) { return -2; } } return 0; } private class Edge { PackInfo u; PackInfo v; Edge(PackInfo u, PackInfo v) { this.u = u; this.v = v; } } | /**
* This function checks for the existence of back edges.
*
* @param edges map to be checked
* @return -2 if back edges exist, else 0
*/ | This function checks for the existence of back edges | checkBackEdges | {
"repo_name": "codehaus/izpack",
"path": "izpack-compiler/src/main/java/com/izforge/izpack/compiler/Compiler.java",
"license": "apache-2.0",
"size": 11528
} | [
"com.izforge.izpack.api.data.PackColor",
"com.izforge.izpack.data.PackInfo",
"java.util.Map",
"java.util.Set"
] | import com.izforge.izpack.api.data.PackColor; import com.izforge.izpack.data.PackInfo; import java.util.Map; import java.util.Set; | import com.izforge.izpack.api.data.*; import com.izforge.izpack.data.*; import java.util.*; | [
"com.izforge.izpack",
"java.util"
] | com.izforge.izpack; java.util; | 1,847,448 |
public PortletConfig getPortletConfig() {
VaadinPortletResponse response = (VaadinPortletResponse) CurrentInstance
.get(VaadinResponse.class);
return response.getService().getPortlet().getPortletConfig();
} | PortletConfig function() { VaadinPortletResponse response = (VaadinPortletResponse) CurrentInstance .get(VaadinResponse.class); return response.getService().getPortlet().getPortletConfig(); } | /**
* Returns the JSR-286 portlet configuration that provides access to the
* portlet context and init parameters.
*
* @return portlet configuration
*/ | Returns the JSR-286 portlet configuration that provides access to the portlet context and init parameters | getPortletConfig | {
"repo_name": "peterl1084/framework",
"path": "server/src/main/java/com/vaadin/server/VaadinPortletSession.java",
"license": "apache-2.0",
"size": 15564
} | [
"com.vaadin.util.CurrentInstance",
"javax.portlet.PortletConfig"
] | import com.vaadin.util.CurrentInstance; import javax.portlet.PortletConfig; | import com.vaadin.util.*; import javax.portlet.*; | [
"com.vaadin.util",
"javax.portlet"
] | com.vaadin.util; javax.portlet; | 529,227 |
JSimpleDB getJSimpleDB(); | JSimpleDB getJSimpleDB(); | /**
* Get the {@link JSimpleDB}.
*
* @return configured database
*/ | Get the <code>JSimpleDB</code> | getJSimpleDB | {
"repo_name": "mmayorivera/jsimpledb",
"path": "src/java/org/jsimpledb/gui/GUIConfig.java",
"license": "apache-2.0",
"size": 1345
} | [
"org.jsimpledb.JSimpleDB"
] | import org.jsimpledb.JSimpleDB; | import org.jsimpledb.*; | [
"org.jsimpledb"
] | org.jsimpledb; | 1,953,153 |
public void addLayoutIdentifier(Set<String> identifier) {
this.layoutIdentifiers.add(identifier);
} | void function(Set<String> identifier) { this.layoutIdentifiers.add(identifier); } | /**
* Adds a set of androidIDs as an identifier for this layout
* @param identifier set of "android:id" values to identify this layout
*/ | Adds a set of androidIDs as an identifier for this layout | addLayoutIdentifier | {
"repo_name": "simonlang7/coastdove-core",
"path": "app/src/main/java/simonlang/coastdove/core/detection/LayoutIdentification.java",
"license": "gpl-3.0",
"size": 4591
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,313,353 |
public static Sprite createSprite(Vector2d position, ImageResource res, String animationKey, Map<String, List<Box2d>> frames) {
Sprite s = createSprite(position, res, animationKey);
s.setFrames(frames);
return s;
}
| static Sprite function(Vector2d position, ImageResource res, String animationKey, Map<String, List<Box2d>> frames) { Sprite s = createSprite(position, res, animationKey); s.setFrames(frames); return s; } | /**
* Create a sprite shape.
* @param position The initial position
* @param res The image resource to use for the sprite frames
* @param animationKey The initial animation key
* @param frames Definition of the animation sequences using croping boxes on the given image
* @return A sprite object
* @see Sprite
*/ | Create a sprite shape | createSprite | {
"repo_name": "SkyCrawl/pikater-vaadin",
"path": "src/net/edzard/kinetic/Kinetic.java",
"license": "apache-2.0",
"size": 24816
} | [
"com.google.gwt.resources.client.ImageResource",
"java.util.List",
"java.util.Map"
] | import com.google.gwt.resources.client.ImageResource; import java.util.List; import java.util.Map; | import com.google.gwt.resources.client.*; import java.util.*; | [
"com.google.gwt",
"java.util"
] | com.google.gwt; java.util; | 1,316,482 |
@TargetApi(11)
public void setNavigationBarAlpha(float alpha) {
if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mNavBarTintView.setAlpha(alpha);
}
} | @TargetApi(11) void function(float alpha) { if (mNavBarAvailable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { mNavBarTintView.setAlpha(alpha); } } | /**
* Apply the specified alpha to the system navigation bar.
*
* @param alpha The alpha to use
*/ | Apply the specified alpha to the system navigation bar | setNavigationBarAlpha | {
"repo_name": "danzi638/ReadilyExpressDemo",
"path": "app/src/main/java/com/example/jiayin/readilyexpressdemo/utils/SystemBarTintManager.java",
"license": "apache-2.0",
"size": 19965
} | [
"android.annotation.TargetApi",
"android.os.Build"
] | import android.annotation.TargetApi; import android.os.Build; | import android.annotation.*; import android.os.*; | [
"android.annotation",
"android.os"
] | android.annotation; android.os; | 588,548 |
public synchronized Client getClient(Configuration conf, SocketFactory factory) {
return this.getClient(conf, factory, ObjectWritable.class);
} | synchronized Client function(Configuration conf, SocketFactory factory) { return this.getClient(conf, factory, ObjectWritable.class); } | /**
* Construct & cache an IPC client with the user-provided SocketFactory
* if no cached client exists. Default response type is ObjectWritable.
*
* @param conf Configuration
* @param factory SocketFactory for client socket
* @return an IPC client
*/ | Construct & cache an IPC client with the user-provided SocketFactory if no cached client exists. Default response type is ObjectWritable | getClient | {
"repo_name": "apurtell/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/ClientCache.java",
"license": "apache-2.0",
"size": 4299
} | [
"javax.net.SocketFactory",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.io.ObjectWritable"
] | import javax.net.SocketFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.ObjectWritable; | import javax.net.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; | [
"javax.net",
"org.apache.hadoop"
] | javax.net; org.apache.hadoop; | 1,152,004 |
protected void renderBookmarkTree(BookmarkData bookmarks) {
assert this.bookmarkTree == null;
if (!hasDocumentNavigation()) {
return;
}
this.bookmarkTree = new BookmarkTree();
for (int i = 0; i < bookmarks.getCount(); i++) {
BookmarkData ext = bookmarks.getSubData(i);
Bookmark b = renderBookmarkItem(ext);
bookmarkTree.addBookmark(b);
}
} | void function(BookmarkData bookmarks) { assert this.bookmarkTree == null; if (!hasDocumentNavigation()) { return; } this.bookmarkTree = new BookmarkTree(); for (int i = 0; i < bookmarks.getCount(); i++) { BookmarkData ext = bookmarks.getSubData(i); Bookmark b = renderBookmarkItem(ext); bookmarkTree.addBookmark(b); } } | /**
* Renders a Bookmark-Tree object
* @param bookmarks the BookmarkData object containing all the Bookmark-Items
*/ | Renders a Bookmark-Tree object | renderBookmarkTree | {
"repo_name": "apache/fop",
"path": "fop-core/src/main/java/org/apache/fop/render/intermediate/IFRenderer.java",
"license": "apache-2.0",
"size": 55087
} | [
"org.apache.fop.area.BookmarkData",
"org.apache.fop.render.intermediate.extensions.Bookmark",
"org.apache.fop.render.intermediate.extensions.BookmarkTree"
] | import org.apache.fop.area.BookmarkData; import org.apache.fop.render.intermediate.extensions.Bookmark; import org.apache.fop.render.intermediate.extensions.BookmarkTree; | import org.apache.fop.area.*; import org.apache.fop.render.intermediate.extensions.*; | [
"org.apache.fop"
] | org.apache.fop; | 2,231,264 |
@Test(expected = NoItemException.class)
public void whenTrackerHasZeroItemsAndUserChoiceFindAllThenReturnNoItemException() {
Tracker tracker = new Tracker();
Input input = new StubInput(new ArrayList<String>(Arrays.asList("1", "8")));
new StartUI(tracker, input).init();
tracker.findAll();
} | @Test(expected = NoItemException.class) void function() { Tracker tracker = new Tracker(); Input input = new StubInput(new ArrayList<String>(Arrays.asList("1", "8"))); new StartUI(tracker, input).init(); tracker.findAll(); } | /**
* Test NoItemException in findAll method.
*/ | Test NoItemException in findAll method | whenTrackerHasZeroItemsAndUserChoiceFindAllThenReturnNoItemException | {
"repo_name": "DartSicon/avolodin",
"path": "chapter_002/src/test/java/ru/job4j/tracker/start/StubInputTest.java",
"license": "apache-2.0",
"size": 6989
} | [
"java.util.ArrayList",
"java.util.Arrays",
"org.junit.Test",
"ru.job4j.tracker.exceptions.NoItemException"
] | import java.util.ArrayList; import java.util.Arrays; import org.junit.Test; import ru.job4j.tracker.exceptions.NoItemException; | import java.util.*; import org.junit.*; import ru.job4j.tracker.exceptions.*; | [
"java.util",
"org.junit",
"ru.job4j.tracker"
] | java.util; org.junit; ru.job4j.tracker; | 518,784 |
public CmsFormatterChangeSet getFormatterChangeSet() {
return m_formatterChangeSet;
} | CmsFormatterChangeSet function() { return m_formatterChangeSet; } | /**
* Gets the formatter change set.<p>
*
* @return the formatter change set.<p>
*/ | Gets the formatter change set | getFormatterChangeSet | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/ade/configuration/CmsADEConfigDataInternal.java",
"license": "lgpl-2.1",
"size": 27876
} | [
"org.opencms.ade.configuration.formatters.CmsFormatterChangeSet"
] | import org.opencms.ade.configuration.formatters.CmsFormatterChangeSet; | import org.opencms.ade.configuration.formatters.*; | [
"org.opencms.ade"
] | org.opencms.ade; | 2,313,532 |
private Socks4Message socksReadReply() throws IOException {
Socks4Message reply = new Socks4Message();
int bytesRead = 0;
while (bytesRead < Socks4Message.REPLY_LENGTH) {
int count = getInputStream().read(reply.getBytes(), bytesRead,
Socks4Message.REPLY_LENGTH - bytesRead);
if (-1 == count) {
break;
}
bytesRead += count;
}
if (Socks4Message.REPLY_LENGTH != bytesRead) {
throw new SocketException(Messages.getString("luni.10")); //$NON-NLS-1$
}
return reply;
}
| Socks4Message function() throws IOException { Socks4Message reply = new Socks4Message(); int bytesRead = 0; while (bytesRead < Socks4Message.REPLY_LENGTH) { int count = getInputStream().read(reply.getBytes(), bytesRead, Socks4Message.REPLY_LENGTH - bytesRead); if (-1 == count) { break; } bytesRead += count; } if (Socks4Message.REPLY_LENGTH != bytesRead) { throw new SocketException(Messages.getString(STR)); } return reply; } | /**
* Read a SOCKS V4 reply.
*/ | Read a SOCKS V4 reply | socksReadReply | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/luni/src/main/java/org/apache/harmony/luni/net/PlainSocketImpl.java",
"license": "gpl-2.0",
"size": 20038
} | [
"java.io.IOException",
"java.net.SocketException",
"org.apache.harmony.luni.internal.nls.Messages"
] | import java.io.IOException; import java.net.SocketException; import org.apache.harmony.luni.internal.nls.Messages; | import java.io.*; import java.net.*; import org.apache.harmony.luni.internal.nls.*; | [
"java.io",
"java.net",
"org.apache.harmony"
] | java.io; java.net; org.apache.harmony; | 1,384,742 |
public static CasualtyDetails selectCasualties(
final PlayerId player,
final Collection<Unit> targetsToPickFrom,
final Collection<Unit> friendlyUnits,
final Collection<Unit> enemyUnits,
final boolean amphibious,
final Collection<Unit> amphibiousLandAttackers,
final Territory battlesite,
final Collection<TerritoryEffect> territoryEffects,
final IDelegateBridge bridge,
final String text,
final DiceRoll dice,
final boolean defending,
final UUID battleId,
final boolean headLess,
final int extraHits,
final boolean allowMultipleHitsPerUnit) {
if (targetsToPickFrom.isEmpty()) {
return new CasualtyDetails();
}
if (!friendlyUnits.containsAll(targetsToPickFrom)) {
throw new IllegalStateException(
"friendlyUnits should but does not contain all units from targetsToPickFrom");
}
final GameData data = bridge.getData();
final boolean isEditMode = BaseEditDelegate.getEditMode(data);
final Player tripleaPlayer =
player.isNull() ? new WeakAi(player.getName()) : bridge.getRemotePlayer(player);
final Map<Unit, Collection<Unit>> dependents =
headLess ? Collections.emptyMap() : getDependents(targetsToPickFrom);
if (isEditMode && !headLess) {
final CasualtyDetails editSelection =
tripleaPlayer.selectCasualties(
targetsToPickFrom,
dependents,
0,
text,
dice,
player,
friendlyUnits,
enemyUnits,
amphibious,
amphibiousLandAttackers,
new CasualtyList(),
battleId,
battlesite,
allowMultipleHitsPerUnit);
final List<Unit> killed = editSelection.getKilled();
// if partial retreat is possible, kill amphibious units first
if (isPartialAmphibiousRetreat(data)) {
killAmphibiousFirst(killed, targetsToPickFrom);
}
return editSelection;
}
if (dice.getHits() == 0) {
return new CasualtyDetails(Collections.emptyList(), Collections.emptyList(), true);
}
int hitsRemaining = dice.getHits();
if (isTransportCasualtiesRestricted(data)) {
hitsRemaining = extraHits;
}
if (!isEditMode && allTargetsOneTypeOneHitPoint(targetsToPickFrom, dependents)) {
final List<Unit> killed = new ArrayList<>();
final Iterator<Unit> iter = targetsToPickFrom.iterator();
for (int i = 0; i < hitsRemaining; i++) {
if (i >= targetsToPickFrom.size()) {
break;
}
killed.add(iter.next());
}
return new CasualtyDetails(killed, Collections.emptyList(), true);
}
// Create production cost map, Maybe should do this elsewhere, but in case prices change, we do
// it here.
final IntegerMap<UnitType> costs = TuvUtils.getCostsForTuv(player, data);
final Tuple<CasualtyList, List<Unit>> defaultCasualtiesAndSortedTargets =
getDefaultCasualties(
targetsToPickFrom,
hitsRemaining,
defending,
player,
enemyUnits,
amphibious,
amphibiousLandAttackers,
battlesite,
costs,
territoryEffects,
data,
allowMultipleHitsPerUnit);
final CasualtyList defaultCasualties = defaultCasualtiesAndSortedTargets.getFirst();
final List<Unit> sortedTargetsToPickFrom = defaultCasualtiesAndSortedTargets.getSecond();
if (sortedTargetsToPickFrom.size() != targetsToPickFrom.size()
|| !targetsToPickFrom.containsAll(sortedTargetsToPickFrom)
|| !sortedTargetsToPickFrom.containsAll(targetsToPickFrom)) {
throw new IllegalStateException(
"sortedTargetsToPickFrom must contain the same units as targetsToPickFrom list");
}
final int totalHitpoints =
(allowMultipleHitsPerUnit
? getTotalHitpointsLeft(sortedTargetsToPickFrom)
: sortedTargetsToPickFrom.size());
final CasualtyDetails casualtySelection;
if (hitsRemaining >= totalHitpoints) {
casualtySelection = new CasualtyDetails(defaultCasualties, true);
} else {
casualtySelection =
tripleaPlayer.selectCasualties(
sortedTargetsToPickFrom,
dependents,
hitsRemaining,
text,
dice,
player,
friendlyUnits,
enemyUnits,
amphibious,
amphibiousLandAttackers,
defaultCasualties,
battleId,
battlesite,
allowMultipleHitsPerUnit);
}
final List<Unit> killed = casualtySelection.getKilled();
// if partial retreat is possible, kill amphibious units first
if (isPartialAmphibiousRetreat(data)) {
killAmphibiousFirst(killed, sortedTargetsToPickFrom);
}
final List<Unit> damaged = casualtySelection.getDamaged();
int numhits = killed.size();
if (!allowMultipleHitsPerUnit) {
damaged.clear();
} else {
for (final Unit unit : killed) {
final UnitAttachment ua = UnitAttachment.get(unit.getType());
final int damageToUnit = Collections.frequency(damaged, unit);
// allowed damage
numhits += Math.max(0, Math.min(damageToUnit, (ua.getHitPoints() - (1 + unit.getHits()))));
// remove from damaged list, since they will die
damaged.removeIf(unit::equals);
}
}
// check right number
if (!isEditMode && numhits + damaged.size() != Math.min(hitsRemaining, totalHitpoints)) {
tripleaPlayer.reportError("Wrong number of casualties selected");
if (headLess) {
log.severe(
"Possible Infinite Loop: Wrong number of casualties selected: number of hits on units "
+ (numhits + damaged.size())
+ " != number of hits to take "
+ Math.min(hitsRemaining, totalHitpoints)
+ ", for "
+ casualtySelection.toString());
}
return selectCasualties(
player,
sortedTargetsToPickFrom,
friendlyUnits,
enemyUnits,
amphibious,
amphibiousLandAttackers,
battlesite,
territoryEffects,
bridge,
text,
dice,
defending,
battleId,
headLess,
extraHits,
allowMultipleHitsPerUnit);
}
// check we have enough of each type
if (!sortedTargetsToPickFrom.containsAll(killed)
|| !sortedTargetsToPickFrom.containsAll(damaged)) {
tripleaPlayer.reportError("Cannot remove enough units of those types");
if (headLess) {
log.severe(
"Possible Infinite Loop: Cannot remove enough units of those types: targets "
+ MyFormatter.unitsToTextNoOwner(sortedTargetsToPickFrom)
+ ", for "
+ casualtySelection.toString());
}
return selectCasualties(
player,
sortedTargetsToPickFrom,
friendlyUnits,
enemyUnits,
amphibious,
amphibiousLandAttackers,
battlesite,
territoryEffects,
bridge,
text,
dice,
defending,
battleId,
headLess,
extraHits,
allowMultipleHitsPerUnit);
}
return casualtySelection;
} | static CasualtyDetails function( final PlayerId player, final Collection<Unit> targetsToPickFrom, final Collection<Unit> friendlyUnits, final Collection<Unit> enemyUnits, final boolean amphibious, final Collection<Unit> amphibiousLandAttackers, final Territory battlesite, final Collection<TerritoryEffect> territoryEffects, final IDelegateBridge bridge, final String text, final DiceRoll dice, final boolean defending, final UUID battleId, final boolean headLess, final int extraHits, final boolean allowMultipleHitsPerUnit) { if (targetsToPickFrom.isEmpty()) { return new CasualtyDetails(); } if (!friendlyUnits.containsAll(targetsToPickFrom)) { throw new IllegalStateException( STR); } final GameData data = bridge.getData(); final boolean isEditMode = BaseEditDelegate.getEditMode(data); final Player tripleaPlayer = player.isNull() ? new WeakAi(player.getName()) : bridge.getRemotePlayer(player); final Map<Unit, Collection<Unit>> dependents = headLess ? Collections.emptyMap() : getDependents(targetsToPickFrom); if (isEditMode && !headLess) { final CasualtyDetails editSelection = tripleaPlayer.selectCasualties( targetsToPickFrom, dependents, 0, text, dice, player, friendlyUnits, enemyUnits, amphibious, amphibiousLandAttackers, new CasualtyList(), battleId, battlesite, allowMultipleHitsPerUnit); final List<Unit> killed = editSelection.getKilled(); if (isPartialAmphibiousRetreat(data)) { killAmphibiousFirst(killed, targetsToPickFrom); } return editSelection; } if (dice.getHits() == 0) { return new CasualtyDetails(Collections.emptyList(), Collections.emptyList(), true); } int hitsRemaining = dice.getHits(); if (isTransportCasualtiesRestricted(data)) { hitsRemaining = extraHits; } if (!isEditMode && allTargetsOneTypeOneHitPoint(targetsToPickFrom, dependents)) { final List<Unit> killed = new ArrayList<>(); final Iterator<Unit> iter = targetsToPickFrom.iterator(); for (int i = 0; i < hitsRemaining; i++) { if (i >= targetsToPickFrom.size()) { break; } killed.add(iter.next()); } return new CasualtyDetails(killed, Collections.emptyList(), true); } final IntegerMap<UnitType> costs = TuvUtils.getCostsForTuv(player, data); final Tuple<CasualtyList, List<Unit>> defaultCasualtiesAndSortedTargets = getDefaultCasualties( targetsToPickFrom, hitsRemaining, defending, player, enemyUnits, amphibious, amphibiousLandAttackers, battlesite, costs, territoryEffects, data, allowMultipleHitsPerUnit); final CasualtyList defaultCasualties = defaultCasualtiesAndSortedTargets.getFirst(); final List<Unit> sortedTargetsToPickFrom = defaultCasualtiesAndSortedTargets.getSecond(); if (sortedTargetsToPickFrom.size() != targetsToPickFrom.size() !targetsToPickFrom.containsAll(sortedTargetsToPickFrom) !sortedTargetsToPickFrom.containsAll(targetsToPickFrom)) { throw new IllegalStateException( STR); } final int totalHitpoints = (allowMultipleHitsPerUnit ? getTotalHitpointsLeft(sortedTargetsToPickFrom) : sortedTargetsToPickFrom.size()); final CasualtyDetails casualtySelection; if (hitsRemaining >= totalHitpoints) { casualtySelection = new CasualtyDetails(defaultCasualties, true); } else { casualtySelection = tripleaPlayer.selectCasualties( sortedTargetsToPickFrom, dependents, hitsRemaining, text, dice, player, friendlyUnits, enemyUnits, amphibious, amphibiousLandAttackers, defaultCasualties, battleId, battlesite, allowMultipleHitsPerUnit); } final List<Unit> killed = casualtySelection.getKilled(); if (isPartialAmphibiousRetreat(data)) { killAmphibiousFirst(killed, sortedTargetsToPickFrom); } final List<Unit> damaged = casualtySelection.getDamaged(); int numhits = killed.size(); if (!allowMultipleHitsPerUnit) { damaged.clear(); } else { for (final Unit unit : killed) { final UnitAttachment ua = UnitAttachment.get(unit.getType()); final int damageToUnit = Collections.frequency(damaged, unit); numhits += Math.max(0, Math.min(damageToUnit, (ua.getHitPoints() - (1 + unit.getHits())))); damaged.removeIf(unit::equals); } } if (!isEditMode && numhits + damaged.size() != Math.min(hitsRemaining, totalHitpoints)) { tripleaPlayer.reportError(STR); if (headLess) { log.severe( STR + (numhits + damaged.size()) + STR + Math.min(hitsRemaining, totalHitpoints) + STR + casualtySelection.toString()); } return selectCasualties( player, sortedTargetsToPickFrom, friendlyUnits, enemyUnits, amphibious, amphibiousLandAttackers, battlesite, territoryEffects, bridge, text, dice, defending, battleId, headLess, extraHits, allowMultipleHitsPerUnit); } if (!sortedTargetsToPickFrom.containsAll(killed) !sortedTargetsToPickFrom.containsAll(damaged)) { tripleaPlayer.reportError(STR); if (headLess) { log.severe( STR + MyFormatter.unitsToTextNoOwner(sortedTargetsToPickFrom) + STR + casualtySelection.toString()); } return selectCasualties( player, sortedTargetsToPickFrom, friendlyUnits, enemyUnits, amphibious, amphibiousLandAttackers, battlesite, territoryEffects, bridge, text, dice, defending, battleId, headLess, extraHits, allowMultipleHitsPerUnit); } return casualtySelection; } | /**
* Selects casualties for the specified battle.
*
* @param battleId may be null if we are not in a battle (eg, if this is an aa fire due to
* moving).
*/ | Selects casualties for the specified battle | selectCasualties | {
"repo_name": "ssoloff/triplea-game-triplea",
"path": "game-core/src/main/java/games/strategy/triplea/delegate/BattleCalculator.java",
"license": "gpl-3.0",
"size": 50917
} | [
"games.strategy.engine.data.GameData",
"games.strategy.engine.data.PlayerId",
"games.strategy.engine.data.Territory",
"games.strategy.engine.data.TerritoryEffect",
"games.strategy.engine.data.Unit",
"games.strategy.engine.data.UnitType",
"games.strategy.engine.delegate.IDelegateBridge",
"games.strateg... | import games.strategy.engine.data.GameData; import games.strategy.engine.data.PlayerId; import games.strategy.engine.data.Territory; import games.strategy.engine.data.TerritoryEffect; import games.strategy.engine.data.Unit; import games.strategy.engine.data.UnitType; import games.strategy.engine.delegate.IDelegateBridge; import games.strategy.engine.player.Player; import games.strategy.triplea.ai.weak.WeakAi; import games.strategy.triplea.attachments.UnitAttachment; import games.strategy.triplea.delegate.data.CasualtyDetails; import games.strategy.triplea.delegate.data.CasualtyList; import games.strategy.triplea.formatter.MyFormatter; import games.strategy.triplea.util.TuvUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; import org.triplea.java.collections.IntegerMap; import org.triplea.util.Tuple; | import games.strategy.engine.data.*; import games.strategy.engine.delegate.*; import games.strategy.engine.player.*; import games.strategy.triplea.ai.weak.*; import games.strategy.triplea.attachments.*; import games.strategy.triplea.delegate.data.*; import games.strategy.triplea.formatter.*; import games.strategy.triplea.util.*; import java.util.*; import org.triplea.java.collections.*; import org.triplea.util.*; | [
"games.strategy.engine",
"games.strategy.triplea",
"java.util",
"org.triplea.java",
"org.triplea.util"
] | games.strategy.engine; games.strategy.triplea; java.util; org.triplea.java; org.triplea.util; | 1,102,987 |
@Override
public void setRootGroup(Group rootGroup) {
} | void function(Group rootGroup) { } | /**
* Not used
* @param rootGroup The rootGroup to set
*/ | Not used | setRootGroup | {
"repo_name": "idega/se.idega.idegaweb.commune",
"path": "src/java/se/idega/idegaweb/commune/block/importer/business/NackaStudentImportFileHandlerBean.java",
"license": "gpl-3.0",
"size": 11296
} | [
"com.idega.user.data.Group"
] | import com.idega.user.data.Group; | import com.idega.user.data.*; | [
"com.idega.user"
] | com.idega.user; | 691,539 |
public boolean remove(PlateDouble[] platesIn) {
boolean success = true;
try {
Preconditions.checkNotNull(platesIn, "The plate array cannot be null.");
} catch(Exception e) {
System.err.println(e.getMessage());
return false;
}
for(PlateDouble plate : platesIn) {
try {
ValUtil.validatePlateDouble(this.rows, this.columns, plate);
success = this.remove(plate) ? success : false;
} catch(Exception e) {
System.err.println(e.getMessage());
success = false;
}
}
return success;
} | boolean function(PlateDouble[] platesIn) { boolean success = true; try { Preconditions.checkNotNull(platesIn, STR); } catch(Exception e) { System.err.println(e.getMessage()); return false; } for(PlateDouble plate : platesIn) { try { ValUtil.validatePlateDouble(this.rows, this.columns, plate); success = this.remove(plate) ? success : false; } catch(Exception e) { System.err.println(e.getMessage()); success = false; } } return success; } | /**
* Removes an array of plates from the plate stack.
* @param PlateDouble[] the plate array
* @return true on successful removal
*/ | Removes an array of plates from the plate stack | remove | {
"repo_name": "jessemull/MicroFlex",
"path": "src/main/java/com/github/jessemull/microflex/doubleflex/plate/StackDouble.java",
"license": "apache-2.0",
"size": 39087
} | [
"com.github.jessemull.microflex.util.ValUtil",
"com.google.common.base.Preconditions"
] | import com.github.jessemull.microflex.util.ValUtil; import com.google.common.base.Preconditions; | import com.github.jessemull.microflex.util.*; import com.google.common.base.*; | [
"com.github.jessemull",
"com.google.common"
] | com.github.jessemull; com.google.common; | 1,509,800 |
public HashMap<String, String> deserializeResult(String providerDtoJSON) {
return new JSONDeserializer<HashMap<String, String>>()
.deserialize(providerDtoJSON);
} | HashMap<String, String> function(String providerDtoJSON) { return new JSONDeserializer<HashMap<String, String>>() .deserialize(providerDtoJSON); } | /**
* Deserialize result.
*
* @param providerDtoJSON
* the provider dto json
* @return the hash map
*/ | Deserialize result | deserializeResult | {
"repo_name": "OBHITA/Consent2Share",
"path": "DS4P/consent2share/bl/web-bl/src/main/java/gov/samhsa/consent2share/web/controller/ProviderController.java",
"license": "bsd-3-clause",
"size": 20614
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 341,592 |
private Calendar date; | private Calendar date; | /**
* Key getter
* @return the key
*/ | Key getter | getKey | {
"repo_name": "Zighome24/CS2340_GoGreek",
"path": "app/RatTracker2k17/app/src/main/java/edu/gatech/cs2340/rattracker2k17/Model/RatSpotting.java",
"license": "mit",
"size": 9058
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 1,297,039 |
public void tableDeleted(final TableName tableName) {
Set<HRegionInfo> regionsToDelete = new HashSet<HRegionInfo>();
synchronized (this) {
for (RegionState state: regionStates.values()) {
HRegionInfo region = state.getRegion();
if (region.getTable().equals(tableName)) {
regionsToDelete.add(region);
}
}
}
for (HRegionInfo region: regionsToDelete) {
deleteRegion(region);
}
} | void function(final TableName tableName) { Set<HRegionInfo> regionsToDelete = new HashSet<HRegionInfo>(); synchronized (this) { for (RegionState state: regionStates.values()) { HRegionInfo region = state.getRegion(); if (region.getTable().equals(tableName)) { regionsToDelete.add(region); } } } for (HRegionInfo region: regionsToDelete) { deleteRegion(region); } } | /**
* A table is deleted. Remove its regions from all internal maps.
* We loop through all regions assuming we don't delete tables too much.
*/ | A table is deleted. Remove its regions from all internal maps. We loop through all regions assuming we don't delete tables too much | tableDeleted | {
"repo_name": "drewpope/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionStates.java",
"license": "apache-2.0",
"size": 39472
} | [
"java.util.HashSet",
"java.util.Set",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.TableName"
] | import java.util.HashSet; import java.util.Set; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.TableName; | import java.util.*; import org.apache.hadoop.hbase.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,340,557 |
public com.mozu.api.contracts.content.PropertyType getPropertyType(String propertyTypeName, String responseFields) throws Exception
{
MozuClient<com.mozu.api.contracts.content.PropertyType> client = com.mozu.api.clients.content.PropertyTypeClient.getPropertyTypeClient(_dataViewMode, propertyTypeName, responseFields);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
} | com.mozu.api.contracts.content.PropertyType function(String propertyTypeName, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.content.PropertyType> client = com.mozu.api.clients.content.PropertyTypeClient.getPropertyTypeClient(_dataViewMode, propertyTypeName, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* Retrieves the details of the content property type.
* <p><pre><code>
* PropertyType propertytype = new PropertyType();
* PropertyType propertyType = propertytype.getPropertyType( propertyTypeName, responseFields);
* </code></pre></p>
* @param propertyTypeName The name of the content property type.
* @param responseFields Use this field to include those fields which are not included by default.
* @return com.mozu.api.contracts.content.PropertyType
* @see com.mozu.api.contracts.content.PropertyType
*/ | Retrieves the details of the content property type. <code><code> PropertyType propertytype = new PropertyType(); PropertyType propertyType = propertytype.getPropertyType( propertyTypeName, responseFields); </code></code> | getPropertyType | {
"repo_name": "eileenzhuang1/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/resources/content/PropertyTypeResource.java",
"license": "mit",
"size": 8203
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 541,435 |
public void testDefaultTssResolverNameUsed() {
final LocalDateDoubleTimeSeries randomTimeSeries1 = randomTimeSeries();
final LocalDateDoubleTimeSeries randomTimeSeries2 = randomTimeSeries();
final ManageableHistoricalTimeSeries hts1 = new ManageableHistoricalTimeSeries();
hts1.setUniqueId(UID_1);
hts1.setTimeSeries(randomTimeSeries1);
final ManageableHistoricalTimeSeries hts2 = new ManageableHistoricalTimeSeries();
hts2.setUniqueId(UID_2);
hts2.setTimeSeries(randomTimeSeries2);
when(_mockMaster.getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null))).thenReturn(hts1);
when(_mockMaster.getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null))).thenReturn(hts2);
when(_mockMaster.getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1))).thenReturn(hts1);
when(_mockMaster.getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1))).thenReturn(hts2);
final ManageableHistoricalTimeSeriesInfo tsInfo1 = new ManageableHistoricalTimeSeriesInfo();
tsInfo1.setUniqueId(UID_1);
final ManageableHistoricalTimeSeriesInfo tsInfo2 = new ManageableHistoricalTimeSeriesInfo();
tsInfo2.setUniqueId(UID_2);
when(_mockResolver.resolve(IDENTIFIERS, LocalDate.now(), null, null, CLOSE_DATA_FIELD, TEST_CONFIG))
.thenReturn(new HistoricalTimeSeriesResolutionResult(tsInfo1));
when(_mockResolver.resolve(IDENTIFIERS, LocalDate.now(), null, null, CLOSE_DATA_FIELD, HistoricalTimeSeriesRatingFieldNames.DEFAULT_CONFIG_NAME))
.thenReturn(new HistoricalTimeSeriesResolutionResult(tsInfo2));
final HistoricalTimeSeries test1 = _tsSource.getHistoricalTimeSeries(CLOSE_DATA_FIELD, IDENTIFIERS, TEST_CONFIG);
verify(_mockMaster, times(1)).getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null));
final HistoricalTimeSeries test2 = _tsSource.getHistoricalTimeSeries(CLOSE_DATA_FIELD, IDENTIFIERS, null);
verify(_mockMaster, times(1)).getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null));
final Pair<LocalDate, Double> latest1 = _tsSource.getLatestDataPoint(CLOSE_DATA_FIELD, IDENTIFIERS, TEST_CONFIG);
verify(_mockMaster, times(1)).getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1));
final Pair<LocalDate, Double> latest2 = _tsSource.getLatestDataPoint(CLOSE_DATA_FIELD, IDENTIFIERS, null);
verify(_mockMaster, times(1)).getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1));
assertEquals(UID_1, test1.getUniqueId());
assertEquals(randomTimeSeries1, test1.getTimeSeries());
assertEquals(UID_2, test2.getUniqueId());
assertEquals(randomTimeSeries2, test2.getTimeSeries());
assertEquals(randomTimeSeries1.getLatestTime(), latest1.getFirst());
assertEquals(randomTimeSeries1.getLatestValue(), latest1.getSecond());
assertEquals(randomTimeSeries2.getLatestTime(), latest2.getFirst());
assertEquals(randomTimeSeries2.getLatestValue(), latest2.getSecond());
} | void function() { final LocalDateDoubleTimeSeries randomTimeSeries1 = randomTimeSeries(); final LocalDateDoubleTimeSeries randomTimeSeries2 = randomTimeSeries(); final ManageableHistoricalTimeSeries hts1 = new ManageableHistoricalTimeSeries(); hts1.setUniqueId(UID_1); hts1.setTimeSeries(randomTimeSeries1); final ManageableHistoricalTimeSeries hts2 = new ManageableHistoricalTimeSeries(); hts2.setUniqueId(UID_2); hts2.setTimeSeries(randomTimeSeries2); when(_mockMaster.getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null))).thenReturn(hts1); when(_mockMaster.getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null))).thenReturn(hts2); when(_mockMaster.getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1))).thenReturn(hts1); when(_mockMaster.getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1))).thenReturn(hts2); final ManageableHistoricalTimeSeriesInfo tsInfo1 = new ManageableHistoricalTimeSeriesInfo(); tsInfo1.setUniqueId(UID_1); final ManageableHistoricalTimeSeriesInfo tsInfo2 = new ManageableHistoricalTimeSeriesInfo(); tsInfo2.setUniqueId(UID_2); when(_mockResolver.resolve(IDENTIFIERS, LocalDate.now(), null, null, CLOSE_DATA_FIELD, TEST_CONFIG)) .thenReturn(new HistoricalTimeSeriesResolutionResult(tsInfo1)); when(_mockResolver.resolve(IDENTIFIERS, LocalDate.now(), null, null, CLOSE_DATA_FIELD, HistoricalTimeSeriesRatingFieldNames.DEFAULT_CONFIG_NAME)) .thenReturn(new HistoricalTimeSeriesResolutionResult(tsInfo2)); final HistoricalTimeSeries test1 = _tsSource.getHistoricalTimeSeries(CLOSE_DATA_FIELD, IDENTIFIERS, TEST_CONFIG); verify(_mockMaster, times(1)).getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null)); final HistoricalTimeSeries test2 = _tsSource.getHistoricalTimeSeries(CLOSE_DATA_FIELD, IDENTIFIERS, null); verify(_mockMaster, times(1)).getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null)); final Pair<LocalDate, Double> latest1 = _tsSource.getLatestDataPoint(CLOSE_DATA_FIELD, IDENTIFIERS, TEST_CONFIG); verify(_mockMaster, times(1)).getTimeSeries(UID_1, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1)); final Pair<LocalDate, Double> latest2 = _tsSource.getLatestDataPoint(CLOSE_DATA_FIELD, IDENTIFIERS, null); verify(_mockMaster, times(1)).getTimeSeries(UID_2, HistoricalTimeSeriesGetFilter.ofRange(null, null, -1)); assertEquals(UID_1, test1.getUniqueId()); assertEquals(randomTimeSeries1, test1.getTimeSeries()); assertEquals(UID_2, test2.getUniqueId()); assertEquals(randomTimeSeries2, test2.getTimeSeries()); assertEquals(randomTimeSeries1.getLatestTime(), latest1.getFirst()); assertEquals(randomTimeSeries1.getLatestValue(), latest1.getSecond()); assertEquals(randomTimeSeries2.getLatestTime(), latest2.getFirst()); assertEquals(randomTimeSeries2.getLatestValue(), latest2.getSecond()); } | /**
* Tests that the default name is used for resolution.
*/ | Tests that the default name is used for resolution | testDefaultTssResolverNameUsed | {
"repo_name": "McLeodMoores/starling",
"path": "projects/master/src/test/java/com/opengamma/master/historicaltimeseries/impl/MasterHistoricalTimeSeriesSourceTest.java",
"license": "apache-2.0",
"size": 40395
} | [
"com.opengamma.core.historicaltimeseries.HistoricalTimeSeries",
"com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesGetFilter",
"com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesResolutionResult",
"com.opengamma.master.historicaltimeseries.ManageableHistoricalTimeSeries",
"com.openga... | import com.opengamma.core.historicaltimeseries.HistoricalTimeSeries; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesGetFilter; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesResolutionResult; import com.opengamma.master.historicaltimeseries.ManageableHistoricalTimeSeries; import com.opengamma.master.historicaltimeseries.ManageableHistoricalTimeSeriesInfo; import com.opengamma.timeseries.date.localdate.LocalDateDoubleTimeSeries; import com.opengamma.util.tuple.Pair; import org.mockito.Mockito; import org.testng.AssertJUnit; import org.threeten.bp.LocalDate; | import com.opengamma.core.historicaltimeseries.*; import com.opengamma.master.historicaltimeseries.*; import com.opengamma.timeseries.date.localdate.*; import com.opengamma.util.tuple.*; import org.mockito.*; import org.testng.*; import org.threeten.bp.*; | [
"com.opengamma.core",
"com.opengamma.master",
"com.opengamma.timeseries",
"com.opengamma.util",
"org.mockito",
"org.testng",
"org.threeten.bp"
] | com.opengamma.core; com.opengamma.master; com.opengamma.timeseries; com.opengamma.util; org.mockito; org.testng; org.threeten.bp; | 1,098,784 |
@Override
public String getPermissionString(String user, String variable) {
User auser = ph.getUser(user);
if (auser == null) {
return "";
}
if (auser.getVariables().hasVar(variable)) {
return auser.getVariables().getVarString(variable);
}
Group start = auser.getGroup();
if (start == null) {
return "";
}
Group result = nextGroupWithVariable(start, variable);
if (result == null) {
// Check sub groups
if (!auser.isSubGroupsEmpty())
for (Group subGroup : auser.subGroupListCopy()) {
result = nextGroupWithVariable(subGroup, variable);
// Found value?
if (result != null)
continue;
}
if (result == null)
return "";
}
return result.getVariables().getVarString(variable);
// return getUserPermissionString(user, variable);
} | String function(String user, String variable) { User auser = ph.getUser(user); if (auser == null) { return STRSTR"; } return result.getVariables().getVarString(variable); } | /**
* Returns the variable value of the user, in INFO node. If not found, it
* will search for his Group variables. It will harvest the inheritance and
* subgroups.
*
* @param user
* @param variable
* @return empty string if not found
*/ | Returns the variable value of the user, in INFO node. If not found, it will search for his Group variables. It will harvest the inheritance and subgroups | getPermissionString | {
"repo_name": "Bukkit-Forge-Plugins/Essentials",
"path": "EssentialsGroupManager/src/org/anjocaido/groupmanager/permissions/AnjoPermissionsHandler.java",
"license": "gpl-3.0",
"size": 32374
} | [
"org.anjocaido.groupmanager.data.User"
] | import org.anjocaido.groupmanager.data.User; | import org.anjocaido.groupmanager.data.*; | [
"org.anjocaido.groupmanager"
] | org.anjocaido.groupmanager; | 99,076 |
protected void removeExternInput(InputId id) {
CompilerInput input = getInput(id);
if (input == null) {
return;
}
Preconditions.checkState(input.isExtern(), "Not an extern input: %s", input.getName());
inputsById.remove(id);
externs.remove(input);
Node root = input.getAstRoot(this);
if (root != null) {
root.detachFromParent();
}
} | void function(InputId id) { CompilerInput input = getInput(id); if (input == null) { return; } Preconditions.checkState(input.isExtern(), STR, input.getName()); inputsById.remove(id); externs.remove(input); Node root = input.getAstRoot(this); if (root != null) { root.detachFromParent(); } } | /**
* Removes an input file from AST.
* @param id The id of the input to be removed.
*/ | Removes an input file from AST | removeExternInput | {
"repo_name": "martinrosstmc/closure-compiler",
"path": "src/com/google/javascript/jscomp/Compiler.java",
"license": "apache-2.0",
"size": 78462
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.rhino.InputId",
"com.google.javascript.rhino.Node"
] | import com.google.common.base.Preconditions; import com.google.javascript.rhino.InputId; import com.google.javascript.rhino.Node; | import com.google.common.base.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 2,101,398 |
protected static boolean isBgOperation(SurfaceData srcData, Color bgColor) {
// If we cannot get the sData, then cannot assume anything about
// the image
return ((srcData == null) ||
((bgColor != null) &&
(srcData.getTransparency() != Transparency.OPAQUE)));
} | static boolean function(SurfaceData srcData, Color bgColor) { return ((srcData == null) ((bgColor != null) && (srcData.getTransparency() != Transparency.OPAQUE))); } | /**
** Utilities
** The following methods are used by the public methods above
** for performing various operations
**/ | Utilities The following methods are used by the public methods above for performing various operations | isBgOperation | {
"repo_name": "ivmai/JCGO",
"path": "sunawt/fix/sun/java2d/pipe/DrawImage.java",
"license": "gpl-2.0",
"size": 34437
} | [
"java.awt.Color",
"java.awt.Transparency"
] | import java.awt.Color; import java.awt.Transparency; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,098,080 |
@Override
public Vector2i getMaxContentSize(Canvas canvas) {
Font font = canvas.getCurrentStyle().getFont();
if (isMultiline()) {
return new Vector2i(Integer.MAX_VALUE, Integer.MAX_VALUE);
} else {
return new Vector2i(Integer.MAX_VALUE, font.getLineHeight());
}
} | Vector2i function(Canvas canvas) { Font font = canvas.getCurrentStyle().getFont(); if (isMultiline()) { return new Vector2i(Integer.MAX_VALUE, Integer.MAX_VALUE); } else { return new Vector2i(Integer.MAX_VALUE, font.getLineHeight()); } } | /**
* Get the maximum content size of the widget.
*
* @param canvas The canvas on which the widget resides
* @return The maximum content size of the widget
*/ | Get the maximum content size of the widget | getMaxContentSize | {
"repo_name": "MovingBlocks/TeraNUI",
"path": "nui/src/main/java/org/terasology/nui/widgets/UIText.java",
"license": "apache-2.0",
"size": 35326
} | [
"org.joml.Vector2i",
"org.terasology.nui.Canvas",
"org.terasology.nui.asset.font.Font"
] | import org.joml.Vector2i; import org.terasology.nui.Canvas; import org.terasology.nui.asset.font.Font; | import org.joml.*; import org.terasology.nui.*; import org.terasology.nui.asset.font.*; | [
"org.joml",
"org.terasology.nui"
] | org.joml; org.terasology.nui; | 745,118 |
public Principal getPrincipal (String user, UserRealm realm)
{
if (realm==null)
return new DummyPrincipal(user);
return realm.getPrincipal(user);
} | Principal function (String user, UserRealm realm) { if (realm==null) return new DummyPrincipal(user); return realm.getPrincipal(user); } | /** Get a Principal matching the user.
* If there is no user realm, and therefore we are using a
* htpassword file instead, then just return a dummy Principal.
* @param user
* @param realm
* @return
*/ | Get a Principal matching the user. If there is no user realm, and therefore we are using a htpassword file instead, then just return a dummy Principal | getPrincipal | {
"repo_name": "napcs/qedserver",
"path": "jetty/modules/jetty/src/main/java/org/mortbay/jetty/security/HTAccessHandler.java",
"license": "mit",
"size": 31212
} | [
"java.security.Principal"
] | import java.security.Principal; | import java.security.*; | [
"java.security"
] | java.security; | 2,373,179 |
OperationFuture<Stat> setData(String path, byte[] data);
/**
* Sets the data for the given path that match the given version. If the version given is {@code -1}, it matches
* any version.
*
* @param dataPath The path to set data to.
* @param data Data to be set.
* @param version Matching version.
* @return A {@link OperationFuture} that will be completed when the setData call is done, with node {@link Stat} | OperationFuture<Stat> setData(String path, byte[] data); /** * Sets the data for the given path that match the given version. If the version given is {@code -1}, it matches * any version. * * @param dataPath The path to set data to. * @param data Data to be set. * @param version Matching version. * @return A {@link OperationFuture} that will be completed when the setData call is done, with node {@link Stat} | /**
* Sets the data for the given path without matching version. Same as calling
* {@link #setData(String, byte[], int) setData(path, data, -1)}.
*/ | Sets the data for the given path without matching version. Same as calling <code>#setData(String, byte[], int) setData(path, data, -1)</code> | setData | {
"repo_name": "cdapio/twill",
"path": "twill-zookeeper/src/main/java/org/apache/twill/zookeeper/ZKClient.java",
"license": "apache-2.0",
"size": 9176
} | [
"org.apache.zookeeper.data.Stat"
] | import org.apache.zookeeper.data.Stat; | import org.apache.zookeeper.data.*; | [
"org.apache.zookeeper"
] | org.apache.zookeeper; | 2,422,757 |
static final String getSignature(Class clazz) {
if (clazz.isArray()) {
final StringBuffer sb = new StringBuffer();
Class cl = clazz;
while (cl.isArray()) {
sb.append("[");
cl = cl.getComponentType();
}
sb.append(getSignature(cl));
return sb.toString();
}
else if (clazz.isPrimitive()) {
if (clazz == Integer.TYPE) {
return "I";
}
else if (clazz == Byte.TYPE) {
return "B";
}
else if (clazz == Long.TYPE) {
return "J";
}
else if (clazz == Float.TYPE) {
return "F";
}
else if (clazz == Double.TYPE) {
return "D";
}
else if (clazz == Short.TYPE) {
return "S";
}
else if (clazz == Character.TYPE) {
return "C";
}
else if (clazz == Boolean.TYPE) {
return "Z";
}
else if (clazz == Void.TYPE) {
return "V";
}
else {
final String name = clazz.toString();
ErrorMsg err = new ErrorMsg(ErrorMsg.UNKNOWN_SIG_TYPE_ERR,name);
throw new Error(err.toString());
}
}
else {
return "L" + clazz.getName().replace('.', '/') + ';';
}
} | static final String getSignature(Class clazz) { if (clazz.isArray()) { final StringBuffer sb = new StringBuffer(); Class cl = clazz; while (cl.isArray()) { sb.append("["); cl = cl.getComponentType(); } sb.append(getSignature(cl)); return sb.toString(); } else if (clazz.isPrimitive()) { if (clazz == Integer.TYPE) { return "I"; } else if (clazz == Byte.TYPE) { return "B"; } else if (clazz == Long.TYPE) { return "J"; } else if (clazz == Float.TYPE) { return "F"; } else if (clazz == Double.TYPE) { return "D"; } else if (clazz == Short.TYPE) { return "S"; } else if (clazz == Character.TYPE) { return "C"; } else if (clazz == Boolean.TYPE) { return "Z"; } else if (clazz == Void.TYPE) { return "V"; } else { final String name = clazz.toString(); ErrorMsg err = new ErrorMsg(ErrorMsg.UNKNOWN_SIG_TYPE_ERR,name); throw new Error(err.toString()); } } else { return "L" + clazz.getName().replace('.', '/') + ';'; } } | /**
* Compute the JVM signature for the class.
*/ | Compute the JVM signature for the class | getSignature | {
"repo_name": "JetBrains/jdk8u_jaxp",
"path": "src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java",
"license": "gpl-2.0",
"size": 45718
} | [
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg"
] | import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; | import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*; | [
"com.sun.org"
] | com.sun.org; | 1,052,878 |
public static Cursor getCursor(final int id) {
final Integer key = new Integer(id);
Cursor cursor = SWTResourceManager.mIdToCursorMap.get(key);
if (cursor == null) {
cursor = new Cursor(Display.getDefault(), id);
SWTResourceManager.mIdToCursorMap.put(key, cursor);
}
return cursor;
} | static Cursor function(final int id) { final Integer key = new Integer(id); Cursor cursor = SWTResourceManager.mIdToCursorMap.get(key); if (cursor == null) { cursor = new Cursor(Display.getDefault(), id); SWTResourceManager.mIdToCursorMap.put(key, cursor); } return cursor; } | /**
* Returns the system cursor matching the specific ID
*
* @param id
* int The ID value for the cursor
* @return Cursor The system cursor matching the specific ID
*/ | Returns the system cursor matching the specific ID | getCursor | {
"repo_name": "debabratahazra/OptimaLA",
"path": "LogAnalyzer/com.zealcore.se.ui/src/com/swtdesigner/SWTResourceManager.java",
"license": "epl-1.0",
"size": 18972
} | [
"org.eclipse.swt.graphics.Cursor",
"org.eclipse.swt.widgets.Display"
] | import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Display; | import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,616,838 |
public String toString() {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
pw.println("=== MimeHeaders ===");
Enumeration e = names();
while (e.hasMoreElements()) {
String n = (String) e.nextElement();
pw.println(n + " = " + getHeader(n));
}
return sw.toString();
}
// -------------------- Idx access to headers ---------- | String function() { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); pw.println(STR); Enumeration e = names(); while (e.hasMoreElements()) { String n = (String) e.nextElement(); pw.println(n + STR + getHeader(n)); } return sw.toString(); } | /**
* EXPENSIVE!!! only for debugging.
*/ | EXPENSIVE!!! only for debugging | toString | {
"repo_name": "benothman/jboss-web-nio2",
"path": "java/org/apache/tomcat/util/http/MimeHeaders.java",
"license": "lgpl-3.0",
"size": 14529
} | [
"java.io.PrintWriter",
"java.io.StringWriter",
"java.util.Enumeration"
] | import java.io.PrintWriter; import java.io.StringWriter; import java.util.Enumeration; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,129,102 |
public static void setDefaultTimestampFormat(DateTimeFormatter defaultTimestampFormat) {
ValueUtil.defaultTimestampFormat = defaultTimestampFormat;
} | static void function(DateTimeFormatter defaultTimestampFormat) { ValueUtil.defaultTimestampFormat = defaultTimestampFormat; } | /**
* Changes the default timestamp format.
*
* @param defaultTimestampFormat the new default timestamp format
*/ | Changes the default timestamp format | setDefaultTimestampFormat | {
"repo_name": "ControlSystemStudio/diirt",
"path": "vtype/vtype/src/main/java/org/diirt/vtype/ValueUtil.java",
"license": "mit",
"size": 20782
} | [
"java.time.format.DateTimeFormatter"
] | import java.time.format.DateTimeFormatter; | import java.time.format.*; | [
"java.time"
] | java.time; | 2,329,289 |
private Map<CoreInjectorInfo, CoreInjectorInfo> getCoreInjectorTree(Set<TypeElement> components) {
Map<CoreInjectorInfo, CoreInjectorInfo> result = new HashMap<>();
for (TypeElement component : componentToCoreInjectorMap.keySet()) {
CoreInjectorInfo coreInjectorInfo = componentToCoreInjectorMap.get(component);
TypeElement parentComponent = componentToParentMap.get(component);
if (parentComponent == null) {
continue;
}
CoreInjectorInfo parentCoreInjectorInfo = componentToCoreInjectorMap.get(parentComponent);
if (parentCoreInjectorInfo == null || parentCoreInjectorInfo.equals(coreInjectorInfo)) {
continue;
}
result.put(coreInjectorInfo, parentCoreInjectorInfo);
}
return result;
} | Map<CoreInjectorInfo, CoreInjectorInfo> function(Set<TypeElement> components) { Map<CoreInjectorInfo, CoreInjectorInfo> result = new HashMap<>(); for (TypeElement component : componentToCoreInjectorMap.keySet()) { CoreInjectorInfo coreInjectorInfo = componentToCoreInjectorMap.get(component); TypeElement parentComponent = componentToParentMap.get(component); if (parentComponent == null) { continue; } CoreInjectorInfo parentCoreInjectorInfo = componentToCoreInjectorMap.get(parentComponent); if (parentCoreInjectorInfo == null parentCoreInjectorInfo.equals(coreInjectorInfo)) { continue; } result.put(coreInjectorInfo, parentCoreInjectorInfo); } return result; } | /**
* The injector tree with on injector for each scope. The map is from child to parent.
*/ | The injector tree with on injector for each scope. The map is from child to parent | getCoreInjectorTree | {
"repo_name": "googlearchive/tiger",
"path": "src/main/java/tiger/Tiger2Processor.java",
"license": "apache-2.0",
"size": 56194
} | [
"java.util.HashMap",
"java.util.Map",
"java.util.Set",
"javax.lang.model.element.TypeElement"
] | import java.util.HashMap; import java.util.Map; import java.util.Set; import javax.lang.model.element.TypeElement; | import java.util.*; import javax.lang.model.element.*; | [
"java.util",
"javax.lang"
] | java.util; javax.lang; | 1,038,001 |
public static EnumSet<WorldType> toWorldTypes(final EnumSet<net.runelite.http.api.worlds.WorldType> apiTypes)
{
final EnumSet<net.runelite.api.WorldType> types = EnumSet.noneOf(net.runelite.api.WorldType.class);
for (net.runelite.http.api.worlds.WorldType apiType : apiTypes)
{
types.add(net.runelite.api.WorldType.valueOf(apiType.name()));
}
return types;
} | static EnumSet<WorldType> function(final EnumSet<net.runelite.http.api.worlds.WorldType> apiTypes) { final EnumSet<net.runelite.api.WorldType> types = EnumSet.noneOf(net.runelite.api.WorldType.class); for (net.runelite.http.api.worlds.WorldType apiType : apiTypes) { types.add(net.runelite.api.WorldType.valueOf(apiType.name())); } return types; } | /**
* Converts http-api world types to runelite-api world types
* TODO: Find a better way to handle these to not have duplicate interfaces
* @param apiTypes http-api world types
* @return runelite-api world types
*/ | Converts http-api world types to runelite-api world types | toWorldTypes | {
"repo_name": "Sethtroll/runelite",
"path": "runelite-client/src/main/java/net/runelite/client/util/WorldUtil.java",
"license": "bsd-2-clause",
"size": 2164
} | [
"java.util.EnumSet",
"net.runelite.api.WorldType"
] | import java.util.EnumSet; import net.runelite.api.WorldType; | import java.util.*; import net.runelite.api.*; | [
"java.util",
"net.runelite.api"
] | java.util; net.runelite.api; | 2,452,217 |
public static int[] parseJsonIDList(JSONObject spec, String[] colnames, String group)
throws JSONException
{
int[] colList = new int[0];
boolean ids = spec.containsKey("ids") && spec.getBoolean("ids");
if( spec.containsKey(group) ) {
//parse attribute-array or plain array of IDs
JSONArray attrs = null;
if( spec.get(group) instanceof JSONObject ) {
attrs = (JSONArray) ((JSONObject)spec.get(group)).get(TfUtils.JSON_ATTRS);
ids = true; //file-based transform outputs ids w/o id tags
}
else
attrs = (JSONArray)spec.get(group);
//construct ID list array
colList = new int[attrs.size()];
for(int i=0; i < colList.length; i++) {
colList[i] = ids ? UtilFunctions.toInt(attrs.get(i)) :
(ArrayUtils.indexOf(colnames, attrs.get(i)) + 1);
if( colList[i] <= 0 ) {
throw new RuntimeException("Specified column '" +
attrs.get(i)+"' does not exist.");
}
}
//ensure ascending order of column IDs
Arrays.sort(colList);
}
return colList;
} | static int[] function(JSONObject spec, String[] colnames, String group) throws JSONException { int[] colList = new int[0]; boolean ids = spec.containsKey("ids") && spec.getBoolean("ids"); if( spec.containsKey(group) ) { JSONArray attrs = null; if( spec.get(group) instanceof JSONObject ) { attrs = (JSONArray) ((JSONObject)spec.get(group)).get(TfUtils.JSON_ATTRS); ids = true; } else attrs = (JSONArray)spec.get(group); colList = new int[attrs.size()]; for(int i=0; i < colList.length; i++) { colList[i] = ids ? UtilFunctions.toInt(attrs.get(i)) : (ArrayUtils.indexOf(colnames, attrs.get(i)) + 1); if( colList[i] <= 0 ) { throw new RuntimeException(STR + attrs.get(i)+STR); } } Arrays.sort(colList); } return colList; } | /**
* TODO consolidate external and internal json spec definitions
*
* @param spec transform specification as json string
* @param colnames column names
* @param group ?
* @return list of column ids
* @throws JSONException if JSONException occurs
*/ | TODO consolidate external and internal json spec definitions | parseJsonIDList | {
"repo_name": "asurve/systemml",
"path": "src/main/java/org/apache/sysml/runtime/transform/meta/TfMetaUtils.java",
"license": "apache-2.0",
"size": 14651
} | [
"java.util.Arrays",
"org.apache.commons.lang.ArrayUtils",
"org.apache.sysml.runtime.transform.TfUtils",
"org.apache.sysml.runtime.util.UtilFunctions",
"org.apache.wink.json4j.JSONArray",
"org.apache.wink.json4j.JSONException",
"org.apache.wink.json4j.JSONObject"
] | import java.util.Arrays; import org.apache.commons.lang.ArrayUtils; import org.apache.sysml.runtime.transform.TfUtils; import org.apache.sysml.runtime.util.UtilFunctions; import org.apache.wink.json4j.JSONArray; import org.apache.wink.json4j.JSONException; import org.apache.wink.json4j.JSONObject; | import java.util.*; import org.apache.commons.lang.*; import org.apache.sysml.runtime.transform.*; import org.apache.sysml.runtime.util.*; import org.apache.wink.json4j.*; | [
"java.util",
"org.apache.commons",
"org.apache.sysml",
"org.apache.wink"
] | java.util; org.apache.commons; org.apache.sysml; org.apache.wink; | 2,305,397 |
public Hashtable hashAllTableDescriptorsByTableId(TransactionController tc)
throws StandardException; | Hashtable function(TransactionController tc) throws StandardException; | /**
* Get all of the TableDescriptors in the database and hash them by TableId
* This is useful as a performance optimization for the locking VTIs.
* NOTE: This method will scan SYS.SYSTABLES at READ COMMITTED.
* It should really scan at READ UNCOMMITTED, but there is no such
* thing yet.
*
* @param tc TransactionController for the transaction
*
* @return A Hashtable with all of the Table descriptors in the database
* hashed by TableId
*
*
* @exception StandardException Thrown on failure
*/ | Get all of the TableDescriptors in the database and hash them by TableId This is useful as a performance optimization for the locking VTIs. It should really scan at READ UNCOMMITTED, but there is no such thing yet | hashAllTableDescriptorsByTableId | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/iapi/sql/dictionary/DataDictionary.java",
"license": "apache-2.0",
"size": 74186
} | [
"com.pivotal.gemfirexd.internal.iapi.error.StandardException",
"com.pivotal.gemfirexd.internal.iapi.store.access.TransactionController",
"java.util.Hashtable"
] | import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.store.access.TransactionController; import java.util.Hashtable; | import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.store.access.*; import java.util.*; | [
"com.pivotal.gemfirexd",
"java.util"
] | com.pivotal.gemfirexd; java.util; | 307,293 |
private View getAltView() {
View view;
synchronized(this) {
view = altView;
}
if (view != null && view.getParent() == null) {
view.setParent(getParent());
}
return view;
} | View function() { View view; synchronized(this) { view = altView; } if (view != null && view.getParent() == null) { view.setParent(getParent()); } return view; } | /**
* Returns the view to use for alternate text. This may be null.
*/ | Returns the view to use for alternate text. This may be null | getAltView | {
"repo_name": "md-5/jdk10",
"path": "src/java.desktop/share/classes/javax/swing/text/html/ImageView.java",
"license": "gpl-2.0",
"size": 37563
} | [
"javax.swing.text.View"
] | import javax.swing.text.View; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 1,612,310 |
public void putDoubleValid(Map<String, Double> arrayBody) {
putDoubleValidWithServiceResponseAsync(arrayBody).toBlocking().single().body();
} | void function(Map<String, Double> arrayBody) { putDoubleValidWithServiceResponseAsync(arrayBody).toBlocking().single().body(); } | /**
* Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20}.
*
* @param arrayBody the Map<String, Double> value
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
*/ | Set dictionary value {"0": 0, "1": -0.01, "2": 1.2e20} | putDoubleValid | {
"repo_name": "balajikris/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/implementation/DictionarysImpl.java",
"license": "mit",
"size": 243390
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,317,404 |
public void run() throws Exception {
NotifyCounter[] ncs = new NotifyCounter[12];
EventRegistration[] ers = new EventRegistration[12];
boolean[] failMatrix = new boolean[12];
boolean failed = false;
long[] evTxnMatrix = new long[] {
2, 1, 0, 0, 0, 0, 0, 0, 3, 2, 1, 3 };
SimpleEntry sampleEntry1 = new SimpleEntry("TestEntry #1", 1);
SimpleEntry sampleEntry2 = new SimpleEntry("TestEntry #2", 2);
SimpleEntry sampleEntry3 = new SimpleEntry("TestEntry #1", 2);
SimpleEntry template;
Transaction txn;
long leaseTime1 = timeout2 * 3;
long leaseTime2 = Lease.FOREVER;
long leaseTime3 = Lease.ANY;
int i;
// first check that space is empty
if (!checkSpace(space)) {
throw new TestException(
"Space is not empty in the beginning.");
}
// create the non null transaction
txn = getTransaction();
// init 3 RemoteEvent counters for each of sample entries
ncs[0] = new NotifyCounter(sampleEntry1, leaseTime1);
ncs[1] = new NotifyCounter(sampleEntry2, leaseTime2);
ncs[2] = new NotifyCounter(sampleEntry3, leaseTime3);
// init 5 counters with wrong templates
template = new SimpleEntry("TestEntry #3", 1);
ncs[3] = new NotifyCounter(template, leaseTime1);
// 2-nd wrong template
template = new SimpleEntry("TestEntry #1", 3);
ncs[4] = new NotifyCounter(template, leaseTime2);
// 3-rd wrong template
template = new SimpleEntry("TestEntry #3", 3);
ncs[5] = new NotifyCounter(template, leaseTime3);
// 4-th wrong template
template = new SimpleEntry(null, 3);
ncs[6] = new NotifyCounter(template, leaseForeverTime);
// 5-th wrong template
template = new SimpleEntry("TestEntry #3", null);
ncs[7] = new NotifyCounter(template, leaseTime1);
// init counter with null entry as a template
ncs[8] = new NotifyCounter(null, leaseForeverTime);
// init 3 counters with null values for different fields
template = new SimpleEntry("TestEntry #1", null);
ncs[9] = new NotifyCounter(template, leaseTime1);
// 2-nd template
template = new SimpleEntry(null, 2);
ncs[10] = new NotifyCounter(template, leaseTime2);
// 3-rd template
template = new SimpleEntry(null, null);
ncs[11] = new NotifyCounter(template, leaseTime3);
// now register all counters with null transaction parameter
for (i = 0; i < 12; i++) {
ers[i] = space.notify(ncs[i].getTemplate(), null, ncs[i],
ncs[i].getLeaseTime(), null);
ers[i] = prepareRegistration(ers[i]);
}
// sleep for a while to let all listeners register properly
logDebugText("now sleeping for " + timeout1
+ " to let all listeners register properly.");
Thread.sleep(timeout1);
space.write(sampleEntry1, txn, leaseForeverTime);
space.write(sampleEntry1, txn, leaseForeverTime);
space.write(sampleEntry1, txn, leaseForeverTime);
space.write(sampleEntry2, txn, leaseForeverTime);
space.write(sampleEntry2, txn, leaseForeverTime);
space.write(sampleEntry2, txn, leaseForeverTime);
space.write(sampleEntry3, txn, leaseForeverTime);
space.write(sampleEntry3, txn, leaseForeverTime);
space.write(sampleEntry3, txn, leaseForeverTime);
logDebugText("3 sample entries have been written"
+ " to the space 3 times within the non null transaction.");
space.take(sampleEntry1, txn, checkTime);
space.take(sampleEntry2, txn, checkTime);
space.take(sampleEntry2, txn, checkTime);
space.take(sampleEntry3, txn, checkTime);
space.take(sampleEntry3, txn, checkTime);
space.take(sampleEntry3, txn, checkTime);
logDebugText(sampleEntry1.toString() + " has been taken 1 time, "
+ sampleEntry2 + " has been taken 2 times, " + sampleEntry3
+ " has been taken 3 times successfully within"
+ " the transaction");
// commit the transaction
txnCommit(txn);
// wait for a while to let all listeners get notifications
logDebugText("now sleeping for " + timeout2
+ " to let all listeners get notifications.");
Thread.sleep(timeout2);
for (i = 0; i < 12; i++) {
if (ncs[i].getEventsNum(ers[i]) != evTxnMatrix[i]) {
failed = true;
failMatrix[i] = true;
} else {
failMatrix[i] = false;
}
}
for (i = 0; i < 12; i++) {
if (failMatrix[i]) {
logDebugText("FAILED: " + ncs[i] + " has got "
+ ncs[i].getEventsNum(ers[i])
+ " notifications instead of " + evTxnMatrix[i]
+ " required after transaction's committing.");
} else {
logDebugText(ncs[i].toString() + " has got "
+ ncs[i].getEventsNum(ers[i])
+ " notifications as expected"
+ " after transaction's committing.");
}
}
// check: we fail of pass
if (failed) {
throw new TestException(
"Not all listeners've got expected number of events.");
}
} | void function() throws Exception { NotifyCounter[] ncs = new NotifyCounter[12]; EventRegistration[] ers = new EventRegistration[12]; boolean[] failMatrix = new boolean[12]; boolean failed = false; long[] evTxnMatrix = new long[] { 2, 1, 0, 0, 0, 0, 0, 0, 3, 2, 1, 3 }; SimpleEntry sampleEntry1 = new SimpleEntry(STR, 1); SimpleEntry sampleEntry2 = new SimpleEntry(STR, 2); SimpleEntry sampleEntry3 = new SimpleEntry(STR, 2); SimpleEntry template; Transaction txn; long leaseTime1 = timeout2 * 3; long leaseTime2 = Lease.FOREVER; long leaseTime3 = Lease.ANY; int i; if (!checkSpace(space)) { throw new TestException( STR); } txn = getTransaction(); ncs[0] = new NotifyCounter(sampleEntry1, leaseTime1); ncs[1] = new NotifyCounter(sampleEntry2, leaseTime2); ncs[2] = new NotifyCounter(sampleEntry3, leaseTime3); template = new SimpleEntry(STR, 1); ncs[3] = new NotifyCounter(template, leaseTime1); template = new SimpleEntry(STR, 3); ncs[4] = new NotifyCounter(template, leaseTime2); template = new SimpleEntry(STR, 3); ncs[5] = new NotifyCounter(template, leaseTime3); template = new SimpleEntry(null, 3); ncs[6] = new NotifyCounter(template, leaseForeverTime); template = new SimpleEntry(STR, null); ncs[7] = new NotifyCounter(template, leaseTime1); ncs[8] = new NotifyCounter(null, leaseForeverTime); template = new SimpleEntry(STR, null); ncs[9] = new NotifyCounter(template, leaseTime1); template = new SimpleEntry(null, 2); ncs[10] = new NotifyCounter(template, leaseTime2); template = new SimpleEntry(null, null); ncs[11] = new NotifyCounter(template, leaseTime3); for (i = 0; i < 12; i++) { ers[i] = space.notify(ncs[i].getTemplate(), null, ncs[i], ncs[i].getLeaseTime(), null); ers[i] = prepareRegistration(ers[i]); } logDebugText(STR + timeout1 + STR); Thread.sleep(timeout1); space.write(sampleEntry1, txn, leaseForeverTime); space.write(sampleEntry1, txn, leaseForeverTime); space.write(sampleEntry1, txn, leaseForeverTime); space.write(sampleEntry2, txn, leaseForeverTime); space.write(sampleEntry2, txn, leaseForeverTime); space.write(sampleEntry2, txn, leaseForeverTime); space.write(sampleEntry3, txn, leaseForeverTime); space.write(sampleEntry3, txn, leaseForeverTime); space.write(sampleEntry3, txn, leaseForeverTime); logDebugText(STR + STR); space.take(sampleEntry1, txn, checkTime); space.take(sampleEntry2, txn, checkTime); space.take(sampleEntry2, txn, checkTime); space.take(sampleEntry3, txn, checkTime); space.take(sampleEntry3, txn, checkTime); space.take(sampleEntry3, txn, checkTime); logDebugText(sampleEntry1.toString() + STR + sampleEntry2 + STR + sampleEntry3 + STR + STR); txnCommit(txn); logDebugText(STR + timeout2 + STR); Thread.sleep(timeout2); for (i = 0; i < 12; i++) { if (ncs[i].getEventsNum(ers[i]) != evTxnMatrix[i]) { failed = true; failMatrix[i] = true; } else { failMatrix[i] = false; } } for (i = 0; i < 12; i++) { if (failMatrix[i]) { logDebugText(STR + ncs[i] + STR + ncs[i].getEventsNum(ers[i]) + STR + evTxnMatrix[i] + STR); } else { logDebugText(ncs[i].toString() + STR + ncs[i].getEventsNum(ers[i]) + STR + STR); } } if (failed) { throw new TestException( STR); } } | /**
* This method asserts, that if an entry is written under
* a transaction and then taken under that same transaction before the
* transaction is committed, listeners registered under a null transaction
* will not be notified of that entry.
*
* <P>Notes:<BR>For more information see the JavaSpaces specification
* sections 2.7, 3.1.</P>
*/ | This method asserts, that if an entry is written under a transaction and then taken under that same transaction before the transaction is committed, listeners registered under a null transaction will not be notified of that entry. Notes:For more information see the JavaSpaces specification sections 2.7, 3.1 | run | {
"repo_name": "trasukg/river-qa-2.2",
"path": "qa/src/com/sun/jini/test/spec/javaspace/conformance/TransactionWriteTakeNotifyTest.java",
"license": "apache-2.0",
"size": 8178
} | [
"com.sun.jini.qa.harness.TestException",
"net.jini.core.event.EventRegistration",
"net.jini.core.lease.Lease",
"net.jini.core.transaction.Transaction"
] | import com.sun.jini.qa.harness.TestException; import net.jini.core.event.EventRegistration; import net.jini.core.lease.Lease; import net.jini.core.transaction.Transaction; | import com.sun.jini.qa.harness.*; import net.jini.core.event.*; import net.jini.core.lease.*; import net.jini.core.transaction.*; | [
"com.sun.jini",
"net.jini.core"
] | com.sun.jini; net.jini.core; | 1,498,835 |
protected void skipped(long nanos, AssumptionViolatedException e, Description description) {
} | void function(long nanos, AssumptionViolatedException e, Description description) { } | /**
* Invoked when a test is skipped due to a failed assumption.
*/ | Invoked when a test is skipped due to a failed assumption | skipped | {
"repo_name": "antalpeti/JUnit",
"path": "src/org/junit/rules/Stopwatch.java",
"license": "epl-1.0",
"size": 5268
} | [
"org.junit.AssumptionViolatedException",
"org.junit.runner.Description"
] | import org.junit.AssumptionViolatedException; import org.junit.runner.Description; | import org.junit.*; import org.junit.runner.*; | [
"org.junit",
"org.junit.runner"
] | org.junit; org.junit.runner; | 959,523 |
void writeInt(String fieldName, int value) throws IOException; | void writeInt(String fieldName, int value) throws IOException; | /**
* Writes a primitive int.
*
* @param fieldName name of the field
* @param value int value to be written
* @throws IOException
*/ | Writes a primitive int | writeInt | {
"repo_name": "tombujok/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/nio/serialization/PortableWriter.java",
"license": "apache-2.0",
"size": 6804
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 907,124 |
public static void d(final String msg, final Object... args) {
logMessage(Log.DEBUG, msg, args, null);
} | static void function(final String msg, final Object... args) { logMessage(Log.DEBUG, msg, args, null); } | /**
* Log a message.
*
* @param msg message to log. This message is expected to be a format string if varargs are
* passed in.
* @param args optional arguments to be formatted into {@code msg}.
*/ | Log a message | d | {
"repo_name": "inloop/easylog",
"path": "easylog/src/main/java/eu/inloop/easylog/EasyLog.java",
"license": "apache-2.0",
"size": 9238
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 1,990,329 |
RMIConnection doNewClient(Object credentials) throws IOException {
final boolean tracing = logger.traceOn();
if (tracing) logger.trace("newClient","making new client");
if (getMBeanServer() == null)
throw new IllegalStateException("Not attached to an MBean server");
Subject subject = null;
JMXAuthenticator authenticator =
(JMXAuthenticator) env.get(JMXConnectorServer.AUTHENTICATOR);
if (authenticator == null) {
if (env.get("jmx.remote.x.password.file") != null ||
env.get("jmx.remote.x.login.config") != null) {
authenticator = new JMXPluggableAuthenticator(env);
}
}
if (authenticator != null) {
if (tracing) logger.trace("newClient","got authenticator: " +
authenticator.getClass().getName());
try {
subject = authenticator.authenticate(credentials);
} catch (SecurityException e) {
logger.trace("newClient", "Authentication failed: " + e);
throw e;
}
}
if (tracing) {
if (subject != null)
logger.trace("newClient","subject is not null");
else logger.trace("newClient","no subject");
}
final String connectionId = makeConnectionId(getProtocol(), subject);
if (tracing)
logger.trace("newClient","making new connection: " + connectionId);
RMIConnection client = makeClient(connectionId, subject);
dropDeadReferences();
WeakReference<RMIConnection> wr = new WeakReference<RMIConnection>(client);
synchronized (clientList) {
clientList.add(wr);
}
connServer.connectionOpened(connectionId, "Connection opened", null);
synchronized (clientList) {
if (!clientList.contains(wr)) {
// can be removed only by a JMXConnectionNotification listener
throw new IOException("The connection is refused.");
}
}
if (tracing)
logger.trace("newClient","new connection done: " + connectionId );
return client;
} | RMIConnection doNewClient(Object credentials) throws IOException { final boolean tracing = logger.traceOn(); if (tracing) logger.trace(STR,STR); if (getMBeanServer() == null) throw new IllegalStateException(STR); Subject subject = null; JMXAuthenticator authenticator = (JMXAuthenticator) env.get(JMXConnectorServer.AUTHENTICATOR); if (authenticator == null) { if (env.get(STR) != null env.get(STR) != null) { authenticator = new JMXPluggableAuthenticator(env); } } if (authenticator != null) { if (tracing) logger.trace(STR,STR + authenticator.getClass().getName()); try { subject = authenticator.authenticate(credentials); } catch (SecurityException e) { logger.trace(STR, STR + e); throw e; } } if (tracing) { if (subject != null) logger.trace(STR,STR); else logger.trace(STR,STR); } final String connectionId = makeConnectionId(getProtocol(), subject); if (tracing) logger.trace(STR,STR + connectionId); RMIConnection client = makeClient(connectionId, subject); dropDeadReferences(); WeakReference<RMIConnection> wr = new WeakReference<RMIConnection>(client); synchronized (clientList) { clientList.add(wr); } connServer.connectionOpened(connectionId, STR, null); synchronized (clientList) { if (!clientList.contains(wr)) { throw new IOException(STR); } } if (tracing) logger.trace(STR,STR + connectionId ); return client; } | /**
* This method could be overridden by subclasses defined in this package
* to perform additional operations specific to the underlying transport
* before creating the new client connection.
*/ | This method could be overridden by subclasses defined in this package to perform additional operations specific to the underlying transport before creating the new client connection | doNewClient | {
"repo_name": "greghaskins/openjdk-jdk7u-jdk",
"path": "src/share/classes/javax/management/remote/rmi/RMIServerImpl.java",
"license": "gpl-2.0",
"size": 20802
} | [
"com.sun.jmx.remote.security.JMXPluggableAuthenticator",
"java.io.IOException",
"java.lang.ref.WeakReference",
"javax.management.remote.JMXAuthenticator",
"javax.management.remote.JMXConnectorServer",
"javax.security.auth.Subject"
] | import com.sun.jmx.remote.security.JMXPluggableAuthenticator; import java.io.IOException; import java.lang.ref.WeakReference; import javax.management.remote.JMXAuthenticator; import javax.management.remote.JMXConnectorServer; import javax.security.auth.Subject; | import com.sun.jmx.remote.security.*; import java.io.*; import java.lang.ref.*; import javax.management.remote.*; import javax.security.auth.*; | [
"com.sun.jmx",
"java.io",
"java.lang",
"javax.management",
"javax.security"
] | com.sun.jmx; java.io; java.lang; javax.management; javax.security; | 1,642,216 |
@WebMethod(action = "http://wshr.mtc.gob.pe/getVehiculo")
@WebResult(name = "getVehiculoResult", targetNamespace = "http://wshr.mtc.gob.pe/")
@RequestWrapper(localName = "getVehiculo", targetNamespace = "http://wshr.mtc.gob.pe/", className = "com.titanic.ventapasajes.ws.GetVehiculo")
@ResponseWrapper(localName = "getVehiculoResponse", targetNamespace = "http://wshr.mtc.gob.pe/", className = "com.titanic.ventapasajes.ws.GetVehiculoResponse")
public ResultVehiculo getVehiculo(
@WebParam(name = "oVehiculo", targetNamespace = "http://wshr.mtc.gob.pe/")
Vehiculo oVehiculo); | @WebMethod(action = STRgetVehiculoResultSTRhttp: @RequestWrapper(localName = "getVehiculoSTRhttp: @ResponseWrapper(localName = "getVehiculoResponseSTRhttp: ResultVehiculo function( @WebParam(name = "oVehiculoSTRhttp: Vehiculo oVehiculo); | /**
* Informacion de Vehiculo por Empresa de Transporte.
*
* @param oVehiculo
* @return
* returns com.titanic.ventapasajes.ws.ResultVehiculo
*/ | Informacion de Vehiculo por Empresa de Transporte | getVehiculo | {
"repo_name": "joedayz/titanic-javaee7",
"path": "titanic-javaee7/src/main/java/com/titanic/ventapasajes/ws/WSServiciosHRSoap.java",
"license": "apache-2.0",
"size": 8622
} | [
"javax.jws.WebMethod",
"javax.jws.WebParam",
"javax.xml.ws.RequestWrapper",
"javax.xml.ws.ResponseWrapper"
] | import javax.jws.WebMethod; import javax.jws.WebParam; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; | import javax.jws.*; import javax.xml.ws.*; | [
"javax.jws",
"javax.xml"
] | javax.jws; javax.xml; | 1,304,464 |
System.out.println("|--- Validating Order object:[OrderID=" + order.getOrderId() + ", ItemID=" + order.getItemId() + ", quantity=" + order.getQuantity() + "] ---|");
if (order.getQuantity() > 1000) {
return BaseValidator.invalidResult("Too many order quantity: " + order.getQuantity());
}
return BaseValidator.validResult();
} | System.out.println(STR + order.getOrderId() + STR + order.getItemId() + STR + order.getQuantity() + STR); if (order.getQuantity() > 1000) { return BaseValidator.invalidResult(STR + order.getQuantity()); } return BaseValidator.validResult(); } | /**
* Validates Order object.
* @param order Order object.
* @return validation result
*/ | Validates Order object | validate | {
"repo_name": "rsriniva/fsw-quickstarts-fixed",
"path": "bean-service/src/main/java/org/switchyard/quickstarts/bean/service/Validators.java",
"license": "apache-2.0",
"size": 1892
} | [
"org.switchyard.validate.BaseValidator"
] | import org.switchyard.validate.BaseValidator; | import org.switchyard.validate.*; | [
"org.switchyard.validate"
] | org.switchyard.validate; | 435,372 |
public Integer countMatchingItem(ItemStack[] inventoryItems, ItemStack item) {
return Arrays.stream(inventoryItems).filter(it -> it != null && it.isSimilar(item)).reduce(0,
(res, val) -> res + val.getAmount(), Integer::sum);
} | Integer function(ItemStack[] inventoryItems, ItemStack item) { return Arrays.stream(inventoryItems).filter(it -> it != null && it.isSimilar(item)).reduce(0, (res, val) -> res + val.getAmount(), Integer::sum); } | /**
* Return the number of items inside an item list that matching a specific item
*
* @param inventoryItems Items List
* @param item Searched item
* @return Number of Searched item inside items list
*/ | Return the number of items inside an item list that matching a specific item | countMatchingItem | {
"repo_name": "EpiCanard/GlobalMarketChest",
"path": "src/main/java/fr/epicanard/globalmarketchest/utils/PlayerUtils.java",
"license": "mit",
"size": 8347
} | [
"java.util.Arrays",
"org.bukkit.inventory.ItemStack"
] | import java.util.Arrays; import org.bukkit.inventory.ItemStack; | import java.util.*; import org.bukkit.inventory.*; | [
"java.util",
"org.bukkit.inventory"
] | java.util; org.bukkit.inventory; | 1,100,351 |
protected double getDoubleInternal(int colIndex) throws SQLException {
return getDoubleInternal(getString(colIndex), colIndex);
} | double function(int colIndex) throws SQLException { return getDoubleInternal(getString(colIndex), colIndex); } | /**
* Converts a string representation of a number to a double. Need a faster
* way to do this.
*
* @param colIndex
* the 1-based index of the column to retrieve a double from.
*
* @return the double value represented by the string in buf
*
* @throws SQLException
* if an error occurs
*/ | Converts a string representation of a number to a double. Need a faster way to do this | getDoubleInternal | {
"repo_name": "scopej/mysql-connector-j",
"path": "src/com/mysql/jdbc/ResultSetImpl.java",
"license": "gpl-2.0",
"size": 287512
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,886,599 |
public void createLinks(final Collection<File> files, final String linkExtension) {
Preconditions.checkArgument(
files != null, "null file collection"
);
Preconditions.checkArgument(
linkExtension != null && !linkExtension.trim().isEmpty(),
"specified null or empty linkEtension"
);
Preconditions.checkState(
m_channel != null, "stale session"
);
verifyAllAreAbsolutePaths(files);
ArrayList<String> fileNames = new ArrayList<String>();
for (File f: files) {
fileNames.add(f.getPath());
}
pipeListToShellCommand(
fileNames, "xargs -I {} ln -f {} {}" + linkExtension);
if (m_log.isDebugEnabled()) {
for (String fileName: fileNames) {
m_log.debug("CMD: 'ln " +
fileName + " " +
fileName+linkExtension + "'"
);
}
}
} | void function(final Collection<File> files, final String linkExtension) { Preconditions.checkArgument( files != null, STR ); Preconditions.checkArgument( linkExtension != null && !linkExtension.trim().isEmpty(), STR ); Preconditions.checkState( m_channel != null, STR ); verifyAllAreAbsolutePaths(files); ArrayList<String> fileNames = new ArrayList<String>(); for (File f: files) { fileNames.add(f.getPath()); } pipeListToShellCommand( fileNames, STR + linkExtension); if (m_log.isDebugEnabled()) { for (String fileName: fileNames) { m_log.debug(STR + fileName + " " + fileName+linkExtension + "'" ); } } } | /**
* Creates hard links of the given list of absolute paths by appending
* the given extension to them
*
* @param files a collection of files specified as absolute paths
* @param linkExtension
*
* @throws {@link SFTPException} when an error occurs during SFTP operations
* performed by this method
*/ | Creates hard links of the given list of absolute paths by appending the given extension to them | createLinks | {
"repo_name": "paulmartel/voltdb",
"path": "src/frontend/org/voltdb/processtools/SFTPSession.java",
"license": "agpl-3.0",
"size": 35500
} | [
"com.google_voltpatches.common.base.Preconditions",
"java.io.File",
"java.util.ArrayList",
"java.util.Collection"
] | import com.google_voltpatches.common.base.Preconditions; import java.io.File; import java.util.ArrayList; import java.util.Collection; | import com.google_voltpatches.common.base.*; import java.io.*; import java.util.*; | [
"com.google_voltpatches.common",
"java.io",
"java.util"
] | com.google_voltpatches.common; java.io; java.util; | 859,265 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.