method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void authenticate(String userLogonName, String password) throws InvalidUserException, InvalidPasswordException { if (isAutomationModeEnabled()) { throw new RuntimeException("API Misuse - automation mode is enabled!"); } checkInit(); if (!userNamesWithProfiles_.contains(userLogonName)) { throw new InvalidUserException("The specified user name is not allowed to login"); } else { if (loggedInUser_ != null) { throw new InvalidUserException("We don't currently support logging out and logging in within a session at this point"); } try { UserProfile up = UserProfile.read(new File(new File(profilesFolder_, userLogonName), PREFS_FILE_NAME)); if (!up.isCorrectPassword(password)) { throw new InvalidPasswordException("Incorrect password"); } else { loggedInUser_ = up; AppContext.getService(UserProfileBindings.class).update(loggedInUser_); Files.write(new File(profilesFolder_, "lastUser.txt").toPath(), userLogonName.getBytes(), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE); for (Consumer<String> listener : notifyUponLogin) { listener.accept(loggedInUser_.getUserLogonName()); } notifyUponLogin = null; } } catch (IOException e) { logger.warn("Couldn't read user profile!", e); throw new InvalidUserException("The profile for the user is unreadable"); } } }
void function(String userLogonName, String password) throws InvalidUserException, InvalidPasswordException { if (isAutomationModeEnabled()) { throw new RuntimeException(STR); } checkInit(); if (!userNamesWithProfiles_.contains(userLogonName)) { throw new InvalidUserException(STR); } else { if (loggedInUser_ != null) { throw new InvalidUserException(STR); } try { UserProfile up = UserProfile.read(new File(new File(profilesFolder_, userLogonName), PREFS_FILE_NAME)); if (!up.isCorrectPassword(password)) { throw new InvalidPasswordException(STR); } else { loggedInUser_ = up; AppContext.getService(UserProfileBindings.class).update(loggedInUser_); Files.write(new File(profilesFolder_, STR).toPath(), userLogonName.getBytes(), StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE); for (Consumer<String> listener : notifyUponLogin) { listener.accept(loggedInUser_.getUserLogonName()); } notifyUponLogin = null; } } catch (IOException e) { logger.warn(STR, e); throw new InvalidUserException(STR); } } }
/** * Throws an exception if authentication fails, otherwise, logs in the user. * @throws InvalidUserException */
Throws an exception if authentication fails, otherwise, logs in the user
authenticate
{ "repo_name": "vaskaloidis/va-isaac-gui", "path": "otf-util/src/main/java/gov/va/isaac/config/profiles/UserProfileManager.java", "license": "apache-2.0", "size": 15765 }
[ "gov.va.isaac.AppContext", "gov.va.isaac.config.users.InvalidUserException", "java.io.File", "java.io.IOException", "java.nio.file.Files", "java.nio.file.StandardOpenOption", "java.util.function.Consumer" ]
import gov.va.isaac.AppContext; import gov.va.isaac.config.users.InvalidUserException; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.StandardOpenOption; import java.util.function.Consumer;
import gov.va.isaac.*; import gov.va.isaac.config.users.*; import java.io.*; import java.nio.file.*; import java.util.function.*;
[ "gov.va.isaac", "java.io", "java.nio", "java.util" ]
gov.va.isaac; java.io; java.nio; java.util;
626,757
public void deleteTrack(long id) { DataBaseHandler db = new DataBaseHandler( context.getApplicationContext()); Track track = db.getGPSTrack(id); db.deleteGPSTrack(track); db.close(); }
void function(long id) { DataBaseHandler db = new DataBaseHandler( context.getApplicationContext()); Track track = db.getGPSTrack(id); db.deleteGPSTrack(track); db.close(); }
/** * Gets the track for a corresponding id and deletes this track from * database. * * @param id */
Gets the track for a corresponding id and deletes this track from database
deleteTrack
{ "repo_name": "Data4All/Data4All", "path": "src/main/java/io/github/data4all/util/TrackUtil.java", "license": "apache-2.0", "size": 6145 }
[ "io.github.data4all.handler.DataBaseHandler", "io.github.data4all.model.data.Track" ]
import io.github.data4all.handler.DataBaseHandler; import io.github.data4all.model.data.Track;
import io.github.data4all.handler.*; import io.github.data4all.model.data.*;
[ "io.github.data4all" ]
io.github.data4all;
854,956
public void filledPolygon(double[] x, double[] y) { int n = x.length; GeneralPath path = new GeneralPath(); path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0])); for (int i = 0; i < n; i++) path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i])); path.closePath(); offscreen.fill(path); draw(); }
void function(double[] x, double[] y) { int n = x.length; GeneralPath path = new GeneralPath(); path.moveTo((float) scaleX(x[0]), (float) scaleY(y[0])); for (int i = 0; i < n; i++) path.lineTo((float) scaleX(x[i]), (float) scaleY(y[i])); path.closePath(); offscreen.fill(path); draw(); }
/** * Draws a filled polygon with the given (x[i], y[i]) coordinates. * * @param x an array of all the x-coordindates of the polygon * @param y an array of all the y-coordindates of the polygon */
Draws a filled polygon with the given (x[i], y[i]) coordinates
filledPolygon
{ "repo_name": "804206793/algs", "path": "src/main/java/edu/princeton/cs/algs4/Draw.java", "license": "gpl-3.0", "size": 47726 }
[ "java.awt.geom.GeneralPath" ]
import java.awt.geom.GeneralPath;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,242,636
public BrokerDestinationView getDestinationView (ActiveMQDestination activeMQDestination) throws Exception { BrokerDestinationView view = null; synchronized(destinationViewMap){ view = destinationViewMap.get(activeMQDestination); if (view==null){ Destination destination = brokerService.getDestination(activeMQDestination); view = new BrokerDestinationView(destination); destinationViewMap.put(activeMQDestination,view); } } return view; }
BrokerDestinationView function (ActiveMQDestination activeMQDestination) throws Exception { BrokerDestinationView view = null; synchronized(destinationViewMap){ view = destinationViewMap.get(activeMQDestination); if (view==null){ Destination destination = brokerService.getDestination(activeMQDestination); view = new BrokerDestinationView(destination); destinationViewMap.put(activeMQDestination,view); } } return view; }
/** * Get the BrokerDestinationView associated with destination * @param activeMQDestination * @return BrokerDestinationView * @throws Exception */
Get the BrokerDestinationView associated with destination
getDestinationView
{ "repo_name": "Mark-Booth/daq-eclipse", "path": "uk.ac.diamond.org.apache.activemq/org/apache/activemq/broker/view/MessageBrokerView.java", "license": "epl-1.0", "size": 9611 }
[ "org.apache.activemq.broker.region.Destination", "org.apache.activemq.command.ActiveMQDestination" ]
import org.apache.activemq.broker.region.Destination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.broker.region.*; import org.apache.activemq.command.*;
[ "org.apache.activemq" ]
org.apache.activemq;
2,047,742
public Object getObject(String uri) throws RepositoryException { assert uri != null; return getObject(getValueFactory().createURI(uri)); }
Object function(String uri) throws RepositoryException { assert uri != null; return getObject(getValueFactory().createURI(uri)); }
/** * Loads a single Object by URI in String form. */
Loads a single Object by URI in String form
getObject
{ "repo_name": "nimble-platform/catalog-service-backend", "path": "libs/alibaba/object-repository/src/main/java/org/openrdf/repository/object/ObjectConnection.java", "license": "apache-2.0", "size": 24740 }
[ "org.openrdf.repository.RepositoryException" ]
import org.openrdf.repository.RepositoryException;
import org.openrdf.repository.*;
[ "org.openrdf.repository" ]
org.openrdf.repository;
2,075,004
public static List<FieldElement> getOnlyAsFieldElements(Collection<? extends PsiMember> members, Collection<? extends PsiMember> selectedNotNullMembers, boolean useAccessors) { List<FieldElement> fieldElementList = new ArrayList<>(); for (PsiMember member : members) { if (member instanceof PsiField) { PsiField field = (PsiField) member; FieldElement fe = ElementFactory.newFieldElement(field, useAccessors); if (selectedNotNullMembers.contains(member)) { fe.setNotNull(true); } fieldElementList.add(fe); } } return fieldElementList; }
static List<FieldElement> function(Collection<? extends PsiMember> members, Collection<? extends PsiMember> selectedNotNullMembers, boolean useAccessors) { List<FieldElement> fieldElementList = new ArrayList<>(); for (PsiMember member : members) { if (member instanceof PsiField) { PsiField field = (PsiField) member; FieldElement fe = ElementFactory.newFieldElement(field, useAccessors); if (selectedNotNullMembers.contains(member)) { fe.setNotNull(true); } fieldElementList.add(fe); } } return fieldElementList; }
/** * Gets the list of members to be put in the VelocityContext. * * @param members a list of {@link PsiMember} objects. * @param selectedNotNullMembers * @param useAccessors * @return a filtered list of only the fields as {@link FieldElement} objects. */
Gets the list of members to be put in the VelocityContext
getOnlyAsFieldElements
{ "repo_name": "paplorinc/intellij-community", "path": "plugins/generate-tostring/src/org/jetbrains/java/generate/element/ElementUtils.java", "license": "apache-2.0", "size": 4176 }
[ "com.intellij.psi.PsiField", "com.intellij.psi.PsiMember", "java.util.ArrayList", "java.util.Collection", "java.util.List" ]
import com.intellij.psi.PsiField; import com.intellij.psi.PsiMember; import java.util.ArrayList; import java.util.Collection; import java.util.List;
import com.intellij.psi.*; import java.util.*;
[ "com.intellij.psi", "java.util" ]
com.intellij.psi; java.util;
1,751,826
public void importResourcesWithTempProject(String importFile) throws Exception { CmsProject project = m_cms.createProject( "SystemUpdate", getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
void function(String importFile) throws Exception { CmsProject project = m_cms.createProject( STR, getMessages().key(Messages.GUI_SHELL_IMPORT_TEMP_PROJECT_NAME_0), OpenCms.getDefaultUsers().getGroupAdministrators(), OpenCms.getDefaultUsers().getGroupAdministrators(), CmsProject.PROJECT_TYPE_TEMPORARY); CmsUUID id = project.getUuid(); m_cms.getRequestContext().setCurrentProject(project); m_cms.copyResourceToProject("/"); CmsImportParameters params = new CmsImportParameters(importFile, "/", true); OpenCms.getImportExportManager().importData( m_cms, new CmsShellReport(m_cms.getRequestContext().getLocale()), params); m_cms.unlockProject(id); OpenCms.getPublishManager().publishProject(m_cms); OpenCms.getPublishManager().waitWhileRunning(); }
/** * Imports a folder or a ZIP file to the root folder of the * current site, creating a temporary project for this.<p> * * @param importFile the absolute path of the import resource * @throws Exception if something goes wrong */
Imports a folder or a ZIP file to the root folder of the current site, creating a temporary project for this
importResourcesWithTempProject
{ "repo_name": "comundus/opencms-comundus", "path": "src/main/java/org/opencms/main/CmsShellCommands.java", "license": "lgpl-2.1", "size": 43138 }
[ "org.opencms.file.CmsProject", "org.opencms.importexport.CmsImportParameters", "org.opencms.report.CmsShellReport", "org.opencms.util.CmsUUID" ]
import org.opencms.file.CmsProject; import org.opencms.importexport.CmsImportParameters; import org.opencms.report.CmsShellReport; import org.opencms.util.CmsUUID;
import org.opencms.file.*; import org.opencms.importexport.*; import org.opencms.report.*; import org.opencms.util.*;
[ "org.opencms.file", "org.opencms.importexport", "org.opencms.report", "org.opencms.util" ]
org.opencms.file; org.opencms.importexport; org.opencms.report; org.opencms.util;
1,696,420
@Test public void testChecksumChunks() throws IOException { testChecksumInternals(false); testChecksumInternals(true); }
void function() throws IOException { testChecksumInternals(false); testChecksumInternals(true); }
/** * Test different values of bytesPerChecksum */
Test different values of bytesPerChecksum
testChecksumChunks
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestChecksum.java", "license": "apache-2.0", "size": 12199 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,377,855
DataHandler getAttachment(String id);
DataHandler getAttachment(String id);
/** * Returns the attachment specified by the id * * @param id the id under which the attachment is stored * @return the data handler for this attachment or <tt>null</tt> */
Returns the attachment specified by the id
getAttachment
{ "repo_name": "aaronwalker/camel", "path": "camel-core/src/main/java/org/apache/camel/Message.java", "license": "apache-2.0", "size": 9298 }
[ "javax.activation.DataHandler" ]
import javax.activation.DataHandler;
import javax.activation.*;
[ "javax.activation" ]
javax.activation;
2,220,153
String submitQuery(Database database, String query);
String submitQuery(Database database, String query);
/** * Submits the given query to Athena and provide the queryExecutionId of the query * * @param database The glue {@link Database} where the query will be run against * @param query The query to run * @return The queryExecutionId of the query */
Submits the given query to Athena and provide the queryExecutionId of the query
submitQuery
{ "repo_name": "xschildw/Synapse-Repository-Services", "path": "lib/jdomodels/src/main/java/org/sagebionetworks/repo/model/athena/AthenaSupport.java", "license": "apache-2.0", "size": 6746 }
[ "com.amazonaws.services.glue.model.Database" ]
import com.amazonaws.services.glue.model.Database;
import com.amazonaws.services.glue.model.*;
[ "com.amazonaws.services" ]
com.amazonaws.services;
2,553,853
protected boolean removePointsInViews(Connection conn, PointList newLine) { boolean bChanged = false; // error checking if (conn == null || newLine == null) { throw new IllegalArgumentException("null connection illegal"); } // check whether the method should be executed. if (newLine.size() < 3) return false; if (conn.getSourceAnchor().getOwner() == null) return false; if (conn.getTargetAnchor().getOwner() == null) return false; Rectangle startRect = new Rectangle(getOwnerBounds(conn .getSourceAnchor())); conn.getSourceAnchor().getOwner().translateToAbsolute(startRect); conn.translateToRelative(startRect); Rectangle endRect = new Rectangle( getOwnerBounds(conn.getTargetAnchor())); conn.getTargetAnchor().getOwner().translateToAbsolute(endRect); conn.translateToRelative(endRect); // Ignore the first and last points PointList newPoints = new PointList(newLine.size()); for (int i = 0; i < newLine.size(); i++) { Point pt = newLine.getPoint(i); if (i == 0 || i == newLine.size() - 1) newPoints.addPoint(pt); else if (!startRect.contains(pt) && !endRect.contains(pt)) { newPoints.addPoint(pt); } else { bChanged = true; } } if (newPoints.size() != newLine.size()) { newLine.removeAllPoints(); for (int i = 0; i < newPoints.size(); i++) newLine.addPoint(new Point(newPoints.getPoint(i))); } return bChanged; }
boolean function(Connection conn, PointList newLine) { boolean bChanged = false; if (conn == null newLine == null) { throw new IllegalArgumentException(STR); } if (newLine.size() < 3) return false; if (conn.getSourceAnchor().getOwner() == null) return false; if (conn.getTargetAnchor().getOwner() == null) return false; Rectangle startRect = new Rectangle(getOwnerBounds(conn .getSourceAnchor())); conn.getSourceAnchor().getOwner().translateToAbsolute(startRect); conn.translateToRelative(startRect); Rectangle endRect = new Rectangle( getOwnerBounds(conn.getTargetAnchor())); conn.getTargetAnchor().getOwner().translateToAbsolute(endRect); conn.translateToRelative(endRect); PointList newPoints = new PointList(newLine.size()); for (int i = 0; i < newLine.size(); i++) { Point pt = newLine.getPoint(i); if (i == 0 i == newLine.size() - 1) newPoints.addPoint(pt); else if (!startRect.contains(pt) && !endRect.contains(pt)) { newPoints.addPoint(pt); } else { bChanged = true; } } if (newPoints.size() != newLine.size()) { newLine.removeAllPoints(); for (int i = 0; i < newPoints.size(); i++) newLine.addPoint(new Point(newPoints.getPoint(i))); } return bChanged; }
/** * Method removePointsInViews. This method will parse through all the points * in the given polyline and remove any of the points that intersect with * the start and end figures. * * @param conn * Connection figure that is currently being routed * @param newLine * PointList that will contain the filtered list of points * @return boolean true if newLine points changed, false otherwise. * @throws IllegalArgumentException * if either paramter is null. */
Method removePointsInViews. This method will parse through all the points in the given polyline and remove any of the points that intersect with the start and end figures
removePointsInViews
{ "repo_name": "StephaneSeyvoz/mindEd", "path": "org.ow2.mindEd.adl.editor.graphic.ui/customsrc/org/ow2/mindEd/adl/editor/graphic/ui/custom/layouts/RectilinearRouterEx.java", "license": "lgpl-3.0", "size": 32826 }
[ "org.eclipse.draw2d.Connection", "org.eclipse.draw2d.geometry.Point", "org.eclipse.draw2d.geometry.PointList", "org.eclipse.draw2d.geometry.Rectangle" ]
import org.eclipse.draw2d.Connection; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.PointList; import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
1,179,004
PagedIterable<Operation> list(Context context);
PagedIterable<Operation> list(Context context);
/** * Lists available operations for the Microsoft.Kusto provider. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of the request to list REST API operations as paginated response with {@link PagedIterable}. */
Lists available operations for the Microsoft.Kusto provider
list
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/kusto/azure-resourcemanager-kusto/src/main/java/com/azure/resourcemanager/kusto/models/Operations.java", "license": "mit", "size": 1456 }
[ "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context" ]
import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context;
import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
64,402
public WorkloadNetworkDnsServiceInner withLogLevel(DnsServiceLogLevelEnum logLevel) { if (this.innerProperties() == null) { this.innerProperties = new WorkloadNetworkDnsServiceProperties(); } this.innerProperties().withLogLevel(logLevel); return this; }
WorkloadNetworkDnsServiceInner function(DnsServiceLogLevelEnum logLevel) { if (this.innerProperties() == null) { this.innerProperties = new WorkloadNetworkDnsServiceProperties(); } this.innerProperties().withLogLevel(logLevel); return this; }
/** * Set the logLevel property: DNS Service log level. * * @param logLevel the logLevel value to set. * @return the WorkloadNetworkDnsServiceInner object itself. */
Set the logLevel property: DNS Service log level
withLogLevel
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/avs/azure-resourcemanager-avs/src/main/java/com/azure/resourcemanager/avs/fluent/models/WorkloadNetworkDnsServiceInner.java", "license": "mit", "size": 6784 }
[ "com.azure.resourcemanager.avs.models.DnsServiceLogLevelEnum" ]
import com.azure.resourcemanager.avs.models.DnsServiceLogLevelEnum;
import com.azure.resourcemanager.avs.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
1,628,729
@Metadata(description = "Allows to configure a custom value of the response header size on the Jetty connectors.") public void setResponseHeaderSize(Integer responseHeaderSize) { this.responseHeaderSize = responseHeaderSize; }
@Metadata(description = STR) void function(Integer responseHeaderSize) { this.responseHeaderSize = responseHeaderSize; }
/** * Allows to configure a custom value of the response header size on the Jetty connectors. */
Allows to configure a custom value of the response header size on the Jetty connectors
setResponseHeaderSize
{ "repo_name": "satishgummadelli/camel", "path": "components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java", "license": "apache-2.0", "size": 57094 }
[ "org.apache.camel.spi.Metadata" ]
import org.apache.camel.spi.Metadata;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
1,816,934
public void requestHardReset() { // Clear the queues // If we're resetting, there's no point in queuing messages! sendQueue.clear(); recvQueue.clear(); // Hard reset the stick - everything will be reset to factory default SerialMessage msg = new ControllerSetDefaultMessageClass().doRequest(); msg.attempts = 1; this.enqueue(msg); // Clear all the nodes and we'll reinitialise this.zwaveNodes.clear(); this.enqueue(new SerialApiGetInitDataMessageClass().doRequest()); }
void function() { sendQueue.clear(); recvQueue.clear(); SerialMessage msg = new ControllerSetDefaultMessageClass().doRequest(); msg.attempts = 1; this.enqueue(msg); this.zwaveNodes.clear(); this.enqueue(new SerialApiGetInitDataMessageClass().doRequest()); }
/** * Sends a request to perform a hard reset on the controller. * This will reset the controller to its default, resetting the network completely */
Sends a request to perform a hard reset on the controller. This will reset the controller to its default, resetting the network completely
requestHardReset
{ "repo_name": "cschneider/openhab", "path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/ZWaveController.java", "license": "epl-1.0", "size": 55071 }
[ "org.openhab.binding.zwave.internal.protocol.serialmessage.ControllerSetDefaultMessageClass", "org.openhab.binding.zwave.internal.protocol.serialmessage.SerialApiGetInitDataMessageClass" ]
import org.openhab.binding.zwave.internal.protocol.serialmessage.ControllerSetDefaultMessageClass; import org.openhab.binding.zwave.internal.protocol.serialmessage.SerialApiGetInitDataMessageClass;
import org.openhab.binding.zwave.internal.protocol.serialmessage.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,478,605
private void setupMacOSXLeopardStyle() { // <editor-fold defaultstate="collapsed" desc="Initiation of some UI-stuff particular for Mac OS X"> // now we have to change back the background-color of all components in the mainpart of the // frame, since the brush-metal-look applies to all components // // other components become normal gray - which is, however, a little bit // darker than the default gray // // snow-leopard and java 6/7 have different color-rendering, we need a different // background-color for OS X 10.5 and above as well as java 6 and 7 Color backcol = ColorUtil.getMacBackgroundColor(); // on Leopard (OS X 10.5), we have different rendering, thus we need these lines if (PlatformUtil.isLeopard()) { mainPanel.setBackground(backcol); } jPanelMainRight.setBackground(backcol); jSplitPaneMain1.setBackground(backcol); jSplitPane1.setBackground(backcol); jSplitPaneMain2.setBackground(backcol); jSplitPaneLinks.setBackground(backcol); jSplitPaneAuthors.setBackground(backcol); jTabbedPaneMain.setBackground(backcol); jPanel1.setBackground(backcol); jPanel2.setBackground(backcol); jPanel7.setBackground(backcol); jPanel8.setBackground(backcol); jPanel9.setBackground(backcol); jPanel10.setBackground(backcol); jPanel11.setBackground(backcol); jPanel13.setBackground(backcol); jPanel14.setBackground(backcol); jPanel15.setBackground(backcol); jPanelLiveSearch.setBackground(backcol); jPanelManLinks.setBackground(backcol); jPanelDispAuthor.setBackground(backcol); // make searchfields look like mac searchTextFieldVariants(); // remove custim borders jScrollPane2.setBorder(null); jScrollPane5.setBorder(null); jScrollPane16.setBorder(null); // make refresh buttons look like mac // get the action map javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class).getContext().getActionMap(ZettelkastenView.class, this); // init variables AbstractAction ac; // get the toolbar-action ac = (AbstractAction) actionMap.get("findLiveCancel"); // and change the large-icon-property, which is applied to the toolbar-icons, // to the new icon ac.putValue(AbstractAction.LARGE_ICON_KEY,new ImageIcon(Toolkit.getDefaultToolkit().getImage("NSImage://NSStopProgressFreestandingTemplate").getScaledInstance(16, 16,Image.SCALE_SMOOTH))); ac.putValue(AbstractAction.SMALL_ICON,new ImageIcon(Toolkit.getDefaultToolkit().getImage("NSImage://NSStopProgressFreestandingTemplate").getScaledInstance(16, 16,Image.SCALE_SMOOTH))); // </editor-fold> }
void function() { Color backcol = ColorUtil.getMacBackgroundColor(); if (PlatformUtil.isLeopard()) { mainPanel.setBackground(backcol); } jPanelMainRight.setBackground(backcol); jSplitPaneMain1.setBackground(backcol); jSplitPane1.setBackground(backcol); jSplitPaneMain2.setBackground(backcol); jSplitPaneLinks.setBackground(backcol); jSplitPaneAuthors.setBackground(backcol); jTabbedPaneMain.setBackground(backcol); jPanel1.setBackground(backcol); jPanel2.setBackground(backcol); jPanel7.setBackground(backcol); jPanel8.setBackground(backcol); jPanel9.setBackground(backcol); jPanel10.setBackground(backcol); jPanel11.setBackground(backcol); jPanel13.setBackground(backcol); jPanel14.setBackground(backcol); jPanel15.setBackground(backcol); jPanelLiveSearch.setBackground(backcol); jPanelManLinks.setBackground(backcol); jPanelDispAuthor.setBackground(backcol); searchTextFieldVariants(); jScrollPane2.setBorder(null); jScrollPane5.setBorder(null); jScrollPane16.setBorder(null); javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(de.danielluedecke.zettelkasten.ZettelkastenApp.class).getContext().getActionMap(ZettelkastenView.class, this); AbstractAction ac; ac = (AbstractAction) actionMap.get(STR); ac.putValue(AbstractAction.LARGE_ICON_KEY,new ImageIcon(Toolkit.getDefaultToolkit().getImage(STRNSImage: }
/** * This method applies some graphical stuff so the appearance of the program is even more * mac-like... */
This method applies some graphical stuff so the appearance of the program is even more mac-like..
setupMacOSXLeopardStyle
{ "repo_name": "ct2034/Zettelkasten", "path": "src/de/danielluedecke/zettelkasten/ZettelkastenView.java", "license": "gpl-3.0", "size": 765056 }
[ "de.danielluedecke.zettelkasten.util.ColorUtil", "de.danielluedecke.zettelkasten.util.PlatformUtil", "java.awt.Color", "java.awt.Toolkit", "javax.swing.AbstractAction", "javax.swing.ImageIcon", "org.jdesktop.application.Application" ]
import de.danielluedecke.zettelkasten.util.ColorUtil; import de.danielluedecke.zettelkasten.util.PlatformUtil; import java.awt.Color; import java.awt.Toolkit; import javax.swing.AbstractAction; import javax.swing.ImageIcon; import org.jdesktop.application.Application;
import de.danielluedecke.zettelkasten.util.*; import java.awt.*; import javax.swing.*; import org.jdesktop.application.*;
[ "de.danielluedecke.zettelkasten", "java.awt", "javax.swing", "org.jdesktop.application" ]
de.danielluedecke.zettelkasten; java.awt; javax.swing; org.jdesktop.application;
1,236,145
public static void setTemplateDirectory(File directory) throws ChangelogManagerException { if (!directory.exists()) { throw new ChangelogManagerException("Could not find the template directory {" + directory + "}"); } templateDirectory = directory; }
static void function(File directory) throws ChangelogManagerException { if (!directory.exists()) { throw new ChangelogManagerException(STR + directory + "}"); } templateDirectory = directory; }
/** * Sets the template directory * * @param templateDirectory * @throws ChangelogManagerException */
Sets the template directory
setTemplateDirectory
{ "repo_name": "gentics/maven-changelog-plugin", "path": "src/main/java/com/gentics/changelogmanager/ChangelogConfiguration.java", "license": "apache-2.0", "size": 9224 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,755,328
protected void disconnect(FTPClient client) { if (client != null) { if (client.isConnected()) { try { client.disconnect(); } catch (Exception e) { LoggingHelper.handleException(this, "Failed to disconnect!", e); } } } }
void function(FTPClient client) { if (client != null) { if (client.isConnected()) { try { client.disconnect(); } catch (Exception e) { LoggingHelper.handleException(this, STR, e); } } } }
/** * Disconnects the SSH session, if necessary. * * @param client the client to disconnect */
Disconnects the SSH session, if necessary
disconnect
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-net/src/main/java/adams/core/io/lister/FtpDirectoryLister.java", "license": "gpl-3.0", "size": 12345 }
[ "org.apache.commons.net.ftp.FTPClient" ]
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.*;
[ "org.apache.commons" ]
org.apache.commons;
2,617,102
DatanodeProtocolClientSideTranslatorPB connectToNN( InetSocketAddress nnAddr) throws IOException { return new DatanodeProtocolClientSideTranslatorPB(nnAddr, conf); }
DatanodeProtocolClientSideTranslatorPB connectToNN( InetSocketAddress nnAddr) throws IOException { return new DatanodeProtocolClientSideTranslatorPB(nnAddr, conf); }
/** * Connect to the NN. This is separated out for easier testing. */
Connect to the NN. This is separated out for easier testing
connectToNN
{ "repo_name": "myeoje/PhillyYarn", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java", "license": "apache-2.0", "size": 118725 }
[ "java.io.IOException", "java.net.InetSocketAddress", "org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB" ]
import java.io.IOException; import java.net.InetSocketAddress; import org.apache.hadoop.hdfs.protocolPB.DatanodeProtocolClientSideTranslatorPB;
import java.io.*; import java.net.*; import org.apache.hadoop.hdfs.*;
[ "java.io", "java.net", "org.apache.hadoop" ]
java.io; java.net; org.apache.hadoop;
728,146
public void testOnFlushDirtyUpdateNoLastUpdateTime() { mockPropertyNames = new String[]{"foo", "bar"}; boolean result = interceptor.onFlushDirty(mockEntity, mockId, mockCurrentState, mockPreviousState, mockPropertyNames, mockTypes); assertFalse("wrong result", result); assertFalse("wrong value in state", mockCurrentState[1] instanceof Date); }
void function() { mockPropertyNames = new String[]{"foo", "bar"}; boolean result = interceptor.onFlushDirty(mockEntity, mockId, mockCurrentState, mockPreviousState, mockPropertyNames, mockTypes); assertFalse(STR, result); assertFalse(STR, mockCurrentState[1] instanceof Date); }
/** Test on flush dirty update no last update time. */
Test on flush dirty update no last update time
testOnFlushDirtyUpdateNoLastUpdateTime
{ "repo_name": "alarulrajan/CodeFest", "path": "test/com/technoetic/xplanner/db/TestXPlannerInterceptor.java", "license": "gpl-2.0", "size": 3078 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,736,318
public void setIdentifiers(Collection<? extends Identifier> newValues) { newValues = NonMarshalledAuthority.setMarshallables(identifiers, newValues); identifiers = writeCollection(newValues, identifiers, Identifier.class); }
void function(Collection<? extends Identifier> newValues) { newValues = NonMarshalledAuthority.setMarshallables(identifiers, newValues); identifiers = writeCollection(newValues, identifiers, Identifier.class); }
/** * Sets the code used to identify the objective. * * <p>XML identifiers ({@linkplain IdentifierSpace#ID ID}, {@linkplain IdentifierSpace#UUID UUID}, <i>etc.</i>), * are not affected by this method, unless they are explicitly provided in the given collection.</p> * * @param newValues the new identifiers values. */
Sets the code used to identify the objective. XML identifiers (IdentifierSpace#ID ID, IdentifierSpace#UUID UUID, etc.), are not affected by this method, unless they are explicitly provided in the given collection
setIdentifiers
{ "repo_name": "apache/sis", "path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/acquisition/DefaultObjective.java", "license": "apache-2.0", "size": 13858 }
[ "java.util.Collection", "org.apache.sis.internal.jaxb.NonMarshalledAuthority", "org.opengis.metadata.Identifier" ]
import java.util.Collection; import org.apache.sis.internal.jaxb.NonMarshalledAuthority; import org.opengis.metadata.Identifier;
import java.util.*; import org.apache.sis.internal.jaxb.*; import org.opengis.metadata.*;
[ "java.util", "org.apache.sis", "org.opengis.metadata" ]
java.util; org.apache.sis; org.opengis.metadata;
968,223
public void testRemove3() { Label label = new Label("label", "text"); Action mambo = new Action("mambo"); MetaDataRoleAuthorizationStrategy strategy = new MetaDataRoleAuthorizationStrategy( new IRoleCheckingStrategy() {
void function() { Label label = new Label("label", "text"); Action mambo = new Action("mambo"); MetaDataRoleAuthorizationStrategy strategy = new MetaDataRoleAuthorizationStrategy( new IRoleCheckingStrategy() {
/** * Test consistency in behavior between authorizing a role for an action and then unauthorizing * it with {@link #testRemove2()}. */
Test consistency in behavior between authorizing a role for an action and then unauthorizing it with <code>#testRemove2()</code>
testRemove3
{ "repo_name": "afiantara/apache-wicket-1.5.7", "path": "src/wicket-auth-roles/src/test/java/org/apache/wicket/authroles/authorization/strategies/role/metadata/ActionPermissionsTest.java", "license": "apache-2.0", "size": 4139 }
[ "org.apache.wicket.authorization.Action", "org.apache.wicket.authroles.authorization.strategies.role.IRoleCheckingStrategy", "org.apache.wicket.markup.html.basic.Label" ]
import org.apache.wicket.authorization.Action; import org.apache.wicket.authroles.authorization.strategies.role.IRoleCheckingStrategy; import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.authorization.*; import org.apache.wicket.authroles.authorization.strategies.role.*; import org.apache.wicket.markup.html.basic.*;
[ "org.apache.wicket" ]
org.apache.wicket;
569,748
public CoinbaseTransaction requestMoneyCoinbaseRequest(CoinbaseRequestMoneyRequest transactionRequest) throws IOException { final CoinbaseTransaction pendingTransaction = coinbase.requestMoney(new CoinbaseTransaction(transactionRequest), exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory()); return handleResponse(pendingTransaction); }
CoinbaseTransaction function(CoinbaseRequestMoneyRequest transactionRequest) throws IOException { final CoinbaseTransaction pendingTransaction = coinbase.requestMoney(new CoinbaseTransaction(transactionRequest), exchange.getExchangeSpecification().getApiKey(), signatureCreator, exchange.getNonceFactory()); return handleResponse(pendingTransaction); }
/** * Authenticated resource which lets the user request money from a Bitcoin * address. * * @see <a * href="https://coinbase.com/api/doc/1.0/transactions/request_money.html">coinbase.com/api/doc/1.0/transactions/request_money.html</a> * @param transactionRequest * @return A pending {@code CoinbaseTransaction} representing the desired * {@code CoinbaseRequestMoneyRequest}. * @throws IOException */
Authenticated resource which lets the user request money from a Bitcoin address
requestMoneyCoinbaseRequest
{ "repo_name": "coingecko/XChange", "path": "xchange-coinbase/src/main/java/com/xeiam/xchange/coinbase/service/polling/CoinbaseAccountServiceRaw.java", "license": "mit", "size": 27724 }
[ "com.xeiam.xchange.coinbase.dto.account.CoinbaseTransaction", "java.io.IOException" ]
import com.xeiam.xchange.coinbase.dto.account.CoinbaseTransaction; import java.io.IOException;
import com.xeiam.xchange.coinbase.dto.account.*; import java.io.*;
[ "com.xeiam.xchange", "java.io" ]
com.xeiam.xchange; java.io;
1,834,117
IVersionBean getRepSearchEngineVersionBean(); /** * Creates a new {@link IRepSearchEngine}. * * @param repFiltersBean replay filters bean to search / filter by * @return a new {@link IRepSearchEngine}
IVersionBean getRepSearchEngineVersionBean(); /** * Creates a new {@link IRepSearchEngine}. * * @param repFiltersBean replay filters bean to search / filter by * @return a new {@link IRepSearchEngine}
/** * Returns the version of the replay search engine. * * @return the version of the replay search engine */
Returns the version of the replay search engine
getRepSearchEngineVersionBean
{ "repo_name": "icza/scelight", "path": "src-ext-mod-api/hu/scelightapi/service/IFactory.java", "license": "apache-2.0", "size": 15365 }
[ "hu.scelightapi.search.IRepSearchEngine", "hu.scelightapibase.bean.IVersionBean" ]
import hu.scelightapi.search.IRepSearchEngine; import hu.scelightapibase.bean.IVersionBean;
import hu.scelightapi.search.*; import hu.scelightapibase.bean.*;
[ "hu.scelightapi.search", "hu.scelightapibase.bean" ]
hu.scelightapi.search; hu.scelightapibase.bean;
938,669
private void incrementModCounts() { if (externalMessageList != null) { externalMessageList.incrementModCount(); } if (externalBuilderList != null) { externalBuilderList.incrementModCount(); } if (externalMessageOrBuilderList != null) { externalMessageOrBuilderList.incrementModCount(); } } private static class MessageExternalList< MType extends AbstractMessage, BType extends AbstractMessage.Builder, IType extends MessageOrBuilder> extends AbstractList<MType> implements List<MType> { RepeatedFieldBuilderV3<MType, BType, IType> builder; MessageExternalList(RepeatedFieldBuilderV3<MType, BType, IType> builder) { this.builder = builder; }
void function() { if (externalMessageList != null) { externalMessageList.incrementModCount(); } if (externalBuilderList != null) { externalBuilderList.incrementModCount(); } if (externalMessageOrBuilderList != null) { externalMessageOrBuilderList.incrementModCount(); } } private static class MessageExternalList< MType extends AbstractMessage, BType extends AbstractMessage.Builder, IType extends MessageOrBuilder> extends AbstractList<MType> implements List<MType> { RepeatedFieldBuilderV3<MType, BType, IType> builder; MessageExternalList(RepeatedFieldBuilderV3<MType, BType, IType> builder) { this.builder = builder; }
/** * Increments the mod counts so that an ConcurrentModificationException can be thrown if calling * code tries to modify the builder while its iterating the list. */
Increments the mod counts so that an ConcurrentModificationException can be thrown if calling code tries to modify the builder while its iterating the list
incrementModCounts
{ "repo_name": "endlessm/chromium-browser", "path": "third_party/protobuf/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java", "license": "bsd-3-clause", "size": 22670 }
[ "java.util.AbstractList", "java.util.List" ]
import java.util.AbstractList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,761,478
@Override IComplexNDArray rdivi(INDArray other, INDArray result);
IComplexNDArray rdivi(INDArray other, INDArray result);
/** * Reverse division (in-place) * * @param other the other ndarray to subtract * @param result the result ndarray * @return the ndarray with the operation applied */
Reverse division (in-place)
rdivi
{ "repo_name": "wlin12/JNN", "path": "src/org/nd4j/linalg/api/complex/IComplexNDArray.java", "license": "apache-2.0", "size": 32141 }
[ "org.nd4j.linalg.api.ndarray.INDArray" ]
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.api.ndarray.*;
[ "org.nd4j.linalg" ]
org.nd4j.linalg;
1,318,311
@Override public UserModel validateAndProxy(RealmModel realm, UserModel local) { if (isValid(realm, local)) { return new WritableUserModelProxy(local, this); } else { return null; } }
UserModel function(RealmModel realm, UserModel local) { if (isValid(realm, local)) { return new WritableUserModelProxy(local, this); } else { return null; } }
/** * Keycloak will call this method if it finds an imported UserModel. Here we proxy the UserModel with * a Writable proxy which will synchronize updates to username and password back to the properties file * * @param local * @return */
Keycloak will call this method if it finds an imported UserModel. Here we proxy the UserModel with a Writable proxy which will synchronize updates to username and password back to the properties file
validateAndProxy
{ "repo_name": "jean-merelis/keycloak", "path": "examples/providers/federation-provider/src/main/java/org/keycloak/examples/federation/properties/FilePropertiesFederationProvider.java", "license": "apache-2.0", "size": 3017 }
[ "org.keycloak.models.RealmModel", "org.keycloak.models.UserModel" ]
import org.keycloak.models.RealmModel; import org.keycloak.models.UserModel;
import org.keycloak.models.*;
[ "org.keycloak.models" ]
org.keycloak.models;
361,414
public Builder put(final String key, final ByteSizeValue byteSizeValue) { return put(key, byteSizeValue.getStringRep()); }
Builder function(final String key, final ByteSizeValue byteSizeValue) { return put(key, byteSizeValue.getStringRep()); }
/** * Sets a byteSizeValue setting with the provided setting key and byteSizeValue. * * @param key The setting key * @param byteSizeValue The setting value * @return The builder */
Sets a byteSizeValue setting with the provided setting key and byteSizeValue
put
{ "repo_name": "GlenRSmith/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/settings/Settings.java", "license": "apache-2.0", "size": 59585 }
[ "org.elasticsearch.common.unit.ByteSizeValue" ]
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
889,946
@Override public String getLocation() throws FormulaNotFoundException { if( getName() != null ) { try { return getName().getLocation(); } catch( Exception e ) { ; } } return null; }
String function() throws FormulaNotFoundException { if( getName() != null ) { try { return getName().getLocation(); } catch( Exception e ) { ; } } return null; }
/** * return referenced Names' location * * @see GenericPtg#getLocation() */
return referenced Names' location
getLocation
{ "repo_name": "Maxels88/openxls", "path": "src/main/java/org/openxls/formats/XLS/formulas/PtgName.java", "license": "gpl-3.0", "size": 7114 }
[ "org.openxls.formats.XLS" ]
import org.openxls.formats.XLS;
import org.openxls.formats.*;
[ "org.openxls.formats" ]
org.openxls.formats;
2,196,060
public Object getUserData(Node n, String key) { if (userData == null) { return null; } Hashtable t = (Hashtable) userData.get(n); if (t == null) { return null; } Object o = t.get(key); if (o != null) { UserDataRecord r = (UserDataRecord) o; return r.fData; } return null; }
Object function(Node n, String key) { if (userData == null) { return null; } Hashtable t = (Hashtable) userData.get(n); if (t == null) { return null; } Object o = t.get(key); if (o != null) { UserDataRecord r = (UserDataRecord) o; return r.fData; } return null; }
/** * Retrieves the object associated to a key on a this node. The object * must first have been set to this node by calling * <code>setUserData</code> with the same key. * @param n The node the object is associated to. * @param key The key the object is associated to. * @return Returns the <code>DOMObject</code> associated to the given key * on this node, or <code>null</code> if there was none. * @since DOM Level 3 */
Retrieves the object associated to a key on a this node. The object must first have been set to this node by calling <code>setUserData</code> with the same key
getUserData
{ "repo_name": "lostdj/Jaklin-OpenJDK-JAXP", "path": "src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java", "license": "gpl-2.0", "size": 98527 }
[ "java.util.Hashtable", "org.w3c.dom.Node" ]
import java.util.Hashtable; import org.w3c.dom.Node;
import java.util.*; import org.w3c.dom.*;
[ "java.util", "org.w3c.dom" ]
java.util; org.w3c.dom;
2,125,083
public unesco_region_country findByunescoregionid_First( int unesco_region_id, OrderByComparator orderByComparator) throws NoSuchunesco_region_countryException, SystemException { unesco_region_country unesco_region_country = fetchByunescoregionid_First(unesco_region_id, orderByComparator); if (unesco_region_country != null) { return unesco_region_country; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("unesco_region_id="); msg.append(unesco_region_id); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchunesco_region_countryException(msg.toString()); }
unesco_region_country function( int unesco_region_id, OrderByComparator orderByComparator) throws NoSuchunesco_region_countryException, SystemException { unesco_region_country unesco_region_country = fetchByunescoregionid_First(unesco_region_id, orderByComparator); if (unesco_region_country != null) { return unesco_region_country; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append(STR); msg.append(unesco_region_id); msg.append(StringPool.CLOSE_CURLY_BRACE); throw new NoSuchunesco_region_countryException(msg.toString()); }
/** * Returns the first unesco_region_country in the ordered set where unesco_region_id = &#63;. * * @param unesco_region_id the unesco_region_id * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the first matching unesco_region_country * @throws com.iucn.whp.dbservice.NoSuchunesco_region_countryException if a matching unesco_region_country could not be found * @throws SystemException if a system exception occurred */
Returns the first unesco_region_country in the ordered set where unesco_region_id = &#63;
findByunescoregionid_First
{ "repo_name": "iucn-whp/world-heritage-outlook", "path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/persistence/unesco_region_countryPersistenceImpl.java", "license": "gpl-2.0", "size": 61281 }
[ "com.liferay.portal.kernel.exception.SystemException", "com.liferay.portal.kernel.util.OrderByComparator", "com.liferay.portal.kernel.util.StringBundler", "com.liferay.portal.kernel.util.StringPool" ]
import com.liferay.portal.kernel.exception.SystemException; import com.liferay.portal.kernel.util.OrderByComparator; import com.liferay.portal.kernel.util.StringBundler; import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.exception.*; import com.liferay.portal.kernel.util.*;
[ "com.liferay.portal" ]
com.liferay.portal;
409,692
public Evaluation createEvaluation(Evaluation eval, Long userId) throws Exception { MockHttpServletRequest request = ServletTestHelperUtils.initRequest( HTTPMODE.POST, UrlHelpers.EVALUATION, userId, token(userId), eval); MockHttpServletResponse response = ServletTestHelperUtils .dispatchRequest(dispatcherServlet, request, HttpStatus.CREATED); return new Evaluation(ServletTestHelperUtils.readResponseJSON(response)); }
Evaluation function(Evaluation eval, Long userId) throws Exception { MockHttpServletRequest request = ServletTestHelperUtils.initRequest( HTTPMODE.POST, UrlHelpers.EVALUATION, userId, token(userId), eval); MockHttpServletResponse response = ServletTestHelperUtils .dispatchRequest(dispatcherServlet, request, HttpStatus.CREATED); return new Evaluation(ServletTestHelperUtils.readResponseJSON(response)); }
/** * Creates an evaluation */
Creates an evaluation
createEvaluation
{ "repo_name": "Sage-Bionetworks/Synapse-Repository-Services", "path": "services/repository/src/test/java/org/sagebionetworks/repo/web/controller/EntityServletTestHelper.java", "license": "apache-2.0", "size": 50576 }
[ "org.sagebionetworks.evaluation.model.Evaluation", "org.sagebionetworks.repo.web.UrlHelpers", "org.springframework.http.HttpStatus", "org.springframework.mock.web.MockHttpServletRequest", "org.springframework.mock.web.MockHttpServletResponse" ]
import org.sagebionetworks.evaluation.model.Evaluation; import org.sagebionetworks.repo.web.UrlHelpers; import org.springframework.http.HttpStatus; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse;
import org.sagebionetworks.evaluation.model.*; import org.sagebionetworks.repo.web.*; import org.springframework.http.*; import org.springframework.mock.web.*;
[ "org.sagebionetworks.evaluation", "org.sagebionetworks.repo", "org.springframework.http", "org.springframework.mock" ]
org.sagebionetworks.evaluation; org.sagebionetworks.repo; org.springframework.http; org.springframework.mock;
26,765
static URI updateToSecureConnectionIfNeeded(URI uri, ServiceInstance ribbonServer) { String scheme = uri.getScheme(); if (StringUtils.isEmpty(scheme)) { scheme = "http"; } if (!StringUtils.isEmpty(uri.toString()) && unsecureSchemeMapping.containsKey(scheme) && ribbonServer.isSecure()) { return upgradeConnection(uri, unsecureSchemeMapping.get(scheme)); } return uri; }
static URI updateToSecureConnectionIfNeeded(URI uri, ServiceInstance ribbonServer) { String scheme = uri.getScheme(); if (StringUtils.isEmpty(scheme)) { scheme = "http"; } if (!StringUtils.isEmpty(uri.toString()) && unsecureSchemeMapping.containsKey(scheme) && ribbonServer.isSecure()) { return upgradeConnection(uri, unsecureSchemeMapping.get(scheme)); } return uri; }
/** * Replace the scheme to the secure variant if needed. If the {@link #unsecureSchemeMapping} map contains the uri * scheme and {@link #isSecure(IClientConfig, ServerIntrospector, Server)} is true, update the scheme. * This assumes the uri is already encoded to avoid double encoding. * * @param uri * @param ribbonServer * @return */
Replace the scheme to the secure variant if needed. If the <code>#unsecureSchemeMapping</code> map contains the uri scheme and <code>#isSecure(IClientConfig, ServerIntrospector, Server)</code> is true, update the scheme. This assumes the uri is already encoded to avoid double encoding
updateToSecureConnectionIfNeeded
{ "repo_name": "brenuart/spring-cloud-netflix", "path": "spring-cloud-netflix-ribbon/src/main/java/org/springframework/cloud/netflix/ribbon/RibbonUtils.java", "license": "apache-2.0", "size": 5556 }
[ "org.springframework.cloud.client.ServiceInstance", "org.springframework.util.StringUtils" ]
import org.springframework.cloud.client.ServiceInstance; import org.springframework.util.StringUtils;
import org.springframework.cloud.client.*; import org.springframework.util.*;
[ "org.springframework.cloud", "org.springframework.util" ]
org.springframework.cloud; org.springframework.util;
2,216,322
@SuppressLint("NewApi") @Override public boolean performAccessibilityAction(int action, Bundle arguments) { if (super.performAccessibilityAction(action, arguments)) { return true; } int changeMultiplier = 0; if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) { changeMultiplier = 1; } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) { changeMultiplier = -1; } if (changeMultiplier != 0) { int value = getCurrentlyShowingValue(); int stepSize = 0; int currentItemShowing = getCurrentItemShowing(); if (currentItemShowing == HOUR_INDEX) { stepSize = HOUR_VALUE_TO_DEGREES_STEP_SIZE; value %= 12; } else if (currentItemShowing == MINUTE_INDEX) { stepSize = MINUTE_VALUE_TO_DEGREES_STEP_SIZE; } int degrees = value * stepSize; degrees = snapOnly30s(degrees, changeMultiplier); value = degrees / stepSize; int maxValue = 0; int minValue = 0; if (currentItemShowing == HOUR_INDEX) { if (mIs24HourMode) { maxValue = 23; } else { maxValue = 12; minValue = 1; } } else { maxValue = 55; } if (value > maxValue) { // If we scrolled forward past the highest number, wrap around to the lowest. value = minValue; } else if (value < minValue) { // If we scrolled backward past the lowest number, wrap around to the highest. value = maxValue; } setItem(currentItemShowing, value); mListener.onValueSelected(currentItemShowing, value, false); return true; } return false; }
@SuppressLint(STR) boolean function(int action, Bundle arguments) { if (super.performAccessibilityAction(action, arguments)) { return true; } int changeMultiplier = 0; if (action == AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) { changeMultiplier = 1; } else if (action == AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD) { changeMultiplier = -1; } if (changeMultiplier != 0) { int value = getCurrentlyShowingValue(); int stepSize = 0; int currentItemShowing = getCurrentItemShowing(); if (currentItemShowing == HOUR_INDEX) { stepSize = HOUR_VALUE_TO_DEGREES_STEP_SIZE; value %= 12; } else if (currentItemShowing == MINUTE_INDEX) { stepSize = MINUTE_VALUE_TO_DEGREES_STEP_SIZE; } int degrees = value * stepSize; degrees = snapOnly30s(degrees, changeMultiplier); value = degrees / stepSize; int maxValue = 0; int minValue = 0; if (currentItemShowing == HOUR_INDEX) { if (mIs24HourMode) { maxValue = 23; } else { maxValue = 12; minValue = 1; } } else { maxValue = 55; } if (value > maxValue) { value = minValue; } else if (value < minValue) { value = maxValue; } setItem(currentItemShowing, value); mListener.onValueSelected(currentItemShowing, value, false); return true; } return false; }
/** * When scroll forward/backward events are received, jump the time to the higher/lower * discrete, visible value on the circle. */
When scroll forward/backward events are received, jump the time to the higher/lower discrete, visible value on the circle
performAccessibilityAction
{ "repo_name": "borax12/MaterialDateRangePicker", "path": "library/src/main/java/com/borax12/materialdaterangepicker/time/RadialPickerLayout.java", "license": "apache-2.0", "size": 36622 }
[ "android.annotation.SuppressLint", "android.os.Bundle", "android.view.accessibility.AccessibilityNodeInfo" ]
import android.annotation.SuppressLint; import android.os.Bundle; import android.view.accessibility.AccessibilityNodeInfo;
import android.annotation.*; import android.os.*; import android.view.accessibility.*;
[ "android.annotation", "android.os", "android.view" ]
android.annotation; android.os; android.view;
1,732,331
@Test public void testTransitiveConfMapping() throws Exception { // mod13.3 depends on mod13.2 which depends on mod13.1 // each module has two confs: j2ee and compile // each module only publishes one artifact in conf compile // each module has the following conf mapping on its dependencies: *->@ // moreover, mod13.1 depends on mod1.2 in with the following conf mapping: compile->default // thus conf j2ee should be empty for each modules ResolveReport report = ivy.resolve(new File("test/repositories/2/mod13.3/ivy-1.0.xml"), getResolveOptions(new String[] {"*"})); assertFalse(report.hasError()); assertEquals(3, report.getConfigurationReport("compile").getArtifactsNumber()); assertEquals(0, report.getConfigurationReport("j2ee").getArtifactsNumber()); }
void function() throws Exception { ResolveReport report = ivy.resolve(new File(STR), getResolveOptions(new String[] {"*"})); assertFalse(report.hasError()); assertEquals(3, report.getConfigurationReport(STR).getArtifactsNumber()); assertEquals(0, report.getConfigurationReport("j2ee").getArtifactsNumber()); }
/** * Test case for IVY-168. * * @throws Exception if something goes wrong * @see <a href="https://issues.apache.org/jira/browse/IVY-168">IVY-168</a> */
Test case for IVY-168
testTransitiveConfMapping
{ "repo_name": "twogee/ant-ivy", "path": "test/java/org/apache/ivy/core/resolve/ResolveTest.java", "license": "apache-2.0", "size": 306179 }
[ "java.io.File", "org.apache.ivy.core.report.ResolveReport", "org.junit.Assert" ]
import java.io.File; import org.apache.ivy.core.report.ResolveReport; import org.junit.Assert;
import java.io.*; import org.apache.ivy.core.report.*; import org.junit.*;
[ "java.io", "org.apache.ivy", "org.junit" ]
java.io; org.apache.ivy; org.junit;
884,206
int deleteByExample(CZNotifyLevelExample example);
int deleteByExample(CZNotifyLevelExample example);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table nfjd502.dbo.CZNotifyLevel * * @mbggenerated Thu Mar 02 11:23:21 CST 2017 */
This method was generated by MyBatis Generator. This method corresponds to the database table nfjd502.dbo.CZNotifyLevel
deleteByExample
{ "repo_name": "xtwxy/cassandra-tests", "path": "mstar-server-dao/src/main/java/com/wincom/mstar/dao/mapper/CZNotifyLevelMapper.java", "license": "apache-2.0", "size": 2198 }
[ "com.wincom.mstar.domain.CZNotifyLevelExample" ]
import com.wincom.mstar.domain.CZNotifyLevelExample;
import com.wincom.mstar.domain.*;
[ "com.wincom.mstar" ]
com.wincom.mstar;
956,618
QQualifiedName getOnTable();
QQualifiedName getOnTable();
/** * Returns the value of the '<em><b>On Table</b></em>' containment reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>On Table</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>On Table</em>' containment reference. * @see #setOnTable(QQualifiedName) * @see org.asup.db.syntax.ddl.QDdlPackage#getCreateIndexStatement_OnTable() * @model containment="true" * @generated */
Returns the value of the 'On Table' containment reference. If the meaning of the 'On Table' reference isn't clear, there really should be more of a description here...
getOnTable
{ "repo_name": "asupdev/asup", "path": "org.asup.db.syntax/src/org/asup/db/syntax/ddl/QCreateIndexStatement.java", "license": "epl-1.0", "size": 4904 }
[ "org.asup.db.core.QQualifiedName" ]
import org.asup.db.core.QQualifiedName;
import org.asup.db.core.*;
[ "org.asup.db" ]
org.asup.db;
2,419,007
protected void submitJob(ExecutorService executor, Content file) { // lifted from http://stackoverflow.com/a/5853198/1874604 class OneShotTask implements Runnable { Content file; OneShotTask(Content file) { this.file = file; }
void function(ExecutorService executor, Content file) { class OneShotTask implements Runnable { Content file; OneShotTask(Content file) { this.file = file; }
/** * Helper method to sumit a new threaded tast to a given executor. * * @param executor * @param file */
Helper method to sumit a new threaded tast to a given executor
submitJob
{ "repo_name": "victims/victims-lib-java", "path": "src/main/java/com/redhat/victims/fingerprint/JarFile.java", "license": "agpl-3.0", "size": 7323 }
[ "java.util.concurrent.ExecutorService" ]
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
458,928
private boolean monitorInfraApplication() throws YarnException, IOException { boolean loggedApplicationInfo = false; boolean success = false; Thread namenodeMonitoringThread = new Thread(() -> { Supplier<Boolean> exitCritera = () -> Apps.isApplicationFinalState(infraAppState); Optional<Properties> namenodeProperties = Optional.empty(); while (!exitCritera.get()) { try { if (!namenodeProperties.isPresent()) { namenodeProperties = DynoInfraUtils .waitForAndGetNameNodeProperties(exitCritera, getConf(), getNameNodeInfoPath(), LOG); if (namenodeProperties.isPresent()) { Properties props = namenodeProperties.get(); LOG.info("NameNode can be reached via HDFS at: {}", DynoInfraUtils.getNameNodeHdfsUri(props)); LOG.info("NameNode web UI available at: {}", DynoInfraUtils.getNameNodeWebUri(props)); LOG.info("NameNode can be tracked at: {}", DynoInfraUtils.getNameNodeTrackingUri(props)); } else { // Only happens if we should be shutting down break; } } DynoInfraUtils.waitForNameNodeStartup(namenodeProperties.get(), exitCritera, LOG); DynoInfraUtils.waitForNameNodeReadiness(namenodeProperties.get(), numTotalDataNodes, false, exitCritera, getConf(), LOG); break; } catch (IOException ioe) { LOG.error( "Unexpected exception while waiting for NameNode readiness", ioe); } catch (InterruptedException ie) { return; } } if (!Apps.isApplicationFinalState(infraAppState) && launchWorkloadJob) { launchAndMonitorWorkloadDriver(namenodeProperties.get()); } }); if (launchNameNode) { namenodeMonitoringThread.start(); } while (true) { // Check app status every 1 second. try { Thread.sleep(1000); } catch (InterruptedException e) { LOG.debug("Thread sleep in monitoring loop interrupted"); } // Get application report for the appId we are interested in ApplicationReport report = yarnClient.getApplicationReport(infraAppId); if (report.getTrackingUrl() != null && !loggedApplicationInfo) { loggedApplicationInfo = true; LOG.info("Track the application at: " + report.getTrackingUrl()); LOG.info("Kill the application using: yarn application -kill " + report.getApplicationId()); } LOG.debug("Got application report from ASM for: appId={}, " + "clientToAMToken={}, appDiagnostics={}, appMasterHost={}, " + "appQueue={}, appMasterRpcPort={}, appStartTime={}, " + "yarnAppState={}, distributedFinalState={}, appTrackingUrl={}, " + "appUser={}", infraAppId.getId(), report.getClientToAMToken(), report.getDiagnostics(), report.getHost(), report.getQueue(), report.getRpcPort(), report.getStartTime(), report.getYarnApplicationState(), report.getFinalApplicationStatus(), report.getTrackingUrl(), report.getUser()); infraAppState = report.getYarnApplicationState(); if (infraAppState == YarnApplicationState.KILLED) { if (!launchWorkloadJob) { success = true; } else if (workloadJob == null) { LOG.error("Infra app was killed before workload job was launched."); } else if (!workloadJob.isComplete()) { LOG.error("Infra app was killed before workload job completed."); } else if (workloadJob.isSuccessful()) { success = true; } LOG.info("Infra app was killed; exiting from client."); break; } else if (infraAppState == YarnApplicationState.FINISHED || infraAppState == YarnApplicationState.FAILED) { LOG.info("Infra app exited unexpectedly. YarnState=" + infraAppState.toString() + ". Exiting from client."); break; } if ((clientTimeout != -1) && (System.currentTimeMillis() > (clientStartTime + clientTimeout))) { LOG.info("Reached client specified timeout of {} ms for application. " + "Killing application", clientTimeout); attemptCleanup(); break; } if (isCompleted(workloadAppState)) { LOG.info("Killing infrastructure app"); try { forceKillApplication(infraAppId); } catch (YarnException | IOException e) { LOG.error("Exception encountered while killing infra app", e); } } } if (launchNameNode) { try { namenodeMonitoringThread.interrupt(); namenodeMonitoringThread.join(); } catch (InterruptedException ie) { LOG.warn("Interrupted while joining workload job thread; " + "continuing to cleanup."); } } attemptCleanup(); return success; }
boolean function() throws YarnException, IOException { boolean loggedApplicationInfo = false; boolean success = false; Thread namenodeMonitoringThread = new Thread(() -> { Supplier<Boolean> exitCritera = () -> Apps.isApplicationFinalState(infraAppState); Optional<Properties> namenodeProperties = Optional.empty(); while (!exitCritera.get()) { try { if (!namenodeProperties.isPresent()) { namenodeProperties = DynoInfraUtils .waitForAndGetNameNodeProperties(exitCritera, getConf(), getNameNodeInfoPath(), LOG); if (namenodeProperties.isPresent()) { Properties props = namenodeProperties.get(); LOG.info(STR, DynoInfraUtils.getNameNodeHdfsUri(props)); LOG.info(STR, DynoInfraUtils.getNameNodeWebUri(props)); LOG.info(STR, DynoInfraUtils.getNameNodeTrackingUri(props)); } else { break; } } DynoInfraUtils.waitForNameNodeStartup(namenodeProperties.get(), exitCritera, LOG); DynoInfraUtils.waitForNameNodeReadiness(namenodeProperties.get(), numTotalDataNodes, false, exitCritera, getConf(), LOG); break; } catch (IOException ioe) { LOG.error( STR, ioe); } catch (InterruptedException ie) { return; } } if (!Apps.isApplicationFinalState(infraAppState) && launchWorkloadJob) { launchAndMonitorWorkloadDriver(namenodeProperties.get()); } }); if (launchNameNode) { namenodeMonitoringThread.start(); } while (true) { try { Thread.sleep(1000); } catch (InterruptedException e) { LOG.debug(STR); } ApplicationReport report = yarnClient.getApplicationReport(infraAppId); if (report.getTrackingUrl() != null && !loggedApplicationInfo) { loggedApplicationInfo = true; LOG.info(STR + report.getTrackingUrl()); LOG.info(STR + report.getApplicationId()); } LOG.debug(STR + STR + STR + STR + STR, infraAppId.getId(), report.getClientToAMToken(), report.getDiagnostics(), report.getHost(), report.getQueue(), report.getRpcPort(), report.getStartTime(), report.getYarnApplicationState(), report.getFinalApplicationStatus(), report.getTrackingUrl(), report.getUser()); infraAppState = report.getYarnApplicationState(); if (infraAppState == YarnApplicationState.KILLED) { if (!launchWorkloadJob) { success = true; } else if (workloadJob == null) { LOG.error(STR); } else if (!workloadJob.isComplete()) { LOG.error(STR); } else if (workloadJob.isSuccessful()) { success = true; } LOG.info(STR); break; } else if (infraAppState == YarnApplicationState.FINISHED infraAppState == YarnApplicationState.FAILED) { LOG.info(STR + infraAppState.toString() + STR); break; } if ((clientTimeout != -1) && (System.currentTimeMillis() > (clientStartTime + clientTimeout))) { LOG.info(STR + STR, clientTimeout); attemptCleanup(); break; } if (isCompleted(workloadAppState)) { LOG.info(STR); try { forceKillApplication(infraAppId); } catch (YarnException IOException e) { LOG.error(STR, e); } } } if (launchNameNode) { try { namenodeMonitoringThread.interrupt(); namenodeMonitoringThread.join(); } catch (InterruptedException ie) { LOG.warn(STR + STR); } } attemptCleanup(); return success; }
/** * Monitor the submitted application for completion. Kill application if time * expires. * * @return true if application completed successfully */
Monitor the submitted application for completion. Kill application if time expires
monitorInfraApplication
{ "repo_name": "steveloughran/hadoop", "path": "hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra/src/main/java/org/apache/hadoop/tools/dynamometer/Client.java", "license": "apache-2.0", "size": 48758 }
[ "java.io.IOException", "java.util.Optional", "java.util.Properties", "java.util.function.Supplier", "org.apache.hadoop.yarn.api.records.ApplicationReport", "org.apache.hadoop.yarn.api.records.YarnApplicationState", "org.apache.hadoop.yarn.exceptions.YarnException", "org.apache.hadoop.yarn.util.Apps" ]
import java.io.IOException; import java.util.Optional; import java.util.Properties; import java.util.function.Supplier; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.util.Apps;
import java.io.*; import java.util.*; import java.util.function.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.exceptions.*; import org.apache.hadoop.yarn.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
2,505,314
public void test(TestHarness harness) { // create instance of a class Double Object o = new CharConversionException("xyzzy"); // get a runtime class of an object "o" Class c = o.getClass(); List interfaces = Arrays.asList(c.getInterfaces()); }
void function(TestHarness harness) { Object o = new CharConversionException("xyzzy"); Class c = o.getClass(); List interfaces = Arrays.asList(c.getInterfaces()); }
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */
Runs the test using the specified harness
test
{ "repo_name": "niloc132/mauve-gwt", "path": "src/main/java/gnu/testlet/java/io/CharConversionException/classInfo/getInterfaces.java", "license": "gpl-2.0", "size": 1676 }
[ "gnu.testlet.TestHarness", "java.io.CharConversionException", "java.util.Arrays", "java.util.List" ]
import gnu.testlet.TestHarness; import java.io.CharConversionException; import java.util.Arrays; import java.util.List;
import gnu.testlet.*; import java.io.*; import java.util.*;
[ "gnu.testlet", "java.io", "java.util" ]
gnu.testlet; java.io; java.util;
1,826,988
public Map<byte[], NavigableMap<byte [], Long>> getFamilyMapOfLongs() { NavigableMap<byte[], List<Cell>> map = super.getFamilyCellMap(); Map<byte [], NavigableMap<byte[], Long>> results = new TreeMap<>(Bytes.BYTES_COMPARATOR); for (Map.Entry<byte [], List<Cell>> entry: map.entrySet()) { NavigableMap<byte [], Long> longs = new TreeMap<>(Bytes.BYTES_COMPARATOR); for (Cell cell: entry.getValue()) { longs.put(CellUtil.cloneQualifier(cell), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } results.put(entry.getKey(), longs); } return results; }
Map<byte[], NavigableMap<byte [], Long>> function() { NavigableMap<byte[], List<Cell>> map = super.getFamilyCellMap(); Map<byte [], NavigableMap<byte[], Long>> results = new TreeMap<>(Bytes.BYTES_COMPARATOR); for (Map.Entry<byte [], List<Cell>> entry: map.entrySet()) { NavigableMap<byte [], Long> longs = new TreeMap<>(Bytes.BYTES_COMPARATOR); for (Cell cell: entry.getValue()) { longs.put(CellUtil.cloneQualifier(cell), Bytes.toLong(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength())); } results.put(entry.getKey(), longs); } return results; }
/** * Before 0.95, when you called Increment#getFamilyMap(), you got back * a map of families to a list of Longs. Now, {@link #getFamilyCellMap()} returns * families by list of Cells. This method has been added so you can have the * old behavior. * @return Map of families to a Map of qualifiers and their Long increments. * @since 0.95.0 */
Before 0.95, when you called Increment#getFamilyMap(), you got back a map of families to a list of Longs. Now, <code>#getFamilyCellMap()</code> returns families by list of Cells. This method has been added so you can have the old behavior
getFamilyMapOfLongs
{ "repo_name": "apurtell/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Increment.java", "license": "apache-2.0", "size": 10132 }
[ "java.util.List", "java.util.Map", "java.util.NavigableMap", "java.util.TreeMap", "org.apache.hadoop.hbase.Cell", "org.apache.hadoop.hbase.CellUtil", "org.apache.hadoop.hbase.util.Bytes" ]
import java.util.List; import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.util.Bytes;
import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
381,027
ObjectStoreInitializer objectStoreInitializer1 = new ObjectStoreInitializer( treeStorageAdapter, SYNC_FOLDER_NAME, INDEX_FILE_NAME, OBJECT_FOLDER_NAME ); IObjectStore objectStore = objectStoreInitializer1.init(); objectStoreInitializer1.start(); return objectStore; }
ObjectStoreInitializer objectStoreInitializer1 = new ObjectStoreInitializer( treeStorageAdapter, SYNC_FOLDER_NAME, INDEX_FILE_NAME, OBJECT_FOLDER_NAME ); IObjectStore objectStore = objectStoreInitializer1.init(); objectStoreInitializer1.start(); return objectStore; }
/** * Creates, inits and starts an object store in the given root test dir * * @param treeStorageAdapter A tree storage adapter pointing to the root directory in which to create the object store * * @return The created object store */
Creates, inits and starts an object store in the given root test dir
createObjectStore
{ "repo_name": "p2p-sync/sync", "path": "src/test/java/org/rmatil/sync/test/base/BaseTest.java", "license": "apache-2.0", "size": 4612 }
[ "org.rmatil.sync.core.init.objecstore.ObjectStoreInitializer", "org.rmatil.sync.version.api.IObjectStore" ]
import org.rmatil.sync.core.init.objecstore.ObjectStoreInitializer; import org.rmatil.sync.version.api.IObjectStore;
import org.rmatil.sync.core.init.objecstore.*; import org.rmatil.sync.version.api.*;
[ "org.rmatil.sync" ]
org.rmatil.sync;
2,115,865
return Camera.open(); }
return Camera.open(); }
/** * Calls {@link Camera#open()}. */
Calls <code>Camera#open()</code>
open
{ "repo_name": "yakovenkodenis/Discounty", "path": "src/main/java/com/google/zxing/client/android/camera/open/DefaultOpenCameraInterface.java", "license": "mit", "size": 969 }
[ "android.hardware.Camera" ]
import android.hardware.Camera;
import android.hardware.*;
[ "android.hardware" ]
android.hardware;
1,602,615
@Column(name = "instance_id", precision = 19) @Override public Long getInstanceId() { return (Long) get(12); }
@Column(name = STR, precision = 19) Long function() { return (Long) get(12); }
/** * Getter for <code>cattle.mount.instance_id</code>. */
Getter for <code>cattle.mount.instance_id</code>
getInstanceId
{ "repo_name": "rancherio/cattle", "path": "modules/model/src/main/java/io/cattle/platform/core/model/tables/records/MountRecord.java", "license": "apache-2.0", "size": 16550 }
[ "javax.persistence.Column" ]
import javax.persistence.Column;
import javax.persistence.*;
[ "javax.persistence" ]
javax.persistence;
2,723,604
public void mouseClicked(MouseEvent e) { firePropertyChange(TO_FRONT_PROPERTY, Boolean.valueOf(false), Boolean.valueOf(true)); user.requestFocus(); //if (user.getText() != null) // user.selectAll(); } }); pass.addMouseListener(new MouseAdapter() {
void function(MouseEvent e) { firePropertyChange(TO_FRONT_PROPERTY, Boolean.valueOf(false), Boolean.valueOf(true)); user.requestFocus(); } }); pass.addMouseListener(new MouseAdapter() {
/** * Fires a property to move the window to the front. * @see MouseListener#mouseClicked(MouseEvent) */
Fires a property to move the window to the front
mouseClicked
{ "repo_name": "dpwrussell/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/login/ScreenLogin.java", "license": "gpl-2.0", "size": 41801 }
[ "java.awt.event.MouseAdapter", "java.awt.event.MouseEvent" ]
import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,334,446
ServiceResponse<List<Double>> getDoubleInvalidString() throws ErrorException, IOException;
ServiceResponse<List<Double>> getDoubleInvalidString() throws ErrorException, IOException;
/** * Get boolean array value [1.0, 'number', 0.0]. * * @throws ErrorException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the List&lt;Double&gt; object wrapped in {@link ServiceResponse} if successful. */
Get boolean array value [1.0, 'number', 0.0]
getDoubleInvalidString
{ "repo_name": "matt-gibbs/AutoRest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodyarray/Array.java", "license": "mit", "size": 57270 }
[ "com.microsoft.rest.ServiceResponse", "java.io.IOException", "java.util.List" ]
import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.List;
import com.microsoft.rest.*; import java.io.*; import java.util.*;
[ "com.microsoft.rest", "java.io", "java.util" ]
com.microsoft.rest; java.io; java.util;
104,193
private void addOptions(NativeObject optionsObject) { if (options != null) { for (Entry<String, String> keyval : options.entrySet()) { optionsObject.put(keyval.getKey(), optionsObject, toOptionValue(keyval.getValue())); } } }
void function(NativeObject optionsObject) { if (options != null) { for (Entry<String, String> keyval : options.entrySet()) { optionsObject.put(keyval.getKey(), optionsObject, toOptionValue(keyval.getValue())); } } }
/** * combine the options from the plugin configuration with the options read from the file */
combine the options from the plugin configuration with the options read from the file
addOptions
{ "repo_name": "vecnatechnologies/jshint-maven-plugin", "path": "src/main/java/com/vecna/maven/jshint/mojo/JsHintMojo.java", "license": "apache-2.0", "size": 10320 }
[ "java.util.Map", "org.mozilla.javascript.NativeObject" ]
import java.util.Map; import org.mozilla.javascript.NativeObject;
import java.util.*; import org.mozilla.javascript.*;
[ "java.util", "org.mozilla.javascript" ]
java.util; org.mozilla.javascript;
1,328,317
@Test public void testFormat3() throws Exception { TextFormatterSettings settings = new TextFormatterSettings().setColorPolicy(FormatPolicy.IGNORE); assertEquals("{RED}redRed", format(settings, "{RED}red{0}", "Red")); assertEquals("{RED}red{RED}Red", format(settings, "{RED}red{0}", "{RED}Red")); settings = new TextFormatterSettings().setColorPolicy(FormatPolicy.REMOVE); assertEquals("redRed", format(settings, "{RED}red{0}", "Red")); assertEquals("redRed", format(settings, "{RED}red{0}", "{RED}Red")); }
void function() throws Exception { TextFormatterSettings settings = new TextFormatterSettings().setColorPolicy(FormatPolicy.IGNORE); assertEquals(STR, format(settings, STR, "Red")); assertEquals(STR, format(settings, STR, STR)); settings = new TextFormatterSettings().setColorPolicy(FormatPolicy.REMOVE); assertEquals(STR, format(settings, STR, "Red")); assertEquals(STR, format(settings, STR, STR)); }
/** * Test Color Settings */
Test Color Settings
testFormat3
{ "repo_name": "JCThePants/NucleusFramework", "path": "tests/src/com/jcwhatever/nucleus/utils/text/TextFormatterTest.java", "license": "mit", "size": 6305 }
[ "com.jcwhatever.nucleus.utils.text.format.TextFormatterSettings", "org.junit.Assert" ]
import com.jcwhatever.nucleus.utils.text.format.TextFormatterSettings; import org.junit.Assert;
import com.jcwhatever.nucleus.utils.text.format.*; import org.junit.*;
[ "com.jcwhatever.nucleus", "org.junit" ]
com.jcwhatever.nucleus; org.junit;
1,884,979
@Override public void close() throws IOException { IOException ex = null; try { super.close(); } catch (IOException e) { ex = e; } try { closeOutputStream(); } catch (IOException e) { ex = ex == null ? e : ex; } try { closeInputStream(); } catch (IOException e) { ex = ex == null ? e : ex; } try { spillSet.delete(path); } catch (IOException e) { ex = ex == null ? e : ex; } if (ex != null) { throw ex; } }
void function() throws IOException { IOException ex = null; try { super.close(); } catch (IOException e) { ex = e; } try { closeOutputStream(); } catch (IOException e) { ex = ex == null ? e : ex; } try { closeInputStream(); } catch (IOException e) { ex = ex == null ? e : ex; } try { spillSet.delete(path); } catch (IOException e) { ex = ex == null ? e : ex; } if (ex != null) { throw ex; } }
/** * Close resources owned by this batch group. Each can fail; report * only the first error. This is cluttered because this class tries * to do multiple tasks. TODO: Split into multiple classes. */
Close resources owned by this batch group. Each can fail; report only the first error. This is cluttered because this class tries
close
{ "repo_name": "bitblender/drill", "path": "exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/xsort/managed/BatchGroup.java", "license": "apache-2.0", "size": 12060 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,695,233
public void setSocketAddr(String name, InetSocketAddress addr) { set(name, NetUtils.getHostPortString(addr)); }
void function(String name, InetSocketAddress addr) { set(name, NetUtils.getHostPortString(addr)); }
/** * Set the socket address for the <code>name</code> property as * a <code>host:port</code>. */
Set the socket address for the <code>name</code> property as a <code>host:port</code>
setSocketAddr
{ "repo_name": "huafengw/hadoop", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java", "license": "apache-2.0", "size": 121356 }
[ "java.net.InetSocketAddress", "org.apache.hadoop.net.NetUtils" ]
import java.net.InetSocketAddress; import org.apache.hadoop.net.NetUtils;
import java.net.*; import org.apache.hadoop.net.*;
[ "java.net", "org.apache.hadoop" ]
java.net; org.apache.hadoop;
878,132
public Enumeration<V> elements() { Node<K,V>[] t; int f = (t = table) == null ? 0 : t.length; return new ValueIterator<K,V>(t, f, 0, f, this); } // ConcurrentHashMap-only methods
Enumeration<V> function() { Node<K,V>[] t; int f = (t = table) == null ? 0 : t.length; return new ValueIterator<K,V>(t, f, 0, f, this); }
/** * Returns an enumeration of the values in this table. * * @return an enumeration of the values in this table * @see #values() */
Returns an enumeration of the values in this table
elements
{ "repo_name": "waynett/j2objc", "path": "jre_emul/android/libcore/luni/src/main/java/java/util/concurrent/ConcurrentHashMap.java", "license": "apache-2.0", "size": 132493 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
1,743,421
JSONObject getByPermalink(final String permalink) throws RepositoryException;
JSONObject getByPermalink(final String permalink) throws RepositoryException;
/** * Gets an article by the specified permalink. * * @param permalink the specified permalink * @return an article, returns {@code null} if not found * @throws RepositoryException repository exception */
Gets an article by the specified permalink
getByPermalink
{ "repo_name": "446541492/solo", "path": "src/main/java/org/b3log/solo/repository/ArticleRepository.java", "license": "apache-2.0", "size": 4736 }
[ "org.b3log.latke.repository.RepositoryException", "org.json.JSONObject" ]
import org.b3log.latke.repository.RepositoryException; import org.json.JSONObject;
import org.b3log.latke.repository.*; import org.json.*;
[ "org.b3log.latke", "org.json" ]
org.b3log.latke; org.json;
751,676
public void setHeader(String name, String value) { if (this.customOptions == null) { this.customOptions = new HashMap<>(); } this.customOptions.put(name, value); }
void function(String name, String value) { if (this.customOptions == null) { this.customOptions = new HashMap<>(); } this.customOptions.put(name, value); }
/** * Sets the custom request option value by key * * @param name a string representing the custom option's name * @param value a STRING representing the custom option's value */
Sets the custom request option value by key
setHeader
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/RequestOptions.java", "license": "mit", "size": 15352 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,472,591
Object recordValue = value; if ((value instanceof BigDecimal) || (value instanceof BigInteger)) { recordValue = getConversionManager().convertObject(value, ClassConstants.STRING); } record.put(key, recordValue); }
Object recordValue = value; if ((value instanceof BigDecimal) (value instanceof BigInteger)) { recordValue = getConversionManager().convertObject(value, ClassConstants.STRING); } record.put(key, recordValue); }
/** * Mongo does not support all Java types. * Convert unsupported types to string. */
Mongo does not support all Java types. Convert unsupported types to string
setValueInRecord
{ "repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs", "path": "foundation/org.eclipse.persistence.nosql/src/org/eclipse/persistence/nosql/adapters/mongo/MongoPlatform.java", "license": "epl-1.0", "size": 26332 }
[ "java.math.BigDecimal", "java.math.BigInteger", "org.eclipse.persistence.internal.helper.ClassConstants" ]
import java.math.BigDecimal; import java.math.BigInteger; import org.eclipse.persistence.internal.helper.ClassConstants;
import java.math.*; import org.eclipse.persistence.internal.helper.*;
[ "java.math", "org.eclipse.persistence" ]
java.math; org.eclipse.persistence;
942,114
public void testGetColor( ) throws SemanticException { // red assertEquals( 16711680, colorHandle.getRGB( ) ); assertEquals( "red", colorHandle.getStringValue( ) ); //$NON-NLS-1$ // #FF00FF assertEquals( 16711935, colorHandle1.getRGB( ) ); assertEquals( "red", colorHandle.getCssValue( ) ); //$NON-NLS-1$ colorHandle.setValue( "#FF00FF" ); //$NON-NLS-1$ assertEquals( "RGB(255,0,255)", colorHandle.getCssValue( ) ); //$NON-NLS-1$ assertEquals( "#FF00FF", colorHandle.getStringValue( ) ); //$NON-NLS-1$ Style style1 = (Style) design.findStyle( "My-Style2" ); //$NON-NLS-1$ StyleHandle style2Handle = style1.handle( design ); // has the default value in black. colorHandle = style2Handle.getColor( ); assertNotNull( colorHandle ); assertEquals( "black", colorHandle.getCssValue( ) ); //$NON-NLS-1$ // tests reading a color from a structure like a highlight rule. Iterator highlightHandles = style2Handle.highlightRulesIterator( ); assertNotNull( highlightHandles ); HighlightRuleHandle highlightHandle = (HighlightRuleHandle) highlightHandles .next( ); assertNotNull( highlightHandle ); colorHandle = highlightHandle.getColor( ); assertNotNull( colorHandle ); assertEquals( "yellow", colorHandle.getCssValue( ) ); //$NON-NLS-1$ colorHandle = highlightHandle.getBackgroundColor( ); assertNotNull( colorHandle ); assertEquals( "RGB(18,52,86)", colorHandle.getCssValue( ) ); //$NON-NLS-1$ assertEquals( 1193046, colorHandle.getRGB( ) ); colorHandle = highlightHandle.getBorderBottomColor( ); assertNotNull( colorHandle ); // value from custom color pallete. colorHandle = designHandle.findStyle( "My-Style3" ).getColor( ); //$NON-NLS-1$ assertEquals( "myColor1", colorHandle.getStringValue( ) ); //$NON-NLS-1$ assertEquals( 1193210, colorHandle.getRGB( ) ); }
void function( ) throws SemanticException { assertEquals( 16711680, colorHandle.getRGB( ) ); assertEquals( "red", colorHandle.getStringValue( ) ); assertEquals( 16711935, colorHandle1.getRGB( ) ); assertEquals( "red", colorHandle.getCssValue( ) ); colorHandle.setValue( STR ); assertEquals( STR, colorHandle.getCssValue( ) ); assertEquals( STR, colorHandle.getStringValue( ) ); Style style1 = (Style) design.findStyle( STR ); StyleHandle style2Handle = style1.handle( design ); colorHandle = style2Handle.getColor( ); assertNotNull( colorHandle ); assertEquals( "black", colorHandle.getCssValue( ) ); Iterator highlightHandles = style2Handle.highlightRulesIterator( ); assertNotNull( highlightHandles ); HighlightRuleHandle highlightHandle = (HighlightRuleHandle) highlightHandles .next( ); assertNotNull( highlightHandle ); colorHandle = highlightHandle.getColor( ); assertNotNull( colorHandle ); assertEquals( STR, colorHandle.getCssValue( ) ); colorHandle = highlightHandle.getBackgroundColor( ); assertNotNull( colorHandle ); assertEquals( STR, colorHandle.getCssValue( ) ); assertEquals( 1193046, colorHandle.getRGB( ) ); colorHandle = highlightHandle.getBorderBottomColor( ); assertNotNull( colorHandle ); colorHandle = designHandle.findStyle( STR ).getColor( ); assertEquals( STR, colorHandle.getStringValue( ) ); assertEquals( 1193210, colorHandle.getRGB( ) ); }
/** * test getCSSCompatibleValue() and getRGB() and getStringValue(). * * @throws SemanticException * if the the value of the color is invalid. */
test getCSSCompatibleValue() and getRGB() and getStringValue()
testGetColor
{ "repo_name": "sguan-actuate/birt", "path": "model/org.eclipse.birt.report.model.tests/test/org/eclipse/birt/report/model/api/ColorHandleTest.java", "license": "epl-1.0", "size": 9456 }
[ "java.util.Iterator", "org.eclipse.birt.report.model.api.activity.SemanticException", "org.eclipse.birt.report.model.elements.Style" ]
import java.util.Iterator; import org.eclipse.birt.report.model.api.activity.SemanticException; import org.eclipse.birt.report.model.elements.Style;
import java.util.*; import org.eclipse.birt.report.model.api.activity.*; import org.eclipse.birt.report.model.elements.*;
[ "java.util", "org.eclipse.birt" ]
java.util; org.eclipse.birt;
267,407
public SphericalCS createSphericalCS(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateSystem cs = createCoordinateSystem(code); try { return (SphericalCS) cs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(SphericalCS.class, code, exception); } }
SphericalCS function(final String code) throws NoSuchAuthorityCodeException, FactoryException { final CoordinateSystem cs = createCoordinateSystem(code); try { return (SphericalCS) cs; } catch (ClassCastException exception) { throw noSuchAuthorityCode(SphericalCS.class, code, exception); } }
/** * Creates a spherical coordinate system from a code. The default implementation invokes <code> * {@linkplain #createCoordinateSystem createCoordinateSystem}(code)</code>. * * @param code Value allocated by authority. * @return The coordinate system for the given code. * @throws NoSuchAuthorityCodeException if the specified {@code code} was not found. * @throws FactoryException if the object creation failed for some other reason. */
Creates a spherical coordinate system from a code. The default implementation invokes <code> #createCoordinateSystem createCoordinateSystem(code)</code>
createSphericalCS
{ "repo_name": "geotools/geotools", "path": "modules/library/referencing/src/main/java/org/geotools/referencing/factory/AbstractAuthorityFactory.java", "license": "lgpl-2.1", "size": 41575 }
[ "org.opengis.referencing.FactoryException", "org.opengis.referencing.NoSuchAuthorityCodeException", "org.opengis.referencing.cs.CoordinateSystem", "org.opengis.referencing.cs.SphericalCS" ]
import org.opengis.referencing.FactoryException; import org.opengis.referencing.NoSuchAuthorityCodeException; import org.opengis.referencing.cs.CoordinateSystem; import org.opengis.referencing.cs.SphericalCS;
import org.opengis.referencing.*; import org.opengis.referencing.cs.*;
[ "org.opengis.referencing" ]
org.opengis.referencing;
2,550,500
protected double readBaseExternal(final ObjectInput in) throws IOException, ClassNotFoundException { final int dimension = in.readInt(); globalPreviousTime = in.readDouble(); globalCurrentTime = in.readDouble(); softPreviousTime = in.readDouble(); softCurrentTime = in.readDouble(); h = in.readDouble(); forward = in.readBoolean(); primaryMapper = (EquationsMapper) in.readObject(); secondaryMappers = new EquationsMapper[in.read()]; for (int i = 0; i < secondaryMappers.length; ++i) { secondaryMappers[i] = (EquationsMapper) in.readObject(); } dirtyState = true; if (dimension < 0) { currentState = null; } else { currentState = new double[dimension]; for (int i = 0; i < currentState.length; ++i) { currentState[i] = in.readDouble(); } } // we do NOT handle the interpolated time and state here interpolatedTime = Double.NaN; allocateInterpolatedArrays(dimension); finalized = true; return in.readDouble(); }
double function(final ObjectInput in) throws IOException, ClassNotFoundException { final int dimension = in.readInt(); globalPreviousTime = in.readDouble(); globalCurrentTime = in.readDouble(); softPreviousTime = in.readDouble(); softCurrentTime = in.readDouble(); h = in.readDouble(); forward = in.readBoolean(); primaryMapper = (EquationsMapper) in.readObject(); secondaryMappers = new EquationsMapper[in.read()]; for (int i = 0; i < secondaryMappers.length; ++i) { secondaryMappers[i] = (EquationsMapper) in.readObject(); } dirtyState = true; if (dimension < 0) { currentState = null; } else { currentState = new double[dimension]; for (int i = 0; i < currentState.length; ++i) { currentState[i] = in.readDouble(); } } interpolatedTime = Double.NaN; allocateInterpolatedArrays(dimension); finalized = true; return in.readDouble(); }
/** Read the base state of the instance. * This method does <strong>neither</strong> set the interpolated * time nor state. It is up to the derived class to reset it * properly calling the {@link #setInterpolatedTime} method later, * once all rest of the object state has been set up properly. * @param in stream where to read the state from * @return interpolated time to be set later by the caller * @exception IOException in case of read error * @exception ClassNotFoundException if an equation mapper class * cannot be found */
Read the base state of the instance. This method does neither set the interpolated time nor state. It is up to the derived class to reset it properly calling the <code>#setInterpolatedTime</code> method later, once all rest of the object state has been set up properly
readBaseExternal
{ "repo_name": "charles-cooper/idylfin", "path": "src/org/apache/commons/math3/ode/sampling/AbstractStepInterpolator.java", "license": "apache-2.0", "size": 22433 }
[ "java.io.IOException", "java.io.ObjectInput", "org.apache.commons.math3.ode.EquationsMapper" ]
import java.io.IOException; import java.io.ObjectInput; import org.apache.commons.math3.ode.EquationsMapper;
import java.io.*; import org.apache.commons.math3.ode.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
2,096,465
public Iterator<String> findAttributes() { if (attributes == null) { List<String> empty = Collections.emptyList(); return empty.iterator(); } else return attributes.keySet().iterator(); }
Iterator<String> function() { if (attributes == null) { List<String> empty = Collections.emptyList(); return empty.iterator(); } else return attributes.keySet().iterator(); }
/** * Return an Iterator of the attribute names of this node. If there are * no attributes, an empty Iterator is returned. */
Return an Iterator of the attribute names of this node. If there are no attributes, an empty Iterator is returned
findAttributes
{ "repo_name": "WhiteBearSolutions/WBSAirback", "path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/jasper/xmlparser/TreeNode.java", "license": "apache-2.0", "size": 8438 }
[ "java.util.Collections", "java.util.Iterator", "java.util.List" ]
import java.util.Collections; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,331,302
try { serverSocket = new ServerSocket( port ); while( listen ) { try { socket = serverSocket.accept(); addSockets( socket ); gui.showText( "Connected: " + Time.getTime() + "\nIP-address: " + socket.getInetAddress().getHostAddress() ); input = new DataInputStream( socket.getInputStream() ); id = input.readUTF(); gui.showText( "Inloggningsid: " + id + "\n"); // If the unique id is known the client only needs to input the password. if( table.containsKey( id ) ) { gui.showText( "Status: User " + table.get( id ).getName() + " is trusted\n" ); output = new DataOutputStream( socket.getOutputStream() ); output.writeUTF( "connected" ); output.flush(); Thread serverThread = new Thread( new ListenToClientPassword( list, socket, output, input, gui, table, id ) ); serverThread.start(); // If the unique id is empty it's the first login and the client needs a username and password. } else if( id.equals( "" ) ) { gui.showText( "Status: New user\n" ); output = new DataOutputStream( socket.getOutputStream() ); output.writeUTF( "newuser" ); output.flush(); Thread serverThread = new Thread( new ListenToNewClient( list, socket, output, input, gui, table ) ); serverThread.start(); // If the unique id is not empty the user is not allowed to log in. } else { gui.showText( "Status: User not trusted\n" ); output = new DataOutputStream( socket.getOutputStream() ); output.writeUTF( "unknown" ); output.flush(); gui.showText( "Disconnected: " + Time.getTime() + "\nIP-address: " + socket.getInetAddress().getHostAddress() + "\n" ); socket.close(); removeSocket(); } } catch( IOException e ) { if( list.size() != 0 ) { socket.close(); removeSocket(); } } } } catch( IOException e1 ) {} }
try { serverSocket = new ServerSocket( port ); while( listen ) { try { socket = serverSocket.accept(); addSockets( socket ); gui.showText( STR + Time.getTime() + STR + socket.getInetAddress().getHostAddress() ); input = new DataInputStream( socket.getInputStream() ); id = input.readUTF(); gui.showText( STR + id + "\n"); if( table.containsKey( id ) ) { gui.showText( STR + table.get( id ).getName() + STR ); output = new DataOutputStream( socket.getOutputStream() ); output.writeUTF( STR ); output.flush(); Thread serverThread = new Thread( new ListenToClientPassword( list, socket, output, input, gui, table, id ) ); serverThread.start(); } else if( id.equals( STRStatus: New user\nSTRnewuserSTRStatus: User not trusted\nSTRunknownSTRDisconnected: " + Time.getTime() + STR + socket.getInetAddress().getHostAddress() + "\n" ); socket.close(); removeSocket(); } } catch( IOException e ) { if( list.size() != 0 ) { socket.close(); removeSocket(); } } } } catch( IOException e1 ) {} }
/** * A function that listens for new clients and sends them the right way. */
A function that listens for new clients and sends them the right way
run
{ "repo_name": "pjohansson77/Remote-Lock", "path": "Server/ListenForClients.java", "license": "mit", "size": 4509 }
[ "java.io.DataInputStream", "java.io.DataOutputStream", "java.io.IOException", "java.net.ServerSocket" ]
import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.ServerSocket;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
840,279
public Point getCenterOfBattleField() { return new Point((int) Math.round(getBattleFieldWidth()/2), (int) Math.round(getBattleFieldHeight()/2.0)); }
Point function() { return new Point((int) Math.round(getBattleFieldWidth()/2), (int) Math.round(getBattleFieldHeight()/2.0)); }
/** * Gives the exact center of the battlefield. * @return a <tt>Point</tt> with the coordinates corresponding to the center of the battlefield. */
Gives the exact center of the battlefield
getCenterOfBattleField
{ "repo_name": "mantono/Robots", "path": "src/com/mantono/AbstractRobot.java", "license": "gpl-2.0", "size": 12208 }
[ "java.awt.Point" ]
import java.awt.Point;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,215,910
User getUserById(PerunSession perunSession, int id) throws UserNotExistsException, PrivilegeException;
User getUserById(PerunSession perunSession, int id) throws UserNotExistsException, PrivilegeException;
/** * Returns user by his/her id. * * @param perunSession * @param id * @return user * @throws UserNotExistsException * @throws InternalErrorException * @throws PrivilegeException */
Returns user by his/her id
getUserById
{ "repo_name": "mvocu/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/UsersManager.java", "license": "bsd-2-clause", "size": 59026 }
[ "cz.metacentrum.perun.core.api.exceptions.PrivilegeException", "cz.metacentrum.perun.core.api.exceptions.UserNotExistsException" ]
import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.UserNotExistsException;
import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
415,155
public static AbstractOffsetDateTimeAssert<?> then(OffsetDateTime actual) { return assertThat(actual); }
static AbstractOffsetDateTimeAssert<?> function(OffsetDateTime actual) { return assertThat(actual); }
/** * Creates a new instance of <code>{@link OffsetTimeAssert}</code>. * * @param actual the actual value. * @return the created assertion object. */
Creates a new instance of <code><code>OffsetTimeAssert</code></code>
then
{ "repo_name": "Turbo87/assertj-core", "path": "src/main/java/org/assertj/core/api/BDDAssertions.java", "license": "apache-2.0", "size": 18983 }
[ "java.time.OffsetDateTime" ]
import java.time.OffsetDateTime;
import java.time.*;
[ "java.time" ]
java.time;
988,732
private int getNextFreestyle() { int max = -1; for (int i = 0; i < styles.size(); i++) { String string = styles.get(i); StringTokenizer tk = new StringTokenizer(string, "\\", true); //$NON-NLS-1$ while (tk.hasMoreTokens()) { String token = tk.nextToken(); if (token.equals("\\")) { //$NON-NLS-1$ if (!tk.hasMoreTokens()) { break; } token = token + tk.nextToken(); } if (getControl(token).equals("s") //$NON-NLS-1$ || getControl(token).equals("cs") //$NON-NLS-1$ || getControl(token).equals("ds") //$NON-NLS-1$ || getControl(token).equals("ts")) { //$NON-NLS-1$ int value = Integer.parseInt(getValue(token).trim()); if (value > max) { max = value; } } } } return max + 1; }
int function() { int max = -1; for (int i = 0; i < styles.size(); i++) { String string = styles.get(i); StringTokenizer tk = new StringTokenizer(string, "\\", true); while (tk.hasMoreTokens()) { String token = tk.nextToken(); if (token.equals("\\")) { if (!tk.hasMoreTokens()) { break; } token = token + tk.nextToken(); } if (getControl(token).equals("s") getControl(token).equals("cs") getControl(token).equals("ds") getControl(token).equals("ts")) { int value = Integer.parseInt(getValue(token).trim()); if (value > max) { max = value; } } } } return max + 1; }
/** * Gets the next freestyle. * @return the next freestyle */
Gets the next freestyle
getNextFreestyle
{ "repo_name": "heartsome/tmxeditor8", "path": "hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Rtf2Xliff.java", "license": "gpl-2.0", "size": 96309 }
[ "java.util.StringTokenizer" ]
import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
2,540,803
public void setMenu(int res) { setMenu(LayoutInflater.from(getContext()).inflate(res, null)); }
void function(int res) { setMenu(LayoutInflater.from(getContext()).inflate(res, null)); }
/** * Set the behind view (menu) content from a layout resource. The resource will be inflated, adding all top-level views * to the behind view. * * @param res the new content */
Set the behind view (menu) content from a layout resource. The resource will be inflated, adding all top-level views to the behind view
setMenu
{ "repo_name": "pingping-jiang6141/appcan-android", "path": "Engine/src/main/java/com/slidingmenu/lib/SlidingMenu.java", "license": "lgpl-3.0", "size": 36305 }
[ "android.view.LayoutInflater" ]
import android.view.LayoutInflater;
import android.view.*;
[ "android.view" ]
android.view;
2,745,412
void writeStreamValue(DBRProgressMonitor monitor, @NotNull DBPDataSource dataSource, @NotNull DBSTypedObject type, @NotNull DBDContent object, @NotNull Writer writer) throws DBCException, IOException;
void writeStreamValue(DBRProgressMonitor monitor, @NotNull DBPDataSource dataSource, @NotNull DBSTypedObject type, @NotNull DBDContent object, @NotNull Writer writer) throws DBCException, IOException;
/** * Writes content value. * Must use native content representation. */
Writes content value. Must use native content representation
writeStreamValue
{ "repo_name": "liuyuanyuan/dbeaver", "path": "plugins/org.jkiss.dbeaver.model/src/org/jkiss/dbeaver/model/data/DBDContentValueHandler.java", "license": "apache-2.0", "size": 1451 }
[ "java.io.IOException", "java.io.Writer", "org.jkiss.code.NotNull", "org.jkiss.dbeaver.model.DBPDataSource", "org.jkiss.dbeaver.model.exec.DBCException", "org.jkiss.dbeaver.model.runtime.DBRProgressMonitor", "org.jkiss.dbeaver.model.struct.DBSTypedObject" ]
import java.io.IOException; import java.io.Writer; import org.jkiss.code.NotNull; import org.jkiss.dbeaver.model.DBPDataSource; import org.jkiss.dbeaver.model.exec.DBCException; import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor; import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import java.io.*; import org.jkiss.code.*; import org.jkiss.dbeaver.model.*; import org.jkiss.dbeaver.model.exec.*; import org.jkiss.dbeaver.model.runtime.*; import org.jkiss.dbeaver.model.struct.*;
[ "java.io", "org.jkiss.code", "org.jkiss.dbeaver" ]
java.io; org.jkiss.code; org.jkiss.dbeaver;
373,957
public Term getSubTerm(String position) { if (position.equals("")) { return this; } else { throw new NoSuchElementException(); } }
Term function(String position) { if (position.equals("")) { return this; } else { throw new NoSuchElementException(); } }
/** * Getter for subterms * * @param position * should be "" or thrwos NoSuchElementException() * @return returns term at position * @throws thrwos * NoSuchElementException() if position not "" */
Getter for subterms
getSubTerm
{ "repo_name": "jurkov/j-algo-mod", "path": "src/org/jalgo/module/lambda/model/Atom.java", "license": "gpl-2.0", "size": 5047 }
[ "java.util.NoSuchElementException" ]
import java.util.NoSuchElementException;
import java.util.*;
[ "java.util" ]
java.util;
2,249,382
public static String encodeUrlSegment(String s) { if (s != null) try { return URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "%20"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } catch (UnsupportedEncodingException e) { // do nothing } return s; }
static String function(String s) { if (s != null) try { return URLEncoder.encode(s, "UTF-8").replaceAll("\\+", "%20"); } catch (UnsupportedEncodingException e) { } return s; }
/** * Encodes a URL segment into the application/x-www-form-urlencoded format. In * addition, '+' characters (that represent whitespace) are encoded into '%20' * * @param s * - input string * @return - endoded string */
Encodes a URL segment into the application/x-www-form-urlencoded format. In addition, '+' characters (that represent whitespace) are encoded into '%20'
encodeUrlSegment
{ "repo_name": "bdaum/zoraPD", "path": "com.bdaum.zoom.core/src/com/bdaum/zoom/core/Core.java", "license": "gpl-2.0", "size": 18423 }
[ "java.io.UnsupportedEncodingException", "java.net.URLEncoder" ]
import java.io.UnsupportedEncodingException; import java.net.URLEncoder;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
887,926
private void resetPlayer(Player player) { player.setHealth(20D); player.setFoodLevel(20); player.setSaturation(20); player.getInventory().clear(); player.getInventory().setArmorContents(null); player.setExp(0L); player.setLevel(0); player.closeInventory(); }
void function(Player player) { player.setHealth(20D); player.setFoodLevel(20); player.setSaturation(20); player.getInventory().clear(); player.getInventory().setArmorContents(null); player.setExp(0L); player.setLevel(0); player.closeInventory(); }
/** * Reinitializes a player (health, XP, inventory...). * * @param player The player */
Reinitializes a player (health, XP, inventory...)
resetPlayer
{ "repo_name": "AmauryCarrade/UHPlugin", "path": "src/main/java/eu/carrade/amaury/UHCReloaded/game/UHGameManager.java", "license": "gpl-3.0", "size": 42228 }
[ "org.bukkit.entity.Player" ]
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
[ "org.bukkit.entity" ]
org.bukkit.entity;
2,582,281
public static boolean addReadResolve(Class cls) { if (cls.isAnonymous() && cls.isToplevel()) { return true; } return false; }
static boolean function(Class cls) { if (cls.isAnonymous() && cls.isToplevel()) { return true; } return false; }
/** Should the given class have a readResolve() method added ? * @param ser */
Should the given class have a readResolve() method added
addReadResolve
{ "repo_name": "gijsleussink/ceylon", "path": "compiler-java/src/com/redhat/ceylon/compiler/java/codegen/Strategy.java", "license": "apache-2.0", "size": 20571 }
[ "com.redhat.ceylon.model.typechecker.model.Class" ]
import com.redhat.ceylon.model.typechecker.model.Class;
import com.redhat.ceylon.model.typechecker.model.*;
[ "com.redhat.ceylon" ]
com.redhat.ceylon;
542,157
public void leaveBootloader() { checkBootloader(); if (isBootloaderV1()) { leaveBootloaderV1(); return; } final UsbControlIrp irp = createIrp(UsbConst.REQUESTTYPE_TYPE_VENDOR | UsbConst.REQUESTTYPE_RECIPIENT_DEVICE | UsbConst.ENDPOINT_DIRECTION_OUT, REQ_LEAVE_BOOTLOADER, 0, 0); submit(irp); }
void function() { checkBootloader(); if (isBootloaderV1()) { leaveBootloaderV1(); return; } final UsbControlIrp irp = createIrp(UsbConst.REQUESTTYPE_TYPE_VENDOR UsbConst.REQUESTTYPE_RECIPIENT_DEVICE UsbConst.ENDPOINT_DIRECTION_OUT, REQ_LEAVE_BOOTLOADER, 0, 0); submit(irp); }
/** * Leaves the boot loader. */
Leaves the boot loader
leaveBootloader
{ "repo_name": "microblinks/lcore", "path": "src/main/java/de/ailis/microblinks/l/core/device/LDevice.java", "license": "lgpl-3.0", "size": 31686 }
[ "javax.usb.UsbConst", "javax.usb.UsbControlIrp" ]
import javax.usb.UsbConst; import javax.usb.UsbControlIrp;
import javax.usb.*;
[ "javax.usb" ]
javax.usb;
994,297
protected void newArray(Object o, String name, Class type, int[] dimensions) { Field f; try { f = o.getClass().getField(name); f.set(o, Array.newInstance(type, dimensions)); } catch (Exception e) { e.printStackTrace(); } }
void function(Object o, String name, Class type, int[] dimensions) { Field f; try { f = o.getClass().getField(name); f.set(o, Array.newInstance(type, dimensions)); } catch (Exception e) { e.printStackTrace(); } }
/** * sets a new array for the field * * @param o the object to set the array for * @param name the name of the field * @param type the type of the array * @param dimensions the dimensions of the array */
sets a new array for the field
newArray
{ "repo_name": "williamClanton/jbossBA", "path": "weka/src/main/java/weka/classifiers/functions/LibSVM.java", "license": "gpl-2.0", "size": 47035 }
[ "java.lang.reflect.Array", "java.lang.reflect.Field" ]
import java.lang.reflect.Array; import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,537,110
public static void fireLeftCluster(byte[] nodeID) { try { Log.info("Firing left cluster event for another node:" + new String(nodeID, StandardCharsets.UTF_8)); Event event = new Event(EventType.left_cluster, nodeID); events.put(event); } catch (InterruptedException e) { // Should never happen Log.error(e.getMessage(), e); } }
static void function(byte[] nodeID) { try { Log.info(STR + new String(nodeID, StandardCharsets.UTF_8)); Event event = new Event(EventType.left_cluster, nodeID); events.put(event); } catch (InterruptedException e) { Log.error(e.getMessage(), e); } }
/** * Triggers event indicating that another JVM is no longer part of the cluster. This could * happen when disabling clustering support or removing the enterprise plugin that provides * clustering support. * * @param nodeID nodeID assigned to the JVM when joining the cluster. */
Triggers event indicating that another JVM is no longer part of the cluster. This could happen when disabling clustering support or removing the enterprise plugin that provides clustering support
fireLeftCluster
{ "repo_name": "speedy01/Openfire", "path": "xmppserver/src/main/java/org/jivesoftware/openfire/cluster/ClusterManager.java", "license": "apache-2.0", "size": 24082 }
[ "java.nio.charset.StandardCharsets" ]
import java.nio.charset.StandardCharsets;
import java.nio.charset.*;
[ "java.nio" ]
java.nio;
2,855,476
@Override public Dimension preferredLayoutSize(Container parent) { Dimension rd = null, mbd; Insets i = getInsets(); if (contentPane != null) { iPlatformComponent pc = Platform.createPlatformComponent(contentPane); rd = SwingHelper.setDimension(rd, pc.getPreferredSize()); } else { rd = parent.getSize(); } if ((menuBar != null) && menuBar.isVisible()) { mbd = menuBar.getPreferredSize(); } else { mbd = new Dimension(0, 0); } UIDimension dd = ((titlePane == null) ||!titlePane.isVisible()) ? null : Platform.createPlatformComponent(titlePane).getPreferredSize(); if (dd != null) { rd.width = Math.max(rd.width, dd.intWidth()); rd.height += dd.height; } return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right, rd.height + mbd.height + i.top + i.bottom); } }
Dimension function(Container parent) { Dimension rd = null, mbd; Insets i = getInsets(); if (contentPane != null) { iPlatformComponent pc = Platform.createPlatformComponent(contentPane); rd = SwingHelper.setDimension(rd, pc.getPreferredSize()); } else { rd = parent.getSize(); } if ((menuBar != null) && menuBar.isVisible()) { mbd = menuBar.getPreferredSize(); } else { mbd = new Dimension(0, 0); } UIDimension dd = ((titlePane == null) !titlePane.isVisible()) ? null : Platform.createPlatformComponent(titlePane).getPreferredSize(); if (dd != null) { rd.width = Math.max(rd.width, dd.intWidth()); rd.height += dd.height; } return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right, rd.height + mbd.height + i.top + i.bottom); } }
/** * Returns the amount of space the layout would like to have. * * @param parent * the Container for which this layout manager is being used * @return a Dimension object containing the layout's preferred size */
Returns the amount of space the layout would like to have
preferredLayoutSize
{ "repo_name": "appnativa/rare", "path": "source/rare/swingx/com/appnativa/rare/platform/swing/ui/view/JRootPaneEx.java", "license": "gpl-3.0", "size": 8918 }
[ "com.appnativa.rare.Platform", "com.appnativa.rare.platform.swing.ui.util.SwingHelper", "com.appnativa.rare.ui.UIDimension", "java.awt.Container", "java.awt.Dimension", "java.awt.Insets" ]
import com.appnativa.rare.Platform; import com.appnativa.rare.platform.swing.ui.util.SwingHelper; import com.appnativa.rare.ui.UIDimension; import java.awt.Container; import java.awt.Dimension; import java.awt.Insets;
import com.appnativa.rare.*; import com.appnativa.rare.platform.swing.ui.util.*; import com.appnativa.rare.ui.*; import java.awt.*;
[ "com.appnativa.rare", "java.awt" ]
com.appnativa.rare; java.awt;
684,916
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; }
boolean function(Object obj) { if (obj == this) { return true; } if (!(obj instanceof KeyedObject)) { return false; } KeyedObject that = (KeyedObject) obj; if (!ObjectUtilities.equal(this.key, that.key)) { return false; } if (!ObjectUtilities.equal(this.object, that.object)) { return false; } return true; }
/** * Tests if this object is equal to another. * * @param obj the other object. * * @return A boolean. */
Tests if this object is equal to another
equals
{ "repo_name": "hongliangpan/manydesigns.cn", "path": "trunk/portofino-chart/jfreechat.src/org/jfree/data/KeyedObject.java", "license": "lgpl-3.0", "size": 4143 }
[ "org.jfree.util.ObjectUtilities" ]
import org.jfree.util.ObjectUtilities;
import org.jfree.util.*;
[ "org.jfree.util" ]
org.jfree.util;
1,352,655
return executeOnServer(new Callable<Object>() {
return executeOnServer(new Callable<Object>() {
/** * Executes the given closure on the server, in the context of an HTTP request. * This is useful for testing some methods that require {@link StaplerRequest} and {@link StaplerResponse}. * * <p> * The closure will get the request and response as parameters. */
Executes the given closure on the server, in the context of an HTTP request. This is useful for testing some methods that require <code>StaplerRequest</code> and <code>StaplerResponse</code>. The closure will get the request and response as parameters
executeOnServer
{ "repo_name": "vivek/hudson", "path": "test/src/main/java/org/jvnet/hudson/test/GroovyHudsonTestCase.java", "license": "mit", "size": 1635 }
[ "java.util.concurrent.Callable" ]
import java.util.concurrent.Callable;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
163,242
private static void sortKeyPrefixArrayAtByte( LongArray array, int numRecords, long[] counts, int byteIdx, int inIndex, int outIndex, boolean desc, boolean signed) { assert counts.length == 256; long[] offsets = transformCountsToOffsets( counts, numRecords, array.getBaseOffset() + outIndex * 8, 16, desc, signed); Object baseObject = array.getBaseObject(); long baseOffset = array.getBaseOffset() + inIndex * 8; long maxOffset = baseOffset + numRecords * 16; for (long offset = baseOffset; offset < maxOffset; offset += 16) { long key = Platform.getLong(baseObject, offset); long prefix = Platform.getLong(baseObject, offset + 8); int bucket = (int)((prefix >>> (byteIdx * 8)) & 0xff); long dest = offsets[bucket]; Platform.putLong(baseObject, dest, key); Platform.putLong(baseObject, dest + 8, prefix); offsets[bucket] += 16; } }
static void function( LongArray array, int numRecords, long[] counts, int byteIdx, int inIndex, int outIndex, boolean desc, boolean signed) { assert counts.length == 256; long[] offsets = transformCountsToOffsets( counts, numRecords, array.getBaseOffset() + outIndex * 8, 16, desc, signed); Object baseObject = array.getBaseObject(); long baseOffset = array.getBaseOffset() + inIndex * 8; long maxOffset = baseOffset + numRecords * 16; for (long offset = baseOffset; offset < maxOffset; offset += 16) { long key = Platform.getLong(baseObject, offset); long prefix = Platform.getLong(baseObject, offset + 8); int bucket = (int)((prefix >>> (byteIdx * 8)) & 0xff); long dest = offsets[bucket]; Platform.putLong(baseObject, dest, key); Platform.putLong(baseObject, dest + 8, prefix); offsets[bucket] += 16; } }
/** * Specialization of sortAtByte() for key-prefix arrays. */
Specialization of sortAtByte() for key-prefix arrays
sortKeyPrefixArrayAtByte
{ "repo_name": "gioenn/xSpark", "path": "core/src/main/java/org/apache/spark/util/collection/unsafe/sort/RadixSort.java", "license": "apache-2.0", "size": 10886 }
[ "org.apache.spark.unsafe.Platform", "org.apache.spark.unsafe.array.LongArray" ]
import org.apache.spark.unsafe.Platform; import org.apache.spark.unsafe.array.LongArray;
import org.apache.spark.unsafe.*; import org.apache.spark.unsafe.array.*;
[ "org.apache.spark" ]
org.apache.spark;
1,991,076
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<SqlTriggerGetResultsInner> createUpdateSqlTriggerAsync( String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, Context context) { return beginCreateUpdateSqlTriggerAsync( resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<SqlTriggerGetResultsInner> function( String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, Context context) { return beginCreateUpdateSqlTriggerAsync( resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * Create or update an Azure Cosmos DB SQL trigger. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param accountName Cosmos DB database account name. * @param databaseName Cosmos DB database name. * @param containerName Cosmos DB container name. * @param triggerName Cosmos DB trigger name. * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return an Azure Cosmos DB trigger. */
Create or update an Azure Cosmos DB SQL trigger
createUpdateSqlTriggerAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/SqlResourcesClientImpl.java", "license": "mit", "size": 547809 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.util.Context", "com.azure.resourcemanager.cosmos.fluent.models.SqlTriggerGetResultsInner", "com.azure.resourcemanager.cosmos.models.SqlTriggerCreateUpdateParameters" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; import com.azure.resourcemanager.cosmos.fluent.models.SqlTriggerGetResultsInner; import com.azure.resourcemanager.cosmos.models.SqlTriggerCreateUpdateParameters;
import com.azure.core.annotation.*; import com.azure.core.util.*; import com.azure.resourcemanager.cosmos.fluent.models.*; import com.azure.resourcemanager.cosmos.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,839,598
public static PyExpr convertMapToOrderedDict(Map<PyExpr, PyExpr> dict) { List<String> values = new ArrayList<>(); for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) { values.add("(" + entry.getKey().getText() + ", " + entry.getValue().getText() + ")"); } Joiner joiner = Joiner.on(", "); return new PyExpr("collections.OrderedDict([" + joiner.join(values) + "])", Integer.MAX_VALUE); }
static PyExpr function(Map<PyExpr, PyExpr> dict) { List<String> values = new ArrayList<>(); for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) { values.add("(" + entry.getKey().getText() + STR + entry.getValue().getText() + ")"); } Joiner joiner = Joiner.on(STR); return new PyExpr(STR + joiner.join(values) + "])", Integer.MAX_VALUE); }
/** * Convert a java Map to valid PyExpr as dict. * * @param dict A Map to be converted to PyExpr as a dictionary, both key and value should be * PyExpr. */
Convert a java Map to valid PyExpr as dict
convertMapToOrderedDict
{ "repo_name": "yext/closure-templates", "path": "java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java", "license": "apache-2.0", "size": 14920 }
[ "com.google.common.base.Joiner", "java.util.ArrayList", "java.util.List", "java.util.Map" ]
import com.google.common.base.Joiner; import java.util.ArrayList; import java.util.List; import java.util.Map;
import com.google.common.base.*; import java.util.*;
[ "com.google.common", "java.util" ]
com.google.common; java.util;
743,250
optionsBuilder = new OptionsBuilder(); optionsBuilder.steps = new Steps(); optionsBuilder.options = new HashMap<String, Object>(); }
optionsBuilder = new OptionsBuilder(); optionsBuilder.steps = new Steps(); optionsBuilder.options = new HashMap<String, Object>(); }
/** * Assings a new {@link OptionsBuilder} instance to the optionsBuilder variable before each individual test. */
Assings a new <code>OptionsBuilder</code> instance to the optionsBuilder variable before each individual test
setUp
{ "repo_name": "transloadit/java-sdk", "path": "src/test/java/com/transloadit/sdk/OptionsBuilderTest.java", "license": "mit", "size": 4121 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,454,580
public void setDictAttributePersistence( DictAttributePersistence dictAttributePersistence) { this.dictAttributePersistence = dictAttributePersistence; }
void function( DictAttributePersistence dictAttributePersistence) { this.dictAttributePersistence = dictAttributePersistence; }
/** * Sets the dictionary attribute persistence. * * @param dictAttributePersistence the dictionary attribute persistence */
Sets the dictionary attribute persistence
setDictAttributePersistence
{ "repo_name": "thongdv/OEPv2", "path": "portlets/oep-core-datamgt-portlet/docroot/WEB-INF/src/org/oep/core/datamgt/dictionary/service/base/DictMetaDataServiceBaseImpl.java", "license": "apache-2.0", "size": 16263 }
[ "org.oep.core.datamgt.dictionary.service.persistence.DictAttributePersistence" ]
import org.oep.core.datamgt.dictionary.service.persistence.DictAttributePersistence;
import org.oep.core.datamgt.dictionary.service.persistence.*;
[ "org.oep.core" ]
org.oep.core;
2,240,719
@Override public String getString( Object[] dataRow, int index ) throws KettleValueException { if ( dataRow == null ) { return null; } ValueMetaInterface meta = valueMetaList.get( index ); return meta.getString( dataRow[index] ); }
String function( Object[] dataRow, int index ) throws KettleValueException { if ( dataRow == null ) { return null; } ValueMetaInterface meta = valueMetaList.get( index ); return meta.getString( dataRow[index] ); }
/** * Get a String value from a row of data. Convert data if this needed. * * @param rowRow * the row of data * @param index * the index * @return The string found on that position in the row * @throws KettleValueException * in case there was a problem converting the data. */
Get a String value from a row of data. Convert data if this needed
getString
{ "repo_name": "ma459006574/pentaho-kettle", "path": "core/src/org/pentaho/di/core/row/RowMeta.java", "license": "apache-2.0", "size": 34343 }
[ "org.pentaho.di.core.exception.KettleValueException" ]
import org.pentaho.di.core.exception.KettleValueException;
import org.pentaho.di.core.exception.*;
[ "org.pentaho.di" ]
org.pentaho.di;
2,600,707
Rectangle2D get_viewport_bounds() { return scroll_pane.getViewportBorderBounds(); }
Rectangle2D get_viewport_bounds() { return scroll_pane.getViewportBorderBounds(); }
/** * Returns the viewport bounds of the scroll pane */
Returns the viewport bounds of the scroll pane
get_viewport_bounds
{ "repo_name": "rbuj/FreeRouting", "path": "src/main/java/net/freerouting/freeroute/BoardPanel.java", "license": "gpl-3.0", "size": 17808 }
[ "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,615,972
public ArrayList<String> email_exchange_organizationName_service_exchangeService_account_GET(String organizationName, String exchangeService, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException { String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/account"; StringBuilder sb = path(qPath, organizationName, exchangeService); query(sb, "licence", licence); query(sb, "number", number); query(sb, "storageQuota", storageQuota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); } /** * Get prices and contracts information * * REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}
ArrayList<String> function(String organizationName, String exchangeService, OvhOvhLicenceEnum licence, Long number, OvhAccountQuotaEnum storageQuota) throws IOException { String qPath = STR; StringBuilder sb = path(qPath, organizationName, exchangeService); query(sb, STR, licence); query(sb, STR, number); query(sb, STR, storageQuota); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); } /** * Get prices and contracts information * * REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/account/{duration}
/** * Get allowed durations for 'account' option * * REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/account * @param number [required] Number of Accounts to order * @param storageQuota [required] The storage quota for the account(s) in GB (default = 50) * @param licence [required] Licence type for the account * @param organizationName [required] The internal name of your exchange organization * @param exchangeService [required] The internal name of your exchange service */
Get allowed durations for 'account' option
email_exchange_organizationName_service_exchangeService_account_GET
{ "repo_name": "UrielCh/ovh-java-sdk", "path": "ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java", "license": "bsd-3-clause", "size": 511080 }
[ "java.io.IOException", "java.util.ArrayList", "net.minidev.ovh.api.email.exchange.OvhAccountQuotaEnum", "net.minidev.ovh.api.email.exchange.OvhOvhLicenceEnum" ]
import java.io.IOException; import java.util.ArrayList; import net.minidev.ovh.api.email.exchange.OvhAccountQuotaEnum; import net.minidev.ovh.api.email.exchange.OvhOvhLicenceEnum;
import java.io.*; import java.util.*; import net.minidev.ovh.api.email.exchange.*;
[ "java.io", "java.util", "net.minidev.ovh" ]
java.io; java.util; net.minidev.ovh;
1,423,151
public Date nextMatch(Date startDate) { if (startDate == null) { startDate = new Date(); } if (this.dateMatches(startDate)) { return startDate; } long neededRepeats; if ((startDate.getTime() - start.getTime()) <= 0) { neededRepeats = 0; } else if (0 < repeatInterval) { neededRepeats = (startDate.getTime() - start.getTime()) / repeatInterval + 1; } else { return null; } if(numRepeats < neededRepeats) { return null; } return new Date(this.start.getTime() + repeatInterval * neededRepeats); }
Date function(Date startDate) { if (startDate == null) { startDate = new Date(); } if (this.dateMatches(startDate)) { return startDate; } long neededRepeats; if ((startDate.getTime() - start.getTime()) <= 0) { neededRepeats = 0; } else if (0 < repeatInterval) { neededRepeats = (startDate.getTime() - start.getTime()) / repeatInterval + 1; } else { return null; } if(numRepeats < neededRepeats) { return null; } return new Date(this.start.getTime() + repeatInterval * neededRepeats); }
/** * Gets the next matching date after the given <code>Date</code>. If the <code>Date</code> * given is null, the current date/time is used instead. * * @param startDate the date to start from when searching for the next match. * @return a <code>Date</code> indicating the next matching date */
Gets the next matching date after the given <code>Date</code>. If the <code>Date</code> given is null, the current date/time is used instead
nextMatch
{ "repo_name": "mdarcy220/MyCards", "path": "app/src/main/java/com/group13/androidsdk/mycards/SimpleDatePattern.java", "license": "apache-2.0", "size": 4487 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
79,818
ImmutableSet<SourcePath> getPathsToThirdPartyJars();
ImmutableSet<SourcePath> getPathsToThirdPartyJars();
/** * Prebuilt/third-party jars to be included in the package. For apks, their resources will * be placed directly in the apk. */
Prebuilt/third-party jars to be included in the package. For apks, their resources will be placed directly in the apk
getPathsToThirdPartyJars
{ "repo_name": "rhencke/buck", "path": "src/com/facebook/buck/android/AbstractAndroidPackageableCollection.java", "license": "apache-2.0", "size": 4573 }
[ "com.facebook.buck.rules.SourcePath", "com.google.common.collect.ImmutableSet" ]
import com.facebook.buck.rules.SourcePath; import com.google.common.collect.ImmutableSet;
import com.facebook.buck.rules.*; import com.google.common.collect.*;
[ "com.facebook.buck", "com.google.common" ]
com.facebook.buck; com.google.common;
1,534,350
@ApiModelProperty(value = "Discovered name of the entity") public String getDiscoveredName() { return discoveredName; }
@ApiModelProperty(value = STR) String function() { return discoveredName; }
/** * Discovered name of the entity * * @return discoveredName **/
Discovered name of the entity
getDiscoveredName
{ "repo_name": "T-Systems-MMS/perfsig-jenkins", "path": "dynatrace/src/main/java/de/tsystems/mms/apm/performancesignature/dynatracesaas/rest/model/ProcessGroupInstance.java", "license": "apache-2.0", "size": 15928 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,762,471
protected Node getFirstChild(Node n) { return n.getFirstChild(); }
Node function(Node n) { return n.getFirstChild(); }
/** * Returns the first child node of the given node that should be * processed by the text bridge. */
Returns the first child node of the given node that should be processed by the text bridge
getFirstChild
{ "repo_name": "sflyphotobooks/crp-batik", "path": "sources/org/apache/batik/bridge/SVGTextElementBridge.java", "license": "apache-2.0", "size": 114566 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,201,970
public Observable<ServiceResponse<Page<ResourceMetricInner>>> listWebWorkerMetricsSinglePageAsync(final String resourceGroupName, final String name, final String workerPoolName) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (name == null) { throw new IllegalArgumentException("Parameter name is required and cannot be null."); } if (workerPoolName == null) { throw new IllegalArgumentException("Parameter workerPoolName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<Page<ResourceMetricInner>>> function(final String resourceGroupName, final String name, final String workerPoolName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (workerPoolName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). * Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param name Name of the App Service Environment. * @param workerPoolName Name of worker pool * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;ResourceMetricInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment). Get metrics for a worker pool of a AppServiceEnvironment (App Service Environment)
listWebWorkerMetricsSinglePageAsync
{ "repo_name": "anudeepsharma/azure-sdk-for-java", "path": "azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/AppServiceEnvironmentsInner.java", "license": "mit", "size": 564891 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,611,679
@Test public void whenAddNormal() { Squad squad = new Squad(); AbstractUnit unit = new Mage(); squad.addNormal(unit); assertThat(squad.getNormalUnits()[0], is(unit)); }
void function() { Squad squad = new Squad(); AbstractUnit unit = new Mage(); squad.addNormal(unit); assertThat(squad.getNormalUnits()[0], is(unit)); }
/** * Check work addNormal. */
Check work addNormal
whenAddNormal
{ "repo_name": "wolfdog007/aruzhev", "path": "chapter_002/src/test/java/ru/job4j/battlegame/SquadTest.java", "license": "apache-2.0", "size": 6871 }
[ "org.hamcrest.core.Is", "org.junit.Assert", "ru.job4j.battlegame.units.AbstractUnit", "ru.job4j.battlegame.units.elf.Mage" ]
import org.hamcrest.core.Is; import org.junit.Assert; import ru.job4j.battlegame.units.AbstractUnit; import ru.job4j.battlegame.units.elf.Mage;
import org.hamcrest.core.*; import org.junit.*; import ru.job4j.battlegame.units.*; import ru.job4j.battlegame.units.elf.*;
[ "org.hamcrest.core", "org.junit", "ru.job4j.battlegame" ]
org.hamcrest.core; org.junit; ru.job4j.battlegame;
2,393,118
@Override public void onTimeSet(final TimePicker view, final int hourOfDay, final int minute) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss"); Date date = new Date(); date.setHours(hourOfDay); date.setMinutes(minute); callbackContext.success(sdf.format(date)); } }
void function(final TimePicker view, final int hourOfDay, final int minute) { SimpleDateFormat sdf = new SimpleDateFormat(STR); Date date = new Date(); date.setHours(hourOfDay); date.setMinutes(minute); callbackContext.success(sdf.format(date)); } }
/** * Return the current date with the time modified as it was set in the * time picker. */
Return the current date with the time modified as it was set in the time picker
onTimeSet
{ "repo_name": "croshim/cordova-plugin-datepicker-ios-fix", "path": "src/android/DatePickerPlugin.java", "license": "mit", "size": 8805 }
[ "android.widget.TimePicker", "java.text.SimpleDateFormat", "java.util.Date" ]
import android.widget.TimePicker; import java.text.SimpleDateFormat; import java.util.Date;
import android.widget.*; import java.text.*; import java.util.*;
[ "android.widget", "java.text", "java.util" ]
android.widget; java.text; java.util;
2,000,765
private Object readResolve() throws ObjectStreamException { if ( ordinal == SUBINCREMENTAL.ordinal ) { return SUBINCREMENTAL; } if ( ordinal == INCREMENTAL.ordinal ) { return INCREMENTAL; } if ( ordinal == MINOR.ordinal ) { return MINOR; } if ( ordinal == MAJOR.ordinal ) { return MAJOR; } if ( ordinal == ANY.ordinal ) { return ANY; } throw new StreamCorruptedException(); }
Object function() throws ObjectStreamException { if ( ordinal == SUBINCREMENTAL.ordinal ) { return SUBINCREMENTAL; } if ( ordinal == INCREMENTAL.ordinal ) { return INCREMENTAL; } if ( ordinal == MINOR.ordinal ) { return MINOR; } if ( ordinal == MAJOR.ordinal ) { return MAJOR; } if ( ordinal == ANY.ordinal ) { return ANY; } throw new StreamCorruptedException(); }
/** * We need to ensure that the singleton is used when deserializing. * * @return The correct singleton instance. * @throws java.io.ObjectStreamException when things go wrong. */
We need to ensure that the singleton is used when deserializing
readResolve
{ "repo_name": "prostagma/versions-maven-plugin", "path": "src/main/java/org/codehaus/mojo/versions/api/UpdateScope.java", "license": "apache-2.0", "size": 21868 }
[ "java.io.ObjectStreamException", "java.io.StreamCorruptedException" ]
import java.io.ObjectStreamException; import java.io.StreamCorruptedException;
import java.io.*;
[ "java.io" ]
java.io;
589,129
public void setEnrolmentChangePartDao(EnrolmentChangePartDao enrolmentChangePartDao) { this.enrolmentChangePartDao = enrolmentChangePartDao; }
void function(EnrolmentChangePartDao enrolmentChangePartDao) { this.enrolmentChangePartDao = enrolmentChangePartDao; }
/** * Set the enrolment change part DAO. * * @param enrolmentChangePartDao the enrolment change part DAO to set. */
Set the enrolment change part DAO
setEnrolmentChangePartDao
{ "repo_name": "rnicoll/learn_syllabus_plus_sync", "path": "src/main/java/uk/ac/ed/learn9/bb/timetabling/controller/AuditLogController.java", "license": "mit", "size": 3343 }
[ "uk.ac.ed.learn9.bb.timetabling.dao.EnrolmentChangePartDao" ]
import uk.ac.ed.learn9.bb.timetabling.dao.EnrolmentChangePartDao;
import uk.ac.ed.learn9.bb.timetabling.dao.*;
[ "uk.ac.ed" ]
uk.ac.ed;
2,463,675
public BigVector getBigVector(int rowNo) { return varr.get(rowNo); } // getBigVector
BigVector function(int rowNo) { return varr.get(rowNo); }
/** Returns a row as a {@link BigVector}. * @param rowNo number of the row, zero based * @return a BigVector containing the elements of the varr' row */
Returns a row as a <code>BigVector</code>
getBigVector
{ "repo_name": "gfis/ramath", "path": "src/main/java/org/teherba/ramath/linear/BigVectorArray.java", "license": "apache-2.0", "size": 14842 }
[ "org.teherba.ramath.linear.BigVector" ]
import org.teherba.ramath.linear.BigVector;
import org.teherba.ramath.linear.*;
[ "org.teherba.ramath" ]
org.teherba.ramath;
777,095
private void format(StorageDirectory bpSdir, NamespaceInfo nsInfo) throws IOException { LOG.info("Formatting block pool " + blockpoolID + " directory " + bpSdir.getCurrentDir()); bpSdir.clearDirectory(); // create directory this.layoutVersion = HdfsServerConstants.DATANODE_LAYOUT_VERSION; this.cTime = nsInfo.getCTime(); this.namespaceID = nsInfo.getNamespaceID(); this.blockpoolID = nsInfo.getBlockPoolID(); writeProperties(bpSdir); }
void function(StorageDirectory bpSdir, NamespaceInfo nsInfo) throws IOException { LOG.info(STR + blockpoolID + STR + bpSdir.getCurrentDir()); bpSdir.clearDirectory(); this.layoutVersion = HdfsServerConstants.DATANODE_LAYOUT_VERSION; this.cTime = nsInfo.getCTime(); this.namespaceID = nsInfo.getNamespaceID(); this.blockpoolID = nsInfo.getBlockPoolID(); writeProperties(bpSdir); }
/** * Format a block pool slice storage. * @param bpSdir the block pool storage * @param nsInfo the name space info * @throws IOException Signals that an I/O exception has occurred. */
Format a block pool slice storage
format
{ "repo_name": "Microsoft-CISL/hadoop-prototype", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockPoolSliceStorage.java", "license": "apache-2.0", "size": 31808 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.server.common.HdfsServerConstants", "org.apache.hadoop.hdfs.server.protocol.NamespaceInfo" ]
import java.io.IOException; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; import org.apache.hadoop.hdfs.server.protocol.NamespaceInfo;
import java.io.*; import org.apache.hadoop.hdfs.server.common.*; import org.apache.hadoop.hdfs.server.protocol.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,786,386
EReference getCOREImpactModel_ImpactModelElements();
EReference getCOREImpactModel_ImpactModelElements();
/** * Returns the meta object for the containment reference list '{@link ca.mcgill.sel.core.COREImpactModel#getImpactModelElements <em>Impact Model Elements</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Impact Model Elements</em>'. * @see ca.mcgill.sel.core.COREImpactModel#getImpactModelElements() * @see #getCOREImpactModel() * @generated */
Returns the meta object for the containment reference list '<code>ca.mcgill.sel.core.COREImpactModel#getImpactModelElements Impact Model Elements</code>'.
getCOREImpactModel_ImpactModelElements
{ "repo_name": "sacooper/ECSE-429-Project-Group1", "path": "ca.mcgill.sel.core/src/ca/mcgill/sel/core/CorePackage.java", "license": "gpl-2.0", "size": 112990 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,307,338
private synchronized I get(long id) throws E { IdentifierPointer pointer = new IdentifierPointer(id); Reference<I> ref = identifierSet.get(pointer); if (ref == null) { // there is no such ID registered by this ID manager throw identifierNotFound(id); } I identifier = ref.get(); if (identifier == null) { // this may happen only if <tt>identifier</tt> was just discarded between // the <tt>get</tt> call from the hashmap // and the get call of the reference if (identifierSet.get(pointer) == null) { // it really happened! The object collection really happened between the // two <tt>get</tt> calls above throw identifierNotFound(id); } else { // this should not ever happen... see the theory behind explanation in // this file throw new IllegalStateException("The idea behind this manager prooved to be wrong! This is very very bad!"); } } return identifier; }
synchronized I function(long id) throws E { IdentifierPointer pointer = new IdentifierPointer(id); Reference<I> ref = identifierSet.get(pointer); if (ref == null) { throw identifierNotFound(id); } I identifier = ref.get(); if (identifier == null) { if (identifierSet.get(pointer) == null) { throw identifierNotFound(id); } else { throw new IllegalStateException(STR); } } return identifier; }
/** * Gets an identifier for the given ID.<br/> * If the given ID represents an object that was discarded, exception is * thrown. * * @param id * The ID that an identifier is looked for. * @return The identifier. * @throws E * If the object that is represented by the given ID was discarded. */
Gets an identifier for the given ID. If the given ID represents an object that was discarded, exception is thrown
get
{ "repo_name": "stepanv/jpf-jdwp", "path": "src/main/gov/nasa/jpf/jdwp/id/IdManager.java", "license": "gpl-3.0", "size": 7487 }
[ "java.lang.ref.Reference" ]
import java.lang.ref.Reference;
import java.lang.ref.*;
[ "java.lang" ]
java.lang;
2,708,002
protected void appendArtifactPath( Artifact art, StringBuilder sb ) { if ( prefix == null ) { String file = art.getFile().getPath(); // substitute the property for the local repo path to make the classpath file portable. if ( StringUtils.isNotEmpty( localRepoProperty ) ) { File localBasedir = repositoryManager.getLocalRepositoryBasedir( session.getProjectBuildingRequest() ); file = StringUtils.replace( file, localBasedir.getAbsolutePath(), localRepoProperty ); } sb.append( file ); } else { // TODO: add param for prepending groupId and version. sb.append( prefix ); sb.append( File.separator ); sb.append( DependencyUtil.getFormattedFileName( art, this.stripVersion, this.prependGroupId, this.useBaseVersion, this.stripClassifier ) ); } }
void function( Artifact art, StringBuilder sb ) { if ( prefix == null ) { String file = art.getFile().getPath(); if ( StringUtils.isNotEmpty( localRepoProperty ) ) { File localBasedir = repositoryManager.getLocalRepositoryBasedir( session.getProjectBuildingRequest() ); file = StringUtils.replace( file, localBasedir.getAbsolutePath(), localRepoProperty ); } sb.append( file ); } else { sb.append( prefix ); sb.append( File.separator ); sb.append( DependencyUtil.getFormattedFileName( art, this.stripVersion, this.prependGroupId, this.useBaseVersion, this.stripClassifier ) ); } }
/** * Appends the artifact path into the specified StringBuilder. * * @param art * @param sb */
Appends the artifact path into the specified StringBuilder
appendArtifactPath
{ "repo_name": "hgschmie/apache-maven-plugins", "path": "maven-dependency-plugin/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/BuildClasspathMojo.java", "license": "apache-2.0", "size": 15829 }
[ "java.io.File", "org.apache.maven.artifact.Artifact", "org.apache.maven.plugins.dependency.utils.DependencyUtil", "org.codehaus.plexus.util.StringUtils" ]
import java.io.File; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugins.dependency.utils.DependencyUtil; import org.codehaus.plexus.util.StringUtils;
import java.io.*; import org.apache.maven.artifact.*; import org.apache.maven.plugins.dependency.utils.*; import org.codehaus.plexus.util.*;
[ "java.io", "org.apache.maven", "org.codehaus.plexus" ]
java.io; org.apache.maven; org.codehaus.plexus;
1,236,583
@Override public void write(int v) throws IOException { if (_bufferEnd <= _offset) { flushBlock(); } _buffer[_offset++] = (byte) (v >> 8); _buffer[_offset++] = (byte) (v); _length += 2; }
void function(int v) throws IOException { if (_bufferEnd <= _offset) { flushBlock(); } _buffer[_offset++] = (byte) (v >> 8); _buffer[_offset++] = (byte) (v); _length += 2; }
/** * Writes a byte. */
Writes a byte
write
{ "repo_name": "christianchristensen/resin", "path": "modules/resin/src/com/caucho/db/blob/ClobWriter.java", "license": "gpl-2.0", "size": 5328 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,698,484
public List<Broker> followerBrokers() { List<Broker> followerBrokers = new ArrayList<>(); _replicas.forEach(r -> { if (!r.isLeader()) { followerBrokers.add(r.broker()); } }); return followerBrokers; }
List<Broker> function() { List<Broker> followerBrokers = new ArrayList<>(); _replicas.forEach(r -> { if (!r.isLeader()) { followerBrokers.add(r.broker()); } }); return followerBrokers; }
/** * Get the set of brokers that followers reside in. */
Get the set of brokers that followers reside in
followerBrokers
{ "repo_name": "GergoHong/cruise-control", "path": "cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/model/Partition.java", "license": "bsd-2-clause", "size": 6975 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
289,177
private String storeFile(File file) throws Exception { if (file == null) return null; Digester<SHA1> digester = SHA1.getDigester(); FileInputStream fin = new FileInputStream(file); IO.copy(fin, digester); String name = Hex.toHexString(digester.digest().toByteArray()); if (store.getGridFs().findOne(name) != null) return name; GridFSInputFile gf = store.getGridFs().createFile(file); gf.setFilename(name); gf.save(); return gf.getFilename(); }
String function(File file) throws Exception { if (file == null) return null; Digester<SHA1> digester = SHA1.getDigester(); FileInputStream fin = new FileInputStream(file); IO.copy(fin, digester); String name = Hex.toHexString(digester.digest().toByteArray()); if (store.getGridFs().findOne(name) != null) return name; GridFSInputFile gf = store.getGridFs().createFile(file); gf.setFilename(name); gf.save(); return gf.getFilename(); }
/** * File objects are stored in the GridFS store under their hex SHA1. * * @param file * @return * @throws Exception */
File objects are stored in the GridFS store under their hex SHA1
storeFile
{ "repo_name": "pkriens/aQute.open", "path": "aQute.open.store.mongo.provider/src/aQute/impl/store/mongo/MongoCodec.java", "license": "apache-2.0", "size": 7759 }
[ "com.mongodb.gridfs.GridFSInputFile", "java.io.File", "java.io.FileInputStream" ]
import com.mongodb.gridfs.GridFSInputFile; import java.io.File; import java.io.FileInputStream;
import com.mongodb.gridfs.*; import java.io.*;
[ "com.mongodb.gridfs", "java.io" ]
com.mongodb.gridfs; java.io;
2,757,574