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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Test
public void testMissingFirstResultParameter() {
int maxResults = 10;
given().queryParam("maxResults", maxResults)
.then().expect().statusCode(Status.OK.getStatusCode())
.when().get(PROCESS_INSTANCE_QUERY_URL);
verify(mockedQuery).listPage(0, maxResults);
} | void function() { int maxResults = 10; given().queryParam(STR, maxResults) .then().expect().statusCode(Status.OK.getStatusCode()) .when().get(PROCESS_INSTANCE_QUERY_URL); verify(mockedQuery).listPage(0, maxResults); } | /**
* If parameter "firstResult" is missing, we expect 0 as default.
*/ | If parameter "firstResult" is missing, we expect 0 as default | testMissingFirstResultParameter | {
"repo_name": "xasx/camunda-bpm-platform",
"path": "engine-rest/engine-rest/src/test/java/org/camunda/bpm/engine/rest/ProcessInstanceRestServiceQueryTest.java",
"license": "apache-2.0",
"size": 37387
} | [
"io.restassured.RestAssured",
"javax.ws.rs.core.Response",
"org.mockito.Mockito"
] | import io.restassured.RestAssured; import javax.ws.rs.core.Response; import org.mockito.Mockito; | import io.restassured.*; import javax.ws.rs.core.*; import org.mockito.*; | [
"io.restassured",
"javax.ws",
"org.mockito"
] | io.restassured; javax.ws; org.mockito; | 162,223 |
protected List<String> getAuthorizeUrls() {
return CollectionUtils.wrapList(OAuth20Constants.AUTHORIZE_URL);
} | List<String> function() { return CollectionUtils.wrapList(OAuth20Constants.AUTHORIZE_URL); } | /**
* Gets authorize url.
*
* @return the authorize url
*/ | Gets authorize url | getAuthorizeUrls | {
"repo_name": "fogbeam/cas_mirror",
"path": "support/cas-server-support-oauth-core-api/src/main/java/org/apereo/cas/support/oauth/web/OAuth20HandlerInterceptorAdapter.java",
"license": "apache-2.0",
"size": 8230
} | [
"java.util.List",
"org.apereo.cas.support.oauth.OAuth20Constants",
"org.apereo.cas.util.CollectionUtils"
] | import java.util.List; import org.apereo.cas.support.oauth.OAuth20Constants; import org.apereo.cas.util.CollectionUtils; | import java.util.*; import org.apereo.cas.support.oauth.*; import org.apereo.cas.util.*; | [
"java.util",
"org.apereo.cas"
] | java.util; org.apereo.cas; | 1,589,222 |
public static void window(MaterialManager mgr, Extent e, Extent re,
Direction out, int key, int stepct) {
// first blow the hole itself
Castle c = Castle.getInstance();
c.fill(e, Material.AIR, 0);
// the window is glazed if it is above the floor or one unit in height.
boolean glazed = (re.miny + 1) < e.miny || (e.ysize() == 1);
// sometimes, glazing becomes iron bars.
boolean ironNotGlass = ((key & 1) == 0);
// so let's fill it
if (glazed) {
Material m =ironNotGlass ? Material.IRON_FENCE : mgr.getWindow().m;
int d = mgr.getWindow().d;
if(m == Material.THIN_GLASS && (((key>>8)&3) == 0)){
// glass can be overriden to stained glass
stainedGlassFill(e,key+stepct);
} else
c.fill(e, m, d);
} else {
// this window isn't going to get filled, lets put some bars in
c.fill(e, Material.IRON_FENCE, 0);
}
} | static void function(MaterialManager mgr, Extent e, Extent re, Direction out, int key, int stepct) { Castle c = Castle.getInstance(); c.fill(e, Material.AIR, 0); boolean glazed = (re.miny + 1) < e.miny (e.ysize() == 1); boolean ironNotGlass = ((key & 1) == 0); if (glazed) { Material m =ironNotGlass ? Material.IRON_FENCE : mgr.getWindow().m; int d = mgr.getWindow().d; if(m == Material.THIN_GLASS && (((key>>8)&3) == 0)){ stainedGlassFill(e,key+stepct); } else c.fill(e, m, d); } else { c.fill(e, Material.IRON_FENCE, 0); } } | /**
* Build a window covering the given extent. The key is a random value used
* to make sure windows built at the same time look the same.
*
* @param mgr
* @param e
* extent of window
* @param re
* extent of containing room
* @param out
* @param key
* @param stepct
*/ | Build a window covering the given extent. The key is a random value used to make sure windows built at the same time look the same | window | {
"repo_name": "jimfinnis/Gorm",
"path": "src/org/pale/gorm/roomutils/WindowMaker.java",
"license": "mit",
"size": 5203
} | [
"org.bukkit.Material",
"org.pale.gorm.Castle",
"org.pale.gorm.Direction",
"org.pale.gorm.Extent",
"org.pale.gorm.MaterialManager"
] | import org.bukkit.Material; import org.pale.gorm.Castle; import org.pale.gorm.Direction; import org.pale.gorm.Extent; import org.pale.gorm.MaterialManager; | import org.bukkit.*; import org.pale.gorm.*; | [
"org.bukkit",
"org.pale.gorm"
] | org.bukkit; org.pale.gorm; | 89,565 |
public void addImageCache(FragmentActivity activity, String diskCacheDirectoryName) {
mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName);
mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams);
new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE);
} | void function(FragmentActivity activity, String diskCacheDirectoryName) { mImageCacheParams = new ImageCache.ImageCacheParams(activity, diskCacheDirectoryName); mImageCache = ImageCache.getInstance(activity.getSupportFragmentManager(), mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); } | /**
* Adds an {@link ImageCache} to this {@link ImageWorker} to handle disk and memory bitmap
* caching.
* @param activity
* @param diskCacheDirectoryName See
* {@link ImageCache.ImageCacheParams#ImageCacheParams(Context, String)}.
*/ | Adds an <code>ImageCache</code> to this <code>ImageWorker</code> to handle disk and memory bitmap caching | addImageCache | {
"repo_name": "ZhenisMadiyar/ProToi",
"path": "ProToi/src/main/java/biz/franch/protoi2/cache/ImageWorker.java",
"license": "apache-2.0",
"size": 18226
} | [
"android.support.v4.app.FragmentActivity"
] | import android.support.v4.app.FragmentActivity; | import android.support.v4.app.*; | [
"android.support"
] | android.support; | 2,154,771 |
void setReference(String majorType, Reference ref, String reference); | void setReference(String majorType, Reference ref, String reference); | /**
* This sets the reference using this entity handler
*
* @param majorType
* The mojor type to bind this reference to
* @param ref
* the reference object
* @param reference
* the reference string
*/ | This sets the reference using this entity handler | setReference | {
"repo_name": "rodriguezdevera/sakai",
"path": "rwiki/rwiki-api/api/src/java/uk/ac/cam/caret/sakai/rwiki/service/api/EntityHandler.java",
"license": "apache-2.0",
"size": 3510
} | [
"org.sakaiproject.entity.api.Reference"
] | import org.sakaiproject.entity.api.Reference; | import org.sakaiproject.entity.api.*; | [
"org.sakaiproject.entity"
] | org.sakaiproject.entity; | 2,501,090 |
private void sendApprovalMailToSupervisors(final Message message, HttpServletRequest request) {
sendMailToSupervisors(message, MessageStatus.WAITING_FOR_APPROVAL, null, request);
}
| void function(final Message message, HttpServletRequest request) { sendMailToSupervisors(message, MessageStatus.WAITING_FOR_APPROVAL, null, request); } | /**
* send mail based on supervisors.
* @param request
* @return
*/ | send mail based on supervisors | sendApprovalMailToSupervisors | {
"repo_name": "vbonamy/esup-smsu",
"path": "src/main/java/org/esupportail/smsu/business/SendSmsManager.java",
"license": "apache-2.0",
"size": 37529
} | [
"javax.servlet.http.HttpServletRequest",
"org.esupportail.smsu.dao.beans.Message",
"org.esupportail.smsu.domain.beans.message.MessageStatus"
] | import javax.servlet.http.HttpServletRequest; import org.esupportail.smsu.dao.beans.Message; import org.esupportail.smsu.domain.beans.message.MessageStatus; | import javax.servlet.http.*; import org.esupportail.smsu.dao.beans.*; import org.esupportail.smsu.domain.beans.message.*; | [
"javax.servlet",
"org.esupportail.smsu"
] | javax.servlet; org.esupportail.smsu; | 2,250,070 |
public void init(JobConf conf) throws IOException {
String tracker = conf.get("mapred.job.tracker", "local");
if ("local".equals(tracker)) {
this.jobSubmitClient = new LocalJobRunner(conf);
} else {
this.jobSubmitClient = createRPCProxy(JobTracker.getAddress(conf), conf);
}
// Read progress monitor poll interval from config. Default is 1 second.
this.progMonitorPollIntervalMillis = conf.getInt(PROGRESS_MONITOR_POLL_INTERVAL_KEY,
DEFAULT_MONITOR_POLL_INTERVAL);
if (this.progMonitorPollIntervalMillis < 1) {
LOG.warn(PROGRESS_MONITOR_POLL_INTERVAL_KEY + " has been set to an invalid value; "
+ " replacing with " + DEFAULT_MONITOR_POLL_INTERVAL);
this.progMonitorPollIntervalMillis = DEFAULT_MONITOR_POLL_INTERVAL;
}
} | void function(JobConf conf) throws IOException { String tracker = conf.get(STR, "local"); if ("local".equals(tracker)) { this.jobSubmitClient = new LocalJobRunner(conf); } else { this.jobSubmitClient = createRPCProxy(JobTracker.getAddress(conf), conf); } this.progMonitorPollIntervalMillis = conf.getInt(PROGRESS_MONITOR_POLL_INTERVAL_KEY, DEFAULT_MONITOR_POLL_INTERVAL); if (this.progMonitorPollIntervalMillis < 1) { LOG.warn(PROGRESS_MONITOR_POLL_INTERVAL_KEY + STR + STR + DEFAULT_MONITOR_POLL_INTERVAL); this.progMonitorPollIntervalMillis = DEFAULT_MONITOR_POLL_INTERVAL; } } | /**
* Connect to the default {@link JobTracker}.
* @param conf the job configuration.
* @throws IOException
*/ | Connect to the default <code>JobTracker</code> | init | {
"repo_name": "ryanobjc/hadoop-cloudera",
"path": "src/mapred/org/apache/hadoop/mapred/JobClient.java",
"license": "apache-2.0",
"size": 67261
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,720,894 |
protected void flushRegion(WAL wal, byte[] regionEncodedName, Set<byte[]> flushedFamilyNames) {
wal.startCacheFlush(regionEncodedName, flushedFamilyNames);
wal.completeCacheFlush(regionEncodedName);
}
private static final byte[] UNSPECIFIED_REGION = new byte[]{}; | void function(WAL wal, byte[] regionEncodedName, Set<byte[]> flushedFamilyNames) { wal.startCacheFlush(regionEncodedName, flushedFamilyNames); wal.completeCacheFlush(regionEncodedName); } private static final byte[] UNSPECIFIED_REGION = new byte[]{}; | /**
* helper method to simulate region flush for a WAL.
* @param wal
* @param regionEncodedName
*/ | helper method to simulate region flush for a WAL | flushRegion | {
"repo_name": "JingchengDu/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestFSHLogProvider.java",
"license": "apache-2.0",
"size": 16048
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,673,871 |
@Column(header = Messages.GUI_HISTORY_DIALOG_COL_PATH_0, order = 40, expandRatio = 1.0f, view = "wide")
public String getPath() {
String rootPath = m_bean.getRootPath();
CmsObject cms = A_CmsUI.getCmsObject();
String result = cms.getRequestContext().removeSiteRoot(rootPath);
return result;
} | @Column(header = Messages.GUI_HISTORY_DIALOG_COL_PATH_0, order = 40, expandRatio = 1.0f, view = "wide") String function() { String rootPath = m_bean.getRootPath(); CmsObject cms = A_CmsUI.getCmsObject(); String result = cms.getRequestContext().removeSiteRoot(rootPath); return result; } | /**
* Gets the path.<p>
*
* @return the path
*/ | Gets the path | getPath | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/ui/dialogs/history/CmsHistoryRow.java",
"license": "lgpl-2.1",
"size": 6098
} | [
"org.opencms.file.CmsObject",
"org.opencms.ui.Messages",
"org.opencms.ui.util.table.Column"
] | import org.opencms.file.CmsObject; import org.opencms.ui.Messages; import org.opencms.ui.util.table.Column; | import org.opencms.file.*; import org.opencms.ui.*; import org.opencms.ui.util.table.*; | [
"org.opencms.file",
"org.opencms.ui"
] | org.opencms.file; org.opencms.ui; | 2,800,392 |
public static void timesAssign(Matrix res, Matrix A) {
if (res instanceof SparseMatrix) {
((SparseMatrix) res).assignSparseMatrix(sparse(res.times(A)));
} else if (res instanceof DenseMatrix) {
int M = A.getRowDimension();
int N = A.getColumnDimension();
double[][] resData = ((DenseMatrix) res).getData();
double[] resRow = null;
if (A instanceof DenseMatrix) {
double[][] AData = ((DenseMatrix) A).getData();
double[] ARow = null;
for (int i = 0; i < M; i++) {
ARow = AData[i];
resRow = resData[i];
for (int j = 0; j < N; j++) {
resRow[j] *= ARow[j];
}
}
} else if (A instanceof SparseMatrix) {
int[] ic = ((SparseMatrix) A).getIc();
int[] jr = ((SparseMatrix) A).getJr();
int[] valCSRIndices = ((SparseMatrix) A).getValCSRIndices();
double[] pr = ((SparseMatrix) A).getPr();
for (int i = 0; i < M; i++) {
resRow = resData[i];
if (jr[i] == jr[i + 1]) {
ArrayOperator.clearVector(resRow);
continue;
}
int lastColumnIdx = -1;
int currentColumnIdx = 0;
for (int k = jr[i]; k < jr[i + 1]; k++) {
currentColumnIdx = ic[k];
for (int c = lastColumnIdx + 1; c < currentColumnIdx; c++) {
resRow[c] = 0;
}
resRow[currentColumnIdx] *= pr[valCSRIndices[k]];
lastColumnIdx = currentColumnIdx;
}
for (int c = lastColumnIdx + 1; c < N; c++) {
resRow[c] = 0;
}
}
}
}
} | static void function(Matrix res, Matrix A) { if (res instanceof SparseMatrix) { ((SparseMatrix) res).assignSparseMatrix(sparse(res.times(A))); } else if (res instanceof DenseMatrix) { int M = A.getRowDimension(); int N = A.getColumnDimension(); double[][] resData = ((DenseMatrix) res).getData(); double[] resRow = null; if (A instanceof DenseMatrix) { double[][] AData = ((DenseMatrix) A).getData(); double[] ARow = null; for (int i = 0; i < M; i++) { ARow = AData[i]; resRow = resData[i]; for (int j = 0; j < N; j++) { resRow[j] *= ARow[j]; } } } else if (A instanceof SparseMatrix) { int[] ic = ((SparseMatrix) A).getIc(); int[] jr = ((SparseMatrix) A).getJr(); int[] valCSRIndices = ((SparseMatrix) A).getValCSRIndices(); double[] pr = ((SparseMatrix) A).getPr(); for (int i = 0; i < M; i++) { resRow = resData[i]; if (jr[i] == jr[i + 1]) { ArrayOperator.clearVector(resRow); continue; } int lastColumnIdx = -1; int currentColumnIdx = 0; for (int k = jr[i]; k < jr[i + 1]; k++) { currentColumnIdx = ic[k]; for (int c = lastColumnIdx + 1; c < currentColumnIdx; c++) { resRow[c] = 0; } resRow[currentColumnIdx] *= pr[valCSRIndices[k]]; lastColumnIdx = currentColumnIdx; } for (int c = lastColumnIdx + 1; c < N; c++) { resRow[c] = 0; } } } } } | /**
* res = res .* A
* @param res
* @param A
*/ | res = res .* A | timesAssign | {
"repo_name": "MingjieQian/LAML",
"path": "src/ml/utils/InPlaceOperator.java",
"license": "apache-2.0",
"size": 114698
} | [
"la.matrix.DenseMatrix",
"la.matrix.Matrix",
"la.matrix.SparseMatrix"
] | import la.matrix.DenseMatrix; import la.matrix.Matrix; import la.matrix.SparseMatrix; | import la.matrix.*; | [
"la.matrix"
] | la.matrix; | 2,231,031 |
TextAttributes getTextAttributes(); | TextAttributes getTextAttributes(); | /**
* Returns visual representation of caret (e.g. background color).
*
* @return Caret attributes.
*/ | Returns visual representation of caret (e.g. background color) | getTextAttributes | {
"repo_name": "liveqmock/platform-tools-idea",
"path": "platform/platform-api/src/com/intellij/openapi/editor/CaretModel.java",
"license": "apache-2.0",
"size": 4847
} | [
"com.intellij.openapi.editor.markup.TextAttributes"
] | import com.intellij.openapi.editor.markup.TextAttributes; | import com.intellij.openapi.editor.markup.*; | [
"com.intellij.openapi"
] | com.intellij.openapi; | 897,009 |
public List<String> getResources() {
return m_resources;
} | List<String> function() { return m_resources; } | /**
* Get the resource list.<p>
*
* @return List of resource root paths
*/ | Get the resource list | getResources | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/ui/apps/linkvalidation/CmsLinkInFolderValidationApp.java",
"license": "lgpl-2.1",
"size": 15359
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,223,623 |
public Versioned<List<StoreDefinition>> getRemoteStoreDefList(int nodeId)
throws VoldemortException {
Versioned<String> value = metadataMgmtOps.getRemoteMetadata(nodeId,
MetadataStore.STORES_KEY);
List<StoreDefinition> storeList = storeMapper.readStoreList(new StringReader(value.getValue()),
false);
return new Versioned<List<StoreDefinition>>(storeList, value.getVersion());
} | Versioned<List<StoreDefinition>> function(int nodeId) throws VoldemortException { Versioned<String> value = metadataMgmtOps.getRemoteMetadata(nodeId, MetadataStore.STORES_KEY); List<StoreDefinition> storeList = storeMapper.readStoreList(new StringReader(value.getValue()), false); return new Versioned<List<StoreDefinition>>(storeList, value.getVersion()); } | /**
* Retrieve the store definitions from a remote node.
* <p>
*
* @param nodeId The node id from which we can to remote the store
* definition
* @return The list of store definitions from the remote machine
* @throws VoldemortException
*/ | Retrieve the store definitions from a remote node. | getRemoteStoreDefList | {
"repo_name": "birendraa/voldemort",
"path": "src/java/voldemort/client/protocol/admin/AdminClient.java",
"license": "apache-2.0",
"size": 239787
} | [
"java.io.StringReader",
"java.util.List"
] | import java.io.StringReader; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,837,475 |
@POST
@Path("broadcast")
public String manualDelayBroadcast(@FormParam("message") String message) {
broadcaster.delayBroadcast(message, 10, TimeUnit.SECONDS);
return message;
} | @Path(STR) String function(@FormParam(STR) String message) { broadcaster.delayBroadcast(message, 10, TimeUnit.SECONDS); return message; } | /**
* Use the {@link Broadcaster#delayBroadcast(java.lang.Object)} directly
* instead of using the annotation.
*
* @param message A String from an HTML form
* @return A {@link Broadcastable} used to broadcast events.
*/ | Use the <code>Broadcaster#delayBroadcast(java.lang.Object)</code> directly instead of using the annotation | manualDelayBroadcast | {
"repo_name": "Atmosphere/atmosphere-samples",
"path": "samples/pubsub/src/main/java/org/atmosphere/samples/pubsub/PubSub.java",
"license": "apache-2.0",
"size": 10530
} | [
"java.util.concurrent.TimeUnit",
"javax.ws.rs.FormParam",
"javax.ws.rs.Path"
] | import java.util.concurrent.TimeUnit; import javax.ws.rs.FormParam; import javax.ws.rs.Path; | import java.util.concurrent.*; import javax.ws.rs.*; | [
"java.util",
"javax.ws"
] | java.util; javax.ws; | 2,808,363 |
private static <T> T createCustomComponent(Class<T> componentType, String componentSpec,
Map<String, String> configProperties, IPluginRegistry pluginRegistry) throws Exception {
return createCustomComponent(componentType, componentSpec, configProperties, pluginRegistry, null);
}
| static <T> T function(Class<T> componentType, String componentSpec, Map<String, String> configProperties, IPluginRegistry pluginRegistry) throws Exception { return createCustomComponent(componentType, componentSpec, configProperties, pluginRegistry, null); } | /**
* Creates a custom component from information found in the properties file.
* @param componentType
* @param componentSpec
* @param configProperties
* @param pluginRegistry
* @throws Exception
*/ | Creates a custom component from information found in the properties file | createCustomComponent | {
"repo_name": "jasonchaffee/apiman",
"path": "manager/api/micro/src/main/java/io/apiman/manager/api/micro/ManagerApiMicroServiceCdiFactory.java",
"license": "apache-2.0",
"size": 16194
} | [
"io.apiman.manager.api.core.IPluginRegistry",
"java.util.Map"
] | import io.apiman.manager.api.core.IPluginRegistry; import java.util.Map; | import io.apiman.manager.api.core.*; import java.util.*; | [
"io.apiman.manager",
"java.util"
] | io.apiman.manager; java.util; | 1,992,789 |
public Builder setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(
Context context) {
if (Util.SDK_INT >= 19) {
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19(context);
}
return this;
} | Builder function( Context context) { if (Util.SDK_INT >= 19) { setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19(context); } return this; } | /**
* Sets the preferred language and role flags for text tracks based on the accessibility
* settings of {@link CaptioningManager}.
*
* <p>Does nothing for API levels < 19 or when the {@link CaptioningManager} is disabled.
*
* @param context A {@link Context}.
* @return This builder.
*/ | Sets the preferred language and role flags for text tracks based on the accessibility settings of <code>CaptioningManager</code>. Does nothing for API levels < 19 or when the <code>CaptioningManager</code> is disabled | setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings | {
"repo_name": "superbderrick/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelectionParameters.java",
"license": "apache-2.0",
"size": 13177
} | [
"android.content.Context",
"com.google.android.exoplayer2.util.Util"
] | import android.content.Context; import com.google.android.exoplayer2.util.Util; | import android.content.*; import com.google.android.exoplayer2.util.*; | [
"android.content",
"com.google.android"
] | android.content; com.google.android; | 205,700 |
@PUT("/v1/sandbox/products/{product_id}")
Response putProducts(@Path("product_id") String productId, @Body SandboxProductBody sandboxProductBody); | @PUT(STR) Response putProducts(@Path(STR) String productId, @Body SandboxProductBody sandboxProductBody); | /**
* <p><b>FOR SANDBOX USE ONLY</b></p>
* <p>Accepts a JSON body indicating what you would like the surge_multiplier to be when making a Request to a particular Product.</p>
* @param productId
* @param sandboxProductBody
* @return
*/ | FOR SANDBOX USE ONLY Accepts a JSON body indicating what you would like the surge_multiplier to be when making a Request to a particular Product | putProducts | {
"repo_name": "vsima/uber-java-client",
"path": "src/main/java/com/victorsima/uber/model/sandbox/SandboxService.java",
"license": "mit",
"size": 1259
} | [
"com.squareup.okhttp.Response"
] | import com.squareup.okhttp.Response; | import com.squareup.okhttp.*; | [
"com.squareup.okhttp"
] | com.squareup.okhttp; | 1,822,183 |
private void addPropDef(QPropertyDefinition def)
throws NamespaceException, RepositoryException {
builder.startElement(Constants.PROPERTYDEFINITION_ELEMENT);
// simple attributes
builder.setAttribute(
Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName()));
builder.setAttribute(
Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated());
builder.setAttribute(
Constants.MANDATORY_ATTRIBUTE, def.isMandatory());
builder.setAttribute(
Constants.PROTECTED_ATTRIBUTE, def.isProtected());
builder.setAttribute(
Constants.ONPARENTVERSION_ATTRIBUTE,
OnParentVersionAction.nameFromValue(def.getOnParentVersion()));
builder.setAttribute(
Constants.MULTIPLE_ATTRIBUTE, def.isMultiple());
builder.setAttribute(
Constants.ISFULLTEXTSEARCHABLE_ATTRIBUTE, def.isFullTextSearchable());
builder.setAttribute(
Constants.ISQUERYORDERABLE_ATTRIBUTE, def.isQueryOrderable());
// TODO do properly...
String[] qops = def.getAvailableQueryOperators();
if (qops != null && qops.length > 0) {
List<String> ops = Arrays.asList(qops);
List<String> defaultOps = Arrays.asList(Operator.getAllQueryOperators());
if (!ops.containsAll(defaultOps)) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < qops.length; i++) {
if (i > 0) {
sb.append(' ');
}
if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO)) {
sb.append(Constants.EQ_ENTITY);
} else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO)) {
sb.append(Constants.NE_ENTITY);
} else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN)) {
sb.append(Constants.GT_ENTITY);
} else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO)) {
sb.append(Constants.GE_ENTITY);
} else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN)) {
sb.append(Constants.LT_ENTITY);
} else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO)) {
sb.append(Constants.LE_ENTITY);
} else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LIKE)) {
sb.append(Constants.LIKE_ENTITY);
}
}
builder.setAttribute(
Constants.AVAILABLEQUERYOPERATORS_ATTRIBUTE, sb.toString());
}
}
builder.setAttribute(
Constants.REQUIREDTYPE_ATTRIBUTE,
PropertyType.nameFromValue(def.getRequiredType()));
// value constraints
QValueConstraint[] constraints = def.getValueConstraints();
if (constraints != null && constraints.length > 0) {
builder.startElement(Constants.VALUECONSTRAINTS_ELEMENT);
for (QValueConstraint constraint : constraints) {
ValueConstraint vc = ValueConstraint.create(
def.getRequiredType(), constraint.getString());
builder.addContentElement(
Constants.VALUECONSTRAINT_ELEMENT,
vc.getDefinition(resolver));
}
builder.endElement();
}
// default values
QValue[] defaults = def.getDefaultValues();
if (defaults != null && defaults.length > 0) {
builder.startElement(Constants.DEFAULTVALUES_ELEMENT);
for (QValue v : defaults) {
builder.addContentElement(
Constants.DEFAULTVALUE_ELEMENT,
factory.createValue(v).getString());
}
builder.endElement();
}
builder.endElement();
} | void function(QPropertyDefinition def) throws NamespaceException, RepositoryException { builder.startElement(Constants.PROPERTYDEFINITION_ELEMENT); builder.setAttribute( Constants.NAME_ATTRIBUTE, resolver.getJCRName(def.getName())); builder.setAttribute( Constants.AUTOCREATED_ATTRIBUTE, def.isAutoCreated()); builder.setAttribute( Constants.MANDATORY_ATTRIBUTE, def.isMandatory()); builder.setAttribute( Constants.PROTECTED_ATTRIBUTE, def.isProtected()); builder.setAttribute( Constants.ONPARENTVERSION_ATTRIBUTE, OnParentVersionAction.nameFromValue(def.getOnParentVersion())); builder.setAttribute( Constants.MULTIPLE_ATTRIBUTE, def.isMultiple()); builder.setAttribute( Constants.ISFULLTEXTSEARCHABLE_ATTRIBUTE, def.isFullTextSearchable()); builder.setAttribute( Constants.ISQUERYORDERABLE_ATTRIBUTE, def.isQueryOrderable()); String[] qops = def.getAvailableQueryOperators(); if (qops != null && qops.length > 0) { List<String> ops = Arrays.asList(qops); List<String> defaultOps = Arrays.asList(Operator.getAllQueryOperators()); if (!ops.containsAll(defaultOps)) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < qops.length; i++) { if (i > 0) { sb.append(' '); } if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_EQUAL_TO)) { sb.append(Constants.EQ_ENTITY); } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_NOT_EQUAL_TO)) { sb.append(Constants.NE_ENTITY); } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN)) { sb.append(Constants.GT_ENTITY); } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_GREATER_THAN_OR_EQUAL_TO)) { sb.append(Constants.GE_ENTITY); } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN)) { sb.append(Constants.LT_ENTITY); } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LESS_THAN_OR_EQUAL_TO)) { sb.append(Constants.LE_ENTITY); } else if (qops[i].equals(QueryObjectModelConstants.JCR_OPERATOR_LIKE)) { sb.append(Constants.LIKE_ENTITY); } } builder.setAttribute( Constants.AVAILABLEQUERYOPERATORS_ATTRIBUTE, sb.toString()); } } builder.setAttribute( Constants.REQUIREDTYPE_ATTRIBUTE, PropertyType.nameFromValue(def.getRequiredType())); QValueConstraint[] constraints = def.getValueConstraints(); if (constraints != null && constraints.length > 0) { builder.startElement(Constants.VALUECONSTRAINTS_ELEMENT); for (QValueConstraint constraint : constraints) { ValueConstraint vc = ValueConstraint.create( def.getRequiredType(), constraint.getString()); builder.addContentElement( Constants.VALUECONSTRAINT_ELEMENT, vc.getDefinition(resolver)); } builder.endElement(); } QValue[] defaults = def.getDefaultValues(); if (defaults != null && defaults.length > 0) { builder.startElement(Constants.DEFAULTVALUES_ELEMENT); for (QValue v : defaults) { builder.addContentElement( Constants.DEFAULTVALUE_ELEMENT, factory.createValue(v).getString()); } builder.endElement(); } builder.endElement(); } | /**
* Builds a property definition element under the current element.
*
* @param def property definition
* @throws RepositoryException if the default values cannot
* be serialized
* @throws NamespaceException if the property definition contains
* invalid namespace references
*/ | Builds a property definition element under the current element | addPropDef | {
"repo_name": "tripodsan/jackrabbit",
"path": "jackrabbit-core/src/main/java/org/apache/jackrabbit/core/nodetype/xml/NodeTypeWriter.java",
"license": "apache-2.0",
"size": 14150
} | [
"java.util.Arrays",
"java.util.List",
"javax.jcr.NamespaceException",
"javax.jcr.PropertyType",
"javax.jcr.RepositoryException",
"javax.jcr.query.qom.QueryObjectModelConstants",
"javax.jcr.version.OnParentVersionAction",
"org.apache.jackrabbit.commons.query.qom.Operator",
"org.apache.jackrabbit.spi.QPropertyDefinition",
"org.apache.jackrabbit.spi.QValue",
"org.apache.jackrabbit.spi.QValueConstraint",
"org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint"
] | import java.util.Arrays; import java.util.List; import javax.jcr.NamespaceException; import javax.jcr.PropertyType; import javax.jcr.RepositoryException; import javax.jcr.query.qom.QueryObjectModelConstants; import javax.jcr.version.OnParentVersionAction; import org.apache.jackrabbit.commons.query.qom.Operator; import org.apache.jackrabbit.spi.QPropertyDefinition; import org.apache.jackrabbit.spi.QValue; import org.apache.jackrabbit.spi.QValueConstraint; import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint; | import java.util.*; import javax.jcr.*; import javax.jcr.query.qom.*; import javax.jcr.version.*; import org.apache.jackrabbit.commons.query.qom.*; import org.apache.jackrabbit.spi.*; import org.apache.jackrabbit.spi.commons.nodetype.constraint.*; | [
"java.util",
"javax.jcr",
"org.apache.jackrabbit"
] | java.util; javax.jcr; org.apache.jackrabbit; | 2,635,126 |
public static String extractAddressBasePath(org.apache.synapse.MessageContext mc) {
String endpointAddress = (String) mc.getProperty(APIMgtGatewayConstants.SYNAPSE_ENDPOINT_ADDRESS);
if (endpointAddress == null) {
endpointAddress = APIMgtGatewayConstants.DUMMY_ENDPOINT_ADDRESS;
}
if (endpointAddress.contains("?")) {
endpointAddress = endpointAddress.substring(0, endpointAddress.indexOf("?"));
}
return endpointAddress;
} | static String function(org.apache.synapse.MessageContext mc) { String endpointAddress = (String) mc.getProperty(APIMgtGatewayConstants.SYNAPSE_ENDPOINT_ADDRESS); if (endpointAddress == null) { endpointAddress = APIMgtGatewayConstants.DUMMY_ENDPOINT_ADDRESS; } if (endpointAddress.contains("?")) { endpointAddress = endpointAddress.substring(0, endpointAddress.indexOf("?")); } return endpointAddress; } | /**
* This method extracts the endpoint address base path if query parameters are contained in endpoint
*
* @param mc The message context
* @return The endpoint address base path
*/ | This method extracts the endpoint address base path if query parameters are contained in endpoint | extractAddressBasePath | {
"repo_name": "nuwand/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/utils/GatewayUtils.java",
"license": "apache-2.0",
"size": 55545
} | [
"org.apache.axis2.context.MessageContext",
"org.wso2.carbon.apimgt.gateway.APIMgtGatewayConstants"
] | import org.apache.axis2.context.MessageContext; import org.wso2.carbon.apimgt.gateway.APIMgtGatewayConstants; | import org.apache.axis2.context.*; import org.wso2.carbon.apimgt.gateway.*; | [
"org.apache.axis2",
"org.wso2.carbon"
] | org.apache.axis2; org.wso2.carbon; | 1,855,849 |
static public Properties getProperties(final String className,
final Configuration config) throws ConfigurationException {
final NV[] a = (NV[]) config
.getEntry(JiniClient.class.getName(),
JiniClientConfig.Options.PROPERTIES, NV[].class,
new NV[] {});
final NV[] b;
if (className != null) {
b = (NV[]) config.getEntry(className,
JiniClientConfig.Options.PROPERTIES, NV[].class,
new NV[] {});
} else
b = null;
final NV[] tmp = ConfigMath.concat(a, b);
final Properties properties = new Properties();
for (NV nv : tmp) {
properties.setProperty(nv.getName(), nv.getValue());
}
if (log.isInfoEnabled() || BigdataStatics.debug) {
final String msg = "className=" + className + " : properties="
+ properties.toString();
if (BigdataStatics.debug)
System.err.println(msg);
if (log.isInfoEnabled())
log.info(msg);
}
return properties;
} | static Properties function(final String className, final Configuration config) throws ConfigurationException { final NV[] a = (NV[]) config .getEntry(JiniClient.class.getName(), JiniClientConfig.Options.PROPERTIES, NV[].class, new NV[] {}); final NV[] b; if (className != null) { b = (NV[]) config.getEntry(className, JiniClientConfig.Options.PROPERTIES, NV[].class, new NV[] {}); } else b = null; final NV[] tmp = ConfigMath.concat(a, b); final Properties properties = new Properties(); for (NV nv : tmp) { properties.setProperty(nv.getName(), nv.getValue()); } if (log.isInfoEnabled() BigdataStatics.debug) { final String msg = STR + className + STR + properties.toString(); if (BigdataStatics.debug) System.err.println(msg); if (log.isInfoEnabled()) log.info(msg); } return properties; } | /**
* Read {@value JiniClientConfig.Options#PROPERTIES} for the optional
* application or server class identified by [cls].
* <p>
* Note: Anything read for the specific class will overwrite any value for
* the same properties specified for {@link JiniClient}.
*
* @param className
* The class name of the client or service (optional). When
* specified, properties defined for that class in the
* configuration will be used and will override those specified
* for the {@value Options#NAMESPACE}.
* @param config
* The {@link Configuration}.
*
* @todo this could be replaced by explicit use of the java identifier
* corresponding to the Option and simply collecting all such
* properties into a Properties object using their native type (as
* reported by the ConfigurationFile).
*/ | Read JiniClientConfig.Options#PROPERTIES for the optional application or server class identified by [cls]. Note: Anything read for the specific class will overwrite any value for the same properties specified for <code>JiniClient</code> | getProperties | {
"repo_name": "rac021/blazegraph_1_5_3_cluster_2_nodes",
"path": "bigdata-jini/src/main/java/com/bigdata/service/jini/JiniClient.java",
"license": "gpl-2.0",
"size": 14945
} | [
"com.bigdata.BigdataStatics",
"com.bigdata.jini.util.ConfigMath",
"java.util.Properties",
"net.jini.config.Configuration",
"net.jini.config.ConfigurationException"
] | import com.bigdata.BigdataStatics; import com.bigdata.jini.util.ConfigMath; import java.util.Properties; import net.jini.config.Configuration; import net.jini.config.ConfigurationException; | import com.bigdata.*; import com.bigdata.jini.util.*; import java.util.*; import net.jini.config.*; | [
"com.bigdata",
"com.bigdata.jini",
"java.util",
"net.jini.config"
] | com.bigdata; com.bigdata.jini; java.util; net.jini.config; | 1,480,223 |
public String runToHtmlFile(
String sourceFileName,
Map<String,Object> params,
JRDataSource jrDataSource
) throws JRException
{
File sourceFile = new File(sourceFileName);
JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile);
JasperFillManager jasperFillManager = JasperFillManager.getInstance(jasperReportsContext);
JasperReportsContext lcJrCtx = jasperFillManager.getLocalJasperReportsContext(sourceFile);
JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, jrDataSource);
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html");
String destFileName = destFile.toString();
JasperExportManager.getInstance(jasperReportsContext).exportToHtmlFile(jasperPrint, destFileName);
return destFileName;
}
| String function( String sourceFileName, Map<String,Object> params, JRDataSource jrDataSource ) throws JRException { File sourceFile = new File(sourceFileName); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(sourceFile); JasperFillManager jasperFillManager = JasperFillManager.getInstance(jasperReportsContext); JasperReportsContext lcJrCtx = jasperFillManager.getLocalJasperReportsContext(sourceFile); JasperPrint jasperPrint = JRFiller.fill(lcJrCtx, jasperReport, params, jrDataSource); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".html"); String destFileName = destFile.toString(); JasperExportManager.getInstance(jasperReportsContext).exportToHtmlFile(jasperPrint, destFileName); return destFileName; } | /**
* Fills a report and saves it directly into a HTML file.
* The intermediate JasperPrint object is not saved on disk.
*/ | Fills a report and saves it directly into a HTML file. The intermediate JasperPrint object is not saved on disk | runToHtmlFile | {
"repo_name": "MHTaleb/Encologim",
"path": "lib/JasperReport/src/net/sf/jasperreports/engine/JasperRunManager.java",
"license": "gpl-3.0",
"size": 27813
} | [
"java.io.File",
"java.util.Map",
"net.sf.jasperreports.engine.fill.JRFiller",
"net.sf.jasperreports.engine.util.JRLoader"
] | import java.io.File; import java.util.Map; import net.sf.jasperreports.engine.fill.JRFiller; import net.sf.jasperreports.engine.util.JRLoader; | import java.io.*; import java.util.*; import net.sf.jasperreports.engine.fill.*; import net.sf.jasperreports.engine.util.*; | [
"java.io",
"java.util",
"net.sf.jasperreports"
] | java.io; java.util; net.sf.jasperreports; | 2,284,801 |
@VisibleForTesting
ResourceHandle tryAcquire(ActionExecutionMetadata owner, ResourceSet resources) {
Preconditions.checkNotNull(
resources, "tryAcquire called with resources == NULL during %s", owner);
Preconditions.checkState(
!threadHasResources(), "tryAcquire with existing resource lock during %s", owner);
boolean acquired = false;
synchronized (this) {
if (areResourcesAvailable(resources)) {
incrementResources(resources);
acquired = true;
}
}
if (acquired) {
threadLocked.set(resources != ResourceSet.ZERO);
return new ResourceHandle(this, owner, resources);
}
return null;
} | ResourceHandle tryAcquire(ActionExecutionMetadata owner, ResourceSet resources) { Preconditions.checkNotNull( resources, STR, owner); Preconditions.checkState( !threadHasResources(), STR, owner); boolean acquired = false; synchronized (this) { if (areResourcesAvailable(resources)) { incrementResources(resources); acquired = true; } } if (acquired) { threadLocked.set(resources != ResourceSet.ZERO); return new ResourceHandle(this, owner, resources); } return null; } | /**
* Acquires the given resources if available immediately. Does not block.
*
* @return a ResourceHandle iff the given resources were locked (all or nothing), null otherwise.
*/ | Acquires the given resources if available immediately. Does not block | tryAcquire | {
"repo_name": "juhalindfors/bazel-patches",
"path": "src/main/java/com/google/devtools/build/lib/actions/ResourceManager.java",
"license": "apache-2.0",
"size": 15858
} | [
"com.google.devtools.build.lib.util.Preconditions"
] | import com.google.devtools.build.lib.util.Preconditions; | import com.google.devtools.build.lib.util.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,340,757 |
public List<String> getPkFields() {
return pkFields;
} | List<String> function() { return pkFields; } | /**
* Gets the immutable list of fields that compose the primary key.
*
* @return The immutable list of keys that compose the primary key.
*/ | Gets the immutable list of fields that compose the primary key | getPkFields | {
"repo_name": "feedzai/pdb",
"path": "src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbEntity.java",
"license": "apache-2.0",
"size": 13269
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,527,939 |
public int deleteGroup(String groupID) {
SQLiteDatabase db;
int rowsAffected = -1;
synchronized (lock) {
try {
db = appDb.getWritableDatabase(TABLE_NAME);
String selection = COL_ID + "=? ";
String[] selectionArgs = new String[] { groupID };
rowsAffected = db.delete(TABLE_NAME, selection, selectionArgs);
ContactTable contactTable = (ContactTable) appDb.getTableObject(ContactTable.TABLE_NAME);
rowsAffected = contactTable.deleteContactsByGroup(groupID);
} catch (Exception e) {
e.printStackTrace();
} finally {
appDb.closeDB();
}
}
return rowsAffected;
} | int function(String groupID) { SQLiteDatabase db; int rowsAffected = -1; synchronized (lock) { try { db = appDb.getWritableDatabase(TABLE_NAME); String selection = COL_ID + STR; String[] selectionArgs = new String[] { groupID }; rowsAffected = db.delete(TABLE_NAME, selection, selectionArgs); ContactTable contactTable = (ContactTable) appDb.getTableObject(ContactTable.TABLE_NAME); rowsAffected = contactTable.deleteContactsByGroup(groupID); } catch (Exception e) { e.printStackTrace(); } finally { appDb.closeDB(); } } return rowsAffected; } | /**
* Method to delete a group and related contact from database
* @param groupID to delete a particular group and all contact that have this
* groupID as a foreign key
* @return no. of records which has been deleted or
* -1 if operation will fails
*/ | Method to delete a group and related contact from database | deleteGroup | {
"repo_name": "bshubham80/ThereVGo",
"path": "app/src/main/java/com/client/therevgo/services/database/GroupTable.java",
"license": "gpl-3.0",
"size": 6275
} | [
"android.database.sqlite.SQLiteDatabase"
] | import android.database.sqlite.SQLiteDatabase; | import android.database.sqlite.*; | [
"android.database"
] | android.database; | 798,141 |
public static void createDirectory(Path dirPath) {
try {
Files.createDirectory(dirPath);
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
| static void function(Path dirPath) { try { Files.createDirectory(dirPath); } catch (IOException e) { throw new RuntimeException(e); } } | /**
* Create a directory; throw RuntimeException in case of error.
*
* @param dirPath Directory to create.
*/ | Create a directory; throw RuntimeException in case of error | createDirectory | {
"repo_name": "gbtorrance/test",
"path": "core/src/main/java/org/tdc/util/Util.java",
"license": "mit",
"size": 6722
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Path"
] | import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; | import java.io.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 2,886,958 |
public Map<String, Double> getHashtags() {
return hashtags;
} | Map<String, Double> function() { return hashtags; } | /**
* Return the dysco's hashtags with their assigned weights
*
* @return Map of String to Double
*/ | Return the dysco's hashtags with their assigned weights | getHashtags | {
"repo_name": "socialsensor/socialsensor-framework-common",
"path": "src/main/java/eu/socialsensor/framework/common/domain/dysco/Dysco.java",
"license": "apache-2.0",
"size": 14969
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,847,173 |
public Observable<ServiceResponse<TransformInner>> updateWithServiceResponseAsync(String resourceGroupName, String accountName, String transformName, TransformInner parameters) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (transformName == null) {
throw new IllegalArgumentException("Parameter transformName is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<TransformInner>> function(String resourceGroupName, String accountName, String transformName, TransformInner parameters) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } if (transformName == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Update Transform.
* Updates a Transform.
*
* @param resourceGroupName The name of the resource group within the Azure subscription.
* @param accountName The Media Services account name.
* @param transformName The Transform name.
* @param parameters The request parameters
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the TransformInner object
*/ | Update Transform. Updates a Transform | updateWithServiceResponseAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/mediaservices/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/mediaservices/v2018_07_01/implementation/TransformsInner.java",
"license": "mit",
"size": 48794
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 417,595 |
public void setQuota(Path src, long quota) throws IOException {
dfs.setQuota(src, quota, HdfsConstants.QUOTA_DONT_SET);
} | void function(Path src, long quota) throws IOException { dfs.setQuota(src, quota, HdfsConstants.QUOTA_DONT_SET); } | /**
* Set the namespace quota (count of files, directories, and sym links) for a
* directory.
*
* @param src the path to set the quota for
* @param quota the value to set for the quota
* @throws IOException in the event of error
*/ | Set the namespace quota (count of files, directories, and sym links) for a directory | setQuota | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/client/HdfsAdmin.java",
"license": "apache-2.0",
"size": 7673
} | [
"java.io.IOException",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hdfs.protocol.HdfsConstants"
] | import java.io.IOException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.HdfsConstants; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,833,313 |
public void resetMappingValues(ActionEvent event) {
localGradebook.getSelectedGradeMapping().setDefaultValues();
} | void function(ActionEvent event) { localGradebook.getSelectedGradeMapping().setDefaultValues(); } | /**
* Action listener to reset the currently selected grade mapping to its default values.
* Other, not currently visible, changed unsaved grade mapping settings are left as they
* are.
*/ | Action listener to reset the currently selected grade mapping to its default values. Other, not currently visible, changed unsaved grade mapping settings are left as they are | resetMappingValues | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "gradebook/app/ui/src/java/org/sakaiproject/tool/gradebook/ui/FeedbackOptionsBean.java",
"license": "apache-2.0",
"size": 11491
} | [
"javax.faces.event.ActionEvent"
] | import javax.faces.event.ActionEvent; | import javax.faces.event.*; | [
"javax.faces"
] | javax.faces; | 871,957 |
public void setOAuthCredentials(OAuthParameters parameters,
OAuthSigner signer) throws OAuthException {
// validate input parameters
parameters.assertOAuthConsumerKeyExists();
setAuthToken(new OAuthToken(parameters, signer));
} | void function(OAuthParameters parameters, OAuthSigner signer) throws OAuthException { parameters.assertOAuthConsumerKeyExists(); setAuthToken(new OAuthToken(parameters, signer)); } | /**
* Sets the OAuth credentials used to generate the authorization header.
* The following OAuth parameters are required:
* <ul>
* <li>oauth_consumer_key
* <li>oauth_token
* </ul>
*
* @param parameters the OAuth parameters to use to generate the header
* @param signer the signing method to use for signing the header
* @throws OAuthException
*/ | Sets the OAuth credentials used to generate the authorization header. The following OAuth parameters are required: oauth_consumer_key oauth_token | setOAuthCredentials | {
"repo_name": "athibanraj/gdata-java-client",
"path": "java/src/com/google/gdata/client/GoogleAuthTokenFactory.java",
"license": "apache-2.0",
"size": 25616
} | [
"com.google.gdata.client.authn.oauth.OAuthException",
"com.google.gdata.client.authn.oauth.OAuthParameters",
"com.google.gdata.client.authn.oauth.OAuthSigner"
] | import com.google.gdata.client.authn.oauth.OAuthException; import com.google.gdata.client.authn.oauth.OAuthParameters; import com.google.gdata.client.authn.oauth.OAuthSigner; | import com.google.gdata.client.authn.oauth.*; | [
"com.google.gdata"
] | com.google.gdata; | 1,064,918 |
public Configurable withScope(String scope) {
this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
return this;
} | Configurable function(String scope) { this.scopes.add(Objects.requireNonNull(scope, STR)); return this; } | /**
* Adds the scope to permission sets.
*
* @param scope the scope.
* @return the configurable object itself.
*/ | Adds the scope to permission sets | withScope | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/hybridnetwork/azure-resourcemanager-hybridnetwork/src/main/java/com/azure/resourcemanager/hybridnetwork/HybridNetworkManager.java",
"license": "mit",
"size": 14344
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 1,069,790 |
public void setSlaveServers( List<SlaveServer> slaveServers ) {
this.slaveServers = slaveServers;
} | void function( List<SlaveServer> slaveServers ) { this.slaveServers = slaveServers; } | /**
* Sets the slave servers.
*
* @param slaveServers the slaveServers to set
*/ | Sets the slave servers | setSlaveServers | {
"repo_name": "nicoben/pentaho-kettle",
"path": "engine/src/org/pentaho/di/base/AbstractMeta.java",
"license": "apache-2.0",
"size": 46352
} | [
"java.util.List",
"org.pentaho.di.cluster.SlaveServer"
] | import java.util.List; import org.pentaho.di.cluster.SlaveServer; | import java.util.*; import org.pentaho.di.cluster.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 1,611,913 |
return Stream.concat(getBranchAndBoundConfigs(), getBruteForceConfigs()).collect(Collectors.toList());
} | return Stream.concat(getBranchAndBoundConfigs(), getBruteForceConfigs()).collect(Collectors.toList()); } | /**
* Initialize combination of input parameters.
*
* @return collection of combination of input parameters
*/ | Initialize combination of input parameters | params | {
"repo_name": "ge0ffrey/optaplanner",
"path": "optaplanner-core/src/test/java/org/optaplanner/core/impl/exhaustivesearch/BlackBoxExhaustiveSearchPhaseTest.java",
"license": "apache-2.0",
"size": 26765
} | [
"java.util.stream.Collectors",
"java.util.stream.Stream"
] | import java.util.stream.Collectors; import java.util.stream.Stream; | import java.util.stream.*; | [
"java.util"
] | java.util; | 1,899,928 |
@Override
protected void validateAttributes(RuleContext ruleContext) {
Iterable<ObjcProvider> extensionProviders = ruleContext.getPrerequisites(
"extensions", Mode.TARGET, ObjcProvider.class);
if (hasMoreThanOneWatchExtension(extensionProviders, Flag.HAS_WATCH1_EXTENSION)
|| hasMoreThanOneWatchExtension(extensionProviders, Flag.HAS_WATCH2_EXTENSION)) {
ruleContext.attributeError("extensions", "An iOS application can contain exactly one "
+ "watch extension for each watch OS version");
}
} | void function(RuleContext ruleContext) { Iterable<ObjcProvider> extensionProviders = ruleContext.getPrerequisites( STR, Mode.TARGET, ObjcProvider.class); if (hasMoreThanOneWatchExtension(extensionProviders, Flag.HAS_WATCH1_EXTENSION) hasMoreThanOneWatchExtension(extensionProviders, Flag.HAS_WATCH2_EXTENSION)) { ruleContext.attributeError(STR, STR + STR); } } | /**
* Validates that there is exactly one watch extension for each OS version.
*/ | Validates that there is exactly one watch extension for each OS version | validateAttributes | {
"repo_name": "kchodorow/bazel-1",
"path": "src/main/java/com/google/devtools/build/lib/rules/objc/IosApplication.java",
"license": "apache-2.0",
"size": 4432
} | [
"com.google.devtools.build.lib.analysis.RuleConfiguredTarget",
"com.google.devtools.build.lib.analysis.RuleContext",
"com.google.devtools.build.lib.rules.objc.ObjcProvider"
] | import com.google.devtools.build.lib.analysis.RuleConfiguredTarget; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.rules.objc.ObjcProvider; | import com.google.devtools.build.lib.analysis.*; import com.google.devtools.build.lib.rules.objc.*; | [
"com.google.devtools"
] | com.google.devtools; | 2,665,867 |
@Override
public MovingObjectPosition getMouseOver(double d0)
{
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc.getRenderViewEntity() != null)
{
if (mc.theWorld != null)
{
float tickPart = BattlegearClientTickHandeler.getPartialTick();
MovingObjectPosition objectMouseOver = mc.getRenderViewEntity().rayTrace(d0, tickPart);
double d1 = d0;
Vec3 vec3 = mc.getRenderViewEntity().getPositionEyes(tickPart);
if (objectMouseOver != null)
{
d1 = objectMouseOver.hitVec.distanceTo(vec3);
}
Vec3 vec31 = mc.getRenderViewEntity().getLook(tickPart);
Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0);
Vec3 vec33 = null;
Entity pointedEntity = null;
List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.getRenderViewEntity(), mc.getRenderViewEntity().getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(1.0D, 1.0D, 1.0D));
double d2 = d1;
for (Object o : list)
{
Entity entity = (Entity) o;
if (entity.canBeCollidedWith())
{
double f2 = entity.getCollisionBorderSize();
AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expand(f2, f2, f2);
MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32);
if (axisalignedbb.isVecInside(vec3))
{
if (d2 >= 0.0D)
{
pointedEntity = entity;
vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec;
d2 = 0.0D;
}
}
else if (movingobjectposition != null)
{
double d3 = vec3.distanceTo(movingobjectposition.hitVec);
if (d3 < d2 || d2 == 0.0D)
{
if (entity == entity.ridingEntity && !entity.canRiderInteract()) {
if (d2 == 0.0D) {
pointedEntity = entity;
vec33 = movingobjectposition.hitVec;
}
} else {
pointedEntity = entity;
vec33 = movingobjectposition.hitVec;
d2 = d3;
}
}
}
}
}
if (pointedEntity != null && (d2 < d1 || objectMouseOver == null))
{
objectMouseOver = new MovingObjectPosition(pointedEntity, vec33);
}
return objectMouseOver;
}
}
return null;
} | MovingObjectPosition function(double d0) { Minecraft mc = FMLClientHandler.instance().getClient(); if (mc.getRenderViewEntity() != null) { if (mc.theWorld != null) { float tickPart = BattlegearClientTickHandeler.getPartialTick(); MovingObjectPosition objectMouseOver = mc.getRenderViewEntity().rayTrace(d0, tickPart); double d1 = d0; Vec3 vec3 = mc.getRenderViewEntity().getPositionEyes(tickPart); if (objectMouseOver != null) { d1 = objectMouseOver.hitVec.distanceTo(vec3); } Vec3 vec31 = mc.getRenderViewEntity().getLook(tickPart); Vec3 vec32 = vec3.addVector(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0); Vec3 vec33 = null; Entity pointedEntity = null; List list = mc.theWorld.getEntitiesWithinAABBExcludingEntity(mc.getRenderViewEntity(), mc.getRenderViewEntity().getEntityBoundingBox().addCoord(vec31.xCoord * d0, vec31.yCoord * d0, vec31.zCoord * d0).expand(1.0D, 1.0D, 1.0D)); double d2 = d1; for (Object o : list) { Entity entity = (Entity) o; if (entity.canBeCollidedWith()) { double f2 = entity.getCollisionBorderSize(); AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expand(f2, f2, f2); MovingObjectPosition movingobjectposition = axisalignedbb.calculateIntercept(vec3, vec32); if (axisalignedbb.isVecInside(vec3)) { if (d2 >= 0.0D) { pointedEntity = entity; vec33 = movingobjectposition == null ? vec3 : movingobjectposition.hitVec; d2 = 0.0D; } } else if (movingobjectposition != null) { double d3 = vec3.distanceTo(movingobjectposition.hitVec); if (d3 < d2 d2 == 0.0D) { if (entity == entity.ridingEntity && !entity.canRiderInteract()) { if (d2 == 0.0D) { pointedEntity = entity; vec33 = movingobjectposition.hitVec; } } else { pointedEntity = entity; vec33 = movingobjectposition.hitVec; d2 = d3; } } } } } if (pointedEntity != null && (d2 < d1 objectMouseOver == null)) { objectMouseOver = new MovingObjectPosition(pointedEntity, vec33); } return objectMouseOver; } } return null; } | /**
* Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime
*/ | Finds what block or object the mouse is over at the specified partial tick time. Args: partialTickTime | getMouseOver | {
"repo_name": "nalimleinad/Battlegear2",
"path": "battlegear mod src/minecraft/mods/battlegear2/client/ClientProxy.java",
"license": "gpl-3.0",
"size": 14994
} | [
"java.util.List",
"net.minecraft.client.Minecraft",
"net.minecraft.entity.Entity",
"net.minecraft.util.AxisAlignedBB",
"net.minecraft.util.MovingObjectPosition",
"net.minecraft.util.Vec3",
"net.minecraftforge.fml.client.FMLClientHandler"
] | import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraftforge.fml.client.FMLClientHandler; | import java.util.*; import net.minecraft.client.*; import net.minecraft.entity.*; import net.minecraft.util.*; import net.minecraftforge.fml.client.*; | [
"java.util",
"net.minecraft.client",
"net.minecraft.entity",
"net.minecraft.util",
"net.minecraftforge.fml"
] | java.util; net.minecraft.client; net.minecraft.entity; net.minecraft.util; net.minecraftforge.fml; | 2,856,591 |
private void setDropInsertionPredecessor(final Operator closestLeftNeighbour) {
dropInsertionPredecessor = closestLeftNeighbour;
if (dropInsertionPredecessor != null) {
controller.showStatus("Operator will be inserted after " + dropInsertionPredecessor);
} else {
controller.showStatus("Operator will be inserted as the last operator in this process.");
}
} | void function(final Operator closestLeftNeighbour) { dropInsertionPredecessor = closestLeftNeighbour; if (dropInsertionPredecessor != null) { controller.showStatus(STR + dropInsertionPredecessor); } else { controller.showStatus(STR); } } | /**
* Set the operator which were to become the direct predecessor of the dropped operator if it
* was dropped now.
*
* @param closestLeftNeighbour
* the predecessor
*/ | Set the operator which were to become the direct predecessor of the dropped operator if it was dropped now | setDropInsertionPredecessor | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/flow/processrendering/view/ProcessRendererTransferHandler.java",
"license": "agpl-3.0",
"size": 16019
} | [
"com.rapidminer.operator.Operator"
] | import com.rapidminer.operator.Operator; | import com.rapidminer.operator.*; | [
"com.rapidminer.operator"
] | com.rapidminer.operator; | 1,171,196 |
public static void skipFully(InputStream in, long n) throws IOException {
long skipped = skipUpTo(in, n);
if (skipped < n) {
throw new EOFException(
"reached end of stream after skipping " + skipped + " bytes; " + n + " bytes expected");
}
} | static void function(InputStream in, long n) throws IOException { long skipped = skipUpTo(in, n); if (skipped < n) { throw new EOFException( STR + skipped + STR + n + STR); } } | /**
* Discards {@code n} bytes of data from the input stream. This method will block until the full
* amount has been skipped. Does not close the stream.
*
* @param in the input stream to read from
* @param n the number of bytes to skip
* @throws EOFException if this stream reaches the end before skipping all the bytes
* @throws IOException if an I/O error occurs, or the stream does not support skipping
*/ | Discards n bytes of data from the input stream. This method will block until the full amount has been skipped. Does not close the stream | skipFully | {
"repo_name": "DavesMan/guava",
"path": "guava/src/com/google/common/io/ByteStreams.java",
"license": "apache-2.0",
"size": 26779
} | [
"java.io.EOFException",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.EOFException; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 63,394 |
public static int toIntUnsafe(byte[] bytes, int offset) {
if (UnsafeComparer.littleEndian) {
return Integer.reverseBytes(UnsafeComparer.theUnsafe.getInt(bytes,
(long) offset + UnsafeComparer.BYTE_ARRAY_BASE_OFFSET));
} else {
return UnsafeComparer.theUnsafe.getInt(bytes,
(long) offset + UnsafeComparer.BYTE_ARRAY_BASE_OFFSET);
}
} | static int function(byte[] bytes, int offset) { if (UnsafeComparer.littleEndian) { return Integer.reverseBytes(UnsafeComparer.theUnsafe.getInt(bytes, (long) offset + UnsafeComparer.BYTE_ARRAY_BASE_OFFSET)); } else { return UnsafeComparer.theUnsafe.getInt(bytes, (long) offset + UnsafeComparer.BYTE_ARRAY_BASE_OFFSET); } } | /**
* Converts a byte array to an int value (Unsafe version)
* @param bytes byte array
* @param offset offset into array
* @return the int value
*/ | Converts a byte array to an int value (Unsafe version) | toIntUnsafe | {
"repo_name": "ibmsoe/hbase",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/Bytes.java",
"license": "apache-2.0",
"size": 73824
} | [
"org.apache.hadoop.hbase.util.Bytes"
] | import org.apache.hadoop.hbase.util.Bytes; | import org.apache.hadoop.hbase.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,785,842 |
public static void writeByteArray(DataOutput par0DataOutput, byte[] par1ArrayOfByte) throws IOException {
par0DataOutput.writeShort(par1ArrayOfByte.length);
par0DataOutput.write(par1ArrayOfByte);
} | static void function(DataOutput par0DataOutput, byte[] par1ArrayOfByte) throws IOException { par0DataOutput.writeShort(par1ArrayOfByte.length); par0DataOutput.write(par1ArrayOfByte); } | /**
* Writes a byte array to the DataOutputStream
*/ | Writes a byte array to the DataOutputStream | writeByteArray | {
"repo_name": "DirectCodeGraveyard/Minetweak",
"path": "src/main/java/net/minecraft/server/network/packet/Packet.java",
"license": "lgpl-3.0",
"size": 16493
} | [
"java.io.DataOutput",
"java.io.IOException"
] | import java.io.DataOutput; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,653,299 |
public static PrivateKey privateToExplicitParameters(PrivateKey key, String providerName)
throws IllegalArgumentException, NoSuchAlgorithmException, NoSuchProviderException
{
Provider provider = Security.getProvider(providerName);
if (provider == null)
{
throw new NoSuchProviderException("cannot find provider: " + providerName);
}
return privateToExplicitParameters(key, provider);
} | static PrivateKey function(PrivateKey key, String providerName) throws IllegalArgumentException, NoSuchAlgorithmException, NoSuchProviderException { Provider provider = Security.getProvider(providerName); if (provider == null) { throw new NoSuchProviderException(STR + providerName); } return privateToExplicitParameters(key, provider); } | /**
* Convert a passed in private EC key to have explicit parameters. If the key
* is already using explicit parameters it is returned.
*
* @param key key to be converted
* @param providerName provider name to be used.
* @return the equivalent key with explicit curve parameters
* @throws IllegalArgumentException
* @throws NoSuchAlgorithmException
* @throws NoSuchProviderException
*/ | Convert a passed in private EC key to have explicit parameters. If the key is already using explicit parameters it is returned | privateToExplicitParameters | {
"repo_name": "bullda/DroidText",
"path": "src/bouncycastle/repack/org/bouncycastle/jce/ECKeyUtil.java",
"license": "lgpl-3.0",
"size": 8819
} | [
"java.security.NoSuchAlgorithmException",
"java.security.NoSuchProviderException",
"java.security.PrivateKey",
"java.security.Provider",
"java.security.Security"
] | import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.PrivateKey; import java.security.Provider; import java.security.Security; | import java.security.*; | [
"java.security"
] | java.security; | 2,257,036 |
public ConfigurationManager getConfigurationManager( ) {
return this.getFacility( ConfigurationManager.class );
}
| ConfigurationManager function( ) { return this.getFacility( ConfigurationManager.class ); } | /**
* Returns the configuration manager used by the service.
* The configuration manager is used to get retrieve
* configuration.
* @return the configuration manager used by the service
*/ | Returns the configuration manager used by the service. The configuration manager is used to get retrieve configuration | getConfigurationManager | {
"repo_name": "Talvish/Tales",
"path": "product/services/src/com/talvish/tales/services/Service.java",
"license": "apache-2.0",
"size": 43265
} | [
"com.talvish.tales.system.configuration.ConfigurationManager"
] | import com.talvish.tales.system.configuration.ConfigurationManager; | import com.talvish.tales.system.configuration.*; | [
"com.talvish.tales"
] | com.talvish.tales; | 1,280,597 |
public void testFindSecondaryType_Exist01() throws JavaModelException, CoreException {
int length = SF_LENGTH - 1;
assertTypeFound(
"org.eclipse.jdt.core.test"+length+".Foo",
"Foo [in Foo.java [in org.eclipse.jdt.core.test"+length+" [in src"+length+" [in TestProject]]]]"
);
} | void function() throws JavaModelException, CoreException { int length = SF_LENGTH - 1; assertTypeFound( STR+length+".Foo", STR+length+STR+length+STR ); } | /**
* Bug 36032: JavaProject.findType() fails to find second type in source file
* @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=36032"
*/ | Bug 36032: JavaProject.findType() fails to find second type in source file | testFindSecondaryType_Exist01 | {
"repo_name": "Niky4000/UsefulUtils",
"path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClassNameTests.java",
"license": "gpl-3.0",
"size": 30472
} | [
"org.eclipse.core.runtime.CoreException",
"org.eclipse.jdt.core.JavaModelException"
] | import org.eclipse.core.runtime.CoreException; import org.eclipse.jdt.core.JavaModelException; | import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; | [
"org.eclipse.core",
"org.eclipse.jdt"
] | org.eclipse.core; org.eclipse.jdt; | 2,586,480 |
protected void initTransformService() {
if (getTransformationService() != null || StringUtils.isBlank(getTransformationServiceName())) {
return;
}
BundleContext context = MqttActivator.getContext();
transformationService =
TransformationHelper.getTransformationService(context, getTransformationServiceName());
if (transformationService == null) {
logger.debug("No transformation service found for {}", getTransformationServiceName());
}
} | void function() { if (getTransformationService() != null StringUtils.isBlank(getTransformationServiceName())) { return; } BundleContext context = MqttActivator.getContext(); transformationService = TransformationHelper.getTransformationService(context, getTransformationServiceName()); if (transformationService == null) { logger.debug(STR, getTransformationServiceName()); } } | /**
* Start transformation service.
*/ | Start transformation service | initTransformService | {
"repo_name": "Greblys/openhab",
"path": "bundles/binding/org.openhab.binding.mqtt/src/main/java/org/openhab/binding/mqtt/internal/AbstractMqttMessagePubSub.java",
"license": "epl-1.0",
"size": 5447
} | [
"org.apache.commons.lang.StringUtils",
"org.openhab.core.transform.TransformationHelper",
"org.osgi.framework.BundleContext"
] | import org.apache.commons.lang.StringUtils; import org.openhab.core.transform.TransformationHelper; import org.osgi.framework.BundleContext; | import org.apache.commons.lang.*; import org.openhab.core.transform.*; import org.osgi.framework.*; | [
"org.apache.commons",
"org.openhab.core",
"org.osgi.framework"
] | org.apache.commons; org.openhab.core; org.osgi.framework; | 342,489 |
public void deleteLocations(Event event) throws LocationException {
Log.e(LOG_NAME, "Deleting locations for event " + event.getName());
try {
QueryBuilder<Location, Long> qb = locationDao.queryBuilder();
qb.where().eq("event_id", event.getId());
List<Location> locations = qb.query();
delete(locations);
} catch (SQLException sqle) {
Log.e(LOG_NAME, "Unable to delete locations for an event", sqle);
throw new LocationException("Unable to delete locations for an event", sqle);
}
} | void function(Event event) throws LocationException { Log.e(LOG_NAME, STR + event.getName()); try { QueryBuilder<Location, Long> qb = locationDao.queryBuilder(); qb.where().eq(STR, event.getId()); List<Location> locations = qb.query(); delete(locations); } catch (SQLException sqle) { Log.e(LOG_NAME, STR, sqle); throw new LocationException(STR, sqle); } } | /**
* This will delete all locations for an event.
*
* @param event
* The event to remove locations for
* @throws LocationException
*/ | This will delete all locations for an event | deleteLocations | {
"repo_name": "ngageoint/mage-android",
"path": "mage/src/main/java/mil/nga/giat/mage/sdk/datastore/location/LocationHelper.java",
"license": "apache-2.0",
"size": 11750
} | [
"android.util.Log",
"com.j256.ormlite.stmt.QueryBuilder",
"java.sql.SQLException",
"java.util.List",
"mil.nga.giat.mage.sdk.datastore.user.Event",
"mil.nga.giat.mage.sdk.exceptions.LocationException"
] | import android.util.Log; import com.j256.ormlite.stmt.QueryBuilder; import java.sql.SQLException; import java.util.List; import mil.nga.giat.mage.sdk.datastore.user.Event; import mil.nga.giat.mage.sdk.exceptions.LocationException; | import android.util.*; import com.j256.ormlite.stmt.*; import java.sql.*; import java.util.*; import mil.nga.giat.mage.sdk.datastore.user.*; import mil.nga.giat.mage.sdk.exceptions.*; | [
"android.util",
"com.j256.ormlite",
"java.sql",
"java.util",
"mil.nga.giat"
] | android.util; com.j256.ormlite; java.sql; java.util; mil.nga.giat; | 2,154,917 |
public ResultSetFuture executeAsyncSelect (
Object indexkey) throws Exception {
return
this.getQuery(kSelectName).executeAsync(
indexkey);
} | ResultSetFuture function ( Object indexkey) throws Exception { return this.getQuery(kSelectName).executeAsync( indexkey); } | /**
* executeAsyncSelect
* executes Select Query asynchronously
* @param indexkey
* @return ResultSetFuture
* @throws Exception
*/ | executeAsyncSelect executes Select Query asynchronously | executeAsyncSelect | {
"repo_name": "vangav/vos_geo_server",
"path": "app/com/vangav/vos_geo_server/cassandra_keyspaces/gs_top/NameIndex.java",
"license": "mit",
"size": 12531
} | [
"com.datastax.driver.core.ResultSetFuture"
] | import com.datastax.driver.core.ResultSetFuture; | import com.datastax.driver.core.*; | [
"com.datastax.driver"
] | com.datastax.driver; | 1,596,947 |
public void setLastUpdatedDateFormat(SimpleDateFormat lastUpdatedDateFormat){
this.lastUpdatedDateFormat = lastUpdatedDateFormat;
} | void function(SimpleDateFormat lastUpdatedDateFormat){ this.lastUpdatedDateFormat = lastUpdatedDateFormat; } | /**
* Default: "dd/MM HH:mm". Set the format in which the last-updated
* date/time is shown. Meaningless if 'showLastUpdatedText == false (default)'.
* See 'setShowLastUpdatedText'.
*
* @param lastUpdatedDateFormat
*/ | date/time is shown. Meaningless if 'showLastUpdatedText == false (default)'. See 'setShowLastUpdatedText' | setLastUpdatedDateFormat | {
"repo_name": "OnecloudVideo/android-demo",
"path": "src/com/pispower/util/PullRefreshListView.java",
"license": "apache-2.0",
"size": 19561
} | [
"java.text.SimpleDateFormat"
] | import java.text.SimpleDateFormat; | import java.text.*; | [
"java.text"
] | java.text; | 1,547,822 |
@IgniteSpiConfiguration(optional = true)
public JdbcCheckpointSpi setValueFieldType(String valType) {
this.valType = valType;
return this;
} | @IgniteSpiConfiguration(optional = true) JdbcCheckpointSpi function(String valType) { this.valType = valType; return this; } | /**
* Sets checkpoint value field type. Note, that the field should have corresponding
* SQL {@code BLOB} type, and the default value of {@link #DFLT_VALUE_FIELD_TYPE}, which is
* {@code BLOB}, won't work for all databases. For example, if using {@code HSQL DB},
* then the type should be {@code longvarbinary}.
*
* @param valType Checkpoint value field type to set.
* @return {@code this} for chaining.
*/ | Sets checkpoint value field type. Note, that the field should have corresponding SQL BLOB type, and the default value of <code>#DFLT_VALUE_FIELD_TYPE</code>, which is BLOB, won't work for all databases. For example, if using HSQL DB, then the type should be longvarbinary | setValueFieldType | {
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/checkpoint/jdbc/JdbcCheckpointSpi.java",
"license": "apache-2.0",
"size": 32338
} | [
"org.apache.ignite.spi.IgniteSpiConfiguration"
] | import org.apache.ignite.spi.IgniteSpiConfiguration; | import org.apache.ignite.spi.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,107,589 |
protected Collection<IAction> generateCreateChildActions(Collection<?> descriptors, ISelection selection) {
Collection<IAction> actions = new ArrayList<IAction>();
if (descriptors != null) {
for (Object descriptor : descriptors) {
actions.add(new CreateChildAction(activeEditorPart, selection, descriptor));
}
}
return actions;
}
| Collection<IAction> function(Collection<?> descriptors, ISelection selection) { Collection<IAction> actions = new ArrayList<IAction>(); if (descriptors != null) { for (Object descriptor : descriptors) { actions.add(new CreateChildAction(activeEditorPart, selection, descriptor)); } } return actions; } | /**
* This generates a {@link org.eclipse.emf.edit.ui.action.CreateChildAction} for each object in <code>descriptors</code>,
* and returns the collection of these actions.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This generates a <code>org.eclipse.emf.edit.ui.action.CreateChildAction</code> for each object in <code>descriptors</code>, and returns the collection of these actions. | generateCreateChildActions | {
"repo_name": "openmapsoftware/mappingtools",
"path": "openmap-mapper-editor/src/main/java/com/openMap1/mapper/presentation/MapperActionBarContributor.java",
"license": "epl-1.0",
"size": 18085
} | [
"java.util.ArrayList",
"java.util.Collection",
"org.eclipse.emf.edit.ui.action.CreateChildAction",
"org.eclipse.jface.action.IAction",
"org.eclipse.jface.viewers.ISelection"
] | import java.util.ArrayList; import java.util.Collection; import org.eclipse.emf.edit.ui.action.CreateChildAction; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; | import java.util.*; import org.eclipse.emf.edit.ui.action.*; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.jface"
] | java.util; org.eclipse.emf; org.eclipse.jface; | 135,397 |
public void setContent (InputStream contentStream, long contentLength) {
this.contentStream = contentStream;
this.contentLength = contentLength;
}
| void function (InputStream contentStream, long contentLength) { this.contentStream = contentStream; this.contentLength = contentLength; } | /** Sets the content as a stream to be used for a POST for example, to transmit custom data.
* @param contentStream The stream with the content data. */ | Sets the content as a stream to be used for a POST for example, to transmit custom data | setContent | {
"repo_name": "azakhary/libgdx",
"path": "gdx/src/com/badlogic/gdx/Net.java",
"license": "apache-2.0",
"size": 14693
} | [
"java.io.InputStream"
] | import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,836,110 |
public Set<String> getIpBans(); | Set<String> function(); | /**
* Returns a string set of currently banned addresses
*
* @return
*/ | Returns a string set of currently banned addresses | getIpBans | {
"repo_name": "karlthepagan/Glowstone",
"path": "src/main/java/net/glowstone/util/bans/BanManager.java",
"license": "mit",
"size": 1839
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 331,051 |
@Query("select new "
+ "org.helianto.user.repository.UserReadAdapter"
+ "(user.id"
+ ", user.entity.operator.id"
+ ", user.entity.id"
+ ", user.entity.alias"
+ ", user.identity.id"
+ ", user.userKey"
+ ", user.userName"
+ ", user.userState"
+ ") "
+ "from User user "
+ "where user.identity.id = ?1 "
+ "and user.class = 'U' "
+ "and user.userState = 'A' "
+ "order by user.lastEvent DESC ")
List<UserReadAdapter> findByIdentityIdOrderByLastEventDesc(int identityId); | @Query(STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR + STR) List<UserReadAdapter> findByIdentityIdOrderByLastEventDesc(int identityId); | /**
* Find by identity id.
*
* @param identityId
* @return
*/ | Find by identity id | findByIdentityIdOrderByLastEventDesc | {
"repo_name": "eldevanjr/helianto",
"path": "helianto-core/src/main/java/org/helianto/user/repository/UserGroupRepository.java",
"license": "apache-2.0",
"size": 5976
} | [
"java.util.List",
"org.springframework.data.jpa.repository.Query"
] | import java.util.List; import org.springframework.data.jpa.repository.Query; | import java.util.*; import org.springframework.data.jpa.repository.*; | [
"java.util",
"org.springframework.data"
] | java.util; org.springframework.data; | 954,393 |
static String opToStr(int operator) {
switch (operator) {
case Token.BITOR: return "|";
case Token.OR: return "||";
case Token.BITXOR: return "^";
case Token.AND: return "&&";
case Token.BITAND: return "&";
case Token.SHEQ: return "===";
case Token.EQ: return "==";
case Token.NOT: return "!";
case Token.NE: return "!=";
case Token.SHNE: return "!==";
case Token.LSH: return "<<";
case Token.IN: return "in";
case Token.LE: return "<=";
case Token.LT: return "<";
case Token.URSH: return ">>>";
case Token.RSH: return ">>";
case Token.GE: return ">=";
case Token.GT: return ">";
case Token.MUL: return "*";
case Token.DIV: return "/";
case Token.MOD: return "%";
case Token.BITNOT: return "~";
case Token.ADD: return "+";
case Token.SUB: return "-";
case Token.POS: return "+";
case Token.NEG: return "-";
case Token.ASSIGN: return "=";
case Token.ASSIGN_BITOR: return "|=";
case Token.ASSIGN_BITXOR: return "^=";
case Token.ASSIGN_BITAND: return "&=";
case Token.ASSIGN_LSH: return "<<=";
case Token.ASSIGN_RSH: return ">>=";
case Token.ASSIGN_URSH: return ">>>=";
case Token.ASSIGN_ADD: return "+=";
case Token.ASSIGN_SUB: return "-=";
case Token.ASSIGN_MUL: return "*=";
case Token.ASSIGN_DIV: return "/=";
case Token.ASSIGN_MOD: return "%=";
case Token.VOID: return "void";
case Token.TYPEOF: return "typeof";
case Token.INSTANCEOF: return "instanceof";
default: return null;
}
} | static String opToStr(int operator) { switch (operator) { case Token.BITOR: return " "; case Token.OR: return " "; case Token.BITXOR: return "^"; case Token.AND: return "&&"; case Token.BITAND: return "&"; case Token.SHEQ: return "==="; case Token.EQ: return "=="; case Token.NOT: return "!"; case Token.NE: return "!="; case Token.SHNE: return "!=="; case Token.LSH: return "<<"; case Token.IN: return "in"; case Token.LE: return "<="; case Token.LT: return "<"; case Token.URSH: return ">>>"; case Token.RSH: return ">>"; case Token.GE: return ">="; case Token.GT: return ">"; case Token.MUL: return "*"; case Token.DIV: return "/"; case Token.MOD: return "%"; case Token.BITNOT: return "~"; case Token.ADD: return "+"; case Token.SUB: return "-"; case Token.POS: return "+"; case Token.NEG: return "-"; case Token.ASSIGN: return "="; case Token.ASSIGN_BITOR: return STR; case Token.ASSIGN_BITXOR: return "^="; case Token.ASSIGN_BITAND: return "&="; case Token.ASSIGN_LSH: return "<<="; case Token.ASSIGN_RSH: return ">>="; case Token.ASSIGN_URSH: return ">>>="; case Token.ASSIGN_ADD: return "+="; case Token.ASSIGN_SUB: return "-="; case Token.ASSIGN_MUL: return "*="; case Token.ASSIGN_DIV: return "/="; case Token.ASSIGN_MOD: return "%="; case Token.VOID: return "void"; case Token.TYPEOF: return STR; case Token.INSTANCEOF: return STR; default: return null; } } | /**
* Converts an operator's token value (see {@link Token}) to a string
* representation.
*
* @param operator the operator's token value to convert
* @return the string representation or {@code null} if the token value is
* not an operator
*/ | Converts an operator's token value (see <code>Token</code>) to a string representation | opToStr | {
"repo_name": "007slm/kissy",
"path": "tools/module-compiler/src/com/google/javascript/jscomp/NodeUtil.java",
"license": "mit",
"size": 77263
} | [
"com.google.javascript.rhino.Token"
] | import com.google.javascript.rhino.Token; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,186,549 |
public Enumeration<byte[]> getIds(); | Enumeration<byte[]> function(); | /**
* Returns an Enumeration of all known session id's grouped under this
* <code>SSLSessionContext</code>.
* <p>Session contexts may not contain all sessions. For example,
* stateless sessions are not stored in the session context.
*
* @return an enumeration of all the Session id's
*/ | Returns an Enumeration of all known session id's grouped under this <code>SSLSessionContext</code>. Session contexts may not contain all sessions. For example, stateless sessions are not stored in the session context | getIds | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/javax/net/ssl/SSLSessionContext.java",
"license": "apache-2.0",
"size": 6950
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 632,550 |
public boolean isNewerThan(Timestamp other) {
return timestamp.isNewerThan(other);
} | boolean function(Timestamp other) { return timestamp.isNewerThan(other); } | /**
* Tests if this timestamp is newer than the specified timestamp.
*
* @param other timestamp to compare against
* @return true if this instance is newer
*/ | Tests if this timestamp is newer than the specified timestamp | isNewerThan | {
"repo_name": "gkatsikas/onos",
"path": "core/store/dist/src/main/java/org/onosproject/store/impl/Timestamped.java",
"license": "apache-2.0",
"size": 3014
} | [
"org.onosproject.store.Timestamp"
] | import org.onosproject.store.Timestamp; | import org.onosproject.store.*; | [
"org.onosproject.store"
] | org.onosproject.store; | 1,875,189 |
protected native void addHeaderCells(Element tHead, int row, int num);
| native void function(Element tHead, int row, int num); | /**
* This native method is used to create TH tags instead of TD tags.
*
* @param tHead is a grid thead element.
* @param row is the index of the TR element
* @param num is a number of columns to create.
*/ | This native method is used to create TH tags instead of TD tags | addHeaderCells | {
"repo_name": "witterk/thai-accounting",
"path": "src/gwt/client/ui/CustomFlexTable.java",
"license": "mit",
"size": 4716
} | [
"com.google.gwt.user.client.Element"
] | import com.google.gwt.user.client.Element; | import com.google.gwt.user.client.*; | [
"com.google.gwt"
] | com.google.gwt; | 644,136 |
public ValidationResult validateWithResult(String theResource) {
Validate.notNull(theResource, "theResource must not be null");
IValidationContext<IBaseResource> ctx = ValidationContext.forText(myContext, theResource);
for (IValidatorModule next : myValidators) {
next.validateResource(ctx);
}
return ctx.toResult();
} | ValidationResult function(String theResource) { Validate.notNull(theResource, STR); IValidationContext<IBaseResource> ctx = ValidationContext.forText(myContext, theResource); for (IValidatorModule next : myValidators) { next.validateResource(ctx); } return ctx.toResult(); } | /**
* Validates a resource instance returning a {@link ca.uhn.fhir.validation.ValidationResult} which contains the results.
*
* @param theResource
* the resource to validate
* @return the results of validation
* @since 1.1
*/ | Validates a resource instance returning a <code>ca.uhn.fhir.validation.ValidationResult</code> which contains the results | validateWithResult | {
"repo_name": "lcamilo15/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java",
"license": "apache-2.0",
"size": 9818
} | [
"org.apache.commons.lang3.Validate",
"org.hl7.fhir.instance.model.api.IBaseResource"
] | import org.apache.commons.lang3.Validate; import org.hl7.fhir.instance.model.api.IBaseResource; | import org.apache.commons.lang3.*; import org.hl7.fhir.instance.model.api.*; | [
"org.apache.commons",
"org.hl7.fhir"
] | org.apache.commons; org.hl7.fhir; | 2,224,684 |
protected void emit_XBlockExpression_SemicolonKeyword_2_1_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) {
acceptNodes(transition, nodes);
}
| void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); } | /**
* Ambiguous syntax:
* ';'?
*
* This ambiguous syntax occurs at:
* expressions+=XExpressionOrVarDeclaration (ambiguity) '}' ')' (rule end)
* expressions+=XExpressionOrVarDeclaration (ambiguity) '}' (rule end)
* expressions+=XExpressionOrVarDeclaration (ambiguity) expressions+=XExpressionOrVarDeclaration
*/ | Ambiguous syntax: ';'? This ambiguous syntax occurs at: expressions+=XExpressionOrVarDeclaration (ambiguity) '}' ')' (rule end) expressions+=XExpressionOrVarDeclaration (ambiguity) '}' (rule end) expressions+=XExpressionOrVarDeclaration (ambiguity) expressions+=XExpressionOrVarDeclaration | emit_XBlockExpression_SemicolonKeyword_2_1_q | {
"repo_name": "LorenzoBettini/packtpub-xtext-book-examples",
"path": "org.example.xbase.expressions/src-gen/org/example/xbase/expressions/serializer/ExpressionsSyntacticSequencer.java",
"license": "epl-1.0",
"size": 13211
} | [
"java.util.List",
"org.eclipse.emf.ecore.EObject",
"org.eclipse.xtext.nodemodel.INode",
"org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider"
] | import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider; | import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*; | [
"java.util",
"org.eclipse.emf",
"org.eclipse.xtext"
] | java.util; org.eclipse.emf; org.eclipse.xtext; | 1,421,991 |
public ImmutableList<String> allArguments()
throws CommandLineExpansionException, InterruptedException {
ImmutableList.Builder<String> arguments = ImmutableList.builder();
for (CommandLineAndParamFileInfo pair : getCommandLines()) {
arguments.addAll(pair.commandLine.arguments());
}
return arguments.build();
} | ImmutableList<String> function() throws CommandLineExpansionException, InterruptedException { ImmutableList.Builder<String> arguments = ImmutableList.builder(); for (CommandLineAndParamFileInfo pair : getCommandLines()) { arguments.addAll(pair.commandLine.arguments()); } return arguments.build(); } | /**
* Returns all arguments, including ones inside of param files.
*
* <p>Suitable for debugging and printing messages to users. This expands all command lines, so it
* is potentially expensive.
*/ | Returns all arguments, including ones inside of param files. Suitable for debugging and printing messages to users. This expands all command lines, so it is potentially expensive | allArguments | {
"repo_name": "perezd/bazel",
"path": "src/main/java/com/google/devtools/build/lib/actions/CommandLines.java",
"license": "apache-2.0",
"size": 16480
} | [
"com.google.common.collect.ImmutableList"
] | import com.google.common.collect.ImmutableList; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,673,884 |
public void restartHBaseCluster(int servers) throws IOException, InterruptedException {
if(connection != null){
connection.close();
connection = null;
}
this.hbaseCluster = new MiniHBaseCluster(this.conf, servers);
// Don't leave here till we've done a successful scan of the hbase:meta
Table t = new HTable(new Configuration(this.conf), TableName.META_TABLE_NAME);
ResultScanner s = t.getScanner(new Scan());
while (s.next() != null) {
// do nothing
}
LOG.info("HBase has been restarted");
s.close();
t.close();
} | void function(int servers) throws IOException, InterruptedException { if(connection != null){ connection.close(); connection = null; } this.hbaseCluster = new MiniHBaseCluster(this.conf, servers); Table t = new HTable(new Configuration(this.conf), TableName.META_TABLE_NAME); ResultScanner s = t.getScanner(new Scan()); while (s.next() != null) { } LOG.info(STR); s.close(); t.close(); } | /**
* Starts the hbase cluster up again after shutting it down previously in a
* test. Use this if you want to keep dfs/zk up and just stop/start hbase.
* @param servers number of region servers
* @throws IOException
*/ | Starts the hbase cluster up again after shutting it down previously in a test. Use this if you want to keep dfs/zk up and just stop/start hbase | restartHBaseCluster | {
"repo_name": "StackVista/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 142672
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.client.HTable",
"org.apache.hadoop.hbase.client.ResultScanner",
"org.apache.hadoop.hbase.client.Scan",
"org.apache.hadoop.hbase.client.Table"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.ResultScanner; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Table; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.client.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,238,555 |
private void write(int sectorNumber, byte[] data, int length) throws IOException
{
this.dataFile.seek((long)(sectorNumber * 4096));
this.dataFile.writeInt(length + 1);
this.dataFile.writeByte(2);
this.dataFile.write(data, 0, length);
} | void function(int sectorNumber, byte[] data, int length) throws IOException { this.dataFile.seek((long)(sectorNumber * 4096)); this.dataFile.writeInt(length + 1); this.dataFile.writeByte(2); this.dataFile.write(data, 0, length); } | /**
* args: sectorNumber, data, length - write the chunk data to this RegionFile
*/ | args: sectorNumber, data, length - write the chunk data to this RegionFile | write | {
"repo_name": "tomtomtom09/CampCraft",
"path": "build/tmp/recompileMc/sources/net/minecraft/world/chunk/storage/RegionFile.java",
"license": "gpl-3.0",
"size": 11666
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,305,085 |
@Deprecated
public void setStartTime(final Calendar startTime) {
this.startTime = startTime;
} | void function(final Calendar startTime) { this.startTime = startTime; } | /**
* Sets Start Time.
* <p>
* A UTCTime field to denote the time at which the value becomes valid. The value remains
* valid until replaced by a newer one.
*
* @param startTime the Start Time
* @deprecated as of 1.3.0. Use the parameterised constructor instead to ensure that all mandatory fields are provided.
*/ | Sets Start Time. A UTCTime field to denote the time at which the value becomes valid. The value remains valid until replaced by a newer one | setStartTime | {
"repo_name": "zsmartsystems/com.zsmartsystems.zigbee",
"path": "com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/price/PublishConversionFactorCommand.java",
"license": "epl-1.0",
"size": 8126
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,506,004 |
public ServiceFuture<Void> beginDeleteAsync(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName), serviceCallback); } | /**
* Deletes the specified load balancer inbound nat rule.
*
* @param resourceGroupName The name of the resource group.
* @param loadBalancerName The name of the load balancer.
* @param inboundNatRuleName The name of the inbound nat rule.
* @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 load balancer inbound nat rule | beginDeleteAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/InboundNatRulesInner.java",
"license": "mit",
"size": 51227
} | [
"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,608,732 |
public boolean needsInserting(Object entry, int i, Type elemType); | boolean function(Object entry, int i, Type elemType); | /**
* Do we need to insert this element?
*
* @param entry The collection element to check
* @param i The index (for indexed collections)
* @param elemType The type for the element
*
* @return {@code true} if the element needs inserting
*/ | Do we need to insert this element | needsInserting | {
"repo_name": "kevin-chen-hw/LDAE",
"path": "com.huawei.soa.ldae/src/main/java/org/hibernate/collection/spi/PersistentCollection.java",
"license": "lgpl-2.1",
"size": 13745
} | [
"org.hibernate.type.Type"
] | import org.hibernate.type.Type; | import org.hibernate.type.*; | [
"org.hibernate.type"
] | org.hibernate.type; | 1,286,548 |
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
Builder builder = Settings.settingsBuilder();
builder.put("path.home", "target/data");
node = new NodeBuilder().settings(builder).node();
} | static void function() throws Exception { Builder builder = Settings.settingsBuilder(); builder.put(STR, STR); node = new NodeBuilder().settings(builder).node(); } | /**
* Sets the up before class.
*
* @throws Exception
* the exception
*/ | Sets the up before class | setUpBeforeClass | {
"repo_name": "impetus-opensource/Kundera",
"path": "src/kundera-redis/src/test/java/com/impetus/client/RedisESIndexerTest.java",
"license": "apache-2.0",
"size": 17081
} | [
"org.elasticsearch.common.settings.Settings",
"org.elasticsearch.node.NodeBuilder"
] | import org.elasticsearch.common.settings.Settings; import org.elasticsearch.node.NodeBuilder; | import org.elasticsearch.common.settings.*; import org.elasticsearch.node.*; | [
"org.elasticsearch.common",
"org.elasticsearch.node"
] | org.elasticsearch.common; org.elasticsearch.node; | 586,303 |
private void declareAndRunFunction( String name, String returnType, String[] argTypes, String args, String result )
throws Exception
{
Connection conn = getConnection();
declareFunction( conn, name, returnType, argTypes );
runFunction( conn, name, args, result, null );
} | void function( String name, String returnType, String[] argTypes, String args, String result ) throws Exception { Connection conn = getConnection(); declareFunction( conn, name, returnType, argTypes ); runFunction( conn, name, args, result, null ); } | /**
* <p>
* Declare and run a function.
* </p>
*/ | Declare and run a function. | declareAndRunFunction | {
"repo_name": "splicemachine/spliceengine",
"path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/lang/AnsiSignaturesTest.java",
"license": "agpl-3.0",
"size": 31771
} | [
"java.sql.Connection"
] | import java.sql.Connection; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,867,262 |
RelDataType createSqlIntervalType(
SqlIntervalQualifier intervalQualifier);
/**
* Infers the return type of a decimal multiplication. Decimal
* multiplication involves at least one decimal operand and requires both
* operands to have exact numeric types.
*
* @param type1 type of the first operand
* @param type2 type of the second operand
* @return the result type for a decimal multiplication, or null if decimal
* multiplication should not be applied to the operands.
* @deprecated Use
* {@link RelDataTypeSystem#deriveDecimalMultiplyType(RelDataTypeFactory, RelDataType, RelDataType)} | RelDataType createSqlIntervalType( SqlIntervalQualifier intervalQualifier); /** * Infers the return type of a decimal multiplication. Decimal * multiplication involves at least one decimal operand and requires both * operands to have exact numeric types. * * @param type1 type of the first operand * @param type2 type of the second operand * @return the result type for a decimal multiplication, or null if decimal * multiplication should not be applied to the operands. * @deprecated Use * {@link RelDataTypeSystem#deriveDecimalMultiplyType(RelDataTypeFactory, RelDataType, RelDataType)} | /**
* Creates a SQL interval type.
*
* @param intervalQualifier contains information if it is a year-month or a
* day-time interval along with precision information
* @return canonical type descriptor
*/ | Creates a SQL interval type | createSqlIntervalType | {
"repo_name": "datametica/calcite",
"path": "core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactory.java",
"license": "apache-2.0",
"size": 19841
} | [
"org.apache.calcite.sql.SqlIntervalQualifier"
] | import org.apache.calcite.sql.SqlIntervalQualifier; | import org.apache.calcite.sql.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 1,623,152 |
public final String getType() {
String type = JsUtils.getNativePropertyString(this, "type");
// hack to hide INTERNAL PUB. SYSTEM value
if (type != null && type.equals("empty")) return "";
return type;
} | final String function() { String type = JsUtils.getNativePropertyString(this, "type"); if (type != null && type.equals("empty")) return ""; return type; } | /**
* Get type of PublicationSystem (class of xml parser)
*
* @return full class name of xml parser
*/ | Get type of PublicationSystem (class of xml parser) | getType | {
"repo_name": "zlamalp/perun-wui",
"path": "perun-wui-core/src/main/java/cz/metacentrum/perun/wui/model/beans/PublicationSystem.java",
"license": "bsd-2-clause",
"size": 3920
} | [
"cz.metacentrum.perun.wui.client.utils.JsUtils"
] | import cz.metacentrum.perun.wui.client.utils.JsUtils; | import cz.metacentrum.perun.wui.client.utils.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 2,417,855 |
public void setWeekendType(WeekendType weekendType) {
JodaBeanUtils.notNull(weekendType, "weekendType");
this._weekendType = weekendType;
} | void function(WeekendType weekendType) { JodaBeanUtils.notNull(weekendType, STR); this._weekendType = weekendType; } | /**
* Sets the weekend type.
* @param weekendType the new value of the property, not null
*/ | Sets the weekend type | setWeekendType | {
"repo_name": "McLeodMoores/starling",
"path": "projects/core/src/main/java/com/opengamma/core/holiday/HolidayWithWeekendAdapter.java",
"license": "apache-2.0",
"size": 12672
} | [
"org.joda.beans.JodaBeanUtils"
] | import org.joda.beans.JodaBeanUtils; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 2,754,965 |
public float getAverageWidth() {
return dic.getFloat(COSName.AVG_WIDTH, 0);
} | float function() { return dic.getFloat(COSName.AVG_WIDTH, 0); } | /**
* This will get the average width for the font.
*
* @return The average width value.
*/ | This will get the average width for the font | getAverageWidth | {
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFontDescriptor.java",
"license": "apache-2.0",
"size": 18516
} | [
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 2,602,891 |
public RedisTransaction info(Handler<AsyncResult<String>> handler) {
delegate.info(handler);
return this;
} | RedisTransaction function(Handler<AsyncResult<String>> handler) { delegate.info(handler); return this; } | /**
* Get information and statistics about the server
* @param handler Handler for the result of this call.
* @return
*/ | Get information and statistics about the server | info | {
"repo_name": "brianjcj/vertx-redis-client",
"path": "src/main/generated/io/vertx/rxjava/redis/RedisTransaction.java",
"license": "apache-2.0",
"size": 184983
} | [
"io.vertx.core.AsyncResult",
"io.vertx.core.Handler"
] | import io.vertx.core.AsyncResult; import io.vertx.core.Handler; | import io.vertx.core.*; | [
"io.vertx.core"
] | io.vertx.core; | 638,575 |
protected Object getDropTarget(DropInformation drop) {
return null;
} | Object function(DropInformation drop) { return null; } | /**
* Gets the object being dropped on
*
* @param drop
* the drop information
* @return the object being dropped on
*/ | Gets the object being dropped on | getDropTarget | {
"repo_name": "appnativa/rare",
"path": "source/rare/core/com/appnativa/rare/widget/aWidget.java",
"license": "gpl-3.0",
"size": 150848
} | [
"com.appnativa.rare.ui.dnd.DropInformation"
] | import com.appnativa.rare.ui.dnd.DropInformation; | import com.appnativa.rare.ui.dnd.*; | [
"com.appnativa.rare"
] | com.appnativa.rare; | 1,640,480 |
private void cameraDropdownListenerHelper(StyledMenuButton buttons) {
// loop thourhgh all cameras for the active director block, when the list is shown
Set<Integer> indices = activeDirectorBlock.getTimelineIndices();
for (int i = 0; i < manager.getScriptingProject().getCameras().size(); i++) {
Camera camera = manager.getScriptingProject().getCameras().get(i);
// create and add checkbox for camera with on/off toggling loaded in.
StyledCheckbox checkbox = getStyledCheckbox(camera.getName(),
indices.contains(i));
activeCameraBoxes.add(checkbox);
CustomMenuItem item = new CustomMenuItem(checkbox);
item.setHideOnClick(false);
buttons.getItems().add(item);
// add event handler for mouse clicks on the checkbox
checkbox.setOnMouseClicked(createCameraDropdownHandler(checkbox, i));
}
} | void function(StyledMenuButton buttons) { Set<Integer> indices = activeDirectorBlock.getTimelineIndices(); for (int i = 0; i < manager.getScriptingProject().getCameras().size(); i++) { Camera camera = manager.getScriptingProject().getCameras().get(i); StyledCheckbox checkbox = getStyledCheckbox(camera.getName(), indices.contains(i)); activeCameraBoxes.add(checkbox); CustomMenuItem item = new CustomMenuItem(checkbox); item.setHideOnClick(false); buttons.getItems().add(item); checkbox.setOnMouseClicked(createCameraDropdownHandler(checkbox, i)); } } | /**
* Helper method for showing the Camera Dropdown.
*
* @param buttons the dropdown menu containing buttons.
*/ | Helper method for showing the Camera Dropdown | cameraDropdownListenerHelper | {
"repo_name": "bartdejonge1996/goto-fail",
"path": "src/main/java/control/DetailViewController.java",
"license": "apache-2.0",
"size": 24761
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,350,051 |
void setLocation(Point point); | void setLocation(Point point); | /**
* Set the location of this component relative to its parent. The point
* specified represents the top-left corner of this component.
*
* @param point the top-left corner of this component relative to the parent
* @throws NullPointerException if point is null
* @see #getLocation()
*/ | Set the location of this component relative to its parent. The point specified represents the top-left corner of this component | setLocation | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/accessibility/AccessibleComponent.java",
"license": "gpl-2.0",
"size": 10072
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,871,189 |
private static void fetchClusterRoleBindings() throws ApiException {
V1beta1ClusterRoleBindingList clusterRoleBindings = rbacApi
.listClusterRoleBinding(null, null, null,
null, null, null,
null, null, null);
resources.put(ResourceType.CLUSTER_ROLE_BINDING,
clusterRoleBindings.getItems().stream()
.map(ClusterRoleBinding::new)
.collect(Collectors.toList()));
} | static void function() throws ApiException { V1beta1ClusterRoleBindingList clusterRoleBindings = rbacApi .listClusterRoleBinding(null, null, null, null, null, null, null, null, null); resources.put(ResourceType.CLUSTER_ROLE_BINDING, clusterRoleBindings.getItems().stream() .map(ClusterRoleBinding::new) .collect(Collectors.toList())); } | /**
* Fetches cluster role bindings from the api and stores them in the resource cache.
* @throws ApiException in case of API communication error
*/ | Fetches cluster role bindings from the api and stores them in the resource cache | fetchClusterRoleBindings | {
"repo_name": "google/gke-auditor",
"path": "src/main/java/com/google/gke/auditor/system/AssetService.java",
"license": "apache-2.0",
"size": 15446
} | [
"com.google.gke.auditor.models.ClusterRoleBinding",
"io.kubernetes.client.openapi.ApiException",
"io.kubernetes.client.openapi.models.V1beta1ClusterRoleBindingList",
"java.util.stream.Collectors"
] | import com.google.gke.auditor.models.ClusterRoleBinding; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.models.V1beta1ClusterRoleBindingList; import java.util.stream.Collectors; | import com.google.gke.auditor.models.*; import io.kubernetes.client.openapi.*; import io.kubernetes.client.openapi.models.*; import java.util.stream.*; | [
"com.google.gke",
"io.kubernetes.client",
"java.util"
] | com.google.gke; io.kubernetes.client; java.util; | 124,377 |
public Consumed<K, V> withValueSerde(final Serde<V> valueSerde) {
this.valueSerde = valueSerde;
return this;
} | Consumed<K, V> function(final Serde<V> valueSerde) { this.valueSerde = valueSerde; return this; } | /**
* Configure the instance of {@link Consumed} with a value {@link Serde}.
*
* @param valueSerde the value serde. If {@code null} the default value serde from config will be used
* @return this
*/ | Configure the instance of <code>Consumed</code> with a value <code>Serde</code> | withValueSerde | {
"repo_name": "sebadiaz/kafka",
"path": "streams/src/main/java/org/apache/kafka/streams/Consumed.java",
"license": "apache-2.0",
"size": 8395
} | [
"org.apache.kafka.common.serialization.Serde"
] | import org.apache.kafka.common.serialization.Serde; | import org.apache.kafka.common.serialization.*; | [
"org.apache.kafka"
] | org.apache.kafka; | 76,965 |
@Override
public double getDouble(int columnIndex) throws SQLException {
Object o = get(columnIndex);
if (o != null && !(o instanceof Number)) {
return Double.parseDouble(o.toString());
}
return o == null ? 0 : ((Number) o).doubleValue();
} | double function(int columnIndex) throws SQLException { Object o = get(columnIndex); if (o != null && !(o instanceof Number)) { return Double.parseDouble(o.toString()); } return o == null ? 0 : ((Number) o).doubleValue(); } | /**
* Returns the value as an double.
*
* @param columnIndex (1,2,...)
* @return the value
*/ | Returns the value as an double | getDouble | {
"repo_name": "wizardofos/Protozoo",
"path": "extra/h2/src/main/java/org/h2/tools/SimpleResultSet.java",
"license": "mit",
"size": 55309
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,188,520 |
public ServiceFuture<Void> deleteAsync(String resourceGroupName, String localNetworkGatewayName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName), serviceCallback);
} | ServiceFuture<Void> function(String resourceGroupName, String localNetworkGatewayName, final ServiceCallback<Void> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName), serviceCallback); } | /**
* Deletes the specified local network gateway.
*
* @param resourceGroupName The name of the resource group.
* @param localNetworkGatewayName The name of the local network gateway.
* @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 local network gateway | deleteAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/LocalNetworkGatewaysInner.java",
"license": "mit",
"size": 54385
} | [
"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,578,418 |
@Test
public void testVanillaIborSwapSecurity() {
final SimpleTrade trade = new SimpleTrade();
trade.setSecurityLink(SimpleSecurityLink.of(VANILLA_IBOR_SWAP));
final List<ExternalId> expected = Collections.singletonList(ExternalId.of("SecurityType", "SWAP_USD_US"));
assertEquals(EXPOSURE_FUNCTION.getIds(trade, COMPILATION_CONTEXT), expected);
assertEquals(EXPOSURE_FUNCTION.getIds(trade, EXECUTION_CONTEXT), expected);
} | void function() { final SimpleTrade trade = new SimpleTrade(); trade.setSecurityLink(SimpleSecurityLink.of(VANILLA_IBOR_SWAP)); final List<ExternalId> expected = Collections.singletonList(ExternalId.of(STR, STR)); assertEquals(EXPOSURE_FUNCTION.getIds(trade, COMPILATION_CONTEXT), expected); assertEquals(EXPOSURE_FUNCTION.getIds(trade, EXECUTION_CONTEXT), expected); } | /**
* Tests the ids returned for a vanilla ibor swap security.
*/ | Tests the ids returned for a vanilla ibor swap security | testVanillaIborSwapSecurity | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial/src/test/java/com/opengamma/financial/analytics/curve/exposure/factory/SecurityCurrencyAndRegionExposureFunctionTest.java",
"license": "apache-2.0",
"size": 12228
} | [
"com.opengamma.core.position.impl.SimpleTrade",
"com.opengamma.core.security.impl.SimpleSecurityLink",
"com.opengamma.id.ExternalId",
"java.util.Collections",
"java.util.List",
"org.testng.Assert"
] | import com.opengamma.core.position.impl.SimpleTrade; import com.opengamma.core.security.impl.SimpleSecurityLink; import com.opengamma.id.ExternalId; import java.util.Collections; import java.util.List; import org.testng.Assert; | import com.opengamma.core.position.impl.*; import com.opengamma.core.security.impl.*; import com.opengamma.id.*; import java.util.*; import org.testng.*; | [
"com.opengamma.core",
"com.opengamma.id",
"java.util",
"org.testng"
] | com.opengamma.core; com.opengamma.id; java.util; org.testng; | 1,250,427 |
VerticalLayout getEmptyLayout(); | VerticalLayout getEmptyLayout(); | /**
* Gets a layout in case of empty table.<p>
*
* @return VerticalLayout
*/ | Gets a layout in case of empty table | getEmptyLayout | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/ui/apps/user/I_CmsFilterableTable.java",
"license": "lgpl-2.1",
"size": 1633
} | [
"com.vaadin.v7.ui.VerticalLayout"
] | import com.vaadin.v7.ui.VerticalLayout; | import com.vaadin.v7.ui.*; | [
"com.vaadin.v7"
] | com.vaadin.v7; | 2,187,699 |
void put(Bitmap bm,int size,String path) {
File f = new File(_cacheDir,Integer.toString(size)+"_"+new File(path).getName());
try {
FileOutputStream os = new FileOutputStream(f.getAbsolutePath());
bm.compress(Bitmap.CompressFormat.JPEG, 85, os);
os.close();
_size += f.length();
_queue.add(f);
purge();
} catch (Exception e) {
e.printStackTrace();
}
_preCache.put(new BitmapNode(size,path),bm);
}
| void put(Bitmap bm,int size,String path) { File f = new File(_cacheDir,Integer.toString(size)+"_"+new File(path).getName()); try { FileOutputStream os = new FileOutputStream(f.getAbsolutePath()); bm.compress(Bitmap.CompressFormat.JPEG, 85, os); os.close(); _size += f.length(); _queue.add(f); purge(); } catch (Exception e) { e.printStackTrace(); } _preCache.put(new BitmapNode(size,path),bm); } | /** Stores a new Bitmap under a given Key. If the max size of
* the cache is exceeded we delete images until we are below
* the treshold.
*
* @param bm
* @param size
* @param path
*/ | Stores a new Bitmap under a given Key. If the max size of the cache is exceeded we delete images until we are below the treshold | put | {
"repo_name": "oncaphillis/OCTV",
"path": "src/net/oncaphillis/whatsontv/BitmapCache.java",
"license": "gpl-2.0",
"size": 3291
} | [
"android.graphics.Bitmap",
"java.io.File",
"java.io.FileOutputStream"
] | import android.graphics.Bitmap; import java.io.File; import java.io.FileOutputStream; | import android.graphics.*; import java.io.*; | [
"android.graphics",
"java.io"
] | android.graphics; java.io; | 866,065 |
public static void upgradeDatabaseSchema(SQLiteDatabase dbh, int oldVersion) {
if (oldVersion < 20170101) {
// this is ugly but was never released as a stable version, so
// it's good enough to keep playlists for testers
dbh.execSQL("DROP TABLE songs");
dbh.execSQL("DROP TABLE albums");
dbh.execSQL(DATABASE_CREATE_SONGS);
dbh.execSQL(DATABASE_CREATE_ALBUMS);
}
if (oldVersion < 20170102) {
dbh.execSQL("UPDATE songs SET disc_num=1 WHERE disc_num IS null");
}
if (oldVersion < 20170211) {
// older versions of triggerFullMediaScan did this by mistake
dbh.execSQL("UPDATE songs SET mtime=1 WHERE mtime=0");
}
if (oldVersion < 20170217) {
dbh.execSQL(VIEW_CREATE_ALBUMARTISTS);
dbh.execSQL(VIEW_CREATE_COMPOSERS);
dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE);
}
if (oldVersion >= 20170120 && oldVersion < 20170407) {
dbh.execSQL("DROP TABLE preferences");
}
if (oldVersion >= 20170407 && oldVersion < 20170608) {
// renames were buggy for some time -> get rid of duplicates
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_SONGS+" WHERE "+MediaLibrary.SongColumns._ID+" IN ("+
"SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS+" GROUP BY "+
MediaLibrary.SongColumns._ID+" HAVING count("+MediaLibrary.SongColumns._ID+") > 1)");
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_ALBUMS+" WHERE "+MediaLibrary.AlbumColumns._ID+" NOT IN (SELECT "+MediaLibrary.SongColumns.ALBUM_ID+" FROM "+MediaLibrary.TABLE_SONGS+");");
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_GENRES_SONGS+" WHERE "+MediaLibrary.GenreSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");");
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_GENRES+" WHERE "+MediaLibrary.GenreColumns._ID+" NOT IN (SELECT "+MediaLibrary.GenreSongColumns._GENRE_ID+" FROM "+MediaLibrary.TABLE_GENRES_SONGS+");");
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+" WHERE "+MediaLibrary.ContributorSongColumns.SONG_ID+" NOT IN (SELECT "+MediaLibrary.SongColumns._ID+" FROM "+MediaLibrary.TABLE_SONGS+");");
dbh.execSQL("DELETE FROM "+MediaLibrary.TABLE_CONTRIBUTORS+" WHERE "+MediaLibrary.ContributorColumns._ID+" NOT IN (SELECT "+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+" FROM "+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+");");
}
if (oldVersion < 20170619) {
// Android 4.x tends to not use idx_contributors_songs, resulting in full table scans.
// We will force the use of this index on views doing a LEFT JOIN as it doesn't cause
// any harm to newer sqlite versions. (We know that this is the best index to use).
dbh.execSQL("DROP VIEW "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS);
dbh.execSQL("DROP VIEW "+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE);
dbh.execSQL("DROP VIEW "+MediaLibrary.VIEW_PLAYLIST_SONGS);
dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS);
dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE);
dbh.execSQL(VIEW_CREATE_PLAYLIST_SONGS);
}
} | static void function(SQLiteDatabase dbh, int oldVersion) { if (oldVersion < 20170101) { dbh.execSQL(STR); dbh.execSQL(STR); dbh.execSQL(DATABASE_CREATE_SONGS); dbh.execSQL(DATABASE_CREATE_ALBUMS); } if (oldVersion < 20170102) { dbh.execSQL(STR); } if (oldVersion < 20170211) { dbh.execSQL(STR); } if (oldVersion < 20170217) { dbh.execSQL(VIEW_CREATE_ALBUMARTISTS); dbh.execSQL(VIEW_CREATE_COMPOSERS); dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE); } if (oldVersion >= 20170120 && oldVersion < 20170407) { dbh.execSQL(STR); } if (oldVersion >= 20170407 && oldVersion < 20170608) { dbh.execSQL(STR+MediaLibrary.TABLE_SONGS+STR+MediaLibrary.SongColumns._ID+STR+ STR+MediaLibrary.SongColumns._ID+STR+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS+STR+ MediaLibrary.SongColumns._ID+STR+MediaLibrary.SongColumns._ID+STR); dbh.execSQL(STR+MediaLibrary.TABLE_ALBUMS+STR+MediaLibrary.AlbumColumns._ID+STR+MediaLibrary.SongColumns.ALBUM_ID+STR+MediaLibrary.TABLE_SONGS+");"); dbh.execSQL(STR+MediaLibrary.TABLE_GENRES_SONGS+STR+MediaLibrary.GenreSongColumns.SONG_ID+STR+MediaLibrary.SongColumns._ID+STR+MediaLibrary.TABLE_SONGS+");"); dbh.execSQL(STR+MediaLibrary.TABLE_GENRES+STR+MediaLibrary.GenreColumns._ID+STR+MediaLibrary.GenreSongColumns._GENRE_ID+STR+MediaLibrary.TABLE_GENRES_SONGS+");"); dbh.execSQL(STR+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+STR+MediaLibrary.ContributorSongColumns.SONG_ID+STR+MediaLibrary.SongColumns._ID+STR+MediaLibrary.TABLE_SONGS+");"); dbh.execSQL(STR+MediaLibrary.TABLE_CONTRIBUTORS+STR+MediaLibrary.ContributorColumns._ID+STR+MediaLibrary.ContributorSongColumns._CONTRIBUTOR_ID+STR+MediaLibrary.TABLE_CONTRIBUTORS_SONGS+");"); } if (oldVersion < 20170619) { dbh.execSQL(STR+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS); dbh.execSQL(STR+MediaLibrary.VIEW_SONGS_ALBUMS_ARTISTS_HUGE); dbh.execSQL(STR+MediaLibrary.VIEW_PLAYLIST_SONGS); dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS); dbh.execSQL(VIEW_CREATE_SONGS_ALBUMS_ARTISTS_HUGE); dbh.execSQL(VIEW_CREATE_PLAYLIST_SONGS); } } | /**
* Upgrades an existing database
*
* @param dbh the writeable dbh to use
* @param oldVersion the version of the old (aka: existing) database
*/ | Upgrades an existing database | upgradeDatabaseSchema | {
"repo_name": "xbao/vanilla",
"path": "src/ch/blinkenlights/android/medialibrary/MediaSchema.java",
"license": "gpl-3.0",
"size": 18119
} | [
"android.database.sqlite.SQLiteDatabase"
] | import android.database.sqlite.SQLiteDatabase; | import android.database.sqlite.*; | [
"android.database"
] | android.database; | 1,894,258 |
EAttribute getRenderObject_Render();
| EAttribute getRenderObject_Render(); | /**
* Returns the meta object for the attribute '{@link org.eclipse.eavp.geometry.view.model.RenderObject#getRender <em>Render</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Render</em>'.
* @see org.eclipse.eavp.geometry.view.model.RenderObject#getRender()
* @see #getRenderObject()
* @generated
*/ | Returns the meta object for the attribute '<code>org.eclipse.eavp.geometry.view.model.RenderObject#getRender Render</code>'. | getRenderObject_Render | {
"repo_name": "eclipse/eavp",
"path": "org.eclipse.eavp.geometry.view.model/src/org/eclipse/eavp/geometry/view/model/ModelPackage.java",
"license": "epl-1.0",
"size": 71561
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 146,949 |
public List<String> getAllRelationIds() {
List<String> result;
synchronized(myRelId2ObjMap) {
result = new ArrayList<String>(myRelId2ObjMap.keySet());
}
return result;
} | List<String> function() { List<String> result; synchronized(myRelId2ObjMap) { result = new ArrayList<String>(myRelId2ObjMap.keySet()); } return result; } | /**
* Returns all the relation ids for all the relations handled by the
* Relation Service.
*
* @return ArrayList of String
*/ | Returns all the relation ids for all the relations handled by the Relation Service | getAllRelationIds | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/share/classes/javax/management/relation/RelationService.java",
"license": "gpl-2.0",
"size": 151190
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 355,345 |
public void testSerialization() {
EmptyBlock b1 = new EmptyBlock(1.0, 2.0);
EmptyBlock b2 = null;
try {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(b1);
out.close();
ObjectInput in = new ObjectInputStream(
new ByteArrayInputStream(buffer.toByteArray())
);
b2 = (EmptyBlock) in.readObject();
in.close();
}
catch (Exception e) {
fail(e.toString());
}
assertEquals(b1, b2);
} | void function() { EmptyBlock b1 = new EmptyBlock(1.0, 2.0); EmptyBlock b2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(b1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); b2 = (EmptyBlock) in.readObject(); in.close(); } catch (Exception e) { fail(e.toString()); } assertEquals(b1, b2); } | /**
* Serialize an instance, restore it, and check for equality.
*/ | Serialize an instance, restore it, and check for equality | testSerialization | {
"repo_name": "raedle/univis",
"path": "lib/jfreechart-1.0.1/src/org/jfree/chart/block/junit/EmptyBlockTests.java",
"license": "lgpl-2.1",
"size": 4250
} | [
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.ObjectInput",
"java.io.ObjectInputStream",
"java.io.ObjectOutput",
"java.io.ObjectOutputStream",
"org.jfree.chart.block.EmptyBlock"
] | import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import org.jfree.chart.block.EmptyBlock; | import java.io.*; import org.jfree.chart.block.*; | [
"java.io",
"org.jfree.chart"
] | java.io; org.jfree.chart; | 2,108,282 |
// List<Trelease> loadCustomReportReleasesScheduled(FilterUpperTO
// List<Trelease> loadCustomReportReleasesNoticed(FilterUpperTO
// List<Trelease> loadCustomReportPickerReleases(FilterUpperTO
Map<Integer, Trelease> loadHistoryReleases(int[] workItemIDs); | Map<Integer, Trelease> loadHistoryReleases(int[] workItemIDs); | /**
* Get the Map of releaseBeans from the history of the workItemIDs added by
* personID
*
* @param workItemIDs
* @param personID
* in null do not filter by personID
* @return
*/ | Get the Map of releaseBeans from the history of the workItemIDs added by personID | loadHistoryReleases | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/trackplus/dao/ReleaseDAO.java",
"license": "gpl-3.0",
"size": 8621
} | [
"com.trackplus.model.Trelease",
"java.util.Map"
] | import com.trackplus.model.Trelease; import java.util.Map; | import com.trackplus.model.*; import java.util.*; | [
"com.trackplus.model",
"java.util"
] | com.trackplus.model; java.util; | 256,993 |
private void initiatePropertyElement(ILayoutPropertyBeginElement element) {
Integer width = getMaxColumnsOnView() > 0 ? 50 / getMaxColumnsOnView() : 0;
width = 0;
if (!firstCellPainted) {
attributes.clear();
attributes.put(ATTR_CLASS, getStyle().getLabel() + " " + getStyle().getLayoutLabelCell());
StringBuffer style = new StringBuffer("");
if (width > 0) {
style.append("width:" + width.toString() + "%;");
}
style.append("white-space:nowrap;");
attributes.put(ATTR_STYLE, style.toString());
attributes.put("valign", "center");
write(LayoutJspUtils.INSTANCE.startTag(TAG_TD, attributes));
}
if (isSmallLabel(element)) {
attributes.clear();
attributes.put(ATTR_STYLE, "margin-left:" + getStyle().getPropertyLeftMargin() + "px");
write(LayoutJspUtils.INSTANCE.startTag(TAG_TABLE, attributes));
write(LayoutJspUtils.INSTANCE.startTag(TAG_TR));
attributes.clear();
attributes.put(ATTR_STYLE, "text-align:left");
write(LayoutJspUtils.INSTANCE.startTag(TAG_TD, attributes));
smallLabelPainted = true;
}
}
| void function(ILayoutPropertyBeginElement element) { Integer width = getMaxColumnsOnView() > 0 ? 50 / getMaxColumnsOnView() : 0; width = 0; if (!firstCellPainted) { attributes.clear(); attributes.put(ATTR_CLASS, getStyle().getLabel() + " " + getStyle().getLayoutLabelCell()); StringBuffer style = new StringBuffer(STRwidth:STR%;STRwhite-space:nowrap;STRvalignSTRcenterSTRmargin-left:STRpxSTRtext-align:left"); write(LayoutJspUtils.INSTANCE.startTag(TAG_TD, attributes)); smallLabelPainted = true; } } | /**
* Initiates a property element.
* @param element Current property element.
*/ | Initiates a property element | initiatePropertyElement | {
"repo_name": "jecuendet/maven4openxava",
"path": "dist/openxava/workspace/OpenXava/src/org/openxava/web/layout/impl/DefaultLayoutPainter.java",
"license": "apache-2.0",
"size": 39402
} | [
"org.openxava.web.layout.ILayoutPropertyBeginElement",
"org.openxava.web.layout.LayoutJspUtils"
] | import org.openxava.web.layout.ILayoutPropertyBeginElement; import org.openxava.web.layout.LayoutJspUtils; | import org.openxava.web.layout.*; | [
"org.openxava.web"
] | org.openxava.web; | 406,235 |
public String encode(String pString) throws EncoderException {
if (pString == null) {
return null;
}
try {
return encode(pString, getDefaultCharset());
} catch (UnsupportedEncodingException e) {
throw new EncoderException(e.getMessage(), e);
}
} | String function(String pString) throws EncoderException { if (pString == null) { return null; } try { return encode(pString, getDefaultCharset()); } catch (UnsupportedEncodingException e) { throw new EncoderException(e.getMessage(), e); } } | /**
* Encodes a string into its quoted-printable form using the default string charset. Unsafe characters are escaped.
*
* <p>
* This function implements a subset of quoted-printable encoding specification (rule #1 and rule #2) as defined in
* RFC 1521 and is suitable for encoding binary data.
* </p>
*
* @param pString
* string to convert to quoted-printable form
* @return quoted-printable string
*
* @throws EncoderException
* Thrown if quoted-printable encoding is unsuccessful
*
* @see #getDefaultCharset()
*/ | Encodes a string into its quoted-printable form using the default string charset. Unsafe characters are escaped. This function implements a subset of quoted-printable encoding specification (rule #1 and rule #2) as defined in RFC 1521 and is suitable for encoding binary data. | encode | {
"repo_name": "mcomella/FirefoxAccounts-android",
"path": "thirdparty/src/main/java/org/mozilla/apache/commons/codec/net/QuotedPrintableCodec.java",
"license": "mpl-2.0",
"size": 14766
} | [
"java.io.UnsupportedEncodingException",
"org.mozilla.apache.commons.codec.EncoderException"
] | import java.io.UnsupportedEncodingException; import org.mozilla.apache.commons.codec.EncoderException; | import java.io.*; import org.mozilla.apache.commons.codec.*; | [
"java.io",
"org.mozilla.apache"
] | java.io; org.mozilla.apache; | 1,777,263 |
IHUAttributeTransferRequestBuilder setQtyUnloaded(BigDecimal qtyUnloaded); | IHUAttributeTransferRequestBuilder setQtyUnloaded(BigDecimal qtyUnloaded); | /**
* Set qty already unloaded
*
* @param qtyUnloaded
* @return builder
*/ | Set qty already unloaded | setQtyUnloaded | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.handlingunits.base/src/main/java/de/metas/handlingunits/attribute/strategy/IHUAttributeTransferRequestBuilder.java",
"license": "gpl-2.0",
"size": 3148
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 863,818 |
public void invalidateWaypoints(final Collection<String> geocodes) {
final Set<Geocache> baseCaches = DataStore.loadCaches(geocodes, LoadFlags.LOAD_WAYPOINTS);
final Collection<String> invalidWpCodes = new ArrayList<>();
for (final Geocache cache : baseCaches) {
final List<Waypoint> wl = cache.getWaypoints();
for (final Waypoint w : wl) {
invalidWpCodes.add(w.getGpxId());
}
}
invalidate(invalidWpCodes);
} | void function(final Collection<String> geocodes) { final Set<Geocache> baseCaches = DataStore.loadCaches(geocodes, LoadFlags.LOAD_WAYPOINTS); final Collection<String> invalidWpCodes = new ArrayList<>(); for (final Geocache cache : baseCaches) { final List<Waypoint> wl = cache.getWaypoints(); for (final Waypoint w : wl) { invalidWpCodes.add(w.getGpxId()); } } invalidate(invalidWpCodes); } | /**
* get waypoint IDs for geocodes and invalidate them
* @param geocodes the codes
*/ | get waypoint IDs for geocodes and invalidate them | invalidateWaypoints | {
"repo_name": "rsudev/c-geo-opensource",
"path": "main/src/cgeo/geocaching/maps/mapsforge/v6/caches/WaypointsOverlay.java",
"license": "apache-2.0",
"size": 3420
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"java.util.Set"
] | import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,804,769 |
GerPatternType patternType = findPattern();
if(patternType == null) return null;
Pattern group = new Pattern();
group.setGroupId(patternType.getGroupId());
group.setArtifactId(patternType.getArtifactId());
group.setVersion(patternType.getVersion());
group.setModule(patternType.getModule());
group.setName(patternType.getName());
return group.empty() ? null : group;
} | GerPatternType patternType = findPattern(); if(patternType == null) return null; Pattern group = new Pattern(); group.setGroupId(patternType.getGroupId()); group.setArtifactId(patternType.getArtifactId()); group.setVersion(patternType.getVersion()); group.setModule(patternType.getModule()); group.setName(patternType.getName()); return group.empty() ? null : group; } | /**
* JavaBean getter for the Pattern property. Gets a JavaBean of type
* Pattern for the pattern child of this element, or null if there is no
* pattern child.
*/ | JavaBean getter for the Pattern property. Gets a JavaBean of type Pattern for the pattern child of this element, or null if there is no pattern child | getPattern | {
"repo_name": "apache/geronimo",
"path": "plugins/j2ee/geronimo-naming-builder/src/main/java/org/apache/geronimo/naming/deployment/jsr88/HasPattern.java",
"license": "apache-2.0",
"size": 5572
} | [
"org.apache.geronimo.xbeans.geronimo.naming.GerPatternType"
] | import org.apache.geronimo.xbeans.geronimo.naming.GerPatternType; | import org.apache.geronimo.xbeans.geronimo.naming.*; | [
"org.apache.geronimo"
] | org.apache.geronimo; | 77,858 |
void appendEncoded(Encoder encoder, EncodingState encodingState, CharSequence str, int off, int len)
throws IOException; | void appendEncoded(Encoder encoder, EncodingState encodingState, CharSequence str, int off, int len) throws IOException; | /**
* Appends an encoded portion of a string to the buffer
*
* @param encoder
* the encoder that has been applied
* @param encodingState
* the previous encoding state of the string
* @param str
* A String
* @param off
* Offset from which to start encoding characters
* @param len
* Number of characters to encode
* @throws IOException
* Signals that an I/O exception has occurred.
*/ | Appends an encoded portion of a string to the buffer | appendEncoded | {
"repo_name": "clockworkorange/grails-core",
"path": "grails-encoder/src/main/groovy/org/grails/encoder/EncodedAppender.java",
"license": "apache-2.0",
"size": 4901
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 571,799 |
@Override
public List<FederationModel> getFederationRegistrations() {
if (federationRegistrations.isEmpty()) {
federationRegistrations.addAll(FederationUtils.getFederationRegistrations(settings));
}
return federationRegistrations;
} | List<FederationModel> function() { if (federationRegistrations.isEmpty()) { federationRegistrations.addAll(FederationUtils.getFederationRegistrations(settings)); } return federationRegistrations; } | /**
* Returns the list of federated gitblit instances that this instance will
* try to pull.
*
* @return list of registered gitblit instances
*/ | Returns the list of federated gitblit instances that this instance will try to pull | getFederationRegistrations | {
"repo_name": "culmat/gitblit",
"path": "src/main/java/com/gitblit/manager/FederationManager.java",
"license": "apache-2.0",
"size": 14547
} | [
"com.gitblit.models.FederationModel",
"com.gitblit.utils.FederationUtils",
"java.util.List"
] | import com.gitblit.models.FederationModel; import com.gitblit.utils.FederationUtils; import java.util.List; | import com.gitblit.models.*; import com.gitblit.utils.*; import java.util.*; | [
"com.gitblit.models",
"com.gitblit.utils",
"java.util"
] | com.gitblit.models; com.gitblit.utils; java.util; | 522,323 |
public void forEach(final long parallelismThreshold, final BiConsumer<? super K, ? super V> action)
{
if (action == null)
{
throw new NullPointerException();
}
new ForEachMappingTask<>(null, this.batchFor(parallelismThreshold), 0, 0, this.table, action).invoke();
} | void function(final long parallelismThreshold, final BiConsumer<? super K, ? super V> action) { if (action == null) { throw new NullPointerException(); } new ForEachMappingTask<>(null, this.batchFor(parallelismThreshold), 0, 0, this.table, action).invoke(); } | /**
* Performs the given action for each (key, value).
*
* @param parallelismThreshold the (estimated) number of elements
* needed for this operation to be executed in parallel
* @param action the action
*
* @since 1.8
*/ | Performs the given action for each (key, value) | forEach | {
"repo_name": "joda17/Diorite-API",
"path": "src/main/java/org/diorite/utils/collections/maps/ConcurrentIdentityHashMap.java",
"license": "mit",
"size": 322933
} | [
"java.util.function.BiConsumer"
] | import java.util.function.BiConsumer; | import java.util.function.*; | [
"java.util"
] | java.util; | 1,244,891 |
private void calibrate(final int digits) {
final int precision = context.getPrecision();
if (digits > precision) {
context = new MathContext(digits, RoundingMode.HALF_EVEN);
}
} | void function(final int digits) { final int precision = context.getPrecision(); if (digits > precision) { context = new MathContext(digits, RoundingMode.HALF_EVEN); } } | /**
* Increase the precision of the math context as more digits are requested.
* This behavior is "sticky" in that the precision is never decreased.
*/ | Increase the precision of the math context as more digits are requested. This behavior is "sticky" in that the precision is never decreased | calibrate | {
"repo_name": "alex-fawkes/scroll-pi",
"path": "app/src/main/java/com/gmail/pi/scroll/math/BaseCalculator.java",
"license": "isc",
"size": 3088
} | [
"java.math.MathContext",
"java.math.RoundingMode"
] | import java.math.MathContext; import java.math.RoundingMode; | import java.math.*; | [
"java.math"
] | java.math; | 819,189 |
@Override public ImmutableSetMultimap<K, V> build() {
if (keyComparator != null) {
Multimap<K, V> sortedCopy = new BuilderMultimap<K, V>();
List<Map.Entry<K, Collection<V>>> entries =
Ordering.from(keyComparator).<K>onKeys().immutableSortedCopy(
builderMultimap.asMap().entrySet());
for (Map.Entry<K, Collection<V>> entry : entries) {
sortedCopy.putAll(entry.getKey(), entry.getValue());
}
builderMultimap = sortedCopy;
}
return copyOf(builderMultimap, valueComparator);
}
} | @Override ImmutableSetMultimap<K, V> function() { if (keyComparator != null) { Multimap<K, V> sortedCopy = new BuilderMultimap<K, V>(); List<Map.Entry<K, Collection<V>>> entries = Ordering.from(keyComparator).<K>onKeys().immutableSortedCopy( builderMultimap.asMap().entrySet()); for (Map.Entry<K, Collection<V>> entry : entries) { sortedCopy.putAll(entry.getKey(), entry.getValue()); } builderMultimap = sortedCopy; } return copyOf(builderMultimap, valueComparator); } } | /**
* Returns a newly-created immutable set multimap.
*/ | Returns a newly-created immutable set multimap | build | {
"repo_name": "binhvu7/guava",
"path": "guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/ImmutableSetMultimap.java",
"license": "apache-2.0",
"size": 16963
} | [
"java.util.Collection",
"java.util.List",
"java.util.Map"
] | import java.util.Collection; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,754,141 |
EClass getIPersistentObject(); | EClass getIPersistentObject(); | /**
* Returns the meta object for class '{@link ch.elexis.core.model.IPersistentObject <em>IPersistent Object</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>IPersistent Object</em>'.
* @see ch.elexis.core.model.IPersistentObject
* @generated
*/ | Returns the meta object for class '<code>ch.elexis.core.model.IPersistentObject IPersistent Object</code>'. | getIPersistentObject | {
"repo_name": "sazgin/elexis-3-core",
"path": "ch.elexis.core/src-gen/ch/elexis/core/model/ModelPackage.java",
"license": "epl-1.0",
"size": 108231
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,368,512 |
public void testExtendsMultithreaded() {
CompilerDef baseCompiler = new CompilerDef();
baseCompiler.setMultithreaded(false);
CompilerDef extendedCompiler = (CompilerDef) createExtendedProcessorDef(
baseCompiler);
setCompilerName(extendedCompiler, "msvc");
CCTask cctask = new CCTask();
LinkType linkType = new LinkType();
linkType.setStaticRuntime(true);
CommandLineCompilerConfiguration config = (CommandLineCompilerConfiguration)
extendedCompiler
.createConfiguration(cctask, linkType, null, null, null);
String[] preArgs = config.getPreArguments();
assertEquals("/ML", preArgs[3]);
} | void function() { CompilerDef baseCompiler = new CompilerDef(); baseCompiler.setMultithreaded(false); CompilerDef extendedCompiler = (CompilerDef) createExtendedProcessorDef( baseCompiler); setCompilerName(extendedCompiler, "msvc"); CCTask cctask = new CCTask(); LinkType linkType = new LinkType(); linkType.setStaticRuntime(true); CommandLineCompilerConfiguration config = (CommandLineCompilerConfiguration) extendedCompiler .createConfiguration(cctask, linkType, null, null, null); String[] preArgs = config.getPreArguments(); assertEquals("/ML", preArgs[3]); } | /**
* Tests that the multithread attribute of the base compiler definition is
* effective.
*/ | Tests that the multithread attribute of the base compiler definition is effective | testExtendsMultithreaded | {
"repo_name": "flax3lbs/cpptasks-parallel",
"path": "src/test/java/net/sf/antcontrib/cpptasks/TestCompilerDef.java",
"license": "apache-2.0",
"size": 11792
} | [
"net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration",
"net.sf.antcontrib.cpptasks.compiler.LinkType"
] | import net.sf.antcontrib.cpptasks.compiler.CommandLineCompilerConfiguration; import net.sf.antcontrib.cpptasks.compiler.LinkType; | import net.sf.antcontrib.cpptasks.compiler.*; | [
"net.sf.antcontrib"
] | net.sf.antcontrib; | 488,427 |
private static void generateMethod(String className, String fqClassName, String methodName, String returnType, String[] paramTypes, int modifiers, ClassWriter cw) {
String[] exceptions = null;
boolean isStatic = (modifiers & ACC_STATIC) != 0;
if (returnType == null) // map loose return type to Object
{
returnType = OBJECT;
}
String methodDescriptor = getMethodDescriptor(returnType, paramTypes);
// Generate method body
MethodVisitor cv = cw.visitMethod(modifiers, methodName, methodDescriptor, null, exceptions);
if ((modifiers & ACC_ABSTRACT) != 0) {
return;
}
// Generate code to push the BSHTHIS or BSHSTATIC field
if (isStatic) {
cv.visitFieldInsn(GETSTATIC, fqClassName, BSHSTATIC + className, "Lbsh/This;");
} else {
// Push 'this'
cv.visitVarInsn(ALOAD, 0);
// Get the instance field
cv.visitFieldInsn(GETFIELD, fqClassName, BSHTHIS + className, "Lbsh/This;");
}
// Push the name of the method as a constant
cv.visitLdcInsn(methodName);
// Generate code to push arguments as an object array
generateParameterReifierCode(paramTypes, isStatic, cv);
// Push nulls for various args of invokeMethod
cv.visitInsn(ACONST_NULL); // interpreter
cv.visitInsn(ACONST_NULL); // callstack
cv.visitInsn(ACONST_NULL); // callerinfo
// Push the boolean constant 'true' (for declaredOnly)
cv.visitInsn(ICONST_1);
// Invoke the method This.invokeMethod( name, Class [] sig, boolean )
cv.visitMethodInsn(INVOKEVIRTUAL, "bsh/This", "invokeMethod", Type.getMethodDescriptor(Type.getType(Object.class), new Type[]{Type.getType(String.class), Type.getType(Object[].class), Type.getType(Interpreter.class), Type.getType(CallStack.class), Type.getType(SimpleNode.class), Type.getType(Boolean.TYPE)}));
// Generate code to unwrap bsh Primitive types
cv.visitMethodInsn(INVOKESTATIC, "bsh/Primitive", "unwrap", "(Ljava/lang/Object;)Ljava/lang/Object;");
// Generate code to return the value
generateReturnCode(returnType, cv);
// Need to calculate this... just fudging here for now.
cv.visitMaxs(20, 20);
} | static void function(String className, String fqClassName, String methodName, String returnType, String[] paramTypes, int modifiers, ClassWriter cw) { String[] exceptions = null; boolean isStatic = (modifiers & ACC_STATIC) != 0; if (returnType == null) { returnType = OBJECT; } String methodDescriptor = getMethodDescriptor(returnType, paramTypes); MethodVisitor cv = cw.visitMethod(modifiers, methodName, methodDescriptor, null, exceptions); if ((modifiers & ACC_ABSTRACT) != 0) { return; } if (isStatic) { cv.visitFieldInsn(GETSTATIC, fqClassName, BSHSTATIC + className, STR); } else { cv.visitVarInsn(ALOAD, 0); cv.visitFieldInsn(GETFIELD, fqClassName, BSHTHIS + className, STR); } cv.visitLdcInsn(methodName); generateParameterReifierCode(paramTypes, isStatic, cv); cv.visitInsn(ACONST_NULL); cv.visitInsn(ACONST_NULL); cv.visitInsn(ACONST_NULL); cv.visitInsn(ICONST_1); cv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, Type.getMethodDescriptor(Type.getType(Object.class), new Type[]{Type.getType(String.class), Type.getType(Object[].class), Type.getType(Interpreter.class), Type.getType(CallStack.class), Type.getType(SimpleNode.class), Type.getType(Boolean.TYPE)})); cv.visitMethodInsn(INVOKESTATIC, STR, STR, STR); generateReturnCode(returnType, cv); cv.visitMaxs(20, 20); } | /**
* Generate a delegate method - static or instance.
* The generated code packs the method arguments into an object array
* (wrapping primitive types in bsh.Primitive), invokes the static or
* instance namespace invokeMethod() method, and then unwraps / returns
* the result.
*/ | Generate a delegate method - static or instance. The generated code packs the method arguments into an object array (wrapping primitive types in bsh.Primitive), invokes the static or instance namespace invokeMethod() method, and then unwraps / returns the result | generateMethod | {
"repo_name": "davidholiday/ALTk",
"path": "beanshell/src/bsh/ClassGeneratorUtil.java",
"license": "gpl-3.0",
"size": 38843
} | [
"org.objectweb.asm.ClassWriter",
"org.objectweb.asm.MethodVisitor",
"org.objectweb.asm.Type"
] | import org.objectweb.asm.ClassWriter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Type; | import org.objectweb.asm.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 2,884,035 |
public void removeTimegraphListener(TimegraphListener l) {
timedDocumentRoot.removeTimegraphListener(l);
} | void function(TimegraphListener l) { timedDocumentRoot.removeTimegraphListener(l); } | /**
* Removes a {@link TimegraphListener} from the document.
*/ | Removes a <code>TimegraphListener</code> from the document | removeTimegraphListener | {
"repo_name": "Uni-Sol/batik",
"path": "sources/org/apache/batik/anim/AnimationEngine.java",
"license": "apache-2.0",
"size": 21091
} | [
"org.apache.batik.anim.timing.TimegraphListener"
] | import org.apache.batik.anim.timing.TimegraphListener; | import org.apache.batik.anim.timing.*; | [
"org.apache.batik"
] | org.apache.batik; | 1,484,143 |
T deserialize(Version version, DataInputPlus in) throws IOException; | T deserialize(Version version, DataInputPlus in) throws IOException; | /**
* Deserialize metadata component from given input.
*
* @param version serialize version
* @param in deserialize source
* @return Deserialized component
* @throws IOException
*/ | Deserialize metadata component from given input | deserialize | {
"repo_name": "carlyeks/cassandra",
"path": "src/java/org/apache/cassandra/io/sstable/metadata/IMetadataComponentSerializer.java",
"license": "apache-2.0",
"size": 2108
} | [
"java.io.IOException",
"org.apache.cassandra.io.sstable.format.Version",
"org.apache.cassandra.io.util.DataInputPlus"
] | import java.io.IOException; import org.apache.cassandra.io.sstable.format.Version; import org.apache.cassandra.io.util.DataInputPlus; | import java.io.*; import org.apache.cassandra.io.sstable.format.*; import org.apache.cassandra.io.util.*; | [
"java.io",
"org.apache.cassandra"
] | java.io; org.apache.cassandra; | 2,326,947 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.