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 static float textBoxToFloat(final String textBoxString, final float defaultValue) { float val = defaultValue; if (!StringUtils.isEmpty(textBoxString)) { try { val = Float.parseFloat(textBoxString); } catch (NumberFormatException e) { LOGGER.warn("Cannot parse float from '" + textBoxString + "'"); } } return val; }
static float function(final String textBoxString, final float defaultValue) { float val = defaultValue; if (!StringUtils.isEmpty(textBoxString)) { try { val = Float.parseFloat(textBoxString); } catch (NumberFormatException e) { LOGGER.warn(STR + textBoxString + "'"); } } return val; }
/** * Extract float value from given text box string. If a number * cannot be extracted, return default value. This method * traps number format exceptions. * @param textBoxString String from numeric text box * @param defaultValue Default value to return if a valid float * cannot be parsed * @return Float equivalent */
Extract float value from given text box string. If a number cannot be extracted, return default value. This method traps number format exceptions
textBoxToFloat
{ "repo_name": "NCIP/webgenome", "path": "tags/WEBGENOME_R3.2_6MAR2009_BUILD1/java/webui/src/org/rti/webgenome/webui/util/FormUtils.java", "license": "bsd-3-clause", "size": 2593 }
[ "org.rti.webgenome.util.StringUtils" ]
import org.rti.webgenome.util.StringUtils;
import org.rti.webgenome.util.*;
[ "org.rti.webgenome" ]
org.rti.webgenome;
1,687,976
private void createRestoreHandlerRun(List<LabelNode> restores) { if (restores.isEmpty()) { logger.debug(" No restore handler needed for run"); return; } logger.debug(" Creating restore handler for run"); InsnList instructions = new InsnList(); // thread = this.$$thread$$; instructions.add(threadCode.getRunThread(clazz.name, localThread)); // frame = this.$$frame$$; instructions.add(threadCode.getRunFrame(clazz.name, localFrame)); // SerialThreadManager.setThread(thread); instructions.add(threadCode.setThread(localThread)); // Store current frame, so next method can fetch is as previous frame. // thread.frame = frame; instructions.add(threadCode.setFrame(localThread, localFrame)); // No previous frame needed in run, because there may not be a previous frame. // Add label for first call of run() at index -1, see "startIndex" below. // Empty frames are expected to have method == -1. LabelNode startRun = new LabelNode(); restores.add(0, startRun); instructions.add(restoreCodeDispatcher(localFrame, restores, -1)); // Dummy startup code to avoid check of thread.serializing. instructions.add(startRun); // Reset method to 0 for the case that there is just one normal restore code (except startRun), // because if there is just one normal restore code, the method index will not be captured. // So we set the correct one (0) for this case. if (restores.size() == 2) { instructions.add(threadCode.setMethod(localFrame, 0)); } // Continue with normal code. method.instructions.insertBefore(method.instructions.getFirst(), instructions); }
void function(List<LabelNode> restores) { if (restores.isEmpty()) { logger.debug(STR); return; } logger.debug(STR); InsnList instructions = new InsnList(); instructions.add(threadCode.getRunThread(clazz.name, localThread)); instructions.add(threadCode.getRunFrame(clazz.name, localFrame)); instructions.add(threadCode.setThread(localThread)); instructions.add(threadCode.setFrame(localThread, localFrame)); LabelNode startRun = new LabelNode(); restores.add(0, startRun); instructions.add(restoreCodeDispatcher(localFrame, restores, -1)); instructions.add(startRun); if (restores.size() == 2) { instructions.add(threadCode.setMethod(localFrame, 0)); } method.instructions.insertBefore(method.instructions.getFirst(), instructions); }
/** * Insert frame restoring code at the begin of the run() method. * * @param restores Labels pointing to the generated restore codes for method calls. */
Insert frame restoring code at the begin of the run() method
createRestoreHandlerRun
{ "repo_name": "markusheiden/serialthreads", "path": "src/main/java/org/serialthreads/transformer/strategies/frequent/RunMethodTransformer.java", "license": "gpl-3.0", "size": 3149 }
[ "java.util.List", "org.objectweb.asm.tree.InsnList", "org.objectweb.asm.tree.LabelNode" ]
import java.util.List; import org.objectweb.asm.tree.InsnList; import org.objectweb.asm.tree.LabelNode;
import java.util.*; import org.objectweb.asm.tree.*;
[ "java.util", "org.objectweb.asm" ]
java.util; org.objectweb.asm;
1,566,984
@RequiresPermissions("applications") @RequestMapping(value = "/vulnerabilitySummary/{id}", method = RequestMethod.GET) public String vulnerabiltySummary(Map<String, Object> map, @PathVariable("id") int id) { map.put("vulnerabilityInfo", vulnerabilityService.getVulnerabilitySummary(id)); return "vulnerabilitySummary"; }
@RequiresPermissions(STR) @RequestMapping(value = STR, method = RequestMethod.GET) String function(Map<String, Object> map, @PathVariable("id") int id) { map.put(STR, vulnerabilityService.getVulnerabilitySummary(id)); return STR; }
/** * Lists vulnerability summary information for the specified application. * * @param map A map of parameters * @param id The ID of the Application to retrieve vulnerability info for * @return a String */
Lists vulnerability summary information for the specified application
vulnerabiltySummary
{ "repo_name": "janaroj/dependency-track", "path": "src/main/java/org/owasp/dependencytrack/controller/ApplicationController.java", "license": "gpl-3.0", "size": 18365 }
[ "java.util.Map", "org.apache.shiro.authz.annotation.RequiresPermissions", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod" ]
import java.util.Map; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import java.util.*; import org.apache.shiro.authz.annotation.*; import org.springframework.web.bind.annotation.*;
[ "java.util", "org.apache.shiro", "org.springframework.web" ]
java.util; org.apache.shiro; org.springframework.web;
549,417
@SuppressWarnings("unchecked") public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException { return (Constructor) getConstructorOrMethod("<init>", false, true, parameterTypes); }
@SuppressWarnings(STR) Constructor<T> function(Class<?>... parameterTypes) throws NoSuchMethodException { return (Constructor) getConstructorOrMethod(STR, false, true, parameterTypes); }
/** * Returns a {@code Constructor} object which represents the public * constructor matching the given parameter types. * {@code (Class[]) null} is equivalent to the empty array. * * <p>See {@link #getMethod} for details of the search order. * Use {@link #getDeclaredConstructor} if you don't want to search superclasses. * * @throws NoSuchMethodException * if the constructor can not be found. */
Returns a Constructor object which represents the public constructor matching the given parameter types. (Class[]) null is equivalent to the empty array. See <code>#getMethod</code> for details of the search order. Use <code>#getDeclaredConstructor</code> if you don't want to search superclasses
getConstructor
{ "repo_name": "JSDemos/android-sdk-20", "path": "src/java/lang/Class.java", "license": "apache-2.0", "size": 51633 }
[ "java.lang.reflect.Constructor" ]
import java.lang.reflect.Constructor;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,725,821
protected String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response) { String serviceUrl = CommonUtils.constructServiceUrl(request, response, null, serverName, serviceParameterName, artifactParameterName, true); if ("embed".equalsIgnoreCase(entityIdLocation)) { serviceUrl += (new EntityIdParameterBuilder().getParameterString(request, false)); } return serviceUrl; }
String function(final HttpServletRequest request, final HttpServletResponse response) { String serviceUrl = CommonUtils.constructServiceUrl(request, response, null, serverName, serviceParameterName, artifactParameterName, true); if ("embed".equalsIgnoreCase(entityIdLocation)) { serviceUrl += (new EntityIdParameterBuilder().getParameterString(request, false)); } return serviceUrl; }
/** * Use the CAS CommonUtils to build the CAS Service URL. */
Use the CAS CommonUtils to build the CAS Service URL
constructServiceUrl
{ "repo_name": "Unicon/shib-cas-authn3", "path": "src/main/java/net/unicon/idp/externalauth/ShibcasAuthServlet.java", "license": "apache-2.0", "size": 14561 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "net.unicon.idp.authn.provider.extra.EntityIdParameterBuilder", "org.jasig.cas.client.util.CommonUtils" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import net.unicon.idp.authn.provider.extra.EntityIdParameterBuilder; import org.jasig.cas.client.util.CommonUtils;
import javax.servlet.http.*; import net.unicon.idp.authn.provider.extra.*; import org.jasig.cas.client.util.*;
[ "javax.servlet", "net.unicon.idp", "org.jasig.cas" ]
javax.servlet; net.unicon.idp; org.jasig.cas;
223,916
public void setBackgroundPaint(Paint paint) { this.backgroundPaint = paint; notifyListeners(new TitleChangeEvent(this)); }
void function(Paint paint) { this.backgroundPaint = paint; notifyListeners(new TitleChangeEvent(this)); }
/** * Sets the background paint and sends a {@link TitleChangeEvent} to all * registered listeners. If you set this attribute to <code>null</code>, * no background is painted (which makes the title background transparent). * * @param paint the background paint (<code>null</code> permitted). * * @since 1.0.11 */
Sets the background paint and sends a <code>TitleChangeEvent</code> to all registered listeners. If you set this attribute to <code>null</code>, no background is painted (which makes the title background transparent)
setBackgroundPaint
{ "repo_name": "greearb/jfreechart-fse-ct", "path": "src/main/java/org/jfree/chart/title/CompositeTitle.java", "license": "lgpl-2.1", "size": 8368 }
[ "java.awt.Paint", "org.jfree.chart.event.TitleChangeEvent" ]
import java.awt.Paint; import org.jfree.chart.event.TitleChangeEvent;
import java.awt.*; import org.jfree.chart.event.*;
[ "java.awt", "org.jfree.chart" ]
java.awt; org.jfree.chart;
2,511,099
protected static String parseParams(Map<String,String> params) throws Exception { LOG.entering(name, "parseParams"); if (table == null) throw new Exception("Table not Initialized"); String ret = ""; //read mode parameter WebserviceCommand wsCmd = loadCmd(params); if (wsCmd != null) { ret = processCmd(wsCmd, params); } LOG.exiting(name, "parseParams", "ret: " + ret); return ret; }
static String function(Map<String,String> params) throws Exception { LOG.entering(name, STR); if (table == null) throw new Exception(STR); String ret = ""; WebserviceCommand wsCmd = loadCmd(params); if (wsCmd != null) { ret = processCmd(wsCmd, params); } LOG.exiting(name, STR, "ret: " + ret); return ret; }
/** * Before calling this function, the LedTable must be set using the * setLedTable method * * @param params * @return * @throws Exception */
Before calling this function, the LedTable must be set using the setLedTable method
parseParams
{ "repo_name": "mikelduke/LedTable", "path": "RPi-Java-LedTable/src/net/mdp3/java/rpi/ledtable/webservice/WebserviceFunctions.java", "license": "gpl-2.0", "size": 7616 }
[ "java.util.Map", "net.mdp3.java.rpi.ledtable.webservice.WebserviceCommands" ]
import java.util.Map; import net.mdp3.java.rpi.ledtable.webservice.WebserviceCommands;
import java.util.*; import net.mdp3.java.rpi.ledtable.webservice.*;
[ "java.util", "net.mdp3.java" ]
java.util; net.mdp3.java;
135,478
private List<DeferredQueueRecordType> queryDeferredQueue(QueryDeferredQueueRequestType queryDeferredQueueRequest) throws DeferredQueueException { LOG.debug("Start: DeferredQueueManagerHelper.queryDeferredQueue method - query deferred messages."); List<DeferredQueueRecordType> response = new ArrayList<DeferredQueueRecordType>(); try { AsyncMsgRecordDao queueDao = new AsyncMsgRecordDao(); List<AsyncMsgRecord> asyncResponse = queueDao.queryByCriteria(queryDeferredQueueRequest); if (asyncResponse != null && asyncResponse.size() > 0) { for (AsyncMsgRecord asyncRecord : asyncResponse) { DeferredQueueRecordType queueRecord = new DeferredQueueRecordType(); queueRecord.setMessageId(asyncRecord.getMessageId()); queueRecord.setCreationTime(XMLDateUtil.date2Gregorian(asyncRecord.getCreationTime())); queueRecord.setResponseTime(XMLDateUtil.date2Gregorian(asyncRecord.getResponseTime())); queueRecord.setDuration(asyncRecord.getDuration()); queueRecord.setServiceName(asyncRecord.getServiceName()); queueRecord.setDirection(asyncRecord.getDirection()); queueRecord.setCommunityId(asyncRecord.getCommunityId()); queueRecord.setStatus(asyncRecord.getStatus()); queueRecord.setResponseType(asyncRecord.getResponseType()); response.add(queueRecord); } } } catch (Exception e) { LOG.error("Exception occurred while querying deferred queue: ", e); throw new DeferredQueueException(e); } LOG.debug("End: DeferredQueueManagerHelper.queryDeferredQueue method - query deferred messages."); return response; }
List<DeferredQueueRecordType> function(QueryDeferredQueueRequestType queryDeferredQueueRequest) throws DeferredQueueException { LOG.debug(STR); List<DeferredQueueRecordType> response = new ArrayList<DeferredQueueRecordType>(); try { AsyncMsgRecordDao queueDao = new AsyncMsgRecordDao(); List<AsyncMsgRecord> asyncResponse = queueDao.queryByCriteria(queryDeferredQueueRequest); if (asyncResponse != null && asyncResponse.size() > 0) { for (AsyncMsgRecord asyncRecord : asyncResponse) { DeferredQueueRecordType queueRecord = new DeferredQueueRecordType(); queueRecord.setMessageId(asyncRecord.getMessageId()); queueRecord.setCreationTime(XMLDateUtil.date2Gregorian(asyncRecord.getCreationTime())); queueRecord.setResponseTime(XMLDateUtil.date2Gregorian(asyncRecord.getResponseTime())); queueRecord.setDuration(asyncRecord.getDuration()); queueRecord.setServiceName(asyncRecord.getServiceName()); queueRecord.setDirection(asyncRecord.getDirection()); queueRecord.setCommunityId(asyncRecord.getCommunityId()); queueRecord.setStatus(asyncRecord.getStatus()); queueRecord.setResponseType(asyncRecord.getResponseType()); response.add(queueRecord); } } } catch (Exception e) { LOG.error(STR, e); throw new DeferredQueueException(e); } LOG.debug(STR); return response; }
/** * Call deferred queue dao to query for matching records * * @param queryDeferredQueueRequest * @return found list of queue records * @throws DeferredQueueException */
Call deferred queue dao to query for matching records
queryDeferredQueue
{ "repo_name": "beiyuxinke/CONNECT", "path": "Product/Production/Adapters/General/CONNECTAdapterWeb/src/main/java/gov/hhs/fha/nhinc/adapter/deferred/queue/DeferredQueueManagerHelper.java", "license": "bsd-3-clause", "size": 21694 }
[ "gov.hhs.fha.nhinc.asyncmsgs.dao.AsyncMsgRecordDao", "gov.hhs.fha.nhinc.asyncmsgs.model.AsyncMsgRecord", "gov.hhs.fha.nhinc.common.deferredqueuemanager.DeferredQueueRecordType", "gov.hhs.fha.nhinc.common.deferredqueuemanager.QueryDeferredQueueRequestType", "gov.hhs.fha.nhinc.util.format.XMLDateUtil", "java.util.ArrayList", "java.util.List" ]
import gov.hhs.fha.nhinc.asyncmsgs.dao.AsyncMsgRecordDao; import gov.hhs.fha.nhinc.asyncmsgs.model.AsyncMsgRecord; import gov.hhs.fha.nhinc.common.deferredqueuemanager.DeferredQueueRecordType; import gov.hhs.fha.nhinc.common.deferredqueuemanager.QueryDeferredQueueRequestType; import gov.hhs.fha.nhinc.util.format.XMLDateUtil; import java.util.ArrayList; import java.util.List;
import gov.hhs.fha.nhinc.asyncmsgs.dao.*; import gov.hhs.fha.nhinc.asyncmsgs.model.*; import gov.hhs.fha.nhinc.common.deferredqueuemanager.*; import gov.hhs.fha.nhinc.util.format.*; import java.util.*;
[ "gov.hhs.fha", "java.util" ]
gov.hhs.fha; java.util;
568,140
public ProcessorBuilder processor(StreamApplication processor) { Assert.notNull(processor, "Processor application can't be null"); return new ProcessorBuilder( processor.type(StreamApplication.ApplicationType.PROCESSOR), this.parent); }
ProcessorBuilder function(StreamApplication processor) { Assert.notNull(processor, STR); return new ProcessorBuilder( processor.type(StreamApplication.ApplicationType.PROCESSOR), this.parent); }
/** * Appends a {@link StreamApplication} as a processor for this stream * @param processor - The {@link StreamApplication} being added * @return a {@link ProcessorBuilder} to continue the building of the Stream */
Appends a <code>StreamApplication</code> as a processor for this stream
processor
{ "repo_name": "jvalkeal/spring-cloud-data", "path": "spring-cloud-dataflow-rest-client/src/main/java/org/springframework/cloud/dataflow/rest/client/dsl/Stream.java", "license": "apache-2.0", "size": 8596 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
2,108,607
Writer openWriter() throws IOException;
Writer openWriter() throws IOException;
/** * Gets a Writer for this file object. * * @return a Writer * @throws IllegalStateException if this file object was * opened for reading and does not support writing * @throws UnsupportedOperationException if this kind of * file object does not support character access * @throws IOException if an I/O error occurred */
Gets a Writer for this file object
openWriter
{ "repo_name": "mashuai/Open-Source-Research", "path": "Javac2007/src/javax/tools/FileObject.java", "license": "apache-2.0", "size": 6190 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,340,725
private JobDetailFactoryBean createJobDetailBean(JobSchedulerConfiguration jobSchedulerConfiguration) { final JobDetailFactoryBean jobDetailBean = new JobDetailFactoryBean(); Class<?> jobClass = getJobClass(jobSchedulerConfiguration.getJobClassName()); if ( jobClass == null ) { return null; } jobDetailBean.setName(jobSchedulerConfiguration.getJobName()); jobDetailBean.setGroup(jobSchedulerConfiguration.getJobGroup()); jobDetailBean.setJobClass(jobClass); Map<String, Object> jobDataAsMap = new HashMap<>(); jobDataAsMap.put("applicationContext", applicationContext); jobDetailBean.setJobDataAsMap(jobDataAsMap); jobDetailBean.afterPropertiesSet(); return jobDetailBean; }
JobDetailFactoryBean function(JobSchedulerConfiguration jobSchedulerConfiguration) { final JobDetailFactoryBean jobDetailBean = new JobDetailFactoryBean(); Class<?> jobClass = getJobClass(jobSchedulerConfiguration.getJobClassName()); if ( jobClass == null ) { return null; } jobDetailBean.setName(jobSchedulerConfiguration.getJobName()); jobDetailBean.setGroup(jobSchedulerConfiguration.getJobGroup()); jobDetailBean.setJobClass(jobClass); Map<String, Object> jobDataAsMap = new HashMap<>(); jobDataAsMap.put(STR, applicationContext); jobDetailBean.setJobDataAsMap(jobDataAsMap); jobDetailBean.afterPropertiesSet(); return jobDetailBean; }
/** * Creates {@link JobDetailFactoryBean} from the specified * <code>{@link JobSchedulerConfiguration}</code> * * @param jobSchedulerConfiguration * configuration to create <code>JobDetailFactoryBean</> * @return the created <code>JobDetailFactoryBean</code> or null if unable to it */
Creates <code>JobDetailFactoryBean</code> from the specified <code><code>JobSchedulerConfiguration</code></code>
createJobDetailBean
{ "repo_name": "LibrePlan/libreplan", "path": "libreplan-webapp/src/main/java/org/libreplan/importers/SchedulerManager.java", "license": "agpl-3.0", "size": 11859 }
[ "java.util.HashMap", "java.util.Map", "org.libreplan.business.common.entities.JobSchedulerConfiguration", "org.springframework.scheduling.quartz.JobDetailFactoryBean" ]
import java.util.HashMap; import java.util.Map; import org.libreplan.business.common.entities.JobSchedulerConfiguration; import org.springframework.scheduling.quartz.JobDetailFactoryBean;
import java.util.*; import org.libreplan.business.common.entities.*; import org.springframework.scheduling.quartz.*;
[ "java.util", "org.libreplan.business", "org.springframework.scheduling" ]
java.util; org.libreplan.business; org.springframework.scheduling;
1,363,112
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_FLOAT, defaultValue = DEFAULT_LINE_WIDTH + "") @SimpleProperty public void LineWidth(float width) { paint.setStrokeWidth(width); } /** * Returns the alignment of the canvas's text: center, normal * (starting at the specified point in drawText()), or opposite * (ending at the specified point in drawText()). * * @return one of {@link Component#ALIGNMENT_NORMAL}, * {@link Component#ALIGNMENT_CENTER} or * {@link Component#ALIGNMENT_OPPOSITE}
@DesignerProperty(editorType = PropertyTypeConstants.PROPERTY_TYPE_NON_NEGATIVE_FLOAT, defaultValue = DEFAULT_LINE_WIDTH + "") void function(float width) { paint.setStrokeWidth(width); } /** * Returns the alignment of the canvas's text: center, normal * (starting at the specified point in drawText()), or opposite * (ending at the specified point in drawText()). * * @return one of {@link Component#ALIGNMENT_NORMAL}, * {@link Component#ALIGNMENT_CENTER} or * {@link Component#ALIGNMENT_OPPOSITE}
/** * Specifies the stroke width * * @param width */
Specifies the stroke width
LineWidth
{ "repo_name": "cjessica/aifoo", "path": "appinventor/components/src/com/google/appinventor/components/runtime/Canvas.java", "license": "mit", "size": 49834 }
[ "com.google.appinventor.components.annotations.DesignerProperty", "com.google.appinventor.components.common.PropertyTypeConstants" ]
import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.common.*;
[ "com.google.appinventor" ]
com.google.appinventor;
1,437,990
@Override public AbstractFunction findFunction(String name) { return _program.findFunction(name); }
AbstractFunction function(String name) { return _program.findFunction(name); }
/** * Finds the function */
Finds the function
findFunction
{ "repo_name": "CleverCloud/Quercus", "path": "quercus/src/main/java/com/caucho/quercus/page/InterpretedPage.java", "license": "gpl-2.0", "size": 4132 }
[ "com.caucho.quercus.function.AbstractFunction" ]
import com.caucho.quercus.function.AbstractFunction;
import com.caucho.quercus.function.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
2,635,541
public T caseFolder(IFolder object) { return null; }
T function(IFolder object) { return null; }
/** * Returns the result of interpreting the object as an instance of '<em>Folder</em>'. * <!-- begin-user-doc --> * This implementation returns null; * returning a non-null result will terminate the switch. * <!-- end-user-doc --> * @param object the target of the switch. * @return the result of interpreting the object as an instance of '<em>Folder</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */
Returns the result of interpreting the object as an instance of 'Folder'. This implementation returns null; returning a non-null result will terminate the switch.
caseFolder
{ "repo_name": "archimatetool/archi", "path": "com.archimatetool.model/src/com/archimatetool/model/util/ArchimateSwitch.java", "license": "mit", "size": 256079 }
[ "com.archimatetool.model.IFolder" ]
import com.archimatetool.model.IFolder;
import com.archimatetool.model.*;
[ "com.archimatetool.model" ]
com.archimatetool.model;
2,036,818
public Object instantiate(EntityMode entityMode) throws HibernateException { return componentTuplizer.instantiate(); }
Object function(EntityMode entityMode) throws HibernateException { return componentTuplizer.instantiate(); }
/** * This method does not populate the component parent */
This method does not populate the component parent
instantiate
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/hibernate-core/org/hibernate/type/ComponentType.java", "license": "gpl-2.0", "size": 23842 }
[ "org.hibernate.EntityMode", "org.hibernate.HibernateException" ]
import org.hibernate.EntityMode; import org.hibernate.HibernateException;
import org.hibernate.*;
[ "org.hibernate" ]
org.hibernate;
2,742,942
public static void main(String args[]) { if (args.length == 0) { printHelp(); } else { if (args[0].equals("--help")) { printHelp(); return; } else if (args[0].equals("local")) { runLocalTests(); } else if (args[0].equals("remote")) { runRemoteTests(); } else if (args[0].equals("http")) { runRemoteHttpTests(); } else if (args[0].equals("tomcat")) { runTomcatRemoteHttpTests(); } else { printHelp(); return; } try { TestRunner aTestRunner = new TestRunner(); TestResult r = aTestRunner.start(new String[]{"org.apache.openejb.test.ClientTestSuite"}); System.out.println(""); System.out.println("_________________________________________________"); System.out.println("CLIENT JNDI PROPERTIES"); Properties env = TestManager.getServer().getContextEnvironment(); for (Iterator iterator = env.entrySet().iterator(); iterator.hasNext();) { Map.Entry entry = (Map.Entry) iterator.next(); String key = (String) entry.getKey(); Object value = entry.getValue(); System.out.println(key+" = "+value); } System.out.println("_________________________________________________"); if (!r.wasSuccessful()) System.exit(FAILURE_EXIT); System.exit(SUCCESS_EXIT); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(EXCEPTION_EXIT); } } }
static void function(String args[]) { if (args.length == 0) { printHelp(); } else { if (args[0].equals(STR)) { printHelp(); return; } else if (args[0].equals("local")) { runLocalTests(); } else if (args[0].equals(STR)) { runRemoteTests(); } else if (args[0].equals("http")) { runRemoteHttpTests(); } else if (args[0].equals(STR)) { runTomcatRemoteHttpTests(); } else { printHelp(); return; } try { TestRunner aTestRunner = new TestRunner(); TestResult r = aTestRunner.start(new String[]{STR}); System.out.println(STR_________________________________________________STRCLIENT JNDI PROPERTIESSTR = STR_________________________________________________"); if (!r.wasSuccessful()) System.exit(FAILURE_EXIT); System.exit(SUCCESS_EXIT); } catch (Exception e) { System.err.println(e.getMessage()); System.exit(EXCEPTION_EXIT); } } }
/** * main entry point. */
main entry point
main
{ "repo_name": "apache/openejb", "path": "itests/openejb-itests-client/src/main/java/org/apache/openejb/test/TestRunner.java", "license": "apache-2.0", "size": 8354 }
[ "junit.framework.TestResult" ]
import junit.framework.TestResult;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
372,724
void connectAndSetOwner(HQ_OkHttpClient client, Object owner, HQ_Request request) throws HQ_RouteException { setOwner(owner); if (!isConnected()) { List<HQ_ConnectionSpec> connectionSpecs = route.address.getConnectionSpecs(); connect(client.getConnectTimeout(), client.getReadTimeout(), client.getWriteTimeout(), request, connectionSpecs, client.getRetryOnConnectionFailure()); if (isFramed()) { client.getConnectionPool().share(this); } client.routeDatabase().connected(getRoute()); } setTimeouts(client.getReadTimeout(), client.getWriteTimeout()); }
void connectAndSetOwner(HQ_OkHttpClient client, Object owner, HQ_Request request) throws HQ_RouteException { setOwner(owner); if (!isConnected()) { List<HQ_ConnectionSpec> connectionSpecs = route.address.getConnectionSpecs(); connect(client.getConnectTimeout(), client.getReadTimeout(), client.getWriteTimeout(), request, connectionSpecs, client.getRetryOnConnectionFailure()); if (isFramed()) { client.getConnectionPool().share(this); } client.routeDatabase().connected(getRoute()); } setTimeouts(client.getReadTimeout(), client.getWriteTimeout()); }
/** * Connects this connection if it isn't already. This creates tunnels, shares * the connection with the connection pool, and configures timeouts. */
Connects this connection if it isn't already. This creates tunnels, shares the connection with the connection pool, and configures timeouts
connectAndSetOwner
{ "repo_name": "honeyqa/honeyqa-android", "path": "honeyqa/client/src/main/java/io/honeyqa/client/network/okhttp/HQ_Connection.java", "license": "mit", "size": 19713 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,573,480
protected String buildClassPath(List<File> files) { StringBuilder sb = new StringBuilder(); for (File file : files) { sb.append(file.getPath() + File.pathSeparatorChar); } return sb.toString(); }
String function(List<File> files) { StringBuilder sb = new StringBuilder(); for (File file : files) { sb.append(file.getPath() + File.pathSeparatorChar); } return sb.toString(); }
/** * Returns the class path argument for Soot * * @param files * Files in the class path * @return Class path argument for Soot */
Returns the class path argument for Soot
buildClassPath
{ "repo_name": "spencerwuwu/java-statement-resolver", "path": "src/statementResolver/soot/SootRunner.java", "license": "mit", "size": 13871 }
[ "java.io.File", "java.util.List" ]
import java.io.File; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,021,416
jdo.setName(dto.getName()); if(dto.getId() != null){ jdo.setId(KeyFactory.stringToKey(dto.getId())); } if(dto.getCreatedOn() != null){ jdo.setCreatedOn(dto.getCreatedOn().getTime()); } if (dto.getCreatedByPrincipalId() != null){ jdo.setCreatedBy(dto.getCreatedByPrincipalId()); } if(dto.getParentId() != null){ jdo.setParentId(KeyFactory.stringToKey(dto.getParentId())); } jdo.setAlias(StringUtils.isEmpty(dto.getAlias()) ? null : dto.getAlias()); if (dto.getModifiedByPrincipalId()==null) throw new InvalidModelException("modifiedByPrincipalId may not be null"); rev.setModifiedBy(dto.getModifiedByPrincipalId()); if (dto.getModifiedOn()==null) throw new InvalidModelException("modifiedOn may not be null"); rev.setModifiedOn(dto.getModifiedOn().getTime()); if (dto.getVersionComment()!=null && dto.getVersionComment().length()>DBORevision.MAX_COMMENT_LENGTH) throw new IllegalArgumentException("Version comment length exceeds "+DBORevision.MAX_COMMENT_LENGTH+"."); rev.setComment(dto.getVersionComment()); if(dto.getVersionLabel() != null){ rev.setLabel(dto.getVersionLabel()); } if(dto.getFileHandleId() != null){ rev.setFileHandleId(KeyFactory.stringToKey(dto.getFileHandleId())); }else{ rev.setFileHandleId(null); } // bring in activity id, if set if(deleteActivityId) { rev.setActivityId(null); } else if(dto.getActivityId() != null) { rev.setActivityId(Long.parseLong(dto.getActivityId())); } if(dto.getColumnModelIds() != null){ rev.setColumnModelIds(createByteForIdList(dto.getColumnModelIds())); } if(dto.getScopeIds() != null){ rev.setScopeIds(createByteForIdList(dto.getScopeIds())); } rev.setItems(writeItemsToJson(dto.getItems())); rev.setReference(compressReference(dto.getReference())); rev.setIsSearchEnabled(dto.getIsSearchEnabled()); rev.setDefiningSQL(dto.getDefiningSQL()); }
jdo.setName(dto.getName()); if(dto.getId() != null){ jdo.setId(KeyFactory.stringToKey(dto.getId())); } if(dto.getCreatedOn() != null){ jdo.setCreatedOn(dto.getCreatedOn().getTime()); } if (dto.getCreatedByPrincipalId() != null){ jdo.setCreatedBy(dto.getCreatedByPrincipalId()); } if(dto.getParentId() != null){ jdo.setParentId(KeyFactory.stringToKey(dto.getParentId())); } jdo.setAlias(StringUtils.isEmpty(dto.getAlias()) ? null : dto.getAlias()); if (dto.getModifiedByPrincipalId()==null) throw new InvalidModelException(STR); rev.setModifiedBy(dto.getModifiedByPrincipalId()); if (dto.getModifiedOn()==null) throw new InvalidModelException(STR); rev.setModifiedOn(dto.getModifiedOn().getTime()); if (dto.getVersionComment()!=null && dto.getVersionComment().length()>DBORevision.MAX_COMMENT_LENGTH) throw new IllegalArgumentException(STR+DBORevision.MAX_COMMENT_LENGTH+"."); rev.setComment(dto.getVersionComment()); if(dto.getVersionLabel() != null){ rev.setLabel(dto.getVersionLabel()); } if(dto.getFileHandleId() != null){ rev.setFileHandleId(KeyFactory.stringToKey(dto.getFileHandleId())); }else{ rev.setFileHandleId(null); } if(deleteActivityId) { rev.setActivityId(null); } else if(dto.getActivityId() != null) { rev.setActivityId(Long.parseLong(dto.getActivityId())); } if(dto.getColumnModelIds() != null){ rev.setColumnModelIds(createByteForIdList(dto.getColumnModelIds())); } if(dto.getScopeIds() != null){ rev.setScopeIds(createByteForIdList(dto.getScopeIds())); } rev.setItems(writeItemsToJson(dto.getItems())); rev.setReference(compressReference(dto.getReference())); rev.setIsSearchEnabled(dto.getIsSearchEnabled()); rev.setDefiningSQL(dto.getDefiningSQL()); }
/** * Used to update an existing object * @param dto * @param jdo * @param rev * @return * @throws DatastoreException */
Used to update an existing object
updateFromDto
{ "repo_name": "Sage-Bionetworks/Synapse-Repository-Services", "path": "lib/jdomodels/src/main/java/org/sagebionetworks/repo/model/dbo/dao/NodeUtils.java", "license": "apache-2.0", "size": 13676 }
[ "org.apache.commons.lang3.StringUtils", "org.sagebionetworks.repo.model.InvalidModelException", "org.sagebionetworks.repo.model.dbo.persistence.DBORevision", "org.sagebionetworks.repo.model.jdo.KeyFactory" ]
import org.apache.commons.lang3.StringUtils; import org.sagebionetworks.repo.model.InvalidModelException; import org.sagebionetworks.repo.model.dbo.persistence.DBORevision; import org.sagebionetworks.repo.model.jdo.KeyFactory;
import org.apache.commons.lang3.*; import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.dbo.persistence.*; import org.sagebionetworks.repo.model.jdo.*;
[ "org.apache.commons", "org.sagebionetworks.repo" ]
org.apache.commons; org.sagebionetworks.repo;
2,462,354
public void afterTestClass(TestContext testContext) throws Exception { }
void function(TestContext testContext) throws Exception { }
/** * The default implementation is <em>empty</em>. Can be overridden by * subclasses as necessary. */
The default implementation is empty. Can be overridden by subclasses as necessary
afterTestClass
{ "repo_name": "kingtang/spring-learn", "path": "spring-test/src/main/java/org/springframework/test/context/support/AbstractTestExecutionListener.java", "license": "gpl-3.0", "size": 2175 }
[ "org.springframework.test.context.TestContext" ]
import org.springframework.test.context.TestContext;
import org.springframework.test.context.*;
[ "org.springframework.test" ]
org.springframework.test;
503,544
static EntityKey deserialize( ObjectInputStream ois, SessionImplementor session) throws IOException, ClassNotFoundException { return new EntityKey( ( Serializable ) ois.readObject(), ( String ) ois.readObject(), ( String ) ois.readObject(), ( Type ) ois.readObject(), ois.readBoolean(), ( session == null ? null : session.getFactory() ), EntityMode.parse( ( String ) ois.readObject() ) ); }
static EntityKey deserialize( ObjectInputStream ois, SessionImplementor session) throws IOException, ClassNotFoundException { return new EntityKey( ( Serializable ) ois.readObject(), ( String ) ois.readObject(), ( String ) ois.readObject(), ( Type ) ois.readObject(), ois.readBoolean(), ( session == null ? null : session.getFactory() ), EntityMode.parse( ( String ) ois.readObject() ) ); }
/** * Custom deserialization routine used during deserialization of a * Session/PersistenceContext for increased performance. * * @param ois The stream from which to read the entry. * @param session The session being deserialized. * @return The deserialized EntityEntry * @throws IOException * @throws ClassNotFoundException */
Custom deserialization routine used during deserialization of a Session/PersistenceContext for increased performance
deserialize
{ "repo_name": "ControlSystemStudio/cs-studio", "path": "thirdparty/plugins/org.csstudio.platform.libs.hibernate/project/core/src/main/java/org/hibernate/engine/EntityKey.java", "license": "epl-1.0", "size": 5813 }
[ "java.io.IOException", "java.io.ObjectInputStream", "java.io.Serializable", "org.hibernate.EntityMode", "org.hibernate.type.Type" ]
import java.io.IOException; import java.io.ObjectInputStream; import java.io.Serializable; import org.hibernate.EntityMode; import org.hibernate.type.Type;
import java.io.*; import org.hibernate.*; import org.hibernate.type.*;
[ "java.io", "org.hibernate", "org.hibernate.type" ]
java.io; org.hibernate; org.hibernate.type;
877,675
IStructuredDocument createStructuredDocumentFor(IPath location, IProgressMonitor progressMonitor) throws IOException, CoreException;
IStructuredDocument createStructuredDocumentFor(IPath location, IProgressMonitor progressMonitor) throws IOException, CoreException;
/** * Factory method, since a proper IStructuredDocument must have a proper * parser assigned. Note: clients should verify that the resource * identified by the IPath exists before using this method. If this IFile * does not exist, then createNewStructuredDocument is the correct API to * use. * * ISSUE: do we want to support this via model manager, or else where? * ISSUE: do we need two of these? What's legacy use case? * * @param location * @param progressMonitor * @return * @throws IOException * @throws CoreException */
Factory method, since a proper IStructuredDocument must have a proper parser assigned. Note: clients should verify that the resource identified by the IPath exists before using this method. If this IFile does not exist, then createNewStructuredDocument is the correct API to use
createStructuredDocumentFor
{ "repo_name": "ttimbul/eclipse.wst", "path": "bundles/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/provisional/model/IModelManagerProposed.java", "license": "epl-1.0", "size": 12075 }
[ "java.io.IOException", "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.IPath", "org.eclipse.core.runtime.IProgressMonitor", "org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument" ]
import java.io.IOException; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import java.io.*; import org.eclipse.core.runtime.*; import org.eclipse.wst.sse.core.internal.provisional.text.*;
[ "java.io", "org.eclipse.core", "org.eclipse.wst" ]
java.io; org.eclipse.core; org.eclipse.wst;
1,114,995
protected AntiSamy getAntiSamyInstance() { return new AntiSamy(); }
AntiSamy function() { return new AntiSamy(); }
/** * Just returns a new AntiSamy instance. This method is mostly to help * enable unit tests. * * @return new AntiSamy instance */
Just returns a new AntiSamy instance. This method is mostly to help enable unit tests
getAntiSamyInstance
{ "repo_name": "Jasig/SimpleContentPortlet", "path": "src/main/java/org/jasig/portlet/cms/service/AntiSamyStringCleaningService.java", "license": "apache-2.0", "size": 4792 }
[ "org.owasp.validator.html.AntiSamy" ]
import org.owasp.validator.html.AntiSamy;
import org.owasp.validator.html.*;
[ "org.owasp.validator" ]
org.owasp.validator;
2,816,999
public Collection<IssueFilter> getIssueFilters() { final File cache = new File(root, "issue_filters.ser"); Collection<IssueFilter> cached = read(cache); if (cached != null) return cached; return Collections.emptyList(); }
Collection<IssueFilter> function() { final File cache = new File(root, STR); Collection<IssueFilter> cached = read(cache); if (cached != null) return cached; return Collections.emptyList(); }
/** * Get bookmarked issue filters * <p/> * This method may perform network I/O and should never be called on the * UI-thread * * @return non-null but possibly empty collection of issue filters */
Get bookmarked issue filters This method may perform network I/O and should never be called on the UI-thread
getIssueFilters
{ "repo_name": "hufsm/PocketHub", "path": "app/src/main/java/com/github/pockethub/persistence/AccountDataManager.java", "license": "apache-2.0", "size": 9095 }
[ "com.github.pockethub.core.issue.IssueFilter", "java.io.File", "java.util.Collection", "java.util.Collections" ]
import com.github.pockethub.core.issue.IssueFilter; import java.io.File; import java.util.Collection; import java.util.Collections;
import com.github.pockethub.core.issue.*; import java.io.*; import java.util.*;
[ "com.github.pockethub", "java.io", "java.util" ]
com.github.pockethub; java.io; java.util;
926,056
public static Location randomiseLocation(Location original, int radius) { int modX = RandomUtils.nextInt(radius); int modY = RandomUtils.nextInt(radius); int modZ = RandomUtils.nextInt(radius); if (RandomUtils.nextBoolean()) { modX = modX * -1; } // so that randomisation goes if (RandomUtils.nextBoolean()) { modY = modY * -1; } // in both directions!! if (RandomUtils.nextBoolean()) { modZ = modZ * -1; } // ^^^^^^^^^^^^^^^^ return new Location(original.getWorld(), original.getBlockX() + modX, // create new object so that original.getBlockY() + modY, // original can be reused original.getBlockZ() + modZ); }
static Location function(Location original, int radius) { int modX = RandomUtils.nextInt(radius); int modY = RandomUtils.nextInt(radius); int modZ = RandomUtils.nextInt(radius); if (RandomUtils.nextBoolean()) { modX = modX * -1; } if (RandomUtils.nextBoolean()) { modY = modY * -1; } if (RandomUtils.nextBoolean()) { modZ = modZ * -1; } return new Location(original.getWorld(), original.getBlockX() + modX, original.getBlockY() + modY, original.getBlockZ() + modZ); }
/** * Randomises x,y and z coordinates of a Location, in a (square!) radius. * * @param original Location to randomise * @param radius Maximum distance from the original location * @return a random location with at most radius distance from the original location */
Randomises x,y and z coordinates of a Location, in a (square!) radius
randomiseLocation
{ "repo_name": "xxyy/xyc", "path": "bukkit/src/main/java/li/l1t/common/util/LocationHelper.java", "license": "mit", "size": 9986 }
[ "org.apache.commons.lang.math.RandomUtils", "org.bukkit.Location" ]
import org.apache.commons.lang.math.RandomUtils; import org.bukkit.Location;
import org.apache.commons.lang.math.*; import org.bukkit.*;
[ "org.apache.commons", "org.bukkit" ]
org.apache.commons; org.bukkit;
1,522,498
private File reading(File f) { filterNonNull().read(f); return f; }
File function(File f) { filterNonNull().read(f); return f; }
/** * Pass through 'f' after ensuring that we can read that file. */
Pass through 'f' after ensuring that we can read that file
reading
{ "repo_name": "bkmeneguello/jenkins", "path": "core/src/main/java/hudson/FilePath.java", "license": "mit", "size": 133565 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
677,501
public List<T> getLocations();
List<T> function();
/** * Gets all the locations that this location manager has. * * @return This location manager's locations. */
Gets all the locations that this location manager has
getLocations
{ "repo_name": "wizjany/commandbook", "path": "src/main/java/com/sk89q/commandbook/locations/LocationManager.java", "license": "lgpl-3.0", "size": 2231 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
922,965
public boolean verify(Text key, Value value) { return verify(key, value, false, Versioned.NO_VERSION); } /** * Return {@code true} if {@code value} existed in the field mapped from * {@code key} at {@code timestamp}
boolean function(Text key, Value value) { return verify(key, value, false, Versioned.NO_VERSION); } /** * Return {@code true} if {@code value} existed in the field mapped from * {@code key} at {@code timestamp}
/** * Return {@code true} if {@code value} <em>currently</em> exists in the * field mapped from {@code key}. * * @param key * @param value * @return {@code true} if {@code key} as {@code value} is a valid mapping */
Return true if value currently exists in the field mapped from key
verify
{ "repo_name": "hcuffy/concourse", "path": "concourse-server/src/main/java/com/cinchapi/concourse/server/storage/db/PrimaryRecord.java", "license": "apache-2.0", "size": 6732 }
[ "com.cinchapi.concourse.server.model.Text", "com.cinchapi.concourse.server.model.Value", "com.cinchapi.concourse.server.storage.Versioned" ]
import com.cinchapi.concourse.server.model.Text; import com.cinchapi.concourse.server.model.Value; import com.cinchapi.concourse.server.storage.Versioned;
import com.cinchapi.concourse.server.model.*; import com.cinchapi.concourse.server.storage.*;
[ "com.cinchapi.concourse" ]
com.cinchapi.concourse;
1,545,400
private boolean readIndex(String filename, Collection<UpdateFile> collector) { File file = new File(filesDir, filename); return readIndex(file, collector); }
boolean function(String filename, Collection<UpdateFile> collector) { File file = new File(filesDir, filename); return readIndex(file, collector); }
/** Load the index from a local file. */
Load the index from a local file
readIndex
{ "repo_name": "melato/next-bus", "path": "src/org/melato/update/PortableUpdateManager.java", "license": "gpl-3.0", "size": 12017 }
[ "java.io.File", "java.util.Collection" ]
import java.io.File; import java.util.Collection;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,184,248
private PartitionStats computePartition(Partition<I, V, E, M> partition) throws IOException, InterruptedException { PartitionStats partitionStats = new PartitionStats(partition.getId(), 0, 0, 0, 0); // Make sure this is thread-safe across runs synchronized (partition) { // Prepare Partition context WorkerContext workerContext = graphState.getGraphTaskManager().getWorkerContext(); PartitionContext partitionContext = partition.getPartitionContext(); synchronized (workerContext) { partitionContext.preSuperstep(workerContext); } graphState.setPartitionContext(partition.getPartitionContext()); // the real execution logic here!! computeSuperstep(partition, partitionStats); messageStore.clearPartition(partition.getId()); synchronized (workerContext) { partitionContext.postSuperstep(workerContext); } } return partitionStats; }
PartitionStats function(Partition<I, V, E, M> partition) throws IOException, InterruptedException { PartitionStats partitionStats = new PartitionStats(partition.getId(), 0, 0, 0, 0); synchronized (partition) { WorkerContext workerContext = graphState.getGraphTaskManager().getWorkerContext(); PartitionContext partitionContext = partition.getPartitionContext(); synchronized (workerContext) { partitionContext.preSuperstep(workerContext); } graphState.setPartitionContext(partition.getPartitionContext()); computeSuperstep(partition, partitionStats); messageStore.clearPartition(partition.getId()); synchronized (workerContext) { partitionContext.postSuperstep(workerContext); } } return partitionStats; }
/** * Compute a single partition * 1. get executing query * 2. retrieve vertices and their negihbors * 3. construct new 2-length paths. * * @param partition Partition to compute * @return Partition stats for this computed partition */
Compute a single partition 1. get executing query 2. retrieve vertices and their negihbors 3. construct new 2-length paths
computePartition
{ "repo_name": "simon0227/dgraph", "path": "giraph-core/src/main/java/org/apache/giraph/subgraph/graphextraction/GraphExtractionCallable.java", "license": "apache-2.0", "size": 10263 }
[ "java.io.IOException", "org.apache.giraph.partition.Partition", "org.apache.giraph.partition.PartitionContext", "org.apache.giraph.partition.PartitionStats", "org.apache.giraph.worker.WorkerContext" ]
import java.io.IOException; import org.apache.giraph.partition.Partition; import org.apache.giraph.partition.PartitionContext; import org.apache.giraph.partition.PartitionStats; import org.apache.giraph.worker.WorkerContext;
import java.io.*; import org.apache.giraph.partition.*; import org.apache.giraph.worker.*;
[ "java.io", "org.apache.giraph" ]
java.io; org.apache.giraph;
1,377,678
public Cancellable deleteAutoFollowPatternAsync( DeleteAutoFollowPatternRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener ) { return restHighLevelClient.performRequestAsyncAndParseEntity( request, CcrRequestConverters::deleteAutoFollowPattern, options, AcknowledgedResponse::fromXContent, listener, Collections.emptySet() ); }
Cancellable function( DeleteAutoFollowPatternRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener ) { return restHighLevelClient.performRequestAsyncAndParseEntity( request, CcrRequestConverters::deleteAutoFollowPattern, options, AcknowledgedResponse::fromXContent, listener, Collections.emptySet() ); }
/** * Asynchronously deletes an auto follow pattern. * * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ccr-delete-auto-follow-pattern.html"> * the docs</a> for more. * @param request the request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion * @return cancellable that may be used to cancel the request */
Asynchronously deletes an auto follow pattern. See the docs for more
deleteAutoFollowPatternAsync
{ "repo_name": "GlenRSmith/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/CcrClient.java", "license": "apache-2.0", "size": 27205 }
[ "java.util.Collections", "org.elasticsearch.action.ActionListener", "org.elasticsearch.client.ccr.DeleteAutoFollowPatternRequest", "org.elasticsearch.client.core.AcknowledgedResponse" ]
import java.util.Collections; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.ccr.DeleteAutoFollowPatternRequest; import org.elasticsearch.client.core.AcknowledgedResponse;
import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.client.ccr.*; import org.elasticsearch.client.core.*;
[ "java.util", "org.elasticsearch.action", "org.elasticsearch.client" ]
java.util; org.elasticsearch.action; org.elasticsearch.client;
1,394,226
public List<String> getExpandedIds() { return mExpandedIds; }
List<String> function() { return mExpandedIds; }
/** * Returns the expanded ids * * @return */
Returns the expanded ids
getExpandedIds
{ "repo_name": "christoandrew/Gula", "path": "library-core/src/main/java/it/gmariotti/cardslib/library/internal/CardCursorAdapter.java", "license": "mit", "size": 9361 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,637,840
void reportRedbox( String title, StackFrame[] stack, String sourceUrl, ReportCompletedListener reportCompletedListener);
void reportRedbox( String title, StackFrame[] stack, String sourceUrl, ReportCompletedListener reportCompletedListener);
/** * Report the information from the redbox and set up a callback listener. */
Report the information from the redbox and set up a callback listener
reportRedbox
{ "repo_name": "prayuditb/tryout-01", "path": "websocket/client/Client/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java", "license": "mit", "size": 1604 }
[ "com.facebook.react.devsupport.StackTraceHelper" ]
import com.facebook.react.devsupport.StackTraceHelper;
import com.facebook.react.devsupport.*;
[ "com.facebook.react" ]
com.facebook.react;
1,608,297
Observable<AutoApprovedPrivateLinkService> listAutoApprovedPrivateLinkServicesAsync(final String location);
Observable<AutoApprovedPrivateLinkService> listAutoApprovedPrivateLinkServicesAsync(final String location);
/** * Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region. * * @param location The location of the domain name. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Returns all of the private link service ids that can be linked to a Private Endpoint with auto approved in this subscription in this region
listAutoApprovedPrivateLinkServicesAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/PrivateLinkServices.java", "license": "mit", "size": 5131 }
[ "com.microsoft.azure.management.network.v2020_05_01.AutoApprovedPrivateLinkService" ]
import com.microsoft.azure.management.network.v2020_05_01.AutoApprovedPrivateLinkService;
import com.microsoft.azure.management.network.v2020_05_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
2,265,602
public static ArchitectureOptionAttribute getAttributeFromLabel( final String label, final List<ArchitectureOptionAttribute> attrs) { ArchitectureOptionAttribute found = null; final Optional<ArchitectureOptionAttribute> result = attrs.stream(). filter(attr -> attr.getLabel().equals(label)).findFirst(); if (result.isPresent()) { found = result.get(); } else { LOGGER.error("Cannot load attribute from attribute label: " + label); } return found; }
static ArchitectureOptionAttribute function( final String label, final List<ArchitectureOptionAttribute> attrs) { ArchitectureOptionAttribute found = null; final Optional<ArchitectureOptionAttribute> result = attrs.stream(). filter(attr -> attr.getLabel().equals(label)).findFirst(); if (result.isPresent()) { found = result.get(); } else { LOGGER.error(STR + label); } return found; }
/** * Given a list of ArchitectureOptionAttribute, find the attribute with the * given label. * * @param label the label to find * @param attrs the list of attributes * * @return the found attribute or null if none found */
Given a list of ArchitectureOptionAttribute, find the attribute with the given label
getAttributeFromLabel
{ "repo_name": "astropcr/pmasecapstone", "path": "src/edu/gatech/pmase/capstone/awesome/util/PrioritizationUtil.java", "license": "mit", "size": 6336 }
[ "edu.gatech.pmase.capstone.awesome.objects.ArchitectureOptionAttribute", "java.util.List", "java.util.Optional" ]
import edu.gatech.pmase.capstone.awesome.objects.ArchitectureOptionAttribute; import java.util.List; import java.util.Optional;
import edu.gatech.pmase.capstone.awesome.objects.*; import java.util.*;
[ "edu.gatech.pmase", "java.util" ]
edu.gatech.pmase; java.util;
684,554
public boolean pathExists(Path path) { if (path == null) { return false; } try { return fs.exists(path); } catch(Exception e) { //theLogger.error("pathExists(): failed.", e); return false; } }
boolean function(Path path) { if (path == null) { return false; } try { return fs.exists(path); } catch(Exception e) { return false; } }
/** * Return true, if HDFS path doers exist; otherwise return false. * */
Return true, if HDFS path doers exist; otherwise return false
pathExists
{ "repo_name": "batermj/algorithm-challenger", "path": "Interviews/Basics/MapReduce/ISBN978-7-5123-9594-7/data-algorithms-book-master/src/main/java/org/dataalgorithms/chap29/combinesmallfilesbybuckets/BucketThread.java", "license": "apache-2.0", "size": 5140 }
[ "org.apache.hadoop.fs.Path" ]
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,386,620
private static Node getReplacementReturnStatement( Node node, String resultName) { Node resultNode = null; Node retVal = null; if (node.hasChildren()) { // Clone the child as the child hasn't been removed // from the node yet. retVal = node.getFirstChild().cloneTree(); } if (resultName == null) { if (retVal != null) { resultNode = NodeUtil.newExpr(retVal); // maybe null. } } else { if (retVal == null) { // A result is needed create a dummy value. Node srcLocation = node; retVal = NodeUtil.newUndefinedNode(srcLocation); } // Create a "resultName = retVal;" statement. resultNode = createAssignStatementNode(resultName, retVal); } return resultNode; }
static Node function( Node node, String resultName) { Node resultNode = null; Node retVal = null; if (node.hasChildren()) { retVal = node.getFirstChild().cloneTree(); } if (resultName == null) { if (retVal != null) { resultNode = NodeUtil.newExpr(retVal); } } else { if (retVal == null) { Node srcLocation = node; retVal = NodeUtil.newUndefinedNode(srcLocation); } resultNode = createAssignStatementNode(resultName, retVal); } return resultNode; }
/** * Replace the 'return' statement with its child expression. * If the result is needed (resultName != null): * "return foo()" becomes "resultName = foo()" * "return" becomes "resultName = void 0". * Otherwise: * "return foo()" becomes "foo()" * "return", null is returned. */
Replace the 'return' statement with its child expression. If the result is needed (resultName != null): "return foo()" becomes "resultName = foo()" "return" becomes "resultName = void 0". Otherwise: "return foo()" becomes "foo()" "return", null is returned
getReplacementReturnStatement
{ "repo_name": "GoogleChromeLabs/chromeos_smart_card_connector", "path": "third_party/closure-compiler/src/src/com/google/javascript/jscomp/FunctionToBlockMutator.java", "license": "apache-2.0", "size": 20093 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
2,387,694
@Nullable private static String getAuthor(@NonNull String firstChapterPath, @NonNull MediaMetadataRetriever mmr) { try { mmr.setDataSource(firstChapterPath); String bookName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_COMPOSER); if (bookName == null || bookName.length() == 0) { bookName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_AUTHOR); } if (bookName == null || bookName.length() == 0) { bookName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST); } return bookName; } catch (RuntimeException ignored) { return null; } } /** * @param left First chapter to compare * @param right Second chapter to compare * @return True if the Chapters in the array differ by {@link Chapter#name} or {@link Chapter#path}
static String function(@NonNull String firstChapterPath, @NonNull MediaMetadataRetriever mmr) { try { mmr.setDataSource(firstChapterPath); String bookName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_COMPOSER); if (bookName == null bookName.length() == 0) { bookName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_AUTHOR); } if (bookName == null bookName.length() == 0) { bookName = mmr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ARTIST); } return bookName; } catch (RuntimeException ignored) { return null; } } /** * @param left First chapter to compare * @param right Second chapter to compare * @return True if the Chapters in the array differ by {@link Chapter#name} or {@link Chapter#path}
/** * Returns the author of the book we want to add. If there is a tag embedded, use that one. Else * return null * * @param firstChapterPath A path to a file * @return The name of the book we add */
Returns the author of the book we want to add. If there is a tag embedded, use that one. Else return null
getAuthor
{ "repo_name": "intrications/MaterialAudiobookPlayer", "path": "audiobook/src/main/java/de/ph1b/audiobook/model/BookAdder.java", "license": "lgpl-3.0", "size": 27085 }
[ "android.media.MediaMetadataRetriever", "android.support.annotation.NonNull" ]
import android.media.MediaMetadataRetriever; import android.support.annotation.NonNull;
import android.media.*; import android.support.annotation.*;
[ "android.media", "android.support" ]
android.media; android.support;
1,110,826
private static void addDefaultProfile(SpringApplication app, SimpleCommandLinePropertySource source) { if (!source.containsProperty("spring.profiles.active") && !System.getenv().containsKey("SPRING_PROFILES_ACTIVE")) { app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT); } }
static void function(SpringApplication app, SimpleCommandLinePropertySource source) { if (!source.containsProperty(STR) && !System.getenv().containsKey(STR)) { app.setAdditionalProfiles(Constants.SPRING_PROFILE_DEVELOPMENT); } }
/** * If no profile has been configured, set by default the "dev" profile. */
If no profile has been configured, set by default the "dev" profile
addDefaultProfile
{ "repo_name": "cmercer/spring-boot-demo", "path": "src/main/java/com/harpoontech/demo/EasySpringApplication.java", "license": "apache-2.0", "size": 4585 }
[ "com.harpoontech.demo.config.Constants", "org.springframework.boot.SpringApplication", "org.springframework.core.env.SimpleCommandLinePropertySource" ]
import com.harpoontech.demo.config.Constants; import org.springframework.boot.SpringApplication; import org.springframework.core.env.SimpleCommandLinePropertySource;
import com.harpoontech.demo.config.*; import org.springframework.boot.*; import org.springframework.core.env.*;
[ "com.harpoontech.demo", "org.springframework.boot", "org.springframework.core" ]
com.harpoontech.demo; org.springframework.boot; org.springframework.core;
1,801,205
public void test_DELETE_accessPath_delete_c() throws Exception { if(TestMode.quads != getTestMode()) return; doInsertbyURL("POST", packagePath + "test_delete_by_access_path.trig"); final long mutationResult = doDeleteWithAccessPath(// // requestPath,// null,// s null,// p null,// o new URIImpl("http://www.bigdata.com/") // c ); assertEquals(3, mutationResult); }
void function() throws Exception { if(TestMode.quads != getTestMode()) return; doInsertbyURL("POST", packagePath + STR); final long mutationResult = doDeleteWithAccessPath( null, null, null, new URIImpl("http: ); assertEquals(3, mutationResult); }
/** * Delete everything in a named graph (context). */
Delete everything in a named graph (context)
test_DELETE_accessPath_delete_c
{ "repo_name": "smalyshev/blazegraph", "path": "bigdata-sails/src/test/com/bigdata/rdf/sail/webapp/TestBigdataSailRemoteRepository.java", "license": "gpl-2.0", "size": 24471 }
[ "org.openrdf.model.impl.URIImpl" ]
import org.openrdf.model.impl.URIImpl;
import org.openrdf.model.impl.*;
[ "org.openrdf.model" ]
org.openrdf.model;
856,648
void write(OutputStream out) throws IOException;
void write(OutputStream out) throws IOException;
/** * Writes this content to the given {@link OutputStream}. * * @param out the target * @throws IOException if an error occurs */
Writes this content to the given <code>OutputStream</code>
write
{ "repo_name": "palava/palava-bridge", "path": "src/main/java/de/cosmocode/palava/bridge/Content.java", "license": "apache-2.0", "size": 1731 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,259,774
public boolean addNewCompanyProfile(CompanyProfile companyProfile);
boolean function(CompanyProfile companyProfile);
/** * Adds a new company profile to the database. * * @param companyProfile the company profile to add. * @return the success of the operation. */
Adds a new company profile to the database
addNewCompanyProfile
{ "repo_name": "OpenCollabZA/sakai", "path": "profile2/api/src/java/org/sakaiproject/profile2/logic/ProfileLogic.java", "license": "apache-2.0", "size": 6145 }
[ "org.sakaiproject.profile2.model.CompanyProfile" ]
import org.sakaiproject.profile2.model.CompanyProfile;
import org.sakaiproject.profile2.model.*;
[ "org.sakaiproject.profile2" ]
org.sakaiproject.profile2;
511,132
@Override public boolean onCreatePanelMenu(int featureId, Menu menu) { if (featureId == Window.FEATURE_OPTIONS_PANEL) { boolean show = super.onCreatePanelMenu(featureId, menu); show |= mFragments.dispatchCreateOptionsMenu(menu, getMenuInflater()); if (android.os.Build.VERSION.SDK_INT >= HONEYCOMB) { return show; } // Prior to Honeycomb, the framework can't invalidate the options // menu, so we must always say we have one in case the app later // invalidates it and needs to have it shown. return true; } return super.onCreatePanelMenu(featureId, menu); }
boolean function(int featureId, Menu menu) { if (featureId == Window.FEATURE_OPTIONS_PANEL) { boolean show = super.onCreatePanelMenu(featureId, menu); show = mFragments.dispatchCreateOptionsMenu(menu, getMenuInflater()); if (android.os.Build.VERSION.SDK_INT >= HONEYCOMB) { return show; } return true; } return super.onCreatePanelMenu(featureId, menu); }
/** * Dispatch to Fragment.onCreateOptionsMenu(). */
Dispatch to Fragment.onCreateOptionsMenu()
onCreatePanelMenu
{ "repo_name": "devoxx/mobile-client", "path": "devoxx-android-client/src/android/support/v4/app/FragmentActivity.java", "license": "apache-2.0", "size": 26373 }
[ "android.view.Menu", "android.view.Window" ]
import android.view.Menu; import android.view.Window;
import android.view.*;
[ "android.view" ]
android.view;
2,689,252
public void accept(Invitation request) { }
void function(Invitation request) { }
/** * invitee accepts this request * @param request Invitation */
invitee accepts this request
accept
{ "repo_name": "Alfresco/alfresco-repository", "path": "src/main/java/org/alfresco/repo/invitation/site/SiteNominatedInvitationProcess.java", "license": "lgpl-3.0", "size": 1979 }
[ "org.alfresco.service.cmr.invitation.Invitation" ]
import org.alfresco.service.cmr.invitation.Invitation;
import org.alfresco.service.cmr.invitation.*;
[ "org.alfresco.service" ]
org.alfresco.service;
1,913,951
@NotNull public static RxServerInfoService newService(@NotNull AnonymousClient anonymousClient) { Preconditions.checkNotNull(anonymousClient, "Client should not be null"); ServerInfoService service = ServerInfoService.newService(anonymousClient); return new RxServerInfoService(service); } /** * Provides synchronous counterpart of service * * @return wrapped version of service {@link ServerInfoService}
static RxServerInfoService function(@NotNull AnonymousClient anonymousClient) { Preconditions.checkNotNull(anonymousClient, STR); ServerInfoService service = ServerInfoService.newService(anonymousClient); return new RxServerInfoService(service); } /** * Provides synchronous counterpart of service * * @return wrapped version of service {@link ServerInfoService}
/** * Factory method to create new service * * @param anonymousClient anonymous network client * @return instance of newly created service */
Factory method to create new service
newService
{ "repo_name": "Jaspersoft/js-android-sdk", "path": "rx/src/main/java/com/jaspersoft/android/sdk/service/rx/info/RxServerInfoService.java", "license": "lgpl-3.0", "size": 4288 }
[ "com.jaspersoft.android.sdk.network.AnonymousClient", "com.jaspersoft.android.sdk.service.info.ServerInfoService", "com.jaspersoft.android.sdk.service.internal.Preconditions", "org.jetbrains.annotations.NotNull" ]
import com.jaspersoft.android.sdk.network.AnonymousClient; import com.jaspersoft.android.sdk.service.info.ServerInfoService; import com.jaspersoft.android.sdk.service.internal.Preconditions; import org.jetbrains.annotations.NotNull;
import com.jaspersoft.android.sdk.network.*; import com.jaspersoft.android.sdk.service.info.*; import com.jaspersoft.android.sdk.service.internal.*; import org.jetbrains.annotations.*;
[ "com.jaspersoft.android", "org.jetbrains.annotations" ]
com.jaspersoft.android; org.jetbrains.annotations;
2,235,847
public void parse(String text, JRQueryChunkHandler chunkHandler) { if (text != null) { StringBuffer textChunk = new StringBuffer(); StringTokenizer tkzer = new StringTokenizer(text, "$", true); boolean wasDelim = false; while (tkzer.hasMoreTokens()) { String token = tkzer.nextToken(); if (token.equals("$")) { if (wasDelim) { textChunk.append("$"); } wasDelim = true; } else { if ( token.startsWith("P{") && wasDelim ) { int end = token.indexOf('}'); if (end > 0) { if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } String parameterChunk = token.substring(2, end); chunkHandler.handleParameterChunk(parameterChunk); textChunk = new StringBuffer(token.substring(end + 1)); } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } } else if ( token.startsWith("P!{") && wasDelim ) { int end = token.indexOf('}'); if (end > 0) { if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } String parameterClauseChunk = token.substring(3, end); chunkHandler.handleParameterClauseChunk(parameterClauseChunk); textChunk = new StringBuffer(token.substring(end + 1)); } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } } else if ( token.startsWith("X{") && wasDelim ) { int end = token.indexOf('}'); if (end > 0) { if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } String clauseChunk = token.substring(2, end); String[] tokens = parseClause(clauseChunk); chunkHandler.handleClauseChunk(tokens); textChunk = new StringBuffer(token.substring(end + 1)); } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } wasDelim = false; } } if (wasDelim) { textChunk.append("$"); } if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } } }
void function(String text, JRQueryChunkHandler chunkHandler) { if (text != null) { StringBuffer textChunk = new StringBuffer(); StringTokenizer tkzer = new StringTokenizer(text, "$", true); boolean wasDelim = false; while (tkzer.hasMoreTokens()) { String token = tkzer.nextToken(); if (token.equals("$")) { if (wasDelim) { textChunk.append("$"); } wasDelim = true; } else { if ( token.startsWith("P{") && wasDelim ) { int end = token.indexOf('}'); if (end > 0) { if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } String parameterChunk = token.substring(2, end); chunkHandler.handleParameterChunk(parameterChunk); textChunk = new StringBuffer(token.substring(end + 1)); } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } } else if ( token.startsWith("P!{") && wasDelim ) { int end = token.indexOf('}'); if (end > 0) { if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } String parameterClauseChunk = token.substring(3, end); chunkHandler.handleParameterClauseChunk(parameterClauseChunk); textChunk = new StringBuffer(token.substring(end + 1)); } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } } else if ( token.startsWith("X{") && wasDelim ) { int end = token.indexOf('}'); if (end > 0) { if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } String clauseChunk = token.substring(2, end); String[] tokens = parseClause(clauseChunk); chunkHandler.handleClauseChunk(tokens); textChunk = new StringBuffer(token.substring(end + 1)); } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } } else { if (wasDelim) { textChunk.append("$"); } textChunk.append(token); } wasDelim = false; } } if (wasDelim) { textChunk.append("$"); } if (textChunk.length() > 0) { chunkHandler.handleTextChunk(textChunk.toString()); } } }
/** * Parses a report query. * * @param text the query text * @param chunkHandler a handler that will be asked to handle parsed query chunks */
Parses a report query
parse
{ "repo_name": "OpenSoftwareSolutions/PDFReporter", "path": "pdfreporter-core/src/org/oss/pdfreporter/engine/util/JRQueryParser.java", "license": "lgpl-3.0", "size": 7525 }
[ "java.util.StringTokenizer" ]
import java.util.StringTokenizer;
import java.util.*;
[ "java.util" ]
java.util;
626,610
public ItemStack getPickedResult(MovingObjectPosition target) { if (this instanceof net.minecraft.entity.item.EntityPainting) { return new ItemStack(net.minecraft.init.Items.painting); } else if (this instanceof EntityLeashKnot) { return new ItemStack(net.minecraft.init.Items.lead); } else if (this instanceof net.minecraft.entity.item.EntityItemFrame) { ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); if (held == null) { return new ItemStack(net.minecraft.init.Items.item_frame); } else { return held.copy(); } } else if (this instanceof net.minecraft.entity.item.EntityMinecart) { return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); } else if (this instanceof net.minecraft.entity.item.EntityBoat) { return new ItemStack(net.minecraft.init.Items.boat); } else if (this instanceof net.minecraft.entity.item.EntityArmorStand) { return new ItemStack(net.minecraft.init.Items.armor_stand); } else { int id = EntityList.getEntityID(this); if (id > 0 && EntityList.entityEggs.containsKey(id)) { return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); } } return null; }
ItemStack function(MovingObjectPosition target) { if (this instanceof net.minecraft.entity.item.EntityPainting) { return new ItemStack(net.minecraft.init.Items.painting); } else if (this instanceof EntityLeashKnot) { return new ItemStack(net.minecraft.init.Items.lead); } else if (this instanceof net.minecraft.entity.item.EntityItemFrame) { ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).getDisplayedItem(); if (held == null) { return new ItemStack(net.minecraft.init.Items.item_frame); } else { return held.copy(); } } else if (this instanceof net.minecraft.entity.item.EntityMinecart) { return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); } else if (this instanceof net.minecraft.entity.item.EntityBoat) { return new ItemStack(net.minecraft.init.Items.boat); } else if (this instanceof net.minecraft.entity.item.EntityArmorStand) { return new ItemStack(net.minecraft.init.Items.armor_stand); } else { int id = EntityList.getEntityID(this); if (id > 0 && EntityList.entityEggs.containsKey(id)) { return new ItemStack(net.minecraft.init.Items.spawn_egg, 1, id); } } return null; }
/** * Called when a user uses the creative pick block button on this entity. * * @param target The full target the player is looking at * @return A ItemStack to add to the player's inventory, Null if nothing should be added. */
Called when a user uses the creative pick block button on this entity
getPickedResult
{ "repo_name": "kelthalorn/ConquestCraft", "path": "build/tmp/recompSrc/net/minecraft/entity/Entity.java", "license": "lgpl-2.1", "size": 97307 }
[ "net.minecraft.item.ItemStack", "net.minecraft.util.MovingObjectPosition" ]
import net.minecraft.item.ItemStack; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.item.*; import net.minecraft.util.*;
[ "net.minecraft.item", "net.minecraft.util" ]
net.minecraft.item; net.minecraft.util;
1,223,596
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Response<Flux<ByteBuffer>>> migrateSqlDatabaseToAutoscaleWithResponseAsync( String resourceGroupName, String accountName, String databaseName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (accountName == null) { return Mono.error(new IllegalArgumentException("Parameter accountName is required and cannot be null.")); } if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } final String accept = "application/json"; return FluxUtil .withContext( context -> service .migrateSqlDatabaseToAutoscale( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, accountName, databaseName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String accountName, String databaseName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (accountName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (databaseName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String accept = STR; return FluxUtil .withContext( context -> service .migrateSqlDatabaseToAutoscale( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, accountName, databaseName, this.client.getApiVersion(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); }
/** * Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale. * * @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. * @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 resource throughput. */
Migrate an Azure Cosmos DB SQL database from manual throughput to autoscale
migrateSqlDatabaseToAutoscaleWithResponseAsync
{ "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.http.rest.Response", "com.azure.core.util.FluxUtil", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import java.nio.*;
[ "com.azure.core", "java.nio" ]
com.azure.core; java.nio;
1,839,432
private void validateLinkQualifiers(MAssociation assoc, List<List<Value>> qualifiers) throws MSystemException { if (assoc.hasQualifiedEnds()) { if (qualifiers == null || qualifiers.size() != assoc.associationEnds().size() ) throw new MSystemException("Missing qualifier values for link creation."); for (int index = 0; index < assoc.associationEnds().size(); index++) { MAssociationEnd end = assoc.associationEnds().get(index); List<Value> qualifierValues = qualifiers.get(index); if (end.hasQualifiers()) { if (qualifierValues == null) { throw new MSystemException("Association end " + StringUtil.inQuotes(end.toString()) + " requires qualifier values."); } if (qualifierValues.size() != end.getQualifiers().size()) { throw new MSystemException("Association end " + StringUtil.inQuotes(end.toString()) + " requires " + end.getQualifiers().size() + " qualifier values. Provided: " + qualifierValues.size() + "."); } for (int valueIndex = 0; valueIndex < qualifierValues.size(); valueIndex++) { Value qualifierValue = qualifierValues.get(valueIndex); VarDecl qualifier = end.getQualifiers().get(valueIndex); if (!qualifierValue.type().conformsTo(qualifier.type())) { throw new MSystemException( "The type of the provided value (" + StringUtil.inQuotes(qualifierValue .type().toString()) + ") for the qualifier " + qualifier.name() + " does not conform to the specified type (" + StringUtil.inQuotes(qualifier .type().toString()) + ")"); } } } else { if (qualifierValues != null && !qualifierValues.isEmpty()) { throw new MSystemException("The association end " + StringUtil.inQuotes(end.toString()) + " has no qualifier."); } } } } else if (qualifiers != null && !qualifiers.isEmpty()) { // All qualifier values must be null or empty for (int index = 0; index < assoc.associationEnds().size(); ++index) { if (!(qualifiers.get(index) == null || qualifiers.get(index).isEmpty())) throw new MSystemException("No association end of association " + StringUtil.inQuotes(assoc.toString()) + " has qualifier."); } } } private DirectedGraph<MObject, MWholePartLink> fWholePartLinkGraph = new DirectedGraphBase<MObject, MWholePartLink>();
void function(MAssociation assoc, List<List<Value>> qualifiers) throws MSystemException { if (assoc.hasQualifiedEnds()) { if (qualifiers == null qualifiers.size() != assoc.associationEnds().size() ) throw new MSystemException(STR); for (int index = 0; index < assoc.associationEnds().size(); index++) { MAssociationEnd end = assoc.associationEnds().get(index); List<Value> qualifierValues = qualifiers.get(index); if (end.hasQualifiers()) { if (qualifierValues == null) { throw new MSystemException(STR + StringUtil.inQuotes(end.toString()) + STR); } if (qualifierValues.size() != end.getQualifiers().size()) { throw new MSystemException(STR + StringUtil.inQuotes(end.toString()) + STR + end.getQualifiers().size() + STR + qualifierValues.size() + "."); } for (int valueIndex = 0; valueIndex < qualifierValues.size(); valueIndex++) { Value qualifierValue = qualifierValues.get(valueIndex); VarDecl qualifier = end.getQualifiers().get(valueIndex); if (!qualifierValue.type().conformsTo(qualifier.type())) { throw new MSystemException( STR + StringUtil.inQuotes(qualifierValue .type().toString()) + STR + qualifier.name() + STR + StringUtil.inQuotes(qualifier .type().toString()) + ")"); } } } else { if (qualifierValues != null && !qualifierValues.isEmpty()) { throw new MSystemException(STR + StringUtil.inQuotes(end.toString()) + STR); } } } } else if (qualifiers != null && !qualifiers.isEmpty()) { for (int index = 0; index < assoc.associationEnds().size(); ++index) { if (!(qualifiers.get(index) == null qualifiers.get(index).isEmpty())) throw new MSystemException(STR + StringUtil.inQuotes(assoc.toString()) + STR); } } } private DirectedGraph<MObject, MWholePartLink> fWholePartLinkGraph = new DirectedGraphBase<MObject, MWholePartLink>();
/** * Validates the correct usage of qualified associations, e.g., * The provided qualifier values are checked against the definition (defined?, Type?) * and vice versa. * @param assoc * @param qualifiers * @throws MSystemException */
Validates the correct usage of qualified associations, e.g., The provided qualifier values are checked against the definition (defined?, Type?) and vice versa
validateLinkQualifiers
{ "repo_name": "classicwuhao/maxuse", "path": "src/main/org/tzi/use/uml/sys/MSystemState.java", "license": "gpl-2.0", "size": 70194 }
[ "java.util.List", "org.tzi.use.graph.DirectedGraph", "org.tzi.use.graph.DirectedGraphBase", "org.tzi.use.uml.mm.MAssociation", "org.tzi.use.uml.mm.MAssociationEnd", "org.tzi.use.uml.ocl.expr.VarDecl", "org.tzi.use.uml.ocl.value.Value", "org.tzi.use.util.StringUtil" ]
import java.util.List; import org.tzi.use.graph.DirectedGraph; import org.tzi.use.graph.DirectedGraphBase; import org.tzi.use.uml.mm.MAssociation; import org.tzi.use.uml.mm.MAssociationEnd; import org.tzi.use.uml.ocl.expr.VarDecl; import org.tzi.use.uml.ocl.value.Value; import org.tzi.use.util.StringUtil;
import java.util.*; import org.tzi.use.graph.*; import org.tzi.use.uml.mm.*; import org.tzi.use.uml.ocl.expr.*; import org.tzi.use.uml.ocl.value.*; import org.tzi.use.util.*;
[ "java.util", "org.tzi.use" ]
java.util; org.tzi.use;
209,565
public static File getExactFile(File path) { try { return path.getCanonicalFile(); } catch (IOException e) { return path.getAbsoluteFile(); } }
static File function(File path) { try { return path.getCanonicalFile(); } catch (IOException e) { return path.getAbsoluteFile(); } }
/** * Returns the exact path for a file. This path will be the canonical path * unless an exception is thrown in which case it will be the absolute path. * * @param path * @return the exact file */
Returns the exact path for a file. This path will be the canonical path unless an exception is thrown in which case it will be the absolute path
getExactFile
{ "repo_name": "firateren52/gitblit", "path": "src/main/java/com/gitblit/utils/FileUtils.java", "license": "apache-2.0", "size": 9785 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,846,529
@Test public void testRouteDelete() { Route route = new Route(Route.Source.STATIC, V4_PREFIX1, V4_NEXT_HOP1); ResolvedRoute removedResolvedRoute = new ResolvedRoute(route, MAC1, CP1); verifyDelete(route, removedResolvedRoute); route = new Route(Route.Source.STATIC, V6_PREFIX1, V6_NEXT_HOP1); removedResolvedRoute = new ResolvedRoute(route, MAC3, CP1); verifyDelete(route, removedResolvedRoute); }
void function() { Route route = new Route(Route.Source.STATIC, V4_PREFIX1, V4_NEXT_HOP1); ResolvedRoute removedResolvedRoute = new ResolvedRoute(route, MAC1, CP1); verifyDelete(route, removedResolvedRoute); route = new Route(Route.Source.STATIC, V6_PREFIX1, V6_NEXT_HOP1); removedResolvedRoute = new ResolvedRoute(route, MAC3, CP1); verifyDelete(route, removedResolvedRoute); }
/** * Tests deleting routes from the route manager. */
Tests deleting routes from the route manager
testRouteDelete
{ "repo_name": "LorenzReinhart/ONOSnew", "path": "incubator/net/src/test/java/org/onosproject/incubator/net/routing/impl/RouteManagerTest.java", "license": "apache-2.0", "size": 14536 }
[ "org.onosproject.incubator.net.routing.ResolvedRoute", "org.onosproject.incubator.net.routing.Route" ]
import org.onosproject.incubator.net.routing.ResolvedRoute; import org.onosproject.incubator.net.routing.Route;
import org.onosproject.incubator.net.routing.*;
[ "org.onosproject.incubator" ]
org.onosproject.incubator;
457,107
//////////////////////////////////////////////////////////////////////////// // // Cursor // //////////////////////////////////////////////////////////////////////////// private static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); public static Cursor getCursor(int id) { Integer key = Integer.valueOf(id); Cursor cursor = m_idToCursorMap.get(key); if (cursor == null) { cursor = new Cursor(Display.getDefault(), id); m_idToCursorMap.put(key, cursor); } return cursor; }
static Map<Integer, Cursor> m_idToCursorMap = new HashMap<Integer, Cursor>(); public static Cursor function(int id) { Integer key = Integer.valueOf(id); Cursor cursor = m_idToCursorMap.get(key); if (cursor == null) { cursor = new Cursor(Display.getDefault(), id); m_idToCursorMap.put(key, cursor); } return cursor; }
/** * Returns the system cursor matching the specific ID. * * @param id * int The ID value for the cursor * @return Cursor The system cursor matching the specific ID */
Returns the system cursor matching the specific ID
getCursor
{ "repo_name": "capitalone/Hydrograph", "path": "hydrograph.ui/hydrograph.ui.common/src/main/java/hydrograph/ui/common/util/SWTResourceManager.java", "license": "apache-2.0", "size": 15614 }
[ "java.util.HashMap", "java.util.Map", "org.eclipse.swt.graphics.Cursor", "org.eclipse.swt.widgets.Display" ]
import java.util.HashMap; import java.util.Map; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Display;
import java.util.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*;
[ "java.util", "org.eclipse.swt" ]
java.util; org.eclipse.swt;
2,132,638
List<Member> getMembersByUser(PerunSession perunSession, User user) throws InternalErrorException;
List<Member> getMembersByUser(PerunSession perunSession, User user) throws InternalErrorException;
/** * Returns members by his user. * * @param perunSession * @param user * @return list of members * @throws InternalErrorException * @throws MemberNotExistsException * @throws VoNotExistsException * @throws UserNotExistsException */
Returns members by his user
getMembersByUser
{ "repo_name": "stavamichal/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/MembersManagerImplApi.java", "license": "bsd-2-clause", "size": 11622 }
[ "cz.metacentrum.perun.core.api.Member", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.User", "cz.metacentrum.perun.core.api.exceptions.InternalErrorException", "java.util.List" ]
import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.List;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
[ "cz.metacentrum.perun", "java.util" ]
cz.metacentrum.perun; java.util;
1,056,956
if (job == null) { throw ExceptionsHelper.missingJobException(jobId); } if (job.isDeleting()) { throw ExceptionsHelper.conflictStatusException("Cannot open job [" + jobId + "] because it is being deleted"); } if (job.getJobVersion() == null) { throw ExceptionsHelper.badRequestException("Cannot open job [" + jobId + "] because jobs created prior to version 5.5 are not supported"); } }
if (job == null) { throw ExceptionsHelper.missingJobException(jobId); } if (job.isDeleting()) { throw ExceptionsHelper.conflictStatusException(STR + jobId + STR); } if (job.getJobVersion() == null) { throw ExceptionsHelper.badRequestException(STR + jobId + STR); } }
/** * Validations to fail fast before trying to update the job state on master node: * <ul> * <li>check job exists</li> * <li>check job is not marked as deleted</li> * <li>check job's version is supported</li> * </ul> */
Validations to fail fast before trying to update the job state on master node: check job exists check job is not marked as deleted check job's version is supported
validate
{ "repo_name": "gingerwizard/elasticsearch", "path": "x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportOpenJobAction.java", "license": "apache-2.0", "size": 35327 }
[ "org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper" ]
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
import org.elasticsearch.xpack.core.ml.utils.*;
[ "org.elasticsearch.xpack" ]
org.elasticsearch.xpack;
2,811,897
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<ManagementPolicyInner> getAsync( String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { return getWithResponseAsync(resourceGroupName, accountName, managementPolicyName) .flatMap( (Response<ManagementPolicyInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<ManagementPolicyInner> function( String resourceGroupName, String accountName, ManagementPolicyName managementPolicyName) { return getWithResponseAsync(resourceGroupName, accountName, managementPolicyName) .flatMap( (Response<ManagementPolicyInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); }
/** * Gets the managementpolicy associated with the specified storage account. * * @param resourceGroupName The name of the resource group within the user's subscription. The name is case * insensitive. * @param accountName The name of the storage account within the specified resource group. Storage account names * must be between 3 and 24 characters in length and use numbers and lower-case letters only. * @param managementPolicyName The name of the Storage Account Management Policy. It should always be 'default'. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the managementpolicy associated with the specified storage account on successful completion of {@link * Mono}. */
Gets the managementpolicy associated with the specified storage account
getAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/implementation/ManagementPoliciesClientImpl.java", "license": "mit", "size": 35629 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.resourcemanager.storage.fluent.models.ManagementPolicyInner", "com.azure.resourcemanager.storage.models.ManagementPolicyName" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.storage.fluent.models.ManagementPolicyInner; import com.azure.resourcemanager.storage.models.ManagementPolicyName;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.storage.fluent.models.*; import com.azure.resourcemanager.storage.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,796,158
public static <T extends PulsarConfiguration> T create(InputStream inStream, Class<? extends PulsarConfiguration> clazz) throws IOException, IllegalArgumentException { try { requireNonNull(inStream); Properties properties = new Properties(); properties.load(inStream); return (create(properties, clazz)); } finally { if (inStream != null) { inStream.close(); } } }
static <T extends PulsarConfiguration> T function(InputStream inStream, Class<? extends PulsarConfiguration> clazz) throws IOException, IllegalArgumentException { try { requireNonNull(inStream); Properties properties = new Properties(); properties.load(inStream); return (create(properties, clazz)); } finally { if (inStream != null) { inStream.close(); } } }
/** * Creates PulsarConfiguration and loads it with populated attribute values loaded from provided inputstream * property file. * * @param inStream * @throws IOException * if an error occurred when reading from the input stream. * @throws IllegalArgumentException * if the input stream contains incorrect value type */
Creates PulsarConfiguration and loads it with populated attribute values loaded from provided inputstream property file
create
{ "repo_name": "massakam/pulsar", "path": "pulsar-broker-common/src/main/java/org/apache/pulsar/common/configuration/PulsarConfigurationLoader.java", "license": "apache-2.0", "size": 8994 }
[ "java.io.IOException", "java.io.InputStream", "java.util.Objects", "java.util.Properties" ]
import java.io.IOException; import java.io.InputStream; import java.util.Objects; import java.util.Properties;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,897,783
public PersonalContactsEntity readPersonalContactsByUuid(String uuidString);
PersonalContactsEntity function(String uuidString);
/** * Read personal contacts by uuid. * * @param uuidString the uuid string * @return the personal contacts entity */
Read personal contacts by uuid
readPersonalContactsByUuid
{ "repo_name": "willmorejg/net.ljcomputing.ecsr", "path": "net.ljcomputing.people-orientdb/src/main/java/net/ljcomputing/people/service/PersonalContactsService.java", "license": "apache-2.0", "size": 2003 }
[ "net.ljcomputing.people.entity.PersonalContactsEntity" ]
import net.ljcomputing.people.entity.PersonalContactsEntity;
import net.ljcomputing.people.entity.*;
[ "net.ljcomputing.people" ]
net.ljcomputing.people;
327,820
private Object invokeMethod(ApplicationContext appContext, final String methodName, Object[] params) throws Throwable{ try{ Method method = (Method)objectCache.get(methodName); if (method == null){ method = appContext.getClass() .getMethod(methodName, (Class[])classCache.get(methodName)); objectCache.put(methodName, method); } return executeMethod(method,appContext,params); } catch (Exception ex){ handleException(ex, methodName); return null; } finally { params = null; } }
Object function(ApplicationContext appContext, final String methodName, Object[] params) throws Throwable{ try{ Method method = (Method)objectCache.get(methodName); if (method == null){ method = appContext.getClass() .getMethod(methodName, (Class[])classCache.get(methodName)); objectCache.put(methodName, method); } return executeMethod(method,appContext,params); } catch (Exception ex){ handleException(ex, methodName); return null; } finally { params = null; } }
/** * Use reflection to invoke the requested method. Cache the method object * to speed up the process * @param appContext The AppliationContext object on which the method * will be invoked * @param methodName The method to call. * @param params The arguments passed to the called method. */
Use reflection to invoke the requested method. Cache the method object to speed up the process
invokeMethod
{ "repo_name": "whitingjr/JbossWeb_7_2_0", "path": "src/main/java/org/apache/catalina/core/ApplicationContextFacade.java", "license": "apache-2.0", "size": 25191 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,105,224
public static Type[] getArgumentTypes(final Method method) { Class<?>[] classes = method.getParameterTypes(); Type[] types = new Type[classes.length]; for (int i = classes.length - 1; i >= 0; --i) { types[i] = getType(classes[i]); } return types; }
static Type[] function(final Method method) { Class<?>[] classes = method.getParameterTypes(); Type[] types = new Type[classes.length]; for (int i = classes.length - 1; i >= 0; --i) { types[i] = getType(classes[i]); } return types; }
/** * Returns the Java types corresponding to the argument types of the given * method. * * @param method * a method. * @return the Java types corresponding to the argument types of the given * method. */
Returns the Java types corresponding to the argument types of the given method
getArgumentTypes
{ "repo_name": "ArcherFeel/AWACS", "path": "awacs-plugin/awacs-stacktrace-plugin/src/main/java/io/awacs/plugin/org/objectweb/asm/Type.java", "license": "apache-2.0", "size": 29389 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,229,071
@Override public List<Permission> buildFromNames(List<String> names) { List<Permission> permissions = new ArrayList<>(); permissions.addAll(jtalksPermissionFactory.buildFromNames(names)); permissions.addAll(pluginPermissionFactory.buildFromNames(names)); return permissions; }
List<Permission> function(List<String> names) { List<Permission> permissions = new ArrayList<>(); permissions.addAll(jtalksPermissionFactory.buildFromNames(names)); permissions.addAll(pluginPermissionFactory.buildFromNames(names)); return permissions; }
/** * Gets list of permissions by names. Searches in common and plugin permissions * * @param names list of interested permissions names * @return list of permissions with specified names */
Gets list of permissions by names. Searches in common and plugin permissions
buildFromNames
{ "repo_name": "illerax/jcommune", "path": "jcommune-service/src/main/java/org/jtalks/jcommune/service/security/JCPermissionFactory.java", "license": "lgpl-2.1", "size": 4873 }
[ "java.util.ArrayList", "java.util.List", "org.springframework.security.acls.model.Permission" ]
import java.util.ArrayList; import java.util.List; import org.springframework.security.acls.model.Permission;
import java.util.*; import org.springframework.security.acls.model.*;
[ "java.util", "org.springframework.security" ]
java.util; org.springframework.security;
1,031,929
@Invisible @Conversion public static JavaFileArtifact convert(String val) throws VilException { Path path = Path.convert(val); return convert(path); }
static JavaFileArtifact function(String val) throws VilException { Path path = Path.convert(val); return convert(path); }
/** * Conversion operation. * * @param val * the value to be converted * @return the converted value * @throws VilException * in case that creating the artifact fails */
Conversion operation
convert
{ "repo_name": "SSEHUB/EASyProducer", "path": "Plugins/Instantiation/Instantiator.Java/src/net/ssehub/easy/instantiation/java/artifacts/JavaFileArtifact.java", "license": "apache-2.0", "size": 27862 }
[ "net.ssehub.easy.instantiation.core.model.artifactModel.Path", "net.ssehub.easy.instantiation.core.model.common.VilException" ]
import net.ssehub.easy.instantiation.core.model.artifactModel.Path; import net.ssehub.easy.instantiation.core.model.common.VilException;
import net.ssehub.easy.instantiation.core.model.*; import net.ssehub.easy.instantiation.core.model.common.*;
[ "net.ssehub.easy" ]
net.ssehub.easy;
2,072,267
@Required public void setCommandBus(DisruptorCommandBus commandBus) { this.commandBus = commandBus; }
void function(DisruptorCommandBus commandBus) { this.commandBus = commandBus; }
/** * The DisruptorCommandBus instance to create the repository from. This is a required property, but cannot be * set using constructor injection, as Spring will see it as a circular dependency. * * @param commandBus DisruptorCommandBus instance to create the repository from */
The DisruptorCommandBus instance to create the repository from. This is a required property, but cannot be set using constructor injection, as Spring will see it as a circular dependency
setCommandBus
{ "repo_name": "christiaandejong/AxonFramework", "path": "core/src/main/java/org/axonframework/contextsupport/spring/DisruptorRepositoryBeanDefinitionParser.java", "license": "apache-2.0", "size": 9438 }
[ "org.axonframework.commandhandling.disruptor.DisruptorCommandBus" ]
import org.axonframework.commandhandling.disruptor.DisruptorCommandBus;
import org.axonframework.commandhandling.disruptor.*;
[ "org.axonframework.commandhandling" ]
org.axonframework.commandhandling;
1,850,289
public HttpException getException() { return exception; }
HttpException function() { return exception; }
/** * Get the recorded exception to throw. * * @return the recorded exception or <code>null</code> if none has been recorded. */
Get the recorded exception to throw
getException
{ "repo_name": "Comcast/drive-thru", "path": "src/main/java/com/comcast/drivethru/test/ResponseBuilder.java", "license": "apache-2.0", "size": 9844 }
[ "com.comcast.drivethru.exception.HttpException" ]
import com.comcast.drivethru.exception.HttpException;
import com.comcast.drivethru.exception.*;
[ "com.comcast.drivethru" ]
com.comcast.drivethru;
1,810,423
Future<GatewayGetOperationStatusResponse> resizeVirtualNetworkGatewayAsync(String gatewayId, ResizeGatewayParameters parameters);
Future<GatewayGetOperationStatusResponse> resizeVirtualNetworkGatewayAsync(String gatewayId, ResizeGatewayParameters parameters);
/** * The Begin Resize Virtual network Gateway operation resizes an existing * gateway to a different GatewaySKU. * * @param gatewayId Required. The virtual network for this gateway id. * @param parameters Required. Parameters supplied to the Resize Virtual * Network Gateway operation. * @return The response body contains the status of the specified * asynchronous operation, indicating whether it has succeeded, is in * progress, or has failed. Note that this status is distinct from the HTTP * status code returned for the Get Operation Status operation itself. If * the asynchronous operation succeeded, the response body includes the * HTTP status code for the successful request. If the asynchronous * operation failed, the response body includes the HTTP status code for * the failed request, and also includes error information regarding the * failure. */
The Begin Resize Virtual network Gateway operation resizes an existing gateway to a different GatewaySKU
resizeVirtualNetworkGatewayAsync
{ "repo_name": "flydream2046/azure-sdk-for-java", "path": "service-management/azure-svc-mgmt-network/src/main/java/com/microsoft/windowsazure/management/network/GatewayOperations.java", "license": "apache-2.0", "size": 159849 }
[ "com.microsoft.windowsazure.management.network.models.GatewayGetOperationStatusResponse", "com.microsoft.windowsazure.management.network.models.ResizeGatewayParameters", "java.util.concurrent.Future" ]
import com.microsoft.windowsazure.management.network.models.GatewayGetOperationStatusResponse; import com.microsoft.windowsazure.management.network.models.ResizeGatewayParameters; import java.util.concurrent.Future;
import com.microsoft.windowsazure.management.network.models.*; import java.util.concurrent.*;
[ "com.microsoft.windowsazure", "java.util" ]
com.microsoft.windowsazure; java.util;
174,908
public Cancellable stopILMAsync(StopILMRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::stopILM, options, AcknowledgedResponse::fromXContent, listener, emptySet()); }
Cancellable function(StopILMRequest request, RequestOptions options, ActionListener<AcknowledgedResponse> listener) { return restHighLevelClient.performRequestAsyncAndParseEntity(request, IndexLifecycleRequestConverters::stopILM, options, AcknowledgedResponse::fromXContent, listener, emptySet()); }
/** * Asynchronously stop the Index Lifecycle Management feature. * See <pre> * https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/ * java-rest-high-ilm-ilm-stop-ilm.html * </pre> * for more. * @param request the request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @param listener the listener to be notified upon request completion * @return cancellable that may be used to cancel the request */
Asynchronously stop the Index Lifecycle Management feature. See <code> HREF java-rest-high-ilm-ilm-stop-ilm.html </code> for more
stopILMAsync
{ "repo_name": "gingerwizard/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/IndexLifecycleClient.java", "license": "apache-2.0", "size": 37385 }
[ "java.util.Collections", "org.elasticsearch.action.ActionListener", "org.elasticsearch.client.core.AcknowledgedResponse", "org.elasticsearch.client.ilm.StopILMRequest" ]
import java.util.Collections; import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.core.AcknowledgedResponse; import org.elasticsearch.client.ilm.StopILMRequest;
import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.client.core.*; import org.elasticsearch.client.ilm.*;
[ "java.util", "org.elasticsearch.action", "org.elasticsearch.client" ]
java.util; org.elasticsearch.action; org.elasticsearch.client;
1,761,983
private void updateTimer() { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "updateTimer"); } mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME); if (shouldTimerBeRunning()) { mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME); } }
void function() { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, STR); } mUpdateTimeHandler.removeMessages(MSG_UPDATE_TIME); if (shouldTimerBeRunning()) { mUpdateTimeHandler.sendEmptyMessage(MSG_UPDATE_TIME); } }
/** * Starts the {@link #mUpdateTimeHandler} timer if it should be running and isn't currently * or stops it if it shouldn't be running but currently is. */
Starts the <code>#mUpdateTimeHandler</code> timer if it should be running and isn't currently or stops it if it shouldn't be running but currently is
updateTimer
{ "repo_name": "hunatika615/test-android-health", "path": "WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/DigitalWatchFaceService.java", "license": "apache-2.0", "size": 25634 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
2,601,068
public double getFieldDouble(String field, String param, double def) { String val = getFieldParam(field, param); try { return val==null ? def : Double.parseDouble(val); } catch( Exception ex ) { throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); } }
double function(String field, String param, double def) { String val = getFieldParam(field, param); try { return val==null ? def : Double.parseDouble(val); } catch( Exception ex ) { throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, ex.getMessage(), ex ); } }
/** Returns the float value of the field param, or the value for param, or def if neither is set. */
Returns the float value of the field param
getFieldDouble
{ "repo_name": "Lythimus/lptv", "path": "apache-solr-3.6.0/solr/solrj/src/java/org/apache/solr/common/params/SolrParams.java", "license": "gpl-2.0", "size": 11001 }
[ "org.apache.solr.common.SolrException" ]
import org.apache.solr.common.SolrException;
import org.apache.solr.common.*;
[ "org.apache.solr" ]
org.apache.solr;
2,550,235
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); }
ActionResult<ItemStack> function(World worldIn, EntityPlayer playerIn, EnumHand handIn) { return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); }
/** * Called when the equipped item is right clicked. */
Called when the equipped item is right clicked
onItemRightClick
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraft/item/Item.java", "license": "lgpl-2.1", "size": 86763 }
[ "net.minecraft.entity.player.EntityPlayer", "net.minecraft.util.ActionResult", "net.minecraft.util.EnumActionResult", "net.minecraft.util.EnumHand", "net.minecraft.world.World" ]
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; import net.minecraft.world.World;
import net.minecraft.entity.player.*; import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.entity", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.entity; net.minecraft.util; net.minecraft.world;
610,843
public void startElement(String uri, String localname, String qname, Attributes attributes) throws SAXException { _parser.startElement(uri, localname, qname, attributes); }
void function(String uri, String localname, String qname, Attributes attributes) throws SAXException { _parser.startElement(uri, localname, qname, attributes); }
/** * Just forward SAX2 event to parser object. */
Just forward SAX2 event to parser object
startElement
{ "repo_name": "md-5/jdk10", "path": "src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TemplatesHandlerImpl.java", "license": "gpl-2.0", "size": 12553 }
[ "org.xml.sax.Attributes", "org.xml.sax.SAXException" ]
import org.xml.sax.Attributes; import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
249,194
public static List<HostSystem> findAllHostSystem(final Folder folder) { List<HostSystem> hostSystems = new ArrayList<HostSystem>(); try { HostSystem hostSystem; ManagedEntity[] hosts = (ManagedEntity[]) new InventoryNavigator(folder) .searchManagedEntities("HostSystem"); if (hosts != null && hosts.length > 0) { for (int i = 0; i < hosts.length; i++) { hostSystem = (HostSystem) hosts[i]; hostSystems.add(hostSystem); } } } catch (RemoteException e) { LOGGER.error("Error while searching all hostsystems for this folder: " + folder.getName()); } return hostSystems; }
static List<HostSystem> function(final Folder folder) { List<HostSystem> hostSystems = new ArrayList<HostSystem>(); try { HostSystem hostSystem; ManagedEntity[] hosts = (ManagedEntity[]) new InventoryNavigator(folder) .searchManagedEntities(STR); if (hosts != null && hosts.length > 0) { for (int i = 0; i < hosts.length; i++) { hostSystem = (HostSystem) hosts[i]; hostSystems.add(hostSystem); } } } catch (RemoteException e) { LOGGER.error(STR + folder.getName()); } return hostSystems; }
/** * Search all hostsystems on a folder, usually the rootFolder. * * @param folder * @return */
Search all hostsystems on a folder, usually the rootFolder
findAllHostSystem
{ "repo_name": "occiware/Multi-Cloud-Studio", "path": "plugins/org.eclipse.cmf.occi.multicloud.vmware.connector/src/org/ecplise/cmf/occi/multicloud/vmware/connector/driver/HostHelper.java", "license": "epl-1.0", "size": 4466 }
[ "com.vmware.vim25.mo.Folder", "com.vmware.vim25.mo.HostSystem", "com.vmware.vim25.mo.InventoryNavigator", "com.vmware.vim25.mo.ManagedEntity", "java.rmi.RemoteException", "java.util.ArrayList", "java.util.List" ]
import com.vmware.vim25.mo.Folder; import com.vmware.vim25.mo.HostSystem; import com.vmware.vim25.mo.InventoryNavigator; import com.vmware.vim25.mo.ManagedEntity; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List;
import com.vmware.vim25.mo.*; import java.rmi.*; import java.util.*;
[ "com.vmware.vim25", "java.rmi", "java.util" ]
com.vmware.vim25; java.rmi; java.util;
303,740
protected IModel<String> getCaptionModel() { final String defaultCaption = new StringResourceModel("exdocfield.caption", this, null) .setDefaultValue(PluginConstants.DEFAULT_FIELD_CAPTION).getString(); String caption = getPluginConfig().getString("caption", defaultCaption); String captionKey = caption; return new StringResourceModel(captionKey, this, null).setDefaultValue(caption); }
IModel<String> function() { final String defaultCaption = new StringResourceModel(STR, this, null) .setDefaultValue(PluginConstants.DEFAULT_FIELD_CAPTION).getString(); String caption = getPluginConfig().getString(STR, defaultCaption); String captionKey = caption; return new StringResourceModel(captionKey, this, null).setDefaultValue(caption); }
/** * Returns the field caption label. * @return the field caption label */
Returns the field caption label
getCaptionModel
{ "repo_name": "onehippo-forge/external-document-picker", "path": "fieldpicker/src/main/java/org/onehippo/forge/exdocpicker/impl/field/ExternalDocumentFieldSelectorPlugin.java", "license": "apache-2.0", "size": 22123 }
[ "org.apache.wicket.model.IModel", "org.apache.wicket.model.StringResourceModel", "org.onehippo.forge.exdocpicker.api.PluginConstants" ]
import org.apache.wicket.model.IModel; import org.apache.wicket.model.StringResourceModel; import org.onehippo.forge.exdocpicker.api.PluginConstants;
import org.apache.wicket.model.*; import org.onehippo.forge.exdocpicker.api.*;
[ "org.apache.wicket", "org.onehippo.forge" ]
org.apache.wicket; org.onehippo.forge;
1,196,598
public static JsonArray selectToJsonArrayOfObjects(String sql, Map<String,Map<String,String>> lookupMaps) throws Exception { try (JdbcSession tuple = Global.getInstance().getDatabaseManager().executeSqlDirect(null, sql)) { // Convert ResultSet into JSON return JsonHelper.toArrayOfObjects(tuple.getResultSet(), -1, lookupMaps); } }
static JsonArray function(String sql, Map<String,Map<String,String>> lookupMaps) throws Exception { try (JdbcSession tuple = Global.getInstance().getDatabaseManager().executeSqlDirect(null, sql)) { return JsonHelper.toArrayOfObjects(tuple.getResultSet(), -1, lookupMaps); } }
/** * Execute simple SQL query and convert result to JsonArray * * @param sql statement * @param lookupMaps column to Map used to do lookup/replace on the data * @return JsonArray or null if something bad happened * @throws Exception if fails to select data */
Execute simple SQL query and convert result to JsonArray
selectToJsonArrayOfObjects
{ "repo_name": "achacha/SomeWebCardGame", "path": "src/main/java/org/achacha/base/db/DatabaseHelper.java", "license": "mit", "size": 10188 }
[ "com.google.gson.JsonArray", "java.util.Map", "org.achacha.base.global.Global", "org.achacha.base.json.JsonHelper" ]
import com.google.gson.JsonArray; import java.util.Map; import org.achacha.base.global.Global; import org.achacha.base.json.JsonHelper;
import com.google.gson.*; import java.util.*; import org.achacha.base.global.*; import org.achacha.base.json.*;
[ "com.google.gson", "java.util", "org.achacha.base" ]
com.google.gson; java.util; org.achacha.base;
502,038
protected IUndoContext getUndoContext() { return Adapters.adapt(ResourcesPlugin.getWorkspace(), IUndoContext.class); }
IUndoContext function() { return Adapters.adapt(ResourcesPlugin.getWorkspace(), IUndoContext.class); }
/** * Return the undo context associated with operations performed in this view. By default, return * the workspace undo context. Subclasses should override if a more specific undo context should * be used. * * @since 3.7 */
Return the undo context associated with operations performed in this view. By default, return the workspace undo context. Subclasses should override if a more specific undo context should be used
getUndoContext
{ "repo_name": "elucash/eclipse-oxygen", "path": "org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java", "license": "epl-1.0", "size": 48948 }
[ "org.eclipse.core.commands.operations.IUndoContext", "org.eclipse.core.resources.ResourcesPlugin", "org.eclipse.core.runtime.Adapters" ]
import org.eclipse.core.commands.operations.IUndoContext; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.commands.operations.*; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.*;
[ "org.eclipse.core" ]
org.eclipse.core;
1,798,685
public boolean getBoolean(@NonNull String name) throws JSONException { Object object = get(name); Boolean result = JSON.toBoolean(object); if (result == null) { throw JSON.typeMismatch(name, object, "boolean"); } return result; }
boolean function(@NonNull String name) throws JSONException { Object object = get(name); Boolean result = JSON.toBoolean(object); if (result == null) { throw JSON.typeMismatch(name, object, STR); } return result; }
/** * Returns the value mapped by {@code name} if it exists and is a boolean or * can be coerced to a boolean, or throws otherwise. * * @throws JSONException if the mapping doesn't exist or cannot be coerced * to a boolean. */
Returns the value mapped by name if it exists and is a boolean or can be coerced to a boolean, or throws otherwise
getBoolean
{ "repo_name": "smartdevicelink/sdl_android", "path": "javaSE/javaSE/src/main/java/org/json/JSONObject.java", "license": "bsd-3-clause", "size": 30612 }
[ "androidx.annotation.NonNull" ]
import androidx.annotation.NonNull;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
457,292
public Builder setMetadata(@Nullable Metadata metadata) { this.metadata = metadata; return this; } // Container specific.
Builder function(@Nullable Metadata metadata) { this.metadata = metadata; return this; }
/** * Sets {@link Format#metadata}. The default value is {@code null}. * * @param metadata The {@link Format#metadata}. * @return The builder. */
Sets <code>Format#metadata</code>. The default value is null
setMetadata
{ "repo_name": "androidx/media", "path": "libraries/common/src/main/java/androidx/media3/common/Format.java", "license": "apache-2.0", "size": 58093 }
[ "androidx.annotation.Nullable" ]
import androidx.annotation.Nullable;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
1,564,820
public void addParameterMapping(ParameterMapping mapping) { parameterMappings.add(mapping); }
void function(ParameterMapping mapping) { parameterMappings.add(mapping); }
/** * Adds the parameter mapping. * * @param mapping * the mapping */
Adds the parameter mapping
addParameterMapping
{ "repo_name": "hazendaz/mybatis-2", "path": "src/main/java/com/ibatis/sqlmap/engine/mapping/sql/dynamic/elements/SqlTagContext.java", "license": "apache-2.0", "size": 7670 }
[ "com.ibatis.sqlmap.engine.mapping.parameter.ParameterMapping" ]
import com.ibatis.sqlmap.engine.mapping.parameter.ParameterMapping;
import com.ibatis.sqlmap.engine.mapping.parameter.*;
[ "com.ibatis.sqlmap" ]
com.ibatis.sqlmap;
1,238,722
public void setEventListeners(List<EventListener> eventListeners) { this.eventListeners.addAll(eventListeners); }
void function(List<EventListener> eventListeners) { this.eventListeners.addAll(eventListeners); }
/** * Registers a {@link EventListener} for the mapper. * <p> * By default, no listeners are registered. * * @param eventListeners listeners to be registered for the mapper. */
Registers a <code>EventListener</code> for the mapper. By default, no listeners are registered
setEventListeners
{ "repo_name": "DozerMapper/dozer", "path": "dozer-integrations/dozer-spring-support/dozer-spring4/src/main/java/com/github/dozermapper/spring/DozerBeanMapperFactoryBean.java", "license": "apache-2.0", "size": 8166 }
[ "com.github.dozermapper.core.events.EventListener", "java.util.List" ]
import com.github.dozermapper.core.events.EventListener; import java.util.List;
import com.github.dozermapper.core.events.*; import java.util.*;
[ "com.github.dozermapper", "java.util" ]
com.github.dozermapper; java.util;
408,799
private Scope fromDTOToScope(ScopeDTO scopeDTO) { Scope scope = new Scope(); scope.setName(scopeDTO.getDisplayName()); scope.setKey(scopeDTO.getName()); scope.setDescription(scopeDTO.getDescription()); scope.setRoles((scopeDTO.getBindings() != null && !scopeDTO.getBindings().isEmpty()) ? String.join(",", scopeDTO.getBindings()) : StringUtils.EMPTY); return scope; }
Scope function(ScopeDTO scopeDTO) { Scope scope = new Scope(); scope.setName(scopeDTO.getDisplayName()); scope.setKey(scopeDTO.getName()); scope.setDescription(scopeDTO.getDescription()); scope.setRoles((scopeDTO.getBindings() != null && !scopeDTO.getBindings().isEmpty()) ? String.join(",", scopeDTO.getBindings()) : StringUtils.EMPTY); return scope; }
/** * Get Scope object from ScopeDTO response received from authorization server. * * @param scopeDTO ScopeDTO response * @return Scope model object */
Get Scope object from ScopeDTO response received from authorization server
fromDTOToScope
{ "repo_name": "jaadds/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/AMDefaultKeyManagerImpl.java", "license": "apache-2.0", "size": 48794 }
[ "org.apache.commons.lang3.StringUtils", "org.wso2.carbon.apimgt.api.model.Scope", "org.wso2.carbon.apimgt.impl.dto.ScopeDTO" ]
import org.apache.commons.lang3.StringUtils; import org.wso2.carbon.apimgt.api.model.Scope; import org.wso2.carbon.apimgt.impl.dto.ScopeDTO;
import org.apache.commons.lang3.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dto.*;
[ "org.apache.commons", "org.wso2.carbon" ]
org.apache.commons; org.wso2.carbon;
2,803,849
int updateByExampleSelective(@Param("record") RelayEmailNotification record, @Param("example") RelayEmailNotificationExample example);
int updateByExampleSelective(@Param(STR) RelayEmailNotification record, @Param(STR) RelayEmailNotificationExample example);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table s_relay_email_notification * * @mbg.generated Sat Feb 09 11:42:26 CST 2019 */
This method was generated by MyBatis Generator. This method corresponds to the database table s_relay_email_notification
updateByExampleSelective
{ "repo_name": "esofthead/mycollab", "path": "mycollab-services/src/main/java/com/mycollab/common/dao/RelayEmailNotificationMapper.java", "license": "agpl-3.0", "size": 5365 }
[ "com.mycollab.common.domain.RelayEmailNotification", "com.mycollab.common.domain.RelayEmailNotificationExample", "org.apache.ibatis.annotations.Param" ]
import com.mycollab.common.domain.RelayEmailNotification; import com.mycollab.common.domain.RelayEmailNotificationExample; import org.apache.ibatis.annotations.Param;
import com.mycollab.common.domain.*; import org.apache.ibatis.annotations.*;
[ "com.mycollab.common", "org.apache.ibatis" ]
com.mycollab.common; org.apache.ibatis;
712,315
public Builder addExpand(String element) { if (this.expand == null) { this.expand = new ArrayList<>(); } this.expand.add(element); return this; }
Builder function(String element) { if (this.expand == null) { this.expand = new ArrayList<>(); } this.expand.add(element); return this; }
/** * Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and * subsequent calls adds additional elements to the original list. See {@link * ValueListRetrieveParams#expand} for the field documentation. */
Add an element to `expand` list. A list is initialized for the first `add/addAll` call, and subsequent calls adds additional elements to the original list. See <code>ValueListRetrieveParams#expand</code> for the field documentation
addExpand
{ "repo_name": "stripe/stripe-java", "path": "src/main/java/com/stripe/param/radar/ValueListRetrieveParams.java", "license": "mit", "size": 3413 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
2,683,623
@Test public void testPublicCloneable() { StandardCategorySeriesLabelGenerator g1 = new StandardCategorySeriesLabelGenerator("{1}"); assertTrue(g1 instanceof PublicCloneable); }
void function() { StandardCategorySeriesLabelGenerator g1 = new StandardCategorySeriesLabelGenerator("{1}"); assertTrue(g1 instanceof PublicCloneable); }
/** * Check to ensure that this class implements PublicCloneable. */
Check to ensure that this class implements PublicCloneable
testPublicCloneable
{ "repo_name": "oskopek/jfreechart-fse", "path": "src/test/java/org/jfree/chart/labels/StandardCategorySeriesLabelGeneratorTest.java", "license": "lgpl-2.1", "size": 5641 }
[ "org.jfree.chart.util.PublicCloneable", "org.junit.Assert" ]
import org.jfree.chart.util.PublicCloneable; import org.junit.Assert;
import org.jfree.chart.util.*; import org.junit.*;
[ "org.jfree.chart", "org.junit" ]
org.jfree.chart; org.junit;
746,000
public Port<X> on(@Nullable In<? super X> i) { this.in = i; return this; }
Port<X> function(@Nullable In<? super X> i) { this.in = i; return this; }
/** * set the input handler */
set the input handler
on
{ "repo_name": "automenta/narchy", "path": "ui/src/main/java/spacegraph/space2d/widget/port/Port.java", "license": "agpl-3.0", "size": 7847 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,215,124
protected ScrollableGridDisplay constructDisplay( int viewingWidth, int viewingHeight, int minCellSize, Color bgColor) { return new ScrollableGridDisplay(viewingWidth, viewingHeight, minCellSize, bgColor); } // methods that access this object's state, including methods // required by the GridDisplay interface
ScrollableGridDisplay function( int viewingWidth, int viewingHeight, int minCellSize, Color bgColor) { return new ScrollableGridDisplay(viewingWidth, viewingHeight, minCellSize, bgColor); }
/** Constructs the grid display at the heart of the graphical * user interface. Should be redefined in subclasses that wish * to use a subclass of <code>ScrollableGridDisplay</code> (for * example, to modify the way tool tips are displayed, or some * other aspect of the scrollable display). * @param viewingWidth the width of the viewing area * @param viewingHeight the height of the viewing area * @param minCellSize minimum grid cell side length * @param bgColor color to paint background of grid * @return a scrollable grid display **/
Constructs the grid display at the heart of the graphical user interface. Should be redefined in subclasses that wish to use a subclass of <code>ScrollableGridDisplay</code> (for example, to modify the way tool tips are displayed, or some other aspect of the scrollable display)
constructDisplay
{ "repo_name": "AlyceBrady/GridPackage", "path": "edu/kzoo/grid/gui/GridAppFrame.java", "license": "gpl-3.0", "size": 34161 }
[ "edu.kzoo.grid.display.ScrollableGridDisplay", "java.awt.Color" ]
import edu.kzoo.grid.display.ScrollableGridDisplay; import java.awt.Color;
import edu.kzoo.grid.display.*; import java.awt.*;
[ "edu.kzoo.grid", "java.awt" ]
edu.kzoo.grid; java.awt;
1,367,647
@IBAction private void showResetMenu(UILongPressGestureRecognizer gestureRecognizer) { if (gestureRecognizer.getState() == UIGestureRecognizerState.Began) { becomeFirstResponder(); pieceForReset = gestureRecognizer.getView();
void function(UILongPressGestureRecognizer gestureRecognizer) { if (gestureRecognizer.getState() == UIGestureRecognizerState.Began) { becomeFirstResponder(); pieceForReset = gestureRecognizer.getView();
/** * Display a menu with a single item to allow the piece's transform to be * reset. */
Display a menu with a single item to allow the piece's transform to be reset
showResetMenu
{ "repo_name": "robovm/robovm-samples", "path": "ios/touchesgesture/src/main/java/org/robovm/samples/touchesgesture/ui/APLViewController.java", "license": "apache-2.0", "size": 9715 }
[ "org.robovm.apple.uikit.UIGestureRecognizerState", "org.robovm.apple.uikit.UILongPressGestureRecognizer" ]
import org.robovm.apple.uikit.UIGestureRecognizerState; import org.robovm.apple.uikit.UILongPressGestureRecognizer;
import org.robovm.apple.uikit.*;
[ "org.robovm.apple" ]
org.robovm.apple;
2,439,437
public Window getWindow() { return window; }
Window function() { return window; }
/** * Return the window. * * @return the window. */
Return the window
getWindow
{ "repo_name": "Stratio/stratio-connector-decision", "path": "connector-decision/src/main/java/com/stratio/connector/decision/core/engine/query/ConnectorQueryData.java", "license": "apache-2.0", "size": 3695 }
[ "com.stratio.crossdata.common.logicalplan.Window" ]
import com.stratio.crossdata.common.logicalplan.Window;
import com.stratio.crossdata.common.logicalplan.*;
[ "com.stratio.crossdata" ]
com.stratio.crossdata;
1,119,601
Promise<StackFrameDumpDto> getStackFrameDump(String id);
Promise<StackFrameDumpDto> getStackFrameDump(String id);
/** * Gets dump of fields and local variables of the current frame. * * @param id debug session id */
Gets dump of fields and local variables of the current frame
getStackFrameDump
{ "repo_name": "sudaraka94/che", "path": "ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/debug/DebuggerServiceClient.java", "license": "epl-1.0", "size": 4500 }
[ "org.eclipse.che.api.debug.shared.dto.StackFrameDumpDto", "org.eclipse.che.api.promises.client.Promise" ]
import org.eclipse.che.api.debug.shared.dto.StackFrameDumpDto; import org.eclipse.che.api.promises.client.Promise;
import org.eclipse.che.api.debug.shared.dto.*; import org.eclipse.che.api.promises.client.*;
[ "org.eclipse.che" ]
org.eclipse.che;
2,907,178
@WebMethod(operationName = "getCurrentRouteNodeNames") @XmlElementWrapper(name = "nodes", required = true) @XmlElement(name = "node", required = false) @WebResult(name = "nodes") List<String> getCurrentRouteNodeNames(@WebParam(name = "documentId") String documentId) throws RiceIllegalArgumentException;
@WebMethod(operationName = STR) @XmlElementWrapper(name = "nodes", required = true) @XmlElement(name = "node", required = false) @WebResult(name = "nodes") List<String> getCurrentRouteNodeNames(@WebParam(name = STR) String documentId) throws RiceIllegalArgumentException;
/** * Gets a list of current route node names for a {@link Document} with the given documentId. Will never return null but an empty collection to indicate no results. * * @param documentId the unique id of a Document * * @return an unmodifiable list of current route node names for the {@link Document} with the given documentId * * @throws RiceIllegalArgumentException if {@code documentId} is null or blank * * @since rice 2.2 */
Gets a list of current route node names for a <code>Document</code> with the given documentId. Will never return null but an empty collection to indicate no results
getCurrentRouteNodeNames
{ "repo_name": "bhutchinson/rice", "path": "rice-middleware/kew/api/src/main/java/org/kuali/rice/kew/api/document/WorkflowDocumentService.java", "license": "apache-2.0", "size": 33728 }
[ "java.util.List", "javax.jws.WebMethod", "javax.jws.WebParam", "javax.jws.WebResult", "javax.xml.bind.annotation.XmlElement", "javax.xml.bind.annotation.XmlElementWrapper", "org.kuali.rice.core.api.exception.RiceIllegalArgumentException" ]
import java.util.List; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import org.kuali.rice.core.api.exception.RiceIllegalArgumentException;
import java.util.*; import javax.jws.*; import javax.xml.bind.annotation.*; import org.kuali.rice.core.api.exception.*;
[ "java.util", "javax.jws", "javax.xml", "org.kuali.rice" ]
java.util; javax.jws; javax.xml; org.kuali.rice;
772,877
protected void sequence_OperatorMultiply(EObject context, OperatorMultiply semanticObject) { genericSequencer.createSequence(context, semanticObject); }
void function(EObject context, OperatorMultiply semanticObject) { genericSequencer.createSequence(context, semanticObject); }
/** * Constraint: * (multiply='*' | divide='/' | modulo='%') */
Constraint: (multiply='*' | divide='/' | modulo='%')
sequence_OperatorMultiply
{ "repo_name": "niksavis/mm-dsl", "path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java", "license": "epl-1.0", "size": 190481 }
[ "org.eclipse.emf.ecore.EObject", "org.xtext.nv.dsl.mMDSL.OperatorMultiply" ]
import org.eclipse.emf.ecore.EObject; import org.xtext.nv.dsl.mMDSL.OperatorMultiply;
import org.eclipse.emf.ecore.*; import org.xtext.nv.dsl.*;
[ "org.eclipse.emf", "org.xtext.nv" ]
org.eclipse.emf; org.xtext.nv;
1,125,891
public static Date parse(String date) { try { int offset = 0; // extract year int year = parseInt(date, offset, offset += 4); checkOffset(date, offset, '-'); // extract month int month = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, '-'); // extract day int day = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, 'T'); // extract hours, minutes, seconds and milliseconds int hour = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, ':'); int minutes = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, ':'); int seconds = parseInt(date, offset += 1, offset += 2); Calendar calendar = new GregorianCalendar(TIMEZONE_GMT); calendar.setLenient(false); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, seconds); return calendar.getTime(); } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException("Failed to parse date " + date, e); } catch (NumberFormatException e) { throw new IllegalArgumentException("Failed to parse date " + date, e); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Failed to parse date " + date, e); } }
static Date function(String date) { try { int offset = 0; int year = parseInt(date, offset, offset += 4); checkOffset(date, offset, '-'); int month = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, '-'); int day = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, 'T'); int hour = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, ':'); int minutes = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, ':'); int seconds = parseInt(date, offset += 1, offset += 2); Calendar calendar = new GregorianCalendar(TIMEZONE_GMT); calendar.setLenient(false); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, seconds); return calendar.getTime(); } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException(STR + date, e); } catch (NumberFormatException e) { throw new IllegalArgumentException(STR + date, e); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(STR + date, e); } }
/** * Parse a date from ISO-8601 formatted string. It expects a format yyyy-MM-ddThh:mm:ss * * @param date ISO string to parse in the appropriate format. * @return the parsed date * @throws IllegalArgumentException if the date is not in the appropriate format */
Parse a date from ISO-8601 formatted string. It expects a format yyyy-MM-ddThh:mm:ss
parse
{ "repo_name": "HKMOpen/VendingMachine", "path": "vendSDK/vendingmachinesdk/src/main/java/com/hkmvend/sdk/gson/Iso8601DateFormat.java", "license": "mit", "size": 6297 }
[ "java.util.Calendar", "java.util.Date", "java.util.GregorianCalendar" ]
import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar;
import java.util.*;
[ "java.util" ]
java.util;
950,712
@Test(groups = "ticket:3119") public void testDeleteImageInOtherUserDatasetRWRW() throws Exception { EventContext ctx = newUserAndGroup("rwrw--"); Dataset dataset = (Dataset) iUpdate.saveAndReturnObject( mmFactory.simpleDatasetData().asIObject()); disconnect(); EventContext user2Ctx = newUserInGroup(ctx); loginUser(user2Ctx); //create new user. Image image = (Image) iUpdate.saveAndReturnObject( mmFactory.createImage()); DatasetImageLink link = new DatasetImageLinkI(); link.setChild((Image) image.proxy()); link.setParent((Dataset) dataset.proxy()); iUpdate.saveAndReturnObject(link); //Now try to delete the project. delete(client, new DeleteCommand( DeleteServiceTest.REF_IMAGE, image.getId().getValue(), null)); assertDoesNotExist(image); assertExists(dataset); }
@Test(groups = STR) void function() throws Exception { EventContext ctx = newUserAndGroup(STR); Dataset dataset = (Dataset) iUpdate.saveAndReturnObject( mmFactory.simpleDatasetData().asIObject()); disconnect(); EventContext user2Ctx = newUserInGroup(ctx); loginUser(user2Ctx); Image image = (Image) iUpdate.saveAndReturnObject( mmFactory.createImage()); DatasetImageLink link = new DatasetImageLinkI(); link.setChild((Image) image.proxy()); link.setParent((Dataset) dataset.proxy()); iUpdate.saveAndReturnObject(link); delete(client, new DeleteCommand( DeleteServiceTest.REF_IMAGE, image.getId().getValue(), null)); assertDoesNotExist(image); assertExists(dataset); }
/** * Test to delete an image in collaborative RWRW-- group. * The image is linked to another user's dataset. The image was added * by the owner of the image. * None of the users are owner of the group. * @throws Exception Thrown if an error occurred. */
Test to delete an image in collaborative RWRW-- group. The image is linked to another user's dataset. The image was added by the owner of the image. None of the users are owner of the group
testDeleteImageInOtherUserDatasetRWRW
{ "repo_name": "joshmoore/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/DeleteServicePermissionsTest.java", "license": "gpl-2.0", "size": 29297 }
[ "org.testng.annotations.Test" ]
import org.testng.annotations.Test;
import org.testng.annotations.*;
[ "org.testng.annotations" ]
org.testng.annotations;
2,800,122
public static Constraints basicConstraintsFromGeometry( final Geometry geometry ) { // Get the envelope of the geometry being held final Envelope env = geometry.getEnvelopeInternal(); return basicConstraintsFromEnvelope(env); }
static Constraints function( final Geometry geometry ) { final Envelope env = geometry.getEnvelopeInternal(); return basicConstraintsFromEnvelope(env); }
/** * This utility method will convert a JTS geometry to contraints that can be * used in a GeoWave query. * * @return Constraints as a mapping of NumericData objects representing * ranges for a latitude dimension and a longitude dimension */
This utility method will convert a JTS geometry to contraints that can be used in a GeoWave query
basicConstraintsFromGeometry
{ "repo_name": "state-hiu/geowave", "path": "geowave-store/src/main/java/mil/nga/giat/geowave/store/GeometryUtils.java", "license": "apache-2.0", "size": 6547 }
[ "com.vividsolutions.jts.geom.Envelope", "com.vividsolutions.jts.geom.Geometry", "mil.nga.giat.geowave.store.query.BasicQuery" ]
import com.vividsolutions.jts.geom.Envelope; import com.vividsolutions.jts.geom.Geometry; import mil.nga.giat.geowave.store.query.BasicQuery;
import com.vividsolutions.jts.geom.*; import mil.nga.giat.geowave.store.query.*;
[ "com.vividsolutions.jts", "mil.nga.giat" ]
com.vividsolutions.jts; mil.nga.giat;
1,304,352
@Test public void testSelectOrderByDescending() { final QueryApi query = session.createQueryApi(); query.select().allTypes().onWhere().selectEnd().where() .type(JavaClass.class.getName()).each().property("caption") .contains().value("Set").typeEnd().whereEnd().orderBy() .type(JavaClass.class.getName()).property("caption") .descending().orderByEnd(); final QueryResult result = query.execute(sortMode, printInfo); final List<Node> nodes = result.getNodes(); final NodeWrapper[] wrappers = wrapNodes(nodes);
void function() { final QueryApi query = session.createQueryApi(); query.select().allTypes().onWhere().selectEnd().where() .type(JavaClass.class.getName()).each().property(STR) .contains().value("Set").typeEnd().whereEnd().orderBy() .type(JavaClass.class.getName()).property(STR) .descending().orderByEnd(); final QueryResult result = query.execute(sortMode, printInfo); final List<Node> nodes = result.getNodes(); final NodeWrapper[] wrappers = wrapNodes(nodes);
/** * Test select order by descending. */
Test select order by descending
testSelectOrderByDescending
{ "repo_name": "porcelli/OpenSpotLight", "path": "osl-graph/osl-graph-core/src/test/java/org/openspotlight/graph/query/SLGraphQueryTest.java", "license": "lgpl-3.0", "size": 227396 }
[ "java.util.List", "org.openspotlight.graph.Node", "org.openspotlight.graph.test.domain.node.JavaClass" ]
import java.util.List; import org.openspotlight.graph.Node; import org.openspotlight.graph.test.domain.node.JavaClass;
import java.util.*; import org.openspotlight.graph.*; import org.openspotlight.graph.test.domain.node.*;
[ "java.util", "org.openspotlight.graph" ]
java.util; org.openspotlight.graph;
2,769,161
private void createOutputJar() throws IOException { // Create the uninstaller directory String dirPath = IoHelper.translatePath(installData.getInfo().getUninstallerPath(), installData.getVariables()); String jarPath = dirPath + File.separator + installData.getInfo().getUninstallerName(); File dir = new File(dirPath); if (!dir.exists() && !dir.mkdirs()) { throw new IOException("Failed to create output path: " + dir); } // Log the uninstaller deletion information uninstallData.setUninstallerJarFilename(jarPath); uninstallData.setUninstallerPath(dirPath); // Create the jar file jarStream = new FileOutputStream(jarPath); jar = new JarOutputStream(new BufferedOutputStream(jarStream)); jar.setLevel(9); uninstallData.addFile(jarPath, true); }
void function() throws IOException { String dirPath = IoHelper.translatePath(installData.getInfo().getUninstallerPath(), installData.getVariables()); String jarPath = dirPath + File.separator + installData.getInfo().getUninstallerName(); File dir = new File(dirPath); if (!dir.exists() && !dir.mkdirs()) { throw new IOException(STR + dir); } uninstallData.setUninstallerJarFilename(jarPath); uninstallData.setUninstallerPath(dirPath); jarStream = new FileOutputStream(jarPath); jar = new JarOutputStream(new BufferedOutputStream(jarStream)); jar.setLevel(9); uninstallData.addFile(jarPath, true); }
/** * Creates the uninstaller jar file. * * @throws IOException for any I/O error */
Creates the uninstaller jar file
createOutputJar
{ "repo_name": "codehaus/izpack", "path": "izpack-installer/src/main/java/com/izforge/izpack/installer/data/UninstallDataWriter.java", "license": "apache-2.0", "size": 17388 }
[ "com.izforge.izpack.util.IoHelper", "java.io.BufferedOutputStream", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.util.jar.JarOutputStream" ]
import com.izforge.izpack.util.IoHelper; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.jar.JarOutputStream;
import com.izforge.izpack.util.*; import java.io.*; import java.util.jar.*;
[ "com.izforge.izpack", "java.io", "java.util" ]
com.izforge.izpack; java.io; java.util;
2,322,317
public final static Observable<WatchEvent<?>> from(WatchService watchService, Scheduler scheduler, long pollDuration, TimeUnit pollDurationUnit, long pollInterval, TimeUnit pollIntervalUnit, BackpressureStrategy backpressureStrategy) { Preconditions.checkNotNull(watchService); Preconditions.checkNotNull(scheduler); Preconditions.checkNotNull(pollDurationUnit); Preconditions.checkNotNull(backpressureStrategy); Observable<WatchEvent<?>> o = Observable .create(new OnSubscribeWatchServiceEvents(watchService, scheduler, pollDuration, pollDurationUnit, pollInterval, pollIntervalUnit)); if (backpressureStrategy == BackpressureStrategy.BUFFER) { return o.onBackpressureBuffer(); } else if (backpressureStrategy == BackpressureStrategy.DROP) return o.onBackpressureDrop(); else if (backpressureStrategy == BackpressureStrategy.LATEST) return o.onBackpressureLatest(); else throw new RuntimeException("unrecognized backpressureStrategy " + backpressureStrategy); }
final static Observable<WatchEvent<?>> function(WatchService watchService, Scheduler scheduler, long pollDuration, TimeUnit pollDurationUnit, long pollInterval, TimeUnit pollIntervalUnit, BackpressureStrategy backpressureStrategy) { Preconditions.checkNotNull(watchService); Preconditions.checkNotNull(scheduler); Preconditions.checkNotNull(pollDurationUnit); Preconditions.checkNotNull(backpressureStrategy); Observable<WatchEvent<?>> o = Observable .create(new OnSubscribeWatchServiceEvents(watchService, scheduler, pollDuration, pollDurationUnit, pollInterval, pollIntervalUnit)); if (backpressureStrategy == BackpressureStrategy.BUFFER) { return o.onBackpressureBuffer(); } else if (backpressureStrategy == BackpressureStrategy.DROP) return o.onBackpressureDrop(); else if (backpressureStrategy == BackpressureStrategy.LATEST) return o.onBackpressureLatest(); else throw new RuntimeException(STR + backpressureStrategy); }
/** * Returns an {@link Observable} of {@link WatchEvent}s from a * {@link WatchService}. * * @param watchService * WatchService to generate events from * @param scheduler * schedules polls of the watchService * @param pollDuration * duration of each poll * @param pollDurationUnit * time unit for the duration of each poll * @param pollInterval * interval between polls of the watchService * @param pollIntervalUnit * time unit for the interval between polls * @param backpressureStrategy * backpressures strategy to apply * @return an observable of WatchEvents from watchService */
Returns an <code>Observable</code> of <code>WatchEvent</code>s from a <code>WatchService</code>
from
{ "repo_name": "sparty02/rxjava-file", "path": "src/main/java/com/github/davidmoten/rx/FileObservable.java", "license": "apache-2.0", "size": 24650 }
[ "com.github.davidmoten.guavamini.Preconditions", "com.github.davidmoten.rx.internal.operators.OnSubscribeWatchServiceEvents", "com.github.davidmoten.rx.util.BackpressureStrategy", "java.nio.file.WatchEvent", "java.nio.file.WatchService", "java.util.concurrent.TimeUnit" ]
import com.github.davidmoten.guavamini.Preconditions; import com.github.davidmoten.rx.internal.operators.OnSubscribeWatchServiceEvents; import com.github.davidmoten.rx.util.BackpressureStrategy; import java.nio.file.WatchEvent; import java.nio.file.WatchService; import java.util.concurrent.TimeUnit;
import com.github.davidmoten.guavamini.*; import com.github.davidmoten.rx.internal.operators.*; import com.github.davidmoten.rx.util.*; import java.nio.file.*; import java.util.concurrent.*;
[ "com.github.davidmoten", "java.nio", "java.util" ]
com.github.davidmoten; java.nio; java.util;
431,695
@SuppressWarnings("unchecked") public static void mergeArrayIntoCollection(Object array, Collection collection) { if (collection == null) { throw new IllegalArgumentException("Collection must not be null"); } Object[] arr = ObjectUtils.toObjectArray(array); for (Object elem : arr) { collection.add(elem); } }
@SuppressWarnings(STR) static void function(Object array, Collection collection) { if (collection == null) { throw new IllegalArgumentException(STR); } Object[] arr = ObjectUtils.toObjectArray(array); for (Object elem : arr) { collection.add(elem); } }
/** * Merge the given array into the given Collection. * * @param array * the array to merge (may be <code>null</code>) * @param collection * the target Collection to merge the array into */
Merge the given array into the given Collection
mergeArrayIntoCollection
{ "repo_name": "lewjeen/framework", "path": "common-utils/src/main/java/com/mocha/common/utils/CollectionUtils.java", "license": "unlicense", "size": 14767 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,778,429
public void createDeleteOverlay(Feed feed) { VBox vbox = new VBox(); overlay.getChildren().setAll(vbox); Button delete = new Button("Delete Feed"); Button cancel = new Button("Cancel"); vbox.getChildren().add(new Label("Are you sure to delete Feed ?")); vbox.getChildren().add(new HBox(delete, cancel)); delete.setOnAction(evt -> { feedingList.remove(feed); overlayProperty.set(false); }); cancel.setOnAction(evt -> { feed.deleteProperty().set(false); overlayProperty.set(false); }); getChildren().remove(overlay); getChildren().add(overlay); overlayProperty.set(true); }
void function(Feed feed) { VBox vbox = new VBox(); overlay.getChildren().setAll(vbox); Button delete = new Button(STR); Button cancel = new Button(STR); vbox.getChildren().add(new Label(STR)); vbox.getChildren().add(new HBox(delete, cancel)); delete.setOnAction(evt -> { feedingList.remove(feed); overlayProperty.set(false); }); cancel.setOnAction(evt -> { feed.deleteProperty().set(false); overlayProperty.set(false); }); getChildren().remove(overlay); getChildren().add(overlay); overlayProperty.set(true); }
/** * Creates an overlay to delete the given feed. * * @param feed */
Creates an overlay to delete the given feed
createDeleteOverlay
{ "repo_name": "facewindu/BreastFeedingBuddyFX", "path": "src/main/java/org/facewindu/breastfeedingbuddy/BoobsManager.java", "license": "mit", "size": 11394 }
[ "org.facewindu.breastfeedingbuddy.model.Feed" ]
import org.facewindu.breastfeedingbuddy.model.Feed;
import org.facewindu.breastfeedingbuddy.model.*;
[ "org.facewindu.breastfeedingbuddy" ]
org.facewindu.breastfeedingbuddy;
2,681,375
boolean blockUntilBecomingActiveMaster() { boolean cleanSetOfActiveMaster = true; // Try to become the active master, watch if there is another master try { if (ZKUtil.setAddressAndWatch(this.watcher, this.watcher.masterAddressZNode, this.address)) { // We are the master, return this.clusterHasActiveMaster.set(true); LOG.info("Master=" + this.address); return cleanSetOfActiveMaster; } cleanSetOfActiveMaster = false; // There is another active master running elsewhere or this is a restart // and the master ephemeral node has not expired yet. this.clusterHasActiveMaster.set(true); HServerAddress currentMaster = ZKUtil.getDataAsAddress(this.watcher, this.watcher.masterAddressZNode); if (currentMaster != null && currentMaster.equals(this.address)) { LOG.info("Current master has this master's address, " + currentMaster + "; master was restarted? Waiting on znode to expire..."); // Hurry along the expiration of the znode. ZKUtil.deleteNode(this.watcher, this.watcher.masterAddressZNode); } else { LOG.info("Another master is the active master, " + currentMaster + "; waiting to become the next active master"); } } catch (KeeperException ke) { master.abort("Received an unexpected KeeperException, aborting", ke); return false; } synchronized (this.clusterHasActiveMaster) { while (this.clusterHasActiveMaster.get() && !this.master.isStopped()) { try { this.clusterHasActiveMaster.wait(); } catch (InterruptedException e) { // We expect to be interrupted when a master dies, will fall out if so LOG.debug("Interrupted waiting for master to die", e); } } if (this.master.isStopped()) { return cleanSetOfActiveMaster; } // Try to become active master again now that there is no active master blockUntilBecomingActiveMaster(); } return cleanSetOfActiveMaster; }
boolean blockUntilBecomingActiveMaster() { boolean cleanSetOfActiveMaster = true; try { if (ZKUtil.setAddressAndWatch(this.watcher, this.watcher.masterAddressZNode, this.address)) { this.clusterHasActiveMaster.set(true); LOG.info(STR + this.address); return cleanSetOfActiveMaster; } cleanSetOfActiveMaster = false; this.clusterHasActiveMaster.set(true); HServerAddress currentMaster = ZKUtil.getDataAsAddress(this.watcher, this.watcher.masterAddressZNode); if (currentMaster != null && currentMaster.equals(this.address)) { LOG.info(STR + currentMaster + STR); ZKUtil.deleteNode(this.watcher, this.watcher.masterAddressZNode); } else { LOG.info(STR + currentMaster + STR); } } catch (KeeperException ke) { master.abort(STR, ke); return false; } synchronized (this.clusterHasActiveMaster) { while (this.clusterHasActiveMaster.get() && !this.master.isStopped()) { try { this.clusterHasActiveMaster.wait(); } catch (InterruptedException e) { LOG.debug(STR, e); } } if (this.master.isStopped()) { return cleanSetOfActiveMaster; } blockUntilBecomingActiveMaster(); } return cleanSetOfActiveMaster; }
/** * Block until becoming the active master. * * Method blocks until there is not another active master and our attempt * to become the new active master is successful. * * This also makes sure that we are watching the master znode so will be * notified if another master dies. * @return True if no issue becoming active master else false if another * master was running or if some other problem (zookeeper, stop flag has been * set on this Master) */
Block until becoming the active master. Method blocks until there is not another active master and our attempt to become the new active master is successful. This also makes sure that we are watching the master znode so will be notified if another master dies
blockUntilBecomingActiveMaster
{ "repo_name": "NotBadPad/hadoop-hbase", "path": "src/main/java/org/apache/hadoop/hbase/master/ActiveMasterManager.java", "license": "apache-2.0", "size": 7380 }
[ "org.apache.hadoop.hbase.HServerAddress", "org.apache.hadoop.hbase.zookeeper.ZKUtil", "org.apache.zookeeper.KeeperException" ]
import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.zookeeper.KeeperException;
import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.zookeeper.*; import org.apache.zookeeper.*;
[ "org.apache.hadoop", "org.apache.zookeeper" ]
org.apache.hadoop; org.apache.zookeeper;
1,199,470
@Override public int hashCode() { int hash = 7; hash = 89 * hash + (this.shapeVisible ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.shape); hash = 89 * hash + Objects.hashCode(this.shapeLocation); hash = 89 * hash + Objects.hashCode(this.shapeAnchor); hash = 89 * hash + (this.shapeFilled ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.fillPaint); hash = 89 * hash + Objects.hashCode(this.fillPaintTransformer); hash = 89 * hash + (this.shapeOutlineVisible ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.outlinePaint); hash = 89 * hash + Objects.hashCode(this.outlineStroke); hash = 89 * hash + (this.lineVisible ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.line); hash = 89 * hash + Objects.hashCode(this.lineStroke); hash = 89 * hash + Objects.hashCode(this.linePaint); return hash; }
int function() { int hash = 7; hash = 89 * hash + (this.shapeVisible ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.shape); hash = 89 * hash + Objects.hashCode(this.shapeLocation); hash = 89 * hash + Objects.hashCode(this.shapeAnchor); hash = 89 * hash + (this.shapeFilled ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.fillPaint); hash = 89 * hash + Objects.hashCode(this.fillPaintTransformer); hash = 89 * hash + (this.shapeOutlineVisible ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.outlinePaint); hash = 89 * hash + Objects.hashCode(this.outlineStroke); hash = 89 * hash + (this.lineVisible ? 1 : 0); hash = 89 * hash + Objects.hashCode(this.line); hash = 89 * hash + Objects.hashCode(this.lineStroke); hash = 89 * hash + Objects.hashCode(this.linePaint); return hash; }
/** * Returns a hash code for this instance. * * @return A hash code. */
Returns a hash code for this instance
hashCode
{ "repo_name": "jfree/jfreechart", "path": "src/main/java/org/jfree/chart/legend/LegendGraphic.java", "license": "lgpl-2.1", "size": 22714 }
[ "java.util.Objects" ]
import java.util.Objects;
import java.util.*;
[ "java.util" ]
java.util;
1,580,820
public void handleContentOutlineSelection(ISelection selection) { if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); ArrayList<Object> selectionList = new ArrayList<Object>(); selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } // Set the selection to the widget. // selectionViewer.setSelection(new StructuredSelection(selectionList)); } } }
void function(ISelection selection) { if (selectionViewer != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { ArrayList<Object> selectionList = new ArrayList<Object>(); selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } } } }
/** * This deals with how we want selection in the outliner to affect the other views. * @generated */
This deals with how we want selection in the outliner to affect the other views
handleContentOutlineSelection
{ "repo_name": "parraman/micobs", "path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/library/mclevlibrary/presentation/mclevlibraryEditor.java", "license": "epl-1.0", "size": 43392 }
[ "java.util.ArrayList", "java.util.Iterator", "org.eclipse.jface.viewers.ISelection", "org.eclipse.jface.viewers.IStructuredSelection" ]
import java.util.ArrayList; import java.util.Iterator; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection;
import java.util.*; import org.eclipse.jface.viewers.*;
[ "java.util", "org.eclipse.jface" ]
java.util; org.eclipse.jface;
2,198,329
public Observable<ServiceResponse<DdosProtectionPlanInner>> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (ddosProtectionPlanName == null) { throw new IllegalArgumentException("Parameter ddosProtectionPlanName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); final String apiVersion = "2020-03-01"; Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, ddosProtectionPlanName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<DdosProtectionPlanInner>() { }.getType()); }
Observable<ServiceResponse<DdosProtectionPlanInner>> function(String resourceGroupName, String ddosProtectionPlanName, DdosProtectionPlanInner parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (ddosProtectionPlanName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); } Validator.validate(parameters); final String apiVersion = STR; Observable<Response<ResponseBody>> observable = service.createOrUpdate(resourceGroupName, ddosProtectionPlanName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<DdosProtectionPlanInner>() { }.getType()); }
/** * Creates or updates a DDoS protection plan. * * @param resourceGroupName The name of the resource group. * @param ddosProtectionPlanName The name of the DDoS protection plan. * @param parameters Parameters supplied to the create or update operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Creates or updates a DDoS protection plan
createOrUpdateWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/DdosProtectionPlansInner.java", "license": "mit", "size": 66305 }
[ "com.google.common.reflect.TypeToken", "com.microsoft.rest.ServiceResponse", "com.microsoft.rest.Validator" ]
import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator;
import com.google.common.reflect.*; import com.microsoft.rest.*;
[ "com.google.common", "com.microsoft.rest" ]
com.google.common; com.microsoft.rest;
385,821