method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public Calendar getCalendar() { return calendar; }
Calendar function() { return calendar; }
/** * Gets the calendar associated with this date/time formatter. * * @return the calendar associated with this date/time formatter. */
Gets the calendar associated with this date/time formatter
getCalendar
{ "repo_name": "mirego/j2objc", "path": "jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormat.java", "license": "apache-2.0", "size": 40451 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
728,376
private void prepareCamera() throws SSJException { //set camera and frame size Camera.Parameters parameters = prePrepare(); if (options.showSupportedValues.get()) { //list sizes List<Camera.Size> sizes = parameters.getSupportedPreviewSizes(); Log.i("Preview size: (n=" + sizes.size() + ")"); for (Camera.Size size : sizes) { Log.i("Preview size: " + size.width + "x" + size.height); } //list preview formats List<Integer> formats = parameters.getSupportedPreviewFormats(); Log.i("Preview format (n=" + formats.size() + ")"); for (Integer i : formats) { Log.i("Preview format: " + i); } } //set preview format parameters.setPreviewFormat(options.imageFormat.get().val); //set preview fps range choosePreviewFpsRange(parameters, options.previewFpsRangeMin.get(), options.previewFpsRangeMax.get()); //optimizations for more fps if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { parameters.setRecordingHint(true); } List<String> FocusModes = parameters.getSupportedFocusModes(); if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } //set camera parameters camera.setParameters(parameters); //display used parameters Camera.Size size = parameters.getPreviewSize(); Log.d("Camera preview size is " + size.width + "x" + size.height); int[] range = new int[2]; parameters.getPreviewFpsRange(range); Log.d("Preview fps range is " + (range[0] / 1000) + " to " + (range[1] / 1000)); }
void function() throws SSJException { Camera.Parameters parameters = prePrepare(); if (options.showSupportedValues.get()) { List<Camera.Size> sizes = parameters.getSupportedPreviewSizes(); Log.i(STR + sizes.size() + ")"); for (Camera.Size size : sizes) { Log.i(STR + size.width + "x" + size.height); } List<Integer> formats = parameters.getSupportedPreviewFormats(); Log.i(STR + formats.size() + ")"); for (Integer i : formats) { Log.i(STR + i); } } parameters.setPreviewFormat(options.imageFormat.get().val); choosePreviewFpsRange(parameters, options.previewFpsRangeMin.get(), options.previewFpsRangeMax.get()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { parameters.setRecordingHint(true); } List<String> FocusModes = parameters.getSupportedFocusModes(); if (FocusModes != null && FocusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } camera.setParameters(parameters); Camera.Size size = parameters.getPreviewSize(); Log.d(STR + size.width + "x" + size.height); int[] range = new int[2]; parameters.getPreviewFpsRange(range); Log.d(STR + (range[0] / 1000) + STR + (range[1] / 1000)); }
/** * Configures camera for video capture. <br> * Opens a camera and sets parameters. Does not start preview. */
Configures camera for video capture. Opens a camera and sets parameters. Does not start preview
prepareCamera
{ "repo_name": "toni1991/ssj", "path": "libssj/src/main/java/hcm/ssj/camera/CameraSensor.java", "license": "gpl-3.0", "size": 13730 }
[ "android.hardware.Camera", "android.os.Build", "java.util.List" ]
import android.hardware.Camera; import android.os.Build; import java.util.List;
import android.hardware.*; import android.os.*; import java.util.*;
[ "android.hardware", "android.os", "java.util" ]
android.hardware; android.os; java.util;
402,980
public static int getRandomInt() { Random random = new Random(System.currentTimeMillis()); int randomValue = random.nextInt(); return randomValue; }
static int function() { Random random = new Random(System.currentTimeMillis()); int randomValue = random.nextInt(); return randomValue; }
/** * <p> * Returns a random integer value. * </p> * * @return random integer value */
Returns a random integer value.
getRandomInt
{ "repo_name": "Myasuka/systemml", "path": "src/test/java/org/apache/sysml/test/utils/TestUtils.java", "license": "apache-2.0", "size": 65313 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
1,473,494
private OMElement generateSelectProductByCodeElement(String opName, int id) { OMElement selectProductByCodeOpEl = fac.createOMElement(opName, omNs); OMElement productCodeEl = fac.createOMElement("productCode", omNs); productCodeEl.setText("productCode" + id); selectProductByCodeOpEl.addChild(productCodeEl); return selectProductByCodeOpEl; }
OMElement function(String opName, int id) { OMElement selectProductByCodeOpEl = fac.createOMElement(opName, omNs); OMElement productCodeEl = fac.createOMElement(STR, omNs); productCodeEl.setText(STR + id); selectProductByCodeOpEl.addChild(productCodeEl); return selectProductByCodeOpEl; }
/** * Helper method to generate SelectProductByCode operation Request OME element. * * @param opName * @param id * @return */
Helper method to generate SelectProductByCode operation Request OME element
generateSelectProductByCodeElement
{ "repo_name": "madhawa-gunasekara/product-ei", "path": "integration/dataservice-hosting-tests/tests-integration/tests/src/test/java/org/wso2/ei/dataservice/integration/test/requestBox/RequestBoxTenantUserTestCase.java", "license": "apache-2.0", "size": 17043 }
[ "org.apache.axiom.om.OMElement" ]
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.*;
[ "org.apache.axiom" ]
org.apache.axiom;
897,056
public ServiceFuture<Void> beginRefreshPermissionsAsync(String resourceGroupName, String applicationName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginRefreshPermissionsWithServiceResponseAsync(resourceGroupName, applicationName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String applicationName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginRefreshPermissionsWithServiceResponseAsync(resourceGroupName, applicationName), serviceCallback); }
/** * Refresh Permissions for application. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param applicationName The name of the managed application. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Refresh Permissions for application
beginRefreshPermissionsAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/managedapplications/mgmt-v2019_07_01/src/main/java/com/microsoft/azure/management/managedapplications/v2019_07_01/implementation/ApplicationsInner.java", "license": "mit", "size": 112965 }
[ "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;
2,214,576
@Override protected void initViews(Bundle savedInstanceState) { TextView imageTV = (TextView) this.findViewById(R.id.image_tv); imageTV.setText(OBJECT_IMAGE_URL); this.startBT = (Button) this.findViewById(R.id.start_service_bt); this.imageIV = (ImageView) this.findViewById(R.id.image_iv); }
@Override void function(Bundle savedInstanceState) { TextView imageTV = (TextView) this.findViewById(R.id.image_tv); imageTV.setText(OBJECT_IMAGE_URL); this.startBT = (Button) this.findViewById(R.id.start_service_bt); this.imageIV = (ImageView) this.findViewById(R.id.image_iv); }
/** * Initialize the view in the layout * * @param savedInstanceState savedInstanceState */
Initialize the view in the layout
initViews
{ "repo_name": "CaMnter/AndroidLife", "path": "app/src/main/java/com/camnter/newlife/ui/activity/DownloadServiceActivity.java", "license": "apache-2.0", "size": 4121 }
[ "android.os.Bundle", "android.widget.Button", "android.widget.ImageView", "android.widget.TextView" ]
import android.os.Bundle; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView;
import android.os.*; import android.widget.*;
[ "android.os", "android.widget" ]
android.os; android.widget;
146,466
public void setRequest(HttpServletRequest request) { this.request = new XWikiServletRequest(request); }
void function(HttpServletRequest request) { this.request = new XWikiServletRequest(request); }
/** * Reset all properties to their default values. * * @param request The servlet request we are processing */
Reset all properties to their default values
setRequest
{ "repo_name": "pbondoer/xwiki-platform", "path": "xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/XWikiForm.java", "license": "lgpl-2.1", "size": 2241 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,285,110
public void putOID(ObjectIdentifier oid) throws IOException { oid.encode(this); }
void function(ObjectIdentifier oid) throws IOException { oid.encode(this); }
/** * Marshals an object identifier (OID) on the output stream. * Corresponds to the ASN.1 "OBJECT IDENTIFIER" construct. */
Marshals an object identifier (OID) on the output stream. Corresponds to the ASN.1 "OBJECT IDENTIFIER" construct
putOID
{ "repo_name": "andreagenso/java2scala", "path": "test/J2s/java/openjdk-6-src-b27/jdk/src/share/classes/sun/security/util/DerOutputStream.java", "license": "apache-2.0", "size": 17983 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,365,870
public static HtmlResponse fromRedirectPathAsIs(String redirectPath) { return new HtmlResponse(new RedirectNext(redirectPath, RedirectPathStyle.AS_IS)); }
static HtmlResponse function(String redirectPath) { return new HtmlResponse(new RedirectNext(redirectPath, RedirectPathStyle.AS_IS)); }
/** * Create HTML response by plain text URL as is. <br> * Basically for outer resources. e.g. http://dbflute.org <br> * Or resources in same domain without context path adjustment. e.g. /harbor/product/list/ * @param redirectPath The path for redirect. e.g. /harbor/product/list/, http://dbflute.org (NotNull) * @return The new-created instance of HTML response. (NotNull) */
Create HTML response by plain text URL as is. Basically for outer resources. e.g. HREF Or resources in same domain without context path adjustment. e.g. /harbor/product/list
fromRedirectPathAsIs
{ "repo_name": "lastaflute/lastaflute", "path": "src/main/java/org/lastaflute/web/response/HtmlResponse.java", "license": "apache-2.0", "size": 23797 }
[ "org.lastaflute.web.response.next.RedirectNext" ]
import org.lastaflute.web.response.next.RedirectNext;
import org.lastaflute.web.response.next.*;
[ "org.lastaflute.web" ]
org.lastaflute.web;
2,502,360
public String connectToPeerServer(String message, String ip, int port) throws UnknownHostException, IOException { Socket connectToPeerServer = new Socket(ip, port); // connect to peer server. OutputStream outToServer = connectToPeerServer.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); out.writeUTF(message); DataInputStream in = new DataInputStream(connectToPeerServer.getInputStream()); message = in.readUTF(); connectToPeerServer.close(); // Close the connection to the peer server. return message; }
String function(String message, String ip, int port) throws UnknownHostException, IOException { Socket connectToPeerServer = new Socket(ip, port); OutputStream outToServer = connectToPeerServer.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); out.writeUTF(message); DataInputStream in = new DataInputStream(connectToPeerServer.getInputStream()); message = in.readUTF(); connectToPeerServer.close(); return message; }
/** * Connect to a peer's server. * @param message The message to be received. * @param ip The IP of the peer's server. * @param port The port number of the peer's server. * @return message * @throws UnknownHostException If the host does not exist. * @throws IOException If there is a read/write error. */
Connect to a peer's server
connectToPeerServer
{ "repo_name": "nsalerni/P2P-Photo-Sharing-Service", "path": "src/PeerClient.java", "license": "gpl-3.0", "size": 15636 }
[ "java.io.DataInputStream", "java.io.DataOutputStream", "java.io.IOException", "java.io.OutputStream", "java.net.Socket", "java.net.UnknownHostException" ]
import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import java.net.UnknownHostException;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,470,723
public static GetTaskRequest getTaskRequest() { return new GetTaskRequest(); }
static GetTaskRequest function() { return new GetTaskRequest(); }
/** * Creates a get task request. * * @return The nodes tasks request * @see org.elasticsearch.client.ClusterAdminClient#getTask(GetTaskRequest) */
Creates a get task request
getTaskRequest
{ "repo_name": "nknize/elasticsearch", "path": "server/src/main/java/org/elasticsearch/client/Requests.java", "license": "apache-2.0", "size": 19767 }
[ "org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest" ]
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest;
import org.elasticsearch.action.admin.cluster.node.tasks.get.*;
[ "org.elasticsearch.action" ]
org.elasticsearch.action;
2,267,375
@Override public void shutdown() { if (!m_gameOver) { final int rVal = JOptionPane.showConfirmDialog(this, "Are you sure you want to exit?\nUnsaved game data will be lost.", "Exit", JOptionPane.YES_NO_OPTION); if (rVal != JOptionPane.OK_OPTION) return; } stopGame(); System.exit(0); }
void function() { if (!m_gameOver) { final int rVal = JOptionPane.showConfirmDialog(this, STR, "Exit", JOptionPane.YES_NO_OPTION); if (rVal != JOptionPane.OK_OPTION) return; } stopGame(); System.exit(0); }
/** * Process a user request to exit the program. */
Process a user request to exit the program
shutdown
{ "repo_name": "tea-dragon/triplea", "path": "src/main/java/games/strategy/grid/ui/GridGameFrame.java", "license": "gpl-2.0", "size": 40860 }
[ "javax.swing.JOptionPane" ]
import javax.swing.JOptionPane;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,672,838
protected Type getResponseType() { return TypeToken.of(getResponseClass()).getType(); }
Type function() { return TypeToken.of(getResponseClass()).getType(); }
/** * If getPojoClass does not work because of generics, return null. * Then override this and return the Type. * * @return the Type (including generic type) of this request's response */
If getPojoClass does not work because of generics, return null. Then override this and return the Type
getResponseType
{ "repo_name": "kkysen/QuickTrip", "path": "src/main/java/io/github/kkysen/quicktrip/apis/CachedApiRequest.java", "license": "apache-2.0", "size": 29473 }
[ "com.google.common.reflect.TypeToken", "java.lang.reflect.Type" ]
import com.google.common.reflect.TypeToken; import java.lang.reflect.Type;
import com.google.common.reflect.*; import java.lang.reflect.*;
[ "com.google.common", "java.lang" ]
com.google.common; java.lang;
1,538,291
private PropertiesFile getCachedDataFile(String resolverName, ModuleRevisionId mRevId) { // we append ".${resolverName} onto the end of the regular ivydata location return new PropertiesFile(new File(getRepositoryCacheRoot(), IvyPatternHelper.substitute(getDataFilePattern(), mRevId) + "." + resolverName), "ivy cached data file for " + mRevId); }
PropertiesFile function(String resolverName, ModuleRevisionId mRevId) { return new PropertiesFile(new File(getRepositoryCacheRoot(), IvyPatternHelper.substitute(getDataFilePattern(), mRevId) + "." + resolverName), STR + mRevId); }
/** * A resolver-specific ivydata file, only used for caching dynamic revisions, e.g. * integration-repo. */
A resolver-specific ivydata file, only used for caching dynamic revisions, e.g. integration-repo
getCachedDataFile
{ "repo_name": "jaikiran/ant-ivy", "path": "src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java", "license": "apache-2.0", "size": 71308 }
[ "java.io.File", "org.apache.ivy.core.IvyPatternHelper", "org.apache.ivy.core.module.id.ModuleRevisionId", "org.apache.ivy.util.PropertiesFile" ]
import java.io.File; import org.apache.ivy.core.IvyPatternHelper; import org.apache.ivy.core.module.id.ModuleRevisionId; import org.apache.ivy.util.PropertiesFile;
import java.io.*; import org.apache.ivy.core.*; import org.apache.ivy.core.module.id.*; import org.apache.ivy.util.*;
[ "java.io", "org.apache.ivy" ]
java.io; org.apache.ivy;
926,501
public static SimpleFeatureBuilder getLasFeatureBuilder( CoordinateReferenceSystem crs ) { if (lasSimpleFeatureBuilder == null) { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("lasdata"); b.setCRS(crs); b.add(THE_GEOM, Point.class); b.add(ID, Integer.class); b.add(ELEVATION, Double.class); b.add(INTENSITY, Double.class); b.add(CLASSIFICATION, Integer.class); b.add(IMPULSE, Double.class); b.add(NUM_OF_IMPULSES, Double.class); final SimpleFeatureType featureType = b.buildFeatureType(); lasSimpleFeatureBuilder = new SimpleFeatureBuilder(featureType); } return lasSimpleFeatureBuilder; }
static SimpleFeatureBuilder function( CoordinateReferenceSystem crs ) { if (lasSimpleFeatureBuilder == null) { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName(STR); b.setCRS(crs); b.add(THE_GEOM, Point.class); b.add(ID, Integer.class); b.add(ELEVATION, Double.class); b.add(INTENSITY, Double.class); b.add(CLASSIFICATION, Integer.class); b.add(IMPULSE, Double.class); b.add(NUM_OF_IMPULSES, Double.class); final SimpleFeatureType featureType = b.buildFeatureType(); lasSimpleFeatureBuilder = new SimpleFeatureBuilder(featureType); } return lasSimpleFeatureBuilder; }
/** * Creates a builder for las data. * * The attributes are: * * <ul> * <li>the_geom: a point geometry</li> * <li>elev</li> * <li>intensity</li> * <li>classification</li> * <li>impulse</li> * <li>numimpulse</li> * </ul> * * * @param crs the {@link CoordinateReferenceSystem}. * @return the {@link SimpleFeatureBuilder builder}. */
Creates a builder for las data. The attributes are: the_geom: a point geometry elev intensity classification impulse numimpulse
getLasFeatureBuilder
{ "repo_name": "moovida/jgrasstools", "path": "gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java", "license": "gpl-3.0", "size": 27433 }
[ "org.geotools.feature.simple.SimpleFeatureBuilder", "org.geotools.feature.simple.SimpleFeatureTypeBuilder", "org.locationtech.jts.geom.Point", "org.opengis.feature.simple.SimpleFeatureType", "org.opengis.referencing.crs.CoordinateReferenceSystem" ]
import org.geotools.feature.simple.SimpleFeatureBuilder; import org.geotools.feature.simple.SimpleFeatureTypeBuilder; import org.locationtech.jts.geom.Point; import org.opengis.feature.simple.SimpleFeatureType; import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.geotools.feature.simple.*; import org.locationtech.jts.geom.*; import org.opengis.feature.simple.*; import org.opengis.referencing.crs.*;
[ "org.geotools.feature", "org.locationtech.jts", "org.opengis.feature", "org.opengis.referencing" ]
org.geotools.feature; org.locationtech.jts; org.opengis.feature; org.opengis.referencing;
2,290,567
@Override protected boolean logMultipleExceptions() { return false; } // ------------------------------------------------------------------------- // TXOriginatorRecoveryMessage // ------------------------------------------------------------------------- public static final class TXOriginatorRecoveryMessage extends PooledDistributionMessage implements MessageWithReply { protected TXLockId txLockId; protected int processorId;
boolean function() { return false; } public static final class TXOriginatorRecoveryMessage extends PooledDistributionMessage implements MessageWithReply { protected TXLockId txLockId; protected int processorId;
/** * IllegalStateException is an anticipated reply exception. Receiving * multiple replies with this exception is normal. */
IllegalStateException is an anticipated reply exception. Receiving multiple replies with this exception is normal
logMultipleExceptions
{ "repo_name": "ysung-pivotal/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/locks/TXOriginatorRecoveryProcessor.java", "license": "apache-2.0", "size": 10938 }
[ "com.gemstone.gemfire.distributed.internal.MessageWithReply", "com.gemstone.gemfire.distributed.internal.PooledDistributionMessage" ]
import com.gemstone.gemfire.distributed.internal.MessageWithReply; import com.gemstone.gemfire.distributed.internal.PooledDistributionMessage;
import com.gemstone.gemfire.distributed.internal.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
455,821
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String routeTableName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, routeTableName), serviceCallback); }
ServiceFuture<Void> function(String resourceGroupName, String routeTableName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, routeTableName), serviceCallback); }
/** * Deletes the specified route table. * * @param resourceGroupName The name of the resource group. * @param routeTableName The name of the route table. * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceFuture} object */
Deletes the specified route table
deleteAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/RouteTablesInner.java", "license": "mit", "size": 67373 }
[ "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;
2,777,889
@SuppressWarnings({"rawtypes", "unchecked"}) public TargetNode<?> withDescription(Description<?> description) { try { return new TargetNode( description, constructorArg, ruleFactoryParams, declaredDeps, visibilityPatterns); } catch (InvalidSourcePathInputException | NoSuchBuildTargetException e) { // This is extremely unlikely to happen --- we've already created a TargetNode with these // values before. throw new RuntimeException(e); } }
@SuppressWarnings({STR, STR}) TargetNode<?> function(Description<?> description) { try { return new TargetNode( description, constructorArg, ruleFactoryParams, declaredDeps, visibilityPatterns); } catch (InvalidSourcePathInputException NoSuchBuildTargetException e) { throw new RuntimeException(e); } }
/** * Return a copy of the current TargetNode, with the {@link Description} used for creating * {@link BuildRule} instances switched out. */
Return a copy of the current TargetNode, with the <code>Description</code> used for creating <code>BuildRule</code> instances switched out
withDescription
{ "repo_name": "dpursehouse/buck", "path": "src/com/facebook/buck/rules/TargetNode.java", "license": "apache-2.0", "size": 11008 }
[ "com.facebook.buck.parser.NoSuchBuildTargetException" ]
import com.facebook.buck.parser.NoSuchBuildTargetException;
import com.facebook.buck.parser.*;
[ "com.facebook.buck" ]
com.facebook.buck;
974,916
private void refreshStatus() { try { final String state = upsStatusCache.getValue(); final ExpiringCache<Boolean> localVariablesRefreshCache = refreshVariablesCache; if (!lastUpsStatus.equals(state)) { if (isLinked(upsStatusChannelUID)) { updateState(upsStatusChannelUID, state == null ? UnDefType.UNDEF : new StringType(state)); } lastUpsStatus = state == null ? "" : state; if (localVariablesRefreshCache != null) { localVariablesRefreshCache.invalidateValue(); } } // Just call a get on variables. If the cache is expired it will trigger an update of the channels. if (localVariablesRefreshCache != null) { localVariablesRefreshCache.getValue(); } } catch (final RuntimeException e) { logger.debug("Updating ups status failed: ", e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); } }
void function() { try { final String state = upsStatusCache.getValue(); final ExpiringCache<Boolean> localVariablesRefreshCache = refreshVariablesCache; if (!lastUpsStatus.equals(state)) { if (isLinked(upsStatusChannelUID)) { updateState(upsStatusChannelUID, state == null ? UnDefType.UNDEF : new StringType(state)); } lastUpsStatus = state == null ? STRUpdating ups status failed: ", e); updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage()); } }
/** * Method called by the scheduled task that checks for the active status of the ups. */
Method called by the scheduled task that checks for the active status of the ups
refreshStatus
{ "repo_name": "MikeJMajor/openhab2-addons-dlinksmarthome", "path": "bundles/org.openhab.binding.networkupstools/src/main/java/org/openhab/binding/networkupstools/internal/NUTHandler.java", "license": "epl-1.0", "size": 17348 }
[ "org.openhab.core.cache.ExpiringCache", "org.openhab.core.library.types.StringType", "org.openhab.core.thing.ThingStatus", "org.openhab.core.thing.ThingStatusDetail", "org.openhab.core.types.UnDefType" ]
import org.openhab.core.cache.ExpiringCache; import org.openhab.core.library.types.StringType; import org.openhab.core.thing.ThingStatus; import org.openhab.core.thing.ThingStatusDetail; import org.openhab.core.types.UnDefType;
import org.openhab.core.cache.*; import org.openhab.core.library.types.*; import org.openhab.core.thing.*; import org.openhab.core.types.*;
[ "org.openhab.core" ]
org.openhab.core;
199,328
boolean hasOlder(E baseElement) throws SocialClientLibException;
boolean hasOlder(E baseElement) throws SocialClientLibException;
/** * Checks if there is older elements than the provided element. * * @param baseElement the based element * @return true if there is any older element, otherwise, false */
Checks if there is older elements than the provided element
hasOlder
{ "repo_name": "exoplatform/social-client-java", "path": "src/main/java/org/exoplatform/social/client/api/common/RealtimeListAccess.java", "license": "agpl-3.0", "size": 3260 }
[ "org.exoplatform.social.client.api.SocialClientLibException" ]
import org.exoplatform.social.client.api.SocialClientLibException;
import org.exoplatform.social.client.api.*;
[ "org.exoplatform.social" ]
org.exoplatform.social;
248,009
public synchronized static void initRegistry() { if (registry == null) { try { try { registry = LocateRegistry.createRegistry(Net.getRegistryPort()); } catch (ExportException e) { registry = LocateRegistry.getRegistry(Net.getRegistryPort()); } } catch (RemoteException e) { e.printStackTrace(); } } }
synchronized static void function() { if (registry == null) { try { try { registry = LocateRegistry.createRegistry(Net.getRegistryPort()); } catch (ExportException e) { registry = LocateRegistry.getRegistry(Net.getRegistryPort()); } } catch (RemoteException e) { e.printStackTrace(); } } }
/** * If registry is null, creates it. * */
If registry is null, creates it
initRegistry
{ "repo_name": "freeVM/freeVM", "path": "enhanced/archive/classlib/modules/rmi2/rmi-1.4.2/src/ar/org/fitc/test/rmi/integration/fase2/test/ITCTestCase.java", "license": "apache-2.0", "size": 6419 }
[ "ar.org.fitc.test.rmi.integration.fase2.Net", "java.rmi.RemoteException", "java.rmi.registry.LocateRegistry", "java.rmi.server.ExportException" ]
import ar.org.fitc.test.rmi.integration.fase2.Net; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.server.ExportException;
import ar.org.fitc.test.rmi.integration.fase2.*; import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*;
[ "ar.org.fitc", "java.rmi" ]
ar.org.fitc; java.rmi;
2,748,529
private static AxesWalker createDefaultWalker(Compiler compiler, int opPos, WalkingIterator lpi, int analysis) { AxesWalker ai = null; int stepType = compiler.getOp(opPos); boolean simpleInit = false; int totalNumberWalkers = (analysis & BITS_COUNT); boolean prevIsOneStepDown = true; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : prevIsOneStepDown = false; if (DEBUG_WALKER_CREATION) System.out.println("new walker: FilterExprWalker: " + analysis + ", " + compiler.toString()); ai = new FilterExprWalker(lpi); simpleInit = true; break; case OpCodes.FROM_ROOT : ai = new AxesWalker(lpi, Axis.ROOT); break; case OpCodes.FROM_ANCESTORS : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.ANCESTOR); break; case OpCodes.FROM_ANCESTORS_OR_SELF : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.ANCESTORORSELF); break; case OpCodes.FROM_ATTRIBUTES : ai = new AxesWalker(lpi, Axis.ATTRIBUTE); break; case OpCodes.FROM_NAMESPACE : ai = new AxesWalker(lpi, Axis.NAMESPACE); break; case OpCodes.FROM_CHILDREN : ai = new AxesWalker(lpi, Axis.CHILD); break; case OpCodes.FROM_DESCENDANTS : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.DESCENDANT); break; case OpCodes.FROM_DESCENDANTS_OR_SELF : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.DESCENDANTORSELF); break; case OpCodes.FROM_FOLLOWING : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.FOLLOWING); break; case OpCodes.FROM_FOLLOWING_SIBLINGS : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.FOLLOWINGSIBLING); break; case OpCodes.FROM_PRECEDING : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PRECEDING); break; case OpCodes.FROM_PRECEDING_SIBLINGS : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PRECEDINGSIBLING); break; case OpCodes.FROM_PARENT : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PARENT); break; case OpCodes.FROM_SELF : ai = new AxesWalker(lpi, Axis.SELF); break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); //"Programmer's assertion: unknown opcode: " //+ stepType); } if (simpleInit) { ai.initNodeTest(DTMFilter.SHOW_ALL); } else { int whatToShow = compiler.getWhatToShow(opPos); if ((0 == (whatToShow & (DTMFilter.SHOW_ATTRIBUTE | DTMFilter.SHOW_NAMESPACE | DTMFilter.SHOW_ELEMENT | DTMFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == DTMFilter.SHOW_ALL)) ai.initNodeTest(whatToShow); else { ai.initNodeTest(whatToShow, compiler.getStepNS(opPos), compiler.getStepLocalName(opPos)); } } return ai; }
static AxesWalker function(Compiler compiler, int opPos, WalkingIterator lpi, int analysis) { AxesWalker ai = null; int stepType = compiler.getOp(opPos); boolean simpleInit = false; int totalNumberWalkers = (analysis & BITS_COUNT); boolean prevIsOneStepDown = true; switch (stepType) { case OpCodes.OP_VARIABLE : case OpCodes.OP_EXTFUNCTION : case OpCodes.OP_FUNCTION : case OpCodes.OP_GROUP : prevIsOneStepDown = false; if (DEBUG_WALKER_CREATION) System.out.println(STR + analysis + STR + compiler.toString()); ai = new FilterExprWalker(lpi); simpleInit = true; break; case OpCodes.FROM_ROOT : ai = new AxesWalker(lpi, Axis.ROOT); break; case OpCodes.FROM_ANCESTORS : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.ANCESTOR); break; case OpCodes.FROM_ANCESTORS_OR_SELF : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.ANCESTORORSELF); break; case OpCodes.FROM_ATTRIBUTES : ai = new AxesWalker(lpi, Axis.ATTRIBUTE); break; case OpCodes.FROM_NAMESPACE : ai = new AxesWalker(lpi, Axis.NAMESPACE); break; case OpCodes.FROM_CHILDREN : ai = new AxesWalker(lpi, Axis.CHILD); break; case OpCodes.FROM_DESCENDANTS : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.DESCENDANT); break; case OpCodes.FROM_DESCENDANTS_OR_SELF : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.DESCENDANTORSELF); break; case OpCodes.FROM_FOLLOWING : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.FOLLOWING); break; case OpCodes.FROM_FOLLOWING_SIBLINGS : prevIsOneStepDown = false; ai = new AxesWalker(lpi, Axis.FOLLOWINGSIBLING); break; case OpCodes.FROM_PRECEDING : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PRECEDING); break; case OpCodes.FROM_PRECEDING_SIBLINGS : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PRECEDINGSIBLING); break; case OpCodes.FROM_PARENT : prevIsOneStepDown = false; ai = new ReverseAxesWalker(lpi, Axis.PARENT); break; case OpCodes.FROM_SELF : ai = new AxesWalker(lpi, Axis.SELF); break; default : throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NULL_ERROR_HANDLER, new Object[]{Integer.toString(stepType)})); } if (simpleInit) { ai.initNodeTest(DTMFilter.SHOW_ALL); } else { int whatToShow = compiler.getWhatToShow(opPos); if ((0 == (whatToShow & (DTMFilter.SHOW_ATTRIBUTE DTMFilter.SHOW_NAMESPACE DTMFilter.SHOW_ELEMENT DTMFilter.SHOW_PROCESSING_INSTRUCTION))) (whatToShow == DTMFilter.SHOW_ALL)) ai.initNodeTest(whatToShow); else { ai.initNodeTest(whatToShow, compiler.getStepNS(opPos), compiler.getStepLocalName(opPos)); } } return ai; }
/** * Create the proper Walker from the axes type. * * @param compiler non-null reference to compiler object that has processed * the XPath operations into an opcode map. * @param opPos The opcode position for the step. * @param lpi The owning location path iterator. * @param analysis 32 bits of analysis, from which the type of AxesWalker * may be influenced. * * @return non-null reference to AxesWalker derivative. * @throws RuntimeException if the input is bad. */
Create the proper Walker from the axes type
createDefaultWalker
{ "repo_name": "md-5/jdk10", "path": "src/java.xml/share/classes/com/sun/org/apache/xpath/internal/axes/WalkerFactory.java", "license": "gpl-2.0", "size": 60289 }
[ "com.sun.org.apache.xalan.internal.res.XSLMessages", "com.sun.org.apache.xml.internal.dtm.Axis", "com.sun.org.apache.xml.internal.dtm.DTMFilter", "com.sun.org.apache.xpath.internal.compiler.Compiler", "com.sun.org.apache.xpath.internal.compiler.OpCodes", "com.sun.org.apache.xpath.internal.res.XPATHErrorResources" ]
import com.sun.org.apache.xalan.internal.res.XSLMessages; import com.sun.org.apache.xml.internal.dtm.Axis; import com.sun.org.apache.xml.internal.dtm.DTMFilter; import com.sun.org.apache.xpath.internal.compiler.Compiler; import com.sun.org.apache.xpath.internal.compiler.OpCodes; import com.sun.org.apache.xpath.internal.res.XPATHErrorResources;
import com.sun.org.apache.xalan.internal.res.*; import com.sun.org.apache.xml.internal.dtm.*; import com.sun.org.apache.xpath.internal.compiler.*; import com.sun.org.apache.xpath.internal.res.*;
[ "com.sun.org" ]
com.sun.org;
2,413,547
public SearchRequest extraSource(byte[] source, int offset, int length, boolean unsafe) { return extraSource(new BytesArray(source, offset, length), unsafe); }
SearchRequest function(byte[] source, int offset, int length, boolean unsafe) { return extraSource(new BytesArray(source, offset, length), unsafe); }
/** * Allows to provide additional source that will be used as well. */
Allows to provide additional source that will be used as well
extraSource
{ "repo_name": "dmiszkiewicz/elasticsearch", "path": "src/main/java/org/elasticsearch/action/search/SearchRequest.java", "license": "apache-2.0", "size": 20302 }
[ "org.elasticsearch.common.bytes.BytesArray" ]
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.bytes.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,257,190
EReference getRootElementType_ExtendedAddress();
EReference getRootElementType_ExtendedAddress();
/** * Returns the meta object for the containment reference '{@link com.example.example.with.extensions.RootElementType#getExtendedAddress <em>Extended Address</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference '<em>Extended Address</em>'. * @see com.example.example.with.extensions.RootElementType#getExtendedAddress() * @see #getRootElementType() * @generated */
Returns the meta object for the containment reference '<code>com.example.example.with.extensions.RootElementType#getExtendedAddress Extended Address</code>'.
getRootElementType_ExtendedAddress
{ "repo_name": "patrickneubauer/XMLIntellEdit", "path": "individual-experiments/SandboxProject/src/com/example/example/with/extensions/ExtensionsPackage.java", "license": "mit", "size": 22872 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
780,932
public interface ReadbackViewCallback { View getReadbackView(); }
interface ReadbackViewCallback { View function(); }
/** * Gets the {@link View} for readback. */
Gets the <code>View</code> for readback
getReadbackView
{ "repo_name": "ric2b/Vivaldi-browser", "path": "chromium/content/public/android/java/src/org/chromium/content/browser/selection/SelectionPopupControllerImpl.java", "license": "bsd-3-clause", "size": 62465 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
34,002
@Nullable public static com.google.rpc.Status fromThrowable(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return toStatusProto(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return toStatusProto(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; }
static com.google.rpc.Status function(Throwable t) { Throwable cause = checkNotNull(t, "t"); while (cause != null) { if (cause instanceof StatusException) { StatusException e = (StatusException) cause; return toStatusProto(e.getStatus(), e.getTrailers()); } else if (cause instanceof StatusRuntimeException) { StatusRuntimeException e = (StatusRuntimeException) cause; return toStatusProto(e.getStatus(), e.getTrailers()); } cause = cause.getCause(); } return null; }
/** * Extract a {@link com.google.rpc.Status} instance from the causal chain of a {@link Throwable}. * * @return the extracted {@link com.google.rpc.Status} instance, or {@code null} if none exists. * @throws IllegalArgumentException if an embedded {@link com.google.rpc.Status} is found and its * code does not match the gRPC {@link Status} code. */
Extract a <code>com.google.rpc.Status</code> instance from the causal chain of a <code>Throwable</code>
fromThrowable
{ "repo_name": "nmittler/grpc-java", "path": "protobuf/src/main/java/io/grpc/protobuf/StatusProto.java", "license": "bsd-3-clause", "size": 7447 }
[ "com.google.common.base.Preconditions", "io.grpc.Status", "io.grpc.StatusException", "io.grpc.StatusRuntimeException" ]
import com.google.common.base.Preconditions; import io.grpc.Status; import io.grpc.StatusException; import io.grpc.StatusRuntimeException;
import com.google.common.base.*; import io.grpc.*;
[ "com.google.common", "io.grpc" ]
com.google.common; io.grpc;
2,796,469
void getCompeleteWithFile(int id, Path path);
void getCompeleteWithFile(int id, Path path);
/** * Deliver complete detection result with file. * After on-line detection is done, this method will be called. * * @param id registered id * @param path result file path */
Deliver complete detection result with file. After on-line detection is done, this method will be called
getCompeleteWithFile
{ "repo_name": "shlee89/athena", "path": "core/api/src/main/java/org/onosproject/athena/learning/LearningEventListener.java", "license": "apache-2.0", "size": 603 }
[ "java.nio.file.Path" ]
import java.nio.file.Path;
import java.nio.file.*;
[ "java.nio" ]
java.nio;
1,847,523
public static Bitmap fetchFileIntoImageView(File file, ImageView destView, int maxWidth, int maxHeight, boolean exact) { Bitmap bm = null; // resultant Bitmap (which we will return) // Get the file, if it exists. Otherwise set 'help' icon and exit. if (!file.exists()) { if (destView != null) destView.setImageResource(android.R.drawable.ic_menu_help); return null; } bm = shrinkFileIntoImageView(destView, file.getPath(), maxWidth, maxHeight, exact); return bm; }
static Bitmap function(File file, ImageView destView, int maxWidth, int maxHeight, boolean exact) { Bitmap bm = null; if (!file.exists()) { if (destView != null) destView.setImageResource(android.R.drawable.ic_menu_help); return null; } bm = shrinkFileIntoImageView(destView, file.getPath(), maxWidth, maxHeight, exact); return bm; }
/** * Shrinks the image in the passed file to the specified dimensions, and places the image * in the passed view. The bitmap is returned. * * @param file * @param destView * @param maxWidth * @param maxHeight * @param exact * * @return */
Shrinks the image in the passed file to the specified dimensions, and places the image in the passed view. The bitmap is returned
fetchFileIntoImageView
{ "repo_name": "eleybourn/Book-Catalogue", "path": "src/com/eleybourn/bookcatalogue/utils/Utils.java", "license": "gpl-3.0", "size": 70928 }
[ "android.graphics.Bitmap", "android.widget.ImageView", "java.io.File" ]
import android.graphics.Bitmap; import android.widget.ImageView; import java.io.File;
import android.graphics.*; import android.widget.*; import java.io.*;
[ "android.graphics", "android.widget", "java.io" ]
android.graphics; android.widget; java.io;
1,492,931
@Scheduled(fixedRate = 60000) public void scheduleDiscoverUser() { if (!resetTimer) { // Use ranked users when possible User user = userRepository.findRankedUserToCrawl(); if (user == null) { user = userRepository.findNextUserToCrawl(); } if (user != null) { user = twitterService.discoverUserByProfileId(user.getProfileId()); logger.info(String.format("Discover user %s", user.getScreenName())); userRepository.save(user); } } else { resetTimer = false; } // Update rankings logger.info("Updating last ranks..."); userRepository.setLastPageRank(); logger.info("Updating current rank..."); userRepository.updateUserCurrentRank(); logger.info("Current ranks updated!"); }
@Scheduled(fixedRate = 60000) void function() { if (!resetTimer) { User user = userRepository.findRankedUserToCrawl(); if (user == null) { user = userRepository.findNextUserToCrawl(); } if (user != null) { user = twitterService.discoverUserByProfileId(user.getProfileId()); logger.info(String.format(STR, user.getScreenName())); userRepository.save(user); } } else { resetTimer = false; } logger.info(STR); userRepository.setLastPageRank(); logger.info(STR); userRepository.updateUserCurrentRank(); logger.info(STR); }
/** * Every minute, an attempt to discover a new user to be imported is attempted. This only succeeds if * the API is not restricted by a temporary rate limit. This makes sure that only relevant users are * discovered over time, to keep the API crawling relevant. */
Every minute, an attempt to discover a new user to be imported is attempted. This only succeeds if the API is not restricted by a temporary rate limit. This makes sure that only relevant users are discovered over time, to keep the API crawling relevant
scheduleDiscoverUser
{ "repo_name": "fpeyron/twitter-analytics", "path": "crawler/src/main/java/fr/sysf/boot/scheduling/AnalyticsScheduler.java", "license": "apache-2.0", "size": 2887 }
[ "fr.sysf.boot.model.User", "org.springframework.scheduling.annotation.Scheduled" ]
import fr.sysf.boot.model.User; import org.springframework.scheduling.annotation.Scheduled;
import fr.sysf.boot.model.*; import org.springframework.scheduling.annotation.*;
[ "fr.sysf.boot", "org.springframework.scheduling" ]
fr.sysf.boot; org.springframework.scheduling;
127,186
public static void readSSLProperties(Map<String, String> env, boolean ignoreGemFirePropsFile) { Properties props = new Properties(); DistributionConfigImpl.loadGemFireProperties(props, ignoreGemFirePropsFile); for (Map.Entry<Object, Object> ent : props.entrySet()) { String key = (String) ent.getKey(); // if the value of ssl props is empty, read them from console if (key.startsWith(DistributionConfig.SSL_SYSTEM_PROPS_NAME) || key.startsWith(DistributionConfig.SYS_PROP_NAME)) { if (key.startsWith(DistributionConfig.SYS_PROP_NAME)) { key = key.substring(DistributionConfig.SYS_PROP_NAME.length()); } final String value = (String) ent.getValue(); if (value == null || value.trim().equals("")) { Console console = System.console(); if (console == null) { throw new GemFireConfigException( "SSL properties are empty, but a console is not available"); } String val = console.readLine("Please enter " + key + ": "); env.put(key, val); } } } }
static void function(Map<String, String> env, boolean ignoreGemFirePropsFile) { Properties props = new Properties(); DistributionConfigImpl.loadGemFireProperties(props, ignoreGemFirePropsFile); for (Map.Entry<Object, Object> ent : props.entrySet()) { String key = (String) ent.getKey(); if (key.startsWith(DistributionConfig.SSL_SYSTEM_PROPS_NAME) key.startsWith(DistributionConfig.SYS_PROP_NAME)) { if (key.startsWith(DistributionConfig.SYS_PROP_NAME)) { key = key.substring(DistributionConfig.SYS_PROP_NAME.length()); } final String value = (String) ent.getValue(); if (value == null value.trim().equals(STRSSL properties are empty, but a console is not availableSTRPlease enter STR: "); env.put(key, val); } } } }
/** * Used to read the properties from console. AgentLauncher calls this method directly & ignores * gemfire.properties. SystemAdmin calls this through {@link #readSSLProperties(Map)} and does * NOT ignore gemfire.properties. * * @param env Map in which the properties are to be read from console. * @param ignoreGemFirePropsFile if <code>false</code> existing gemfire.properties file is read, * if <code>true</code>, properties from gemfire.properties file are ignored. */
Used to read the properties from console. AgentLauncher calls this method directly & ignores gemfire.properties. SystemAdmin calls this through <code>#readSSLProperties(Map)</code> and does NOT ignore gemfire.properties
readSSLProperties
{ "repo_name": "davinash/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/net/SocketCreator.java", "license": "apache-2.0", "size": 32144 }
[ "java.util.Map", "java.util.Properties", "org.apache.geode.distributed.internal.DistributionConfig", "org.apache.geode.distributed.internal.DistributionConfigImpl" ]
import java.util.Map; import java.util.Properties; import org.apache.geode.distributed.internal.DistributionConfig; import org.apache.geode.distributed.internal.DistributionConfigImpl;
import java.util.*; import org.apache.geode.distributed.internal.*;
[ "java.util", "org.apache.geode" ]
java.util; org.apache.geode;
1,335,249
public Collection<ServletRegistrationBean> getServletRegistrationBeans() { return this.servletRegistrationBeans; }
Collection<ServletRegistrationBean> function() { return this.servletRegistrationBeans; }
/** * Return a mutable collection of the {@link ServletRegistrationBean} that the filter * will be registered against. {@link ServletRegistrationBean}s. * @return the Servlet registration beans * @see #setServletNames * @see #setUrlPatterns */
Return a mutable collection of the <code>ServletRegistrationBean</code> that the filter will be registered against. <code>ServletRegistrationBean</code>s
getServletRegistrationBeans
{ "repo_name": "gregturn/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/FilterRegistrationBean.java", "license": "apache-2.0", "size": 10448 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,576,562
public HttpRequest code(final AtomicInteger output) throws HttpRequestException { output.set(code()); return this; }
HttpRequest function(final AtomicInteger output) throws HttpRequestException { output.set(code()); return this; }
/** * Set the value of the given {@link AtomicInteger} to the status code of the * response * * @param output * @return this request * @throws HttpRequestException */
Set the value of the given <code>AtomicInteger</code> to the status code of the response
code
{ "repo_name": "h42i/Hasi-App", "path": "app/src/main/java/org/hasi/apps/hasi/HttpRequest.java", "license": "gpl-3.0", "size": 101719 }
[ "java.util.concurrent.atomic.AtomicInteger" ]
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.*;
[ "java.util" ]
java.util;
2,513,961
public static double estimateStrengthDifference( final ProData proData, final Territory t, final Collection<Unit> attackingUnits, final Collection<Unit> defendingUnits) { if (attackingUnits.stream().allMatch(Matches.unitIsInfrastructure()) || estimatePower(t, attackingUnits, defendingUnits, true) <= 0) { return 0; } if (defendingUnits.stream().allMatch(Matches.unitIsInfrastructure()) || estimatePower(t, defendingUnits, attackingUnits, false) <= 0) { return 99999; } final double attackerStrength = estimateStrength(t, attackingUnits, defendingUnits, true); final double defenderStrength = estimateStrength(t, defendingUnits, attackingUnits, false); return ((attackerStrength - defenderStrength) / Math.pow(defenderStrength, 0.85) * 50 + 50); }
static double function( final ProData proData, final Territory t, final Collection<Unit> attackingUnits, final Collection<Unit> defendingUnits) { if (attackingUnits.stream().allMatch(Matches.unitIsInfrastructure()) estimatePower(t, attackingUnits, defendingUnits, true) <= 0) { return 0; } if (defendingUnits.stream().allMatch(Matches.unitIsInfrastructure()) estimatePower(t, defendingUnits, attackingUnits, false) <= 0) { return 99999; } final double attackerStrength = estimateStrength(t, attackingUnits, defendingUnits, true); final double defenderStrength = estimateStrength(t, defendingUnits, attackingUnits, false); return ((attackerStrength - defenderStrength) / Math.pow(defenderStrength, 0.85) * 50 + 50); }
/** * Returns an estimate of the strength difference between the specified attacking and defending * units. * * @return 0 indicates absolute defender strength; 100+ indicates absolute attacker strength; 50 * indicates equal attacker and defender strength. */
Returns an estimate of the strength difference between the specified attacking and defending units
estimateStrengthDifference
{ "repo_name": "DanVanAtta/triplea", "path": "game-core/src/main/java/games/strategy/triplea/ai/pro/util/ProBattleUtils.java", "license": "gpl-3.0", "size": 17269 }
[ "games.strategy.engine.data.Territory", "games.strategy.engine.data.Unit", "games.strategy.triplea.ai.pro.ProData", "games.strategy.triplea.delegate.Matches", "java.util.Collection" ]
import games.strategy.engine.data.Territory; import games.strategy.engine.data.Unit; import games.strategy.triplea.ai.pro.ProData; import games.strategy.triplea.delegate.Matches; import java.util.Collection;
import games.strategy.engine.data.*; import games.strategy.triplea.ai.pro.*; import games.strategy.triplea.delegate.*; import java.util.*;
[ "games.strategy.engine", "games.strategy.triplea", "java.util" ]
games.strategy.engine; games.strategy.triplea; java.util;
482,973
@GET(JOBS_URL_SUFFIX + "/{id}/metadata") Call<JobMetadata> getJobMetadata(@Path("id") String jobId);
@GET(JOBS_URL_SUFFIX + STR) Call<JobMetadata> getJobMetadata(@Path("id") String jobId);
/** * Method to get the metadata information for a job. * * @param jobId The id of the job. * @return A callable object. */
Method to get the metadata information for a job
getJobMetadata
{ "repo_name": "Netflix/genie", "path": "genie-client/src/main/java/com/netflix/genie/client/apis/JobService.java", "license": "apache-2.0", "size": 8391 }
[ "com.netflix.genie.common.dto.JobMetadata" ]
import com.netflix.genie.common.dto.JobMetadata;
import com.netflix.genie.common.dto.*;
[ "com.netflix.genie" ]
com.netflix.genie;
495,019
public Component readDesign(Element componentDesign) { // Create the component. Component component = instantiateComponent(componentDesign); readDesign(componentDesign, component); fireComponentCreatedEvent(componentToLocalId.get(component), component); return component; }
Component function(Element componentDesign) { Component component = instantiateComponent(componentDesign); readDesign(componentDesign, component); fireComponentCreatedEvent(componentToLocalId.get(component), component); return component; }
/** * Reads the given design node and creates the corresponding component tree. * * @param componentDesign * The design element containing the description of the component * to be created. * @return the root component of component tree */
Reads the given design node and creates the corresponding component tree
readDesign
{ "repo_name": "Darsstar/framework", "path": "server/src/main/java/com/vaadin/ui/declarative/DesignContext.java", "license": "apache-2.0", "size": 32696 }
[ "com.vaadin.ui.Component", "org.jsoup.nodes.Element" ]
import com.vaadin.ui.Component; import org.jsoup.nodes.Element;
import com.vaadin.ui.*; import org.jsoup.nodes.*;
[ "com.vaadin.ui", "org.jsoup.nodes" ]
com.vaadin.ui; org.jsoup.nodes;
1,898,110
public TriplePattern toTp() { return GraphPatterns.tp(this); }
TriplePattern function() { return GraphPatterns.tp(this); }
/** * convert this blank node to a triple pattern * * @return the triple pattern identified by this blank node * * @see <a href="https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#QSynBlankNodes"> * blank node syntax</a> */
convert this blank node to a triple pattern
toTp
{ "repo_name": "anqit/spanqit", "path": "src/main/java/com/anqit/spanqit/rdf/RdfBlankNode.java", "license": "apache-2.0", "size": 3212 }
[ "com.anqit.spanqit.graphpattern.GraphPatterns", "com.anqit.spanqit.graphpattern.TriplePattern" ]
import com.anqit.spanqit.graphpattern.GraphPatterns; import com.anqit.spanqit.graphpattern.TriplePattern;
import com.anqit.spanqit.graphpattern.*;
[ "com.anqit.spanqit" ]
com.anqit.spanqit;
943,017
private static File getSharedFolder() throws SharedConfigurationException { // Check that the shared folder is set and exists String remoteConfigFolderPath = AutoIngestUserPreferences.getSharedConfigFolder(); if (remoteConfigFolderPath.isEmpty()) { logger.log(Level.SEVERE, "Shared configuration folder is not set."); throw new SharedConfigurationException("Shared configuration folder is not set."); } File remoteFolder = new File(remoteConfigFolderPath); if (!remoteFolder.exists()) { logger.log(Level.SEVERE, "Shared configuration folder {0} does not exist", remoteConfigFolderPath); throw new SharedConfigurationException("Shared configuration folder " + remoteConfigFolderPath + " does not exist"); } return remoteFolder; }
static File function() throws SharedConfigurationException { String remoteConfigFolderPath = AutoIngestUserPreferences.getSharedConfigFolder(); if (remoteConfigFolderPath.isEmpty()) { logger.log(Level.SEVERE, STR); throw new SharedConfigurationException(STR); } File remoteFolder = new File(remoteConfigFolderPath); if (!remoteFolder.exists()) { logger.log(Level.SEVERE, STR, remoteConfigFolderPath); throw new SharedConfigurationException(STR + remoteConfigFolderPath + STR); } return remoteFolder; }
/** * Get the base folder being used to store the shared config settings. * * @return The shared configuration folder * * @throws SharedConfigurationException */
Get the base folder being used to store the shared config settings
getSharedFolder
{ "repo_name": "dgrove727/autopsy", "path": "Experimental/src/org/sleuthkit/autopsy/experimental/configuration/SharedConfiguration.java", "license": "apache-2.0", "size": 60350 }
[ "java.io.File", "java.util.logging.Level" ]
import java.io.File; import java.util.logging.Level;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,291,187
public boolean isHttp09() { return protocol.equals(Protocols.HTTP_0_9); }
boolean function() { return protocol.equals(Protocols.HTTP_0_9); }
/** * Determine whether this request conforms to HTTP 0.9. * * @return {@code true} if the request protocol is equal to {@link Protocols#HTTP_0_9}, {@code false} otherwise */
Determine whether this request conforms to HTTP 0.9
isHttp09
{ "repo_name": "popstr/undertow", "path": "core/src/main/java/io/undertow/server/HttpServerExchange.java", "license": "apache-2.0", "size": 82724 }
[ "io.undertow.util.Protocols" ]
import io.undertow.util.Protocols;
import io.undertow.util.*;
[ "io.undertow.util" ]
io.undertow.util;
2,643,954
@Override public void visitRank(PORank op) throws VisitorException { try { FileSpec fSpec = getTempFileSpec(); MapReduceOper prevMROper = endSingleInputPlanWithStr(fSpec); curMROp = startNew(fSpec, prevMROper); curMROp.mapPlan.addAsLeaf(op); phyToMROpMap.put(op, curMROp); } catch (Exception e) { int errCode = 2034; String msg = "Error compiling operator " + op.getClass().getSimpleName(); throw new MRCompilerException(msg, errCode, PigException.BUG, e); } }
void function(PORank op) throws VisitorException { try { FileSpec fSpec = getTempFileSpec(); MapReduceOper prevMROper = endSingleInputPlanWithStr(fSpec); curMROp = startNew(fSpec, prevMROper); curMROp.mapPlan.addAsLeaf(op); phyToMROpMap.put(op, curMROp); } catch (Exception e) { int errCode = 2034; String msg = STR + op.getClass().getSimpleName(); throw new MRCompilerException(msg, errCode, PigException.BUG, e); } }
/** * In case of PORank, it is closed any other previous job (containing * POCounter as a leaf) and PORank is added on map phase. **/
In case of PORank, it is closed any other previous job (containing POCounter as a leaf) and PORank is added on map phase
visitRank
{ "repo_name": "hxquangnhat/PIG-ROLLUP-AUTO-HII", "path": "src/org/apache/pig/backend/hadoop/executionengine/mapReduceLayer/MRCompiler.java", "license": "apache-2.0", "size": 155423 }
[ "org.apache.pig.PigException", "org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.PORank", "org.apache.pig.impl.io.FileSpec", "org.apache.pig.impl.plan.VisitorException" ]
import org.apache.pig.PigException; import org.apache.pig.backend.hadoop.executionengine.physicalLayer.relationalOperators.PORank; import org.apache.pig.impl.io.FileSpec; import org.apache.pig.impl.plan.VisitorException;
import org.apache.pig.*; import org.apache.pig.backend.hadoop.executionengine.*; import org.apache.pig.impl.io.*; import org.apache.pig.impl.plan.*;
[ "org.apache.pig" ]
org.apache.pig;
1,194,534
public static final byte[] encode(BigInteger big, int bitlen) { //round bitlen bitlen = ((bitlen + 7) >> 3) << 3; if (bitlen < big.bitLength()) { throw new IllegalArgumentException(I18n .translate("utils.Base64.IllegalBitlength")); } byte[] bigBytes = big.toByteArray(); if (((big.bitLength() % 8) != 0) && (((big.bitLength() / 8) + 1) == (bitlen / 8))) { return bigBytes; } // some copying needed int startSrc = 0; // no need to skip anything int bigLen = bigBytes.length; //valid length of the string if ((big.bitLength() % 8) == 0) { // correct values startSrc = 1; // skip sign bit bigLen--; // valid length of the string } int startDst = bitlen / 8 - bigLen; //pad with leading nulls byte[] resizedBytes = new byte[bitlen / 8]; System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, bigLen); return resizedBytes; }
static final byte[] function(BigInteger big, int bitlen) { bitlen = ((bitlen + 7) >> 3) << 3; if (bitlen < big.bitLength()) { throw new IllegalArgumentException(I18n .translate(STR)); } byte[] bigBytes = big.toByteArray(); if (((big.bitLength() % 8) != 0) && (((big.bitLength() / 8) + 1) == (bitlen / 8))) { return bigBytes; } int startSrc = 0; int bigLen = bigBytes.length; if ((big.bitLength() % 8) == 0) { startSrc = 1; bigLen--; } int startDst = bitlen / 8 - bigLen; byte[] resizedBytes = new byte[bitlen / 8]; System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, bigLen); return resizedBytes; }
/** * Returns a byte-array representation of a <code>{@link BigInteger}<code>. * No sign-bit is outputed. * * <b>N.B.:</B> <code>{@link BigInteger}<code>'s toByteArray * retunrs eventually longer arrays because of the leading sign-bit. * * @param big <code>BigInteger<code> to be converted * @param bitlen <code>int<code> the desired length in bits of the representation * @return a byte array with <code>bitlen</code> bits of <code>big</code> */
Returns a byte-array representation of a <code><code>BigInteger</code><code>. No sign-bit is outputed. N.B.: <code><code>BigInteger</code><code>'s toByteArray retunrs eventually longer arrays because of the leading sign-bit
encode
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jdk/src/share/classes/com/sun/org/apache/xml/internal/security/utils/Base64.java", "license": "gpl-2.0", "size": 26374 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,429,580
Mono<Boolean> acquireInitializationLock(Duration lockExpirationTime);
Mono<Boolean> acquireInitializationLock(Duration lockExpirationTime);
/** * Places a lock on the lease store for initialization. Only one process may own the store for the lock time. * * @param lockExpirationTime the time for the lock to expire. * @return true if the lock was acquired, false otherwise. */
Places a lock on the lease store for initialization. Only one process may own the store for the lock time
acquireInitializationLock
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/changefeed/LeaseStoreManager.java", "license": "mit", "size": 4202 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
2,849,140
public void setCanWrite(Capability cooked) throws AccessPoemException { _getProtectedTable(). getCanWriteColumn(). getType().assertValidCooked(cooked); writeLock(); if (cooked == null) setCanWrite_unsafe(null); else { cooked.existenceLock(); setCanWrite_unsafe(cooked.troid()); } }
void function(Capability cooked) throws AccessPoemException { _getProtectedTable(). getCanWriteColumn(). getType().assertValidCooked(cooked); writeLock(); if (cooked == null) setCanWrite_unsafe(null); else { cooked.existenceLock(); setCanWrite_unsafe(cooked.troid()); } }
/** * Set the CanWrite. * * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods * @param cooked a validated <code>Capability</code> * @throws AccessPoemException * if the current <code>AccessToken</code> * does not confer write access rights */
Set the CanWrite. Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
setCanWrite
{ "repo_name": "timp21337/melati-old", "path": "poem/src/test/java/org/melati/poem/test/generated/ProtectedBase.java", "license": "gpl-2.0", "size": 28567 }
[ "org.melati.poem.AccessPoemException", "org.melati.poem.Capability" ]
import org.melati.poem.AccessPoemException; import org.melati.poem.Capability;
import org.melati.poem.*;
[ "org.melati.poem" ]
org.melati.poem;
1,864,547
public Paint getBorderPaint() { return borderPaint; }
Paint function() { return borderPaint; }
/** * Gets the border paint. * * @return the border paint. */
Gets the border paint
getBorderPaint
{ "repo_name": "trejkaz/hex-components", "path": "viewer/src/main/java/org/trypticon/hex/AnnotationStyle.java", "license": "lgpl-3.0", "size": 2023 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,844,556
public boolean appendPrefix(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; if (sd != null) { String prefix = sd.prefix; if (prefix != null) { sb.append(prefix); return sd.requiresDigitPrefix; } } } return false; }
boolean function(int tl, int td, StringBuffer sb) { if (dr.scopeData != null) { int ix = tl * 3 + td; ScopeData sd = dr.scopeData[ix]; if (sd != null) { String prefix = sd.prefix; if (prefix != null) { sb.append(prefix); return sd.requiresDigitPrefix; } } } return false; }
/** * Append the appropriate prefix to the string builder, depending on whether and * how a limit and direction are to be displayed. * * @param tl how and whether to display the time limit * @param td how and whether to display the time direction * @param sb the string builder to which to append the text * @return true if a following digit will require a digit prefix */
Append the appropriate prefix to the string builder, depending on whether and how a limit and direction are to be displayed
appendPrefix
{ "repo_name": "google/j2objc", "path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/impl/PeriodFormatterData.java", "license": "apache-2.0", "size": 22414 }
[ "android.icu.impl.duration.impl.DataRecord" ]
import android.icu.impl.duration.impl.DataRecord;
import android.icu.impl.duration.impl.*;
[ "android.icu" ]
android.icu;
2,396,805
private au.csiro.snorocket.core.model.AbstractLiteral transformLiteral(Literal l) { if(l instanceof au.csiro.ontology.model.DateLiteral) { return new DateLiteral(((au.csiro.ontology.model.DateLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.DecimalLiteral) { return new DecimalLiteral(((au.csiro.ontology.model.DecimalLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.IntegerLiteral) { return new IntegerLiteral(((au.csiro.ontology.model.IntegerLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.StringLiteral) { return new StringLiteral(((au.csiro.ontology.model.StringLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.FloatLiteral) { return new DecimalLiteral(new BigDecimal(((au.csiro.ontology.model.FloatLiteral) l).getValue())); } else { throw new RuntimeException("Unexpected AbstractLiteral "+l.getClass().getName()); } }
au.csiro.snorocket.core.model.AbstractLiteral function(Literal l) { if(l instanceof au.csiro.ontology.model.DateLiteral) { return new DateLiteral(((au.csiro.ontology.model.DateLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.DecimalLiteral) { return new DecimalLiteral(((au.csiro.ontology.model.DecimalLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.IntegerLiteral) { return new IntegerLiteral(((au.csiro.ontology.model.IntegerLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.StringLiteral) { return new StringLiteral(((au.csiro.ontology.model.StringLiteral) l).getValue()); } else if(l instanceof au.csiro.ontology.model.FloatLiteral) { return new DecimalLiteral(new BigDecimal(((au.csiro.ontology.model.FloatLiteral) l).getValue())); } else { throw new RuntimeException(STR+l.getClass().getName()); } }
/** * Transforms an {@link ILiteral} into an {@link au.csiro.snorocket.core.model.AbstractLiteral}. * * @param l The literal in the ontology model format. * @return The literal in the internal model format. */
Transforms an <code>ILiteral</code> into an <code>au.csiro.snorocket.core.model.AbstractLiteral</code>
transformLiteral
{ "repo_name": "aehrc/snorocket", "path": "snorocket-core/src/main/java/au/csiro/snorocket/core/NormalisedOntology.java", "license": "apache-2.0", "size": 98552 }
[ "au.csiro.ontology.model.Literal", "au.csiro.snorocket.core.model.AbstractLiteral", "au.csiro.snorocket.core.model.DateLiteral", "au.csiro.snorocket.core.model.DecimalLiteral", "au.csiro.snorocket.core.model.IntegerLiteral", "au.csiro.snorocket.core.model.StringLiteral", "java.math.BigDecimal" ]
import au.csiro.ontology.model.Literal; import au.csiro.snorocket.core.model.AbstractLiteral; import au.csiro.snorocket.core.model.DateLiteral; import au.csiro.snorocket.core.model.DecimalLiteral; import au.csiro.snorocket.core.model.IntegerLiteral; import au.csiro.snorocket.core.model.StringLiteral; import java.math.BigDecimal;
import au.csiro.ontology.model.*; import au.csiro.snorocket.core.model.*; import java.math.*;
[ "au.csiro.ontology", "au.csiro.snorocket", "java.math" ]
au.csiro.ontology; au.csiro.snorocket; java.math;
666,644
public void archive(List<Inode> nodes, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException, DotStateException;
void function(List<Inode> nodes, User user, boolean respectFrontendRoles) throws DotDataException, DotSecurityException, DotStateException;
/** * This method archives the given nodes * * @param nodes * @param user * @param respectFrontendRoles * @throws DotDataException * @throws DotSecurityException */
This method archives the given nodes
archive
{ "repo_name": "wisdom-garden/dotcms", "path": "src/com/dotmarketing/business/skeleton/DotCMSAPI.java", "license": "gpl-3.0", "size": 24636 }
[ "com.dotmarketing.beans.Inode", "com.dotmarketing.business.DotStateException", "com.dotmarketing.exception.DotDataException", "com.dotmarketing.exception.DotSecurityException", "com.liferay.portal.model.User", "java.util.List" ]
import com.dotmarketing.beans.Inode; import com.dotmarketing.business.DotStateException; import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException; import com.liferay.portal.model.User; import java.util.List;
import com.dotmarketing.beans.*; import com.dotmarketing.business.*; import com.dotmarketing.exception.*; import com.liferay.portal.model.*; import java.util.*;
[ "com.dotmarketing.beans", "com.dotmarketing.business", "com.dotmarketing.exception", "com.liferay.portal", "java.util" ]
com.dotmarketing.beans; com.dotmarketing.business; com.dotmarketing.exception; com.liferay.portal; java.util;
1,222,912
public Call buildCall(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams); final String url = buildUrl(path, queryParams); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); String contentType = (String) headerParams.get("Content-Type"); // ensuring a default content type if (contentType == null) { contentType = "application/json"; } RequestBody reqBody; if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; } else if ("application/x-www-form-urlencoded".equals(contentType)) { reqBody = buildRequestBodyFormEncoding(formParams); } else if ("multipart/form-data".equals(contentType)) { reqBody = buildRequestBodyMultipart(formParams); } else if (body == null) { if ("DELETE".equals(method)) { // allow calling DELETE without sending a request body reqBody = null; } else { // use an empty request body (for POST, PUT and PATCH) reqBody = RequestBody.create(MediaType.parse(contentType), ""); } } else { reqBody = serialize(body, contentType); } Request request = null; if(progressRequestListener != null && reqBody != null) { ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); request = reqBuilder.method(method, progressRequestBody).build(); } else { request = reqBuilder.method(method, reqBody).build(); } return httpClient.newCall(request); }
Call function(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { updateParamsForAuth(authNames, queryParams, headerParams); final String url = buildUrl(path, queryParams); final Request.Builder reqBuilder = new Request.Builder().url(url); processHeaderParams(headerParams, reqBuilder); String contentType = (String) headerParams.get(STR); if (contentType == null) { contentType = STR; } RequestBody reqBody; if (!HttpMethod.permitsRequestBody(method)) { reqBody = null; } else if (STR.equals(contentType)) { reqBody = buildRequestBodyFormEncoding(formParams); } else if (STR.equals(contentType)) { reqBody = buildRequestBodyMultipart(formParams); } else if (body == null) { if (STR.equals(method)) { reqBody = null; } else { reqBody = RequestBody.create(MediaType.parse(contentType), ""); } } else { reqBody = serialize(body, contentType); } Request request = null; if(progressRequestListener != null && reqBody != null) { ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, progressRequestListener); request = reqBuilder.method(method, progressRequestBody).build(); } else { request = reqBuilder.method(method, reqBody).build(); } return httpClient.newCall(request); }
/** * Build HTTP call with the given options. * * @param path The sub-path of the HTTP URL * @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" * @param queryParams The query parameters * @param body The request body object * @param headerParams The header parameters * @param formParams The form parameters * @param authNames The authentications to apply * @param progressRequestListener Progress request listener * @return The HTTP call * @throws ApiException If fail to serialize the request body object */
Build HTTP call with the given options
buildCall
{ "repo_name": "ScsApiTribe/payments-api-java-sdk", "path": "src/main/java/com/swisscom/api/sdk/payments/ApiClient.java", "license": "apache-2.0", "size": 46277 }
[ "com.squareup.okhttp.Call", "com.squareup.okhttp.MediaType", "com.squareup.okhttp.Request", "com.squareup.okhttp.RequestBody", "com.squareup.okhttp.internal.http.HttpMethod", "java.util.List", "java.util.Map" ]
import com.squareup.okhttp.Call; import com.squareup.okhttp.MediaType; import com.squareup.okhttp.Request; import com.squareup.okhttp.RequestBody; import com.squareup.okhttp.internal.http.HttpMethod; import java.util.List; import java.util.Map;
import com.squareup.okhttp.*; import com.squareup.okhttp.internal.http.*; import java.util.*;
[ "com.squareup.okhttp", "java.util" ]
com.squareup.okhttp; java.util;
65,262
public static Map<Guid, DiskImage> getDiskImagesByIdMap(Collection<DiskImage> diskImages) { Map<Guid, DiskImage> result = new HashMap<>(); if (diskImages != null) { for (DiskImage diskImage : diskImages) { result.put(diskImage.getImageId(), diskImage); } } return result; }
static Map<Guid, DiskImage> function(Collection<DiskImage> diskImages) { Map<Guid, DiskImage> result = new HashMap<>(); if (diskImages != null) { for (DiskImage diskImage : diskImages) { result.put(diskImage.getImageId(), diskImage); } } return result; }
/** * Gets a map of DiskImage IDs to DiskImage objects * * @param diskImages * collection of DiskImage objects to create the map for * @return map object is the collection is not null */
Gets a map of DiskImage IDs to DiskImage objects
getDiskImagesByIdMap
{ "repo_name": "jtux270/translate", "path": "ovirt/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImagesHandler.java", "license": "gpl-3.0", "size": 37626 }
[ "java.util.Collection", "java.util.HashMap", "java.util.Map", "org.ovirt.engine.core.common.businessentities.DiskImage", "org.ovirt.engine.core.compat.Guid" ]
import java.util.Collection; import java.util.HashMap; import java.util.Map; import org.ovirt.engine.core.common.businessentities.DiskImage; import org.ovirt.engine.core.compat.Guid;
import java.util.*; import org.ovirt.engine.core.common.businessentities.*; import org.ovirt.engine.core.compat.*;
[ "java.util", "org.ovirt.engine" ]
java.util; org.ovirt.engine;
1,397,396
public void setDomain(String domain, SetConfigCallback setConfigCallback, boolean... sync) { if (TextUtils.isEmpty(domain)) { Tool.executeCallback(listener, Tool.CallbackType.WARNING, "Bad value for domain, default value retained"); } else { setConfig(TrackerConfigurationKeys.DOMAIN, domain, setConfigCallback, sync); } }
void function(String domain, SetConfigCallback setConfigCallback, boolean... sync) { if (TextUtils.isEmpty(domain)) { Tool.executeCallback(listener, Tool.CallbackType.WARNING, STR); } else { setConfig(TrackerConfigurationKeys.DOMAIN, domain, setConfigCallback, sync); } }
/** * Set a new domain * * @param domain ATInternet collect domain value * @param setConfigCallback Callback called when the operation has been done * @param sync (optional) perform the operation synchronously (default: false) */
Set a new domain
setDomain
{ "repo_name": "at-internet/atinternet-android-sdk", "path": "ATMobileAnalytics/Tracker/src/main/java/com/atinternet/tracker/Tracker.java", "license": "mit", "size": 58353 }
[ "android.text.TextUtils" ]
import android.text.TextUtils;
import android.text.*;
[ "android.text" ]
android.text;
1,261,481
void setFocusEntity(URIAndEntityName value);
void setFocusEntity(URIAndEntityName value);
/** * Sets the value of the '{@link org.openhealthtools.mdht.cts2.association.AssociationGraph#getFocusEntity <em>Focus Entity</em>}' containment * reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @param value * the new value of the '<em>Focus Entity</em>' containment reference. * @see #getFocusEntity() * @generated */
Sets the value of the '<code>org.openhealthtools.mdht.cts2.association.AssociationGraph#getFocusEntity Focus Entity</code>' containment reference.
setFocusEntity
{ "repo_name": "drbgfc/mdht", "path": "cts2/plugins/org.openhealthtools.mdht.cts2.core/src/org/openhealthtools/mdht/cts2/association/AssociationGraph.java", "license": "epl-1.0", "size": 9601 }
[ "org.openhealthtools.mdht.cts2.core.URIAndEntityName" ]
import org.openhealthtools.mdht.cts2.core.URIAndEntityName;
import org.openhealthtools.mdht.cts2.core.*;
[ "org.openhealthtools.mdht" ]
org.openhealthtools.mdht;
2,613,847
@Inject @Optional public void setSelectionOn( @UIEventTopic(TestEditorUIEventConstants.ACTIVE_TESTFLOW_EDITOR_CHANGED) TestStructure testStructure) { if (metaDataStructureTree != null) { metaDataStructureTree.selectTestStructure(testStructure); } }
void function( @UIEventTopic(TestEditorUIEventConstants.ACTIVE_TESTFLOW_EDITOR_CHANGED) TestStructure testStructure) { if (metaDataStructureTree != null) { metaDataStructureTree.selectTestStructure(testStructure); } }
/** * Changes the Selection of the TestCase Tree. * * @param testStructure * to be selected in the Tree. */
Changes the Selection of the TestCase Tree
setSelectionOn
{ "repo_name": "test-editor/test-editor", "path": "metadata/org.testeditor.metadata.ui/src/main/java/org/testeditor/metadata/ui/explorer/MetaDataExplorer.java", "license": "epl-1.0", "size": 8049 }
[ "org.eclipse.e4.ui.di.UIEventTopic", "org.testeditor.core.model.teststructure.TestStructure", "org.testeditor.ui.constants.TestEditorUIEventConstants" ]
import org.eclipse.e4.ui.di.UIEventTopic; import org.testeditor.core.model.teststructure.TestStructure; import org.testeditor.ui.constants.TestEditorUIEventConstants;
import org.eclipse.e4.ui.di.*; import org.testeditor.core.model.teststructure.*; import org.testeditor.ui.constants.*;
[ "org.eclipse.e4", "org.testeditor.core", "org.testeditor.ui" ]
org.eclipse.e4; org.testeditor.core; org.testeditor.ui;
2,552,137
@param _name the name of the table to drop */ private void dropTable(final String _name) throws SQLException { final StringBuffer dropStatement = new StringBuffer("DROP TABLE \""); dropStatement.append(_name); dropStatement.append("\" IF EXISTS"); executeSQL(dropStatement.toString()); }
@param _name the name of the table to drop */ void function(final String _name) throws SQLException { final StringBuffer dropStatement = new StringBuffer(STRSTR\STR); executeSQL(dropStatement.toString()); }
/** drops the table with a given name @param _name the name of the table to drop */
drops the table with a given name
dropTable
{ "repo_name": "jvanz/core", "path": "connectivity/qa/connectivity/tools/HsqlDatabase.java", "license": "gpl-3.0", "size": 7258 }
[ "com.sun.star.sdbc.SQLException" ]
import com.sun.star.sdbc.SQLException;
import com.sun.star.sdbc.*;
[ "com.sun.star" ]
com.sun.star;
2,814,991
protected void onDeletedMessages(Context context, int total) { }
void function(Context context, int total) { }
/** * Called when the GCM server tells pending messages have been deleted * because the device was idle. * * @param context application's context. * @param total total number of collapsed messages */
Called when the GCM server tells pending messages have been deleted because the device was idle
onDeletedMessages
{ "repo_name": "fjpavm/ChilliSource", "path": "Source/CSBackend/Platform/Android/GooglePlay/Java/com/chilliworks/chillisource/googleplay/core/GCMBaseIntentService.java", "license": "mit", "size": 12940 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,768,670
public final void setDataSource(FileDescriptor fd) { setDataSource(fd, 0, 0x7ffffffffffffffL); }
final void function(FileDescriptor fd) { setDataSource(fd, 0, 0x7ffffffffffffffL); }
/** * Sets the data source (FileDescriptor) to use. It is the caller's responsibility * to close the file descriptor. It is safe to do so as soon as this call returns. * * @param fd the FileDescriptor for the file you want to extract from. */
Sets the data source (FileDescriptor) to use. It is the caller's responsibility to close the file descriptor. It is safe to do so as soon as this call returns
setDataSource
{ "repo_name": "haikuowuya/android_system_code", "path": "src/android/media/MediaExtractor.java", "license": "apache-2.0", "size": 11059 }
[ "java.io.FileDescriptor" ]
import java.io.FileDescriptor;
import java.io.*;
[ "java.io" ]
java.io;
2,560,539
public void crabBackDirBlockForModification(BlockId blk) { lockTbl.release(blk, txNum, ConservativeOrderedLockTable.LockType.X_LOCK); writtenIndexBlks.remove(blk); }
void function(BlockId blk) { lockTbl.release(blk, txNum, ConservativeOrderedLockTable.LockType.X_LOCK); writtenIndexBlks.remove(blk); }
/** * Releases exclusive locks on the directory block for crabbing back. * * @param blk * the block id */
Releases exclusive locks on the directory block for crabbing back
crabBackDirBlockForModification
{ "repo_name": "elasql/elasql", "path": "src/main/java/org/elasql/storage/tx/concurrency/ConservativeOrderedCcMgr.java", "license": "apache-2.0", "size": 7596 }
[ "org.elasql.storage.tx.concurrency.ConservativeOrderedLockTable", "org.vanilladb.core.storage.file.BlockId" ]
import org.elasql.storage.tx.concurrency.ConservativeOrderedLockTable; import org.vanilladb.core.storage.file.BlockId;
import org.elasql.storage.tx.concurrency.*; import org.vanilladb.core.storage.file.*;
[ "org.elasql.storage", "org.vanilladb.core" ]
org.elasql.storage; org.vanilladb.core;
2,543,867
@Override protected boolean isFormSubmission(HttpServletRequest request) { return super.isFormSubmission(request) || isCancelRequest(request); }
boolean function(HttpServletRequest request) { return super.isFormSubmission(request) isCancelRequest(request); }
/** * Consider an explicit cancel request as a form submission too. * @see #isCancelRequest(javax.servlet.http.HttpServletRequest) */
Consider an explicit cancel request as a form submission too
isFormSubmission
{ "repo_name": "kingtang/spring-learn", "path": "spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/CancellableFormController.java", "license": "gpl-3.0", "size": 8277 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
1,368,593
public java.util.List<ArcHLAPI> getOutArcsHLAPI();
java.util.List<ArcHLAPI> function();
/** * This accessor automaticaly encapsulate all elements of the selected sublist. * WARNING : this can creates a lot of new object in memory. */
This accessor automaticaly encapsulate all elements of the selected sublist. WARNING : this can creates a lot of new object in memory
getOutArcsHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/hlcorestructure/hlapi/TransitionNodeHLAPI.java", "license": "epl-1.0", "size": 4467 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,467,472
public VolleyError getError() { return mError; }
VolleyError function() { return mError; }
/** * Get the error for this response */
Get the error for this response
getError
{ "repo_name": "dim1989/zhangzhoujun.github.io", "path": "MyVolley/app/src/main/java/com/android/myvolley/volley/toolbox/ImageLoader.java", "license": "epl-1.0", "size": 20161 }
[ "com.android.myvolley.volley.VolleyError" ]
import com.android.myvolley.volley.VolleyError;
import com.android.myvolley.volley.*;
[ "com.android.myvolley" ]
com.android.myvolley;
393,375
public static <T extends ByteCodeElement> ElementMatcher.Junction<T> isDeclaredBy(ElementMatcher<? super TypeDescription> matcher) { return isDeclaredByGeneric(erasure(matcher)); }
static <T extends ByteCodeElement> ElementMatcher.Junction<T> function(ElementMatcher<? super TypeDescription> matcher) { return isDeclaredByGeneric(erasure(matcher)); }
/** * Matches a {@link ByteCodeElement} for being declared by a {@link TypeDescription} that is matched by the given matcher. This matcher matches * a declared element's raw declaring type. * * @param matcher A matcher for the declaring type of the matched byte code element as long as it * is not {@code null}. * @param <T> The type of the matched object. * @return A matcher for byte code elements being declared by a type matched by the given {@code matcher}. */
Matches a <code>ByteCodeElement</code> for being declared by a <code>TypeDescription</code> that is matched by the given matcher. This matcher matches a declared element's raw declaring type
isDeclaredBy
{ "repo_name": "DALDEI/byte-buddy", "path": "byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java", "license": "apache-2.0", "size": 103880 }
[ "net.bytebuddy.description.ByteCodeElement", "net.bytebuddy.description.type.TypeDescription" ]
import net.bytebuddy.description.ByteCodeElement; import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.description.*; import net.bytebuddy.description.type.*;
[ "net.bytebuddy.description" ]
net.bytebuddy.description;
1,827,778
String methodName = null; try { JobDataMap data = context.getJobDetail().getJobDataMap(); Map paramsMap = data.getWrappedMap(); methodName = (String) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_NAME); final Object instance = getInstanceToRun(paramsMap); final Object[] methodParams = (Object[]) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_PARAM); String methodKey = getMethodKey(instance.getClass().getName(), methodName); final Method methodToRun; if (!cachedMethods.containsKey(methodKey)) { cachedMethods.putIfAbsent(methodKey, getMethodToRun(instance, methodName)); } methodToRun = cachedMethods.get(methodKey); invokeMethod(instance, methodToRun, methodParams); } catch (Exception e) { log.error("Failed to invoke scheduled method {}: {}", methodName, e.getMessage()); log.debug("Exception", e); JobExecutionException jee = new JobExecutionException("failed to execute job"); jee.setStackTrace(e.getStackTrace()); throw jee; } }
String methodName = null; try { JobDataMap data = context.getJobDetail().getJobDataMap(); Map paramsMap = data.getWrappedMap(); methodName = (String) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_NAME); final Object instance = getInstanceToRun(paramsMap); final Object[] methodParams = (Object[]) paramsMap.get(SchedulerUtilBaseImpl.RUN_METHOD_PARAM); String methodKey = getMethodKey(instance.getClass().getName(), methodName); final Method methodToRun; if (!cachedMethods.containsKey(methodKey)) { cachedMethods.putIfAbsent(methodKey, getMethodToRun(instance, methodName)); } methodToRun = cachedMethods.get(methodKey); invokeMethod(instance, methodToRun, methodParams); } catch (Exception e) { log.error(STR, methodName, e.getMessage()); log.debug(STR, e); JobExecutionException jee = new JobExecutionException(STR); jee.setStackTrace(e.getStackTrace()); throw jee; } }
/** * execute a method within an instance. The instance and the method name are * expected to be in the context given object. * * @param context * the context for this job. */
execute a method within an instance. The instance and the method name are expected to be in the context given object
execute
{ "repo_name": "jtux270/translate", "path": "ovirt/3.6_source/backend/manager/modules/scheduler/src/main/java/org/ovirt/engine/core/utils/timer/JobWrapper.java", "license": "gpl-3.0", "size": 4702 }
[ "java.lang.reflect.Method", "java.util.Map", "org.quartz.JobDataMap", "org.quartz.JobExecutionException" ]
import java.lang.reflect.Method; import java.util.Map; import org.quartz.JobDataMap; import org.quartz.JobExecutionException;
import java.lang.reflect.*; import java.util.*; import org.quartz.*;
[ "java.lang", "java.util", "org.quartz" ]
java.lang; java.util; org.quartz;
2,085,423
private SchemaTupleFactory newSchemaTupleFactory(Triple<SchemaKey, Boolean, GenContext> trip) { SchemaTupleFactory stf = schemaTupleFactoriesByTriple.get(trip); if (stf == null) { SchemaTupleFactory.LOG.warn("No SchemaTupleFactory present for given SchemaKey/Boolean/Context combination " + trip); } return stf; }
SchemaTupleFactory function(Triple<SchemaKey, Boolean, GenContext> trip) { SchemaTupleFactory stf = schemaTupleFactoriesByTriple.get(trip); if (stf == null) { SchemaTupleFactory.LOG.warn(STR + trip); } return stf; }
/** * This method fetches the SchemaTupleFactory that can create Tuples of the given * Schema and appendability. IMPORTANT: if no such SchemaTupleFactory is available, * this returns null. * @param SchemaKey/appendability pair * @return generating SchemaTupleFactory, null otherwise */
This method fetches the SchemaTupleFactory that can create Tuples of the given this returns null
newSchemaTupleFactory
{ "repo_name": "bsmedberg/pig", "path": "src/org/apache/pig/data/SchemaTupleBackend.java", "license": "apache-2.0", "size": 12414 }
[ "org.apache.pig.data.SchemaTupleClassGenerator", "org.apache.pig.data.utils.StructuresHelper" ]
import org.apache.pig.data.SchemaTupleClassGenerator; import org.apache.pig.data.utils.StructuresHelper;
import org.apache.pig.data.*; import org.apache.pig.data.utils.*;
[ "org.apache.pig" ]
org.apache.pig;
1,425,809
public Options shapes(Shape... shapes) { this.shapes = Arrays.asList(shapes); return this; }
Options function(Shape... shapes) { this.shapes = Arrays.asList(shapes); return this; }
/** * Sets the shapes option. * * @param shapes The shape of each component in a value. Each shape must be 1 in the * first dimension. The length of this attr must be the same as the length of * component_types. * @return this Options instance. */
Sets the shapes option
shapes
{ "repo_name": "tensorflow/java", "path": "tensorflow-core/tensorflow-core-api/src/gen/java/org/tensorflow/op/core/Barrier.java", "license": "apache-2.0", "size": 9226 }
[ "java.util.Arrays", "org.tensorflow.ndarray.Shape" ]
import java.util.Arrays; import org.tensorflow.ndarray.Shape;
import java.util.*; import org.tensorflow.ndarray.*;
[ "java.util", "org.tensorflow.ndarray" ]
java.util; org.tensorflow.ndarray;
1,648,344
void writeOutlines() throws IOException { if (rootOutline.getKids().size() == 0) return; outlineTree(rootOutline); writer.addToBody(rootOutline, rootOutline.indirectReference()); }
void writeOutlines() throws IOException { if (rootOutline.getKids().size() == 0) return; outlineTree(rootOutline); writer.addToBody(rootOutline, rootOutline.indirectReference()); }
/** * Writes the outline tree to the body of the PDF document. */
Writes the outline tree to the body of the PDF document
writeOutlines
{ "repo_name": "bullda/DroidText", "path": "src/core/com/lowagie/text/pdf/PdfDocument.java", "license": "lgpl-3.0", "size": 117456 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,042,415
protected void shutDownAllHADoEntryOps() { checkForLastIteration(); registerInterestCoordinator = new MethodCoordinator(ParRegTest.class.getName(), "registerInterest"); numThreadsInClients = RemoteTestModule.getCurrentThread().getCurrentTask().getTotalThreads(); Log.getLogWriter().info("numThreadsInClients = " + numThreadsInClients); // disconnect can cause cacheClosedException if the thread is accessing the cache // but with partitioned regions, it can also cause IllegalStateExceptions if the // partitioned region needed to consult the distributed system for something, such // as size() try { testInstance.doEntryOperations(testInstance.aRegion); if (ParRegBB.getBB().getSharedCounters().read(ParRegBB.Pausing) > 0) { // we are pausing ParRegBB.getBB().getSharedCounters().increment(ParRegBB.Pausing); TestHelper.waitForCounter(ParRegBB.getBB(), "ParRegBB.Pausing", ParRegBB.Pausing, numThreadsInClients, true, -1, 5000); if (isBridgeConfiguration) { // wait for 30 seconds of client silence to allow everything to be pushed to clients SilenceListener.waitForSilence(30, 5000); } if (isBridgeClient && (bridgeOrderingWorkaround.equalsIgnoreCase("registerInterest"))) { // lynn - Workaround for bug 35662, ordering problem in bridge clients. // The workaround is to re-registerInterest doing a full GII; this causes the // clients to become aligned with the servers. registerInterestCoordinator.executeOnce(this, new Object[0]); if (!registerInterestCoordinator.methodWasExecuted()) { throw new TestException("Test problem: RegisterInterest did not execute"); } } concVerify(); // wait for everybody to finish verify ParRegBB.getBB().getSharedCounters().increment(ParRegBB.FinishedVerify); TestHelper.waitForCounter(ParRegBB.getBB(), "ParRegBB.FinishedVerify", ParRegBB.FinishedVerify, numThreadsInClients, true, -1, 5000); // wait for the HAController to finish rebalancing TestHelper.waitForCounter(ParRegBB.getBB(), "ParRegBB.rebalanceCompleted", ParRegBB.rebalanceCompleted, 1, true, -1, 5000); ParRegBB.getBB().getSharedCounters().zero(ParRegBB.Pausing); } } catch (Exception e) { handleException(e); } // free up any client connections (as they are not re-used across hydra // task invocation boundaries) if (isBridgeClient) { ClientHelper.release(testInstance.aRegion); } }
void function() { checkForLastIteration(); registerInterestCoordinator = new MethodCoordinator(ParRegTest.class.getName(), STR); numThreadsInClients = RemoteTestModule.getCurrentThread().getCurrentTask().getTotalThreads(); Log.getLogWriter().info(STR + numThreadsInClients); try { testInstance.doEntryOperations(testInstance.aRegion); if (ParRegBB.getBB().getSharedCounters().read(ParRegBB.Pausing) > 0) { ParRegBB.getBB().getSharedCounters().increment(ParRegBB.Pausing); TestHelper.waitForCounter(ParRegBB.getBB(), STR, ParRegBB.Pausing, numThreadsInClients, true, -1, 5000); if (isBridgeConfiguration) { SilenceListener.waitForSilence(30, 5000); } if (isBridgeClient && (bridgeOrderingWorkaround.equalsIgnoreCase(STR))) { registerInterestCoordinator.executeOnce(this, new Object[0]); if (!registerInterestCoordinator.methodWasExecuted()) { throw new TestException(STR); } } concVerify(); ParRegBB.getBB().getSharedCounters().increment(ParRegBB.FinishedVerify); TestHelper.waitForCounter(ParRegBB.getBB(), STR, ParRegBB.FinishedVerify, numThreadsInClients, true, -1, 5000); TestHelper.waitForCounter(ParRegBB.getBB(), STR, ParRegBB.rebalanceCompleted, 1, true, -1, 5000); ParRegBB.getBB().getSharedCounters().zero(ParRegBB.Pausing); } } catch (Exception e) { handleException(e); } if (isBridgeClient) { ClientHelper.release(testInstance.aRegion); } }
/** Do entry ops and handle vms undergoing a shutDownAllMembers. */
Do entry ops and handle vms undergoing a shutDownAllMembers
shutDownAllHADoEntryOps
{ "repo_name": "papicella/snappy-store", "path": "tests/core/src/main/java/parReg/ParRegTest.java", "license": "apache-2.0", "size": 239462 }
[ "com.gemstone.gemfire.cache.ClientHelper" ]
import com.gemstone.gemfire.cache.ClientHelper;
import com.gemstone.gemfire.cache.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
2,063,002
public static Builder builder(KeepAliveRequest request) { return POOL.acquire(Assert.notNull(request, "request")); } private long commandSequence; private long eventVersion; private long eventSequence; public KeepAliveRequest(ReferenceManager<KeepAliveRequest> referenceManager) { super(referenceManager); }
static Builder function(KeepAliveRequest request) { return POOL.acquire(Assert.notNull(request, STR)); } private long commandSequence; private long eventVersion; private long eventSequence; public KeepAliveRequest(ReferenceManager<KeepAliveRequest> referenceManager) { super(referenceManager); }
/** * Returns a keep alive request builder for an existing request. * * @param request The request to build. * @return The keep alive request builder. * @throws NullPointerException if {@code request} is null */
Returns a keep alive request builder for an existing request
builder
{ "repo_name": "moyun/copycat", "path": "protocol/src/main/java/io/atomix/copycat/client/request/KeepAliveRequest.java", "license": "apache-2.0", "size": 5901 }
[ "io.atomix.catalyst.util.Assert", "io.atomix.catalyst.util.ReferenceManager" ]
import io.atomix.catalyst.util.Assert; import io.atomix.catalyst.util.ReferenceManager;
import io.atomix.catalyst.util.*;
[ "io.atomix.catalyst" ]
io.atomix.catalyst;
2,095,483
public final void setInclusiveNamespacePrefixList(String inclusiveNamespacePrefixes) throws IOException { this.inclusiveNamespacePrefixes.clear(); if (this.exclusive && inclusiveNamespacePrefixes != null) { StringTokenizer tokenizer = new StringTokenizer( inclusiveNamespacePrefixes, " \t\r\n", false); while (tokenizer.hasMoreTokens()) { this.inclusiveNamespacePrefixes.add(tokenizer.nextToken()); } } }
final void function(String inclusiveNamespacePrefixes) throws IOException { this.inclusiveNamespacePrefixes.clear(); if (this.exclusive && inclusiveNamespacePrefixes != null) { StringTokenizer tokenizer = new StringTokenizer( inclusiveNamespacePrefixes, STR, false); while (tokenizer.hasMoreTokens()) { this.inclusiveNamespacePrefixes.add(tokenizer.nextToken()); } } }
/** * <p> * Specifies the prefixes that will be output as specified in * regular canonical XML, even when doing exclusive * XML canonicalization. * </p> * * @param inclusiveNamespacePrefixes a whitespace separated list * of namespace prefixes that will always be included in the * output, even in exclusive canonicalization */
Specifies the prefixes that will be output as specified in regular canonical XML, even when doing exclusive XML canonicalization.
setInclusiveNamespacePrefixList
{ "repo_name": "mmohan01/ReFactory", "path": "data/xom/xom-1.2.1/nu/xom/canonical/Canonicalizer.java", "license": "mit", "size": 43091 }
[ "java.io.IOException", "java.util.StringTokenizer" ]
import java.io.IOException; import java.util.StringTokenizer;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,654,377
protected void initConfig() { // need to call getConfiguration before adding our config so // that core-api config gets initialised and logged first. CompositeConfiguration config = Eurocarb.getConfiguration(); log.info("adding eurocarbdb application configuration: " + ECDB_APP_PROPERTIES_FILE ); try { config.addConfiguration( new PropertiesConfiguration( ECDB_APP_PROPERTIES_FILE ) ); } catch ( ConfigurationException ex ) { throw new RuntimeException( ex ); } if ( log.isInfoEnabled() ) { log.info( "Configured eurocarb-application properties:\n" + CR + ConfigurationUtils.toString( config ) ); } }
void function() { CompositeConfiguration config = Eurocarb.getConfiguration(); log.info(STR + ECDB_APP_PROPERTIES_FILE ); try { config.addConfiguration( new PropertiesConfiguration( ECDB_APP_PROPERTIES_FILE ) ); } catch ( ConfigurationException ex ) { throw new RuntimeException( ex ); } if ( log.isInfoEnabled() ) { log.info( STR + CR + ConfigurationUtils.toString( config ) ); } }
/** * Loads the main application properties file, given by {@link ECDB_APP_PROPERTIES_FILE}. * Note that core-api properties take precedence over application properties; * ideally there shouldn't be any property name collisions in the first place. */
Loads the main application properties file, given by <code>ECDB_APP_PROPERTIES_FILE</code>. Note that core-api properties take precedence over application properties; ideally there shouldn't be any property name collisions in the first place
initConfig
{ "repo_name": "glycoinfo/eurocarbdb", "path": "application/Eurocarbdb/src/java/org/eurocarbdb/servlet/init/EurocarbApplicationContextHandler.java", "license": "gpl-3.0", "size": 11215 }
[ "org.apache.commons.configuration.CompositeConfiguration", "org.apache.commons.configuration.ConfigurationException", "org.apache.commons.configuration.ConfigurationUtils", "org.apache.commons.configuration.PropertiesConfiguration", "org.eurocarbdb.dataaccess.Eurocarb" ]
import org.apache.commons.configuration.CompositeConfiguration; import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.ConfigurationUtils; import org.apache.commons.configuration.PropertiesConfiguration; import org.eurocarbdb.dataaccess.Eurocarb;
import org.apache.commons.configuration.*; import org.eurocarbdb.dataaccess.*;
[ "org.apache.commons", "org.eurocarbdb.dataaccess" ]
org.apache.commons; org.eurocarbdb.dataaccess;
923,677
public synchronized boolean setSyncedBit(SQLiteDatabase db, int dsid, long lastSyncKey) { insertDB(db, TABLE_NAME); ContentValues values = new ContentValues(); int bit = 1; values.put("cc_sync", bit); String[] args = new String[]{Long.toString(lastSyncKey), Integer.toString(dsid)}; db.update(TABLE_NAME, values, "cc_sync = 0 AND _id <= ? AND datasource_id = ?", args); return true; }
synchronized boolean function(SQLiteDatabase db, int dsid, long lastSyncKey) { insertDB(db, TABLE_NAME); ContentValues values = new ContentValues(); int bit = 1; values.put(STR, bit); String[] args = new String[]{Long.toString(lastSyncKey), Integer.toString(dsid)}; db.update(TABLE_NAME, values, STR, args); return true; }
/** * Sets the synced bit of the last synced key. * * @param db Database. * @param dsid Data source identifier. * @param lastSyncKey Key of the last sync. * @return Always returns true; */
Sets the synced bit of the last synced key
setSyncedBit
{ "repo_name": "MD2Korg/mCerebrum-DataKit", "path": "datakit/src/main/java/org/md2k/datakit/logger/DatabaseTable_Data.java", "license": "bsd-2-clause", "size": 29267 }
[ "android.content.ContentValues", "android.database.sqlite.SQLiteDatabase" ]
import android.content.ContentValues; import android.database.sqlite.SQLiteDatabase;
import android.content.*; import android.database.sqlite.*;
[ "android.content", "android.database" ]
android.content; android.database;
464,494
public void setData(List<String> list) { dp.setList(list); }
void function(List<String> list) { dp.setList(list); }
/** * Sets data to suggestion list * * @param list * */
Sets data to suggestion list
setData
{ "repo_name": "Agnie-Software/3a", "path": "code/common/src/main/java/com/agnie/gwt/common/client/widget/SuggestionBox.java", "license": "gpl-2.0", "size": 3478 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
969,511
public boolean launch(String businessPath, UserRequest ureq, WindowControl origControl) { BusinessControl bc = BusinessControlFactory.getInstance().createFromString(businessPath); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, origControl); return launch(ureq, bwControl); }
boolean function(String businessPath, UserRequest ureq, WindowControl origControl) { BusinessControl bc = BusinessControlFactory.getInstance().createFromString(businessPath); WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, origControl); return launch(ureq, bwControl); }
/** * Launch a controller in a tab or a site with the business path * @param businessPath * @param ureq * @param origControl */
Launch a controller in a tab or a site with the business path
launch
{ "repo_name": "stevenhva/InfoLearn_OpenOLAT", "path": "src/main/java/org/olat/NewControllerFactory.java", "license": "apache-2.0", "size": 9812 }
[ "org.olat.core.gui.UserRequest", "org.olat.core.gui.control.WindowControl", "org.olat.core.id.context.BusinessControl", "org.olat.core.id.context.BusinessControlFactory" ]
import org.olat.core.gui.UserRequest; import org.olat.core.gui.control.WindowControl; import org.olat.core.id.context.BusinessControl; import org.olat.core.id.context.BusinessControlFactory;
import org.olat.core.gui.*; import org.olat.core.gui.control.*; import org.olat.core.id.context.*;
[ "org.olat.core" ]
org.olat.core;
1,481,894
public ColumnType getExpectedColumnType() { if (_subQuerySelectItem != null) { return _subQuerySelectItem.getExpectedColumnType(); } if (_function != null) { if (_column != null) { return _function.getExpectedColumnType(_column.getType()); } else { return _function.getExpectedColumnType(null); } } if (_column != null) { return _column.getType(); } return null; }
ColumnType function() { if (_subQuerySelectItem != null) { return _subQuerySelectItem.getExpectedColumnType(); } if (_function != null) { if (_column != null) { return _function.getExpectedColumnType(_column.getType()); } else { return _function.getExpectedColumnType(null); } } if (_column != null) { return _column.getType(); } return null; }
/** * Tries to infer the {@link ColumnType} of this {@link SelectItem}. For * expression based select items, this is not possible, and the method will * return null. * * @return */
Tries to infer the <code>ColumnType</code> of this <code>SelectItem</code>. For expression based select items, this is not possible, and the method will return null
getExpectedColumnType
{ "repo_name": "ardlema/metamodel", "path": "core/src/main/java/org/apache/metamodel/query/SelectItem.java", "license": "apache-2.0", "size": 22580 }
[ "org.apache.metamodel.schema.ColumnType" ]
import org.apache.metamodel.schema.ColumnType;
import org.apache.metamodel.schema.*;
[ "org.apache.metamodel" ]
org.apache.metamodel;
1,763,869
public static Color[] createMultiGradient(Color[] colors, int numSteps) { //we assume a linear gradient, with equal spacing between colors //The final gradient will be made up of n 'sections', where n = colors.length - 1 int numSections = colors.length - 1; int gradientIndex = 0; //points to the next open spot in the final gradient Color[] gradient = new Color[numSteps]; Color[] temp; if (numSections <= 0) { throw new IllegalArgumentException("You must pass in at least 2 colors in the array!"); } for (int section = 0; section < numSections; section++) { //we divide the gradient into (n - 1) sections, and do a regular gradient for each temp = createGradient(colors[section], colors[section+1], numSteps / numSections); for (int i = 0; i < temp.length; i++) { //copy the sub-gradient into the overall gradient gradient[gradientIndex++] = temp[i]; } } if (gradientIndex < numSteps) { //The rounding didn't work out in our favor, and there is at least // one unfilled slot in the gradient[] array. //We can just copy the final color there for (; gradientIndex < numSteps; gradientIndex++) { gradient[gradientIndex] = colors[colors.length - 1]; } } return gradient; }
static Color[] function(Color[] colors, int numSteps) { int numSections = colors.length - 1; int gradientIndex = 0; Color[] gradient = new Color[numSteps]; Color[] temp; if (numSections <= 0) { throw new IllegalArgumentException(STR); } for (int section = 0; section < numSections; section++) { temp = createGradient(colors[section], colors[section+1], numSteps / numSections); for (int i = 0; i < temp.length; i++) { gradient[gradientIndex++] = temp[i]; } } if (gradientIndex < numSteps) { for (; gradientIndex < numSteps; gradientIndex++) { gradient[gradientIndex] = colors[colors.length - 1]; } } return gradient; }
/** * Creates an array of Color objects for use as a gradient, using an array of Color objects. It uses a linear interpolation between each pair of points. The parameter numSteps defines the total number of colors in the returned array, not the number of colors per segment. * @param colors An array of Color objects used for the gradient. The Color at index 0 will be the lowest color. * @param numSteps The number of steps in the gradient. 250 is a good number. */
Creates an array of Color objects for use as a gradient, using an array of Color objects. It uses a linear interpolation between each pair of points. The parameter numSteps defines the total number of colors in the returned array, not the number of colors per segment
createMultiGradient
{ "repo_name": "matthewbeckler/HeatMap", "path": "Gradient.java", "license": "gpl-2.0", "size": 7070 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,540,832
public boolean accept(java.io.File file) { if (file == null) { String msg = Logging.getMessage("nullValue.FileIsNull"); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } // First check the file path, optionally returning false if the path cannot be accepted for any reason. if (!this.acceptFilePath(file)) return false; try { return VPFDatabase.isDatabase(file.getPath()); } catch (Exception e) { // Not interested in logging or reporting the exception; just return false indicating that the file is not // a VPF database. } return false; }
boolean function(java.io.File file) { if (file == null) { String msg = Logging.getMessage(STR); Logging.logger().severe(msg); throw new IllegalArgumentException(msg); } if (!this.acceptFilePath(file)) return false; try { return VPFDatabase.isDatabase(file.getPath()); } catch (Exception e) { } return false; }
/** * Returns true if the specified file can be opened as an VPF database. * * @param file the file in question. * * @return true if the file should be accepted; false otherwise. * * @throws IllegalArgumentException if the file is null. */
Returns true if the specified file can be opened as an VPF database
accept
{ "repo_name": "aleo72/ww-ceem-radar", "path": "src/main/java/gov/nasa/worldwind/formats/vpf/VPFDatabaseFilter.java", "license": "apache-2.0", "size": 1917 }
[ "gov.nasa.worldwind.util.Logging" ]
import gov.nasa.worldwind.util.Logging;
import gov.nasa.worldwind.util.*;
[ "gov.nasa.worldwind" ]
gov.nasa.worldwind;
2,103,924
public void banAddress(AddressDTO address) throws UnknownHostException { InetAddress inetAddress = InetAddress.getByName(address.getAddress()); bannedAddresses.add(inetAddress); }
void function(AddressDTO address) throws UnknownHostException { InetAddress inetAddress = InetAddress.getByName(address.getAddress()); bannedAddresses.add(inetAddress); }
/** * Ban the given address until the next proxy restart. The address can be an * IP (v4 or v6) or a hostname. * * @param username * @return true if the address has been banned. * @throws UnknownHostException */
Ban the given address until the next proxy restart. The address can be an IP (v4 or v6) or a hostname
banAddress
{ "repo_name": "Stratehm/stratum-proxy", "path": "src/main/java/strat/mining/stratum/proxy/manager/AuthorizationManager.java", "license": "gpl-3.0", "size": 4395 }
[ "java.net.InetAddress", "java.net.UnknownHostException" ]
import java.net.InetAddress; import java.net.UnknownHostException;
import java.net.*;
[ "java.net" ]
java.net;
1,218,705
protected void sequence_Model(ISerializationContext context, Model semanticObject) { genericSequencer.createSequence(context, semanticObject); }
void function(ISerializationContext context, Model semanticObject) { genericSequencer.createSequence(context, semanticObject); }
/** * Contexts: * Model returns Model * * Constraint: * (strings+=STRING* (keys+=STRING values+=STRING)* subModel=SubModel?) */
Contexts: Model returns Model Constraint: (strings+=STRING* (keys+=STRING values+=STRING)* subModel=SubModel?)
sequence_Model
{ "repo_name": "miklossy/xtext-core", "path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/parsetree/reconstr/serializer/Bug299395TestLanguageSemanticSequencer.java", "license": "epl-1.0", "size": 2282 }
[ "org.eclipse.xtext.parsetree.reconstr.bug299395.Model", "org.eclipse.xtext.serializer.ISerializationContext" ]
import org.eclipse.xtext.parsetree.reconstr.bug299395.Model; import org.eclipse.xtext.serializer.ISerializationContext;
import org.eclipse.xtext.parsetree.reconstr.bug299395.*; import org.eclipse.xtext.serializer.*;
[ "org.eclipse.xtext" ]
org.eclipse.xtext;
2,043,003
private void testBatchApply(boolean writeCoalescing) throws Exception { delegate = new GridCacheTestStore(new ConcurrentLinkedHashMap<Integer, String>() { @Override public void clear() { }
void function(boolean writeCoalescing) throws Exception { delegate = new GridCacheTestStore(new ConcurrentLinkedHashMap<Integer, String>() { @Override public void clear() { }
/** * Tests that all values will be written to the underlying store * right in the same order as they were put into the store. * * @param writeCoalescing Write coalescing flag. * @throws Exception If failed. */
Tests that all values will be written to the underlying store right in the same order as they were put into the store
testBatchApply
{ "repo_name": "alexzaitzev/ignite", "path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/store/GridCacheWriteBehindStoreSelfTest.java", "license": "apache-2.0", "size": 14557 }
[ "org.apache.ignite.internal.processors.cache.GridCacheTestStore", "org.jsr166.ConcurrentLinkedHashMap" ]
import org.apache.ignite.internal.processors.cache.GridCacheTestStore; import org.jsr166.ConcurrentLinkedHashMap;
import org.apache.ignite.internal.processors.cache.*; import org.jsr166.*;
[ "org.apache.ignite", "org.jsr166" ]
org.apache.ignite; org.jsr166;
2,211,312
protected GrantedAuthority createAuthority(Object role) { if (role instanceof String) { if (this.convertToUpperCase) { role = ((String) role).toUpperCase(); } return new SimpleGrantedAuthority(this.rolePrefix + role); } return null; }
GrantedAuthority function(Object role) { if (role instanceof String) { if (this.convertToUpperCase) { role = ((String) role).toUpperCase(); } return new SimpleGrantedAuthority(this.rolePrefix + role); } return null; }
/** * Creates a GrantedAuthority from a role attribute. Override to customize authority * object creation. * <p> * The default implementation converts string attributes to roles, making use of the * <tt>rolePrefix</tt> and <tt>convertToUpperCase</tt> properties. Non-String * attributes are ignored. * </p> * * @param role the attribute returned from * @return the authority to be added to the list of authorities for the user, or null * if this attribute should be ignored. */
Creates a GrantedAuthority from a role attribute. Override to customize authority object creation. The default implementation converts string attributes to roles, making use of the rolePrefix and convertToUpperCase properties. Non-String attributes are ignored.
createAuthority
{ "repo_name": "thomasdarimont/spring-security", "path": "ldap/src/main/java/org/springframework/security/ldap/userdetails/LdapUserDetailsMapper.java", "license": "apache-2.0", "size": 6486 }
[ "org.springframework.security.core.GrantedAuthority", "org.springframework.security.core.authority.SimpleGrantedAuthority" ]
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.*; import org.springframework.security.core.authority.*;
[ "org.springframework.security" ]
org.springframework.security;
1,343,245
public Object unmarshal(InputSource inputSource, Class clazz) throws XMLMarshalException { if ((null == inputSource) || (null == clazz)) { throw XMLMarshalException.nullArgumentException(); } return platformUnmarshaller.unmarshal(inputSource, clazz); }
Object function(InputSource inputSource, Class clazz) throws XMLMarshalException { if ((null == inputSource) (null == clazz)) { throw XMLMarshalException.nullArgumentException(); } return platformUnmarshaller.unmarshal(inputSource, clazz); }
/** * PUBLIC: * Read and parse the XML document from the inputSource and map the XML data into an object. * The inputSource must contain a valid XML document, and be mapped by a project used to * create the XMLContext. * @param inputSource The inputSource to unmarshal from * @param clazz The type of object to return. * @return the object which resulted from unmarshalling the given inputSource * @throws XMLMarshalException if an error occurred during unmarshalling */
Read and parse the XML document from the inputSource and map the XML data into an object. The inputSource must contain a valid XML document, and be mapped by a project used to create the XMLContext
unmarshal
{ "repo_name": "RallySoftware/eclipselink.runtime", "path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/oxm/XMLUnmarshaller.java", "license": "epl-1.0", "size": 37054 }
[ "org.eclipse.persistence.exceptions.XMLMarshalException", "org.xml.sax.InputSource" ]
import org.eclipse.persistence.exceptions.XMLMarshalException; import org.xml.sax.InputSource;
import org.eclipse.persistence.exceptions.*; import org.xml.sax.*;
[ "org.eclipse.persistence", "org.xml.sax" ]
org.eclipse.persistence; org.xml.sax;
2,322,355
@Nullable public File getProjectCacheDir() { return projectCacheDir; } public StartParameter() { GradleInstallation gradleInstallation = CurrentGradleInstallation.get(); if (gradleInstallation == null) { gradleHomeDir = null; } else { gradleHomeDir = gradleInstallation.getGradleHome(); } BuildLayoutParameters layoutParameters = new BuildLayoutParameters(); searchUpwards = layoutParameters.getSearchUpwards(); currentDir = layoutParameters.getCurrentDir(); projectDir = layoutParameters.getProjectDir(); gradleUserHomeDir = layoutParameters.getGradleUserHomeDir(); }
File function() { return projectCacheDir; } public StartParameter() { GradleInstallation gradleInstallation = CurrentGradleInstallation.get(); if (gradleInstallation == null) { gradleHomeDir = null; } else { gradleHomeDir = gradleInstallation.getGradleHome(); } BuildLayoutParameters layoutParameters = new BuildLayoutParameters(); searchUpwards = layoutParameters.getSearchUpwards(); currentDir = layoutParameters.getCurrentDir(); projectDir = layoutParameters.getProjectDir(); gradleUserHomeDir = layoutParameters.getGradleUserHomeDir(); }
/** * Returns the project's cache dir. * * @return project's cache dir, or null if the default location is to be used. */
Returns the project's cache dir
getProjectCacheDir
{ "repo_name": "lsmaira/gradle", "path": "subprojects/core-api/src/main/java/org/gradle/StartParameter.java", "license": "apache-2.0", "size": 29910 }
[ "java.io.File", "org.gradle.initialization.BuildLayoutParameters", "org.gradle.internal.installation.CurrentGradleInstallation", "org.gradle.internal.installation.GradleInstallation" ]
import java.io.File; import org.gradle.initialization.BuildLayoutParameters; import org.gradle.internal.installation.CurrentGradleInstallation; import org.gradle.internal.installation.GradleInstallation;
import java.io.*; import org.gradle.initialization.*; import org.gradle.internal.installation.*;
[ "java.io", "org.gradle.initialization", "org.gradle.internal" ]
java.io; org.gradle.initialization; org.gradle.internal;
2,233,808
private static String getRequestPath(final HttpServletRequest req) { final StringBuffer reqPath = req.getRequestURL(); return reqPath.toString(); // NOPMD }
static String function(final HttpServletRequest req) { final StringBuffer reqPath = req.getRequestURL(); return reqPath.toString(); }
/** * Gets the request path. * * @param req the req * @return the request path */
Gets the request path
getRequestPath
{ "repo_name": "willmorejg/net.ljcomputing.ecsr-neo4j", "path": "src/main/java/net/ljcomputing/ecsr/controller/GlobalExceptionController.java", "license": "apache-2.0", "size": 6659 }
[ "javax.servlet.http.HttpServletRequest" ]
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.*;
[ "javax.servlet" ]
javax.servlet;
2,236,602
public SimpleFragmentIntent<F> putExtra(String name, Serializable value) { if (extras == null) { extras = new Bundle(); } extras.putSerializable(name, value); return this; }
SimpleFragmentIntent<F> function(String name, Serializable value) { if (extras == null) { extras = new Bundle(); } extras.putSerializable(name, value); return this; }
/** * Add extended data to the intent. * * @param name The name of the extra data, with package prefix. * @param value The Serializable data value. * @return Returns the same SimpleFragmentIntent<F> object, for chaining multiple calls into a * single statement. * @see #putExtras * @see #removeExtra * @see #getSerializableExtra(String) */
Add extended data to the intent
putExtra
{ "repo_name": "evant/simplefragment", "path": "simplefragment/src/main/java/me/tatarka/simplefragment/SimpleFragmentIntent.java", "license": "apache-2.0", "size": 36200 }
[ "android.os.Bundle", "java.io.Serializable" ]
import android.os.Bundle; import java.io.Serializable;
import android.os.*; import java.io.*;
[ "android.os", "java.io" ]
android.os; java.io;
2,357,481
public static boolean addDefaultLifecyclesIfNotAvailable(Registry registry, Registry rootRegistry) throws RegistryException, FileNotFoundException, XMLStreamException { if (!registry.resourceExists(RegistryConstants.LIFECYCLE_CONFIGURATION_PATH)) { Collection lifeCycleConfigurationCollection = new CollectionImpl(); registry.put(RegistryConstants.LIFECYCLE_CONFIGURATION_PATH, lifeCycleConfigurationCollection); String defaultLifecycleConfigLocation = getDefaltLifecycleConfigLocation(); File defaultLifecycleConfigDirectory = new File(defaultLifecycleConfigLocation); if (!defaultLifecycleConfigDirectory.exists()) { return false; }
static boolean function(Registry registry, Registry rootRegistry) throws RegistryException, FileNotFoundException, XMLStreamException { if (!registry.resourceExists(RegistryConstants.LIFECYCLE_CONFIGURATION_PATH)) { Collection lifeCycleConfigurationCollection = new CollectionImpl(); registry.put(RegistryConstants.LIFECYCLE_CONFIGURATION_PATH, lifeCycleConfigurationCollection); String defaultLifecycleConfigLocation = getDefaltLifecycleConfigLocation(); File defaultLifecycleConfigDirectory = new File(defaultLifecycleConfigLocation); if (!defaultLifecycleConfigDirectory.exists()) { return false; }
/** * This method reads all the lifecycle configuration files from a folder and add the already added configurations * as aspects. * * @param registry tenant registry * @param rootRegistry root registry * @return * @throws RegistryException * @throws FileNotFoundException * @throws XMLStreamException */
This method reads all the lifecycle configuration files from a folder and add the already added configurations as aspects
addDefaultLifecyclesIfNotAvailable
{ "repo_name": "pulasthi/carbon-governance", "path": "components/governance/org.wso2.carbon.governance.lcm/src/main/java/org/wso2/carbon/governance/lcm/util/CommonUtil.java", "license": "apache-2.0", "size": 35290 }
[ "java.io.File", "java.io.FileNotFoundException", "javax.xml.stream.XMLStreamException", "org.wso2.carbon.registry.core.Collection", "org.wso2.carbon.registry.core.CollectionImpl", "org.wso2.carbon.registry.core.Registry", "org.wso2.carbon.registry.core.RegistryConstants", "org.wso2.carbon.registry.core.exceptions.RegistryException" ]
import java.io.File; import java.io.FileNotFoundException; import javax.xml.stream.XMLStreamException; import org.wso2.carbon.registry.core.Collection; import org.wso2.carbon.registry.core.CollectionImpl; import org.wso2.carbon.registry.core.Registry; import org.wso2.carbon.registry.core.RegistryConstants; import org.wso2.carbon.registry.core.exceptions.RegistryException;
import java.io.*; import javax.xml.stream.*; import org.wso2.carbon.registry.core.*; import org.wso2.carbon.registry.core.exceptions.*;
[ "java.io", "javax.xml", "org.wso2.carbon" ]
java.io; javax.xml; org.wso2.carbon;
218,982
public Location getHome() { final BlockLoc home = this.getPosition(); if ((home == null) || ((home.x == 0) && (home.z == 0))) { return this.getDefaultHome(); } else { final Location bot = this.getBottomAbs(); final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch); if (WorldUtil.IMP.getBlock(loc).id != 0) { loc.setY(Math.max(WorldUtil.IMP.getHighestBlock(this.area.worldname, loc.getX(), loc.getZ()), bot.getY())); } return loc; } }
Location function() { final BlockLoc home = this.getPosition(); if ((home == null) ((home.x == 0) && (home.z == 0))) { return this.getDefaultHome(); } else { final Location bot = this.getBottomAbs(); final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch); if (WorldUtil.IMP.getBlock(loc).id != 0) { loc.setY(Math.max(WorldUtil.IMP.getHighestBlock(this.area.worldname, loc.getX(), loc.getZ()), bot.getY())); } return loc; } }
/** * Return the home location for the plot * @return Home location */
Return the home location for the plot
getHome
{ "repo_name": "SilverCory/PlotSquared", "path": "Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java", "license": "gpl-3.0", "size": 98015 }
[ "com.intellectualcrafters.plot.util.WorldUtil" ]
import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.util.*;
[ "com.intellectualcrafters.plot" ]
com.intellectualcrafters.plot;
1,262,016
protected static StringEntity jsonEntity(ExtendedJSONObject body) { return stringEntityWithContentTypeApplicationJSON(body.toJSONString()); }
static StringEntity function(ExtendedJSONObject body) { return stringEntityWithContentTypeApplicationJSON(body.toJSONString()); }
/** * Helper for turning an extended JSON object into a payload. * @throws UnsupportedEncodingException */
Helper for turning an extended JSON object into a payload
jsonEntity
{ "repo_name": "Yukarumya/Yukarum-Redfoxes", "path": "mobile/android/services/src/main/java/org/mozilla/gecko/sync/net/BaseResource.java", "license": "mpl-2.0", "size": 19810 }
[ "ch.boye.httpclientandroidlib.entity.StringEntity", "org.mozilla.gecko.sync.ExtendedJSONObject" ]
import ch.boye.httpclientandroidlib.entity.StringEntity; import org.mozilla.gecko.sync.ExtendedJSONObject;
import ch.boye.httpclientandroidlib.entity.*; import org.mozilla.gecko.sync.*;
[ "ch.boye.httpclientandroidlib", "org.mozilla.gecko" ]
ch.boye.httpclientandroidlib; org.mozilla.gecko;
318,397
private void loadAllInstances(ZooClassProxy def, boolean subClasses, MergingIterator<ZooPC> iter, boolean loadFromCache) { for (Node n: nodes) { iter.add(n.loadAllInstances(def, loadFromCache)); } if (subClasses) { for (ZooClassProxy sub: def.getSubProxies()) { loadAllInstances(sub, true, iter, loadFromCache); } } }
void function(ZooClassProxy def, boolean subClasses, MergingIterator<ZooPC> iter, boolean loadFromCache) { for (Node n: nodes) { iter.add(n.loadAllInstances(def, loadFromCache)); } if (subClasses) { for (ZooClassProxy sub: def.getSubProxies()) { loadAllInstances(sub, true, iter, loadFromCache); } } }
/** * This method avoids nesting MergingIterators. * @param def * @param subClasses * @param iter */
This method avoids nesting MergingIterators
loadAllInstances
{ "repo_name": "NickCharsley/zoodb", "path": "src/org/zoodb/internal/Session.java", "license": "gpl-3.0", "size": 24234 }
[ "org.zoodb.api.impl.ZooPC", "org.zoodb.internal.util.MergingIterator" ]
import org.zoodb.api.impl.ZooPC; import org.zoodb.internal.util.MergingIterator;
import org.zoodb.api.impl.*; import org.zoodb.internal.util.*;
[ "org.zoodb.api", "org.zoodb.internal" ]
org.zoodb.api; org.zoodb.internal;
374,939
@Test public void binaryWithCustomCxxLdTool() throws IOException, InterruptedException { ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, "binary_with_custom_ld_tool", tmp); workspace.setUp(); workspace.runBuckBuild("//:bin").assertSuccess(); }
void function() throws IOException, InterruptedException { ProjectWorkspace workspace = TestDataHelper.createProjectWorkspaceForScenario(this, STR, tmp); workspace.setUp(); workspace.runBuckBuild(" }
/** * Test that Go binaries work with custom C++ linker wrapper tools which includes extra arguments * (which would otherwise require bash quoting). */
Test that Go binaries work with custom C++ linker wrapper tools which includes extra arguments (which would otherwise require bash quoting)
binaryWithCustomCxxLdTool
{ "repo_name": "zpao/buck", "path": "test/com/facebook/buck/features/go/GoBinaryIntegrationTest.java", "license": "apache-2.0", "size": 18366 }
[ "com.facebook.buck.testutil.integration.ProjectWorkspace", "com.facebook.buck.testutil.integration.TestDataHelper", "java.io.IOException" ]
import com.facebook.buck.testutil.integration.ProjectWorkspace; import com.facebook.buck.testutil.integration.TestDataHelper; import java.io.IOException;
import com.facebook.buck.testutil.integration.*; import java.io.*;
[ "com.facebook.buck", "java.io" ]
com.facebook.buck; java.io;
2,468,804
private static boolean validateSizes(final GModel model) { if (model.getContentWidth() < 0 || model.getContentHeight() < 0) { LOGGER.error("Model contains negative width / height values."); return false; } for (final GNode node : model.getNodes()) { if (node.getWidth() < 0 || node.getHeight() < 0) { LOGGER.error("Model contains negative width / height values."); return false; } } return true; }
static boolean function(final GModel model) { if (model.getContentWidth() < 0 model.getContentHeight() < 0) { LOGGER.error(STR); return false; } for (final GNode node : model.getNodes()) { if (node.getWidth() < 0 node.getHeight() < 0) { LOGGER.error(STR); return false; } } return true; }
/** * Performs a basic sanity check that width and height parameters are * non-negative. * * @param model * the {@link GModel} to be validated * @return {@code true} if the model width and height parameters are valid */
Performs a basic sanity check that width and height parameters are non-negative
validateSizes
{ "repo_name": "eckig/graph-editor", "path": "core/src/main/java/de/tesis/dynaware/grapheditor/core/model/ModelSanityChecker.java", "license": "epl-1.0", "size": 3202 }
[ "de.tesis.dynaware.grapheditor.model.GModel", "de.tesis.dynaware.grapheditor.model.GNode" ]
import de.tesis.dynaware.grapheditor.model.GModel; import de.tesis.dynaware.grapheditor.model.GNode;
import de.tesis.dynaware.grapheditor.model.*;
[ "de.tesis.dynaware" ]
de.tesis.dynaware;
2,889,157
if (this.transactionConnection != null) return this.transactionConnection; else if (!connectionPool.isEmpty()) { Connection conn = connectionPool.removeFirst(); Date connUsed = connectionLastUsed.removeFirst(); if (!conn.isClosed()) { // 19 minutes threshold if (new Date().getTime() - connUsed.getTime() <= connectionThreshold) { return conn; } // just close it and do nothing try { conn.close(); } catch (Exception e) { // do nothing } } return popConnection(); } return createConnection(); }
if (this.transactionConnection != null) return this.transactionConnection; else if (!connectionPool.isEmpty()) { Connection conn = connectionPool.removeFirst(); Date connUsed = connectionLastUsed.removeFirst(); if (!conn.isClosed()) { if (new Date().getTime() - connUsed.getTime() <= connectionThreshold) { return conn; } try { conn.close(); } catch (Exception e) { } } return popConnection(); } return createConnection(); }
/** * Pops a connection from the pool and checks if it is open and the last used * time is below 19 minutes. If those things are false, it attempts to close the * connection. Otherwise it returns the connection or simply instantiates a new * one; * * @return * @throws SQLException */
Pops a connection from the pool and checks if it is open and the last used time is below 19 minutes. If those things are false, it attempts to close the connection. Otherwise it returns the connection or simply instantiates a new one
popConnection
{ "repo_name": "EixoX/jetfuel", "path": "jetfuel-core/src/main/java/com/eixox/data/sql/Database.java", "license": "apache-2.0", "size": 7196 }
[ "java.sql.Connection", "java.util.Date" ]
import java.sql.Connection; import java.util.Date;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
1,523,047
@Override public HDFSStore create(String name) throws GemFireConfigException, StoreExistsException { throw new UnsupportedOperationException(); }
HDFSStore function(String name) throws GemFireConfigException, StoreExistsException { throw new UnsupportedOperationException(); }
/** * This method should not be called on this class. * @see HDFSStoreFactory#create(String) */
This method should not be called on this class
create
{ "repo_name": "robertgeiger/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/cache/hdfs/internal/HDFSStoreConfigHolder.java", "license": "apache-2.0", "size": 18593 }
[ "com.gemstone.gemfire.GemFireConfigException", "com.gemstone.gemfire.cache.hdfs.HDFSStore", "com.gemstone.gemfire.cache.hdfs.StoreExistsException" ]
import com.gemstone.gemfire.GemFireConfigException; import com.gemstone.gemfire.cache.hdfs.HDFSStore; import com.gemstone.gemfire.cache.hdfs.StoreExistsException;
import com.gemstone.gemfire.*; import com.gemstone.gemfire.cache.hdfs.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
1,003,475
@Override public JobStateInternal transition(JobImpl job, JobEvent event) { job.metrics.submittedJob(job); job.metrics.preparingJob(job); if (job.newApiCommitter) { job.jobContext = new JobContextImpl(job.conf, job.oldJobId); } else { job.jobContext = new org.apache.hadoop.mapred.JobContextImpl( job.conf, job.oldJobId); } try { setup(job); job.fs = job.getFileSystem(job.conf); //log to job history JobSubmittedEvent jse = new JobSubmittedEvent(job.oldJobId, job.conf.get(MRJobConfig.JOB_NAME, "test"), job.conf.get(MRJobConfig.USER_NAME, "mapred"), job.appSubmitTime, job.remoteJobConfFile.toString(), job.jobACLs, job.queueName, job.conf.get(MRJobConfig.WORKFLOW_ID, ""), job.conf.get(MRJobConfig.WORKFLOW_NAME, ""), job.conf.get(MRJobConfig.WORKFLOW_NODE_NAME, ""), getWorkflowAdjacencies(job.conf), job.conf.get(MRJobConfig.WORKFLOW_TAGS, "")); job.eventHandler.handle(new JobHistoryEvent(job.jobId, jse)); //TODO JH Verify jobACLs, UserName via UGI? TaskSplitMetaInfo[] taskSplitMetaInfo = createSplits(job, job.jobId); job.numMapTasks = taskSplitMetaInfo.length; job.numReduceTasks = job.conf.getInt(MRJobConfig.NUM_REDUCES, 0); if (job.numMapTasks == 0 && job.numReduceTasks == 0) { job.addDiagnostic("No of maps and reduces are 0 " + job.jobId); } else if (job.numMapTasks == 0) { job.reduceWeight = 0.9f; } else if (job.numReduceTasks == 0) { job.mapWeight = 0.9f; } else { job.mapWeight = job.reduceWeight = 0.45f; } checkTaskLimits(); long inputLength = 0; for (int i = 0; i < job.numMapTasks; ++i) { inputLength += taskSplitMetaInfo[i].getInputDataLength(); } job.makeUberDecision(inputLength); job.taskAttemptCompletionEvents = new ArrayList<TaskAttemptCompletionEvent>( job.numMapTasks + job.numReduceTasks + 10); job.mapAttemptCompletionEvents = new ArrayList<TaskCompletionEvent>(job.numMapTasks + 10); job.taskCompletionIdxToMapCompletionIdx = new ArrayList<Integer>( job.numMapTasks + job.numReduceTasks + 10); job.allowedMapFailuresPercent = job.conf.getInt(MRJobConfig.MAP_FAILURES_MAX_PERCENT, 0); job.allowedReduceFailuresPercent = job.conf.getInt(MRJobConfig.REDUCE_FAILURES_MAXPERCENT, 0); // create the Tasks but don't start them yet createMapTasks(job, inputLength, taskSplitMetaInfo); createReduceTasks(job); job.metrics.endPreparingJob(job); return JobStateInternal.INITED; } catch (Exception e) { LOG.warn("Job init failed", e); job.metrics.endPreparingJob(job); job.addDiagnostic("Job init failed : " + StringUtils.stringifyException(e)); // Leave job in the NEW state. The MR AM will detect that the state is // not INITED and send a JOB_INIT_FAILED event. return JobStateInternal.NEW; } }
JobStateInternal function(JobImpl job, JobEvent event) { job.metrics.submittedJob(job); job.metrics.preparingJob(job); if (job.newApiCommitter) { job.jobContext = new JobContextImpl(job.conf, job.oldJobId); } else { job.jobContext = new org.apache.hadoop.mapred.JobContextImpl( job.conf, job.oldJobId); } try { setup(job); job.fs = job.getFileSystem(job.conf); JobSubmittedEvent jse = new JobSubmittedEvent(job.oldJobId, job.conf.get(MRJobConfig.JOB_NAME, "test"), job.conf.get(MRJobConfig.USER_NAME, STR), job.appSubmitTime, job.remoteJobConfFile.toString(), job.jobACLs, job.queueName, job.conf.get(MRJobConfig.WORKFLOW_ID, STRSTRSTRSTRNo of maps and reduces are 0 STRJob init failedSTRJob init failed : " + StringUtils.stringifyException(e)); return JobStateInternal.NEW; } }
/** * Note that this transition method is called directly (and synchronously) * by MRAppMaster's init() method (i.e., no RPC, no thread-switching; * just plain sequential call within AM context), so we can trigger * modifications in AM state from here (at least, if AM is written that * way; MR version is). */
Note that this transition method is called directly (and synchronously) by MRAppMaster's init() method (i.e., no RPC, no thread-switching; just plain sequential call within AM context), so we can trigger modifications in AM state from here (at least, if AM is written that way; MR version is)
transition
{ "repo_name": "cnfire/hadoop", "path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/JobImpl.java", "license": "apache-2.0", "size": 87134 }
[ "org.apache.hadoop.mapreduce.MRJobConfig", "org.apache.hadoop.mapreduce.jobhistory.JobSubmittedEvent", "org.apache.hadoop.mapreduce.task.JobContextImpl", "org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal", "org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent", "org.apache.hadoop.util.StringUtils" ]
import org.apache.hadoop.mapreduce.MRJobConfig; import org.apache.hadoop.mapreduce.jobhistory.JobSubmittedEvent; import org.apache.hadoop.mapreduce.task.JobContextImpl; import org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal; import org.apache.hadoop.mapreduce.v2.app.job.event.JobEvent; import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.jobhistory.*; import org.apache.hadoop.mapreduce.task.*; import org.apache.hadoop.mapreduce.v2.app.job.*; import org.apache.hadoop.mapreduce.v2.app.job.event.*; import org.apache.hadoop.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
677,395
@SuppressWarnings("unchecked") public Type to(Iterable<Endpoint> endpoints) { for (Endpoint endpoint : endpoints) { addOutput(new ToDefinition(endpoint)); } return (Type) this; }
@SuppressWarnings(STR) Type function(Iterable<Endpoint> endpoints) { for (Endpoint endpoint : endpoints) { addOutput(new ToDefinition(endpoint)); } return (Type) this; }
/** * Sends the exchange to a list of endpoints * * @param endpoints list of endpoints to send to * @return the builder */
Sends the exchange to a list of endpoints
to
{ "repo_name": "grange74/camel", "path": "camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java", "license": "apache-2.0", "size": 152533 }
[ "org.apache.camel.Endpoint" ]
import org.apache.camel.Endpoint;
import org.apache.camel.*;
[ "org.apache.camel" ]
org.apache.camel;
1,797,688
@Test public void test1XSLBMTBusinessMethod() throws Exception { String testStr = "Test string."; String buf = fejb1.method1(testStr); assertEquals("Method call (method1) test returned unexpected value.", buf, testStr); }
void function() throws Exception { String testStr = STR; String buf = fejb1.method1(testStr); assertEquals(STR, buf, testStr); }
/** * (iia22) Test Stateless BMT business method. */
(iia22) Test Stateless BMT business method
test1XSLBMTBusinessMethod
{ "repo_name": "kgibm/open-liberty", "path": "dev/com.ibm.ws.ejbcontainer.legacy_fat/test-applications/EJB1XRemoteSpecWeb.war/src/com/ibm/ejb1x/base/spec/slr/web/SLRemoteImplLifecycleMethodServlet.java", "license": "epl-1.0", "size": 10698 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,277,840
public ModelAndView handleHelpVGSBibPage05(HttpServletRequest request, HttpServletResponse response) throws ServletException { String viewName = "videregaaendeSkoleBibHelpScreenPage05View"; return new ModelAndView(viewName); }
ModelAndView function(HttpServletRequest request, HttpServletResponse response) throws ServletException { String viewName = STR; return new ModelAndView(viewName); }
/** * Custom handler handleHelpVGSBibPage05. * * @param request current HTTP request * @param response current HTTP response * @return a ModelAndView to render the response */
Custom handler handleHelpVGSBibPage05
handleHelpVGSBibPage05
{ "repo_name": "NationalLibraryOfNorway/Bibliotekstatistikk", "path": "abmstatistikk-main/src/main/java/no/abmu/abmstatistikk/web/ABMStatistikkHelpController.java", "license": "gpl-2.0", "size": 61831 }
[ "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.springframework.web.servlet.ModelAndView" ]
import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.*; import javax.servlet.http.*; import org.springframework.web.servlet.*;
[ "javax.servlet", "org.springframework.web" ]
javax.servlet; org.springframework.web;
2,866,997
MatcherAssert.assertThat( new PsByFlag( new PsByFlag.Pair( "test", new PsFake(true) ) ).enter( new RqFake("GET", "/?PsByFlag=x") ).has(), Matchers.is(false) ); }
MatcherAssert.assertThat( new PsByFlag( new PsByFlag.Pair( "test", new PsFake(true) ) ).enter( new RqFake("GET", STR) ).has(), Matchers.is(false) ); }
/** * PsByFlag can skip if nothing found. * @throws IOException If some problem inside */
PsByFlag can skip if nothing found
skipsIfNothingFound
{ "repo_name": "antonini/takes", "path": "src/test/java/org/takes/facets/auth/PsByFlagTest.java", "license": "mit", "size": 3844 }
[ "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers", "org.takes.rq.RqFake" ]
import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.takes.rq.RqFake;
import org.hamcrest.*; import org.takes.rq.*;
[ "org.hamcrest", "org.takes.rq" ]
org.hamcrest; org.takes.rq;
1,132,021
private synchronized int getCurrentCacheSize() { int size = 0; Iterator<BitmapCacheValue> it = this.bitmaps.values().iterator(); while(it.hasNext()) { BitmapCacheValue bcv = it.next(); Bitmap bitmap = bcv.bitmap; size += getBitmapSizeInCache(bitmap); } Log.v(TAG, "Cache size: "+size); return size; }
synchronized int function() { int size = 0; Iterator<BitmapCacheValue> it = this.bitmaps.values().iterator(); while(it.hasNext()) { BitmapCacheValue bcv = it.next(); Bitmap bitmap = bcv.bitmap; size += getBitmapSizeInCache(bitmap); } Log.v(TAG, STR+size); return size; }
/** * Get estimated sum of byte sizes of bitmaps stored in cache currently. */
Get estimated sum of byte sizes of bitmaps stored in cache currently
getCurrentCacheSize
{ "repo_name": "jiayaoqijia/apv", "path": "pdfview/src/cx/hell/android/pdfview/PDFPagesProvider.java", "license": "gpl-3.0", "size": 16194 }
[ "android.graphics.Bitmap", "android.util.Log", "java.util.Iterator" ]
import android.graphics.Bitmap; import android.util.Log; import java.util.Iterator;
import android.graphics.*; import android.util.*; import java.util.*;
[ "android.graphics", "android.util", "java.util" ]
android.graphics; android.util; java.util;
1,921,163
private void saveImage(INodeDirectory current, DataOutputStream out, boolean toSaveSubtree, boolean inSnapshot, Counter counter) throws IOException { // write the inode id of the directory out.writeLong(current.getId()); if (!toSaveSubtree) { return; } final ReadOnlyList<INode> children = current .getChildrenList(Snapshot.CURRENT_STATE_ID); int dirNum = 0; List<INodeDirectory> snapshotDirs = null; DirectoryWithSnapshotFeature sf = current.getDirectoryWithSnapshotFeature(); if (sf != null) { snapshotDirs = new ArrayList<INodeDirectory>(); sf.getSnapshotDirectory(snapshotDirs); dirNum += snapshotDirs.size(); } // 2. Write INodeDirectorySnapshottable#snapshotsByNames to record all // Snapshots if (current.isDirectory() && current.asDirectory().isSnapshottable()) { SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); // # of snapshots } // 3. Write children INode dirNum += saveChildren(children, out, inSnapshot, counter); // 4. Write DirectoryDiff lists, if there is any. SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap); // Write sub-tree of sub-directories, including possible snapshots of // deleted sub-directories out.writeInt(dirNum); // the number of sub-directories for(INode child : children) { if(!child.isDirectory()) { continue; } // make sure we only save the subtree under a reference node once boolean toSave = child.isReference() ? referenceMap.toProcessSubtree(child.getId()) : true; saveImage(child.asDirectory(), out, toSave, inSnapshot, counter); } if (snapshotDirs != null) { for (INodeDirectory subDir : snapshotDirs) { // make sure we only save the subtree under a reference node once boolean toSave = subDir.getParentReference() != null ? referenceMap.toProcessSubtree(subDir.getId()) : true; saveImage(subDir, out, toSave, true, counter); } } }
void function(INodeDirectory current, DataOutputStream out, boolean toSaveSubtree, boolean inSnapshot, Counter counter) throws IOException { out.writeLong(current.getId()); if (!toSaveSubtree) { return; } final ReadOnlyList<INode> children = current .getChildrenList(Snapshot.CURRENT_STATE_ID); int dirNum = 0; List<INodeDirectory> snapshotDirs = null; DirectoryWithSnapshotFeature sf = current.getDirectoryWithSnapshotFeature(); if (sf != null) { snapshotDirs = new ArrayList<INodeDirectory>(); sf.getSnapshotDirectory(snapshotDirs); dirNum += snapshotDirs.size(); } if (current.isDirectory() && current.asDirectory().isSnapshottable()) { SnapshotFSImageFormat.saveSnapshots(current.asDirectory(), out); } else { out.writeInt(-1); } dirNum += saveChildren(children, out, inSnapshot, counter); SnapshotFSImageFormat.saveDirectoryDiffList(current, out, referenceMap); out.writeInt(dirNum); for(INode child : children) { if(!child.isDirectory()) { continue; } boolean toSave = child.isReference() ? referenceMap.toProcessSubtree(child.getId()) : true; saveImage(child.asDirectory(), out, toSave, inSnapshot, counter); } if (snapshotDirs != null) { for (INodeDirectory subDir : snapshotDirs) { boolean toSave = subDir.getParentReference() != null ? referenceMap.toProcessSubtree(subDir.getId()) : true; saveImage(subDir, out, toSave, true, counter); } } }
/** * Save file tree image starting from the given root. * This is a recursive procedure, which first saves all children and * snapshot diffs of a current directory and then moves inside the * sub-directories. * * @param current The current node * @param out The DataoutputStream to write the image * @param toSaveSubtree Whether or not to save the subtree to fsimage. For * reference node, its subtree may already have been * saved before. * @param inSnapshot Whether the current directory is in snapshot * @param counter Counter to increment for namenode startup progress */
Save file tree image starting from the given root. This is a recursive procedure, which first saves all children and snapshot diffs of a current directory and then moves inside the sub-directories
saveImage
{ "repo_name": "jonathangizmo/HadoopDistJ", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImageFormat.java", "license": "mit", "size": 53694 }
[ "java.io.DataOutputStream", "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature", "org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot", "org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotFSImageFormat", "org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress", "org.apache.hadoop.hdfs.util.ReadOnlyList" ]
import java.io.DataOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hdfs.server.namenode.snapshot.DirectoryWithSnapshotFeature; import org.apache.hadoop.hdfs.server.namenode.snapshot.Snapshot; import org.apache.hadoop.hdfs.server.namenode.snapshot.SnapshotFSImageFormat; import org.apache.hadoop.hdfs.server.namenode.startupprogress.StartupProgress; import org.apache.hadoop.hdfs.util.ReadOnlyList;
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.server.namenode.snapshot.*; import org.apache.hadoop.hdfs.server.namenode.startupprogress.*; import org.apache.hadoop.hdfs.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
690,480
public PlayerMessage setPosition(int mediaItemIndex, long positionMs) { Assertions.checkState(!isSent); Assertions.checkArgument(positionMs != C.TIME_UNSET); if (mediaItemIndex < 0 || (!timeline.isEmpty() && mediaItemIndex >= timeline.getWindowCount())) { throw new IllegalSeekPositionException(timeline, mediaItemIndex, positionMs); } this.mediaItemIndex = mediaItemIndex; this.positionMs = positionMs; return this; }
PlayerMessage function(int mediaItemIndex, long positionMs) { Assertions.checkState(!isSent); Assertions.checkArgument(positionMs != C.TIME_UNSET); if (mediaItemIndex < 0 (!timeline.isEmpty() && mediaItemIndex >= timeline.getWindowCount())) { throw new IllegalSeekPositionException(timeline, mediaItemIndex, positionMs); } this.mediaItemIndex = mediaItemIndex; this.positionMs = positionMs; return this; }
/** * Sets a position in a media item at which the message will be delivered. * * @param mediaItemIndex The index of the media item at which the message will be sent. * @param positionMs The position in the media item with index {@code mediaItemIndex} at which the * message will be sent, in milliseconds, or {@link C#TIME_END_OF_SOURCE} to deliver the * message at the end of the media item with index {@code mediaItemIndex}. * @return This message. * @throws IllegalSeekPositionException If the timeline returned by {@link #getTimeline()} is not * empty and the provided media item index is not within the bounds of the timeline. * @throws IllegalStateException If {@link #send()} has already been called. */
Sets a position in a media item at which the message will be delivered
setPosition
{ "repo_name": "androidx/media", "path": "libraries/exoplayer/src/main/java/androidx/media3/exoplayer/PlayerMessage.java", "license": "apache-2.0", "size": 12815 }
[ "androidx.media3.common.IllegalSeekPositionException", "androidx.media3.common.util.Assertions" ]
import androidx.media3.common.IllegalSeekPositionException; import androidx.media3.common.util.Assertions;
import androidx.media3.common.*; import androidx.media3.common.util.*;
[ "androidx.media3" ]
androidx.media3;
466,472
private boolean paremeterEnabled(final Optional<Boolean> parameter) { return parameter.isPresent() && parameter.get().booleanValue() == true; }
boolean function(final Optional<Boolean> parameter) { return parameter.isPresent() && parameter.get().booleanValue() == true; }
/** * Helper method. Determines if the given request parameter, represented as * <code>Optional</code> type is 'enabled' for the request ('enabled' means: two conditions are * met: it is present and is set to <code>true</code>. * * @param parameter * request parameter being input of the rest service method * @return boolean: <tt>true</tt> - if it's enabled, <tt>false</tt> - otherwise */
Helper method. Determines if the given request parameter, represented as <code>Optional</code> type is 'enabled' for the request ('enabled' means: two conditions are met: it is present and is set to <code>true</code>
paremeterEnabled
{ "repo_name": "daniel-fryze/inteview-medications-app-daniel-fryze", "path": "meds-app-daniel-fryze-rest-api/rest-api/src/main/java/pl/education/fryzedaniel/restapp/api/controllers/MedicationController.java", "license": "apache-2.0", "size": 6356 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
1,586,057
private class DataTableColumnModel extends DefaultTableColumnModel { public TableColumn getColumn(int columnIndex) { TableColumn tableColumn; try { tableColumn = super.getColumn(columnIndex); } catch(Exception ex) { // return an empty column if the columnIndex is not valid. return new TableColumn(); } String headerValue = (String) tableColumn.getHeaderValue(); if(headerValue==null) { return tableColumn; } else if(headerValue.equals("row")) { //$NON-NLS-1$ tableColumn.setMaxWidth(labelColumnWidth); tableColumn.setMinWidth(labelColumnWidth); tableColumn.setResizable(true); } return tableColumn; } } } /* * Open Source Physics software is free software; you can redistribute * it and/or modify it under the terms of the GNU General Public License (GPL) as * published by the Free Software Foundation; either version 2 of the License, * or(at your option) any later version. * Code that uses any portion of the code in the org.opensourcephysics package * or any subpackage (subdirectory) of this package must must also be be released * under the GNU GPL license. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA * or view the license online at http://www.gnu.org/copyleft/gpl.html * * Copyright (c) 2007 The Open Source Physics project * http://www.opensourcephysics.org
class DataTableColumnModel extends DefaultTableColumnModel { public TableColumn function(int columnIndex) { TableColumn tableColumn; try { tableColumn = super.getColumn(columnIndex); } catch(Exception ex) { return new TableColumn(); } String headerValue = (String) tableColumn.getHeaderValue(); if(headerValue==null) { return tableColumn; } else if(headerValue.equals("row")) { tableColumn.setMaxWidth(labelColumnWidth); tableColumn.setMinWidth(labelColumnWidth); tableColumn.setResizable(true); } return tableColumn; } } } /* * Open Source Physics software is free software; you can redistribute * it and/or modify it under the terms of the GNU General Public License (GPL) as * published by the Free Software Foundation; either version 2 of the License, * or(at your option) any later version. * Code that uses any portion of the code in the org.opensourcephysics package * or any subpackage (subdirectory) of this package must must also be be released * under the GNU GPL license. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA * or view the license online at http: * * Copyright (c) 2007 The Open Source Physics project * http:
/** * Method getColumn * * @param columnIndex * @return */
Method getColumn
getColumn
{ "repo_name": "dobrown/tracker-mvn", "path": "src/main/java/org/opensourcephysics/display/DataRowTable.java", "license": "gpl-3.0", "size": 12041 }
[ "javax.swing.table.DefaultTableColumnModel", "javax.swing.table.TableColumn" ]
import javax.swing.table.DefaultTableColumnModel; import javax.swing.table.TableColumn;
import javax.swing.table.*;
[ "javax.swing" ]
javax.swing;
2,527,443
public boolean isProcedureFinished(String signature, String instance, Map<String, String> props) throws IOException { final ProcedureDescription.Builder builder = ProcedureDescription.newBuilder(); builder.setSignature(signature).setInstance(instance); for (Entry<String, String> entry : props.entrySet()) { NameStringPair pair = NameStringPair.newBuilder().setName(entry.getKey()) .setValue(entry.getValue()).build(); builder.addConfiguration(pair); }
boolean function(String signature, String instance, Map<String, String> props) throws IOException { final ProcedureDescription.Builder builder = ProcedureDescription.newBuilder(); builder.setSignature(signature).setInstance(instance); for (Entry<String, String> entry : props.entrySet()) { NameStringPair pair = NameStringPair.newBuilder().setName(entry.getKey()) .setValue(entry.getValue()).build(); builder.addConfiguration(pair); }
/** * Check the current state of the specified procedure. * <p> * There are three possible states: * <ol> * <li>running - returns <tt>false</tt></li> * <li>finished - returns <tt>true</tt></li> * <li>finished with error - throws the exception that caused the procedure to fail</li> * </ol> * <p> * * @param signature The signature that uniquely identifies a procedure * @param instance The instance name of the procedure * @param props Property/Value pairs of properties passing to the procedure * @return true if the specified procedure is finished successfully, false if it is still running * @throws IOException if the specified procedure finished with error */
Check the current state of the specified procedure. There are three possible states: running - returns false finished - returns true finished with error - throws the exception that caused the procedure to fail
isProcedureFinished
{ "repo_name": "intel-hadoop/hbase-rhino", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java", "license": "apache-2.0", "size": 138284 }
[ "java.io.IOException", "java.util.Map", "org.apache.hadoop.hbase.protobuf.generated.HBaseProtos" ]
import java.io.IOException; import java.util.Map; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.protobuf.generated.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
35,987