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
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public void build() { assert this.sd != null; synchronized (storage) { for (Map.Entry<String, List<StorageDirectory>> e : bpStorageDirMap.entrySet()) { final String bpid = e.getKey(); BlockPoolSliceStorage bpStorage = this.storage.bpStorageMap.get(bpid); assert bpStorage != null; for (StorageDirectory bpSd : e.getValue()) { bpStorage.addStorageDir(bpSd); } } storage.addStorageDir(sd); } } }
void function() { assert this.sd != null; synchronized (storage) { for (Map.Entry<String, List<StorageDirectory>> e : bpStorageDirMap.entrySet()) { final String bpid = e.getKey(); BlockPoolSliceStorage bpStorage = this.storage.bpStorageMap.get(bpid); assert bpStorage != null; for (StorageDirectory bpSd : e.getValue()) { bpStorage.addStorageDir(bpSd); } } storage.addStorageDir(sd); } } }
/** * Add loaded metadata of a data volume to {@link DataStorage}. */
Add loaded metadata of a data volume to <code>DataStorage</code>
build
{ "repo_name": "mapr/hadoop-common", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java", "license": "apache-2.0", "size": 53760 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,258,212
public void add(InputStream in) { IXMLElement data; try { IXMLParser parser = new XMLParser(); data = parser.parse(in); } catch (XMLException exception) { throw new ResourceException("Failed to read langpack stream", exception); } // We check the data if (!"langpack".equalsIgnoreCase(data.getElement().getLocalName())) { throw new ResourceException("Invalid IzPack XML langpack file"); } // We fill the Hashtable for (IXMLElement child : data.getChildren()) { String text = child.getContent(); if (text != null && !"".equals(text)) { put(child.getAttribute("id"), text.trim()); } else { put(child.getAttribute("id"), child.getAttribute("txt")); } } }
void function(InputStream in) { IXMLElement data; try { IXMLParser parser = new XMLParser(); data = parser.parse(in); } catch (XMLException exception) { throw new ResourceException(STR, exception); } if (!STR.equalsIgnoreCase(data.getElement().getLocalName())) { throw new ResourceException(STR); } for (IXMLElement child : data.getChildren()) { String text = child.getContent(); if (text != null && !STRidSTRidSTRtxt")); } } }
/** * Adds the contents of the given stream to the data base. The stream have to contain key value * pairs as declared by the DTD langpack.dtd. * * @param in an InputStream to read the translation from. * @throws ResourceException if the stream is not an IzPack langpack file or cannot be read */
Adds the contents of the given stream to the data base. The stream have to contain key value pairs as declared by the DTD langpack.dtd
add
{ "repo_name": "mtjandra/izpack", "path": "izpack-api/src/main/java/com/izforge/izpack/api/data/LocaleDatabase.java", "license": "apache-2.0", "size": 10499 }
[ "com.izforge.izpack.api.adaptator.IXMLElement", "com.izforge.izpack.api.adaptator.IXMLParser", "com.izforge.izpack.api.adaptator.XMLException", "com.izforge.izpack.api.adaptator.impl.XMLParser", "com.izforge.izpack.api.exception.ResourceException", "java.io.InputStream" ]
import com.izforge.izpack.api.adaptator.IXMLElement; import com.izforge.izpack.api.adaptator.IXMLParser; import com.izforge.izpack.api.adaptator.XMLException; import com.izforge.izpack.api.adaptator.impl.XMLParser; import com.izforge.izpack.api.exception.ResourceException; import java.io.InputStream;
import com.izforge.izpack.api.adaptator.*; import com.izforge.izpack.api.adaptator.impl.*; import com.izforge.izpack.api.exception.*; import java.io.*;
[ "com.izforge.izpack", "java.io" ]
com.izforge.izpack; java.io;
519,858
void setUOM(DomainMetadataType value);
void setUOM(DomainMetadataType value);
/** * Sets the value of the '{@link net.opengis.wcs11.AxisType#getUOM <em>UOM</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>UOM</em>' containment reference. * @see #getUOM() * @generated */
Sets the value of the '<code>net.opengis.wcs11.AxisType#getUOM UOM</code>' containment reference.
setUOM
{ "repo_name": "geotools/geotools", "path": "modules/ogc/net.opengis.wcs/src/net/opengis/wcs11/AxisType.java", "license": "lgpl-2.1", "size": 8806 }
[ "net.opengis.ows11.DomainMetadataType" ]
import net.opengis.ows11.DomainMetadataType;
import net.opengis.ows11.*;
[ "net.opengis.ows11" ]
net.opengis.ows11;
1,837,130
@Beta ParallelSetIterable<T> asParallel(ExecutorService executorService, int batchSize);
ParallelSetIterable<T> asParallel(ExecutorService executorService, int batchSize);
/** * Returns a parallel iterable of this SetIterable. * * @since 6.0 */
Returns a parallel iterable of this SetIterable
asParallel
{ "repo_name": "bhav0904/eclipse-collections", "path": "eclipse-collections-api/src/main/java/org/eclipse/collections/api/set/SetIterable.java", "license": "bsd-3-clause", "size": 5624 }
[ "java.util.concurrent.ExecutorService" ]
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
2,560,850
static public TGPostManagerInterface posts(){ return mInstance.getPostManager(); }
static TGPostManagerInterface function(){ return mInstance.getPostManager(); }
/** * Get posts manager * @return Posts manager */
Get posts manager
posts
{ "repo_name": "AutomatedPlayground/android_sdk", "path": "tapglue-android-sdk/src/main/java/com/tapglue/Tapglue.java", "license": "apache-2.0", "size": 11002 }
[ "com.tapglue.managers.TGPostManagerInterface" ]
import com.tapglue.managers.TGPostManagerInterface;
import com.tapglue.managers.*;
[ "com.tapglue.managers" ]
com.tapglue.managers;
516,994
public List findGPPPSEntries( PPSFilter filter ) { List resp = null; GPPPSQueryCmd cmd = null; try { resp = new ArrayList(); cmd = new GPPPSQueryCmd( filter.toSearchDS() ); cmd.execute(); while ( cmd.next() ) { resp.add( cmd.getDataset() ); } } catch ( Exception x ) { log.error( "Exception occured in getMWLEntries: "+x.getMessage(), x ); } if ( cmd != null ) cmd.close(); return resp; }
List function( PPSFilter filter ) { List resp = null; GPPPSQueryCmd cmd = null; try { resp = new ArrayList(); cmd = new GPPPSQueryCmd( filter.toSearchDS() ); cmd.execute(); while ( cmd.next() ) { resp.add( cmd.getDataset() ); } } catch ( Exception x ) { log.error( STR+x.getMessage(), x ); } if ( cmd != null ) cmd.close(); return resp; }
/** * Makes the MBean call to get the list of worklist entries for given filter (ds). * * @param filter The WADO request. * * @return The list of worklist entries ( Each item in the list is a Dataset of one scheduled procedure step). */
Makes the MBean call to get the list of worklist entries for given filter (ds)
findGPPPSEntries
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4jboss-all/tags/DCM4CHEE_2_9_5/dcm4jboss-web/src/java/org/dcm4chex/archive/web/maverick/gppps/GPPPSDelegate.java", "license": "apache-2.0", "size": 5052 }
[ "java.util.ArrayList", "java.util.List", "org.dcm4chex.archive.ejb.jdbc.GPPPSQueryCmd" ]
import java.util.ArrayList; import java.util.List; import org.dcm4chex.archive.ejb.jdbc.GPPPSQueryCmd;
import java.util.*; import org.dcm4chex.archive.ejb.jdbc.*;
[ "java.util", "org.dcm4chex.archive" ]
java.util; org.dcm4chex.archive;
921,085
private void connect() { InfluxDB db; // This section will not block synchronized calls if (username == null || "".equals(username) || password == null || "".equals(password)) { logger.warn("one of (username, password) is null or missing, connecting unauthenticated - THIS IS A BAD IDEA"); logger.warn("see https://docs.influxdata.com/influxdb/v1.7/administration/authentication_and_authorization/"); logger.warn("(username, password) = (" + username + ", " + password + ")"); db = InfluxDBFactory.connect(dbURL); } else { db = InfluxDBFactory.connect(dbURL, username, password); } // This section is short and won't delay other synchronized calls much synchronized (this) { this.db = db; } }
void function() { InfluxDB db; if (username == null STRSTRone of (username, password) is null or missing, connecting unauthenticated - THIS IS A BAD IDEASTRsee https: logger.warn(STR + username + STR + password + ")"); db = InfluxDBFactory.connect(dbURL); } else { db = InfluxDBFactory.connect(dbURL, username, password); } synchronized (this) { this.db = db; } }
/** * Connect to the remote in a non-blocking way. */
Connect to the remote in a non-blocking way
connect
{ "repo_name": "home-climate-control/dz", "path": "dz3-influxdb/src/main/java/net/sf/dz3/view/influxdb/v1/InfluxDbLogger.java", "license": "gpl-3.0", "size": 6736 }
[ "org.influxdb.InfluxDB", "org.influxdb.InfluxDBFactory" ]
import org.influxdb.InfluxDB; import org.influxdb.InfluxDBFactory;
import org.influxdb.*;
[ "org.influxdb" ]
org.influxdb;
1,642,816
@Generated @Selector("menuAttachmentPointForConfiguration:") @ByValue public native CGPoint menuAttachmentPointForConfiguration(UIContextMenuConfiguration configuration);
@Selector(STR) native CGPoint function(UIContextMenuConfiguration configuration);
/** * Return a point in this control's coordinate space to which to attach the given configuration's menu. */
Return a point in this control's coordinate space to which to attach the given configuration's menu
menuAttachmentPointForConfiguration
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIControl.java", "license": "apache-2.0", "size": 32314 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
972,414
@FFDCIgnore(IllegalArgumentException.class) private String evaluateCallerSearchBase(boolean immediateOnly) { String callerSearchBase = this.idStoreDefinition.callerSearchBase(); try { return elHelper.processString("callerSearchBase", callerSearchBase, immediateOnly); } catch (IllegalArgumentException e) { if (immediateOnly && elHelper.isDeferredExpression(callerSearchBase)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "evaluateCallerSearchBase", "Returning null since callerSearchBase is a deferred expression and this is called on initialization."); } return null; } if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) { Tr.warning(tc, "JAVAEESEC_WARNING_IDSTORE_CONFIG", new Object[] { "callerSearchBase", "" }); } return ""; } }
@FFDCIgnore(IllegalArgumentException.class) String function(boolean immediateOnly) { String callerSearchBase = this.idStoreDefinition.callerSearchBase(); try { return elHelper.processString(STR, callerSearchBase, immediateOnly); } catch (IllegalArgumentException e) { if (immediateOnly && elHelper.isDeferredExpression(callerSearchBase)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR, STR); } return null; } if (TraceComponent.isAnyTracingEnabled() && tc.isWarningEnabled()) { Tr.warning(tc, STR, new Object[] { STR, STR"; } }
/** * Evaluate and return the callerSearchBase. * * @param immediateOnly If true, only return a non-null value if the setting is either an * immediate EL expression or not set by an EL expression. If false, return the * value regardless of where it is evaluated. * @return The callerSearchBase or null if immediateOnly==true AND the value is not evaluated * from a deferred EL expression. */
Evaluate and return the callerSearchBase
evaluateCallerSearchBase
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/LdapIdentityStoreDefinitionWrapper.java", "license": "epl-1.0", "size": 44802 }
[ "com.ibm.websphere.ras.Tr", "com.ibm.websphere.ras.TraceComponent", "com.ibm.ws.ffdc.annotation.FFDCIgnore" ]
import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import com.ibm.ws.ffdc.annotation.FFDCIgnore;
import com.ibm.websphere.ras.*; import com.ibm.ws.ffdc.annotation.*;
[ "com.ibm.websphere", "com.ibm.ws" ]
com.ibm.websphere; com.ibm.ws;
302,751
ProcessInstance findById(String piId);
ProcessInstance findById(String piId);
/** * Returns the process instance with the given process instance id. * * @param piId the process instance id * @return ProcessInstance */
Returns the process instance with the given process instance id
findById
{ "repo_name": "christian-weber/arrow", "path": "arrow-runtime/src/main/java/org/arrow/runtime/execution/service/data/ProcessInstanceRepository.java", "license": "gpl-3.0", "size": 2179 }
[ "org.arrow.runtime.execution.ProcessInstance" ]
import org.arrow.runtime.execution.ProcessInstance;
import org.arrow.runtime.execution.*;
[ "org.arrow.runtime" ]
org.arrow.runtime;
1,294,783
private static void initializeFlipper( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { Class<?> aClass = Class.forName("com.moonrailgun.trpg.ReactNativeFlipper"); aClass .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }
static void function( Context context, ReactInstanceManager reactInstanceManager) { if (BuildConfig.DEBUG) { try { Class<?> aClass = Class.forName(STR); aClass .getMethod(STR, Context.class, ReactInstanceManager.class) .invoke(null, context, reactInstanceManager); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } }
/** * Loads Flipper in React Native templates. Call this in the onCreate method with something like * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); * * @param context * @param reactInstanceManager */
Loads Flipper in React Native templates. Call this in the onCreate method with something like initializeFlipper(this, getReactNativeHost().getReactInstanceManager())
initializeFlipper
{ "repo_name": "TRPGEngine/Client", "path": "src/app/android/app/src/main/java/com/moonrailgun/trpg/MainApplication.java", "license": "gpl-3.0", "size": 5176 }
[ "android.content.Context", "com.facebook.react.ReactInstanceManager", "java.lang.reflect.InvocationTargetException" ]
import android.content.Context; import com.facebook.react.ReactInstanceManager; import java.lang.reflect.InvocationTargetException;
import android.content.*; import com.facebook.react.*; import java.lang.reflect.*;
[ "android.content", "com.facebook.react", "java.lang" ]
android.content; com.facebook.react; java.lang;
1,198,032
public BigDecimal getProcessedOn () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ProcessedOn); if (bd == null) return Env.ZERO; return bd; }
BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_ProcessedOn); if (bd == null) return Env.ZERO; return bd; }
/** Get Processed On. @return The date+time (expressed in decimal format) when the document has been processed */
Get Processed On
getProcessedOn
{ "repo_name": "pplatek/adempiere", "path": "base/src/org/compiere/model/X_C_ProjectIssue.java", "license": "gpl-2.0", "size": 12047 }
[ "java.math.BigDecimal", "org.compiere.util.Env" ]
import java.math.BigDecimal; import org.compiere.util.Env;
import java.math.*; import org.compiere.util.*;
[ "java.math", "org.compiere.util" ]
java.math; org.compiere.util;
219,871
private boolean hasInstances(final Context context) { final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); return appWidgetIds.length > 0; }
boolean function(final Context context) { final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); final int[] appWidgetIds = appWidgetManager.getAppWidgetIds(new ComponentName(context, getClass())); return appWidgetIds.length > 0; }
/** * Check against {@link AppWidgetManager} if there are any instances of this widget. * * @param context The current context. * @return True if an instance already exists, false otherwise. */
Check against <code>AppWidgetManager</code> if there are any instances of this widget
hasInstances
{ "repo_name": "hurzl/dmix", "path": "MPDroid/src/main/java/com/namelessdev/mpdroid/widgets/SimpleWidgetProvider.java", "license": "apache-2.0", "size": 6074 }
[ "android.appwidget.AppWidgetManager", "android.content.ComponentName", "android.content.Context" ]
import android.appwidget.AppWidgetManager; import android.content.ComponentName; import android.content.Context;
import android.appwidget.*; import android.content.*;
[ "android.appwidget", "android.content" ]
android.appwidget; android.content;
662,134
public MessageBytes getRequestPathMB() { return mappingData.requestPath; }
MessageBytes function() { return mappingData.requestPath; }
/** * Get the request path. * * @return the request path */
Get the request path
getRequestPathMB
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/catalina/connector/Request.java", "license": "apache-2.0", "size": 100331 }
[ "org.apache.tomcat.util.buf.MessageBytes" ]
import org.apache.tomcat.util.buf.MessageBytes;
import org.apache.tomcat.util.buf.*;
[ "org.apache.tomcat" ]
org.apache.tomcat;
2,903,171
public String getStringRep() { ListThing newthing = null; try { Vector v = ListThing.get(new Thing(new HashThing(val))); newthing = new ListThing(v); } catch (HeclException he) { } return newthing.getStringRep(); }
String function() { ListThing newthing = null; try { Vector v = ListThing.get(new Thing(new HashThing(val))); newthing = new ListThing(v); } catch (HeclException he) { } return newthing.getStringRep(); }
/** * <code>getStringRep</code> returns a string representation of a * HashThing, which is in reality a string representation of a ListThing, * only that there are guaranteed to be an even number of elements. * * @return a <code>String</code> value * @exception HeclException * if an error occurs */
<code>getStringRep</code> returns a string representation of a HashThing, which is in reality a string representation of a ListThing, only that there are guaranteed to be an even number of elements
getStringRep
{ "repo_name": "davidw/hecl", "path": "core/org/hecl/HashThing.java", "license": "apache-2.0", "size": 5596 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
733,841
public Set<String> getAtMeGroups(){ return atMeGroupList; }
Set<String> function(){ return atMeGroupList; }
/** * get groups which I was mentioned * @return */
get groups which I was mentioned
getAtMeGroups
{ "repo_name": "HyphenateInc/easeui_android", "path": "src/com/hyphenate/easeui/model/EaseAtMessageHelper.java", "license": "apache-2.0", "size": 5711 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
4,055
public void runPersistArgument(Object o) throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException { getPMF(); //make sure we enfore reload the metadata PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); Object id = null; try { tx.begin(); pm.makePersistent(o); id = pm.getObjectId(o); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); shutdownDatabase(); } pm = pmf.getPersistenceManager(); tx = pm.currentTransaction(); try { tx.begin(); Object o1 = pm.getObjectById(id); pm.deletePersistent(o1); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); shutdownDatabase(); } }
void function(Object o) throws MalformedURLException, ClassNotFoundException, InstantiationException, IllegalAccessException { getPMF(); PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); Object id = null; try { tx.begin(); pm.makePersistent(o); id = pm.getObjectId(o); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); shutdownDatabase(); } pm = pmf.getPersistenceManager(); tx = pm.currentTransaction(); try { tx.begin(); Object o1 = pm.getObjectById(id); pm.deletePersistent(o1); tx.commit(); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); shutdownDatabase(); } }
/** * Run the classloader test for ContextClassLoader * @throws MalformedURLException * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException */
Run the classloader test for ContextClassLoader
runPersistArgument
{ "repo_name": "hopecee/texsts", "path": "jdo/general/src/test/org/datanucleus/tests/ClassLoaderTest.java", "license": "apache-2.0", "size": 41009 }
[ "java.net.MalformedURLException", "javax.jdo.PersistenceManager", "javax.jdo.Transaction" ]
import java.net.MalformedURLException; import javax.jdo.PersistenceManager; import javax.jdo.Transaction;
import java.net.*; import javax.jdo.*;
[ "java.net", "javax.jdo" ]
java.net; javax.jdo;
1,068,168
public static String getExtension(File f) { String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i+1).toLowerCase(); } return ext; }
static String function(File f) { String ext = null; String s = f.getName(); int i = s.lastIndexOf('.'); if (i > 0 && i < s.length() - 1) { ext = s.substring(i+1).toLowerCase(); } return ext; }
/** * Get the extension of a file. */
Get the extension of a file
getExtension
{ "repo_name": "hernol/ConuWar", "path": "ConuWar/src_swing/net/yura/domination/engine/guishared/RiskFileFilter.java", "license": "gpl-3.0", "size": 2256 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,125,252
@FIXVersion(introduced="4.4") @TagNumRef(tagNum=TagNum.SharedCommission) public void setSharedCommission(Double sharedCommission) { this.sharedCommission = sharedCommission; }
@FIXVersion(introduced="4.4") @TagNumRef(tagNum=TagNum.SharedCommission) void function(Double sharedCommission) { this.sharedCommission = sharedCommission; }
/** * Message field setter. * @param sharedCommission field value */
Message field setter
setSharedCommission
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/ConfirmationMsg.java", "license": "gpl-3.0", "size": 94557 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.TagNum" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.TagNum;
import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "net.hades.fix" ]
net.hades.fix;
502,599
private VirtualMachineRelocateSpec setHostAndStorage(VMwareClient vmw, VMPropertyHandler paramHandler, ManagedObjectReference vmDataCenter, String datacenter, String cluster) throws Exception { logger.debug("datacenter: " + datacenter + " cluster: " + cluster); String xmlData = paramHandler.getHostLoadBalancerConfig(); VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec(); String storageName = paramHandler .getServiceSetting(VMPropertyHandler.TS_TARGET_STORAGE); String hostName = paramHandler .getServiceSetting(VMPropertyHandler.TS_TARGET_HOST); if (hostName == null || hostName.trim().length() == 0) { logger.debug("target host not set. get host and storage from loadbalancer"); VMwareDatacenterInventory inventory = readDatacenterInventory(vmw, datacenter, cluster); LoadBalancerConfiguration balancerConfig = new LoadBalancerConfiguration( xmlData, inventory); VMwareHost host = balancerConfig.getBalancer().next(paramHandler); hostName = host.getName(); paramHandler.setSetting(VMPropertyHandler.TS_TARGET_HOST, hostName); VMwareStorage storage = host.getNextStorage(paramHandler); storageName = storage.getName(); } else { if (storageName == null || storageName.trim().length() == 0) { logger.debug("target storage not set. get host and storage from loadbalancer"); VMwareDatacenterInventory inventory = readDatacenterInventory( vmw, datacenter, cluster); VMwareHost host = inventory.getHost(hostName); VMwareStorage storage = host.getNextStorage(paramHandler); storageName = storage.getName(); } } logger.info("Target Host: " + hostName + " Target Storage: " + storageName); ManagedObjectReference vmHost = vmw.getServiceUtil().getDecendentMoRef( vmDataCenter, "HostSystem", hostName); if (vmHost == null) { logger.error("Target host " + hostName + " not found"); throw new APPlatformException(Messages.getAll("error_invalid_host", new Object[] { hostName })); } ManagedObjectReference vmHostCluster = (ManagedObjectReference) vmw .getServiceUtil().getDynamicProperty(vmHost, "parent"); ManagedObjectReference vmPool = vmw.getServiceUtil().getDecendentMoRef( vmHostCluster, "ResourcePool", "Resources"); if (vmPool == null) { logger.error("Resourcepool not found"); throw new APPlatformException(Messages.getAll("error_invalid_pool", new Object[] { hostName })); } ManagedObjectReference vmDatastore = null; Object vmHostDatastores = vmw.getServiceUtil().getDynamicProperty( vmHost, "datastore"); if (vmHostDatastores instanceof List<?>) { for (Object vmHostDatastore : (List<?>) vmHostDatastores) { if (vmHostDatastore instanceof ManagedObjectReference) { String dsname = (String) vmw.getServiceUtil() .getDynamicProperty( (ManagedObjectReference) vmHostDatastore, "summary.name"); if (dsname.equalsIgnoreCase(storageName)) { vmDatastore = (ManagedObjectReference) vmHostDatastore; break; } } else { logger.warn("Expected datastore information as 'ManagedObjectReference' but recieved object of type " + (vmHostDatastore == null ? "[null]" : vmHostDatastore.getClass() .getSimpleName())); } } } if (vmDatastore == null) { logger.error("Target datastore " + storageName + " not found"); throw new APPlatformException(Messages.getAll( "error_invalid_datastore", new Object[] { storageName, hostName })); } relocSpec.setDatastore(vmDatastore); relocSpec.setPool(vmPool); relocSpec.setHost(vmHost); return relocSpec; }
VirtualMachineRelocateSpec function(VMwareClient vmw, VMPropertyHandler paramHandler, ManagedObjectReference vmDataCenter, String datacenter, String cluster) throws Exception { logger.debug(STR + datacenter + STR + cluster); String xmlData = paramHandler.getHostLoadBalancerConfig(); VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec(); String storageName = paramHandler .getServiceSetting(VMPropertyHandler.TS_TARGET_STORAGE); String hostName = paramHandler .getServiceSetting(VMPropertyHandler.TS_TARGET_HOST); if (hostName == null hostName.trim().length() == 0) { logger.debug(STR); VMwareDatacenterInventory inventory = readDatacenterInventory(vmw, datacenter, cluster); LoadBalancerConfiguration balancerConfig = new LoadBalancerConfiguration( xmlData, inventory); VMwareHost host = balancerConfig.getBalancer().next(paramHandler); hostName = host.getName(); paramHandler.setSetting(VMPropertyHandler.TS_TARGET_HOST, hostName); VMwareStorage storage = host.getNextStorage(paramHandler); storageName = storage.getName(); } else { if (storageName == null storageName.trim().length() == 0) { logger.debug(STR); VMwareDatacenterInventory inventory = readDatacenterInventory( vmw, datacenter, cluster); VMwareHost host = inventory.getHost(hostName); VMwareStorage storage = host.getNextStorage(paramHandler); storageName = storage.getName(); } } logger.info(STR + hostName + STR + storageName); ManagedObjectReference vmHost = vmw.getServiceUtil().getDecendentMoRef( vmDataCenter, STR, hostName); if (vmHost == null) { logger.error(STR + hostName + STR); throw new APPlatformException(Messages.getAll(STR, new Object[] { hostName })); } ManagedObjectReference vmHostCluster = (ManagedObjectReference) vmw .getServiceUtil().getDynamicProperty(vmHost, STR); ManagedObjectReference vmPool = vmw.getServiceUtil().getDecendentMoRef( vmHostCluster, STR, STR); if (vmPool == null) { logger.error(STR); throw new APPlatformException(Messages.getAll(STR, new Object[] { hostName })); } ManagedObjectReference vmDatastore = null; Object vmHostDatastores = vmw.getServiceUtil().getDynamicProperty( vmHost, STR); if (vmHostDatastores instanceof List<?>) { for (Object vmHostDatastore : (List<?>) vmHostDatastores) { if (vmHostDatastore instanceof ManagedObjectReference) { String dsname = (String) vmw.getServiceUtil() .getDynamicProperty( (ManagedObjectReference) vmHostDatastore, STR); if (dsname.equalsIgnoreCase(storageName)) { vmDatastore = (ManagedObjectReference) vmHostDatastore; break; } } else { logger.warn(STR + (vmHostDatastore == null ? STR : vmHostDatastore.getClass() .getSimpleName())); } } } if (vmDatastore == null) { logger.error(STR + storageName + STR); throw new APPlatformException(Messages.getAll( STR, new Object[] { storageName, hostName })); } relocSpec.setDatastore(vmDatastore); relocSpec.setPool(vmPool); relocSpec.setHost(vmHost); return relocSpec; }
/** * If host and storage are not defined as technical service parameter then * the load balancing mechanism is used to determine host and storage */
If host and storage are not defined as technical service parameter then the load balancing mechanism is used to determine host and storage
setHostAndStorage
{ "repo_name": "opetrovski/development", "path": "oscm-app-vmware/javasrc/org/oscm/app/vmware/business/Template.java", "license": "apache-2.0", "size": 26996 }
[ "com.vmware.vim25.ManagedObjectReference", "com.vmware.vim25.VirtualMachineRelocateSpec", "java.util.List", "org.oscm.app.v2_0.exceptions.APPlatformException", "org.oscm.app.vmware.business.balancer.LoadBalancerConfiguration", "org.oscm.app.vmware.business.model.VMwareHost", "org.oscm.app.vmware.business.model.VMwareStorage", "org.oscm.app.vmware.i18n.Messages", "org.oscm.app.vmware.remote.vmware.VMwareClient" ]
import com.vmware.vim25.ManagedObjectReference; import com.vmware.vim25.VirtualMachineRelocateSpec; import java.util.List; import org.oscm.app.v2_0.exceptions.APPlatformException; import org.oscm.app.vmware.business.balancer.LoadBalancerConfiguration; import org.oscm.app.vmware.business.model.VMwareHost; import org.oscm.app.vmware.business.model.VMwareStorage; import org.oscm.app.vmware.i18n.Messages; import org.oscm.app.vmware.remote.vmware.VMwareClient;
import com.vmware.vim25.*; import java.util.*; import org.oscm.app.v2_0.exceptions.*; import org.oscm.app.vmware.business.balancer.*; import org.oscm.app.vmware.business.model.*; import org.oscm.app.vmware.i18n.*; import org.oscm.app.vmware.remote.vmware.*;
[ "com.vmware.vim25", "java.util", "org.oscm.app" ]
com.vmware.vim25; java.util; org.oscm.app;
1,096,560
public LinkedList<Patch> patch_make(String text1, String text2, LinkedList<Diff> diffs) { return patch_make(text1, diffs); }
LinkedList<Patch> function(String text1, String text2, LinkedList<Diff> diffs) { return patch_make(text1, diffs); }
/** * Compute a list of patches to turn text1 into text2. * text2 is ignored, diffs are the delta between text1 and text2. * @param text1 Old text * @param text2 Ignored. * @param diffs Array of Diff objects for text1 to text2. * @return LinkedList of Patch objects. * @deprecated Prefer patch_make(String text1, LinkedList<Diff> diffs). */
Compute a list of patches to turn text1 into text2. text2 is ignored, diffs are the delta between text1 and text2
patch_make
{ "repo_name": "mischov/clj-diffmatchpatch", "path": "src/java/google/dmp/DiffMatchPatch.java", "license": "apache-2.0", "size": 89116 }
[ "java.util.LinkedList" ]
import java.util.LinkedList;
import java.util.*;
[ "java.util" ]
java.util;
1,974,489
public static final Document createDocument(InputStream in) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Turn on validation, and turn on namespaces factory.setValidating(false); factory.setNamespaceAware(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(in); return doc; } catch (ParserConfigurationException e) { log.error("", e); return null; } catch (IOException e) { log.error("", e); return null; } catch (SAXException e) { log.error("", e); return null; } }
static final Document function(InputStream in) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); factory.setNamespaceAware(false); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(in); return doc; } catch (ParserConfigurationException e) { log.error(STRSTR", e); return null; } }
/** * Create a document from a template, validation is turned off. The * method doesn't close the input stream. * @param in * @return */
Create a document from a template, validation is turned off. The method doesn't close the input stream
createDocument
{ "repo_name": "stevenhva/InfoLearn_OpenOLAT", "path": "src/main/java/org/olat/core/util/openxml/OpenXMLUtils.java", "license": "apache-2.0", "size": 5777 }
[ "java.io.InputStream", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException", "org.w3c.dom.Document" ]
import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document;
import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*;
[ "java.io", "javax.xml", "org.w3c.dom" ]
java.io; javax.xml; org.w3c.dom;
14,602
@Override public String getText(Object object) { String label = ((HyName)object).getName(); return label == null || label.length() == 0 ? getString("_UI_HyName_type") : getString("_UI_HyName_type") + " " + label; }
String function(Object object) { String label = ((HyName)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; }
/** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This returns the label text for the adapted class.
getText
{ "repo_name": "DarwinSPL/DarwinSPL", "path": "plugins/eu.hyvar.evolution.edit/src-gen/eu/hyvar/evolution/provider/HyNameItemProvider.java", "license": "apache-2.0", "size": 8498 }
[ "eu.hyvar.evolution.HyName" ]
import eu.hyvar.evolution.HyName;
import eu.hyvar.evolution.*;
[ "eu.hyvar.evolution" ]
eu.hyvar.evolution;
2,300,102
public final String toSource(boolean useLongIdents) { DefaultTextOutput out = new DefaultTextOutput(false); JsSourceGenerationVisitor v = new JsSourceGenerationVisitor(out, useLongIdents); v.accept(this); return out.toString(); }
final String function(boolean useLongIdents) { DefaultTextOutput out = new DefaultTextOutput(false); JsSourceGenerationVisitor v = new JsSourceGenerationVisitor(out, useLongIdents); v.accept(this); return out.toString(); }
/** * Returns a source code representation of the node using short or long identifiers. * * @param useLongIdents if true, emit all identifiers in long form */
Returns a source code representation of the node using short or long identifiers
toSource
{ "repo_name": "syntelos/gwtcc", "path": "src/com/google/gwt/dev/js/ast/JsNode.java", "license": "apache-2.0", "size": 2376 }
[ "com.google.gwt.dev.js.JsSourceGenerationVisitor", "com.google.gwt.dev.util.DefaultTextOutput" ]
import com.google.gwt.dev.js.JsSourceGenerationVisitor; import com.google.gwt.dev.util.DefaultTextOutput;
import com.google.gwt.dev.js.*; import com.google.gwt.dev.util.*;
[ "com.google.gwt" ]
com.google.gwt;
2,529,720
public void setContainerConditionHLAPI( ConditionHLAPI elem) { if (elem != null) item.setContainerCondition((Condition) elem.getContainedItem()); }
void function( ConditionHLAPI elem) { if (elem != null) item.setContainerCondition((Condition) elem.getContainedItem()); }
/** * set ContainerCondition */
set ContainerCondition
setContainerConditionHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/integers/hlapi/ModuloHLAPI.java", "license": "epl-1.0", "size": 69704 }
[ "fr.lip6.move.pnml.pthlpng.hlcorestructure.Condition", "fr.lip6.move.pnml.pthlpng.hlcorestructure.hlapi.ConditionHLAPI" ]
import fr.lip6.move.pnml.pthlpng.hlcorestructure.Condition; import fr.lip6.move.pnml.pthlpng.hlcorestructure.hlapi.ConditionHLAPI;
import fr.lip6.move.pnml.pthlpng.hlcorestructure.*; import fr.lip6.move.pnml.pthlpng.hlcorestructure.hlapi.*;
[ "fr.lip6.move" ]
fr.lip6.move;
78,720
protected Rectangle backwardMapRect(Rectangle destRect, int sourceIndex) { if (destRect == null) { throw new IllegalArgumentException(JaiI18N.getString("Generic0")); } if (sourceIndex != 0) { throw new IllegalArgumentException(JaiI18N.getString("Generic1")); } // Get the destination rectangle coordinates and dimensions int x0 = destRect.x; int y0 = destRect.y; int w = destRect.width; int h = destRect.height; // Variables that will eventually hold the source pixel // positions which are the result of the backward map long sx0Num, sx0Denom, sy0Num, sy0Denom; // First destination point that will be backward mapped // will be dx0 + 0.5, dy0 + 0.5 sx0Num = (x0 * 2 + 1); sx0Denom = 2; sy0Num = (y0 * 2 + 1); sy0Denom = 2; // The last destination pixel to be backward mapped will be // dx0 + w - 1 + 0.5, dy0 + h - 1 + 0.5 i.e. // dx0 + w - 0.5, dy0 + h - 0.5 long sx1Num, sx1Denom, sy1Num, sy1Denom; // Equivalent to float sx1 = dx0 + dw - 0.5; sx1Num = 2 * x0 + 2 * w - 1; sx1Denom = 2; // Equivalent to float sy1 = dy0 + dh - 0.5; sy1Num = 2 * y0 + 2 * h - 1; sy1Denom = 2; // Subtract the translation factors. sx0Num = sx0Num * transXRationalDenom - transXRationalNum * sx0Denom; sx0Denom *= transXRationalDenom; sy0Num = sy0Num * transYRationalDenom - transYRationalNum * sy0Denom; sy0Denom *= transYRationalDenom; sx1Num = sx1Num * transXRationalDenom - transXRationalNum * sx1Denom; sx1Denom *= transXRationalDenom; sy1Num = sy1Num * transYRationalDenom - transYRationalNum * sy1Denom; sy1Denom *= transYRationalDenom; // Backward map both the destination positions // Equivalent to float sx0 = x0 / scaleX; sx0Num *= invScaleXRationalNum; sx0Denom *= invScaleXRationalDenom; sy0Num *= invScaleYRationalNum; sy0Denom *= invScaleYRationalDenom; sx1Num *= invScaleXRationalNum; sx1Denom *= invScaleXRationalDenom; sy1Num *= invScaleYRationalNum; sy1Denom *= invScaleYRationalDenom; int s_x0 = 0, s_y0 = 0, s_x1 = 0, s_y1 = 0; if (interp instanceof InterpolationNearest) { // Floor sx0, sy0 s_x0 = Rational.floor(sx0Num, sx0Denom); s_y0 = Rational.floor(sy0Num, sy0Denom); // Equivalent to (int)Math.floor(sx1) s_x1 = Rational.floor(sx1Num , sx1Denom); // Equivalent to (int)Math.floor(sy1) s_y1 = Rational.floor(sy1Num , sy1Denom); } else { // For all other interpolations // Equivalent to (int) Math.floor(sx0 - 0.5) s_x0 = Rational.floor(2 * sx0Num - sx0Denom, 2 * sx0Denom); // Equivalent to (int) Math.floor(sy0 - 0.5) s_y0 = Rational.floor(2 * sy0Num - sy0Denom , 2 * sy0Denom); // Calculate the last source point s_x1 = Rational.floor(2 * sx1Num - sx1Denom , 2 * sx1Denom); // Equivalent to (int)Math.ceil(sy1 - 0.5) s_y1 = Rational.floor(2 * sy1Num - sy1Denom , 2 * sy1Denom); } return new Rectangle(s_x0, s_y0, (s_x1 - s_x0 + 1), (s_y1 - s_y0 + 1)); }
Rectangle function(Rectangle destRect, int sourceIndex) { if (destRect == null) { throw new IllegalArgumentException(JaiI18N.getString(STR)); } if (sourceIndex != 0) { throw new IllegalArgumentException(JaiI18N.getString(STR)); } int x0 = destRect.x; int y0 = destRect.y; int w = destRect.width; int h = destRect.height; long sx0Num, sx0Denom, sy0Num, sy0Denom; sx0Num = (x0 * 2 + 1); sx0Denom = 2; sy0Num = (y0 * 2 + 1); sy0Denom = 2; long sx1Num, sx1Denom, sy1Num, sy1Denom; sx1Num = 2 * x0 + 2 * w - 1; sx1Denom = 2; sy1Num = 2 * y0 + 2 * h - 1; sy1Denom = 2; sx0Num = sx0Num * transXRationalDenom - transXRationalNum * sx0Denom; sx0Denom *= transXRationalDenom; sy0Num = sy0Num * transYRationalDenom - transYRationalNum * sy0Denom; sy0Denom *= transYRationalDenom; sx1Num = sx1Num * transXRationalDenom - transXRationalNum * sx1Denom; sx1Denom *= transXRationalDenom; sy1Num = sy1Num * transYRationalDenom - transYRationalNum * sy1Denom; sy1Denom *= transYRationalDenom; sx0Num *= invScaleXRationalNum; sx0Denom *= invScaleXRationalDenom; sy0Num *= invScaleYRationalNum; sy0Denom *= invScaleYRationalDenom; sx1Num *= invScaleXRationalNum; sx1Denom *= invScaleXRationalDenom; sy1Num *= invScaleYRationalNum; sy1Denom *= invScaleYRationalDenom; int s_x0 = 0, s_y0 = 0, s_x1 = 0, s_y1 = 0; if (interp instanceof InterpolationNearest) { s_x0 = Rational.floor(sx0Num, sx0Denom); s_y0 = Rational.floor(sy0Num, sy0Denom); s_x1 = Rational.floor(sx1Num , sx1Denom); s_y1 = Rational.floor(sy1Num , sy1Denom); } else { s_x0 = Rational.floor(2 * sx0Num - sx0Denom, 2 * sx0Denom); s_y0 = Rational.floor(2 * sy0Num - sy0Denom , 2 * sy0Denom); s_x1 = Rational.floor(2 * sx1Num - sx1Denom , 2 * sx1Denom); s_y1 = Rational.floor(2 * sy1Num - sy1Denom , 2 * sy1Denom); } return new Rectangle(s_x0, s_y0, (s_x1 - s_x0 + 1), (s_y1 - s_y0 + 1)); }
/** * Returns the minimum bounding box of the region of the specified * source to which a particular <code>Rectangle</code> of the * destination will be mapped. * * @param destRect the <code>Rectangle</code> in destination coordinates. * @param sourceIndex the index of the source image. * * @return a <code>Rectangle</code> indicating the source bounding box, * or <code>null</code> if the bounding box is unknown. * * @throws IllegalArgumentException if <code>sourceIndex</code> is * negative or greater than the index of the last source. * @throws IllegalArgumentException if <code>destRect</code> is * <code>null</code>. * * @since JAI 1.1 */
Returns the minimum bounding box of the region of the specified source to which a particular <code>Rectangle</code> of the destination will be mapped
backwardMapRect
{ "repo_name": "MarinnaCole/LightZone", "path": "lightcrafts/extsrc/com/lightcrafts/mediax/jai/ScaleOpImage.java", "license": "bsd-3-clause", "size": 51222 }
[ "com.lightcrafts.media.jai.util.Rational", "java.awt.Rectangle" ]
import com.lightcrafts.media.jai.util.Rational; import java.awt.Rectangle;
import com.lightcrafts.media.jai.util.*; import java.awt.*;
[ "com.lightcrafts.media", "java.awt" ]
com.lightcrafts.media; java.awt;
1,884,448
public ServiceCall<KeyBundle> updateKeyAsync(UpdateKeyRequest updateKeyRequest, final ServiceCallback<KeyBundle> serviceCallback) { return innerKeyVaultClient.updateKeyAsync( updateKeyRequest.vaultBaseUrl(), updateKeyRequest.keyName(), updateKeyRequest.keyVersion(), updateKeyRequest.keyOperations(), updateKeyRequest.keyAttributes(), updateKeyRequest.tags(), serviceCallback); }
ServiceCall<KeyBundle> function(UpdateKeyRequest updateKeyRequest, final ServiceCallback<KeyBundle> serviceCallback) { return innerKeyVaultClient.updateKeyAsync( updateKeyRequest.vaultBaseUrl(), updateKeyRequest.keyName(), updateKeyRequest.keyVersion(), updateKeyRequest.keyOperations(), updateKeyRequest.keyAttributes(), updateKeyRequest.tags(), serviceCallback); }
/** * Updates the Key Attributes associated with the specified key. * * @param updateKeyRequest the grouped properties for updating a key request * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */
Updates the Key Attributes associated with the specified key
updateKeyAsync
{ "repo_name": "herveyw/azure-sdk-for-java", "path": "azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClient.java", "license": "mit", "size": 97117 }
[ "com.microsoft.azure.keyvault.models.KeyBundle", "com.microsoft.azure.keyvault.requests.UpdateKeyRequest", "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.azure.keyvault.models.KeyBundle; import com.microsoft.azure.keyvault.requests.UpdateKeyRequest; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.azure.keyvault.models.*; import com.microsoft.azure.keyvault.requests.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,439,911
public char[][] getCompoundName() { return CharOperation.splitOn('/', fileName()); }
char[][] function() { return CharOperation.splitOn('/', fileName()); }
/** * EXTERNAL API * Answer the compound name of the class file. * @return char[][] * e.g. {{java}, {util}, {Hashtable}}. */
EXTERNAL API Answer the compound name of the class file
getCompoundName
{ "repo_name": "trylimits/Eclipse-Postfix-Code-Completion-Juno38", "path": "juno38/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java", "license": "epl-1.0", "size": 221633 }
[ "org.eclipse.jdt.core.compiler.CharOperation" ]
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.core.compiler.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
755,150
public ExecutorService execute(ExecutorService executor) { executor.execute(this); return executor; }
ExecutorService function(ExecutorService executor) { executor.execute(this); return executor; }
/** * Execute this thread with single thread executor service * * @param executor ExecutorService to run this thread instance * @return ExecutorService Reference to handled this thread. <b>Use executor.shutDown for stop the current thread instance</b> */
Execute this thread with single thread executor service
execute
{ "repo_name": "fvasquezjatar/fermat-unused", "path": "fermat-android-api/src/main/java/com/bitdubai/fermat_android_api/ui/util/FermatWorker.java", "license": "mit", "size": 4221 }
[ "java.util.concurrent.ExecutorService" ]
import java.util.concurrent.ExecutorService;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,155,083
public ServiceFuture<NetworkSecurityGroupInner> createOrUpdateAsync(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters, final ServiceCallback<NetworkSecurityGroupInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters), serviceCallback); }
ServiceFuture<NetworkSecurityGroupInner> function(String resourceGroupName, String networkSecurityGroupName, NetworkSecurityGroupInner parameters, final ServiceCallback<NetworkSecurityGroupInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, networkSecurityGroupName, parameters), serviceCallback); }
/** * Creates or updates a network security group in the specified resource group. * * @param resourceGroupName The name of the resource group. * @param networkSecurityGroupName The name of the network security group. * @param parameters Parameters supplied to the create or update network security group operation. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Creates or updates a network security group in the specified resource group
createOrUpdateAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2018_12_01/src/main/java/com/microsoft/azure/management/network/v2018_12_01/implementation/NetworkSecurityGroupsInner.java", "license": "mit", "size": 81333 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
774,845
public final BulkByScrollResponse reindex(ReindexRequest reindexRequest, RequestOptions options) throws IOException { return performRequestAndParseEntity( reindexRequest, RequestConverters::reindex, options, BulkByScrollResponse::fromXContent, singleton(409) ); }
final BulkByScrollResponse function(ReindexRequest reindexRequest, RequestOptions options) throws IOException { return performRequestAndParseEntity( reindexRequest, RequestConverters::reindex, options, BulkByScrollResponse::fromXContent, singleton(409) ); }
/** * Executes a reindex request. * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html">Reindex API on elastic.co</a> * @param reindexRequest the request * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized * @return the response */
Executes a reindex request. See Reindex API on elastic.co
reindex
{ "repo_name": "robin13/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java", "license": "apache-2.0", "size": 121051 }
[ "java.io.IOException", "java.util.Collections", "org.elasticsearch.index.reindex.BulkByScrollResponse", "org.elasticsearch.index.reindex.ReindexRequest" ]
import java.io.IOException; import java.util.Collections; import org.elasticsearch.index.reindex.BulkByScrollResponse; import org.elasticsearch.index.reindex.ReindexRequest;
import java.io.*; import java.util.*; import org.elasticsearch.index.reindex.*;
[ "java.io", "java.util", "org.elasticsearch.index" ]
java.io; java.util; org.elasticsearch.index;
80,408
@Override public String toSerializable(final LogEvent event) { return serializer.toSerializable(event); }
String function(final LogEvent event) { return serializer.toSerializable(event); }
/** * Formats a logging event to a writer. * * @param event logging event to be formatted. * @return The event formatted as a String. */
Formats a logging event to a writer
toSerializable
{ "repo_name": "MagicWiz/log4j2", "path": "log4j-core/src/main/java/org/apache/logging/log4j/core/layout/PatternLayout.java", "license": "apache-2.0", "size": 16020 }
[ "org.apache.logging.log4j.core.LogEvent" ]
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.*;
[ "org.apache.logging" ]
org.apache.logging;
2,883,648
@Nullable public IndexMetaData verifyIndexIsDeleted(final Index index, final ClusterState clusterState) { // this method should only be called when we know the index (name + uuid) is not part of the cluster state if (clusterState.metaData().index(index) != null) { throw new IllegalStateException("Cannot delete index [" + index + "], it is still part of the cluster state."); } if (nodeEnv.hasNodeFile() && FileSystemUtils.exists(nodeEnv.indexPaths(index))) { final IndexMetaData metaData; try { metaData = metaStateService.loadIndexState(index); } catch (IOException e) { logger.warn("[{}] failed to load state file from a stale deleted index, folders will be left on disk", e, index); return null; } final IndexSettings indexSettings = buildIndexSettings(metaData); try { deleteIndexStoreIfDeletionAllowed("stale deleted index", index, indexSettings, ALWAYS_TRUE); } catch (IOException e) { // we just warn about the exception here because if deleteIndexStoreIfDeletionAllowed // throws an exception, it gets added to the list of pending deletes to be tried again logger.warn("[{}] failed to delete index on disk", e, metaData.getIndex()); } return metaData; } return null; }
IndexMetaData function(final Index index, final ClusterState clusterState) { if (clusterState.metaData().index(index) != null) { throw new IllegalStateException(STR + index + STR); } if (nodeEnv.hasNodeFile() && FileSystemUtils.exists(nodeEnv.indexPaths(index))) { final IndexMetaData metaData; try { metaData = metaStateService.loadIndexState(index); } catch (IOException e) { logger.warn(STR, e, index); return null; } final IndexSettings indexSettings = buildIndexSettings(metaData); try { deleteIndexStoreIfDeletionAllowed(STR, index, indexSettings, ALWAYS_TRUE); } catch (IOException e) { logger.warn(STR, e, metaData.getIndex()); } return metaData; } return null; }
/** * Verify that the contents on disk for the given index is deleted; if not, delete the contents. * This method assumes that an index is already deleted in the cluster state and/or explicitly * through index tombstones. * @param index {@code Index} to make sure its deleted from disk * @param clusterState {@code ClusterState} to ensure the index is not part of it * @return IndexMetaData for the index loaded from disk */
Verify that the contents on disk for the given index is deleted; if not, delete the contents. This method assumes that an index is already deleted in the cluster state and/or explicitly through index tombstones
verifyIndexIsDeleted
{ "repo_name": "camilojd/elasticsearch", "path": "core/src/main/java/org/elasticsearch/indices/IndicesService.java", "license": "apache-2.0", "size": 56543 }
[ "java.io.IOException", "org.elasticsearch.cluster.ClusterState", "org.elasticsearch.cluster.metadata.IndexMetaData", "org.elasticsearch.common.io.FileSystemUtils", "org.elasticsearch.index.Index", "org.elasticsearch.index.IndexSettings" ]
import java.io.IOException; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.common.io.FileSystemUtils; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexSettings;
import java.io.*; import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.common.io.*; import org.elasticsearch.index.*;
[ "java.io", "org.elasticsearch.cluster", "org.elasticsearch.common", "org.elasticsearch.index" ]
java.io; org.elasticsearch.cluster; org.elasticsearch.common; org.elasticsearch.index;
622,121
public Set<CmsResource> getRelatedResources() { return m_relatedResources; }
Set<CmsResource> function() { return m_relatedResources; }
/** * Returns the related resources.<p> * * @return the related resources */
Returns the related resources
getRelatedResources
{ "repo_name": "PatidarWeb/opencms-core", "path": "src/org/opencms/ade/publish/CmsPublish.java", "license": "lgpl-2.1", "size": 13846 }
[ "java.util.Set", "org.opencms.file.CmsResource" ]
import java.util.Set; import org.opencms.file.CmsResource;
import java.util.*; import org.opencms.file.*;
[ "java.util", "org.opencms.file" ]
java.util; org.opencms.file;
1,075,956
private void commonMediaUploadError(int serverResponseCode, final String serverErrorMessage, final MessageRow messageRow) { // warn the user that the media upload fails if (serverResponseCode == 500) { messageRow.getEvent().mSentState = Event.SentState.WAITING_RETRY;
void function(int serverResponseCode, final String serverErrorMessage, final MessageRow messageRow) { if (serverResponseCode == 500) { messageRow.getEvent().mSentState = Event.SentState.WAITING_RETRY;
/** * The media upload fails. * * @param serverResponseCode the response code. * @param serverErrorMessage the error message. * @param messageRow the messageRow */
The media upload fails
commonMediaUploadError
{ "repo_name": "matrix-org/matrix-android-sdk", "path": "matrix-sdk/src/main/java/org/matrix/androidsdk/fragments/MatrixMessageListFragment.java", "license": "apache-2.0", "size": 91833 }
[ "org.matrix.androidsdk.adapters.MessageRow", "org.matrix.androidsdk.rest.model.Event" ]
import org.matrix.androidsdk.adapters.MessageRow; import org.matrix.androidsdk.rest.model.Event;
import org.matrix.androidsdk.adapters.*; import org.matrix.androidsdk.rest.model.*;
[ "org.matrix.androidsdk" ]
org.matrix.androidsdk;
1,205,061
public ContentDirectoryBrowseResult browseSync(Device<?, ?, ?> device, String objectID) { return browseSync(device, objectID, BrowseFlag.DIRECT_CHILDREN, "*", 0L, null, new SortCriterion[0]); }
ContentDirectoryBrowseResult function(Device<?, ?, ?> device, String objectID) { return browseSync(device, objectID, BrowseFlag.DIRECT_CHILDREN, "*", 0L, null, new SortCriterion[0]); }
/** * Browse ContenDirctory synchronous * * @param device the device to be browsed * @param objectID the browsing root * @return the browsing result */
Browse ContenDirctory synchronous
browseSync
{ "repo_name": "z7z8th/yaacc", "path": "yaacc/src/de/yaacc/upnp/UpnpClient.java", "license": "gpl-3.0", "size": 47772 }
[ "de.yaacc.upnp.callback.contentdirectory.ContentDirectoryBrowseResult", "org.fourthline.cling.model.meta.Device", "org.fourthline.cling.support.model.BrowseFlag", "org.fourthline.cling.support.model.SortCriterion" ]
import de.yaacc.upnp.callback.contentdirectory.ContentDirectoryBrowseResult; import org.fourthline.cling.model.meta.Device; import org.fourthline.cling.support.model.BrowseFlag; import org.fourthline.cling.support.model.SortCriterion;
import de.yaacc.upnp.callback.contentdirectory.*; import org.fourthline.cling.model.meta.*; import org.fourthline.cling.support.model.*;
[ "de.yaacc.upnp", "org.fourthline.cling" ]
de.yaacc.upnp; org.fourthline.cling;
198,355
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); } if (l == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); } if (l == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); } if (l == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); } if (par6ItemStack.hasDisplayName()) { ((TileEntityAdvancedElectrolyzer)par1World.getTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName()); } }
void function(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) { int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if (l == 0) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2); } if (l == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 5, 2); } if (l == 2) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2); } if (l == 3) { par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2); } if (par6ItemStack.hasDisplayName()) { ((TileEntityAdvancedElectrolyzer)par1World.getTileEntity(par2, par3, par4)).setGuiDisplayName(par6ItemStack.getDisplayName()); } }
/** * Called when the block is placed in the world. */
Called when the block is placed in the world
onBlockPlacedBy
{ "repo_name": "NEMESIS13cz/Evercraft", "path": "java/evercraft/NEMESIS13cz/Blocks/Machines/BlockAdvancedElectrolyzer.java", "license": "gpl-3.0", "size": 11803 }
[ "net.minecraft.entity.EntityLivingBase", "net.minecraft.item.ItemStack", "net.minecraft.util.MathHelper", "net.minecraft.world.World" ]
import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World;
import net.minecraft.entity.*; import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.entity", "net.minecraft.item", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.entity; net.minecraft.item; net.minecraft.util; net.minecraft.world;
83,338
public void setStyleSheet( final StyleSheet style ) { if ( style != null ) { final Color backgroundColor = (Color) style.getStyleProperty( ElementStyleKeys.BACKGROUND_COLOR ); if ( backgroundColor != null ) { getPieGraphDrawable().setBackground( backgroundColor ); } final Color color = (Color) style.getStyleProperty( ElementStyleKeys.PAINT ); if ( color != null ) { getPieGraphDrawable().setColor( color ); } final Color lowColor = (Color) style.getStyleProperty( SparklineStyleKeys.LOW_COLOR ); if ( lowColor != null ) { getPieGraphDrawable().setLowColor( lowColor ); } final Color mediumColor = (Color) style.getStyleProperty( SparklineStyleKeys.MEDIUM_COLOR ); if ( mediumColor != null ) { getPieGraphDrawable().setMediumColor( mediumColor ); } final Color highColor = (Color) style.getStyleProperty( SparklineStyleKeys.HIGH_COLOR ); if ( highColor != null ) { getPieGraphDrawable().setHighColor( highColor ); } } }
void function( final StyleSheet style ) { if ( style != null ) { final Color backgroundColor = (Color) style.getStyleProperty( ElementStyleKeys.BACKGROUND_COLOR ); if ( backgroundColor != null ) { getPieGraphDrawable().setBackground( backgroundColor ); } final Color color = (Color) style.getStyleProperty( ElementStyleKeys.PAINT ); if ( color != null ) { getPieGraphDrawable().setColor( color ); } final Color lowColor = (Color) style.getStyleProperty( SparklineStyleKeys.LOW_COLOR ); if ( lowColor != null ) { getPieGraphDrawable().setLowColor( lowColor ); } final Color mediumColor = (Color) style.getStyleProperty( SparklineStyleKeys.MEDIUM_COLOR ); if ( mediumColor != null ) { getPieGraphDrawable().setMediumColor( mediumColor ); } final Color highColor = (Color) style.getStyleProperty( SparklineStyleKeys.HIGH_COLOR ); if ( highColor != null ) { getPieGraphDrawable().setHighColor( highColor ); } } }
/** * Provides the computed stylesheet of the report element that contained this drawable. The stylesheet is immutable. * * @param style * the stylesheet. */
Provides the computed stylesheet of the report element that contained this drawable. The stylesheet is immutable
setStyleSheet
{ "repo_name": "EgorZhuk/pentaho-reporting", "path": "engine/extensions/src/main/java/org/pentaho/reporting/engine/classic/extensions/modules/sparklines/PieSparklinesWrapper.java", "license": "lgpl-2.1", "size": 4336 }
[ "java.awt.Color", "org.pentaho.reporting.engine.classic.core.style.ElementStyleKeys", "org.pentaho.reporting.engine.classic.core.style.StyleSheet" ]
import java.awt.Color; import org.pentaho.reporting.engine.classic.core.style.ElementStyleKeys; import org.pentaho.reporting.engine.classic.core.style.StyleSheet;
import java.awt.*; import org.pentaho.reporting.engine.classic.core.style.*;
[ "java.awt", "org.pentaho.reporting" ]
java.awt; org.pentaho.reporting;
1,580,825
public void print(String s) throws IOException { if (s == null) { s = "null"; } write(s); }
void function(String s) throws IOException { if (s == null) { s = "null"; } write(s); }
/** * Print a string. If the argument is <code>null</code> then the string * <code>"null"</code> is printed. Otherwise, the string's characters are * converted into bytes according to the platform's default character * encoding, and these bytes are written in exactly the manner of the * <code>{@link #write(int)}</code> method. * * @param s The <code>String</code> to be printed */
Print a string. If the argument is <code>null</code> then the string <code>"null"</code> is printed. Otherwise, the string's characters are converted into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the <code><code>#write(int)</code></code> method
print
{ "repo_name": "johnaoahra80/JBOSSWEB_7_5_0_FINAL", "path": "src/main/java/org/apache/jasper/runtime/JspWriterImpl.java", "license": "apache-2.0", "size": 17602 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,333,746
void subscribe(@NonNull EventBusSubscriber subscriber);
void subscribe(@NonNull EventBusSubscriber subscriber);
/** * A subscriber can register itself to the event * bus in order to listen for broadcast events. * * @param subscriber who wants to receive broadcast event bus events. */
A subscriber can register itself to the event bus in order to listen for broadcast events
subscribe
{ "repo_name": "MarcelBraghetto/AndroidNanoDegreeProject3", "path": "Alexandria/app/src/main/java/io/github/marcelbraghetto/alexandria/framework/providers/eventbus/contracts/EventBusProvider.java", "license": "apache-2.0", "size": 1410 }
[ "android.support.annotation.NonNull" ]
import android.support.annotation.NonNull;
import android.support.annotation.*;
[ "android.support" ]
android.support;
1,425,548
private List<Weighted<DirectedEdge<V>>> getCycle(Weighted<DirectedEdge<V>> newEdge) { final List<Weighted<DirectedEdge<V>>> cycle = Lists.newLinkedList(); // circle around backward until you get back to where you started Weighted<DirectedEdge<V>> edge = newEdge; cycle.add(edge); while (!stronglyConnected.sameComponent(edge.val.source, newEdge.val.destination)) { edge = incomingEdgeByScc.get(stronglyConnected.componentOf(edge.val.source)); cycle.add(edge); } return cycle; }
List<Weighted<DirectedEdge<V>>> function(Weighted<DirectedEdge<V>> newEdge) { final List<Weighted<DirectedEdge<V>>> cycle = Lists.newLinkedList(); Weighted<DirectedEdge<V>> edge = newEdge; cycle.add(edge); while (!stronglyConnected.sameComponent(edge.val.source, newEdge.val.destination)) { edge = incomingEdgeByScc.get(stronglyConnected.componentOf(edge.val.source)); cycle.add(edge); } return cycle; }
/** * Gets the cycle of edges between SCCs that newEdge creates */
Gets the cycle of edges between SCCs that newEdge creates
getCycle
{ "repo_name": "sheldonkhall/grakn", "path": "grakn-graql/src/main/java/ai/grakn/graql/internal/gremlin/spanningtree/ChuLiuEdmonds.java", "license": "gpl-3.0", "size": 13141 }
[ "ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge", "ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted", "com.google.common.collect.Lists", "java.util.List" ]
import ai.grakn.graql.internal.gremlin.spanningtree.graph.DirectedEdge; import ai.grakn.graql.internal.gremlin.spanningtree.util.Weighted; import com.google.common.collect.Lists; import java.util.List;
import ai.grakn.graql.internal.gremlin.spanningtree.graph.*; import ai.grakn.graql.internal.gremlin.spanningtree.util.*; import com.google.common.collect.*; import java.util.*;
[ "ai.grakn.graql", "com.google.common", "java.util" ]
ai.grakn.graql; com.google.common; java.util;
294,931
public static void writeEnclosedExtensionAttachments(PSGenerator gen, Collection attachmentCollection) throws IOException { Iterator iter = attachmentCollection.iterator(); while (iter.hasNext()) { PSExtensionAttachment attachment = (PSExtensionAttachment)iter.next(); if (attachment != null) { writeEnclosedExtensionAttachment(gen, attachment); } iter.remove(); } }
static void function(PSGenerator gen, Collection attachmentCollection) throws IOException { Iterator iter = attachmentCollection.iterator(); while (iter.hasNext()) { PSExtensionAttachment attachment = (PSExtensionAttachment)iter.next(); if (attachment != null) { writeEnclosedExtensionAttachment(gen, attachment); } iter.remove(); } }
/** * Formats and writes a Collection of PSExtensionAttachment instances to * the output stream. The instances are removed from the collection when they * have been written. * * @param gen the PS generator * @param attachmentCollection * a Collection of PSExtensionAttachment instances * @throws IOException if an I/O error occurs. */
Formats and writes a Collection of PSExtensionAttachment instances to the output stream. The instances are removed from the collection when they have been written
writeEnclosedExtensionAttachments
{ "repo_name": "chunlinyao/fop", "path": "fop-core/src/main/java/org/apache/fop/render/ps/PSRenderingUtil.java", "license": "apache-2.0", "size": 11882 }
[ "java.io.IOException", "java.util.Collection", "java.util.Iterator", "org.apache.fop.render.ps.extensions.PSExtensionAttachment", "org.apache.xmlgraphics.ps.PSGenerator" ]
import java.io.IOException; import java.util.Collection; import java.util.Iterator; import org.apache.fop.render.ps.extensions.PSExtensionAttachment; import org.apache.xmlgraphics.ps.PSGenerator;
import java.io.*; import java.util.*; import org.apache.fop.render.ps.extensions.*; import org.apache.xmlgraphics.ps.*;
[ "java.io", "java.util", "org.apache.fop", "org.apache.xmlgraphics" ]
java.io; java.util; org.apache.fop; org.apache.xmlgraphics;
763,009
private void checkWebSocketConnectionState() throws WebSocketException { if (!isSupported()) { throw new WebSocketException("WebSocket is not supported."); } if (getReadyState() != ReadyState.OPEN) { throw new WebSocketException("WebSocket is not opened."); } } private class WsListener implements ConnectionOpenedHandler, ConnectionClosedHandler, ConnectionErrorHandler {
void function() throws WebSocketException { if (!isSupported()) { throw new WebSocketException(STR); } if (getReadyState() != ReadyState.OPEN) { throw new WebSocketException(STR); } } private class WsListener implements ConnectionOpenedHandler, ConnectionClosedHandler, ConnectionErrorHandler {
/** * Check WebSocket connection and throws {@link WebSocketException} if WebSocket connection is not ready to use. * * @throws WebSocketException * throws if WebSocket connection is not ready to use */
Check WebSocket connection and throws <code>WebSocketException</code> if WebSocket connection is not ready to use
checkWebSocketConnectionState
{ "repo_name": "Ori-Libhaber/che-core", "path": "commons/che-core-commons-gwt/src/main/java/org/eclipse/che/ide/websocket/MessageBusImpl.java", "license": "epl-1.0", "size": 19769 }
[ "org.eclipse.che.ide.websocket.events.ConnectionClosedHandler", "org.eclipse.che.ide.websocket.events.ConnectionErrorHandler", "org.eclipse.che.ide.websocket.events.ConnectionOpenedHandler" ]
import org.eclipse.che.ide.websocket.events.ConnectionClosedHandler; import org.eclipse.che.ide.websocket.events.ConnectionErrorHandler; import org.eclipse.che.ide.websocket.events.ConnectionOpenedHandler;
import org.eclipse.che.ide.websocket.events.*;
[ "org.eclipse.che" ]
org.eclipse.che;
600,652
public static boolean isMutable(String name, Map accessPoints) { AccessPoint p = (AccessPoint) accessPoints.get(name); if (p == null) return false; else return (p instanceof MutableAccessPoint); }
static boolean function(String name, Map accessPoints) { AccessPoint p = (AccessPoint) accessPoints.get(name); if (p == null) return false; else return (p instanceof MutableAccessPoint); }
/** * tests if the access point with the given name is mutable. * * @param name an access point's name * @param accessPoints a map containing access points * @return true iff the access point with the given name is a MutableAccessPoint */
tests if the access point with the given name is mutable
isMutable
{ "repo_name": "muhd7rosli/desmoj", "path": "src/desmoj/extensions/experimentation/util/AccessUtil.java", "license": "apache-2.0", "size": 9129 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
408,134
FrameSlot getReturnSlot();
FrameSlot getReturnSlot();
/** * Gets the return slot where the function return value is stored. * * @return the return slot. */
Gets the return slot where the function return value is stored
getReturnSlot
{ "repo_name": "lxp/sulong", "path": "projects/com.oracle.truffle.llvm.parser.base/src/com/oracle/truffle/llvm/parser/base/util/LLVMParserRuntime.java", "license": "bsd-3-clause", "size": 3708 }
[ "com.oracle.truffle.api.frame.FrameSlot" ]
import com.oracle.truffle.api.frame.FrameSlot;
import com.oracle.truffle.api.frame.*;
[ "com.oracle.truffle" ]
com.oracle.truffle;
223,959
public Date fetchProject(Context ctx, RsrDbAdapter dba, URL url) throws ParserConfigurationException, SAXException, IOException, FailedFetchException { HttpRequest h = getWithRedirect(ctx, url); int code = h.code(); String serverVersion = h.header(ConstantUtil.SERVER_VERSION_HEADER); Date serverDate = new Date(h.date()); if (code == 200) { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); ProjectExtraRestHandler myHandler = new ProjectExtraRestHandler(serverVersion); xr.setContentHandler(myHandler); xr.parse(new InputSource(h.stream())); Project proj = myHandler.getProject(); if (proj != null) { dba.saveProject(proj); Log.i(TAG, "Fetched project #" + proj.getId()); } else { Log.e(TAG, "Fetch project failed:" + myHandler.getError()); } } else { //Vanilla case is 403 forbidden on an auth failure Log.e(TAG, "Fetch project HTTP error code:" + code); Log.e(TAG, h.body()); throw new FailedFetchException("Unexpected server response " + code); } return serverDate; } //TODO make a a general paged-list fetch method
Date function(Context ctx, RsrDbAdapter dba, URL url) throws ParserConfigurationException, SAXException, IOException, FailedFetchException { HttpRequest h = getWithRedirect(ctx, url); int code = h.code(); String serverVersion = h.header(ConstantUtil.SERVER_VERSION_HEADER); Date serverDate = new Date(h.date()); if (code == 200) { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); ProjectExtraRestHandler myHandler = new ProjectExtraRestHandler(serverVersion); xr.setContentHandler(myHandler); xr.parse(new InputSource(h.stream())); Project proj = myHandler.getProject(); if (proj != null) { dba.saveProject(proj); Log.i(TAG, STR + proj.getId()); } else { Log.e(TAG, STR + myHandler.getError()); } } else { Log.e(TAG, STR + code); Log.e(TAG, h.body()); throw new FailedFetchException(STR + code); } return serverDate; }
/** * populates the projects table in the db from a server URL * @param ctx * @param url * @throws ParserConfigurationException * @throws SAXException * @throws FailedFetchException */
populates the projects table in the db from a server URL
fetchProject
{ "repo_name": "akvo/akvo-rsr-up", "path": "android/AkvoRSR/app/src/main/java/org/akvo/rsr/up/util/Downloader.java", "license": "agpl-3.0", "size": 30543 }
[ "android.content.Context", "android.util.Log", "com.github.kevinsawicki.http.HttpRequest", "java.io.IOException", "java.util.Date", "javax.xml.parsers.ParserConfigurationException", "javax.xml.parsers.SAXParser", "javax.xml.parsers.SAXParserFactory", "org.akvo.rsr.up.dao.RsrDbAdapter", "org.akvo.rsr.up.domain.Project", "org.akvo.rsr.up.xml.ProjectExtraRestHandler", "org.xml.sax.InputSource", "org.xml.sax.SAXException", "org.xml.sax.XMLReader" ]
import android.content.Context; import android.util.Log; import com.github.kevinsawicki.http.HttpRequest; import java.io.IOException; import java.util.Date; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.akvo.rsr.up.dao.RsrDbAdapter; import org.akvo.rsr.up.domain.Project; import org.akvo.rsr.up.xml.ProjectExtraRestHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader;
import android.content.*; import android.util.*; import com.github.kevinsawicki.http.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.akvo.rsr.up.dao.*; import org.akvo.rsr.up.domain.*; import org.akvo.rsr.up.xml.*; import org.xml.sax.*;
[ "android.content", "android.util", "com.github.kevinsawicki", "java.io", "java.util", "javax.xml", "org.akvo.rsr", "org.xml.sax" ]
android.content; android.util; com.github.kevinsawicki; java.io; java.util; javax.xml; org.akvo.rsr; org.xml.sax;
1,691,612
public ITableSortingState getSortingState() { return m_objSortingState; }
ITableSortingState function() { return m_objSortingState; }
/** * Returns the sortingState. * @return ITableSortingState */
Returns the sortingState
getSortingState
{ "repo_name": "apache/tapestry3", "path": "tapestry-contrib/src/org/apache/tapestry/contrib/table/model/simple/SimpleTableState.java", "license": "apache-2.0", "size": 1669 }
[ "org.apache.tapestry.contrib.table.model.ITableSortingState" ]
import org.apache.tapestry.contrib.table.model.ITableSortingState;
import org.apache.tapestry.contrib.table.model.*;
[ "org.apache.tapestry" ]
org.apache.tapestry;
963,679
Double value = getMaterialDensityLUT().get(name); if (value == null) System.out.println("Error value was null: " + name); Material material = MaterialsDB.getMaterialWithName("Water"); material.setName(name + " (water w rho=" + value + " [g/cm^3])"); if (name.contains("Bone")) material = MaterialsDB.getMaterialWithName("Bone"); if (name.contains("Marrow")) material = MaterialsDB.getMaterialWithName("Bonemarrow"); if (name.contains("Catheter")) material = MaterialsDB.getMaterialWithName("copper"); material.setDensity(value); // using custom contrast agent from tutorial code. // in this material the density is already set correctly. if (name.contains("Coronary Artery")) { material = MaterialsDB.getMaterialWithName("Ultravist370"); } return material; }
Double value = getMaterialDensityLUT().get(name); if (value == null) System.out.println(STR + name); Material material = MaterialsDB.getMaterialWithName("Water"); material.setName(name + STR + value + STR); if (name.contains("Bone")) material = MaterialsDB.getMaterialWithName("Bone"); if (name.contains(STR)) material = MaterialsDB.getMaterialWithName(STR); if (name.contains(STR)) material = MaterialsDB.getMaterialWithName(STR); material.setDensity(value); if (name.contains(STR)) { material = MaterialsDB.getMaterialWithName(STR); } return material; }
/** * Get the material from its name. * @param name the name * @return the material */
Get the material from its name
generateFromMaterialName
{ "repo_name": "kristina-san/CONRAD", "path": "src/edu/stanford/rsl/conrad/phantom/xcat/XCatMaterialGenerator.java", "license": "gpl-3.0", "size": 6069 }
[ "edu.stanford.rsl.conrad.physics.materials.Material", "edu.stanford.rsl.conrad.physics.materials.database.MaterialsDB" ]
import edu.stanford.rsl.conrad.physics.materials.Material; import edu.stanford.rsl.conrad.physics.materials.database.MaterialsDB;
import edu.stanford.rsl.conrad.physics.materials.*; import edu.stanford.rsl.conrad.physics.materials.database.*;
[ "edu.stanford.rsl" ]
edu.stanford.rsl;
2,704,537
@SuppressWarnings("unchecked") public Type log(LoggingLevel loggingLevel, Logger logger, String marker, String message) { LogDefinition answer = new LogDefinition(message); answer.setLoggingLevel(loggingLevel); answer.setLogger(logger); answer.setMarker(marker); addOutput(answer); return (Type) this; }
@SuppressWarnings(STR) Type function(LoggingLevel loggingLevel, Logger logger, String marker, String message) { LogDefinition answer = new LogDefinition(message); answer.setLoggingLevel(loggingLevel); answer.setLogger(logger); answer.setMarker(marker); addOutput(answer); return (Type) this; }
/** * Creates a log message to be logged at the given level using provided logger. * * * @param loggingLevel the logging level to use * @param logger the logger to use * @param marker log marker name * @param message the log message, (you can use {@link org.apache.camel.language.simple.SimpleLanguage} syntax) * @return the builder */
Creates a log message to be logged at the given level using provided logger
log
{ "repo_name": "oscerd/camel", "path": "camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java", "license": "apache-2.0", "size": 144870 }
[ "org.apache.camel.LoggingLevel", "org.slf4j.Logger" ]
import org.apache.camel.LoggingLevel; import org.slf4j.Logger;
import org.apache.camel.*; import org.slf4j.*;
[ "org.apache.camel", "org.slf4j" ]
org.apache.camel; org.slf4j;
945,645
private boolean validateEmail(String email) { Pattern pattern = Pattern.compile(EMAIL_PATTERN); Matcher matcher = pattern.matcher(email); return matcher.matches(); } // @POST // @Path("/login") // @Consumes(MediaType.APPLICATION_JSON) // public JSONResponse login(User user) throws AuthenticationException { // Optional<User> res = RestaurantApplication.cachedAuthenticator.authenticate(user.toCredentials()); // if ( res.isPresent() ) { // return new JSONResponse(200, res.get().toString(), null); // } else { // throw new MessageException("Unable to log in with those credentials!"); // } // }
boolean function(String email) { Pattern pattern = Pattern.compile(EMAIL_PATTERN); Matcher matcher = pattern.matcher(email); return matcher.matches(); }
/** * This method is used for validate email syntax with regex * @param email This is * @return boolean This return true if syntax is correct */
This method is used for validate email syntax with regex
validateEmail
{ "repo_name": "basti1dr/api_dropwizard", "path": "src/main/java/com/rentmycourt/api/resources/UserResource.java", "license": "mit", "size": 2866 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
2,440,143
public void addActualArgument(Object handle, Object argument) { if (handle instanceof MAction && argument instanceof MArgument) { ((MAction) handle).addActualArgument((MArgument) argument); return; } throw new IllegalArgumentException("handle: " + handle + " or argument: " + argument); }
void function(Object handle, Object argument) { if (handle instanceof MAction && argument instanceof MArgument) { ((MAction) handle).addActualArgument((MArgument) argument); return; } throw new IllegalArgumentException(STR + handle + STR + argument); }
/** * Adds an actual argument to an action. * * @param handle the action * @param argument the argument */
Adds an actual argument to an action
addActualArgument
{ "repo_name": "carvalhomb/tsmells", "path": "sample/argouml/argouml/org/argouml/model/uml/CommonBehaviorHelperImpl.java", "license": "gpl-2.0", "size": 21931 }
[ "ru.novosoft.uml.behavior.common_behavior.MAction", "ru.novosoft.uml.behavior.common_behavior.MArgument" ]
import ru.novosoft.uml.behavior.common_behavior.MAction; import ru.novosoft.uml.behavior.common_behavior.MArgument;
import ru.novosoft.uml.behavior.common_behavior.*;
[ "ru.novosoft.uml" ]
ru.novosoft.uml;
983,225
static public String millisToEasDateTime(long millis, TimeZone tz, boolean withTime) { StringBuilder sb = new StringBuilder(); GregorianCalendar cal = new GregorianCalendar(tz); cal.setTimeInMillis(millis); sb.append(cal.get(Calendar.YEAR)); sb.append(formatTwo(cal.get(Calendar.MONTH) + 1)); sb.append(formatTwo(cal.get(Calendar.DAY_OF_MONTH))); if (withTime) { sb.append('T'); sb.append(formatTwo(cal.get(Calendar.HOUR_OF_DAY))); sb.append(formatTwo(cal.get(Calendar.MINUTE))); sb.append(formatTwo(cal.get(Calendar.SECOND))); if (tz == sGmtTimeZone) { sb.append('Z'); } } return sb.toString(); }
static String function(long millis, TimeZone tz, boolean withTime) { StringBuilder sb = new StringBuilder(); GregorianCalendar cal = new GregorianCalendar(tz); cal.setTimeInMillis(millis); sb.append(cal.get(Calendar.YEAR)); sb.append(formatTwo(cal.get(Calendar.MONTH) + 1)); sb.append(formatTwo(cal.get(Calendar.DAY_OF_MONTH))); if (withTime) { sb.append('T'); sb.append(formatTwo(cal.get(Calendar.HOUR_OF_DAY))); sb.append(formatTwo(cal.get(Calendar.MINUTE))); sb.append(formatTwo(cal.get(Calendar.SECOND))); if (tz == sGmtTimeZone) { sb.append('Z'); } } return sb.toString(); }
/** * Generate an EAS formatted local date/time string from a time and a time zone. If the final * argument is false, only a date will be returned (e.g. 20100331) * @param millis a time in milliseconds * @param tz a time zone * @param withTime if the time is to be included in the string * @return an EAS formatted string indicating the date (and time) in the given time zone */
Generate an EAS formatted local date/time string from a time and a time zone. If the final argument is false, only a date will be returned (e.g. 20100331)
millisToEasDateTime
{ "repo_name": "rex-xxx/mt6572_x201", "path": "packages/apps/Exchange/exchange2/src/com/android/exchange/utility/CalendarUtilities.java", "license": "gpl-2.0", "size": 91569 }
[ "java.util.Calendar", "java.util.GregorianCalendar", "java.util.TimeZone" ]
import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone;
import java.util.*;
[ "java.util" ]
java.util;
381,592
private void populateModel(Model model, EmployeeBean employee, FormMode formMode) { //--- Main entity List<LookUp> genderLookup=CommonMasterUtility.getLookUps("GEN",UserSession.getCurrent().getOrganisation()); List<LookUp> titleLookup=CommonMasterUtility.getLookUps("TTL",UserSession.getCurrent().getOrganisation()); Map<Long, String> groupLookup=employeeService.getGroupList(UserSession.getCurrent().getOrganisation().getOrgid()); model.addAttribute("command", model); model.addAttribute(genderLookups_init, genderLookup); model.addAttribute(titleLookups_init, titleLookup); model.addAttribute(Group_Map, groupLookup); model.addAttribute(MAIN_ENTITY_NAME, employee); if ( formMode == FormMode.CREATE ) { model.addAttribute(MODE, MODE_CREATE); // The form is in "create" mode model.addAttribute(SAVE_ACTION, SAVE_ACTION_CREATE); } else if ( formMode == FormMode.UPDATE ) { model.addAttribute(MODE, MODE_UPDATE); // The form is in "update" mode model.addAttribute(SAVE_ACTION, SAVE_ACTION_UPDATE); } }
void function(Model model, EmployeeBean employee, FormMode formMode) { List<LookUp> genderLookup=CommonMasterUtility.getLookUps("GEN",UserSession.getCurrent().getOrganisation()); List<LookUp> titleLookup=CommonMasterUtility.getLookUps("TTL",UserSession.getCurrent().getOrganisation()); Map<Long, String> groupLookup=employeeService.getGroupList(UserSession.getCurrent().getOrganisation().getOrgid()); model.addAttribute(STR, model); model.addAttribute(genderLookups_init, genderLookup); model.addAttribute(titleLookups_init, titleLookup); model.addAttribute(Group_Map, groupLookup); model.addAttribute(MAIN_ENTITY_NAME, employee); if ( formMode == FormMode.CREATE ) { model.addAttribute(MODE, MODE_CREATE); model.addAttribute(SAVE_ACTION, SAVE_ACTION_CREATE); } else if ( formMode == FormMode.UPDATE ) { model.addAttribute(MODE, MODE_UPDATE); model.addAttribute(SAVE_ACTION, SAVE_ACTION_UPDATE); } }
/** * Populates the Spring MVC model with the given entity and eventually other useful data * @param model * @param employee */
Populates the Spring MVC model with the given entity and eventually other useful data
populateModel
{ "repo_name": "abmindiarepomanager/ABMOpenMainet", "path": "Mainet1.0/MainetServiceParent/MainetServiceCommon/src/main/java/com/abm/mainet/common/master/ui/controller/EmployeeController.java", "license": "gpl-3.0", "size": 25756 }
[ "com.abm.mainet.common.constant.FormMode", "com.abm.mainet.common.master.dto.EmployeeBean", "com.abm.mainet.common.utility.CommonMasterUtility", "com.abm.mainet.common.utility.LookUp", "com.abm.mainet.common.utility.UserSession", "java.util.List", "java.util.Map", "org.springframework.ui.Model" ]
import com.abm.mainet.common.constant.FormMode; import com.abm.mainet.common.master.dto.EmployeeBean; import com.abm.mainet.common.utility.CommonMasterUtility; import com.abm.mainet.common.utility.LookUp; import com.abm.mainet.common.utility.UserSession; import java.util.List; import java.util.Map; import org.springframework.ui.Model;
import com.abm.mainet.common.constant.*; import com.abm.mainet.common.master.dto.*; import com.abm.mainet.common.utility.*; import java.util.*; import org.springframework.ui.*;
[ "com.abm.mainet", "java.util", "org.springframework.ui" ]
com.abm.mainet; java.util; org.springframework.ui;
1,497,750
public int expand(@IntRange(from = 0) int position, boolean animate, boolean shouldNotify) { position -= getHeaderLayoutCount(); IExpandable expandable = getExpandableItem(position); if (expandable == null) { return 0; } if (!hasSubItems(expandable)) { expandable.setExpanded(false); return 0; } int subItemCount = 0; if (!expandable.isExpanded()) { List list = expandable.getSubItems(); mData.addAll(position + 1, list); subItemCount += recursiveExpand(position + 1, list); expandable.setExpanded(true); subItemCount += list.size(); } int parentPos = position + getHeaderLayoutCount(); if (shouldNotify) { if (animate) { notifyItemChanged(parentPos); notifyItemRangeInserted(parentPos + 1, subItemCount); } else { notifyDataSetChanged(); } } return subItemCount; }
int function(@IntRange(from = 0) int position, boolean animate, boolean shouldNotify) { position -= getHeaderLayoutCount(); IExpandable expandable = getExpandableItem(position); if (expandable == null) { return 0; } if (!hasSubItems(expandable)) { expandable.setExpanded(false); return 0; } int subItemCount = 0; if (!expandable.isExpanded()) { List list = expandable.getSubItems(); mData.addAll(position + 1, list); subItemCount += recursiveExpand(position + 1, list); expandable.setExpanded(true); subItemCount += list.size(); } int parentPos = position + getHeaderLayoutCount(); if (shouldNotify) { if (animate) { notifyItemChanged(parentPos); notifyItemRangeInserted(parentPos + 1, subItemCount); } else { notifyDataSetChanged(); } } return subItemCount; }
/** * Expand an expandable item * * @param position position of the item * @param animate expand items with animation * @param shouldNotify notify the RecyclerView to rebind items, <strong>false</strong> if you want to do it yourself. * @return the number of items that have been added. */
Expand an expandable item
expand
{ "repo_name": "mcshengInworking/MFrame", "path": "library/src/main/java/com/mcs/mframe/ui/recyclerview/BaseQuickAdapter.java", "license": "apache-2.0", "size": 45444 }
[ "android.support.annotation.IntRange", "com.mcs.mframe.ui.recyclerview.entity.IExpandable", "java.util.List" ]
import android.support.annotation.IntRange; import com.mcs.mframe.ui.recyclerview.entity.IExpandable; import java.util.List;
import android.support.annotation.*; import com.mcs.mframe.ui.recyclerview.entity.*; import java.util.*;
[ "android.support", "com.mcs.mframe", "java.util" ]
android.support; com.mcs.mframe; java.util;
2,336,226
void doHome(ServletContext ctx, HttpServletRequest req, HttpServletResponse resp, String userID, String results) throws javax.servlet.ServletException, java.io.IOException { try { AccountDataBean accountData = tAction.getAccountData(userID); Collection<?> holdingDataBeans = tAction.getHoldings(userID); // Edge Caching: // Getting the MarketSummary has been moved to the JSP // MarketSummary.jsp. This makes the MarketSummary a // standalone "fragment", and thus is a candidate for // Edge caching. // marketSummaryData = tAction.getMarketSummary(); req.setAttribute("accountData", accountData); req.setAttribute("holdingDataBeans", holdingDataBeans); // See Edge Caching above // req.setAttribute("marketSummaryData", marketSummaryData); req.setAttribute("results", results); } catch (java.lang.IllegalArgumentException e) { // this is a user // error so I will // forward them to another page rather than throw a 500 req.setAttribute("results", results + "check userID = " + userID + " and that the database is populated"); requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE)); // log the exception with an error level of 3 which means, handled // exception but would invalidate a automation run Log.error("TradeServletAction.doHome(...)" + "illegal argument, information should be in exception string" + "treating this as a user error and forwarding on to a new page", e); } catch (javax.ejb.FinderException e) { // this is a user error so I will // forward them to another page rather than throw a 500 req.setAttribute("results", results + "\nCould not find account for + " + userID); // requestDispatch(ctx, req, resp, // TradeConfig.getPage(TradeConfig.HOME_PAGE)); // log the exception with an error level of 3 which means, handled // exception but would invalidate a automation run Log.error("TradeServletAction.doHome(...)" + "Error finding account for user " + userID + "treating this as a user error and forwarding on to a new page", e); } catch (Exception e) { // log the exception with error page throw new ServletException("TradeServletAction.doHome(...)" + " exception user =" + userID, e); } requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE)); }
void doHome(ServletContext ctx, HttpServletRequest req, HttpServletResponse resp, String userID, String results) throws javax.servlet.ServletException, java.io.IOException { try { AccountDataBean accountData = tAction.getAccountData(userID); Collection<?> holdingDataBeans = tAction.getHoldings(userID); req.setAttribute(STR, accountData); req.setAttribute(STR, holdingDataBeans); req.setAttribute(STR, results); } catch (java.lang.IllegalArgumentException e) { req.setAttribute(STR, results + STR + userID + STR); requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE)); Log.error(STR + STR + STR, e); } catch (javax.ejb.FinderException e) { req.setAttribute(STR, results + STR + userID); Log.error(STR + STR + userID + STR, e); } catch (Exception e) { throw new ServletException(STR + STR + userID, e); } requestDispatch(ctx, req, resp, userID, TradeConfig.getPage(TradeConfig.HOME_PAGE)); }
/** * Create the Trade Home page with personalized information such as the * traders account balance Dispatch to the Trade Home JSP for display * * @param ctx * the servlet context * @param req * the HttpRequest object * @param resp * the HttpResponse object * @param results * A short description of the results/success of this web request * provided on the web page * @exception javax.servlet.ServletException * If a servlet specific exception is encountered * @exception javax.io.IOException * If an exception occurs while writing results back to the * user * */
Create the Trade Home page with personalized information such as the traders account balance Dispatch to the Trade Home JSP for display
doHome
{ "repo_name": "WASdev/sample.daytrader7", "path": "daytrader-ee7-web/src/main/java/com/ibm/websphere/samples/daytrader/web/TradeServletAction.java", "license": "apache-2.0", "size": 29754 }
[ "com.ibm.websphere.samples.daytrader.entities.AccountDataBean", "com.ibm.websphere.samples.daytrader.util.Log", "com.ibm.websphere.samples.daytrader.util.TradeConfig", "java.io.IOException", "java.util.Collection", "javax.servlet.ServletContext", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import com.ibm.websphere.samples.daytrader.entities.AccountDataBean; import com.ibm.websphere.samples.daytrader.util.Log; import com.ibm.websphere.samples.daytrader.util.TradeConfig; import java.io.IOException; import java.util.Collection; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import com.ibm.websphere.samples.daytrader.entities.*; import com.ibm.websphere.samples.daytrader.util.*; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*;
[ "com.ibm.websphere", "java.io", "java.util", "javax.servlet" ]
com.ibm.websphere; java.io; java.util; javax.servlet;
1,267,278
public void setDiskSpace(DiskQuota quota);
void function(DiskQuota quota);
/** * Sets the used and available disk space. * * @param qota The value to set. */
Sets the used and available disk space
setDiskSpace
{ "repo_name": "jballanc/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/view/Importer.java", "license": "gpl-2.0", "size": 11843 }
[ "org.openmicroscopy.shoola.env.data.model.DiskQuota" ]
import org.openmicroscopy.shoola.env.data.model.DiskQuota;
import org.openmicroscopy.shoola.env.data.model.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
2,355,857
public Collection<Path> scan(IProgressMonitor monitor) throws CoreException { try { scanDir(rootDir, (monitor == null? new NullProgressMonitor(): monitor)); } catch (IOException e) { throw new CoreException(StatusFactory.newErrorStatus("Failed to scan "+rootDir, e)); } return getDirectories(); }
Collection<Path> function(IProgressMonitor monitor) throws CoreException { try { scanDir(rootDir, (monitor == null? new NullProgressMonitor(): monitor)); } catch (IOException e) { throw new CoreException(StatusFactory.newErrorStatus(STR+rootDir, e)); } return getDirectories(); }
/** * Scan the the directories found to be containing the sought-after file. * @param monitor the {@link IProgressMonitor} used to handle scan interruption. * @return an unmodifiable collection of {@link Path}s. * @throws CoreException if an error is encountered during the scan */
Scan the the directories found to be containing the sought-after file
scan
{ "repo_name": "gorkem/java-language-server", "path": "org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/managers/BasicFileDetector.java", "license": "epl-1.0", "size": 6376 }
[ "java.io.IOException", "java.nio.file.Path", "java.util.Collection", "org.eclipse.core.runtime.CoreException", "org.eclipse.core.runtime.IProgressMonitor", "org.eclipse.core.runtime.NullProgressMonitor", "org.eclipse.jdt.ls.core.internal.StatusFactory" ]
import java.io.IOException; import java.nio.file.Path; import java.util.Collection; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.jdt.ls.core.internal.StatusFactory;
import java.io.*; import java.nio.file.*; import java.util.*; import org.eclipse.core.runtime.*; import org.eclipse.jdt.ls.core.internal.*;
[ "java.io", "java.nio", "java.util", "org.eclipse.core", "org.eclipse.jdt" ]
java.io; java.nio; java.util; org.eclipse.core; org.eclipse.jdt;
1,389,825
public Set<PrivilegeEntity> getPrivileges() { return privileges; }
Set<PrivilegeEntity> function() { return privileges; }
/** * Get the principal privileges. * * @return the principal privileges */
Get the principal privileges
getPrivileges
{ "repo_name": "zouzhberk/ambaridemo", "path": "demo-server/src/main/java/org/apache/ambari/server/orm/entities/PrincipalEntity.java", "license": "apache-2.0", "size": 4296 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,625,108
public void onDeath(DamageSource cause) { super.onDeath(cause); if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) cause.getEntity(); double d0 = entityplayer.posX - posX; double d1 = entityplayer.posZ - posZ; if (d0 * d0 + d1 * d1 >= 2500.0D) { entityplayer.addStat(AchievementList.SNIPE_SKELETON); } } else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper) cause.getEntity()).getPowered() && ((EntityCreeper) cause.getEntity()).isAIEnabled()) { ((EntityCreeper) cause.getEntity()).incrementDroppedSkulls(); entityDropItem(new ItemStack(Items.SKULL, 1, getSkeletonType() == SkeletonType.WITHER ? 1 : 0), 0.0F); } }
void function(DamageSource cause) { super.onDeath(cause); if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) cause.getEntity(); double d0 = entityplayer.posX - posX; double d1 = entityplayer.posZ - posZ; if (d0 * d0 + d1 * d1 >= 2500.0D) { entityplayer.addStat(AchievementList.SNIPE_SKELETON); } } else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper) cause.getEntity()).getPowered() && ((EntityCreeper) cause.getEntity()).isAIEnabled()) { ((EntityCreeper) cause.getEntity()).incrementDroppedSkulls(); entityDropItem(new ItemStack(Items.SKULL, 1, getSkeletonType() == SkeletonType.WITHER ? 1 : 0), 0.0F); } }
/** * Called when the mob's health reaches 0. */
Called when the mob's health reaches 0
onDeath
{ "repo_name": "EPIICTHUNDERCAT/TameableMobs", "path": "src/main/java/com/github/epiicthundercat/tameablemobs/mobs/TameableSkeleton.java", "license": "mit", "size": 40155 }
[ "net.minecraft.entity.monster.EntityCreeper", "net.minecraft.entity.monster.SkeletonType", "net.minecraft.entity.player.EntityPlayer", "net.minecraft.entity.projectile.EntityArrow", "net.minecraft.init.Items", "net.minecraft.item.ItemStack", "net.minecraft.stats.AchievementList", "net.minecraft.util.DamageSource" ]
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.SkeletonType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; import net.minecraft.util.DamageSource;
import net.minecraft.entity.monster.*; import net.minecraft.entity.player.*; import net.minecraft.entity.projectile.*; import net.minecraft.init.*; import net.minecraft.item.*; import net.minecraft.stats.*; import net.minecraft.util.*;
[ "net.minecraft.entity", "net.minecraft.init", "net.minecraft.item", "net.minecraft.stats", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.init; net.minecraft.item; net.minecraft.stats; net.minecraft.util;
919,115
public void testDropLocalAndForeignColumnFromFK() { final String model1Xml = "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+ "<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='roundtriptest'>\n"+ " <table name='roundtrip1'>\n"+ " <column name='pk1' type='VARCHAR' size='32' primaryKey='true' required='true'/>\n"+ " <column name='pk2' type='INTEGER' primaryKey='true' required='true'/>\n"+ " <column name='avalue' type='INTEGER'/>\n"+ " </table>\n"+ " <table name='roundtrip2'>\n"+ " <column name='pk' type='INTEGER' primaryKey='true' required='true'/>\n"+ " <column name='avalue1' type='VARCHAR' size='32'/>\n"+ " <column name='avalue2' type='INTEGER'/>\n"+ " <foreign-key foreignTable='roundtrip1'>\n"+ " <reference local='avalue1' foreign='pk1'/>\n"+ " <reference local='avalue2' foreign='pk2'/>\n"+ " </foreign-key>\n"+ " </table>\n"+ "</database>"; final String model2Xml = "<?xml version='1.0' encoding='ISO-8859-1'?>\n"+ "<database xmlns='" + DatabaseIO.DDLUTILS_NAMESPACE + "' name='roundtriptest'>\n"+ " <table name='roundtrip1'>\n"+ " <column name='pk2' type='INTEGER' primaryKey='true' required='true'/>\n"+ " <column name='avalue' type='INTEGER'/>\n"+ " </table>\n"+ " <table name='roundtrip2'>\n"+ " <column name='pk' type='INTEGER' primaryKey='true' required='true'/>\n"+ " <column name='avalue2' type='INTEGER'/>\n"+ " <foreign-key foreignTable='roundtrip1'>\n"+ " <reference local='avalue2' foreign='pk2'/>\n"+ " </foreign-key>\n"+ " </table>\n"+ "</database>"; createDatabase(model1Xml); insertRow("roundtrip1", new Object[] { "text", new Integer(2), new Integer(3) }); insertRow("roundtrip2", new Object[] { new Integer(1), "text", new Integer(2) }); alterDatabase(model2Xml); assertEquals(getAdjustedModel(), readModelFromDatabase("roundtriptest")); List beans1 = getRows("roundtrip1"); List beans2 = getRows("roundtrip2"); assertEquals(new Integer(2), beans1.get(0), "pk2"); assertEquals(new Integer(3), beans1.get(0), "avalue"); assertEquals(new Integer(1), beans2.get(0), "pk"); assertEquals(new Integer(2), beans2.get(0), "avalue2"); }
void function() { final String model1Xml = STR+ STR + DatabaseIO.DDLUTILS_NAMESPACE + STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR; final String model2Xml = STR+ STR + DatabaseIO.DDLUTILS_NAMESPACE + STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR+ STR; createDatabase(model1Xml); insertRow(STR, new Object[] { "text", new Integer(2), new Integer(3) }); insertRow(STR, new Object[] { new Integer(1), "text", new Integer(2) }); alterDatabase(model2Xml); assertEquals(getAdjustedModel(), readModelFromDatabase(STR)); List beans1 = getRows(STR); List beans2 = getRows(STR); assertEquals(new Integer(2), beans1.get(0), "pk2"); assertEquals(new Integer(3), beans1.get(0), STR); assertEquals(new Integer(1), beans2.get(0), "pk"); assertEquals(new Integer(2), beans2.get(0), STR); }
/** * Tests the removal of a local and foreign column from a foreign key. */
Tests the removal of a local and foreign column from a foreign key
testDropLocalAndForeignColumnFromFK
{ "repo_name": "qxo/ddlutils", "path": "src/test/java/org/apache/ddlutils/io/TestDropColumn.java", "license": "apache-2.0", "size": 42235 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,006,147
public int read2LE() throws OtpErlangDecodeException { final byte[] b = new byte[2]; try { super.read(b); } catch (final IOException e) { throw new OtpErlangDecodeException("Cannot read from input stream"); } return (b[1] << 8 & 0xff00) + (b[0] & 0xff); }
int function() throws OtpErlangDecodeException { final byte[] b = new byte[2]; try { super.read(b); } catch (final IOException e) { throw new OtpErlangDecodeException(STR); } return (b[1] << 8 & 0xff00) + (b[0] & 0xff); }
/** * Read a two byte little endian integer from the stream. * * @return the bytes read, converted from little endian to an integer. * * @exception OtpErlangDecodeException * if the next byte cannot be read. */
Read a two byte little endian integer from the stream
read2LE
{ "repo_name": "aboroska/otp", "path": "lib/jinterface/java_src/com/ericsson/otp/erlang/OtpInputStream.java", "license": "apache-2.0", "size": 39418 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,305,743
protected EventContext newUserInGroup(ExperimenterGroup group, boolean owner) throws Exception { IAdminPrx rootAdmin = root.getSession().getAdminService(); group = rootAdmin.getGroup(group.getId().getValue()); String uuid = UUID.randomUUID().toString(); Experimenter e = new ExperimenterI(); e.setOmeName(omero.rtypes.rstring(uuid)); e.setFirstName(omero.rtypes.rstring("integration")); e.setLastName(omero.rtypes.rstring("tester")); e.setLdap(omero.rtypes.rbool(false)); long id = newUserInGroupWithPassword(e, group, uuid); e = rootAdmin.getExperimenter(id); rootAdmin.addGroups(e, Arrays.asList(group)); if (owner) { rootAdmin.addGroupOwners(group, Arrays.asList(e)); } omero.client client = newOmeroClient(); client.createSession(uuid, uuid); return init(client); }
EventContext function(ExperimenterGroup group, boolean owner) throws Exception { IAdminPrx rootAdmin = root.getSession().getAdminService(); group = rootAdmin.getGroup(group.getId().getValue()); String uuid = UUID.randomUUID().toString(); Experimenter e = new ExperimenterI(); e.setOmeName(omero.rtypes.rstring(uuid)); e.setFirstName(omero.rtypes.rstring(STR)); e.setLastName(omero.rtypes.rstring(STR)); e.setLdap(omero.rtypes.rbool(false)); long id = newUserInGroupWithPassword(e, group, uuid); e = rootAdmin.getExperimenter(id); rootAdmin.addGroups(e, Arrays.asList(group)); if (owner) { rootAdmin.addGroupOwners(group, Arrays.asList(e)); } omero.client client = newOmeroClient(); client.createSession(uuid, uuid); return init(client); }
/** * Creates a new user in the specified group. * * @param group * The group to add the user to. * @param owner * Pass <code>true</code> to indicate that the new user is an * owner of the group, <code>false</code> otherwise. * @return The context. * @throws Exception * Thrown if an error occurred. */
Creates a new user in the specified group
newUserInGroup
{ "repo_name": "tp81/openmicroscopy", "path": "components/tools/OmeroJava/test/integration/AbstractServerTest.java", "license": "gpl-2.0", "size": 80125 }
[ "java.util.Arrays", "java.util.UUID" ]
import java.util.Arrays; import java.util.UUID;
import java.util.*;
[ "java.util" ]
java.util;
799,646
public static String hmacSha384Hex(final byte[] key, final byte[] valueToDigest) { return Hex.encodeHexString(hmacSha384(key, valueToDigest)); }
static String function(final byte[] key, final byte[] valueToDigest) { return Hex.encodeHexString(hmacSha384(key, valueToDigest)); }
/** * Returns a HmacSHA384 Message Authentication Code (MAC) as hex string (lowercase) for the given key and value. * * @param key * They key for the keyed digest (must not be null) * @param valueToDigest * The value (data) which should to digest (maybe empty or null) * @return HmacSHA384 MAC for the given key and value as hex string (lowercase) * @throws IllegalArgumentException * when a {@link NoSuchAlgorithmException} is caught or key is null or key is invalid. */
Returns a HmacSHA384 Message Authentication Code (MAC) as hex string (lowercase) for the given key and value
hmacSha384Hex
{ "repo_name": "MaxCDN/java-maxcdn", "path": "src/org/apache/commons/codec/digest/HmacUtils.java", "license": "mit", "size": 34353 }
[ "org.apache.commons.codec.binary.Hex" ]
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.codec.binary.*;
[ "org.apache.commons" ]
org.apache.commons;
2,269,676
public static Collection<String> readCollection(final Properties props, final String name, final boolean required, final Class<? extends Collection> clazz) throws InstantiationException, IllegalAccessException { final String value = readString(props, name, required); if (StringUtil.isNullOrEmpty(value) && !required) { return null; } final Collection<String> result = clazz.newInstance(); if (!StringUtil.isNullOrEmpty(value)) { result.addAll(Arrays.asList(value.split(DELIMITER))); } return result; }
static Collection<String> function(final Properties props, final String name, final boolean required, final Class<? extends Collection> clazz) throws InstantiationException, IllegalAccessException { final String value = readString(props, name, required); if (StringUtil.isNullOrEmpty(value) && !required) { return null; } final Collection<String> result = clazz.newInstance(); if (!StringUtil.isNullOrEmpty(value)) { result.addAll(Arrays.asList(value.split(DELIMITER))); } return result; }
/** * Reads the string's collection from given Properties object. * And if the property isn't found, then depending on the <i>"required"</i> value, * method will ends program throws ConfigException object or returns <i>null</i>.. * * @param props Properties object to read from. * @param name Key to find the number in <i>props</i> object. * @param required true if methods should ends with ConfigException in cease of property absence. * @param clazz type of returned collection * @return Collection of Strings specified as one String separated with * {@link de.consistec.doubleganger.common.Config#DELIMITER } in given Properties object under the key * <i>"name"</i> * @throws InstantiationException * @throws IllegalAccessException */
Reads the string's collection from given Properties object. And if the property isn't found, then depending on the "required" value, method will ends program throws ConfigException object or returns null.
readCollection
{ "repo_name": "consistec/doubleganger", "path": "common/src/main/java/de/consistec/doubleganger/common/util/PropertiesUtil.java", "license": "gpl-3.0", "size": 10146 }
[ "java.util.Arrays", "java.util.Collection", "java.util.Properties" ]
import java.util.Arrays; import java.util.Collection; import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
859,119
public UrlFileExtensionMatchConditionParameters withTransforms(List<Transform> transforms) { this.transforms = transforms; return this; }
UrlFileExtensionMatchConditionParameters function(List<Transform> transforms) { this.transforms = transforms; return this; }
/** * Set the transforms property: List of transforms. * * @param transforms the transforms value to set. * @return the UrlFileExtensionMatchConditionParameters object itself. */
Set the transforms property: List of transforms
withTransforms
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-cdn/src/main/java/com/azure/resourcemanager/cdn/models/UrlFileExtensionMatchConditionParameters.java", "license": "mit", "size": 5113 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,408,761
public static InputStream toInputStream (final String string, final Charset charset) { return new ByteArrayInputStream(string.getBytes(charset)); }
static InputStream function (final String string, final Charset charset) { return new ByteArrayInputStream(string.getBytes(charset)); }
/** * Build an input stream from the specified string in the encoding specified. * @param string * the string to use. * @param charset * the charset to use. * @return the input stream. */
Build an input stream from the specified string in the encoding specified
toInputStream
{ "repo_name": "AlexRNL/Commons", "path": "src/main/java/com/alexrnl/commons/io/IOUtils.java", "license": "bsd-3-clause", "size": 4097 }
[ "java.io.ByteArrayInputStream", "java.io.InputStream", "java.nio.charset.Charset" ]
import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
1,833,160
public void removeOnAdapterChangeListener(@NonNull OnAdapterChangeListener listener) { if (mAdapterChangeListeners != null) { mAdapterChangeListeners.remove(listener); } }
void function(@NonNull OnAdapterChangeListener listener) { if (mAdapterChangeListeners != null) { mAdapterChangeListeners.remove(listener); } }
/** * Remove a listener that was previously added via * {@link #addOnAdapterChangeListener(OnAdapterChangeListener)}. * * @param listener listener to remove */
Remove a listener that was previously added via <code>#addOnAdapterChangeListener(OnAdapterChangeListener)</code>
removeOnAdapterChangeListener
{ "repo_name": "kazi-mifta/Campus-App", "path": "material-intro-screen/src/main/java/android/support/v4/view/CustomViewPager.java", "license": "mit", "size": 123780 }
[ "android.support.annotation.NonNull" ]
import android.support.annotation.NonNull;
import android.support.annotation.*;
[ "android.support" ]
android.support;
606,884
public LocalProcess executeVrl(String cmd, VRL vrl, boolean waitFor) throws VrsException { String cmdPath=this.getCommandPath(cmd); String cmds[]=new String[2]; cmds[0]=cmdPath; cmds[1]=vrl.toString(); return LocalExec.execute(cmds,waitFor); }
LocalProcess function(String cmd, VRL vrl, boolean waitFor) throws VrsException { String cmdPath=this.getCommandPath(cmd); String cmds[]=new String[2]; cmds[0]=cmdPath; cmds[1]=vrl.toString(); return LocalExec.execute(cmds,waitFor); }
/** * Simple starter: Start tool/command with plain VRL as argument. * Does not download the VRL and uses the plain string representation as first argument * to start the tool. * Tries to resolve the command 'cmd' to a local binary. */
Simple starter: Start tool/command with plain VRL as argument. Does not download the VRL and uses the plain string representation as first argument to start the tool. Tries to resolve the command 'cmd' to a local binary
executeVrl
{ "repo_name": "NLeSC/vbrowser", "path": "source.old/nl.esciencecenter.vlet.gui.utils/src/nl/esciencecenter/vlet/gui/viewers/external/ExternalToolDB.java", "license": "apache-2.0", "size": 3814 }
[ "nl.esciencecenter.vbrowser.vrs.exceptions.VrsException", "nl.esciencecenter.vlet.vrs.vdriver.localfs.LocalExec", "nl.esciencecenter.vlet.vrs.vdriver.localfs.LocalProcess" ]
import nl.esciencecenter.vbrowser.vrs.exceptions.VrsException; import nl.esciencecenter.vlet.vrs.vdriver.localfs.LocalExec; import nl.esciencecenter.vlet.vrs.vdriver.localfs.LocalProcess;
import nl.esciencecenter.vbrowser.vrs.exceptions.*; import nl.esciencecenter.vlet.vrs.vdriver.localfs.*;
[ "nl.esciencecenter.vbrowser", "nl.esciencecenter.vlet" ]
nl.esciencecenter.vbrowser; nl.esciencecenter.vlet;
1,425,313
@Test public void test_setAmount() { BigDecimal value = new BigDecimal(1); instance.setAmount(value); assertSame("'setAmount' should be correct.", value, TestsHelper.getField(instance, "amount")); }
void function() { BigDecimal value = new BigDecimal(1); instance.setAmount(value); assertSame(STR, value, TestsHelper.getField(instance, STR)); }
/** * <p> * Accuracy test for the method <code>setAmount(BigDecimal amount)</code>.<br> * The value should be properly set. * </p> */
Accuracy test for the method <code>setAmount(BigDecimal amount)</code>. The value should be properly set.
test_setAmount
{ "repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application", "path": "Code/FACES/src/java/tests/gov/opm/scrd/entities/application/PaymentUnitTests.java", "license": "apache-2.0", "size": 46209 }
[ "gov.opm.scrd.TestsHelper", "java.math.BigDecimal", "org.junit.Assert" ]
import gov.opm.scrd.TestsHelper; import java.math.BigDecimal; import org.junit.Assert;
import gov.opm.scrd.*; import java.math.*; import org.junit.*;
[ "gov.opm.scrd", "java.math", "org.junit" ]
gov.opm.scrd; java.math; org.junit;
696,259
public final boolean hasConfigScreen() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
final boolean function() { MetaClass c = WebApp.getCurrent().getMetaClass(getClass()); try { JellyClassTearOff tearOff = c.loadTearOff(JellyClassTearOff.class); return tearOff.findScript(getConfigPage())!=null; } catch(JellyException e) { return false; } }
/** * Returns true if this descriptor has <tt>config.jelly</tt>. */
Returns true if this descriptor has config.jelly
hasConfigScreen
{ "repo_name": "jbexten/plugin-ivy", "path": "src/main/java/hudson/ivy/IvyReporterDescriptor.java", "license": "apache-2.0", "size": 4080 }
[ "org.apache.commons.jelly.JellyException", "org.kohsuke.stapler.MetaClass", "org.kohsuke.stapler.WebApp", "org.kohsuke.stapler.jelly.JellyClassTearOff" ]
import org.apache.commons.jelly.JellyException; import org.kohsuke.stapler.MetaClass; import org.kohsuke.stapler.WebApp; import org.kohsuke.stapler.jelly.JellyClassTearOff;
import org.apache.commons.jelly.*; import org.kohsuke.stapler.*; import org.kohsuke.stapler.jelly.*;
[ "org.apache.commons", "org.kohsuke.stapler" ]
org.apache.commons; org.kohsuke.stapler;
119,058
@Test public void encodingsTest() throws ApiException { String factoryId = null; String videoId = null; String status = null; String profileId = null; String profileName = null; Integer page = null; Integer perPage = null; Boolean screenshots = null; Boolean preciseStatus = null; PaginatedEncodingsCollection response = api.encodings(factoryId, videoId, status, profileId, profileName, page, perPage, screenshots, preciseStatus); // TODO: test validations }
void function() throws ApiException { String factoryId = null; String videoId = null; String status = null; String profileId = null; String profileName = null; Integer page = null; Integer perPage = null; Boolean screenshots = null; Boolean preciseStatus = null; PaginatedEncodingsCollection response = api.encodings(factoryId, videoId, status, profileId, profileName, page, perPage, screenshots, preciseStatus); }
/** * Returns a list of Encoding objects * * * * @throws ApiException * if the Api call fails */
Returns a list of Encoding objects
encodingsTest
{ "repo_name": "Telestream/telestream-cloud-java-sdk", "path": "telestream-cloud-flip-sdk/src/test/java/net/telestream/cloud/flip/FlipApiTest.java", "license": "mit", "size": 19356 }
[ "net.telestream.cloud.flip.ApiException", "net.telestream.cloud.flip.PaginatedEncodingsCollection" ]
import net.telestream.cloud.flip.ApiException; import net.telestream.cloud.flip.PaginatedEncodingsCollection;
import net.telestream.cloud.flip.*;
[ "net.telestream.cloud" ]
net.telestream.cloud;
2,351,310
public static String uploadEmxFile(String adminToken, String fileName) { File file = getResourceFile(fileName); return uploadEmxFile(adminToken, file); }
static String function(String adminToken, String fileName) { File file = getResourceFile(fileName); return uploadEmxFile(adminToken, file); }
/** * Import emx file using add/update. * * <p>Importing is done async in the backend, but this methods waits for importing to be done. * * @param adminToken to use for login * @param fileName the file to upload * @return String indicating state of completed job */
Import emx file using add/update. Importing is done async in the backend, but this methods waits for importing to be done
uploadEmxFile
{ "repo_name": "dennishendriksen/molgenis", "path": "molgenis-api-tests/src/test/java/org/molgenis/api/tests/utils/RestTestUtils.java", "license": "lgpl-3.0", "size": 17069 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,572,505
@Test public final void testProcess_SingleVoxel() { ImageStack stack = ImageStack.create(5, 5, 5, 8); for (int z = 0; z < 5; z++) { for (int y = 0; y < 5; y++) { for (int x = 0; x < 5; x++) { stack.setVoxel(x, y, z, 1); } } } stack.setVoxel(2, 2, 2, 2); Calibration calib = new Calibration(); InterfaceSurfaceArea algo = new InterfaceSurfaceArea(); // labels 1-2 -> R = 1, S ~= 3.14 double S12 = algo.process(stack, 1, 2, calib); double expS12 = Math.PI * 4 * .5 * .5; assertEquals(expS12, S12, expS12 * .05); }
final void function() { ImageStack stack = ImageStack.create(5, 5, 5, 8); for (int z = 0; z < 5; z++) { for (int y = 0; y < 5; y++) { for (int x = 0; x < 5; x++) { stack.setVoxel(x, y, z, 1); } } } stack.setVoxel(2, 2, 2, 2); Calibration calib = new Calibration(); InterfaceSurfaceArea algo = new InterfaceSurfaceArea(); double S12 = algo.process(stack, 1, 2, calib); double expS12 = Math.PI * 4 * .5 * .5; assertEquals(expS12, S12, expS12 * .05); }
/** * Test method for {@link inra.ijpb.measure.region3d.InterfaceSurfaceArea#process(ij.ImageStack, int, int, ij.measure.Calibration)}. */
Test method for <code>inra.ijpb.measure.region3d.InterfaceSurfaceArea#process(ij.ImageStack, int, int, ij.measure.Calibration)</code>
testProcess_SingleVoxel
{ "repo_name": "ijpb/MorphoLibJ", "path": "src/test/java/inra/ijpb/measure/region3d/InterfaceSurfaceAreaTest.java", "license": "lgpl-3.0", "size": 3364 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
696,198
PagedIterable<EnrollmentAccountSummary> list();
PagedIterable<EnrollmentAccountSummary> list();
/** * Lists the enrollment accounts the caller has access to. * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return result of listing enrollment accounts. */
Lists the enrollment accounts the caller has access to
list
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/models/EnrollmentAccounts.java", "license": "mit", "size": 2525 }
[ "com.azure.core.http.rest.PagedIterable" ]
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.*;
[ "com.azure.core" ]
com.azure.core;
2,777,706
private void encryptUserPassword(User user) { String pass = user.getPassword(); String newPass = Cryptography.cryptPassword(pass); user.setPassword(newPass); }
void function(User user) { String pass = user.getPassword(); String newPass = Cryptography.cryptPassword(pass); user.setPassword(newPass); }
/** * This method encrypts the user password * * @param user * The user object that will have the password encrypted */
This method encrypts the user password
encryptUserPassword
{ "repo_name": "BackupTheBerlios/arara-svn", "path": "core/tags/arara-1.1/src/main/java/net/indrix/arara/model/UserModel.java", "license": "gpl-2.0", "size": 15150 }
[ "net.indrix.arara.vo.User" ]
import net.indrix.arara.vo.User;
import net.indrix.arara.vo.*;
[ "net.indrix.arara" ]
net.indrix.arara;
1,126,094
private String toAbsolutePaths(String fileResources) { return Stream.of(fileResources.split(",")) .map(f -> { try { return ResourceUtils.getFile("classpath:" + f).getAbsolutePath(); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }) .collect(Collectors.joining(",")); }
String function(String fileResources) { return Stream.of(fileResources.split(",")) .map(f -> { try { return ResourceUtils.getFile(STR + f).getAbsolutePath(); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }) .collect(Collectors.joining(",")); }
/** * Convert comma separated resources locations to comma separated absolute paths string * @param fileResources * @return */
Convert comma separated resources locations to comma separated absolute paths string
toAbsolutePaths
{ "repo_name": "jvalkeal/spring-cloud-data", "path": "spring-cloud-dataflow-shell-core/src/test/java/org/springframework/cloud/dataflow/shell/ShellCommandsTests.java", "license": "apache-2.0", "size": 5910 }
[ "java.io.FileNotFoundException", "java.util.stream.Collectors", "java.util.stream.Stream", "org.springframework.util.ResourceUtils" ]
import java.io.FileNotFoundException; import java.util.stream.Collectors; import java.util.stream.Stream; import org.springframework.util.ResourceUtils;
import java.io.*; import java.util.stream.*; import org.springframework.util.*;
[ "java.io", "java.util", "org.springframework.util" ]
java.io; java.util; org.springframework.util;
452,337
@Test public void testGetRecordResponse_Success() throws Exception { final StringWriter actualJSONResponse = new StringWriter(); final ModelMap viewCSWRecord1 = new ModelMap(); final ModelMap viewCSWRecord2 = new ModelMap(); viewCSWRecord1.put("rec1", "val1"); viewCSWRecord2.put("rec2", "val2"); context.checking(new Expectations() {{ oneOf(mockCSWService).getRecordCache(); will(returnValue(Arrays.asList(mockCSWRecord1, mockCSWRecord2))); oneOf(mockViewCSWRecordFactory).toView(mockCSWRecord1); will(returnValue(viewCSWRecord1)); oneOf(mockViewCSWRecordFactory).toView(mockCSWRecord2); will(returnValue(viewCSWRecord2)); //check that the correct response is getting output oneOf(mockHttpResponse).setContentType(with(any(String.class))); oneOf(mockHttpResponse).getWriter(); will(returnValue(new PrintWriter(actualJSONResponse))); }}); //Run the method, get our response rendered as a JSONObject ModelAndView mav = cswController.getCSWRecords(); ((AbstractView) mav.getView()).setExposePathVariables(false); mav.getView().render(mav.getModel(), mockHttpRequest, mockHttpResponse); JSONObject jsonObj = JSONObject.fromObject(actualJSONResponse.toString()); //Check our response contains useful info... Assert.assertEquals(true, jsonObj.getBoolean(SUCCESSJSON)); JSONArray records = jsonObj.getJSONArray("data"); Assert.assertNotNull(records); Assert.assertEquals(2, records.size()); JSONObject jsonRec1 = records.getJSONObject(0); JSONObject jsonRec2 = records.getJSONObject(1); Assert.assertEquals("val1", jsonRec1.get("rec1")); Assert.assertEquals("val2", jsonRec2.get("rec2")); }
void function() throws Exception { final StringWriter actualJSONResponse = new StringWriter(); final ModelMap viewCSWRecord1 = new ModelMap(); final ModelMap viewCSWRecord2 = new ModelMap(); viewCSWRecord1.put("rec1", "val1"); viewCSWRecord2.put("rec2", "val2"); context.checking(new Expectations() {{ oneOf(mockCSWService).getRecordCache(); will(returnValue(Arrays.asList(mockCSWRecord1, mockCSWRecord2))); oneOf(mockViewCSWRecordFactory).toView(mockCSWRecord1); will(returnValue(viewCSWRecord1)); oneOf(mockViewCSWRecordFactory).toView(mockCSWRecord2); will(returnValue(viewCSWRecord2)); oneOf(mockHttpResponse).setContentType(with(any(String.class))); oneOf(mockHttpResponse).getWriter(); will(returnValue(new PrintWriter(actualJSONResponse))); }}); ModelAndView mav = cswController.getCSWRecords(); ((AbstractView) mav.getView()).setExposePathVariables(false); mav.getView().render(mav.getModel(), mockHttpRequest, mockHttpResponse); JSONObject jsonObj = JSONObject.fromObject(actualJSONResponse.toString()); Assert.assertEquals(true, jsonObj.getBoolean(SUCCESSJSON)); JSONArray records = jsonObj.getJSONArray("data"); Assert.assertNotNull(records); Assert.assertEquals(2, records.size()); JSONObject jsonRec1 = records.getJSONObject(0); JSONObject jsonRec2 = records.getJSONObject(1); Assert.assertEquals("val1", jsonRec1.get("rec1")); Assert.assertEquals("val2", jsonRec2.get("rec2")); }
/** * Test get record response_ success. * * @throws Exception the exception */
Test get record response_ success
testGetRecordResponse_Success
{ "repo_name": "victortey/VEGL-Portal", "path": "src/test/java/org/auscope/portal/server/web/controllers/TestCSWCacheController.java", "license": "gpl-3.0", "size": 8168 }
[ "java.io.PrintWriter", "java.io.StringWriter", "java.util.Arrays", "net.sf.json.JSONArray", "net.sf.json.JSONObject", "org.jmock.Expectations", "org.junit.Assert", "org.springframework.ui.ModelMap", "org.springframework.web.servlet.ModelAndView", "org.springframework.web.servlet.view.AbstractView" ]
import java.io.PrintWriter; import java.io.StringWriter; import java.util.Arrays; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.jmock.Expectations; import org.junit.Assert; import org.springframework.ui.ModelMap; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.view.AbstractView;
import java.io.*; import java.util.*; import net.sf.json.*; import org.jmock.*; import org.junit.*; import org.springframework.ui.*; import org.springframework.web.servlet.*; import org.springframework.web.servlet.view.*;
[ "java.io", "java.util", "net.sf.json", "org.jmock", "org.junit", "org.springframework.ui", "org.springframework.web" ]
java.io; java.util; net.sf.json; org.jmock; org.junit; org.springframework.ui; org.springframework.web;
2,515,408
public ImboResponse post(URI url, InputStream input, List<Header> headers) throws IOException;
ImboResponse function(URI url, InputStream input, List<Header> headers) throws IOException;
/** * Perform a POST-request against the given URL * * @param url URL to perform request against * @param input Input stream to use for reading POST-data from * @param headers Heades to send along with the request * @return HTTP response * @throws IOException */
Perform a POST-request against the given URL
post
{ "repo_name": "imbo/imboclient-java", "path": "src/main/java/io/imbo/client/Http/HttpClient.java", "license": "mit", "size": 8922 }
[ "java.io.IOException", "java.io.InputStream", "java.util.List", "org.apache.http.Header" ]
import java.io.IOException; import java.io.InputStream; import java.util.List; import org.apache.http.Header;
import java.io.*; import java.util.*; import org.apache.http.*;
[ "java.io", "java.util", "org.apache.http" ]
java.io; java.util; org.apache.http;
1,983,014
DataModel getDataModel();
DataModel getDataModel();
/** * Returns the data model for retrieve current and training time series. * @return a data model for retrieve current and training time series. */
Returns the data model for retrieve current and training time series
getDataModel
{ "repo_name": "sajavadi/pinot", "path": "thirdeye/thirdeye-pinot/src/main/java/com/linkedin/thirdeye/anomalydetection/function/ModularizedAnomalyFunctionModelProvider.java", "license": "apache-2.0", "size": 1813 }
[ "com.linkedin.thirdeye.anomalydetection.model.data.DataModel" ]
import com.linkedin.thirdeye.anomalydetection.model.data.DataModel;
import com.linkedin.thirdeye.anomalydetection.model.data.*;
[ "com.linkedin.thirdeye" ]
com.linkedin.thirdeye;
1,023,573
private ExecutorService createExecutor() { ExecutorService service = Executors.newFixedThreadPool(3, new ThreadFactory() { ThreadGroup group = new ThreadGroup("JMSBridgeImpl");
ExecutorService function() { ExecutorService service = Executors.newFixedThreadPool(3, new ThreadFactory() { ThreadGroup group = new ThreadGroup(STR);
/** * Creates a 3-sized thread pool executor (1 thread for the sourceReceiver, 1 for the timeChecker * and 1 for the eventual failureHandler) */
Creates a 3-sized thread pool executor (1 thread for the sourceReceiver, 1 for the timeChecker and 1 for the eventual failureHandler)
createExecutor
{ "repo_name": "jmesnil/activemq-artemis", "path": "artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java", "license": "apache-2.0", "size": 64001 }
[ "java.util.concurrent.ExecutorService", "java.util.concurrent.Executors", "java.util.concurrent.ThreadFactory" ]
import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,447,768
public static ims.oncology.configuration.domain.objects.ChemoRegimensDrugConfig extractChemoRegimensDrugConfig(ims.domain.ILightweightDomainFactory domainFactory, ims.oncology.vo.ChemoRegimensDrugConfigVo valueObject) { return extractChemoRegimensDrugConfig(domainFactory, valueObject, new HashMap()); }
static ims.oncology.configuration.domain.objects.ChemoRegimensDrugConfig function(ims.domain.ILightweightDomainFactory domainFactory, ims.oncology.vo.ChemoRegimensDrugConfigVo valueObject) { return extractChemoRegimensDrugConfig(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractChemoRegimensDrugConfig
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/oncology/vo/domain/ChemoRegimensDrugConfigVoAssembler.java", "license": "agpl-3.0", "size": 18523 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
276,940
public Composite new2ColumnComposite(Composite parent) { return newNcolumnComposite(parent, 2); }
Composite function(Composite parent) { return newNcolumnComposite(parent, 2); }
/** * New 2 column composite. * * @param parent * the parent * @return the composite */
New 2 column composite
new2ColumnComposite
{ "repo_name": "apache/uima-uimaj", "path": "uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/editors/ui/AbstractSection.java", "license": "apache-2.0", "size": 79829 }
[ "org.eclipse.swt.widgets.Composite" ]
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.*;
[ "org.eclipse.swt" ]
org.eclipse.swt;
1,088,091
private void setupSafeZone() { int w = getMeasuredWidth(); int h = getMeasuredHeight(); if (w > 0 && h > 0) { if (mSafeZone == null) { mSafeZone = new Rect(); } int left, right, top, bottom; left = getPaddingLeft() + (mConf.getThumbMarginLeft() > 0 ? mConf.getThumbMarginLeft() : 0); right = w - getPaddingRight() - (mConf.getThumbMarginRight() > 0 ? mConf.getThumbMarginRight() : 0) + (-mConf.getShrinkX()); top = getPaddingTop() + (mConf.getThumbMarginTop() > 0 ? mConf.getThumbMarginTop() : 0); bottom = h - getPaddingBottom() - (mConf.getThumbMarginBottom() > 0 ? mConf.getThumbMarginBottom() : 0) + (-mConf.getShrinkY()); mSafeZone.set(left, top, right, bottom); mCenterPos = mSafeZone.left + (mSafeZone.right - mSafeZone.left - mConf.getThumbWidth()) / 2; } else { mSafeZone = null; } }
void function() { int w = getMeasuredWidth(); int h = getMeasuredHeight(); if (w > 0 && h > 0) { if (mSafeZone == null) { mSafeZone = new Rect(); } int left, right, top, bottom; left = getPaddingLeft() + (mConf.getThumbMarginLeft() > 0 ? mConf.getThumbMarginLeft() : 0); right = w - getPaddingRight() - (mConf.getThumbMarginRight() > 0 ? mConf.getThumbMarginRight() : 0) + (-mConf.getShrinkX()); top = getPaddingTop() + (mConf.getThumbMarginTop() > 0 ? mConf.getThumbMarginTop() : 0); bottom = h - getPaddingBottom() - (mConf.getThumbMarginBottom() > 0 ? mConf.getThumbMarginBottom() : 0) + (-mConf.getShrinkY()); mSafeZone.set(left, top, right, bottom); mCenterPos = mSafeZone.left + (mSafeZone.right - mSafeZone.left - mConf.getThumbWidth()) / 2; } else { mSafeZone = null; } }
/** * setup zone for thumb to move * * @param w * @param h */
setup zone for thumb to move
setupSafeZone
{ "repo_name": "apkdemo/SwitchButton", "path": "SwitchButton/src/com/kyleduo/switchbutton/SwitchButton.java", "license": "mit", "size": 16548 }
[ "android.graphics.Rect" ]
import android.graphics.Rect;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
2,747,659
protected FeatureState checkFeature(String featureId) throws XMLConfigurationException { // // Xerces Features // if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) { final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length(); // // http://apache.org/xml/features/validation/dynamic // Allows the parser to validate a document only when it // contains a grammar. Validation is turned on/off based // on each document instance, automatically. // if (suffixLength == Constants.DYNAMIC_VALIDATION_FEATURE.length() && featureId.endsWith(Constants.DYNAMIC_VALIDATION_FEATURE)) { return FeatureState.RECOGNIZED; } // // http://apache.org/xml/features/validation/default-attribute-values // if (suffixLength == Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE.length() && featureId.endsWith(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) { // REVISIT return FeatureState.NOT_SUPPORTED; } // // http://apache.org/xml/features/validation/default-attribute-values // if (suffixLength == Constants.VALIDATE_CONTENT_MODELS_FEATURE.length() && featureId.endsWith(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) { // REVISIT return FeatureState.NOT_SUPPORTED; } // // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar // if (suffixLength == Constants.LOAD_DTD_GRAMMAR_FEATURE.length() && featureId.endsWith(Constants.LOAD_DTD_GRAMMAR_FEATURE)) { return FeatureState.RECOGNIZED; } // // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd // if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() && featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) { return FeatureState.RECOGNIZED; } // // http://apache.org/xml/features/validation/default-attribute-values // if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() && featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) { return FeatureState.NOT_SUPPORTED; } } // // Not recognized // return super.checkFeature(featureId); } // checkFeature(String)
FeatureState function(String featureId) throws XMLConfigurationException { if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) { final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length(); featureId.endsWith(Constants.DYNAMIC_VALIDATION_FEATURE)) { return FeatureState.RECOGNIZED; } featureId.endsWith(Constants.DEFAULT_ATTRIBUTE_VALUES_FEATURE)) { return FeatureState.NOT_SUPPORTED; } featureId.endsWith(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) { return FeatureState.NOT_SUPPORTED; } featureId.endsWith(Constants.LOAD_DTD_GRAMMAR_FEATURE)) { return FeatureState.RECOGNIZED; } featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) { return FeatureState.RECOGNIZED; } featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) { return FeatureState.NOT_SUPPORTED; } } return super.checkFeature(featureId); }
/** * Check a feature. If feature is know and supported, this method simply * returns. Otherwise, the appropriate exception is thrown. * * @param featureId The unique identifier (URI) of the feature. * * @throws XMLConfigurationException Thrown for configuration error. * In general, components should * only throw this exception if * it is <strong>really</strong> * a critical error. */
Check a feature. If feature is know and supported, this method simply returns. Otherwise, the appropriate exception is thrown
checkFeature
{ "repo_name": "haikuowuya/android_system_code", "path": "src/com/sun/org/apache/xerces/internal/impl/xs/opti/SchemaParsingConfig.java", "license": "apache-2.0", "size": 37701 }
[ "com.sun.org.apache.xerces.internal.impl.Constants", "com.sun.org.apache.xerces.internal.util.FeatureState", "com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException" ]
import com.sun.org.apache.xerces.internal.impl.Constants; import com.sun.org.apache.xerces.internal.util.FeatureState; import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
import com.sun.org.apache.xerces.internal.impl.*; import com.sun.org.apache.xerces.internal.util.*; import com.sun.org.apache.xerces.internal.xni.parser.*;
[ "com.sun.org" ]
com.sun.org;
1,856,060
public Builder setHeaderModule(Artifact headerModule) { this.headerModule = headerModule; return this; }
Builder function(Artifact headerModule) { this.headerModule = headerModule; return this; }
/** * Sets the C++ header module in non-pic mode. */
Sets the C++ header module in non-pic mode
setHeaderModule
{ "repo_name": "UrbanCompass/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompilationContext.java", "license": "apache-2.0", "size": 38954 }
[ "com.google.devtools.build.lib.actions.Artifact" ]
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
1,657,079
public Set<SystemStreamPartition> getSystemStreamPartitions() { return systemStreamPartitions; }
Set<SystemStreamPartition> function() { return systemStreamPartitions; }
/** * Returns the {@link SystemStreamPartition}s that this task is responsible for consuming. * @return {@link SystemStreamPartition}s for this task */
Returns the <code>SystemStreamPartition</code>s that this task is responsible for consuming
getSystemStreamPartitions
{ "repo_name": "prateekm/samza", "path": "samza-api/src/main/java/org/apache/samza/job/model/TaskModel.java", "license": "apache-2.0", "size": 4530 }
[ "java.util.Set", "org.apache.samza.system.SystemStreamPartition" ]
import java.util.Set; import org.apache.samza.system.SystemStreamPartition;
import java.util.*; import org.apache.samza.system.*;
[ "java.util", "org.apache.samza" ]
java.util; org.apache.samza;
2,105,064
public int readInt() throws IOException { return ((readByte() & 0xFF) << 24) | ((readByte() & 0xFF) << 16) | ((readByte() & 0xFF) << 8) | (readByte() & 0xFF); }
int function() throws IOException { return ((readByte() & 0xFF) << 24) ((readByte() & 0xFF) << 16) ((readByte() & 0xFF) << 8) (readByte() & 0xFF); }
/** Reads four bytes and returns an int. * @see IndexOutput#writeInt(int) */
Reads four bytes and returns an int
readInt
{ "repo_name": "lemonJun/Emmet", "path": "src/main/java/com/takin/emmet/store/IndexInput.java", "license": "apache-2.0", "size": 5237 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
796,241
Connection getConnection() throws SQLException;
Connection getConnection() throws SQLException;
/** * Retrieve current connection. Could be used by 3rd party classes to * execute database commands in the same session. */
Retrieve current connection. Could be used by 3rd party classes to execute database commands in the same session
getConnection
{ "repo_name": "dbfit/dbfit", "path": "dbfit-java/core/src/main/java/dbfit/api/DBEnvironment.java", "license": "gpl-2.0", "size": 6884 }
[ "java.sql.Connection", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
399,271
public void removePropertyChangeListener(PropertyChangeListener listener) { support.removePropertyChangeListener(listener); }
void function(PropertyChangeListener listener) { support.removePropertyChangeListener(listener); }
/** * Remove a property change listener from this component. * * @param listener The listener to remove */
Remove a property change listener from this component
removePropertyChangeListener
{ "repo_name": "pistolove/sourcecode4junit", "path": "Source4Tomcat/src/org/apache/catalina/core/StandardServer.java", "license": "apache-2.0", "size": 26865 }
[ "java.beans.PropertyChangeListener" ]
import java.beans.PropertyChangeListener;
import java.beans.*;
[ "java.beans" ]
java.beans;
2,727,410
private static Class<?> getRawType(ParameterizedType parameterizedType) { Type rawType = parameterizedType.getRawType(); // check if raw type is a Class object // not currently necessary, but since the return type is Type instead of // Class, there's enough reason to believe that future versions of Java // may return other Type implementations. And type-safety checking is // rarely a bad idea. if (!(rawType instanceof Class<?>)) { throw new IllegalStateException("Wait... What!? Type of rawType: " + rawType); } return (Class<?>) rawType; }
static Class<?> function(ParameterizedType parameterizedType) { Type rawType = parameterizedType.getRawType(); if (!(rawType instanceof Class<?>)) { throw new IllegalStateException(STR + rawType); } return (Class<?>) rawType; }
/** * <p> Transforms the passed in type to a {@code Class} object. Type-checking method of convenience. </p> * * @param parameterizedType the type to be converted * @return the corresponding {@code Class} object * @throws IllegalStateException if the conversion fails */
Transforms the passed in type to a Class object. Type-checking method of convenience.
getRawType
{ "repo_name": "SpoonLabs/astor", "path": "examples/lang_8/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java", "license": "gpl-2.0", "size": 44161 }
[ "java.lang.reflect.ParameterizedType", "java.lang.reflect.Type" ]
import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
783,172
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> beginReimageAsync( String resourceGroupName, String vmScaleSetName, String instanceId, Boolean tempDisk);
@ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> beginReimageAsync( String resourceGroupName, String vmScaleSetName, String instanceId, Boolean tempDisk);
/** * Reimages (upgrade the operating system) a specific virtual machine in a VM scale set. * * @param resourceGroupName The name of the resource group. * @param vmScaleSetName The name of the VM scale set. * @param instanceId The instance ID of the virtual machine. * @param tempDisk Specifies whether to reimage temp disk. Default value: false. Note: This temp disk reimage * parameter is only supported for VM/VMSS with Ephemeral OS disk. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Reimages (upgrade the operating system) a specific virtual machine in a VM scale set
beginReimageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachineScaleSetVMsClient.java", "license": "mit", "size": 89951 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.PollerFlux" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.PollerFlux;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*;
[ "com.azure.core" ]
com.azure.core;
1,740,580
public static AlertLevel forSeverity(int severity) { switch (severity) { case Alert.WARNING: return AlertLevel.WARNING; case Alert.ERROR: return AlertLevel.ERROR; case Alert.SEVERE: return AlertLevel.SEVERE; case Alert.OFF: return AlertLevel.OFF; default: throw new IllegalArgumentException(LocalizedStrings.AlertLevel_UNKNOWN_ALERT_SEVERITY_0 .toLocalizedString(Integer.valueOf(severity))); } }
static AlertLevel function(int severity) { switch (severity) { case Alert.WARNING: return AlertLevel.WARNING; case Alert.ERROR: return AlertLevel.ERROR; case Alert.SEVERE: return AlertLevel.SEVERE; case Alert.OFF: return AlertLevel.OFF; default: throw new IllegalArgumentException(LocalizedStrings.AlertLevel_UNKNOWN_ALERT_SEVERITY_0 .toLocalizedString(Integer.valueOf(severity))); } }
/** * Returns the <code>AlertLevel</code> for the given severity * * @throws IllegalArgumentException If there is no alert level with the given * <code>severity</code> */
Returns the <code>AlertLevel</code> for the given severity
forSeverity
{ "repo_name": "charliemblack/geode", "path": "geode-core/src/main/java/org/apache/geode/admin/AlertLevel.java", "license": "apache-2.0", "size": 5275 }
[ "org.apache.geode.internal.admin.Alert", "org.apache.geode.internal.i18n.LocalizedStrings" ]
import org.apache.geode.internal.admin.Alert; import org.apache.geode.internal.i18n.LocalizedStrings;
import org.apache.geode.internal.admin.*; import org.apache.geode.internal.i18n.*;
[ "org.apache.geode" ]
org.apache.geode;
1,265,894
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_) { this.fontRendererObj.drawString("Restricted Item Tube", this.xSize / 2 - this.fontRendererObj.getStringWidth("Restricted Item Tube") / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); }
void function(int p_146979_1_, int p_146979_2_) { this.fontRendererObj.drawString(STR, this.xSize / 2 - this.fontRendererObj.getStringWidth(STR) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format(STR, new Object[0]), 8, this.ySize - 96 + 2, 4210752); }
/** * Draw the foreground layer for the GuiContainer (everything in front of the items) */
Draw the foreground layer for the GuiContainer (everything in front of the items)
drawGuiContainerForegroundLayer
{ "repo_name": "Sudwood/AdvancedUtilities", "path": "java/com/sudwood/advancedutilities/client/gui/GuiRestrictedItemTube.java", "license": "mit", "size": 2774 }
[ "net.minecraft.client.resources.I18n" ]
import net.minecraft.client.resources.I18n;
import net.minecraft.client.resources.*;
[ "net.minecraft.client" ]
net.minecraft.client;
190,105
if (input == null || input.size() < 2) return null; try{ Integer first = (Integer)input.get(0); Integer second = (Integer)input.get(1); if (first==null) return first; if (second==null) return second; return Math.min(first, second); } catch (Exception e){ throw new IOException("Caught exception processing input row ", e); } }
if (input == null input.size() < 2) return null; try{ Integer first = (Integer)input.get(0); Integer second = (Integer)input.get(1); if (first==null) return first; if (second==null) return second; return Math.min(first, second); } catch (Exception e){ throw new IOException(STR, e); } }
/** * java level API * @param input expects a two numeric value * @param output returns a single numeric value, which is the smaller of two inputs */
java level API
exec
{ "repo_name": "sigmoidanalytics/spork", "path": "contrib/piggybank/java/src/main/java/org/apache/pig/piggybank/evaluation/math/IntMin.java", "license": "apache-2.0", "size": 2776 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
939,693
//Options public String Option(String Option) { return MediaInfoDLL_Internal.INSTANCE.Option(Handle, new WString(Option), new WString("")).toString(); }
String function(String Option) { return MediaInfoDLL_Internal.INSTANCE.Option(Handle, new WString(Option), new WString("")).toString(); }
/** * Configure or get information about MediaInfo. * * @param Option The name of option * @return Depends on the option: by default "" (nothing) means No, other means Yes */
Configure or get information about MediaInfo
Option
{ "repo_name": "xucp/mpc_hc", "path": "src/thirdparty/MediaInfo/library/Source/MediaInfoDLL/MediaInfoDLL.JNA.java", "license": "gpl-3.0", "size": 14860 }
[ "com.sun.jna.WString" ]
import com.sun.jna.WString;
import com.sun.jna.*;
[ "com.sun.jna" ]
com.sun.jna;
2,331,264
@Test(expected = IllegalArgumentException.class) public void createZeroHeight() { new Ellipse(1.0, 0.0); }
@Test(expected = IllegalArgumentException.class) void function() { new Ellipse(1.0, 0.0); }
/** * Tests a zero height. */
Tests a zero height
createZeroHeight
{ "repo_name": "dmitrykolesnikovich/dyn4j", "path": "junit/org/dyn4j/geometry/EllipseTest.java", "license": "bsd-3-clause", "size": 8021 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,384,069
@RestrictTo(Scope.LIBRARY_GROUP) @NonNull static Builder fromConfig(@NonNull ImageCaptureConfig configuration) { return new Builder(MutableOptionsBundle.from(configuration)); } /** * {@inheritDoc}
@RestrictTo(Scope.LIBRARY_GROUP) static Builder fromConfig(@NonNull ImageCaptureConfig configuration) { return new Builder(MutableOptionsBundle.from(configuration)); } /** * {@inheritDoc}
/** * Generates a Builder from another Config object * * @param configuration An immutable configuration to pre-populate this builder. * @return The new Builder. * @hide */
Generates a Builder from another Config object
fromConfig
{ "repo_name": "AndroidX/androidx", "path": "camera/camera-core/src/main/java/androidx/camera/core/ImageCapture.java", "license": "apache-2.0", "size": 118170 }
[ "androidx.annotation.NonNull", "androidx.annotation.RestrictTo", "androidx.camera.core.impl.ImageCaptureConfig", "androidx.camera.core.impl.MutableOptionsBundle" ]
import androidx.annotation.NonNull; import androidx.annotation.RestrictTo; import androidx.camera.core.impl.ImageCaptureConfig; import androidx.camera.core.impl.MutableOptionsBundle;
import androidx.annotation.*; import androidx.camera.core.impl.*;
[ "androidx.annotation", "androidx.camera" ]
androidx.annotation; androidx.camera;
999,376
protected void fireElementStart(String name, Attributes attribs) { if (getException() == null) { try { Attributes at = (attribs == null) ? EMPTY_ATTRS : attribs; getContentHandler().startElement(NS_URI, name, name, at); } catch (SAXException ex) { exception = ex; } } }
void function(String name, Attributes attribs) { if (getException() == null) { try { Attributes at = (attribs == null) ? EMPTY_ATTRS : attribs; getContentHandler().startElement(NS_URI, name, name, at); } catch (SAXException ex) { exception = ex; } } }
/** * Fires a SAX element start event. * * @param name the name of the actual element * @param attribs the attributes of this element (can be <b>null</b>) */
Fires a SAX element start event
fireElementStart
{ "repo_name": "mohanaraosv/commons-configuration", "path": "src/main/java/org/apache/commons/configuration2/ConfigurationXMLReader.java", "license": "apache-2.0", "size": 10287 }
[ "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;
1,996,775
Instant getExpires();
Instant getExpires();
/** * Get the date this session expires * @return expiration date, if one exists */
Get the date this session expires
getExpires
{ "repo_name": "dbernstein/fcrepo4", "path": "fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/Transaction.java", "license": "apache-2.0", "size": 2778 }
[ "java.time.Instant" ]
import java.time.Instant;
import java.time.*;
[ "java.time" ]
java.time;
2,080,142
@Deprecated public void setPattern(ExchangePattern pattern) { this.pattern = pattern; }
void function(ExchangePattern pattern) { this.pattern = pattern; }
/** * Sets the exchange pattern of the endpoint * * @deprecated set the pattern in the uri */
Sets the exchange pattern of the endpoint
setPattern
{ "repo_name": "jmandawg/camel", "path": "components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelEndpointFactoryBean.java", "license": "apache-2.0", "size": 4263 }
[ "org.apache.camel.ExchangePattern" ]
import org.apache.camel.ExchangePattern;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
2,787,287