method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
private int getDesiredHeight(Layout layout) {
if (layout == null) {
return 0;
}
int linecount = layout.getLineCount();
// APPCELERATOR TITANIUM CUSTOMIZATION:
int desired = layout.getLineTop(linecount) - getAdditionalItemHeight();
if (Build.VERSION.SDK_INT < 21) {
desired -= getItemOffset() * 2;
} else {
desired += getTextSize();
}
// Check against our minimum height
desired = Math.max(desired, getSuggestedMinimumHeight());
return desired;
} | int function(Layout layout) { if (layout == null) { return 0; } int linecount = layout.getLineCount(); int desired = layout.getLineTop(linecount) - getAdditionalItemHeight(); if (Build.VERSION.SDK_INT < 21) { desired -= getItemOffset() * 2; } else { desired += getTextSize(); } desired = Math.max(desired, getSuggestedMinimumHeight()); return desired; } | /**
* Calculates desired height for layout
*
* @param layout
* the source layout
* @return the desired layout height
*/ | Calculates desired height for layout | getDesiredHeight | {
"repo_name": "collinprice/titanium_mobile",
"path": "android/modules/ui/src/java/kankan/wheel/widget/WheelView.java",
"license": "apache-2.0",
"size": 20534
} | [
"android.os.Build",
"android.text.Layout"
] | import android.os.Build; import android.text.Layout; | import android.os.*; import android.text.*; | [
"android.os",
"android.text"
] | android.os; android.text; | 159,033 |
public static InsnList addLogHeaderOldApi(String className) {
return addLogHeader(className, TYPE_JOBCONF);
} | static InsnList function(String className) { return addLogHeader(className, TYPE_JOBCONF); } | /**
* <p>
* This method provides instructions to log header row
* </p>
*
* @param className
* Class which has called the logger
* @return InsnList Instructions
*/ | This method provides instructions to log header row | addLogHeaderOldApi | {
"repo_name": "impetus-opensource/jumbune",
"path": "debugger/src/main/java/org/jumbune/debugger/instrumentation/utils/InstrumentUtil.java",
"license": "lgpl-3.0",
"size": 33467
} | [
"org.objectweb.asm.tree.InsnList"
] | import org.objectweb.asm.tree.InsnList; | import org.objectweb.asm.tree.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 264,286 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(RefLocationType.class)) {
case GmlPackage.REF_LOCATION_TYPE__AFFINE_PLACEMENT:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(RefLocationType.class)) { case GmlPackage.REF_LOCATION_TYPE__AFFINE_PLACEMENT: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/gml/provider/RefLocationTypeItemProvider.java",
"license": "apache-2.0",
"size": 4987
} | [
"net.opengis.gml.GmlPackage",
"net.opengis.gml.RefLocationType",
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification"
] | import net.opengis.gml.GmlPackage; import net.opengis.gml.RefLocationType; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; | import net.opengis.gml.*; import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; | [
"net.opengis.gml",
"org.eclipse.emf"
] | net.opengis.gml; org.eclipse.emf; | 2,466,774 |
public void unbindENC ()
{
try
{
InitialContext ic = new InitialContext();
Context env = (Context)ic.lookup("java:comp/env");
__log.debug("Unbinding java:comp/env/"+getJndiName());
env.unbind(getJndiName());
}
catch (NamingException e)
{
__log.warn(e);
}
} | void function () { try { InitialContext ic = new InitialContext(); Context env = (Context)ic.lookup(STR); __log.debug(STR+getJndiName()); env.unbind(getJndiName()); } catch (NamingException e) { __log.warn(e); } } | /**
* Unbind this NamingEntry from a java:comp/env
*/ | Unbind this NamingEntry from a java:comp/env | unbindENC | {
"repo_name": "whiteley/jetty8",
"path": "jetty-plus/src/main/java/org/eclipse/jetty/plus/jndi/NamingEntry.java",
"license": "apache-2.0",
"size": 6187
} | [
"javax.naming.Context",
"javax.naming.InitialContext",
"javax.naming.NamingException"
] | import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; | import javax.naming.*; | [
"javax.naming"
] | javax.naming; | 2,340,774 |
private int workOutHeight(Transaction transaction) {
return -1; // -1 = we do not know. TODO probably needs replacing by height on TransactionConfidence.
} | int function(Transaction transaction) { return -1; } | /**
* Work out the height of the block chain in which the transaction appears.
*
* @param transaction
* @return
*/ | Work out the height of the block chain in which the transaction appears | workOutHeight | {
"repo_name": "PaulSnow/multibit",
"path": "src/main/java/org/multibit/model/bitcoin/BitcoinModel.java",
"license": "mit",
"size": 29100
} | [
"com.google.bitcoin.core.Transaction"
] | import com.google.bitcoin.core.Transaction; | import com.google.bitcoin.core.*; | [
"com.google.bitcoin"
] | com.google.bitcoin; | 2,578,381 |
private Project createProjectWithAssignedPersons_1(String title) throws Exception
{
// create new project
Project project = new Project();
project.setTitle(title);
// create two persons and assign project
// and assign persons with project
Person p1 = new Person();
p1.setFirstname(title);
broker.beginTransaction();
broker.store(p1);
List projects_1 = new ArrayList();
projects_1.add(project);
p1.setProjects(projects_1); // connect project to person
Person p2 = new Person();
p2.setFirstname(title);
broker.store(p2);
List projects_2 = new ArrayList();
projects_2.add(project);
p2.setProjects(projects_2); // connect project to person
ArrayList persons = new ArrayList();
persons.add(p1);
persons.add(p2);
project.setPersons(persons); // connect persons to project
broker.store(project);
broker.commitTransaction();
return project;
}
| Project function(String title) throws Exception { Project project = new Project(); project.setTitle(title); Person p1 = new Person(); p1.setFirstname(title); broker.beginTransaction(); broker.store(p1); List projects_1 = new ArrayList(); projects_1.add(project); p1.setProjects(projects_1); Person p2 = new Person(); p2.setFirstname(title); broker.store(p2); List projects_2 = new ArrayList(); projects_2.add(project); p2.setProjects(projects_2); ArrayList persons = new ArrayList(); persons.add(p1); persons.add(p2); project.setPersons(persons); broker.store(project); broker.commitTransaction(); return project; } | /**
* Create a project with two persons
* @param title
* @return
* @throws Exception
*/ | Create a project with two persons | createProjectWithAssignedPersons_1 | {
"repo_name": "kuali/ojb-1.0.4",
"path": "src/test/org/apache/ojb/broker/MtoNMapping.java",
"license": "apache-2.0",
"size": 24919
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,599,738 |
EReference getTypeArguments_T13(); | EReference getTypeArguments_T13(); | /**
* Returns the meta object for the containment reference list '{@link com.euclideanspace.spad.editor.TypeArguments#getT13 <em>T13</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>T13</em>'.
* @see com.euclideanspace.spad.editor.TypeArguments#getT13()
* @see #getTypeArguments()
* @generated
*/ | Returns the meta object for the containment reference list '<code>com.euclideanspace.spad.editor.TypeArguments#getT13 T13</code>'. | getTypeArguments_T13 | {
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,228,649 |
public void delete( final int userID, final String userSessionId,
final int forUserID, final List<Integer> messageIDS ) throws SiteException; | void function( final int userID, final String userSessionId, final int forUserID, final List<Integer> messageIDS ) throws SiteException; | /**
* This method allows to delete user messages
* @param userID the user unique ID
* @param userSessionId the user's session id
* @param forUserID the user we want to delete messages for
* @param messageIDS the list of message ID for the messages we want to delete
* @throws SiteException if the user is not logged in or we
* try to validate the session too often or smth else!
*/ | This method allows to delete user messages | delete | {
"repo_name": "ivan-zapreev/x-cure-chat",
"path": "src/com/xcurechat/client/rpc/MessageManager.java",
"license": "gpl-3.0",
"size": 4995
} | [
"com.xcurechat.client.rpc.exceptions.SiteException",
"java.util.List"
] | import com.xcurechat.client.rpc.exceptions.SiteException; import java.util.List; | import com.xcurechat.client.rpc.exceptions.*; import java.util.*; | [
"com.xcurechat.client",
"java.util"
] | com.xcurechat.client; java.util; | 585,316 |
public ByteBuffer getBuffer() {
return data.asReadOnlyBuffer();
}
| ByteBuffer function() { return data.asReadOnlyBuffer(); } | /**
* Get master data as read only ByteBuffer
* @return
*/ | Get master data as read only ByteBuffer | getBuffer | {
"repo_name": "taimos/openhab",
"path": "bundles/binding/org.openhab.binding.ebus/src/main/java/org/openhab/binding/ebus/internal/EBusTelegram.java",
"license": "epl-1.0",
"size": 3164
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,086,042 |
public static void main(String[] args) {
Log.printLine("Starting CloudSimExample7...");
try {
// First step: Initialize the CloudSim package. It should be called
// before creating any entities.
int num_user = 2; // number of grid users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events
// Initialize the CloudSim library
CloudSim.init(num_user, calendar, trace_flag);
// Second step: Create Datacenters
//Datacenters are the resource providers in CloudSim. We need at list one of them to run a CloudSim simulation
Datacenter datacenter0 = createDatacenter("Datacenter_0");
Datacenter datacenter1 = createDatacenter("Datacenter_1");
//Third step: Create Broker
DatacenterBroker broker = createBroker("Broker_0");
int brokerId = broker.getId();
//Fourth step: Create VMs and Cloudlets and send them to broker
vmlist = createVM(brokerId, 5, 0); //creating 5 vms
cloudletList = createCloudlet(brokerId, 10, 0); // creating 10 cloudlets
broker.submitVmList(vmlist);
broker.submitCloudletList(cloudletList); | static void function(String[] args) { Log.printLine(STR); try { int num_user = 2; Calendar calendar = Calendar.getInstance(); boolean trace_flag = false; CloudSim.init(num_user, calendar, trace_flag); Datacenter datacenter0 = createDatacenter(STR); Datacenter datacenter1 = createDatacenter(STR); DatacenterBroker broker = createBroker(STR); int brokerId = broker.getId(); vmlist = createVM(brokerId, 5, 0); cloudletList = createCloudlet(brokerId, 10, 0); broker.submitVmList(vmlist); broker.submitCloudletList(cloudletList); | /**
* Creates main() to run this example
*/ | Creates main() to run this example | main | {
"repo_name": "RohanKabra/adaptiveCloudsim",
"path": "src/org/cloudbus/cloudsim/examples/CloudSimExample7.java",
"license": "lgpl-3.0",
"size": 10307
} | [
"java.util.Calendar",
"org.cloudbus.cloudsim.Datacenter",
"org.cloudbus.cloudsim.DatacenterBroker",
"org.cloudbus.cloudsim.Log",
"org.cloudbus.cloudsim.core.CloudSim"
] | import java.util.Calendar; import org.cloudbus.cloudsim.Datacenter; import org.cloudbus.cloudsim.DatacenterBroker; import org.cloudbus.cloudsim.Log; import org.cloudbus.cloudsim.core.CloudSim; | import java.util.*; import org.cloudbus.cloudsim.*; import org.cloudbus.cloudsim.core.*; | [
"java.util",
"org.cloudbus.cloudsim"
] | java.util; org.cloudbus.cloudsim; | 1,134,363 |
@Nullable private GridCacheMvccCandidate addEntry(
AffinityTopologyVersion topVer,
GridNearCacheEntry entry,
UUID dhtNodeId
) throws GridCacheEntryRemovedException {
// Check if lock acquisition is timed out.
if (timedOut)
return null;
// Add local lock first, as it may throw GridCacheEntryRemovedException.
GridCacheMvccCandidate c = entry.addNearLocal(
dhtNodeId,
threadId,
lockVer,
topVer,
timeout,
!inTx(),
inTx(),
implicitSingleTx()
);
if (inTx()) {
IgniteTxEntry txEntry = tx.entry(entry.txKey());
txEntry.cached(entry);
}
synchronized (mux) {
entries.add(entry);
}
if (c == null && timeout < 0) {
if (log.isDebugEnabled())
log.debug("Failed to acquire lock with negative timeout: " + entry);
onFailed(false);
return null;
}
// Double check if lock acquisition has already timed out.
if (timedOut) {
entry.removeLock(lockVer);
return null;
}
return c;
} | @Nullable GridCacheMvccCandidate function( AffinityTopologyVersion topVer, GridNearCacheEntry entry, UUID dhtNodeId ) throws GridCacheEntryRemovedException { if (timedOut) return null; GridCacheMvccCandidate c = entry.addNearLocal( dhtNodeId, threadId, lockVer, topVer, timeout, !inTx(), inTx(), implicitSingleTx() ); if (inTx()) { IgniteTxEntry txEntry = tx.entry(entry.txKey()); txEntry.cached(entry); } synchronized (mux) { entries.add(entry); } if (c == null && timeout < 0) { if (log.isDebugEnabled()) log.debug(STR + entry); onFailed(false); return null; } if (timedOut) { entry.removeLock(lockVer); return null; } return c; } | /**
* Adds entry to future.
*
* @param topVer Topology version.
* @param entry Entry to add.
* @param dhtNodeId DHT node ID.
* @return Lock candidate.
* @throws GridCacheEntryRemovedException If entry was removed.
*/ | Adds entry to future | addEntry | {
"repo_name": "adeelmahmood/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java",
"license": "apache-2.0",
"size": 56727
} | [
"org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion",
"org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException",
"org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate",
"org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException; import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate; import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.internal.processors.affinity.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.transactions.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 2,502,145 |
public static ListenableFuture<Void> allOf(ListenableFuture<?>... futures)
{
return new AllOfFuture(Arrays.asList(futures));
} | static ListenableFuture<Void> function(ListenableFuture<?>... futures) { return new AllOfFuture(Arrays.asList(futures)); } | /**
* Returns future that will be completed once all of the dependent futures are completed.
*
* If any of the futures fail this future will fail immediately.
*
* @param futures
* dependent futures
*
* @return
* future that will complete once all of {@code futures} complete
*/ | Returns future that will be completed once all of the dependent futures are completed. If any of the futures fail this future will fail immediately | allOf | {
"repo_name": "kvr000/zbynek-concurrent-pof",
"path": "zbynek-lwfuture-pof/src/main/java/cz/znj/kvr/sw/pof/concurrent/lwfuture/concurrent/Futures.java",
"license": "apache-2.0",
"size": 6884
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 298,115 |
@Test
public void testLogOnSpecificLevel() throws Exception {
final BlockingQueue<SyslogServerEventIF> queue = BlockedSyslogServerEventHandler.getQueue();
executeOperation(Operations.createWriteAttributeOperation(SYSLOG_HANDLER_ADDR, "level", "ERROR"));
queue.clear();
makeLogs();
testLog(queue, Level.ERROR);
testLog(queue, Level.FATAL);
Assert.assertTrue("No other message was expected in syslog.", queue.isEmpty());
} | void function() throws Exception { final BlockingQueue<SyslogServerEventIF> queue = BlockedSyslogServerEventHandler.getQueue(); executeOperation(Operations.createWriteAttributeOperation(SYSLOG_HANDLER_ADDR, "level", "ERROR")); queue.clear(); makeLogs(); testLog(queue, Level.ERROR); testLog(queue, Level.FATAL); Assert.assertTrue(STR, queue.isEmpty()); } | /**
* Tests that only messages on specific level or higher level are logged to syslog.
*/ | Tests that only messages on specific level or higher level are logged to syslog | testLogOnSpecificLevel | {
"repo_name": "JiriOndrusek/wildfly-core",
"path": "testsuite/standalone/src/test/java/org/jboss/as/test/integration/logging/syslog/SyslogHandlerTestCase.java",
"license": "lgpl-2.1",
"size": 10185
} | [
"java.util.concurrent.BlockingQueue",
"org.jboss.as.controller.client.helpers.Operations",
"org.jboss.as.test.syslogserver.BlockedSyslogServerEventHandler",
"org.jboss.logging.Logger",
"org.junit.Assert",
"org.productivity.java.syslog4j.server.SyslogServerEventIF"
] | import java.util.concurrent.BlockingQueue; import org.jboss.as.controller.client.helpers.Operations; import org.jboss.as.test.syslogserver.BlockedSyslogServerEventHandler; import org.jboss.logging.Logger; import org.junit.Assert; import org.productivity.java.syslog4j.server.SyslogServerEventIF; | import java.util.concurrent.*; import org.jboss.as.controller.client.helpers.*; import org.jboss.as.test.syslogserver.*; import org.jboss.logging.*; import org.junit.*; import org.productivity.java.syslog4j.server.*; | [
"java.util",
"org.jboss.as",
"org.jboss.logging",
"org.junit",
"org.productivity.java"
] | java.util; org.jboss.as; org.jboss.logging; org.junit; org.productivity.java; | 2,078,533 |
public void evictFromMemoryCache(final Uri uri) {
Predicate<CacheKey> predicate = predicateForUri(uri);
mBitmapMemoryCache.removeAll(predicate);
mEncodedMemoryCache.removeAll(predicate);
} | void function(final Uri uri) { Predicate<CacheKey> predicate = predicateForUri(uri); mBitmapMemoryCache.removeAll(predicate); mEncodedMemoryCache.removeAll(predicate); } | /**
* Removes all images with the specified {@link Uri} from memory cache.
* @param uri The uri of the image to evict
*/ | Removes all images with the specified <code>Uri</code> from memory cache | evictFromMemoryCache | {
"repo_name": "HKMOpen/fresco",
"path": "imagepipeline/src/main/java/com/facebook/imagepipeline/core/ImagePipeline.java",
"license": "bsd-3-clause",
"size": 21396
} | [
"android.net.Uri",
"com.android.internal.util.Predicate",
"com.facebook.cache.common.CacheKey"
] | import android.net.Uri; import com.android.internal.util.Predicate; import com.facebook.cache.common.CacheKey; | import android.net.*; import com.android.internal.util.*; import com.facebook.cache.common.*; | [
"android.net",
"com.android.internal",
"com.facebook.cache"
] | android.net; com.android.internal; com.facebook.cache; | 137,230 |
private static String buildMessage(String format, Object... args) {
String msg = (args == null) ? format : String.format(Locale.US, format, args);
// 拿到 栈轨迹 数据
StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();
String caller = "<unknown>";
// Walk up the stack looking for the first caller outside of VolleyLog.
// It will be at least two frames up, so start there.
for (int i = 2; i < trace.length; i++) {
Class<?> clazz = trace[i].getClass();
if (!clazz.equals(VolleyLog.class)) {
String callingClass = trace[i].getClassName();
callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1);
callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1);
// 拿到 类名称 和 类方法
caller = callingClass + "." + trace[i].getMethodName();
break;
}
}
// 将 类名称 和 类方法 用于格式化 Log 消息内容
return String.format(Locale.US, "[%d] %s: %s", Thread.currentThread().getId(), caller, msg);
}
static class MarkerLog {
// 开关状态和 VolleyLog 一样
public static final boolean ENABLED = VolleyLog.DEBUG;
private static final long MIN_DURATION_FOR_LOGGING_MS = 0;
private static class Marker {
public final String name;
public final long thread;
public final long time;
public Marker(String name, long thread, long time) {
this.name = name;
this.thread = thread;
this.time = time;
}
}
private final List<Marker> mMarkers = new ArrayList<Marker>();
private boolean mFinished = false; | static String function(String format, Object... args) { String msg = (args == null) ? format : String.format(Locale.US, format, args); StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace(); String caller = STR; for (int i = 2; i < trace.length; i++) { Class<?> clazz = trace[i].getClass(); if (!clazz.equals(VolleyLog.class)) { String callingClass = trace[i].getClassName(); callingClass = callingClass.substring(callingClass.lastIndexOf('.') + 1); callingClass = callingClass.substring(callingClass.lastIndexOf('$') + 1); caller = callingClass + "." + trace[i].getMethodName(); break; } } return String.format(Locale.US, STR, Thread.currentThread().getId(), caller, msg); } static class MarkerLog { public static final boolean ENABLED = VolleyLog.DEBUG; private static final long MIN_DURATION_FOR_LOGGING_MS = 0; private static class Marker { public final String name; public final long thread; public final long time; public Marker(String name, long thread, long time) { this.name = name; this.thread = thread; this.time = time; } } private final List<Marker> mMarkers = new ArrayList<Marker>(); private boolean mFinished = false; | /**
* Formats the caller's provided message and prepends useful info like
* calling thread ID and method name.
*/ | Formats the caller's provided message and prepends useful info like calling thread ID and method name | buildMessage | {
"repo_name": "CaMnter/AndroidLife",
"path": "volley/src/main/java/com/android/volley/VolleyLog.java",
"license": "apache-2.0",
"size": 8911
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Locale"
] | import java.util.ArrayList; import java.util.List; import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,377,377 |
synchronized void clearEventActionpointRequest(
IProgressMonitor progressMonitor,
int id)
throws ServiceException, IOException
{
synchronized (lock)
{
init(null);
try
{
monitor.clearEventActionpointRequest(id);
}
catch (IOException e)
{
disconnect();
throw e;
}
waitForEndmark(progressMonitor);
}
} | synchronized void clearEventActionpointRequest( IProgressMonitor progressMonitor, int id) throws ServiceException, IOException { synchronized (lock) { init(null); try { monitor.clearEventActionpointRequest(id); } catch (IOException e) { disconnect(); throw e; } waitForEndmark(progressMonitor); } } | /**
* Request for clearing an event action point.
*
* @param progressMonitor the progress monitor used for cancellation.
* @param id the id of the event action point to be cleared
* or ~0 to clear all.
* @throws IOException if an I/O exception occurred; target is
* automatically disconnected.
* @throws ServiceException if the monitor service reported an error.
* @throws OperationCanceledException if the operation was interrupted or
* cancelled; target is automatically disconnected.
*/ | Request for clearing an event action point | clearEventActionpointRequest | {
"repo_name": "debabratahazra/OptimaLA",
"path": "Optima/com.ose.system/src/com/ose/system/Target.java",
"license": "epl-1.0",
"size": 501290
} | [
"java.io.IOException",
"org.eclipse.core.runtime.IProgressMonitor"
] | import java.io.IOException; import org.eclipse.core.runtime.IProgressMonitor; | import java.io.*; import org.eclipse.core.runtime.*; | [
"java.io",
"org.eclipse.core"
] | java.io; org.eclipse.core; | 598,834 |
public void elementStarted(String name,
String systemId,
int lineNr)
{
Properties attribs
= (Properties) this.attributeDefaultValues.get(name);
if (attribs == null) {
attribs = new Properties();
} else {
attribs = (Properties) attribs.clone();
}
this.currentElements.push(attribs);
} | void function(String name, String systemId, int lineNr) { Properties attribs = (Properties) this.attributeDefaultValues.get(name); if (attribs == null) { attribs = new Properties(); } else { attribs = (Properties) attribs.clone(); } this.currentElements.push(attribs); } | /**
* Indicates that an element has been started.
*
* @param name the name of the element.
* @param systemId the system ID of the XML data of the element.
* @param lineNr the line number in the XML data of the element.
*/ | Indicates that an element has been started | elementStarted | {
"repo_name": "runqingz/umple",
"path": "Umplificator/UmplifiedProjects/jhotdraw7/srcUmple/net/n3/nanoxml/NonValidator.java",
"license": "mit",
"size": 16734
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 134,708 |
public void readFont(InputStream is, String name, FontContainer fontContainer,
Map<Integer, Integer> subsetGlyphs, boolean cid) throws IOException {
this.cid = cid;
if (subsetGlyphs.isEmpty()) {
return;
}
this.fontFile = new FontFileReader(is);
size += fontFile.getAllBytes().length;
readDirTabs();
readFontHeader();
getNumGlyphs();
readHorizontalHeader();
readHorizontalMetrics();
readIndexToLocation();
int sgsize = subsetGlyphs.size();
if (!cid && subsetGlyphs.size() <= 1) {
for (int i = 0; i < mtxTab.length; i++) {
subsetGlyphs.put(i, i);
}
}
scanGlyphs(fontFile, subsetGlyphs);
readGlyf(subsetGlyphs, fontFile);
if (nhmtxDiff == null) {
nhmtxDiff = sgsize - nhmtx;
if (nhmtxDiff < 0) {
nhmtxDiff = 0;
}
}
} | void function(InputStream is, String name, FontContainer fontContainer, Map<Integer, Integer> subsetGlyphs, boolean cid) throws IOException { this.cid = cid; if (subsetGlyphs.isEmpty()) { return; } this.fontFile = new FontFileReader(is); size += fontFile.getAllBytes().length; readDirTabs(); readFontHeader(); getNumGlyphs(); readHorizontalHeader(); readHorizontalMetrics(); readIndexToLocation(); int sgsize = subsetGlyphs.size(); if (!cid && subsetGlyphs.size() <= 1) { for (int i = 0; i < mtxTab.length; i++) { subsetGlyphs.put(i, i); } } scanGlyphs(fontFile, subsetGlyphs); readGlyf(subsetGlyphs, fontFile); if (nhmtxDiff == null) { nhmtxDiff = sgsize - nhmtx; if (nhmtxDiff < 0) { nhmtxDiff = 0; } } } | /**
* Returns a subset of the original font.
*
* @param is font file
* @param name name
* @param fontContainer fontContainer
* @param subsetGlyphs Map of glyphs (glyphs has old index as (Integer) key and
* new index as (Integer) value)
* @param cid is cid
* @throws IOException in case of an I/O problem
*/ | Returns a subset of the original font | readFont | {
"repo_name": "sbsdev/fop-pdf-images",
"path": "src/main/java/org/apache/fop/renderer/pdf/pdfbox/MergeTTFonts.java",
"license": "apache-2.0",
"size": 16952
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.Map",
"org.apache.fop.fonts.truetype.FontFileReader"
] | import java.io.IOException; import java.io.InputStream; import java.util.Map; import org.apache.fop.fonts.truetype.FontFileReader; | import java.io.*; import java.util.*; import org.apache.fop.fonts.truetype.*; | [
"java.io",
"java.util",
"org.apache.fop"
] | java.io; java.util; org.apache.fop; | 618,196 |
public void setParents(TreeBrowserDisplay node, Collection parents);
| void function(TreeBrowserDisplay node, Collection parents); | /**
* Converts the collection of parents into their corresponding UI
* components and adds them to the passed node.
*
* @param node The node to handle. Mustn't be <code>null</code>.
* @param parents Collection of parents to display.
*/ | Converts the collection of parents into their corresponding UI components and adds them to the passed node | setParents | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/metadata/browser/Browser.java",
"license": "gpl-2.0",
"size": 3815
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 2,645,551 |
public Rectangle2D getViewArea() {
return viewArea;
} | Rectangle2D function() { return viewArea; } | /**
* Get the view area of this viewport.
*
* @return the viewport rectangle area
*/ | Get the view area of this viewport | getViewArea | {
"repo_name": "Distrotech/fop",
"path": "src/java/org/apache/fop/area/RegionViewport.java",
"license": "apache-2.0",
"size": 4388
} | [
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,089,805 |
@SuppressWarnings("unused")
@CalledByNative
private void initFromNativeTabContents(int nativeTabContents) {
mContentView = ContentView.newInstance(
getContext(), nativeTabContents, ContentView.PERSONALITY_CHROME);
if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.getUrl());
((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentView,
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.MATCH_PARENT));
mContentView.requestFocus();
} | @SuppressWarnings(STR) void function(int nativeTabContents) { mContentView = ContentView.newInstance( getContext(), nativeTabContents, ContentView.PERSONALITY_CHROME); if (mContentView.getUrl() != null) mUrlTextView.setText(mContentView.getUrl()); ((FrameLayout) findViewById(R.id.contentview_holder)).addView(mContentView, new FrameLayout.LayoutParams( FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); mContentView.requestFocus(); } | /**
* Initializes the ContentView based on the native tab contents pointer passed in.
* @param nativeTabContents The pointer to the native tab contents object.
*/ | Initializes the ContentView based on the native tab contents pointer passed in | initFromNativeTabContents | {
"repo_name": "Crystalnix/BitPop",
"path": "content/shell/android/java/src/org/chromium/content_shell/Shell.java",
"license": "bsd-3-clause",
"size": 7045
} | [
"android.widget.FrameLayout",
"org.chromium.content.browser.ContentView"
] | import android.widget.FrameLayout; import org.chromium.content.browser.ContentView; | import android.widget.*; import org.chromium.content.browser.*; | [
"android.widget",
"org.chromium.content"
] | android.widget; org.chromium.content; | 787,534 |
@SimpleFunction(description = "Requests the " + MAX_MENTIONS_RETURNED
+ " most "
+ "recent mentions of the logged-in user. When the mentions have been "
+ "retrieved, the system will raise the <code>MentionsReceived</code> "
+ "event and set the <code>Mentions</code> property to the list of "
+ "mentions."
+ "<p><u>Requirements</u>: This should only be called after the "
+ "<code>IsAuthorized</code> event has been raised, indicating that the "
+ "user has successfully logged in to Twitter.</p>")
public void RequestMentions() {
if (twitter == null || userName.length() == 0) {
form.dispatchErrorOccurredEvent(this, "RequestMentions",
ErrorMessages.ERROR_TWITTER_REQUEST_MENTIONS_FAILED, "Need to login?");
return;
}
AsynchUtil.runAsynchronously(new Runnable() {
List<Status> replies = Collections.emptyList(); | @SimpleFunction(description = STR + MAX_MENTIONS_RETURNED + STR + STR + STR + STR + STR + STR + STR + STR) void function() { if (twitter == null userName.length() == 0) { form.dispatchErrorOccurredEvent(this, STR, ErrorMessages.ERROR_TWITTER_REQUEST_MENTIONS_FAILED, STR); return; } AsynchUtil.runAsynchronously(new Runnable() { List<Status> replies = Collections.emptyList(); | /**
* Gets the most recent messages where your username is mentioned.
*/ | Gets the most recent messages where your username is mentioned | RequestMentions | {
"repo_name": "anseo/friedgerAI24BLE",
"path": "appinventor/components/src/com/google/appinventor/components/runtime/Twitter.java",
"license": "mit",
"size": 38565
} | [
"com.google.appinventor.components.annotations.SimpleFunction",
"com.google.appinventor.components.runtime.util.AsynchUtil",
"com.google.appinventor.components.runtime.util.ErrorMessages",
"java.util.Collections",
"java.util.List"
] | import com.google.appinventor.components.annotations.SimpleFunction; import com.google.appinventor.components.runtime.util.AsynchUtil; import com.google.appinventor.components.runtime.util.ErrorMessages; import java.util.Collections; import java.util.List; | import com.google.appinventor.components.annotations.*; import com.google.appinventor.components.runtime.util.*; import java.util.*; | [
"com.google.appinventor",
"java.util"
] | com.google.appinventor; java.util; | 1,363,997 |
if (sIsBrowserInitialized) return true;
Log.d(TAG, "Performing one-time browser initialization");
// Initializing the command line must occur before loading the library.
if (!CommandLine.isInitialized()) {
ContentApplication.initCommandLine(context);
if (context instanceof Activity) {
Intent launchingIntent = ((Activity) context).getIntent();
String[] commandLineParams = getCommandLineParamsFromIntent(launchingIntent);
if (commandLineParams != null) {
CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams);
}
}
}
CommandLine.getInstance().appendSwitchWithValue(
ContentSwitches.FORCE_DEVICE_SCALE_FACTOR, "1");
waitForDebuggerIfNeeded();
DeviceUtils.addDeviceSpecificUserAgentSwitch(context);
try {
LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized();
Log.d(TAG, "Loading BrowserStartupController...");
BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER)
.startBrowserProcessesSync(false);
NetworkChangeNotifier.init(context);
// Cast shell always expects to receive notifications to track network state.
NetworkChangeNotifier.registerToReceiveNotificationsAlways();
sIsBrowserInitialized = true;
return true;
} catch (ProcessInitException e) {
Log.e(TAG, "Unable to launch browser process.", e);
return false;
}
} | if (sIsBrowserInitialized) return true; Log.d(TAG, STR); if (!CommandLine.isInitialized()) { ContentApplication.initCommandLine(context); if (context instanceof Activity) { Intent launchingIntent = ((Activity) context).getIntent(); String[] commandLineParams = getCommandLineParamsFromIntent(launchingIntent); if (commandLineParams != null) { CommandLine.getInstance().appendSwitchesAndArguments(commandLineParams); } } } CommandLine.getInstance().appendSwitchWithValue( ContentSwitches.FORCE_DEVICE_SCALE_FACTOR, "1"); waitForDebuggerIfNeeded(); DeviceUtils.addDeviceSpecificUserAgentSwitch(context); try { LibraryLoader.get(LibraryProcessType.PROCESS_BROWSER).ensureInitialized(); Log.d(TAG, STR); BrowserStartupController.get(context, LibraryProcessType.PROCESS_BROWSER) .startBrowserProcessesSync(false); NetworkChangeNotifier.init(context); NetworkChangeNotifier.registerToReceiveNotificationsAlways(); sIsBrowserInitialized = true; return true; } catch (ProcessInitException e) { Log.e(TAG, STR, e); return false; } } | /**
* Starts the browser process synchronously, returning success or failure. If the browser has
* already started, immediately returns true without performing any more initialization.
* This may only be called on the UI thread.
*
* @return whether or not the process started successfully
*/ | Starts the browser process synchronously, returning success or failure. If the browser has already started, immediately returns true without performing any more initialization. This may only be called on the UI thread | initializeBrowser | {
"repo_name": "guorendong/iridium-browser-ubuntu",
"path": "chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastBrowserHelper.java",
"license": "bsd-3-clause",
"size": 3724
} | [
"android.app.Activity",
"android.content.Intent",
"android.util.Log",
"org.chromium.base.CommandLine",
"org.chromium.base.library_loader.LibraryLoader",
"org.chromium.base.library_loader.LibraryProcessType",
"org.chromium.base.library_loader.ProcessInitException",
"org.chromium.content.app.ContentApplication",
"org.chromium.content.browser.BrowserStartupController",
"org.chromium.content.browser.DeviceUtils",
"org.chromium.content.common.ContentSwitches",
"org.chromium.net.NetworkChangeNotifier"
] | import android.app.Activity; import android.content.Intent; import android.util.Log; import org.chromium.base.CommandLine; import org.chromium.base.library_loader.LibraryLoader; import org.chromium.base.library_loader.LibraryProcessType; import org.chromium.base.library_loader.ProcessInitException; import org.chromium.content.app.ContentApplication; import org.chromium.content.browser.BrowserStartupController; import org.chromium.content.browser.DeviceUtils; import org.chromium.content.common.ContentSwitches; import org.chromium.net.NetworkChangeNotifier; | import android.app.*; import android.content.*; import android.util.*; import org.chromium.base.*; import org.chromium.base.library_loader.*; import org.chromium.content.app.*; import org.chromium.content.browser.*; import org.chromium.content.common.*; import org.chromium.net.*; | [
"android.app",
"android.content",
"android.util",
"org.chromium.base",
"org.chromium.content",
"org.chromium.net"
] | android.app; android.content; android.util; org.chromium.base; org.chromium.content; org.chromium.net; | 679,162 |
private void buildGetOIDListBody(InvocableMemberBodyBuilder bodyBuilder) {
// List<String> result = new ArrayList<String>(list.size());
bodyBuilder.appendFormalLine(String.format(
"%s result = new %s(%s.size());",
helper.getFinalTypeName(LIST_STRING),
helper.getFinalTypeName(ARRAYLIST_STRING), listOfEntityName));
// for (Pet pet :list) {
bodyBuilder.appendFormalLine(String.format("for (%s %s : %s) {",
helper.getFinalTypeName(entity), entityName, listOfEntityName));
bodyBuilder.indent();
// result.add(conversionService_batch.convert(pet.getId(),
// String.class));
bodyBuilder.appendFormalLine(String.format(
"result.add(%s.convert(%s.%s(), %s.class));",
getConversionServiceField().getFieldName(), entityName, helper
.getGetterMethodNameForField(entityIdentifier
.getFieldName()), helper
.getFinalTypeName(JavaType.STRING)));
// }
bodyBuilder.indentRemove();
bodyBuilder.appendFormalLine("}");
// return result;
bodyBuilder.appendFormalLine("return result;");
} | void function(InvocableMemberBodyBuilder bodyBuilder) { bodyBuilder.appendFormalLine(String.format( STR, helper.getFinalTypeName(LIST_STRING), helper.getFinalTypeName(ARRAYLIST_STRING), listOfEntityName)); bodyBuilder.appendFormalLine(String.format(STR, helper.getFinalTypeName(entity), entityName, listOfEntityName)); bodyBuilder.indent(); bodyBuilder.appendFormalLine(String.format( STR, getConversionServiceField().getFieldName(), entityName, helper .getGetterMethodNameForField(entityIdentifier .getFieldName()), helper .getFinalTypeName(JavaType.STRING))); bodyBuilder.indentRemove(); bodyBuilder.appendFormalLine("}"); bodyBuilder.appendFormalLine(STR); } | /**
* Build method body for getOIDList method
*
* @param bodyBuilder
*/ | Build method body for getOIDList method | buildGetOIDListBody | {
"repo_name": "osroca/gvnix",
"path": "addon-web-mvc/addon/src/main/java/org/gvnix/addon/web/mvc/addon/batch/WebJpaBatchMetadata.java",
"license": "gpl-3.0",
"size": 58704
} | [
"org.springframework.roo.classpath.itd.InvocableMemberBodyBuilder",
"org.springframework.roo.model.JavaType"
] | import org.springframework.roo.classpath.itd.InvocableMemberBodyBuilder; import org.springframework.roo.model.JavaType; | import org.springframework.roo.classpath.itd.*; import org.springframework.roo.model.*; | [
"org.springframework.roo"
] | org.springframework.roo; | 1,909,120 |
protected HttpResponse perform(HttpRequestBase method, HttpContext context) throws Exception {
return getHttpClient().execute(method, context);
} | HttpResponse function(HttpRequestBase method, HttpContext context) throws Exception { return getHttpClient().execute(method, context); } | /**
* Performs request method with HttpContext. HttpContext typically contains cookie store with all cookies to include
* with request
*
* @param method request method
* @param context httpcontext
* @return request response
* @throws Exception
*/ | Performs request method with HttpContext. HttpContext typically contains cookie store with all cookies to include with request | perform | {
"repo_name": "forcedotcom/aura",
"path": "aura-integration-test/src/test/java/org/auraframework/integration/test/util/IntegrationTestCase.java",
"license": "apache-2.0",
"size": 8487
} | [
"org.apache.http.HttpResponse",
"org.apache.http.client.methods.HttpRequestBase",
"org.apache.http.protocol.HttpContext"
] | import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.protocol.HttpContext; | import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.protocol.*; | [
"org.apache.http"
] | org.apache.http; | 2,772,487 |
private int primUpdate(IPermission perm, PreparedStatement ps) throws Exception
{
java.sql.Timestamp ts = null;
// UPDATE COLUMNS:
ps.clearParameters();
// TYPE:
if ( perm.getType() == null )
{ ps.setNull(1, Types.VARCHAR); }
else
{ ps.setString(1, perm.getType()); }
// EFFECTIVE:
if ( perm.getEffective() == null )
{ ps.setNull(2, Types.TIMESTAMP); }
else
{
ts = new java.sql.Timestamp(perm.getEffective().getTime());
ps.setTimestamp(2, ts);
}
// EXPIRES:
if ( perm.getExpires() == null )
{ ps.setNull(3, Types.TIMESTAMP); }
else
{
ts = new java.sql.Timestamp(perm.getExpires().getTime());
ps.setTimestamp(3, ts);
}
// WHERE COLUMNS:
ps.setString(4, perm.getOwner());
ps.setInt( 5, getPrincipalType(perm));
ps.setString(6, getPrincipalKey(perm));
ps.setString(7, perm.getActivity());
ps.setString(8, perm.getTarget());
if (log.isDebugEnabled())
log.debug("RDBMPermissionImpl.primUpdate(): " + ps);
return ps.executeUpdate();
} | int function(IPermission perm, PreparedStatement ps) throws Exception { java.sql.Timestamp ts = null; ps.clearParameters(); if ( perm.getType() == null ) { ps.setNull(1, Types.VARCHAR); } else { ps.setString(1, perm.getType()); } if ( perm.getEffective() == null ) { ps.setNull(2, Types.TIMESTAMP); } else { ts = new java.sql.Timestamp(perm.getEffective().getTime()); ps.setTimestamp(2, ts); } if ( perm.getExpires() == null ) { ps.setNull(3, Types.TIMESTAMP); } else { ts = new java.sql.Timestamp(perm.getExpires().getTime()); ps.setTimestamp(3, ts); } ps.setString(4, perm.getOwner()); ps.setInt( 5, getPrincipalType(perm)); ps.setString(6, getPrincipalKey(perm)); ps.setString(7, perm.getActivity()); ps.setString(8, perm.getTarget()); if (log.isDebugEnabled()) log.debug(STR + ps); return ps.executeUpdate(); } | /**
* Set the params on the PreparedStatement and execute the update.
* @param perm org.jasig.portal.security.IPermission
* @param ps java.sql.PreparedStatement - the PreparedStatement for updating a Permission row.
* @return int - the return code from the PreparedStatement
* @exception Exception
*/ | Set the params on the PreparedStatement and execute the update | primUpdate | {
"repo_name": "ASU-Capstone/uPortal-Forked",
"path": "uportal-war/src/main/java/org/jasig/portal/security/provider/RDBMPermissionImpl.java",
"license": "apache-2.0",
"size": 30705
} | [
"java.sql.PreparedStatement",
"java.sql.Timestamp",
"java.sql.Types",
"org.jasig.portal.security.IPermission"
] | import java.sql.PreparedStatement; import java.sql.Timestamp; import java.sql.Types; import org.jasig.portal.security.IPermission; | import java.sql.*; import org.jasig.portal.security.*; | [
"java.sql",
"org.jasig.portal"
] | java.sql; org.jasig.portal; | 1,875,341 |
@Deprecated
public void setSessionAuthenticationStrategy(SessionAuthenticationStrategy sessionAuthenticationStrategy) {
Assert.notNull(sessionAuthenticationStrategy, "authenticatedSessionStrategy must not be null");
this.sessionAuthenticationStrategy = sessionAuthenticationStrategy;
} | void function(SessionAuthenticationStrategy sessionAuthenticationStrategy) { Assert.notNull(sessionAuthenticationStrategy, STR); this.sessionAuthenticationStrategy = sessionAuthenticationStrategy; } | /**
* Sets the strategy object which handles the session management behaviour when a
* user has been authenticated during the current request.
*
* @param sessionAuthenticationStrategy the strategy object. If not set, a {@link SessionFixationProtectionStrategy} is used.
* @deprecated Use constructor injection
*/ | Sets the strategy object which handles the session management behaviour when a user has been authenticated during the current request | setSessionAuthenticationStrategy | {
"repo_name": "dsyer/spring-security",
"path": "web/src/main/java/org/springframework/security/web/session/SessionManagementFilter.java",
"license": "apache-2.0",
"size": 7119
} | [
"org.springframework.security.web.authentication.session.SessionAuthenticationStrategy",
"org.springframework.util.Assert"
] | import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; import org.springframework.util.Assert; | import org.springframework.security.web.authentication.session.*; import org.springframework.util.*; | [
"org.springframework.security",
"org.springframework.util"
] | org.springframework.security; org.springframework.util; | 923,907 |
@TargetApi(21)
public void register() {
if (receiver != null) {
Intent initialStickyIntent =
context.registerReceiver(receiver, new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG));
if (initialStickyIntent != null) {
receiver.onReceive(context, initialStickyIntent);
return;
}
}
listener.onAudioCapabilitiesChanged(DEFAULT_AUDIO_CAPABILITIES);
} | @TargetApi(21) void function() { if (receiver != null) { Intent initialStickyIntent = context.registerReceiver(receiver, new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG)); if (initialStickyIntent != null) { receiver.onReceive(context, initialStickyIntent); return; } } listener.onAudioCapabilitiesChanged(DEFAULT_AUDIO_CAPABILITIES); } | /**
* Registers to notify the listener when audio capabilities change. The listener will immediately
* receive the current audio capabilities. It is important to call {@link #unregister} so that
* the listener can be garbage collected.
*/ | Registers to notify the listener when audio capabilities change. The listener will immediately receive the current audio capabilities. It is important to call <code>#unregister</code> so that the listener can be garbage collected | register | {
"repo_name": "galihrepo/ExoPlayer",
"path": "library/src/main/java/com/google/android/exoplayer/audio/AudioCapabilitiesReceiver.java",
"license": "apache-2.0",
"size": 3730
} | [
"android.annotation.TargetApi",
"android.content.Intent",
"android.content.IntentFilter",
"android.media.AudioManager"
] | import android.annotation.TargetApi; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; | import android.annotation.*; import android.content.*; import android.media.*; | [
"android.annotation",
"android.content",
"android.media"
] | android.annotation; android.content; android.media; | 2,593,333 |
@SuppressWarnings("unchecked")
public static <T extends Serializable> T safeGetSerializableExtra(Intent intent, String name) {
try {
return (T) intent.getSerializableExtra(name);
} catch (ClassCastException ex) {
Log.e(TAG, "Invalide class for Serializable: " + name, ex);
return null;
} catch (Throwable t) {
// Catches un-serializable exceptions.
Log.e(TAG, "getSerializableExtra failed on intent " + intent);
return null;
}
} | @SuppressWarnings(STR) static <T extends Serializable> T function(Intent intent, String name) { try { return (T) intent.getSerializableExtra(name); } catch (ClassCastException ex) { Log.e(TAG, STR + name, ex); return null; } catch (Throwable t) { Log.e(TAG, STR + intent); return null; } } | /**
* Just like {@link Intent#getSerializableExtra(String)} but doesn't throw exceptions.
*/ | Just like <code>Intent#getSerializableExtra(String)</code> but doesn't throw exceptions | safeGetSerializableExtra | {
"repo_name": "endlessm/chromium-browser",
"path": "base/android/java/src/org/chromium/base/IntentUtils.java",
"license": "bsd-3-clause",
"size": 16738
} | [
"android.content.Intent",
"java.io.Serializable"
] | import android.content.Intent; import java.io.Serializable; | import android.content.*; import java.io.*; | [
"android.content",
"java.io"
] | android.content; java.io; | 2,245,822 |
public static Expression getFirstPKColumnExpression(Connection conn, String fullTableName) throws SQLException {
PTable table = getTable(conn, fullTableName);
return getFirstPKColumnExpression(table);
} | static Expression function(Connection conn, String fullTableName) throws SQLException { PTable table = getTable(conn, fullTableName); return getFirstPKColumnExpression(table); } | /**
* Get expression that may be used to evaluate to the value of the first
* column of a given row in a Phoenix table.
* @param conn open Phoenix connection
* @param fullTableName full table name
* @return An expression that may be evaluated for a row in the provided table.
* @throws SQLException if the table name is not found, a TableNotFoundException
* is thrown. If a local index is supplied a SQLFeatureNotSupportedException
* is thrown.
*/ | Get expression that may be used to evaluate to the value of the first column of a given row in a Phoenix table | getFirstPKColumnExpression | {
"repo_name": "twdsilva/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/PhoenixRuntime.java",
"license": "apache-2.0",
"size": 71490
} | [
"java.sql.Connection",
"java.sql.SQLException",
"org.apache.phoenix.expression.Expression",
"org.apache.phoenix.schema.PTable"
] | import java.sql.Connection; import java.sql.SQLException; import org.apache.phoenix.expression.Expression; import org.apache.phoenix.schema.PTable; | import java.sql.*; import org.apache.phoenix.expression.*; import org.apache.phoenix.schema.*; | [
"java.sql",
"org.apache.phoenix"
] | java.sql; org.apache.phoenix; | 972,770 |
@Test
void checkAllMatrixMult() {
int numChecked = 0;
Method methods[] = CommonOps_ZDRM.class.getMethods();
for (Method method : methods) {
String name = method.getName();
if (!name.startsWith("mult"))
continue;
// System.out.println(name);
Class[] params = method.getParameterTypes();
boolean add = name.contains("Add");
boolean hasAlpha = double.class == params[0];
boolean transA = name.contains("TransA");
boolean transB = name.contains("TransB");
if (name.contains("TransAB"))
transA = transB = true;
try {
TestMatrixMatrixMult_ZDRM.check(method, add, hasAlpha, transA, transB);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
numChecked++;
}
assertEquals(16, numChecked);
} | void checkAllMatrixMult() { int numChecked = 0; Method methods[] = CommonOps_ZDRM.class.getMethods(); for (Method method : methods) { String name = method.getName(); if (!name.startsWith("mult")) continue; Class[] params = method.getParameterTypes(); boolean add = name.contains("Add"); boolean hasAlpha = double.class == params[0]; boolean transA = name.contains(STR); boolean transB = name.contains(STR); if (name.contains(STR)) transA = transB = true; try { TestMatrixMatrixMult_ZDRM.check(method, add, hasAlpha, transA, transB); } catch (InvocationTargetException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } numChecked++; } assertEquals(16, numChecked); } | /**
* Make sure the multiplication methods here have the same behavior as the ones in MatrixMatrixMult.
*/ | Make sure the multiplication methods here have the same behavior as the ones in MatrixMatrixMult | checkAllMatrixMult | {
"repo_name": "lessthanoptimal/ejml",
"path": "main/ejml-zdense/test/org/ejml/dense/row/TestCommonOps_ZDRM.java",
"license": "apache-2.0",
"size": 24364
} | [
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method",
"org.junit.jupiter.api.Assertions"
] | import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.junit.jupiter.api.Assertions; | import java.lang.reflect.*; import org.junit.jupiter.api.*; | [
"java.lang",
"org.junit.jupiter"
] | java.lang; org.junit.jupiter; | 95,351 |
public int getRunLimit(Set<? extends Attribute> attributes); | int function(Set<? extends Attribute> attributes); | /**
* Returns the index of the last character in the run that has the same
* attribute values for the attributes in the set as the current character.
*
* @param attributes
* the set of attributes which the run is based on.
* @return the index of the last character of the current run.
*/ | Returns the index of the last character in the run that has the same attribute values for the attributes in the set as the current character | getRunLimit | {
"repo_name": "openweave/openweave-core",
"path": "third_party/android/platform-libcore/android-platform-libcore/luni/src/main/java/java/text/AttributedCharacterIterator.java",
"license": "apache-2.0",
"size": 8416
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,369,094 |
public static Metric<AbstractILMultiDimensional> createPrecisionMetric(boolean monotonic) {
return __MetricV2.createPrecisionMetric(monotonic);
}
| static Metric<AbstractILMultiDimensional> function(boolean monotonic) { return __MetricV2.createPrecisionMetric(monotonic); } | /**
* Creates an instance of the precision metric.
* The default aggregate function, which is the arithmetic mean, will be used.
* This metric will respect attribute weights defined in the configuration.
*
* @param monotonic If set to true, the monotonic variant of the metric will be created
*
* @return
*/ | Creates an instance of the precision metric. The default aggregate function, which is the arithmetic mean, will be used. This metric will respect attribute weights defined in the configuration | createPrecisionMetric | {
"repo_name": "arx-deidentifier/arx",
"path": "src/main/org/deidentifier/arx/metric/Metric.java",
"license": "apache-2.0",
"size": 74297
} | [
"org.deidentifier.arx.metric.v2.AbstractILMultiDimensional"
] | import org.deidentifier.arx.metric.v2.AbstractILMultiDimensional; | import org.deidentifier.arx.metric.v2.*; | [
"org.deidentifier.arx"
] | org.deidentifier.arx; | 243,828 |
public void deletePreset(String presetName) {
DeletePresetRequest request = new DeletePresetRequest();
request.setPresetName(presetName);
deletePreset(request);
} | void function(String presetName) { DeletePresetRequest request = new DeletePresetRequest(); request.setPresetName(presetName); deletePreset(request); } | /**
* Deletes a preset with specified name.
*
* @param presetName The name of a preset.
*
*/ | Deletes a preset with specified name | deletePreset | {
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/media/MediaClient.java",
"license": "apache-2.0",
"size": 91398
} | [
"com.baidubce.services.media.model.DeletePresetRequest"
] | import com.baidubce.services.media.model.DeletePresetRequest; | import com.baidubce.services.media.model.*; | [
"com.baidubce.services"
] | com.baidubce.services; | 1,847,309 |
public Module getModule(String uri) {
return ModuleUtils.getModule(_modules,uri);
} | Module function(String uri) { return ModuleUtils.getModule(_modules,uri); } | /**
* Returns the module identified by a given URI.
* <p>
* @param uri the URI of the ModuleImpl.
* @return The module with the given URI, <b>null</b> if none.
*/ | Returns the module identified by a given URI. | getModule | {
"repo_name": "4thline/feeds",
"path": "src/main/java/com/sun/syndication/feed/atom/Person.java",
"license": "agpl-3.0",
"size": 5381
} | [
"com.sun.syndication.feed.module.Module",
"com.sun.syndication.feed.module.impl.ModuleUtils"
] | import com.sun.syndication.feed.module.Module; import com.sun.syndication.feed.module.impl.ModuleUtils; | import com.sun.syndication.feed.module.*; import com.sun.syndication.feed.module.impl.*; | [
"com.sun.syndication"
] | com.sun.syndication; | 1,801,847 |
@Message(id = 96, value = "No protocols in common, supported=(%s), requested=(%s)")
StartException noProtocolsInCommon(String supported, String requested); | @Message(id = 96, value = STR) StartException noProtocolsInCommon(String supported, String requested); | /**
* Create an {@link StartException} where the requested protocols do not match any of the supported protocols.
*
* @param supported the supported protocols
* @param requested the requested protocols
* @return a {@link StartException} for the error.
*/ | Create an <code>StartException</code> where the requested protocols do not match any of the supported protocols | noProtocolsInCommon | {
"repo_name": "aloubyansky/wildfly-core",
"path": "domain-management/src/main/java/org/jboss/as/domain/management/logging/DomainManagementLogger.java",
"license": "lgpl-2.1",
"size": 66389
} | [
"org.jboss.logging.annotations.Message",
"org.jboss.msc.service.StartException"
] | import org.jboss.logging.annotations.Message; import org.jboss.msc.service.StartException; | import org.jboss.logging.annotations.*; import org.jboss.msc.service.*; | [
"org.jboss.logging",
"org.jboss.msc"
] | org.jboss.logging; org.jboss.msc; | 1,817,695 |
private boolean initializeInfrastructureMode(String macAddr, String ssid) throws Exception {
WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
int sleep = 0;
// Make sure WiFi is enabled.
Log.i(TAG, "Enabling WiFi");
while (!wifi.isWifiEnabled() && sleep < 10000) { // Wait for no more than 10 secondes
wifi.setWifiEnabled(true);
sleep += 1000;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if (!wifi.isWifiEnabled()) {
Log.e(TAG, "ERROR: Unable to initialize Wifi. Aborting");
Utils.showToast(this, "Wifi problem: Unable to initialize Wifi ");
return false;
}
Log.i(TAG, "WifiEnabled = " + wifi.isWifiEnabled());
WifiInfo info = wifi.getConnectionInfo();
Log.i(TAG, "Wifi info " + info);
String currentSSID = info.getSSID();
Log.d(TAG, "Current SSID=" + currentSSID + " Requested SSID= " + ssid);
if (currentSSID == null || !currentSSID.equals("\"" + ssid + "\"")) { //SSID contains quotes
List<WifiConfiguration> configs = wifi.getConfiguredNetworks();
int myId = -1;
for (int k = 0; k < configs.size(); k++) {
WifiConfiguration config = configs.get(k);
Log.d(TAG, "Searching for SSID= " + ssid + " found SSID= " + config.SSID);
if (configs.get(k).SSID.equals("\"" + ssid + "\"")){ //SSID contains quote marks!
myId = configs.get(k).networkId;
break;
}
}
if (myId == -1) { // Create a new configuration
Log.i(TAG, "ERROR: network " + ssid + " not found");
Utils.showToast(this, "Wifi problem: network " + ssid + " not found");
return false;
//throw new Exception("ERROR: network " + ssid + " not found");
}
Log.i(TAG, "Trying to enable network with SSID = " + ssid + " netId = " + myId);
boolean ok = false;
ok = wifi.enableNetwork(myId, true);
if (!ok) {
Log.i(TAG, "Cannot enable " + ssid);
}
info = wifi.getConnectionInfo();
Log.i(TAG, "Wifi info " + info);
sleep = 0;
while ( !info.getSupplicantState().equals(SupplicantState.COMPLETED)
&& !info.getSupplicantState().equals(SupplicantState.ASSOCIATED)
&& !info.getSupplicantState().equals(SupplicantState.ASSOCIATING)
&& sleep <= 10000) {
Log.d(TAG, "Waiting for network connection, supplicant state = "
+ info.getSupplicantState().toString());
Thread.sleep(1000);
sleep += 1000;
}
if (sleep >= 10000) {
Log.i(TAG, "Timed out trying to connect with SSID = " + ssid);
Utils.showToast(this, "Wifi problem: Timed out trying to connect to " + ssid);
return false;
} else {
Log.i(TAG, "Enabled hfoss network, SSID = " + wifi.getConnectionInfo().getSSID());
}
}
Log.i(TAG, "Wifi info " + info);
return true;
} | boolean function(String macAddr, String ssid) throws Exception { WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); int sleep = 0; Log.i(TAG, STR); while (!wifi.isWifiEnabled() && sleep < 10000) { wifi.setWifiEnabled(true); sleep += 1000; try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } if (!wifi.isWifiEnabled()) { Log.e(TAG, STR); Utils.showToast(this, STR); return false; } Log.i(TAG, STR + wifi.isWifiEnabled()); WifiInfo info = wifi.getConnectionInfo(); Log.i(TAG, STR + info); String currentSSID = info.getSSID(); Log.d(TAG, STR + currentSSID + STR + ssid); if (currentSSID == null !currentSSID.equals("\"STR\STRSearching for SSID= STR found SSID= STR\"STR\STRERROR: network STR not foundSTRWifi problem: network STR not foundSTRTrying to enable network with SSID = STR netId = STRCannot enable " + ssid); } info = wifi.getConnectionInfo(); Log.i(TAG, STR + info); sleep = 0; while ( !info.getSupplicantState().equals(SupplicantState.COMPLETED) && !info.getSupplicantState().equals(SupplicantState.ASSOCIATED) && !info.getSupplicantState().equals(SupplicantState.ASSOCIATING) && sleep <= 10000) { Log.d(TAG, "Waiting for network connection, supplicant state = STRTimed out trying to connect with SSID = STRWifi problem: Timed out trying to connect to STREnabled hfoss network, SSID = " + wifi.getConnectionInfo().getSSID()); } } Log.i(TAG, STR + info); return true; } | /**
* Tries to put the phone in infrastructure mode with SSID = ssid
* @param macAddr this phone's MacAddress
* @param ssid the network's ssid
* @return true iff the phone successfully connects to SSID network
* @throws Exception
*/ | Tries to put the phone in infrastructure mode with SSID = ssid | initializeInfrastructureMode | {
"repo_name": "everdefiant/posit-mobile.plugin",
"path": "src/org/hfoss/adhoc/AdhocService.java",
"license": "lgpl-2.1",
"size": 20830
} | [
"android.content.Context",
"android.net.wifi.SupplicantState",
"android.net.wifi.WifiInfo",
"android.net.wifi.WifiManager",
"android.util.Log",
"org.hfoss.posit.android.utilities.Utils"
] | import android.content.Context; import android.net.wifi.SupplicantState; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.util.Log; import org.hfoss.posit.android.utilities.Utils; | import android.content.*; import android.net.wifi.*; import android.util.*; import org.hfoss.posit.android.utilities.*; | [
"android.content",
"android.net",
"android.util",
"org.hfoss.posit"
] | android.content; android.net; android.util; org.hfoss.posit; | 2,222,942 |
public void readData(DataInput in, boolean forceExtFormat) throws IOException
{
final int ctrl = in.readUnsignedByte();
int dataLen;
extFormat = forceExtFormat || (ctrl & 0x80) == 0;
if (extFormat)
dataLen = readDataExtendedHeader(in, ctrl);
else dataLen = readDataShortHeader(in, ctrl);
// TPCI - transport control field
int tpci = in.readUnsignedByte();
transport = Transport.valueOf(dest instanceof GroupAddress, tpci);
if (transport == null)
throw new InvalidDataException("TPCI contains no valid transport type", tpci);
if (transport.hasSequence)
sequence = (tpci >> 2) & 15;
else sequence = 0;
if ((transport.mask & 3) == 0)
{
// APCI - application type & data bits
final int apciByte = in.readUnsignedByte();
final int apci = ((tpci & 3) << 8) | apciByte;
final ApplicationType type = ApplicationType.valueOf(apci);
application = ApplicationFactory.createApplication(type);
final int dataMask = type.getDataMask();
application.setApciValue(apciByte & dataMask);
if (dataLen > 1)
application.readData(in, dataLen - 1);
}
else
{
application = null;
}
} | void function(DataInput in, boolean forceExtFormat) throws IOException { final int ctrl = in.readUnsignedByte(); int dataLen; extFormat = forceExtFormat (ctrl & 0x80) == 0; if (extFormat) dataLen = readDataExtendedHeader(in, ctrl); else dataLen = readDataShortHeader(in, ctrl); int tpci = in.readUnsignedByte(); transport = Transport.valueOf(dest instanceof GroupAddress, tpci); if (transport == null) throw new InvalidDataException(STR, tpci); if (transport.hasSequence) sequence = (tpci >> 2) & 15; else sequence = 0; if ((transport.mask & 3) == 0) { final int apciByte = in.readUnsignedByte(); final int apci = ((tpci & 3) << 8) apciByte; final ApplicationType type = ApplicationType.valueOf(apci); application = ApplicationFactory.createApplication(type); final int dataMask = type.getDataMask(); application.setApciValue(apciByte & dataMask); if (dataLen > 1) application.readData(in, dataLen - 1); } else { application = null; } } | /**
* Initialize the object from a {@link DataInput data input stream}. The
* first byte of the stream is expected to be the first byte of the frame
* body, excluding the frame type.
*
* @param in - the input stream to read.
* @param forceExtFormat - enforce extended frame format.
*
* @throws InvalidDataException
*/ | Initialize the object from a <code>DataInput data input stream</code>. The first byte of the stream is expected to be the first byte of the frame body, excluding the frame type | readData | {
"repo_name": "Paolo-Maffei/freebus-fts",
"path": "freebus-fts-knxcomm/src/main/java/org/freebus/knxcomm/telegram/Telegram.java",
"license": "gpl-3.0",
"size": 17404
} | [
"java.io.DataInput",
"java.io.IOException",
"org.freebus.fts.common.address.GroupAddress",
"org.freebus.knxcomm.application.ApplicationFactory",
"org.freebus.knxcomm.application.ApplicationType"
] | import java.io.DataInput; import java.io.IOException; import org.freebus.fts.common.address.GroupAddress; import org.freebus.knxcomm.application.ApplicationFactory; import org.freebus.knxcomm.application.ApplicationType; | import java.io.*; import org.freebus.fts.common.address.*; import org.freebus.knxcomm.application.*; | [
"java.io",
"org.freebus.fts",
"org.freebus.knxcomm"
] | java.io; org.freebus.fts; org.freebus.knxcomm; | 1,302,735 |
void saveScmUsed() {
if (scmUsedFile.exists() && !scmUsedFile.delete()) {
LOG.warn("Failed to delete old scmUsed file in {}.", rootDir);
}
OutputStreamWriter out = null;
try {
long used = getScmUsed();
if (used > 0) {
out = new OutputStreamWriter(new FileOutputStream(scmUsedFile),
StandardCharsets.UTF_8);
// mtime is written last, so that truncated writes won't be valid.
out.write(Long.toString(used) + " " + Long.toString(Time.now()));
out.flush();
out.close();
out = null;
}
} catch (IOException ioe) {
// If write failed, the volume might be bad. Since the cache file is
// not critical, log the error and continue.
LOG.warn("Failed to write scmUsed to " + scmUsedFile, ioe);
} finally {
IOUtils.cleanupWithLogger(null, out);
}
} | void saveScmUsed() { if (scmUsedFile.exists() && !scmUsedFile.delete()) { LOG.warn(STR, rootDir); } OutputStreamWriter out = null; try { long used = getScmUsed(); if (used > 0) { out = new OutputStreamWriter(new FileOutputStream(scmUsedFile), StandardCharsets.UTF_8); out.write(Long.toString(used) + " " + Long.toString(Time.now())); out.flush(); out.close(); out = null; } } catch (IOException ioe) { LOG.warn(STR + scmUsedFile, ioe); } finally { IOUtils.cleanupWithLogger(null, out); } } | /**
* Write the current scmUsed to the cache file.
*/ | Write the current scmUsed to the cache file | saveScmUsed | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/VolumeUsage.java",
"license": "apache-2.0",
"size": 5345
} | [
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.OutputStreamWriter",
"java.nio.charset.StandardCharsets",
"org.apache.hadoop.io.IOUtils",
"org.apache.hadoop.util.Time"
] | import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.util.Time; | import java.io.*; import java.nio.charset.*; import org.apache.hadoop.io.*; import org.apache.hadoop.util.*; | [
"java.io",
"java.nio",
"org.apache.hadoop"
] | java.io; java.nio; org.apache.hadoop; | 231,554 |
private int findClosestXAxisIndex(XYSeries ps, double targetValue)
{
// Set the initial start and stop indices, ignoring the first and last
// points
int lowerIndex = 1;
int upperIndex = ps.getItemCount() - 2;
// Check if the upper index is less than the lower index
if (upperIndex < lowerIndex)
{
// Set the upper index to the lower index. This prevents the
// possibility of calculating a negative data index
upperIndex = lowerIndex;
}
// Begin the search at the plot's midpoint data index
int dataIndex = (lowerIndex + upperIndex) / 2;
// Continue the search until the plot value matches the mouse pointer
// position or until the lower and upper indices meet
while ((ps.getX(dataIndex).doubleValue() != targetValue)
&& (lowerIndex <= upperIndex))
{
// Check if the plot value is greater than the mouse position value
if (ps.getX(dataIndex).doubleValue() > targetValue)
{
// Decrement the upper index
upperIndex = dataIndex - 1;
}
// The plot value is less than the mouse position value
else
{
// Increment the lower index
lowerIndex = dataIndex + 1;
}
// Recalculate the midpoint index between the updated upper and
// lower indices
dataIndex = (lowerIndex + upperIndex) / 2;
}
// Return the next index after the one located by the search
return ++dataIndex;
} | int function(XYSeries ps, double targetValue) { int lowerIndex = 1; int upperIndex = ps.getItemCount() - 2; if (upperIndex < lowerIndex) { upperIndex = lowerIndex; } int dataIndex = (lowerIndex + upperIndex) / 2; while ((ps.getX(dataIndex).doubleValue() != targetValue) && (lowerIndex <= upperIndex)) { if (ps.getX(dataIndex).doubleValue() > targetValue) { upperIndex = dataIndex - 1; } else { lowerIndex = dataIndex + 1; } dataIndex = (lowerIndex + upperIndex) / 2; } return ++dataIndex; } | /**************************************************************************
* Perform a binary search on the x-axis values for the plot under the
* mouse pointer to find the index into the data set closest to where the
* pointer is positioned
*
* @param ps
* reference to the plot to be searched
*
* @param targetValue
* x-axis coordinate to search for
*
* @return The index of the point in the plot's data set nearest to the
* target value
*************************************************************************/ | Perform a binary search on the x-axis values for the plot under the mouse pointer to find the index into the data set closest to where the pointer is positioned | findClosestXAxisIndex | {
"repo_name": "CACTUS-Mission/TRAPSat",
"path": "TRAPSat_cFS/cfs/cfe/tools/perfutils-java/src/CFSPerformanceMonitor/CPMXYPlotHandler.java",
"license": "mit",
"size": 134723
} | [
"org.jfree.data.xy.XYSeries"
] | import org.jfree.data.xy.XYSeries; | import org.jfree.data.xy.*; | [
"org.jfree.data"
] | org.jfree.data; | 2,503,718 |
@RequestMapping(value = "/editcampaign", method = RequestMethod.GET)
public String edit(@RequestParam(value = "Id", required = true) String ID, ModelMap map) {
logger.debug("### edit method starting...");
CampaignPromotion promotion = promotionService.locateCampaignById(ID);
CampaignPromotionsForm campaignPromotionsForm = new CampaignPromotionsForm(promotion);
campaignPromotionsForm.setPromoCode(promotion.getPromoCode());
List<CurrencyValue> supportedCurrencies = currencyValueService.listActiveCurrencies();
Map<String, BigDecimal> discountAmountMap = new HashMap<String, BigDecimal>();
if (promotion.getCampaignPromotionDiscountAmount() != null
&& promotion.getCampaignPromotionDiscountAmount().size() > 0) {
for (CampaignPromotionDiscountAmount discountAmount : promotion.getCampaignPromotionDiscountAmount()) {
discountAmountMap.put(discountAmount.getCurrencyValue().getCurrencyCode(), discountAmount.getDiscount());
}
} else {
for (CurrencyValue currencyValue : supportedCurrencies) {
discountAmountMap.put(currencyValue.getCurrencyCode(), new BigDecimal(0));
}
}
campaignPromotionsForm.setDiscountAmountMap(discountAmountMap);
map.addAttribute("campaignPromotionsForm", campaignPromotionsForm);
map.addAttribute("channels", channelService.getChannels(null, null, null));
map.addAttribute("restrictedEdit", promotion.getState() == State.ACTIVE);
map.addAttribute("PERCENTAGE", DiscountType.PERCENTAGE);
map.addAttribute("FIXED_AMOUNT", DiscountType.FIXED_AMOUNT);
logger.debug("### edit method ending...");
return "promotions.edit";
} | @RequestMapping(value = STR, method = RequestMethod.GET) String function(@RequestParam(value = "Id", required = true) String ID, ModelMap map) { logger.debug(STR); CampaignPromotion promotion = promotionService.locateCampaignById(ID); CampaignPromotionsForm campaignPromotionsForm = new CampaignPromotionsForm(promotion); campaignPromotionsForm.setPromoCode(promotion.getPromoCode()); List<CurrencyValue> supportedCurrencies = currencyValueService.listActiveCurrencies(); Map<String, BigDecimal> discountAmountMap = new HashMap<String, BigDecimal>(); if (promotion.getCampaignPromotionDiscountAmount() != null && promotion.getCampaignPromotionDiscountAmount().size() > 0) { for (CampaignPromotionDiscountAmount discountAmount : promotion.getCampaignPromotionDiscountAmount()) { discountAmountMap.put(discountAmount.getCurrencyValue().getCurrencyCode(), discountAmount.getDiscount()); } } else { for (CurrencyValue currencyValue : supportedCurrencies) { discountAmountMap.put(currencyValue.getCurrencyCode(), new BigDecimal(0)); } } campaignPromotionsForm.setDiscountAmountMap(discountAmountMap); map.addAttribute(STR, campaignPromotionsForm); map.addAttribute(STR, channelService.getChannels(null, null, null)); map.addAttribute(STR, promotion.getState() == State.ACTIVE); map.addAttribute(STR, DiscountType.PERCENTAGE); map.addAttribute(STR, DiscountType.FIXED_AMOUNT); logger.debug(STR); return STR; } | /**
* This method is used to fetch campaign promotion for editing it.
*
* @param ID
* @param map
* @return String
*/ | This method is used to fetch campaign promotion for editing it | edit | {
"repo_name": "backbrainer/cpbm-customization",
"path": "citrix.cpbm.custom.portal/src/main/java/com/citrix/cpbm/portal/fragment/controllers/AbstractCampaignPromotionsController.java",
"license": "bsd-2-clause",
"size": 10939
} | [
"com.vmops.model.CampaignPromotion",
"com.vmops.model.CampaignPromotionDiscountAmount",
"com.vmops.model.CurrencyValue",
"com.vmops.web.forms.CampaignPromotionsForm",
"java.math.BigDecimal",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.springframework.ui.ModelMap",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.RequestParam"
] | import com.vmops.model.CampaignPromotion; import com.vmops.model.CampaignPromotionDiscountAmount; import com.vmops.model.CurrencyValue; import com.vmops.web.forms.CampaignPromotionsForm; import java.math.BigDecimal; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; | import com.vmops.model.*; import com.vmops.web.forms.*; import java.math.*; import java.util.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*; | [
"com.vmops.model",
"com.vmops.web",
"java.math",
"java.util",
"org.springframework.ui",
"org.springframework.web"
] | com.vmops.model; com.vmops.web; java.math; java.util; org.springframework.ui; org.springframework.web; | 226,277 |
public Enumeration<?> elements() {
return delegate.elements();
}
| Enumeration<?> function() { return delegate.elements(); } | /**
* Returns an enumeration of the components of this list.
*
* @return an enumeration of the components of this list
* @see Vector#elements()
*/ | Returns an enumeration of the components of this list | elements | {
"repo_name": "mbshopM/openconcerto",
"path": "OpenConcerto/src/org/openconcerto/ui/DefaultListModel.java",
"license": "gpl-3.0",
"size": 17050
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 734,561 |
public List<Connection> getConnections() {
return this.connections;
} | List<Connection> function() { return this.connections; } | /**
* Returns the connections for other ports.
* @return the connections
*/ | Returns the connections for other ports | getConnections | {
"repo_name": "asakusafw/asakusafw-mapreduce",
"path": "compiler/core/src/main/java/com/asakusafw/compiler/flow/plan/FlowBlock.java",
"license": "apache-2.0",
"size": 41698
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,177,026 |
public static RelDataType extractLastNFields(RelDataTypeFactory typeFactory,
RelDataType type, int numToKeep) {
assert type.isStruct();
assert type.getFieldCount() >= numToKeep;
final int fieldsCnt = type.getFieldCount();
return typeFactory.createStructType(
type.getFieldList().subList(fieldsCnt - numToKeep, fieldsCnt));
} | static RelDataType function(RelDataTypeFactory typeFactory, RelDataType type, int numToKeep) { assert type.isStruct(); assert type.getFieldCount() >= numToKeep; final int fieldsCnt = type.getFieldCount(); return typeFactory.createStructType( type.getFieldList().subList(fieldsCnt - numToKeep, fieldsCnt)); } | /**
* Keeps only the last N fields and returns the new struct type.
*/ | Keeps only the last N fields and returns the new struct type | extractLastNFields | {
"repo_name": "googleinterns/calcite",
"path": "core/src/main/java/org/apache/calcite/sql/type/SqlTypeUtil.java",
"license": "apache-2.0",
"size": 50603
} | [
"org.apache.calcite.rel.type.RelDataType",
"org.apache.calcite.rel.type.RelDataTypeFactory"
] | import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rel.type.RelDataTypeFactory; | import org.apache.calcite.rel.type.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 2,872,408 |
EAttribute getDocument_Key(); | EAttribute getDocument_Key(); | /**
* Returns the meta object for the attribute '
* {@link de.tudresden.slr.model.bibtex.Document#getKey <em>Key</em>}'. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @return the meta object for the attribute '<em>Key</em>'.
* @see de.tudresden.slr.model.bibtex.Document#getKey()
* @see #getDocument()
* @generated
*/ | Returns the meta object for the attribute ' <code>de.tudresden.slr.model.bibtex.Document#getKey Key</code>'. | getDocument_Key | {
"repo_name": "sebastiangoetz/slr-toolkit",
"path": "plugins/de.tudresden.slr.model.bibtex/src/de/tudresden/slr/model/bibtex/BibtexPackage.java",
"license": "epl-1.0",
"size": 17796
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,747,931 |
public static <T extends Chunkable> List<byte[]> chunksFrom(T chunkable, int chunkLength) {
List<byte[]> chunks = new ArrayList<>();
int chunkCount = chunkCountFrom(chunkable, chunkLength);
for (int i = 0; i < chunkCount; i++) {
byte[] chunk = chunkFrom(chunkable, chunkLength, i);
chunks.add(chunk);
}
return chunks;
} | static <T extends Chunkable> List<byte[]> function(T chunkable, int chunkLength) { List<byte[]> chunks = new ArrayList<>(); int chunkCount = chunkCountFrom(chunkable, chunkLength); for (int i = 0; i < chunkCount; i++) { byte[] chunk = chunkFrom(chunkable, chunkLength, i); chunks.add(chunk); } return chunks; } | /**
* Retrieve all chunks for a given chunk length.
* The final chunk may be shorter than the other chunks if it's been truncated.
*
* @param chunkLength The length of each chunk
* @return A list of chunks (byte arrays)
*/ | Retrieve all chunks for a given chunk length. The final chunk may be shorter than the other chunks if it's been truncated | chunksFrom | {
"repo_name": "colus001/Bean-Android-SDK",
"path": "sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Chunk.java",
"license": "mit",
"size": 3238
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,310,288 |
public static String replaceSystemProperties(Object source) {
return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source);
}
//-----------------------------------------------------------------------
public StrSubstitutor() {
this((StrLookup) null, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
}
public StrSubstitutor(Map valueMap) {
this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
}
public StrSubstitutor(Map valueMap, String prefix, String suffix) {
this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE);
}
public StrSubstitutor(Map valueMap, String prefix, String suffix, char escape) {
this(StrLookup.mapLookup(valueMap), prefix, suffix, escape);
}
public StrSubstitutor(StrLookup variableResolver) {
this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE);
}
public StrSubstitutor(StrLookup variableResolver, String prefix, String suffix, char escape) {
this.setVariableResolver(variableResolver);
this.setVariablePrefix(prefix);
this.setVariableSuffix(suffix);
this.setEscapeChar(escape);
}
public StrSubstitutor(
StrLookup variableResolver, StrMatcher prefixMatcher, StrMatcher suffixMatcher, char escape) {
this.setVariableResolver(variableResolver);
this.setVariablePrefixMatcher(prefixMatcher);
this.setVariableSuffixMatcher(suffixMatcher);
this.setEscapeChar(escape);
} | static String function(Object source) { return new StrSubstitutor(StrLookup.systemPropertiesLookup()).replace(source); } public StrSubstitutor() { this((StrLookup) null, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); } public StrSubstitutor(Map valueMap) { this(StrLookup.mapLookup(valueMap), DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); } public StrSubstitutor(Map valueMap, String prefix, String suffix) { this(StrLookup.mapLookup(valueMap), prefix, suffix, DEFAULT_ESCAPE); } public StrSubstitutor(Map valueMap, String prefix, String suffix, char escape) { this(StrLookup.mapLookup(valueMap), prefix, suffix, escape); } public StrSubstitutor(StrLookup variableResolver) { this(variableResolver, DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_ESCAPE); } public StrSubstitutor(StrLookup variableResolver, String prefix, String suffix, char escape) { this.setVariableResolver(variableResolver); this.setVariablePrefix(prefix); this.setVariableSuffix(suffix); this.setEscapeChar(escape); } public StrSubstitutor( StrLookup variableResolver, StrMatcher prefixMatcher, StrMatcher suffixMatcher, char escape) { this.setVariableResolver(variableResolver); this.setVariablePrefixMatcher(prefixMatcher); this.setVariableSuffixMatcher(suffixMatcher); this.setEscapeChar(escape); } | /**
* Replaces all the occurrences of variables in the given source object with
* their matching values from the system properties.
*
* @param source the source text containing the variables to substitute, null returns null
* @return the result of the replace operation
*/ | Replaces all the occurrences of variables in the given source object with their matching values from the system properties | replaceSystemProperties | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/clang/src/main/java/org/apache/commons/lang/text/StrSubstitutor.java",
"license": "gpl-2.0",
"size": 37494
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,202,120 |
public static XMLStreamReader createXMLStreamReader(InputStream stream)
throws IOException, XMLStreamException {
XMLInputFactory factory = XMLInputFactory.newInstance();
//disable DTD resolver
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
XMLStreamReader reader = factory.createXMLStreamReader(stream);
return reader;
} | static XMLStreamReader function(InputStream stream) throws IOException, XMLStreamException { XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); XMLStreamReader reader = factory.createXMLStreamReader(stream); return reader; } | /**
* Returns a XMLStreamReader for the XML document at the given input stream.
*/ | Returns a XMLStreamReader for the XML document at the given input stream | createXMLStreamReader | {
"repo_name": "Xenoage/Zong",
"path": "utils/utils-jse/src/com/xenoage/utils/jse/xml/XMLReader.java",
"license": "agpl-3.0",
"size": 8697
} | [
"java.io.IOException",
"java.io.InputStream",
"javax.xml.stream.XMLInputFactory",
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamReader"
] | import java.io.IOException; import java.io.InputStream; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; | import java.io.*; import javax.xml.stream.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 1,429,772 |
public XmlAnyDefinition findConnection(String name)
{
List<XmlAnyDefinition> connections = Utility.getConnections().getChildDefinitions("Reference");
XmlAnyDefinition connection = null;
for (XmlAnyDefinition currConnection : connections)
{
if (name.equals(currConnection.getAttributeValue("name")))
{
connection = currConnection;
break;
}
}
return connection;
} | XmlAnyDefinition function(String name) { List<XmlAnyDefinition> connections = Utility.getConnections().getChildDefinitions(STR); XmlAnyDefinition connection = null; for (XmlAnyDefinition currConnection : connections) { if (name.equals(currConnection.getAttributeValue("name"))) { connection = currConnection; break; } } return connection; } | /**
* Find a connection in connections.xml
* @param name
* @return
*/ | Find a connection in connections.xml | findConnection | {
"repo_name": "oracle/mobile-persistence",
"path": "Projects/Framework/Runtime/src/oracle/ateam/sample/mobile/v2/persistence/manager/AbstractRemotePersistenceManager.java",
"license": "mit",
"size": 16445
} | [
"java.util.List",
"oracle.adfmf.util.Utility",
"oracle.adfmf.util.XmlAnyDefinition"
] | import java.util.List; import oracle.adfmf.util.Utility; import oracle.adfmf.util.XmlAnyDefinition; | import java.util.*; import oracle.adfmf.util.*; | [
"java.util",
"oracle.adfmf.util"
] | java.util; oracle.adfmf.util; | 1,633,251 |
@ServiceMethod(returns = ReturnType.SINGLE)
public void delete(String resourceGroupName, String serviceName, String namedValueId, String ifMatch) {
deleteAsync(resourceGroupName, serviceName, namedValueId, ifMatch).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) void function(String resourceGroupName, String serviceName, String namedValueId, String ifMatch) { deleteAsync(resourceGroupName, serviceName, namedValueId, ifMatch).block(); } | /**
* Deletes specific named value from the API Management service instance.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param namedValueId Identifier of the NamedValue.
* @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET
* request or it should be * for unconditional update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/ | Deletes specific named value from the API Management service instance | delete | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/NamedValuesClientImpl.java",
"license": "mit",
"size": 110327
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; | import com.azure.core.annotation.*; | [
"com.azure.core"
] | com.azure.core; | 1,688,607 |
public void init(Object operand,
Object operatorOrOpType,
Object methodNameOrAddedArgs)
throws StandardException {
this.operand = (ValueNode)operand;
this.operator = (String)operatorOrOpType;
this.methodName = (String)methodNameOrAddedArgs;
} | void function(Object operand, Object operatorOrOpType, Object methodNameOrAddedArgs) throws StandardException { this.operand = (ValueNode)operand; this.operator = (String)operatorOrOpType; this.methodName = (String)methodNameOrAddedArgs; } | /**
* Initializer for a UnaryOperatorNode.
*
* <ul>
* @param operand The operand of the node
* @param operator The name of the operator,
* @param methodName Name of the method
*/ | Initializer for a UnaryOperatorNode. | init | {
"repo_name": "youngor/openclouddb",
"path": "src/main/java/com/akiban/sql/parser/UnaryOperatorNode.java",
"license": "apache-2.0",
"size": 6265
} | [
"com.akiban.sql.StandardException"
] | import com.akiban.sql.StandardException; | import com.akiban.sql.*; | [
"com.akiban.sql"
] | com.akiban.sql; | 882,625 |
@Override
public ArrayList<Mueble> getInventario()
{
return inventario;
} | ArrayList<Mueble> function() { return inventario; } | /**
* Devuelve el inventario de muebles que se encuentran en el carrito
* @return inventario Lista con los muebles que se encuentran en el carrito
*/ | Devuelve el inventario de muebles que se encuentran en el carrito | getInventario | {
"repo_name": "diego41dc/laboratorio3",
"path": "Lab3-MueblesDeLosAlpes-ejb/src/java/com/losalpes/servicios/ServicioCarritoMock.java",
"license": "gpl-2.0",
"size": 6244
} | [
"com.losalpes.entities.Mueble",
"java.util.ArrayList"
] | import com.losalpes.entities.Mueble; import java.util.ArrayList; | import com.losalpes.entities.*; import java.util.*; | [
"com.losalpes.entities",
"java.util"
] | com.losalpes.entities; java.util; | 395,782 |
public String[] getGroups() throws XMLDBException;
| String[] function() throws XMLDBException; | /**
* Retrieve a list of all existing groups.
*
* Please note: new groups are created automatically if a new group
* is assigned to a user. You can't add or remove them.
*
* @return List of all existing groups.
* @throws XMLDBException
*/ | Retrieve a list of all existing groups. Please note: new groups are created automatically if a new group is assigned to a user. You can't add or remove them | getGroups | {
"repo_name": "shabanovd/exist",
"path": "src/org/exist/xmldb/UserManagementService.java",
"license": "lgpl-2.1",
"size": 12212
} | [
"org.xmldb.api.base.XMLDBException"
] | import org.xmldb.api.base.XMLDBException; | import org.xmldb.api.base.*; | [
"org.xmldb.api"
] | org.xmldb.api; | 309,375 |
Future<Boolean> reindexAsync( String path ) throws RepositoryException; | Future<Boolean> reindexAsync( String path ) throws RepositoryException; | /**
* Asynchronously crawl and index the content starting at the supplied path in this workspace, to the designated depth.
*
* @param path the path of the content to be indexed
* @return a future representing the asynchronous operation; never null
* @throws IllegalArgumentException if the workspace or path are null, or if the depth is less than 1
* @throws AccessDeniedException if the session does not have the privileges to reindex this part of the workspace
* @throws RepositoryException if there is a problem with this session or workspace
* @see #reindex()
* @see #reindex(String)
* @see #reindexAsync()
*/ | Asynchronously crawl and index the content starting at the supplied path in this workspace, to the designated depth | reindexAsync | {
"repo_name": "flownclouds/modeshape",
"path": "modeshape-jcr-api/src/main/java/org/modeshape/jcr/api/Workspace.java",
"license": "apache-2.0",
"size": 4627
} | [
"java.util.concurrent.Future",
"javax.jcr.RepositoryException"
] | import java.util.concurrent.Future; import javax.jcr.RepositoryException; | import java.util.concurrent.*; import javax.jcr.*; | [
"java.util",
"javax.jcr"
] | java.util; javax.jcr; | 1,071,412 |
public static javax.xml.namespace.QName parseQName( String lexicalXSDQName,
NamespaceContext nsc) {
if (theConverter == null) initConverter();
return theConverter.parseQName( lexicalXSDQName, nsc );
} | static javax.xml.namespace.QName function( String lexicalXSDQName, NamespaceContext nsc) { if (theConverter == null) initConverter(); return theConverter.parseQName( lexicalXSDQName, nsc ); } | /**
* <p>
* Converts the string argument into a byte value.
*
* <p>
* String parameter <tt>lexicalXSDQname</tt> must conform to lexical value space specifed at
* <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML Schema Part 2:Datatypes specification:QNames</a>
*
* @param lexicalXSDQName
* A string containing lexical representation of xsd:QName.
* @param nsc
* A namespace context for interpreting a prefix within a QName.
* @return
* A QName value represented by the string argument.
* @throws IllegalArgumentException if string parameter does not conform to XML Schema Part 2 specification or
* if namespace prefix of <tt>lexicalXSDQname</tt> is not bound to a URI in NamespaceContext <tt>nsc</tt>.
*/ | Converts the string argument into a byte value. String parameter lexicalXSDQname must conform to lexical value space specifed at XML Schema Part 2:Datatypes specification:QNames | parseQName | {
"repo_name": "shelan/jdk9-mirror",
"path": "jaxws/src/java.xml.bind/share/classes/javax/xml/bind/DatatypeConverter.java",
"license": "gpl-2.0",
"size": 25871
} | [
"javax.xml.namespace.NamespaceContext"
] | import javax.xml.namespace.NamespaceContext; | import javax.xml.namespace.*; | [
"javax.xml"
] | javax.xml; | 1,793,312 |
protected static SegmentInfos readLastCommittedSegmentInfos(final SearcherManager sm, final Store store) throws IOException {
IndexSearcher searcher = sm.acquire();
try {
IndexCommit latestCommit = ((DirectoryReader) searcher.getIndexReader()).getIndexCommit();
return Lucene.readSegmentInfos(latestCommit);
} catch (IOException e) {
// Fall back to reading from the store if reading from the commit fails
try {
return store.readLastCommittedSegmentsInfo();
} catch (IOException e2) {
e2.addSuppressed(e);
throw e2;
}
} finally {
sm.release(searcher);
}
} | static SegmentInfos function(final SearcherManager sm, final Store store) throws IOException { IndexSearcher searcher = sm.acquire(); try { IndexCommit latestCommit = ((DirectoryReader) searcher.getIndexReader()).getIndexCommit(); return Lucene.readSegmentInfos(latestCommit); } catch (IOException e) { try { return store.readLastCommittedSegmentsInfo(); } catch (IOException e2) { e2.addSuppressed(e); throw e2; } } finally { sm.release(searcher); } } | /**
* Read the last segments info from the commit pointed to by the searcher manager
*/ | Read the last segments info from the commit pointed to by the searcher manager | readLastCommittedSegmentInfos | {
"repo_name": "nomoa/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/index/engine/Engine.java",
"license": "apache-2.0",
"size": 43677
} | [
"java.io.IOException",
"org.apache.lucene.index.DirectoryReader",
"org.apache.lucene.index.IndexCommit",
"org.apache.lucene.index.SegmentInfos",
"org.apache.lucene.search.IndexSearcher",
"org.apache.lucene.search.SearcherManager",
"org.elasticsearch.common.lucene.Lucene",
"org.elasticsearch.index.store.Store"
] | import java.io.IOException; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexCommit; import org.apache.lucene.index.SegmentInfos; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.SearcherManager; import org.elasticsearch.common.lucene.Lucene; import org.elasticsearch.index.store.Store; | import java.io.*; import org.apache.lucene.index.*; import org.apache.lucene.search.*; import org.elasticsearch.common.lucene.*; import org.elasticsearch.index.store.*; | [
"java.io",
"org.apache.lucene",
"org.elasticsearch.common",
"org.elasticsearch.index"
] | java.io; org.apache.lucene; org.elasticsearch.common; org.elasticsearch.index; | 2,577,881 |
public boolean remoteEquals(RemoteRef sub) {
if (sub instanceof UnicastRef)
return ref.remoteEquals(((UnicastRef)sub).ref);
return false;
} | boolean function(RemoteRef sub) { if (sub instanceof UnicastRef) return ref.remoteEquals(((UnicastRef)sub).ref); return false; } | /** default implementation of equals for remote objects
*/ | default implementation of equals for remote objects | remoteEquals | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/share/classes/sun/rmi/server/UnicastRef.java",
"license": "gpl-2.0",
"size": 18433
} | [
"java.rmi.server.RemoteRef"
] | import java.rmi.server.RemoteRef; | import java.rmi.server.*; | [
"java.rmi"
] | java.rmi; | 1,578,367 |
static public PyThread[] ThreadsFromXML(AbstractDebugTarget target, String payload) throws CoreException {
try {
SAXParser parser = getSAXParser();
XMLToThreadInfo info = new XMLToThreadInfo(target);
parser.parse(new ByteArrayInputStream(payload.getBytes()), info);
return info.threads.toArray(new PyThread[0]);
} catch (CoreException e) {
throw e;
} catch (SAXException e) {
throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e));
} catch (IOException e) {
throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Unexpected XML error", e));
}
} | static PyThread[] function(AbstractDebugTarget target, String payload) throws CoreException { try { SAXParser parser = getSAXParser(); XMLToThreadInfo info = new XMLToThreadInfo(target); parser.parse(new ByteArrayInputStream(payload.getBytes()), info); return info.threads.toArray(new PyThread[0]); } catch (CoreException e) { throw e; } catch (SAXException e) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, STR, e)); } catch (IOException e) { throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, STR, e)); } } | /**
* Creates IThread[] from the XML response
*/ | Creates IThread[] from the XML response | ThreadsFromXML | {
"repo_name": "rgom/Pydev",
"path": "plugins/org.python.pydev.debug/src/org/python/pydev/debug/model/XMLUtils.java",
"license": "epl-1.0",
"size": 25976
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"javax.xml.parsers.SAXParser",
"org.eclipse.core.runtime.CoreException",
"org.eclipse.core.runtime.IStatus",
"org.python.pydev.debug.core.PydevDebugPlugin",
"org.xml.sax.SAXException"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import javax.xml.parsers.SAXParser; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IStatus; import org.python.pydev.debug.core.PydevDebugPlugin; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import org.eclipse.core.runtime.*; import org.python.pydev.debug.core.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.eclipse.core",
"org.python.pydev",
"org.xml.sax"
] | java.io; javax.xml; org.eclipse.core; org.python.pydev; org.xml.sax; | 1,357,057 |
@Override
public byte[] getFirstRowKey() {
byte[] firstKey = getFirstKey();
return firstKey == null? null: KeyValue.createKeyValueFromKey(firstKey).getRow();
} | byte[] function() { byte[] firstKey = getFirstKey(); return firstKey == null? null: KeyValue.createKeyValueFromKey(firstKey).getRow(); } | /**
* TODO left from {@link HFile} version 1: move this to StoreFile after Ryan's
* patch goes in to eliminate {@link KeyValue} here.
*
* @return the first row key, or null if the file is empty.
*/ | TODO left from <code>HFile</code> version 1: move this to StoreFile after Ryan's patch goes in to eliminate <code>KeyValue</code> here | getFirstRowKey | {
"repo_name": "Guavus/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderImpl.java",
"license": "apache-2.0",
"size": 60332
} | [
"org.apache.hadoop.hbase.KeyValue"
] | import org.apache.hadoop.hbase.KeyValue; | import org.apache.hadoop.hbase.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,487,910 |
public static RootFinderConfig.Builder builder() {
return new RootFinderConfig.Builder();
}
private RootFinderConfig(
double absoluteTolerance,
double relativeTolerance,
int maximumSteps) {
ArgChecker.notNegativeOrZero(absoluteTolerance, "absoluteTolerance");
ArgChecker.notNegativeOrZero(relativeTolerance, "relativeTolerance");
ArgChecker.notNegativeOrZero(maximumSteps, "maximumSteps");
this.absoluteTolerance = absoluteTolerance;
this.relativeTolerance = relativeTolerance;
this.maximumSteps = maximumSteps;
} | static RootFinderConfig.Builder function() { return new RootFinderConfig.Builder(); } private RootFinderConfig( double absoluteTolerance, double relativeTolerance, int maximumSteps) { ArgChecker.notNegativeOrZero(absoluteTolerance, STR); ArgChecker.notNegativeOrZero(relativeTolerance, STR); ArgChecker.notNegativeOrZero(maximumSteps, STR); this.absoluteTolerance = absoluteTolerance; this.relativeTolerance = relativeTolerance; this.maximumSteps = maximumSteps; } | /**
* Returns a builder used to create an instance of the bean.
* @return the builder, not null
*/ | Returns a builder used to create an instance of the bean | builder | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/measure/src/main/java/com/opengamma/strata/measure/curve/RootFinderConfig.java",
"license": "apache-2.0",
"size": 14805
} | [
"com.opengamma.strata.collect.ArgChecker"
] | import com.opengamma.strata.collect.ArgChecker; | import com.opengamma.strata.collect.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 1,239,372 |
EClass getGlobalScriptTask(); | EClass getGlobalScriptTask(); | /**
* Returns the meta object for class '{@link org.eclipse.bpmn2.GlobalScriptTask <em>Global Script Task</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Global Script Task</em>'.
* @see org.eclipse.bpmn2.GlobalScriptTask
* @generated
*/ | Returns the meta object for class '<code>org.eclipse.bpmn2.GlobalScriptTask Global Script Task</code>'. | getGlobalScriptTask | {
"repo_name": "Rikkola/kie-wb-common",
"path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java",
"license": "apache-2.0",
"size": 929298
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,124,299 |
private static void initDocument() throws Exception
{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder();
doc = dbBuilder.parse(pathToResource);
docAlive = true;
} | static void function() throws Exception { DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dbBuilder = dbFactory.newDocumentBuilder(); doc = dbBuilder.parse(pathToResource); docAlive = true; } | /**
* Initializes the Document representation of the salesforceMetadata.xml file
*
* @throws Exception
*/ | Initializes the Document representation of the salesforceMetadata.xml file | initDocument | {
"repo_name": "aesanch2/salesforce-migration-assistant",
"path": "src/main/java/org/jenkinsci/plugins/sma/SMAMetadataTypes.java",
"license": "mit",
"size": 4153
} | [
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory"
] | import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; | import javax.xml.parsers.*; | [
"javax.xml"
] | javax.xml; | 155,932 |
public static Context chain(Context... contexts) {
return chain(ImmutableList.copyOf(contexts));
} | static Context function(Context... contexts) { return chain(ImmutableList.copyOf(contexts)); } | /** Returns a context that wraps a list of contexts.
*
* <p>A call to {@code unwrap(C)} will return the first object that is an
* instance of {@code C}.
*
* <p>If any of the contexts is a {@link Context}, recursively looks in that
* object. Thus this method can be used to chain contexts.
*/ | Returns a context that wraps a list of contexts. A call to unwrap(C) will return the first object that is an instance of C. If any of the contexts is a <code>Context</code>, recursively looks in that object. Thus this method can be used to chain contexts | chain | {
"repo_name": "julianhyde/calcite",
"path": "core/src/main/java/org/apache/calcite/plan/Contexts.java",
"license": "apache-2.0",
"size": 4588
} | [
"com.google.common.collect.ImmutableList"
] | import com.google.common.collect.ImmutableList; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 168,528 |
private CmsPair<String, List<Object>> prepareRewriteAliasConditions(CmsRewriteAliasFilter filter) {
List<String> conditions = new ArrayList<String>();
conditions.add("1 = 1");
List<Object> parameters = new ArrayList<Object>();
if (filter.getSiteRoot() != null) {
parameters.add(filter.getSiteRoot());
conditions.add("SITE_ROOT = ?");
}
if (filter.getId() != null) {
parameters.add(filter.getId().toString());
conditions.add("ID = ?");
}
return CmsPair.create(CmsStringUtil.listAsString(conditions, " AND "), parameters);
} | CmsPair<String, List<Object>> function(CmsRewriteAliasFilter filter) { List<String> conditions = new ArrayList<String>(); conditions.add(STR); List<Object> parameters = new ArrayList<Object>(); if (filter.getSiteRoot() != null) { parameters.add(filter.getSiteRoot()); conditions.add(STR); } if (filter.getId() != null) { parameters.add(filter.getId().toString()); conditions.add(STR); } return CmsPair.create(CmsStringUtil.listAsString(conditions, STR), parameters); } | /**
* Helper method to prepare the SQL conditions for accessing rewrite aliases using a given filter.<p>
*
* @param filter the filter to use for rewrite aliases
*
* @return a pair consisting of an SQL condition string and a list of query parameters
*/ | Helper method to prepare the SQL conditions for accessing rewrite aliases using a given filter | prepareRewriteAliasConditions | {
"repo_name": "victos/opencms-core",
"path": "src/org/opencms/db/generic/CmsVfsDriver.java",
"license": "lgpl-2.1",
"size": 206070
} | [
"java.util.ArrayList",
"java.util.List",
"org.opencms.db.CmsRewriteAliasFilter",
"org.opencms.util.CmsPair",
"org.opencms.util.CmsStringUtil"
] | import java.util.ArrayList; import java.util.List; import org.opencms.db.CmsRewriteAliasFilter; import org.opencms.util.CmsPair; import org.opencms.util.CmsStringUtil; | import java.util.*; import org.opencms.db.*; import org.opencms.util.*; | [
"java.util",
"org.opencms.db",
"org.opencms.util"
] | java.util; org.opencms.db; org.opencms.util; | 586,933 |
Optional<List<Double>> getDoubleList(DataQuery path); | Optional<List<Double>> getDoubleList(DataQuery path); | /**
* Gets the {@link List} of {@link Double} by path, if available.
*
* <p>If a {@link List} of {@link Double} does not exist, or the data
* residing at the path is not an instance of a {@link List} of
* {@link Double}, an absent is returned.</p>
*
* @param path The path of the value to get
* @return The list of doubles, if available
*/ | Gets the <code>List</code> of <code>Double</code> by path, if available. If a <code>List</code> of <code>Double</code> does not exist, or the data residing at the path is not an instance of a <code>List</code> of <code>Double</code>, an absent is returned | getDoubleList | {
"repo_name": "ryantheleach/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/data/DataView.java",
"license": "mit",
"size": 17130
} | [
"java.util.List",
"java.util.Optional"
] | import java.util.List; import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 668,076 |
public void launchGuestUser(View view) {
FirebaseAuth.getInstance().signInAnonymously().addOnCompleteListener(task -> {
if (task.isSuccessful()) {
Bundle bundle = new Bundle();
bundle.putSerializable("user", User.getGuest());
Intent intent = new Intent(this, WelcomeScreenController.class);
intent.putExtras(bundle);
startActivity(intent);
} else {
Log.d(LOG_ID, "Anonymous sign-in with the guest account could not occur. "
+ "The provided error was: " + task.getException().getMessage());
Toast.makeText(this,
"Anonymous Sign-in is unavailable, please try again in a little bit or"
+ "create an account.", Toast.LENGTH_LONG).show();
}
});
} | void function(View view) { FirebaseAuth.getInstance().signInAnonymously().addOnCompleteListener(task -> { if (task.isSuccessful()) { Bundle bundle = new Bundle(); bundle.putSerializable("user", User.getGuest()); Intent intent = new Intent(this, WelcomeScreenController.class); intent.putExtras(bundle); startActivity(intent); } else { Log.d(LOG_ID, STR + STR + task.getException().getMessage()); Toast.makeText(this, STR + STR, Toast.LENGTH_LONG).show(); } }); } | /**
* Launch Guest user
* @param view current view
*/ | Launch Guest user | launchGuestUser | {
"repo_name": "Zighome24/CS2340_GoGreek",
"path": "app/RatTracker2k17/app/src/main/java/edu/gatech/cs2340/rattracker2k17/Controller/HomeScreenController.java",
"license": "mit",
"size": 2705
} | [
"android.content.Intent",
"android.os.Bundle",
"android.util.Log",
"android.view.View",
"android.widget.Toast",
"com.google.firebase.auth.FirebaseAuth",
"edu.gatech.cs2340.rattracker2k17.Model"
] | import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Toast; import com.google.firebase.auth.FirebaseAuth; import edu.gatech.cs2340.rattracker2k17.Model; | import android.content.*; import android.os.*; import android.util.*; import android.view.*; import android.widget.*; import com.google.firebase.auth.*; import edu.gatech.cs2340.rattracker2k17.*; | [
"android.content",
"android.os",
"android.util",
"android.view",
"android.widget",
"com.google.firebase",
"edu.gatech.cs2340"
] | android.content; android.os; android.util; android.view; android.widget; com.google.firebase; edu.gatech.cs2340; | 1,841,595 |
public List<Integer> emit(Collection<Tuple> anchors, List<Object> tuple) {
return emit(Utils.DEFAULT_STREAM_ID, anchors, tuple);
} | List<Integer> function(Collection<Tuple> anchors, List<Object> tuple) { return emit(Utils.DEFAULT_STREAM_ID, anchors, tuple); } | /**
* Emits a new tuple to the default stream anchored on a group of input tuples. The emitted
* values must be immutable.
*
* @param anchors the tuples to anchor to
* @param tuple the new output tuple from this bolt
* @return the list of task ids that this new tuple was sent to
*/ | Emits a new tuple to the default stream anchored on a group of input tuples. The emitted values must be immutable | emit | {
"repo_name": "mrknmc/storm-mc",
"path": "storm-multicore/src/jvm/backtype/storm/task/OutputCollector.java",
"license": "apache-2.0",
"size": 9283
} | [
"java.util.Collection",
"java.util.List"
] | import java.util.Collection; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 507,481 |
public boolean isTrendVisible(final StaplerRequest request) {
GraphConfigurationView configuration = createUserConfiguration(request);
return configuration.isVisible() && configuration.hasMeaningfulGraph();
}
| boolean function(final StaplerRequest request) { GraphConfigurationView configuration = createUserConfiguration(request); return configuration.isVisible() && configuration.hasMeaningfulGraph(); } | /**
* Returns whether the trend graph is visible.
*
* @param request
* the request to get the cookie from
* @return <code>true</code> if the trend is visible
*/ | Returns whether the trend graph is visible | isTrendVisible | {
"repo_name": "recena/analysis-core-plugin",
"path": "src/main/java/hudson/plugins/analysis/core/AbstractProjectAction.java",
"license": "mit",
"size": 15161
} | [
"hudson.plugins.analysis.graph.GraphConfigurationView",
"org.kohsuke.stapler.StaplerRequest"
] | import hudson.plugins.analysis.graph.GraphConfigurationView; import org.kohsuke.stapler.StaplerRequest; | import hudson.plugins.analysis.graph.*; import org.kohsuke.stapler.*; | [
"hudson.plugins.analysis",
"org.kohsuke.stapler"
] | hudson.plugins.analysis; org.kohsuke.stapler; | 1,630,445 |
public void buildGraphicsNode(BridgeContext ctx,
Element e,
GraphicsNode node) {
ShapeNode shapeNode = (ShapeNode)node;
shapeNode.setShapePainter(createShapePainter(ctx, e, shapeNode));
super.buildGraphicsNode(ctx, e, node);
} | void function(BridgeContext ctx, Element e, GraphicsNode node) { ShapeNode shapeNode = (ShapeNode)node; shapeNode.setShapePainter(createShapePainter(ctx, e, shapeNode)); super.buildGraphicsNode(ctx, e, node); } | /**
* Builds using the specified BridgeContext and element, the
* specified graphics node.
*
* @param ctx the bridge context to use
* @param e the element that describes the graphics node to build
* @param node the graphics node to build
*/ | Builds using the specified BridgeContext and element, the specified graphics node | buildGraphicsNode | {
"repo_name": "srnsw/xena",
"path": "plugins/image/ext/src/batik-1.7/sources/org/apache/batik/bridge/SVGShapeElementBridge.java",
"license": "gpl-3.0",
"size": 7295
} | [
"org.apache.batik.gvt.GraphicsNode",
"org.apache.batik.gvt.ShapeNode",
"org.w3c.dom.Element"
] | import org.apache.batik.gvt.GraphicsNode; import org.apache.batik.gvt.ShapeNode; import org.w3c.dom.Element; | import org.apache.batik.gvt.*; import org.w3c.dom.*; | [
"org.apache.batik",
"org.w3c.dom"
] | org.apache.batik; org.w3c.dom; | 599,122 |
public static SchemaLocation getSchemaLocationForOGC() {
return SCHEMA_LOCATION_OGC;
}
| static SchemaLocation function() { return SCHEMA_LOCATION_OGC; } | /**
* SOS OGC schema location
*
* @return QName of schema location
*/ | SOS OGC schema location | getSchemaLocationForOGC | {
"repo_name": "sauloperez/sos",
"path": "src/core/api/src/main/java/org/n52/sos/util/N52XmlHelper.java",
"license": "apache-2.0",
"size": 11089
} | [
"org.n52.sos.w3c.SchemaLocation"
] | import org.n52.sos.w3c.SchemaLocation; | import org.n52.sos.w3c.*; | [
"org.n52.sos"
] | org.n52.sos; | 2,055,217 |
private String saveLoan() {
AutoCompleteTextView mUserText = (AutoCompleteTextView) getView().findViewById(R.id.loan_to_who);
String friend = mUserText.getText().toString();
BookData values = mEditManager.getBookData();
values.putString(CatalogueDBAdapter.KEY_LOANED_TO, friend);
mDbHelper.createLoan(values);
return friend;
}
| String function() { AutoCompleteTextView mUserText = (AutoCompleteTextView) getView().findViewById(R.id.loan_to_who); String friend = mUserText.getText().toString(); BookData values = mEditManager.getBookData(); values.putString(CatalogueDBAdapter.KEY_LOANED_TO, friend); mDbHelper.createLoan(values); return friend; } | /**
* Save the user and book combination as a loan in the database
*
* @return the user
*/ | Save the user and book combination as a loan in the database | saveLoan | {
"repo_name": "Imkal/Book-Catalogue",
"path": "src/com/eleybourn/bookcatalogue/BookEditLoaned.java",
"license": "gpl-3.0",
"size": 6346
} | [
"android.widget.AutoCompleteTextView"
] | import android.widget.AutoCompleteTextView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 738,229 |
public void start_logfile(File p_filename)
{
if (board_is_read_only)
{
return;
}
logfile.start_write(p_filename);
} | void function(File p_filename) { if (board_is_read_only) { return; } logfile.start_write(p_filename); } | /**
* From here on the interactive actions are written to a logfile.
*/ | From here on the interactive actions are written to a logfile | start_logfile | {
"repo_name": "32bitmicro/Freerouting",
"path": "sources/interactive/BoardHandling.java",
"license": "gpl-3.0",
"size": 56816
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 468,197 |
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
if (bevelType == RAISED) {
paintRaisedBevel(c, g, x, y, width, height);
} else if (bevelType == LOWERED) {
paintLoweredBevel(c, g, x, y, width, height);
}
} | void function(Component c, Graphics g, int x, int y, int width, int height) { if (bevelType == RAISED) { paintRaisedBevel(c, g, x, y, width, height); } else if (bevelType == LOWERED) { paintLoweredBevel(c, g, x, y, width, height); } } | /**
* Paints the border for the specified component with the specified
* position and size.
* @param c the component for which this border is being painted
* @param g the paint graphics
* @param x the x position of the painted border
* @param y the y position of the painted border
* @param width the width of the painted border
* @param height the height of the painted border
*/ | Paints the border for the specified component with the specified position and size | paintBorder | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/javax/swing/border/BevelBorder.java",
"license": "mit",
"size": 10390
} | [
"java.awt.Component",
"java.awt.Graphics"
] | import java.awt.Component; import java.awt.Graphics; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,972,916 |
public void addPropertyChangeListener(final PropertyChangeListener listener) {
change.addPropertyChangeListener(listener);
} | void function(final PropertyChangeListener listener) { change.addPropertyChangeListener(listener); } | /**
* Method registers a property change listener which will be informed about state transitions.
*
* @param listener the change listener to register.
*/ | Method registers a property change listener which will be informed about state transitions | addPropertyChangeListener | {
"repo_name": "openbase/jul",
"path": "pattern/default/src/main/java/org/openbase/jul/pattern/statemachine/StateRunner.java",
"license": "lgpl-3.0",
"size": 7704
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 1,044,787 |
public static void serialize(Object o, String file, boolean compress) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(file);
serialize(o, fos, compress);
fos.flush();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
Execute.close(fos, logger);
}
} | static void function(Object o, String file, boolean compress) { FileOutputStream fos = null; try { fos = new FileOutputStream(file); serialize(o, fos, compress); fos.flush(); } catch (IOException e) { throw new RuntimeException(e); } finally { Execute.close(fos, logger); } } | /**
* method for quick serialization of an object
* @param o
* @param file
*/ | method for quick serialization of an object | serialize | {
"repo_name": "linkedin/indextank-engine",
"path": "flaptor-util/com/flaptor/util/IOUtil.java",
"license": "apache-2.0",
"size": 10370
} | [
"java.io.FileOutputStream",
"java.io.IOException"
] | import java.io.FileOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,738,922 |
public void sendData(SerialMessage serialMessage)
{
if (serialMessage.getMessageClass() != SerialMessageClass.SendData) {
logger.error(String.format("Invalid message class %s (0x%02X) for sendData", serialMessage.getMessageClass().getLabel(), serialMessage.getMessageClass().getKey()));
return;
}
if (serialMessage.getMessageType() != SerialMessageType.Request) {
logger.error("Only request messages can be sent");
return;
}
ZWaveNode node = this.getNode(serialMessage.getMessageNode());
if (node.getNodeStage() == NodeStage.NODEBUILDINFO_DEAD) {
logger.debug("Node {} is dead, not sending message.", node.getNodeId());
return;
}
if (!node.isListening() && serialMessage.getPriority() != SerialMessagePriority.Low) {
ZWaveWakeUpCommandClass wakeUpCommandClass = (ZWaveWakeUpCommandClass)node.getCommandClass(CommandClass.WAKE_UP);
if (wakeUpCommandClass != null && !wakeUpCommandClass.isAwake()) {
wakeUpCommandClass.putInWakeUpQueue(serialMessage); //it's a battery operated device, place in wake-up queue.
return;
}
}
serialMessage.setTransmitOptions(TRANSMIT_OPTION_ACK | TRANSMIT_OPTION_AUTO_ROUTE | TRANSMIT_OPTION_EXPLORE);
if (++sentDataPointer > 0xFF)
sentDataPointer = 1;
serialMessage.setCallbackId(sentDataPointer);
logger.debug("Callback ID = {}", sentDataPointer);
this.enqueue(serialMessage);
}
| void function(SerialMessage serialMessage) { if (serialMessage.getMessageClass() != SerialMessageClass.SendData) { logger.error(String.format(STR, serialMessage.getMessageClass().getLabel(), serialMessage.getMessageClass().getKey())); return; } if (serialMessage.getMessageType() != SerialMessageType.Request) { logger.error(STR); return; } ZWaveNode node = this.getNode(serialMessage.getMessageNode()); if (node.getNodeStage() == NodeStage.NODEBUILDINFO_DEAD) { logger.debug(STR, node.getNodeId()); return; } if (!node.isListening() && serialMessage.getPriority() != SerialMessagePriority.Low) { ZWaveWakeUpCommandClass wakeUpCommandClass = (ZWaveWakeUpCommandClass)node.getCommandClass(CommandClass.WAKE_UP); if (wakeUpCommandClass != null && !wakeUpCommandClass.isAwake()) { wakeUpCommandClass.putInWakeUpQueue(serialMessage); return; } } serialMessage.setTransmitOptions(TRANSMIT_OPTION_ACK TRANSMIT_OPTION_AUTO_ROUTE TRANSMIT_OPTION_EXPLORE); if (++sentDataPointer > 0xFF) sentDataPointer = 1; serialMessage.setCallbackId(sentDataPointer); logger.debug(STR, sentDataPointer); this.enqueue(serialMessage); } | /**
* Transmits the SerialMessage to a single Z-Wave Node.
* Sets the transmission options as well.
* @param serialMessage the Serial message to send.
*/ | Transmits the SerialMessage to a single Z-Wave Node. Sets the transmission options as well | sendData | {
"repo_name": "noushadali/openhab",
"path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/ZWaveController.java",
"license": "gpl-3.0",
"size": 53107
} | [
"org.openhab.binding.zwave.internal.commandclass.ZWaveCommandClass",
"org.openhab.binding.zwave.internal.commandclass.ZWaveWakeUpCommandClass",
"org.openhab.binding.zwave.internal.protocol.SerialMessage",
"org.openhab.binding.zwave.internal.protocol.ZWaveNode"
] | import org.openhab.binding.zwave.internal.commandclass.ZWaveCommandClass; import org.openhab.binding.zwave.internal.commandclass.ZWaveWakeUpCommandClass; import org.openhab.binding.zwave.internal.protocol.SerialMessage; import org.openhab.binding.zwave.internal.protocol.ZWaveNode; | import org.openhab.binding.zwave.internal.commandclass.*; import org.openhab.binding.zwave.internal.protocol.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 82,613 |
public String extractEcosystem(String baseEcosystem, VulnerableSoftware parsedCpe) {
return extractEcosystem(baseEcosystem, parsedCpe.getVendor(), parsedCpe.getProduct(), parsedCpe.getTargetSw());
} | String function(String baseEcosystem, VulnerableSoftware parsedCpe) { return extractEcosystem(baseEcosystem, parsedCpe.getVendor(), parsedCpe.getProduct(), parsedCpe.getTargetSw()); } | /**
* Attempts to determine the ecosystem based on the vendor, product and
* targetSw.
*
* @param baseEcosystem the base ecosystem
* @param parsedCpe the CPE identifier
* @return the ecosystem if one is identified
*/ | Attempts to determine the ecosystem based on the vendor, product and targetSw | extractEcosystem | {
"repo_name": "jeremylong/DependencyCheck",
"path": "core/src/main/java/org/owasp/dependencycheck/data/nvdcve/CveItemOperator.java",
"license": "apache-2.0",
"size": 9748
} | [
"org.owasp.dependencycheck.dependency.VulnerableSoftware"
] | import org.owasp.dependencycheck.dependency.VulnerableSoftware; | import org.owasp.dependencycheck.dependency.*; | [
"org.owasp.dependencycheck"
] | org.owasp.dependencycheck; | 626,843 |
public void run() throws IOException {
execTransfer();
execCircuit();
interpretResult();
}
| void function() throws IOException { execTransfer(); execCircuit(); interpretResult(); } | /**
* Method for running the AES op (client and server).
*
* @throws IOException
*/ | Method for running the AES op (client and server) | run | {
"repo_name": "factcenter/inchworm",
"path": "src/main/java/org/factcenter/fastgc/inchworm/AesOpCommon.java",
"license": "mit",
"size": 15497
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,932,878 |
public static ByteBuffer encrypt(String data) {
return encrypt(data, DEFAULT_KEY);
}
/**
* Encrypt the {@code data} string using the {@code key} | static ByteBuffer function(String data) { return encrypt(data, DEFAULT_KEY); } /** * Encrypt the {@code data} string using the {@code key} | /**
* Encrypt the specified {@code data} string.
*
* @param data
* @return a byte buffer with the encrypted data
*/ | Encrypt the specified data string | encrypt | {
"repo_name": "bigtreeljc/concourse",
"path": "concourse-driver-java/src/main/java/org/cinchapi/concourse/security/ClientSecurity.java",
"license": "apache-2.0",
"size": 4507
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,338,427 |
public synchronized void nodeEvent(final RMNodeEvent event) {
// Update cumulative times based on activity and inactivity during the last time interval
final long currentTimeStamp = System.nanoTime();
final long timeInterval = currentTimeStamp - this.previousTimeStamp;
this.cumulativeActivityTime += this.busyNodesCount * timeInterval;
this.cumulativeInactivityTime += this.freeNodesCount * timeInterval;
// Update the previous time stamp to the current
this.previousTimeStamp = currentTimeStamp;
// Depending on the event type update nodes count
switch (event.getEventType()) {
case NODE_ADDED:
// Increment the available nodes count
this.availableNodesCount++;
// We define the state of the added node
final NodeState addNodeState = event.getNodeState();
switch (addNodeState) {
case FREE:
this.incrementFreeNodesCount();
break;
case CONFIGURING:
this.incrementConfiguringNodesCount();
break;
case DEPLOYING:
this.incrementDeployingNodesCount();
break;
case LOST:
this.incrementLostNodesCount();
break;
case BUSY:
this.incrementBusyNodesCount();
break;
case DOWN:
this.incrementDownNodesCount();
break;
case TO_BE_REMOVED:
this.incrementToBeRemovedNodesCount();
break;
default:
// Unknown NodeState
}
break;
case NODE_REMOVED:
// Get the state of the node before it was removed
final NodeState nodeState = event.getNodeState();
switch (nodeState) {
case FREE:
this.decrementFreeNodesCount();
break;
case BUSY:
this.decrementBusyNodesCount();
break;
case TO_BE_REMOVED:
this.decrementToBeRemovedNodesCount();
break;
case DOWN:
this.decrementDownNodesCount();
break;
case CONFIGURING:
this.decrementConfiguringNodesCount();
break;
case LOST:
this.decrementLostNodesCount();
break;
case DEPLOYING:
this.decrementDeployingNodesCount();
break;
default:
// Unknown NodeState
}
this.decrementAvailableNodesCount();
break;
case NODE_STATE_CHANGED:
// Depending on the previous state decrement counters
final NodeState previousNodeState = event.getPreviousNodeState();
if (previousNodeState != null) {
switch (previousNodeState) {
case FREE:
this.decrementFreeNodesCount();
break;
case BUSY:
this.decrementBusyNodesCount();
break;
case TO_BE_REMOVED:
this.decrementToBeRemovedNodesCount();
break;
case DOWN:
this.decrementDownNodesCount();
break;
case CONFIGURING:
this.decrementConfiguringNodesCount();
break;
case LOST:
this.decrementLostNodesCount();
break;
case DEPLOYING:
this.decrementDeployingNodesCount();
break;
default:
// Unknown NodeState
}
}
final NodeState currentNodeState = event.getNodeState(); // can't be null
// Depending on the current state increment counters
switch (currentNodeState) {
case FREE:
this.incrementFreeNodesCount();
break;
case BUSY:
this.incrementBusyNodesCount();
break;
case TO_BE_REMOVED:
this.incrementToBeRemovedNodesCount();
break;
case DOWN:
this.incrementDownNodesCount();
break;
case CONFIGURING:
this.incrementConfiguringNodesCount();
break;
case LOST:
this.incrementLostNodesCount();
break;
case DEPLOYING:
this.incrementDeployingNodesCount();
break;
default:
// Unknown NodeState
}
default:
// Unknown RMEventType
}
} | synchronized void function(final RMNodeEvent event) { final long currentTimeStamp = System.nanoTime(); final long timeInterval = currentTimeStamp - this.previousTimeStamp; this.cumulativeActivityTime += this.busyNodesCount * timeInterval; this.cumulativeInactivityTime += this.freeNodesCount * timeInterval; this.previousTimeStamp = currentTimeStamp; switch (event.getEventType()) { case NODE_ADDED: this.availableNodesCount++; final NodeState addNodeState = event.getNodeState(); switch (addNodeState) { case FREE: this.incrementFreeNodesCount(); break; case CONFIGURING: this.incrementConfiguringNodesCount(); break; case DEPLOYING: this.incrementDeployingNodesCount(); break; case LOST: this.incrementLostNodesCount(); break; case BUSY: this.incrementBusyNodesCount(); break; case DOWN: this.incrementDownNodesCount(); break; case TO_BE_REMOVED: this.incrementToBeRemovedNodesCount(); break; default: } break; case NODE_REMOVED: final NodeState nodeState = event.getNodeState(); switch (nodeState) { case FREE: this.decrementFreeNodesCount(); break; case BUSY: this.decrementBusyNodesCount(); break; case TO_BE_REMOVED: this.decrementToBeRemovedNodesCount(); break; case DOWN: this.decrementDownNodesCount(); break; case CONFIGURING: this.decrementConfiguringNodesCount(); break; case LOST: this.decrementLostNodesCount(); break; case DEPLOYING: this.decrementDeployingNodesCount(); break; default: } this.decrementAvailableNodesCount(); break; case NODE_STATE_CHANGED: final NodeState previousNodeState = event.getPreviousNodeState(); if (previousNodeState != null) { switch (previousNodeState) { case FREE: this.decrementFreeNodesCount(); break; case BUSY: this.decrementBusyNodesCount(); break; case TO_BE_REMOVED: this.decrementToBeRemovedNodesCount(); break; case DOWN: this.decrementDownNodesCount(); break; case CONFIGURING: this.decrementConfiguringNodesCount(); break; case LOST: this.decrementLostNodesCount(); break; case DEPLOYING: this.decrementDeployingNodesCount(); break; default: } } final NodeState currentNodeState = event.getNodeState(); switch (currentNodeState) { case FREE: this.incrementFreeNodesCount(); break; case BUSY: this.incrementBusyNodesCount(); break; case TO_BE_REMOVED: this.incrementToBeRemovedNodesCount(); break; case DOWN: this.incrementDownNodesCount(); break; case CONFIGURING: this.incrementConfiguringNodesCount(); break; case LOST: this.incrementLostNodesCount(); break; case DEPLOYING: this.incrementDeployingNodesCount(); break; default: } default: } } | /**
* Handle incoming node events of the Resource Manager
* @param event incoming event
*/ | Handle incoming node events of the Resource Manager | nodeEvent | {
"repo_name": "ShatalovYaroslav/scheduling",
"path": "rm/rm-server/src/main/java/org/ow2/proactive/resourcemanager/utils/RMStatistics.java",
"license": "agpl-3.0",
"size": 20823
} | [
"org.ow2.proactive.resourcemanager.common.NodeState",
"org.ow2.proactive.resourcemanager.common.event.RMNodeEvent"
] | import org.ow2.proactive.resourcemanager.common.NodeState; import org.ow2.proactive.resourcemanager.common.event.RMNodeEvent; | import org.ow2.proactive.resourcemanager.common.*; import org.ow2.proactive.resourcemanager.common.event.*; | [
"org.ow2.proactive"
] | org.ow2.proactive; | 1,059,816 |
void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc); | void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc); | /**
* An overconstrained geometry adjustment rule was triggered (5.3.4, XSL 1.0).
* @param source the event source
* @param elementName the formatting object
* @param amount the amount of the adjustment (in mpt)
* @param loc the location of the error or null
* @event.severity INFO
*/ | An overconstrained geometry adjustment rule was triggered (5.3.4, XSL 1.0) | overconstrainedAdjustEndIndent | {
"repo_name": "StrategyObject/fop",
"path": "src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java",
"license": "apache-2.0",
"size": 8564
} | [
"org.xml.sax.Locator"
] | import org.xml.sax.Locator; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,774,288 |
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
super.onBlockPlacedBy(worldIn, pos, state, placer, stack);
if (stack.hasDisplayName())
{
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityHopper)
{
((TileEntityHopper)tileentity).setCustomName(stack.getDisplayName());
}
}
} | void function(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { super.onBlockPlacedBy(worldIn, pos, state, placer, stack); if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityHopper) { ((TileEntityHopper)tileentity).setCustomName(stack.getDisplayName()); } } } | /**
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
*/ | Called by ItemBlocks after a block is set in the world, to allow post-place logic | onBlockPlacedBy | {
"repo_name": "SuperUnitato/UnLonely",
"path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockHopper.java",
"license": "lgpl-2.1",
"size": 10212
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.entity.EntityLivingBase",
"net.minecraft.item.ItemStack",
"net.minecraft.tileentity.TileEntity",
"net.minecraft.tileentity.TileEntityHopper",
"net.minecraft.util.math.BlockPos",
"net.minecraft.world.World"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; | import net.minecraft.block.state.*; import net.minecraft.entity.*; import net.minecraft.item.*; import net.minecraft.tileentity.*; import net.minecraft.util.math.*; import net.minecraft.world.*; | [
"net.minecraft.block",
"net.minecraft.entity",
"net.minecraft.item",
"net.minecraft.tileentity",
"net.minecraft.util",
"net.minecraft.world"
] | net.minecraft.block; net.minecraft.entity; net.minecraft.item; net.minecraft.tileentity; net.minecraft.util; net.minecraft.world; | 871,490 |
public String getSum(File file){
try {
return getSum(new FileInputStream(file));
} catch (FileNotFoundException e) {
return "failed: "+e.getMessage();
}
} | String function(File file){ try { return getSum(new FileInputStream(file)); } catch (FileNotFoundException e) { return STR+e.getMessage(); } } | /**
* Gets the checksum for the given file
* @param file
* @return
*/ | Gets the checksum for the given file | getSum | {
"repo_name": "idega/com.idega.core",
"path": "src/java/com/idega/util/CheckSum.java",
"license": "gpl-3.0",
"size": 5435
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.FileNotFoundException"
] | import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; | import java.io.*; | [
"java.io"
] | java.io; | 1,938,548 |
public IntroductoryTour startTour(String tourKey) {
IntroductoryTour tour = null;
Class<? extends IntroductoryTour> tourClass = tours.get(tourKey);
try {
tour = tourClass.newInstance();
tour.startTour();
} catch (InstantiationException e) {
LogService.getRoot().log(Level.WARNING, NOT_STARTED, new Object[] {tourKey});
throw new IllegalArgumentException();
} catch (IllegalAccessException e) {
LogService.getRoot().log(Level.WARNING, NOT_STARTED, new Object[] {tourKey});
throw new IllegalArgumentException();
}
return tour;
}
| IntroductoryTour function(String tourKey) { IntroductoryTour tour = null; Class<? extends IntroductoryTour> tourClass = tours.get(tourKey); try { tour = tourClass.newInstance(); tour.startTour(); } catch (InstantiationException e) { LogService.getRoot().log(Level.WARNING, NOT_STARTED, new Object[] {tourKey}); throw new IllegalArgumentException(); } catch (IllegalAccessException e) { LogService.getRoot().log(Level.WARNING, NOT_STARTED, new Object[] {tourKey}); throw new IllegalArgumentException(); } return tour; } | /**
* Starts the Tour with the given key and returns the running object
* @param tourKey key/name of the Tour
* @return returns the running object or throws a RuntimeException if the key doesn't match any tour.
*/ | Starts the Tour with the given key and returns the running object | startTour | {
"repo_name": "aborg0/RapidMiner-Unuk",
"path": "src/com/rapidminer/gui/tour/TourManager.java",
"license": "agpl-3.0",
"size": 9825
} | [
"com.rapidminer.tools.LogService",
"java.util.logging.Level"
] | import com.rapidminer.tools.LogService; import java.util.logging.Level; | import com.rapidminer.tools.*; import java.util.logging.*; | [
"com.rapidminer.tools",
"java.util"
] | com.rapidminer.tools; java.util; | 424,687 |
ModTweaker.LATE_ADDITIONS.add(new Add(new MoistenerRecipe(toStack(input), toStack(output), packagingTime)));
}
private static class Add extends BaseAddForestry<IMoistenerRecipe> {
public Add(IMoistenerRecipe recipe) {
super(Moistener.name, RecipeManagers.moistenerManager, recipe);
} | ModTweaker.LATE_ADDITIONS.add(new Add(new MoistenerRecipe(toStack(input), toStack(output), packagingTime))); } private static class Add extends BaseAddForestry<IMoistenerRecipe> { public Add(IMoistenerRecipe recipe) { super(Moistener.name, RecipeManagers.moistenerManager, recipe); } | /**
* Adds recipe to Moistener
*
* @param output recipe product
* @param input required item
* @param packagingTime amount of ticks per crafting operation
*/ | Adds recipe to Moistener | addRecipe | {
"repo_name": "jaredlll08/ModTweaker",
"path": "src/main/java/com/blamejared/compat/forestry/Moistener.java",
"license": "mit",
"size": 6344
} | [
"com.blamejared.ModTweaker",
"com.blamejared.mtlib.helpers.InputHelper",
"com.blamejared.mtlib.utils.BaseAddForestry"
] | import com.blamejared.ModTweaker; import com.blamejared.mtlib.helpers.InputHelper; import com.blamejared.mtlib.utils.BaseAddForestry; | import com.blamejared.*; import com.blamejared.mtlib.helpers.*; import com.blamejared.mtlib.utils.*; | [
"com.blamejared",
"com.blamejared.mtlib"
] | com.blamejared; com.blamejared.mtlib; | 826,708 |
protected static HandleType of(MethodDescription.InDefinedShape methodDescription) {
if (methodDescription.isStatic()) {
return INVOKE_STATIC;
} else if (methodDescription.isPrivate()) {
return INVOKE_SPECIAL;
} else if (methodDescription.isConstructor()) {
return INVOKE_SPECIAL_CONSTRUCTOR;
} else if (methodDescription.getDeclaringType().isInterface()) {
return INVOKE_INTERFACE;
} else {
return INVOKE_VIRTUAL;
}
} | static HandleType function(MethodDescription.InDefinedShape methodDescription) { if (methodDescription.isStatic()) { return INVOKE_STATIC; } else if (methodDescription.isPrivate()) { return INVOKE_SPECIAL; } else if (methodDescription.isConstructor()) { return INVOKE_SPECIAL_CONSTRUCTOR; } else if (methodDescription.getDeclaringType().isInterface()) { return INVOKE_INTERFACE; } else { return INVOKE_VIRTUAL; } } | /**
* Extracts a handle type for invoking the given method.
*
* @param methodDescription The method for which a handle type should be found.
* @return The handle type for the given method.
*/ | Extracts a handle type for invoking the given method | of | {
"repo_name": "mches/byte-buddy",
"path": "byte-buddy-dep/src/main/java/net/bytebuddy/utility/JavaConstant.java",
"license": "apache-2.0",
"size": 59108
} | [
"net.bytebuddy.description.method.MethodDescription"
] | import net.bytebuddy.description.method.MethodDescription; | import net.bytebuddy.description.method.*; | [
"net.bytebuddy.description"
] | net.bytebuddy.description; | 581,544 |
@Inject
@Optional
protected void cutText(@UIEventTopic(TestEditorUIEventConstants.EDIT_CONTEXTMENU_CNTRL_X) String data) {
if (isThisPartOnTop() && !isFocusInSubComponent()) {
String textData = getStyledText().getSelectionText();
if (textData != null && textData.length() > 0) {
TestEditorTestDataTransferContainer dataContainer = testCaseController.cutSelectedTestComponents();
putDataToClipboard(dataContainer);
}
}
}
| void function(@UIEventTopic(TestEditorUIEventConstants.EDIT_CONTEXTMENU_CNTRL_X) String data) { if (isThisPartOnTop() && !isFocusInSubComponent()) { String textData = getStyledText().getSelectionText(); if (textData != null && textData.length() > 0) { TestEditorTestDataTransferContainer dataContainer = testCaseController.cutSelectedTestComponents(); putDataToClipboard(dataContainer); } } } | /**
* cut the selected testComponent and store the text in the clipboard.
*
* @param data
* optional data
*/ | cut the selected testComponent and store the text in the clipboard | cutText | {
"repo_name": "test-editor/test-editor",
"path": "ui/org.testeditor.ui/src/main/java/org/testeditor/ui/parts/editor/view/TestEditorViewBasis.java",
"license": "epl-1.0",
"size": 29767
} | [
"org.eclipse.e4.ui.di.UIEventTopic",
"org.testeditor.ui.constants.TestEditorUIEventConstants"
] | import org.eclipse.e4.ui.di.UIEventTopic; import org.testeditor.ui.constants.TestEditorUIEventConstants; | import org.eclipse.e4.ui.di.*; import org.testeditor.ui.constants.*; | [
"org.eclipse.e4",
"org.testeditor.ui"
] | org.eclipse.e4; org.testeditor.ui; | 536,876 |
public long sizeOf()
{
return INSTANCE_SIZE + SizeOf.sizeOf(array) + (segments * SIZE_OF_SEGMENT);
} | long function() { return INSTANCE_SIZE + SizeOf.sizeOf(array) + (segments * SIZE_OF_SEGMENT); } | /**
* Returns the size of this big array in bytes.
*/ | Returns the size of this big array in bytes | sizeOf | {
"repo_name": "Teradata/presto",
"path": "presto-array/src/main/java/com/facebook/presto/array/LongBigArray.java",
"license": "apache-2.0",
"size": 4220
} | [
"io.airlift.slice.SizeOf"
] | import io.airlift.slice.SizeOf; | import io.airlift.slice.*; | [
"io.airlift.slice"
] | io.airlift.slice; | 2,375,606 |
public List<JsonRpcResponse> submit(Wavelet wavelet, String rpcServerUrl) throws IOException {
return waveService.submit(wavelet, rpcServerUrl);
}
/**
* Returns an empty/blind stub of a wavelet with the given wave id and wavelet
* id.
*
* Call this method if you would like to apply wavelet-only operations
* without fetching the wave first.
*
* The returned wavelet has its own {@link OperationQueue}. It is the
* responsibility of the caller to make sure this wavelet gets submitted to
* the server, either by calling {@link AbstractRobot#submit(Wavelet, String)} | List<JsonRpcResponse> function(Wavelet wavelet, String rpcServerUrl) throws IOException { return waveService.submit(wavelet, rpcServerUrl); } /** * Returns an empty/blind stub of a wavelet with the given wave id and wavelet * id. * * Call this method if you would like to apply wavelet-only operations * without fetching the wave first. * * The returned wavelet has its own {@link OperationQueue}. It is the * responsibility of the caller to make sure this wavelet gets submitted to * the server, either by calling {@link AbstractRobot#submit(Wavelet, String)} | /**
* Submits the pending operations associated with this {@link Wavelet}.
*
* @param wavelet the bundle that contains the operations to be submitted.
* @param rpcServerUrl the active gateway to send the operations to.
* @return a list of {@link JsonRpcResponse} that represents the responses
* from the server for all operations that were submitted.
*
* @throws IllegalStateException if this method is called prior to setting
* the proper consumer key, secret, and handler URL.
* @throws IOException if there is a problem submitting the operations.
*/ | Submits the pending operations associated with this <code>Wavelet</code> | submit | {
"repo_name": "gburd/wave",
"path": "src/com/google/wave/api/AbstractRobot.java",
"license": "apache-2.0",
"size": 33213
} | [
"java.io.IOException",
"java.util.List"
] | import java.io.IOException; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,209,304 |
private void addComponents(Color borderColor)
{
// create the labels
generationLabel = new JLabel(GENERATION + " 0.");
statusLabel = new JLabel(status);
currentCursorPositionLabel = new JLabel(CURSOR_POSITION_STRING);
currentCursorValueLabel = new JLabel(CURSOR_VALUE_STRING);
String ruleSelection = (String) outerPanel.getRulePanel().getRuleTree()
.getSelectedRuleName();
String latticeSelection = (String) outerPanel.getPropertiesPanel()
.getLatticeChooser().getSelectedItem();
int numStates = Integer.parseInt(outerPanel.getPropertiesPanel()
.getNumStatesField().getText());
MinMaxBigIntPair minmaxRule = IntegerRule.getMinMaxRuleNumberAllowed(
latticeSelection, ruleSelection, numStates);
if(minmaxRule != null)
{
currentRuleLabel = new JLabel(ruleString
+ ruleSelection
+ ", "
+ StatusPanel.RULE_NUMBER_STRING
+ outerPanel.getRulePanel().getRuleNumberTextField()
.getText());
}
else
{
currentRuleLabel = new JLabel(ruleString + ruleSelection);
}
// has many options, so farmed the RuleLabel out to a method
setCurrentRuleLabel();
currentLatticeLabel = new JLabel(latticeString + latticeSelection);
currentDimensionsLabel = new JLabel(dimensionsString
+ CurrentProperties.getInstance().getNumRows() + " by "
+ CurrentProperties.getInstance().getNumColumns());
// has many options, so farmed the NumberOfStatesLabel out to a method
setCurrentNumberOfStatesLabel();
currentRunningAverageLabel = new JLabel(runningAvgString
+ outerPanel.getPropertiesPanel().getRunningAverageField()
.getText());
// create the copyright label
JLabel moniker = new JLabel(CAConstants.COPYRIGHT);
// set the fonts
generationLabel.setFont(new Fonts().getBoldVerySmallFont());
generationLabel.setForeground(Color.BLUE);
statusLabel.setFont(new Fonts().getBoldVerySmallFont());
statusLabel.setForeground(Color.BLUE);
currentRuleLabel.setFont(new Fonts().getPlainVerySmallFont());
currentLatticeLabel.setFont(new Fonts().getPlainVerySmallFont());
currentDimensionsLabel.setFont(new Fonts().getPlainVerySmallFont());
currentNumberOfStatesLabel.setFont(new Fonts().getPlainVerySmallFont());
currentRunningAverageLabel.setFont(new Fonts().getPlainVerySmallFont());
moniker.setFont(new Font(moniker.getFont().getFontName(), Font.ITALIC,
9));
currentCursorValueLabel.setFont(new Fonts().getPlainVerySmallFont());
moniker.setFont(new Font(moniker.getFont().getFontName(), Font.ITALIC,
9));
currentCursorPositionLabel.setFont(new Fonts().getPlainVerySmallFont());
moniker.setFont(new Font(moniker.getFont().getFontName(), Font.ITALIC,
9));
// create panels for each label.
JPanel generationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
generationPanel.setBorder(BorderFactory.createLoweredBevelBorder());
generationPanel.add(generationLabel);
JPanel statPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
statPanel.setBorder(BorderFactory.createLoweredBevelBorder());
int height = statusLabel.getPreferredSize().height;
statusLabel.setMinimumSize(new Dimension(220, height));
statusLabel.setPreferredSize(new Dimension(220, height));
statPanel.add(statusLabel);
JPanel rulePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
rulePanel.setBorder(BorderFactory.createLoweredBevelBorder());
rulePanel.add(currentRuleLabel);
JPanel latticePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
latticePanel.setBorder(BorderFactory.createLoweredBevelBorder());
latticePanel.add(currentLatticeLabel);
JPanel dimPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
dimPanel.setBorder(BorderFactory.createLoweredBevelBorder());
// dimPanel.setMinimumSize(new Dimension(80, height));
// dimPanel.setPreferredSize(new Dimension(80, height));
dimPanel.add(currentDimensionsLabel);
JPanel statesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
statesPanel.setBorder(BorderFactory.createLoweredBevelBorder());
// statesPanel.setMinimumSize(new Dimension(60, height));
// statesPanel.setPreferredSize(new Dimension(60, height));
statesPanel.add(currentNumberOfStatesLabel);
JPanel runAvgPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
runAvgPanel.setBorder(BorderFactory.createLoweredBevelBorder());
// runAvgPanel.setMinimumSize(new Dimension(50, height));
// runAvgPanel.setPreferredSize(new Dimension(50, height));
runAvgPanel.add(currentRunningAverageLabel);
JPanel cursorValuePanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
cursorValuePanel.setBorder(BorderFactory.createLoweredBevelBorder());
cursorValuePanel.setMinimumSize(new Dimension(90, height));
cursorValuePanel.setPreferredSize(new Dimension(90, height));
cursorValuePanel.add(currentCursorValueLabel);
JPanel cursorPositionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
cursorPositionPanel.setBorder(BorderFactory.createLoweredBevelBorder());
cursorPositionPanel.setMinimumSize(new Dimension(95, height));
cursorPositionPanel.setPreferredSize(new Dimension(95, height));
cursorPositionPanel.add(currentCursorPositionLabel);
// add the labels and moniker to a GridBagLayout
this.setLayout(new GridBagLayout());
this.setBorder(BorderFactory.createRaisedBevelBorder());
// generation label
int col = 0;
this.add(generationPanel, new GBC(col, 1).setSpan(1, 1).setFill(
GBC.BOTH).setWeight(0.0, 0.0).setAnchor(GBC.WEST).setInsets(1));
// status label
col++;
this.add(statPanel, new GBC(col, 1).setSpan(2, 1).setFill(GBC.BOTH)
.setWeight(1.0, 1.0).setAnchor(GBC.WEST).setInsets(1));
// space (incremented twice because above spans 2)
col++;
col++;
JPanel spacePanel = new JPanel();
spacePanel.add(new JLabel(" "));
this.add(spacePanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH)
.setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));
// rule label
col++;
this.add(rulePanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH)
.setWeight(2.0, 2.0).setAnchor(GBC.WEST).setInsets(1));
// lattice label
col++;
this.add(latticePanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH)
.setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));
// dimensions label
col++;
this.add(dimPanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH)
.setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));
// number of states label
col++;
this.add(statesPanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH)
.setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));
// running average label
col++;
this.add(runAvgPanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH)
.setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));
// value of cell under the cursor label
col++;
this.add(cursorValuePanel, new GBC(col, 1).setSpan(1, 1).setFill(
GBC.BOTH).setWeight(4.0, 4.0).setAnchor(GBC.WEST).setInsets(1));
// cursor position label
col++;
this.add(cursorPositionPanel, new GBC(col, 1).setSpan(1, 1).setFill(
GBC.BOTH).setWeight(0.0, 0.0).setAnchor(GBC.WEST).setInsets(1));
// // space
// col++;
// this.add(new JLabel(" "), new GBC(col, 1).setSpan(1, 1).setFill(
// GBC.BOTH).setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1));
//
// // moniker label
// col++;
// this.add(moniker, new GBC(col, 1).setSpan(2, 1).setFill(GBC.BOTH)
// .setWeight(0.0, 0.0).setAnchor(GBC.EAST).setInsets(1));
}
| void function(Color borderColor) { generationLabel = new JLabel(GENERATION + STR); statusLabel = new JLabel(status); currentCursorPositionLabel = new JLabel(CURSOR_POSITION_STRING); currentCursorValueLabel = new JLabel(CURSOR_VALUE_STRING); String ruleSelection = (String) outerPanel.getRulePanel().getRuleTree() .getSelectedRuleName(); String latticeSelection = (String) outerPanel.getPropertiesPanel() .getLatticeChooser().getSelectedItem(); int numStates = Integer.parseInt(outerPanel.getPropertiesPanel() .getNumStatesField().getText()); MinMaxBigIntPair minmaxRule = IntegerRule.getMinMaxRuleNumberAllowed( latticeSelection, ruleSelection, numStates); if(minmaxRule != null) { currentRuleLabel = new JLabel(ruleString + ruleSelection + STR + StatusPanel.RULE_NUMBER_STRING + outerPanel.getRulePanel().getRuleNumberTextField() .getText()); } else { currentRuleLabel = new JLabel(ruleString + ruleSelection); } setCurrentRuleLabel(); currentLatticeLabel = new JLabel(latticeString + latticeSelection); currentDimensionsLabel = new JLabel(dimensionsString + CurrentProperties.getInstance().getNumRows() + STR + CurrentProperties.getInstance().getNumColumns()); setCurrentNumberOfStatesLabel(); currentRunningAverageLabel = new JLabel(runningAvgString + outerPanel.getPropertiesPanel().getRunningAverageField() .getText()); JLabel moniker = new JLabel(CAConstants.COPYRIGHT); generationLabel.setFont(new Fonts().getBoldVerySmallFont()); generationLabel.setForeground(Color.BLUE); statusLabel.setFont(new Fonts().getBoldVerySmallFont()); statusLabel.setForeground(Color.BLUE); currentRuleLabel.setFont(new Fonts().getPlainVerySmallFont()); currentLatticeLabel.setFont(new Fonts().getPlainVerySmallFont()); currentDimensionsLabel.setFont(new Fonts().getPlainVerySmallFont()); currentNumberOfStatesLabel.setFont(new Fonts().getPlainVerySmallFont()); currentRunningAverageLabel.setFont(new Fonts().getPlainVerySmallFont()); moniker.setFont(new Font(moniker.getFont().getFontName(), Font.ITALIC, 9)); currentCursorValueLabel.setFont(new Fonts().getPlainVerySmallFont()); moniker.setFont(new Font(moniker.getFont().getFontName(), Font.ITALIC, 9)); currentCursorPositionLabel.setFont(new Fonts().getPlainVerySmallFont()); moniker.setFont(new Font(moniker.getFont().getFontName(), Font.ITALIC, 9)); JPanel generationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); generationPanel.setBorder(BorderFactory.createLoweredBevelBorder()); generationPanel.add(generationLabel); JPanel statPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); statPanel.setBorder(BorderFactory.createLoweredBevelBorder()); int height = statusLabel.getPreferredSize().height; statusLabel.setMinimumSize(new Dimension(220, height)); statusLabel.setPreferredSize(new Dimension(220, height)); statPanel.add(statusLabel); JPanel rulePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); rulePanel.setBorder(BorderFactory.createLoweredBevelBorder()); rulePanel.add(currentRuleLabel); JPanel latticePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); latticePanel.setBorder(BorderFactory.createLoweredBevelBorder()); latticePanel.add(currentLatticeLabel); JPanel dimPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); dimPanel.setBorder(BorderFactory.createLoweredBevelBorder()); dimPanel.add(currentDimensionsLabel); JPanel statesPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); statesPanel.setBorder(BorderFactory.createLoweredBevelBorder()); statesPanel.add(currentNumberOfStatesLabel); JPanel runAvgPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); runAvgPanel.setBorder(BorderFactory.createLoweredBevelBorder()); runAvgPanel.add(currentRunningAverageLabel); JPanel cursorValuePanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); cursorValuePanel.setBorder(BorderFactory.createLoweredBevelBorder()); cursorValuePanel.setMinimumSize(new Dimension(90, height)); cursorValuePanel.setPreferredSize(new Dimension(90, height)); cursorValuePanel.add(currentCursorValueLabel); JPanel cursorPositionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); cursorPositionPanel.setBorder(BorderFactory.createLoweredBevelBorder()); cursorPositionPanel.setMinimumSize(new Dimension(95, height)); cursorPositionPanel.setPreferredSize(new Dimension(95, height)); cursorPositionPanel.add(currentCursorPositionLabel); this.setLayout(new GridBagLayout()); this.setBorder(BorderFactory.createRaisedBevelBorder()); int col = 0; this.add(generationPanel, new GBC(col, 1).setSpan(1, 1).setFill( GBC.BOTH).setWeight(0.0, 0.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(statPanel, new GBC(col, 1).setSpan(2, 1).setFill(GBC.BOTH) .setWeight(1.0, 1.0).setAnchor(GBC.WEST).setInsets(1)); col++; col++; JPanel spacePanel = new JPanel(); spacePanel.add(new JLabel(" ")); this.add(spacePanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH) .setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(rulePanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH) .setWeight(2.0, 2.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(latticePanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH) .setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(dimPanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH) .setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(statesPanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH) .setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(runAvgPanel, new GBC(col, 1).setSpan(1, 1).setFill(GBC.BOTH) .setWeight(10.0, 10.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(cursorValuePanel, new GBC(col, 1).setSpan(1, 1).setFill( GBC.BOTH).setWeight(4.0, 4.0).setAnchor(GBC.WEST).setInsets(1)); col++; this.add(cursorPositionPanel, new GBC(col, 1).setSpan(1, 1).setFill( GBC.BOTH).setWeight(0.0, 0.0).setAnchor(GBC.WEST).setInsets(1)); } | /**
* Create and arrange a panel holding the CA status messages.
*
* @return The panel holding the status messages such as the current rule,
* current generation, my moniker, etc.
*/ | Create and arrange a panel holding the CA status messages | addComponents | {
"repo_name": "KEOpenSource/CAExplorer",
"path": "cellularAutomata/graphics/StatusPanel.java",
"license": "apache-2.0",
"size": 22629
} | [
"java.awt.Color",
"java.awt.Dimension",
"java.awt.FlowLayout",
"java.awt.Font",
"java.awt.GridBagLayout",
"javax.swing.BorderFactory",
"javax.swing.JLabel",
"javax.swing.JPanel"
] | import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagLayout; import javax.swing.BorderFactory; import javax.swing.JLabel; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,999,255 |
public void onUsbMassStorageConnectionChanged(boolean connected) throws RemoteException {
Parcel _data = Parcel.obtain();
Parcel _reply = Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeInt(((connected) ? (1) : (0)));
mRemote.transact(Stub.TRANSACTION_onUsbMassStorageConnectionChanged, _data,
_reply, 0);
_reply.readException();
} finally {
_reply.recycle();
_data.recycle();
}
} | void function(boolean connected) throws RemoteException { Parcel _data = Parcel.obtain(); Parcel _reply = Parcel.obtain(); try { _data.writeInterfaceToken(DESCRIPTOR); _data.writeInt(((connected) ? (1) : (0))); mRemote.transact(Stub.TRANSACTION_onUsbMassStorageConnectionChanged, _data, _reply, 0); _reply.readException(); } finally { _reply.recycle(); _data.recycle(); } } | /**
* Detection state of USB Mass Storage has changed
*
* @param available true if a UMS host is connected.
*/ | Detection state of USB Mass Storage has changed | onUsbMassStorageConnectionChanged | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/android/os/storage/IMountServiceListener.java",
"license": "apache-2.0",
"size": 6607
} | [
"android.os.Parcel",
"android.os.RemoteException"
] | import android.os.Parcel; import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 1,050,340 |
public Value value() throws IOException;
| Value function() throws IOException; | /**
* Consume {@link JsonStreamToken#VALUE} token.
* @return value
* @throws IOException
*/ | Consume <code>JsonStreamToken#VALUE</code> token | value | {
"repo_name": "AntonMykolaienko/xml2json",
"path": "staxon/core/src/main/java/de/odysseus/staxon/json/stream/JsonStreamSource.java",
"license": "apache-2.0",
"size": 2650
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,437,269 |
private JPanel getSecurityContainerPanel() {
if (securityContainerPanel == null) {
securityContainerPanel = new MethodSecurityPanel(info, info.getService(), method);
securityContainerPanel.setBorder(BorderFactory.createTitledBorder(null,
"Method Level Security Configuration", TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor()));
}
return securityContainerPanel;
} | JPanel function() { if (securityContainerPanel == null) { securityContainerPanel = new MethodSecurityPanel(info, info.getService(), method); securityContainerPanel.setBorder(BorderFactory.createTitledBorder(null, STR, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, PortalLookAndFeel.getPanelLabelColor())); } return securityContainerPanel; } | /**
* This method initializes securityContainerPanel
*
* @return javax.swing.JPanel
*/ | This method initializes securityContainerPanel | getSecurityContainerPanel | {
"repo_name": "NCIP/cagrid-core",
"path": "caGrid/projects/introduce/src/java/Portal/gov/nih/nci/cagrid/introduce/portal/modification/services/methods/MethodViewer.java",
"license": "bsd-3-clause",
"size": 133307
} | [
"gov.nih.nci.cagrid.common.portal.PortalLookAndFeel",
"gov.nih.nci.cagrid.introduce.portal.modification.security.MethodSecurityPanel",
"javax.swing.BorderFactory",
"javax.swing.JPanel",
"javax.swing.border.TitledBorder"
] | import gov.nih.nci.cagrid.common.portal.PortalLookAndFeel; import gov.nih.nci.cagrid.introduce.portal.modification.security.MethodSecurityPanel; import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.border.TitledBorder; | import gov.nih.nci.cagrid.common.portal.*; import gov.nih.nci.cagrid.introduce.portal.modification.security.*; import javax.swing.*; import javax.swing.border.*; | [
"gov.nih.nci",
"javax.swing"
] | gov.nih.nci; javax.swing; | 1,692,403 |
public ResponseManager getResponseManager(){
return s.getResponseManager();
} | ResponseManager function(){ return s.getResponseManager(); } | /**
* The response manager of the active instance
* @return the response manager
*/ | The response manager of the active instance | getResponseManager | {
"repo_name": "ulyfm/FD2",
"path": "FoodDrop/src/us/noop/server/Main.java",
"license": "bsd-3-clause",
"size": 1598
} | [
"us.noop.server.response.ResponseManager"
] | import us.noop.server.response.ResponseManager; | import us.noop.server.response.*; | [
"us.noop.server"
] | us.noop.server; | 2,148,513 |
@SuppressWarnings("unchecked") private static ChangeBlockEvent.Pre callChangeBlockEventPre(final WorldServerBridge worldIn, final ImmutableList<Location<World>> locations, @Nullable Object source) {
try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) {
final PhaseContext<?> phaseContext = PhaseTracker.getInstance().getCurrentContext();
if (source == null) {
source = phaseContext.getSource() == null ? worldIn : phaseContext.getSource();
}
// TODO - All of this bit should be nuked since PhaseContext has lazy initializing frames.
EntityPlayer player = null;
frame.pushCause(source);
if (source instanceof Player) {
player = (EntityPlayer) source;
if (SpongeImplHooks.isFakePlayer(player)) {
frame.addContext(EventContextKeys.FAKE_PLAYER, (Player) player);
}
}
final User owner = phaseContext.getOwner().orElse((User) player);
if (owner != null) {
frame.addContext(EventContextKeys.OWNER, owner);
}
if (!((IPhaseState) phaseContext.state).shouldProvideModifiers(phaseContext)) {
phaseContext.getSource(BlockBridge.class).ifPresent(bridge -> {
bridge.bridge$getTickFrameModifier().accept(frame, worldIn);
});
}
phaseContext.applyNotifierIfAvailable(notifier -> frame.addContext(EventContextKeys.NOTIFIER, notifier));
final ChangeBlockEvent.Pre event =
SpongeEventFactory.createChangeBlockEventPre(frame.getCurrentCause(), locations);
SpongeImpl.postEvent(event);
return event;
}
} | @SuppressWarnings(STR) static ChangeBlockEvent.Pre function(final WorldServerBridge worldIn, final ImmutableList<Location<World>> locations, @Nullable Object source) { try (final CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { final PhaseContext<?> phaseContext = PhaseTracker.getInstance().getCurrentContext(); if (source == null) { source = phaseContext.getSource() == null ? worldIn : phaseContext.getSource(); } EntityPlayer player = null; frame.pushCause(source); if (source instanceof Player) { player = (EntityPlayer) source; if (SpongeImplHooks.isFakePlayer(player)) { frame.addContext(EventContextKeys.FAKE_PLAYER, (Player) player); } } final User owner = phaseContext.getOwner().orElse((User) player); if (owner != null) { frame.addContext(EventContextKeys.OWNER, owner); } if (!((IPhaseState) phaseContext.state).shouldProvideModifiers(phaseContext)) { phaseContext.getSource(BlockBridge.class).ifPresent(bridge -> { bridge.bridge$getTickFrameModifier().accept(frame, worldIn); }); } phaseContext.applyNotifierIfAvailable(notifier -> frame.addContext(EventContextKeys.NOTIFIER, notifier)); final ChangeBlockEvent.Pre event = SpongeEventFactory.createChangeBlockEventPre(frame.getCurrentCause(), locations); SpongeImpl.postEvent(event); return event; } } | /**
* Processes pre block event data then fires event.
*
* @param worldIn The world
* @param locations The locations affected
* @param source The source of event
* @return The event
*/ | Processes pre block event data then fires event | callChangeBlockEventPre | {
"repo_name": "SpongePowered/SpongeCommon",
"path": "src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java",
"license": "mit",
"size": 99325
} | [
"com.google.common.collect.ImmutableList",
"javax.annotation.Nullable",
"net.minecraft.entity.player.EntityPlayer",
"org.spongepowered.api.Sponge",
"org.spongepowered.api.entity.living.player.Player",
"org.spongepowered.api.entity.living.player.User",
"org.spongepowered.api.event.CauseStackManager",
"org.spongepowered.api.event.SpongeEventFactory",
"org.spongepowered.api.event.block.ChangeBlockEvent",
"org.spongepowered.api.event.cause.EventContextKeys",
"org.spongepowered.api.world.Location",
"org.spongepowered.api.world.World",
"org.spongepowered.common.SpongeImpl",
"org.spongepowered.common.SpongeImplHooks",
"org.spongepowered.common.bridge.block.BlockBridge",
"org.spongepowered.common.bridge.world.WorldServerBridge",
"org.spongepowered.common.event.tracking.IPhaseState",
"org.spongepowered.common.event.tracking.PhaseContext",
"org.spongepowered.common.event.tracking.PhaseTracker"
] | import com.google.common.collect.ImmutableList; import javax.annotation.Nullable; import net.minecraft.entity.player.EntityPlayer; import org.spongepowered.api.Sponge; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.event.CauseStackManager; import org.spongepowered.api.event.SpongeEventFactory; import org.spongepowered.api.event.block.ChangeBlockEvent; import org.spongepowered.api.event.cause.EventContextKeys; import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World; import org.spongepowered.common.SpongeImpl; import org.spongepowered.common.SpongeImplHooks; import org.spongepowered.common.bridge.block.BlockBridge; import org.spongepowered.common.bridge.world.WorldServerBridge; import org.spongepowered.common.event.tracking.IPhaseState; import org.spongepowered.common.event.tracking.PhaseContext; import org.spongepowered.common.event.tracking.PhaseTracker; | import com.google.common.collect.*; import javax.annotation.*; import net.minecraft.entity.player.*; import org.spongepowered.api.*; import org.spongepowered.api.entity.living.player.*; import org.spongepowered.api.event.*; import org.spongepowered.api.event.block.*; import org.spongepowered.api.event.cause.*; import org.spongepowered.api.world.*; import org.spongepowered.common.*; import org.spongepowered.common.bridge.block.*; import org.spongepowered.common.bridge.world.*; import org.spongepowered.common.event.tracking.*; | [
"com.google.common",
"javax.annotation",
"net.minecraft.entity",
"org.spongepowered.api",
"org.spongepowered.common"
] | com.google.common; javax.annotation; net.minecraft.entity; org.spongepowered.api; org.spongepowered.common; | 1,341,463 |
private Object deparsePrimitive(Object obj, PrimitiveObjectInspector primOI) {
return primOI.getPrimitiveJavaObject(obj);
} | Object function(Object obj, PrimitiveObjectInspector primOI) { return primOI.getPrimitiveJavaObject(obj); } | /**
* Deparses a primitive type.
*
* @param obj - Hive object to deparse
* @param primOI - ObjectInspector for the object
* @return - A deparsed object
*/ | Deparses a primitive type | deparsePrimitive | {
"repo_name": "micmiu/bigdata-tutorial",
"path": "hive-demo/src/main/java/com/micmiu/hive/serde/JSONCDHSerDe.java",
"license": "apache-2.0",
"size": 13815
} | [
"org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector"
] | import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; | import org.apache.hadoop.hive.serde2.objectinspector.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 967,905 |
public void pow(final double a,
final double[] operand, final int operandOffset,
final double[] result, final int resultOffset) {
// create the function value and derivatives
// [a^x, ln(a) a^x, ln(a)^2 a^x,, ln(a)^3 a^x, ... ]
final double[] function = new double[1 + order];
if (a == 0) {
if (operand[operandOffset] == 0) {
function[0] = 1;
double infinity = Double.POSITIVE_INFINITY;
for (int i = 1; i < function.length; ++i) {
infinity = -infinity;
function[i] = infinity;
}
} else if (operand[operandOffset] < 0) {
Arrays.fill(function, Double.NaN);
}
} else {
function[0] = FastMath.pow(a, operand[operandOffset]);
final double lnA = FastMath.log(a);
for (int i = 1; i < function.length; ++i) {
function[i] = lnA * function[i - 1];
}
}
// apply function composition
compose(operand, operandOffset, function, result, resultOffset);
} | void function(final double a, final double[] operand, final int operandOffset, final double[] result, final int resultOffset) { final double[] function = new double[1 + order]; if (a == 0) { if (operand[operandOffset] == 0) { function[0] = 1; double infinity = Double.POSITIVE_INFINITY; for (int i = 1; i < function.length; ++i) { infinity = -infinity; function[i] = infinity; } } else if (operand[operandOffset] < 0) { Arrays.fill(function, Double.NaN); } } else { function[0] = FastMath.pow(a, operand[operandOffset]); final double lnA = FastMath.log(a); for (int i = 1; i < function.length; ++i) { function[i] = lnA * function[i - 1]; } } compose(operand, operandOffset, function, result, resultOffset); } | /** Compute power of a double to a derivative structure.
* @param a number to exponentiate
* @param operand array holding the power
* @param operandOffset offset of the power in its array
* @param result array where result must be stored (for
* power the result array <em>cannot</em> be the input
* array)
* @param resultOffset offset of the result in its array
* @since 3.3
*/ | Compute power of a double to a derivative structure | pow | {
"repo_name": "virtualdataset/metagen-java",
"path": "virtdata-lib-curves4/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java",
"license": "apache-2.0",
"size": 78787
} | [
"java.util.Arrays",
"org.apache.commons.math4.util.FastMath"
] | import java.util.Arrays; import org.apache.commons.math4.util.FastMath; | import java.util.*; import org.apache.commons.math4.util.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 566,840 |
public @Nullable Map<String, Object> getExportedViewConstants() {
return null;
} | @Nullable Map<String, Object> function() { return null; } | /**
* Returns a map of view-specific constants that are injected to JavaScript. These constants are
* made accessible via UIManager.<ViewName>.Constants.
*/ | Returns a map of view-specific constants that are injected to JavaScript. These constants are made accessible via UIManager..Constants | getExportedViewConstants | {
"repo_name": "Helena-High/school-app",
"path": "node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java",
"license": "apache-2.0",
"size": 7681
} | [
"java.util.Map",
"javax.annotation.Nullable"
] | import java.util.Map; import javax.annotation.Nullable; | import java.util.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 2,267,899 |
public static final AtomicQuantityImpl createAtomicQuantity (
URI uri,
Units units,
DataType datatype,
String value
)
throws SetDataException, IllegalAccessException
{
logger.debug(" create AQ.");
logger.debug(" create AQ. Got URI:"+uri.toASCIIString());
AtomicQuantityImpl q = new AtomicQuantityImpl(uri);
// populate all of the known fields to test if they are working
q.setUnits(units);
q.setDataType(datatype);
// set the value 2x, just to test the API, and not for any other reason
q.setValue(value, q.createLocator());
q.setValue(value); // will overwrite
return q;
} | static final AtomicQuantityImpl function ( URI uri, Units units, DataType datatype, String value ) throws SetDataException, IllegalAccessException { logger.debug(STR); logger.debug(STR+uri.toASCIIString()); AtomicQuantityImpl q = new AtomicQuantityImpl(uri); q.setUnits(units); q.setDataType(datatype); q.setValue(value, q.createLocator()); q.setValue(value); return q; } | /** General helper method to construct atomic quantities.
*
* @param id
* @param units
* @param datatype
* @param value
* @param properties
* @return
* @throws SetDataException
* @throws IllegalAccessException
*/ | General helper method to construct atomic quantities | createAtomicQuantity | {
"repo_name": "brianthomas/qml",
"path": "src/main/java/net/datamodel/qml/builder/SimpleQuantityBuilder.java",
"license": "lgpl-3.0",
"size": 4740
} | [
"net.datamodel.qml.DataType",
"net.datamodel.qml.SetDataException",
"net.datamodel.qml.Units",
"net.datamodel.qml.core.AtomicQuantityImpl"
] | import net.datamodel.qml.DataType; import net.datamodel.qml.SetDataException; import net.datamodel.qml.Units; import net.datamodel.qml.core.AtomicQuantityImpl; | import net.datamodel.qml.*; import net.datamodel.qml.core.*; | [
"net.datamodel.qml"
] | net.datamodel.qml; | 2,771,332 |
public Map<String, String> getExtraHeaders() {
return mExtraHeaders;
} | Map<String, String> function() { return mExtraHeaders; } | /**
* Return the extra headers as a map.
*/ | Return the extra headers as a map | getExtraHeaders | {
"repo_name": "CTSRD-SOAAP/chromium-42.0.2311.135",
"path": "content/public/android/java/src/org/chromium/content_public/browser/LoadUrlParams.java",
"license": "bsd-3-clause",
"size": 15043
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 799,581 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.