method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Switch(value="Root folder of webapp",compulsory=true) public StandAloneWebApp setRoot(File newRoot) { root = newRoot; return this; }
@Switch(value=STR,compulsory=true) public StandAloneWebApp setRoot(File newRoot) { root = newRoot; return this; }
/** * Getter for {@link #root}: Root directory of webapp. * @return Root directory of webapp. */
Getter for <code>#root</code>: Root directory of webapp
getRoot
{ "repo_name": "nzilbb/ag", "path": "ag/src/main/java/nzilbb/webapp/StandAloneWebApp.java", "license": "gpl-3.0", "size": 10683 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,212,160
public Vector<PeerID> getGlobalPeerView() { Vector<PeerID> global = new Vector<PeerID>(); SortedSet<String> set = new TreeSet<String>(); try { // get the local peerview List<PeerID> rpv = group.getRendezVousService().getLocalRendezVousView(); for (PeerID pid : rpv) { set.add(pid.toString()); } // add myself set.add(group.getPeerID().toString()); // produce a vector of Peer IDs for (String aSet : set) { try { PeerID peerID = (PeerID) IDFactory.fromURI(new URI(aSet)); global.add(peerID); } catch (URISyntaxException badID) { throw new IllegalArgumentException("Bad PeerID ID in advertisement"); } catch (ClassCastException badID) { throw new IllegalArgumentException("ID was not a peerID"); } } } catch (Exception ex) { Logging.logCheckedWarning(LOG, "Failure generating the global view\n", ex); } return global; }
Vector<PeerID> function() { Vector<PeerID> global = new Vector<PeerID>(); SortedSet<String> set = new TreeSet<String>(); try { List<PeerID> rpv = group.getRendezVousService().getLocalRendezVousView(); for (PeerID pid : rpv) { set.add(pid.toString()); } set.add(group.getPeerID().toString()); for (String aSet : set) { try { PeerID peerID = (PeerID) IDFactory.fromURI(new URI(aSet)); global.add(peerID); } catch (URISyntaxException badID) { throw new IllegalArgumentException(STR); } catch (ClassCastException badID) { throw new IllegalArgumentException(STR); } } } catch (Exception ex) { Logging.logCheckedWarning(LOG, STR, ex); } return global; }
/** * get the global peerview as the rendezvous service only returns * the peerview without the local RDV peer. We need this * consistent view for the SRDI index if not each RDV will have a * different peerview, off setting the index even when the peerview * is stable * * @return the sorted list */
get the global peerview as the rendezvous service only returns the peerview without the local RDV peer. We need this consistent view for the SRDI index if not each RDV will have a different peerview, off setting the index even when the peerview is stable
getGlobalPeerView
{ "repo_name": "johnjianfang/jxse", "path": "src/main/java/net/jxta/impl/cm/SrdiManager.java", "license": "apache-2.0", "size": 20671 }
[ "java.net.URISyntaxException", "java.util.List", "java.util.SortedSet", "java.util.TreeSet", "java.util.Vector", "net.jxta.id.IDFactory", "net.jxta.logging.Logging", "net.jxta.peer.PeerID" ]
import java.net.URISyntaxException; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import java.util.Vector; import net.jxta.id.IDFactory; import net.jxta.logging.Logging; import net.jxta.peer.PeerID;
import java.net.*; import java.util.*; import net.jxta.id.*; import net.jxta.logging.*; import net.jxta.peer.*;
[ "java.net", "java.util", "net.jxta.id", "net.jxta.logging", "net.jxta.peer" ]
java.net; java.util; net.jxta.id; net.jxta.logging; net.jxta.peer;
709,558
public static String colorToAlphaHexCode(final Color color) { return String.format("%08x", color.getRGB()); }
static String function(final Color color) { return String.format("%08x", color.getRGB()); }
/** * Gets the ARGB hex color code of the passed color. * * @param color The color to get a hex code from. * @return A lower-cased string of the ARGB hex code of color. */
Gets the ARGB hex color code of the passed color
colorToAlphaHexCode
{ "repo_name": "abelbriggs1/runelite", "path": "runelite-client/src/main/java/net/runelite/client/util/ColorUtil.java", "license": "bsd-2-clause", "size": 6832 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,085,364
public TreeMap<String, Integer> getDefenders() { return defenders; }
TreeMap<String, Integer> function() { return defenders; }
/** * Method which returns the map of defending SPlayers. */
Method which returns the map of defending SPlayers
getDefenders
{ "repo_name": "FireSight/GoonWars", "path": "src/server/campaign/operations/ShortOperation.java", "license": "gpl-2.0", "size": 128303 }
[ "java.util.TreeMap" ]
import java.util.TreeMap;
import java.util.*;
[ "java.util" ]
java.util;
2,245,861
public static boolean logFactoidScore(float score, float absThresh) { // logging is disabled or log file is not specified if (!enabled || logfile == null) return false; DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(3); df.setMinimumFractionDigits(3); try { PrintWriter out = new PrintWriter(new FileOutputStream(logfile, true)); out.println("<factoidscore abs_thresh=\"" + absThresh + "\">"); out.println("\t" + df.format(score)); out.println("</factoidscore>"); out.close(); } catch (IOException e) { return false; } return true; }
static boolean function(float score, float absThresh) { if (!enabled logfile == null) return false; DecimalFormat df = new DecimalFormat(); df.setMaximumFractionDigits(3); df.setMinimumFractionDigits(3); try { PrintWriter out = new PrintWriter(new FileOutputStream(logfile, true)); out.println(STRSTR\">"); out.println("\t" + df.format(score)); out.println(STR); out.close(); } catch (IOException e) { return false; } return true; }
/** * Logs the score of the factoid component. * * @param score the score * @param absThresh absolute confidence threshold for results */
Logs the score of the factoid component
logFactoidScore
{ "repo_name": "sonicwangzhimeng/OpenEphyra", "path": "src/info/ephyra/io/Logger.java", "license": "gpl-2.0", "size": 13929 }
[ "java.io.FileOutputStream", "java.io.IOException", "java.io.PrintWriter", "java.text.DecimalFormat" ]
import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.text.DecimalFormat;
import java.io.*; import java.text.*;
[ "java.io", "java.text" ]
java.io; java.text;
1,442,186
public synchronized BaseType createUnion(final String name) throws CouldntSaveDataException { Preconditions.checkNotNull(name, "Error: type name can not be null."); Preconditions.checkArgument(!name.isEmpty(), "Error: type name can not be empty."); final BaseType unionType = instantiateType(name, 0 , false , null, BaseTypeCategory.UNION); notifyTypeAdded(unionType); return unionType; }
synchronized BaseType function(final String name) throws CouldntSaveDataException { Preconditions.checkNotNull(name, STR); Preconditions.checkArgument(!name.isEmpty(), STR); final BaseType unionType = instantiateType(name, 0 , false , null, BaseTypeCategory.UNION); notifyTypeAdded(unionType); return unionType; }
/** * Creates a new union type and writes it to the backend. * * @param name The name of the union type. * @return The created base type instance. * @throws CouldntSaveDataException Thrown if the type couldn't be stored to the backend. */
Creates a new union type and writes it to the backend
createUnion
{ "repo_name": "google/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/types/TypeManager.java", "license": "apache-2.0", "size": 69588 }
[ "com.google.common.base.Preconditions", "com.google.security.zynamics.binnavi.Database" ]
import com.google.common.base.Preconditions; import com.google.security.zynamics.binnavi.Database;
import com.google.common.base.*; import com.google.security.zynamics.binnavi.*;
[ "com.google.common", "com.google.security" ]
com.google.common; com.google.security;
139,230
private boolean supportsGooglePlayServices() { return GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS; }
boolean function() { return GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) == ConnectionResult.SUCCESS; }
/** * Check if the device supports Google Play Services. It's best * practice to check first rather than handling this as an error case. * * @return whether the device supports Google Play Services */
Check if the device supports Google Play Services. It's best practice to check first rather than handling this as an error case
supportsGooglePlayServices
{ "repo_name": "devs4v/activent", "path": "app/src/main/java/com/agnostix/activent/activent/LoginActivity.java", "license": "mit", "size": 7882 }
[ "com.google.android.gms.common.ConnectionResult", "com.google.android.gms.common.GooglePlayServicesUtil" ]
import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.*;
[ "com.google.android" ]
com.google.android;
270,060
public void testRunAfterBoth_actionFailed() { for (ExecutionMode m : ExecutionMode.values()) for (boolean fFirst : new boolean[] { true, false }) for (Integer v1 : new Integer[] { 1, null }) for (Integer v2 : new Integer[] { 2, null }) { final CompletableFuture<Integer> f = new CompletableFuture<>(); final CompletableFuture<Integer> g = new CompletableFuture<>(); final FailingRunnable r1 = new FailingRunnable(m); final FailingRunnable r2 = new FailingRunnable(m); final FailingRunnable r3 = new FailingRunnable(m); final CompletableFuture<Integer> fst = fFirst ? f : g; final CompletableFuture<Integer> snd = !fFirst ? f : g; final Integer w1 = fFirst ? v1 : v2; final Integer w2 = !fFirst ? v1 : v2; final CompletableFuture<Void> h1 = m.runAfterBoth(f, g, r1); assertTrue(fst.complete(w1)); final CompletableFuture<Void> h2 = m.runAfterBoth(f, g, r2); assertTrue(snd.complete(w2)); final CompletableFuture<Void> h3 = m.runAfterBoth(f, g, r3); checkCompletedWithWrappedException(h1, r1.ex); checkCompletedWithWrappedException(h2, r2.ex); checkCompletedWithWrappedException(h3, r3.ex); r1.assertInvoked(); r2.assertInvoked(); r3.assertInvoked(); checkCompletedNormally(f, v1); checkCompletedNormally(g, v2); }}
void function() { for (ExecutionMode m : ExecutionMode.values()) for (boolean fFirst : new boolean[] { true, false }) for (Integer v1 : new Integer[] { 1, null }) for (Integer v2 : new Integer[] { 2, null }) { final CompletableFuture<Integer> f = new CompletableFuture<>(); final CompletableFuture<Integer> g = new CompletableFuture<>(); final FailingRunnable r1 = new FailingRunnable(m); final FailingRunnable r2 = new FailingRunnable(m); final FailingRunnable r3 = new FailingRunnable(m); final CompletableFuture<Integer> fst = fFirst ? f : g; final CompletableFuture<Integer> snd = !fFirst ? f : g; final Integer w1 = fFirst ? v1 : v2; final Integer w2 = !fFirst ? v1 : v2; final CompletableFuture<Void> h1 = m.runAfterBoth(f, g, r1); assertTrue(fst.complete(w1)); final CompletableFuture<Void> h2 = m.runAfterBoth(f, g, r2); assertTrue(snd.complete(w2)); final CompletableFuture<Void> h3 = m.runAfterBoth(f, g, r3); checkCompletedWithWrappedException(h1, r1.ex); checkCompletedWithWrappedException(h2, r2.ex); checkCompletedWithWrappedException(h3, r3.ex); r1.assertInvoked(); r2.assertInvoked(); r3.assertInvoked(); checkCompletedNormally(f, v1); checkCompletedNormally(g, v2); }}
/** * runAfterBoth result completes exceptionally if action does */
runAfterBoth result completes exceptionally if action does
testRunAfterBoth_actionFailed
{ "repo_name": "google/desugar_jdk_libs", "path": "jdk11/src/libcore/ojluni/src/test/java/util/concurrent/tck/CompletableFutureTest.java", "license": "gpl-2.0", "size": 182910 }
[ "java.util.concurrent.CompletableFuture" ]
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
114,284
public static <T extends Model> List<T> where(Object... paramValues) { throw new UnsupportedOperationException(NIE); }
static <T extends Model> List<T> function(Object... paramValues) { throw new UnsupportedOperationException(NIE); }
/** * Returns a list of entities matching the given key value pairs. The key value pairs are supplied as arguments like (key1, value1, key2, value2) * * @param paramValues * @return */
Returns a list of entities matching the given key value pairs. The key value pairs are supplied as arguments like (key1, value1, key2, value2)
where
{ "repo_name": "ActiveJpa/activejpa", "path": "activejpa-core/src/main/java/org/activejpa/entity/Model.java", "license": "apache-2.0", "size": 8801 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
148,822
public void stopRecording (SavedRecording current) { try { mRecorder.stop(); mEndTime = System.currentTimeMillis(); mRecorder.reset(); mRecorder.release(); mRecorder = null; current.setLength(mEndTime - mStartTime); } catch (RuntimeException e) { Log.d("RecordPage", "Runtime exception on record page when trying to stop recorder."); } }
void function (SavedRecording current) { try { mRecorder.stop(); mEndTime = System.currentTimeMillis(); mRecorder.reset(); mRecorder.release(); mRecorder = null; current.setLength(mEndTime - mStartTime); } catch (RuntimeException e) { Log.d(STR, STR); } }
/** * Stops recording and resets the media recorder. * * @param current The recording to stop. */
Stops recording and resets the media recorder
stopRecording
{ "repo_name": "NicLew/Chordinate", "path": "app/src/main/java/edu/pacificu/chordinate/chordinate/MicInput.java", "license": "mit", "size": 2996 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,164,609
protected static Object makeNewServiceObject(MessageContext msgContext) throws AxisFault { CountDownLatch startLatch = new CountDownLatch(1); CountDownLatch stopLatch = new CountDownLatch(1); EJBClientWorker worker = new EJBClientWorker(msgContext, startLatch, stopLatch); workerPool.execute(worker); startLatch.countDown(); try { stopLatch.await(); } catch (InterruptedException e) { throw AxisFault.makeFault(e); } if (worker.getException() != null) { throw AxisFault.makeFault(worker.getException()); } return worker.getReturnedValue(); } private static class EJBClientWorker implements Runnable { private MessageContext msgContext = null; private CountDownLatch startLatch = null; private CountDownLatch stopLatch = null; protected static final Class[] empty_class_array = new Class[0]; protected static final Object[] empty_object_array = new Object[0]; private static InitialContext cached_context = null; private Exception exception = null; private Object returnedValue = null; public EJBClientWorker(MessageContext msgContext, CountDownLatch startLatch, CountDownLatch stopLatch) { this.msgContext = msgContext; this.startLatch = startLatch; this.stopLatch = stopLatch; }
static Object function(MessageContext msgContext) throws AxisFault { CountDownLatch startLatch = new CountDownLatch(1); CountDownLatch stopLatch = new CountDownLatch(1); EJBClientWorker worker = new EJBClientWorker(msgContext, startLatch, stopLatch); workerPool.execute(worker); startLatch.countDown(); try { stopLatch.await(); } catch (InterruptedException e) { throw AxisFault.makeFault(e); } if (worker.getException() != null) { throw AxisFault.makeFault(worker.getException()); } return worker.getReturnedValue(); } private static class EJBClientWorker implements Runnable { private MessageContext msgContext = null; private CountDownLatch startLatch = null; private CountDownLatch stopLatch = null; protected static final Class[] empty_class_array = new Class[0]; protected static final Object[] empty_object_array = new Object[0]; private static InitialContext cached_context = null; private Exception exception = null; private Object returnedValue = null; public EJBClientWorker(MessageContext msgContext, CountDownLatch startLatch, CountDownLatch stopLatch) { this.msgContext = msgContext; this.startLatch = startLatch; this.stopLatch = stopLatch; }
/** * Return a object which implements the service. * * @param msgContext the message context * @return an object that implements the service * @throws AxisFault if fails */
Return a object which implements the service
makeNewServiceObject
{ "repo_name": "zzsoszz/axiswebservice_demo", "path": "opensource_axis2.1.6.2/org/apache/axis2/rpc/receivers/ejb/EJBUtil.java", "license": "apache-2.0", "size": 13576 }
[ "java.util.concurrent.CountDownLatch", "javax.naming.InitialContext", "org.apache.axis2.AxisFault", "org.apache.axis2.context.MessageContext" ]
import java.util.concurrent.CountDownLatch; import javax.naming.InitialContext; import org.apache.axis2.AxisFault; import org.apache.axis2.context.MessageContext;
import java.util.concurrent.*; import javax.naming.*; import org.apache.axis2.*; import org.apache.axis2.context.*;
[ "java.util", "javax.naming", "org.apache.axis2" ]
java.util; javax.naming; org.apache.axis2;
543,627
private void cleanUpObsoleteTabStatesAsync() { new AsyncTask<Void, Void, Void>() { private List<Entry> mCurrentTabs;
void function() { new AsyncTask<Void, Void, Void>() { private List<Entry> mCurrentTabs;
/** * Clears the folder of TabStates that correspond to missing tasks. */
Clears the folder of TabStates that correspond to missing tasks
cleanUpObsoleteTabStatesAsync
{ "repo_name": "axinging/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/tabmodel/document/DocumentTabModelImpl.java", "license": "bsd-3-clause", "size": 34573 }
[ "android.os.AsyncTask", "java.util.List" ]
import android.os.AsyncTask; import java.util.List;
import android.os.*; import java.util.*;
[ "android.os", "java.util" ]
android.os; java.util;
1,321,714
void expandPaths(@NotNull Element element);
void expandPaths(@NotNull Element element);
/** * Process sub tags of {@code element} recursively and convert paths to absolute forms in all tag texts and attribute values. */
Process sub tags of element recursively and convert paths to absolute forms in all tag texts and attribute values
expandPaths
{ "repo_name": "asedunov/intellij-community", "path": "platform/projectModel-impl/src/com/intellij/openapi/components/PathMacroSubstitutor.java", "license": "apache-2.0", "size": 2734 }
[ "org.jdom.Element", "org.jetbrains.annotations.NotNull" ]
import org.jdom.Element; import org.jetbrains.annotations.NotNull;
import org.jdom.*; import org.jetbrains.annotations.*;
[ "org.jdom", "org.jetbrains.annotations" ]
org.jdom; org.jetbrains.annotations;
1,010,828
void onDrawerStateChange(int oldState, int newState); } private static final String TAG = "MenuDrawer"; private static final boolean DEBUG = false; private static final String STATE_MENU_VISIBLE = "net.simonvt.menudrawer.view.menu.menuVisible"; protected static final int ANIMATION_DELAY = 1000 / 60; protected static final Interpolator ARROW_INTERPOLATOR = new AccelerateInterpolator(); private static final Interpolator PEEK_INTERPOLATOR = new PeekInterpolator(); private static final Interpolator SMOOTH_INTERPOLATOR = new SmoothInterpolator(); private static final long DEFAULT_PEEK_START_DELAY = 5000; private static final long DEFAULT_PEEK_DELAY = 10000; private static final int PEEK_DURATION = 5000; private static final int MAX_DRAG_BEZEL_DP = 24; private static final int DURATION_MAX = 600; protected static final int MAX_MENU_OVERLAY_ALPHA = 185; public static final int MENU_DRAG_CONTENT = 0; public static final int MENU_DRAG_WINDOW = 1; public static final int MENU_POSITION_LEFT = 0; public static final int MENU_POSITION_RIGHT = 1; public static final int STATE_CLOSED = 0; public static final int STATE_CLOSING = 1; public static final int STATE_DRAGGING = 2; public static final int STATE_OPENING = 4; public static final int STATE_OPEN = 8; private static final int CLOSE_ENOUGH = 3; static final boolean USE_TRANSLATIONS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; protected Drawable mMenuOverlay; private boolean mDropShadowEnabled; protected Drawable mDropShadowDrawable; protected int mDropShadowWidth; protected Bitmap mArrowBitmap; protected View mActiveView; protected int mActivePosition; protected Rect mActiveRect = new Rect(); protected BuildLayerFrameLayout mMenuContainer; protected BuildLayerFrameLayout mContentView; protected int mMenuWidth; private boolean mMenuWidthFromTheme; protected int mOffsetPixels; protected boolean mMenuVisible; private int mDragMode; private int mDrawerState = STATE_CLOSED; protected int mMaxDragBezelSize; protected int mDragBezelSize; protected boolean mIsDragging; protected final int mTouchSlop; protected float mInitialMotionX; protected float mLastMotionX = -1; protected float mLastMotionY = -1;
void onDrawerStateChange(int oldState, int newState); } private static final String TAG = STR; private static final boolean DEBUG = false; private static final String STATE_MENU_VISIBLE = STR; protected static final int ANIMATION_DELAY = 1000 / 60; protected static final Interpolator ARROW_INTERPOLATOR = new AccelerateInterpolator(); private static final Interpolator PEEK_INTERPOLATOR = new PeekInterpolator(); private static final Interpolator SMOOTH_INTERPOLATOR = new SmoothInterpolator(); private static final long DEFAULT_PEEK_START_DELAY = 5000; private static final long DEFAULT_PEEK_DELAY = 10000; private static final int PEEK_DURATION = 5000; private static final int MAX_DRAG_BEZEL_DP = 24; private static final int DURATION_MAX = 600; protected static final int MAX_MENU_OVERLAY_ALPHA = 185; public static final int MENU_DRAG_CONTENT = 0; public static final int MENU_DRAG_WINDOW = 1; public static final int MENU_POSITION_LEFT = 0; public static final int MENU_POSITION_RIGHT = 1; public static final int STATE_CLOSED = 0; public static final int STATE_CLOSING = 1; public static final int STATE_DRAGGING = 2; public static final int STATE_OPENING = 4; public static final int STATE_OPEN = 8; private static final int CLOSE_ENOUGH = 3; static final boolean USE_TRANSLATIONS = Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB; protected Drawable mMenuOverlay; private boolean mDropShadowEnabled; protected Drawable mDropShadowDrawable; protected int mDropShadowWidth; protected Bitmap mArrowBitmap; protected View mActiveView; protected int mActivePosition; protected Rect mActiveRect = new Rect(); protected BuildLayerFrameLayout mMenuContainer; protected BuildLayerFrameLayout mContentView; protected int mMenuWidth; private boolean mMenuWidthFromTheme; protected int mOffsetPixels; protected boolean mMenuVisible; private int mDragMode; private int mDrawerState = STATE_CLOSED; protected int mMaxDragBezelSize; protected int mDragBezelSize; protected boolean mIsDragging; protected final int mTouchSlop; protected float mInitialMotionX; protected float mLastMotionX = -1; protected float mLastMotionY = -1;
/** * Called when the drawer state changes. * * @param oldState The old drawer state. * @param newState The new drawer state. */
Called when the drawer state changes
onDrawerStateChange
{ "repo_name": "kevinsawicki/android-menudrawer", "path": "library/src/net/simonvt/widget/MenuDrawer.java", "license": "apache-2.0", "size": 34497 }
[ "android.graphics.Bitmap", "android.graphics.Rect", "android.graphics.drawable.Drawable", "android.os.Build", "android.view.View", "android.view.animation.AccelerateInterpolator", "android.view.animation.Interpolator" ]
import android.graphics.Bitmap; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Build; import android.view.View; import android.view.animation.AccelerateInterpolator; import android.view.animation.Interpolator;
import android.graphics.*; import android.graphics.drawable.*; import android.os.*; import android.view.*; import android.view.animation.*;
[ "android.graphics", "android.os", "android.view" ]
android.graphics; android.os; android.view;
723,015
public Partition<I, V, E, M> addVertex(PartitionOwner partitionOwner, Vertex<I, V, E, M> vertex) { Partition<I, V, E, M> partition = ownerPartitionMap.get(partitionOwner); if (partition == null) { partition = configuration.createPartition( partitionOwner.getPartitionId(), context); ownerPartitionMap.put(partitionOwner, partition); } transferRegulator.incrementCounters(partitionOwner, vertex); Vertex<I, V, E, M> oldVertex = partition.putVertex(vertex); if (oldVertex != null) { LOG.warn("addVertex: Replacing vertex " + oldVertex + " with " + vertex); } // Requirements met to transfer? if (transferRegulator.transferThisPartition(partitionOwner)) { return ownerPartitionMap.remove(partitionOwner); } return null; }
Partition<I, V, E, M> function(PartitionOwner partitionOwner, Vertex<I, V, E, M> vertex) { Partition<I, V, E, M> partition = ownerPartitionMap.get(partitionOwner); if (partition == null) { partition = configuration.createPartition( partitionOwner.getPartitionId(), context); ownerPartitionMap.put(partitionOwner, partition); } transferRegulator.incrementCounters(partitionOwner, vertex); Vertex<I, V, E, M> oldVertex = partition.putVertex(vertex); if (oldVertex != null) { LOG.warn(STR + oldVertex + STR + vertex); } if (transferRegulator.transferThisPartition(partitionOwner)) { return ownerPartitionMap.remove(partitionOwner); } return null; }
/** * Add a vertex to the cache, returning the partition if full * * @param partitionOwner Partition owner of the vertex * @param vertex Vertex to add * @return A partition to send or null, if requirements are not met */
Add a vertex to the cache, returning the partition if full
addVertex
{ "repo_name": "skymanaditya1/giraph", "path": "giraph-core/src/main/java/org/apache/giraph/comm/SendPartitionCache.java", "license": "apache-2.0", "size": 4715 }
[ "org.apache.giraph.graph.Vertex", "org.apache.giraph.partition.Partition", "org.apache.giraph.partition.PartitionOwner" ]
import org.apache.giraph.graph.Vertex; import org.apache.giraph.partition.Partition; import org.apache.giraph.partition.PartitionOwner;
import org.apache.giraph.graph.*; import org.apache.giraph.partition.*;
[ "org.apache.giraph" ]
org.apache.giraph;
2,493,307
private void compareKeySets(Set<Object> keys, SetMultimap<File, Object> fileMap) { for (File currentFile : fileMap.keySet()) { final MessageDispatcher dispatcher = getMessageDispatcher(); final String path = currentFile.getPath(); dispatcher.fireFileStarted(path); final Set<Object> currentKeys = fileMap.get(currentFile); // Clone the keys so that they are not lost final Set<Object> keysClone = Sets.newHashSet(keys); keysClone.removeAll(currentKeys); // Remaining elements in the key set are missing in the current file if (!keysClone.isEmpty()) { for (Object key : keysClone) { log(0, MSG_KEY, key); } } fireErrors(path); dispatcher.fireFileFinished(path); } }
void function(Set<Object> keys, SetMultimap<File, Object> fileMap) { for (File currentFile : fileMap.keySet()) { final MessageDispatcher dispatcher = getMessageDispatcher(); final String path = currentFile.getPath(); dispatcher.fireFileStarted(path); final Set<Object> currentKeys = fileMap.get(currentFile); final Set<Object> keysClone = Sets.newHashSet(keys); keysClone.removeAll(currentKeys); if (!keysClone.isEmpty()) { for (Object key : keysClone) { log(0, MSG_KEY, key); } } fireErrors(path); dispatcher.fireFileFinished(path); } }
/** * Compares the key sets of the given property files (arranged in a map) * with the specified key set. All missing keys are reported. * @param keys the set of keys to compare with * @param fileMap a Map from property files to their key sets */
Compares the key sets of the given property files (arranged in a map) with the specified key set. All missing keys are reported
compareKeySets
{ "repo_name": "gallandarakhneorg/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/TranslationCheck.java", "license": "lgpl-2.1", "size": 18234 }
[ "com.google.common.collect.SetMultimap", "com.google.common.collect.Sets", "com.puppycrawl.tools.checkstyle.api.MessageDispatcher", "java.io.File", "java.util.Set" ]
import com.google.common.collect.SetMultimap; import com.google.common.collect.Sets; import com.puppycrawl.tools.checkstyle.api.MessageDispatcher; import java.io.File; import java.util.Set;
import com.google.common.collect.*; import com.puppycrawl.tools.checkstyle.api.*; import java.io.*; import java.util.*;
[ "com.google.common", "com.puppycrawl.tools", "java.io", "java.util" ]
com.google.common; com.puppycrawl.tools; java.io; java.util;
2,395,571
// Example of adding multiple data items at once. list.addTerm("Colours", new WText("Red"), new WText("Green"), new WText("Blue")); // Example of adding multiple data items using multiple calls. list.addTerm("Shapes", new WText("Circle")); list.addTerm("Shapes", new WText("Square"), new WText("Triangle")); }
list.addTerm(STR, new WText("Red"), new WText("Green"), new WText("Blue")); list.addTerm(STR, new WText(STR)); list.addTerm(STR, new WText(STR), new WText(STR)); }
/** * Adds some items to a definition list. * * @param list the list to add the items to. */
Adds some items to a definition list
addListItems
{ "repo_name": "marksreeves/wcomponents", "path": "wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/WDefinitionListExample.java", "license": "gpl-3.0", "size": 1587 }
[ "com.github.bordertech.wcomponents.WText" ]
import com.github.bordertech.wcomponents.WText;
import com.github.bordertech.wcomponents.*;
[ "com.github.bordertech" ]
com.github.bordertech;
751,903
public void updateSubscription(SubscribedAPI subscribedAPI) throws APIManagementException { Connection conn = null; PreparedStatement ps = null; try { conn = APIMgtDBUtil.getConnection(); conn.setAutoCommit(false); //This query to update the AM_SUBSCRIPTION table String sqlQuery = SQLConstants.UPDATE_SUBSCRIPTION_OF_UUID_SQL; //Updating data to the AM_SUBSCRIPTION table ps = conn.prepareStatement(sqlQuery); ps.setString(1, subscribedAPI.getSubStatus()); //TODO Need to find logged in user who does this update. ps.setString(2, null); ps.setTimestamp(3, new Timestamp(System.currentTimeMillis())); ps.setString(4, subscribedAPI.getUUID()); ps.execute(); // finally commit transaction conn.commit(); } catch (SQLException e) { if (conn != null) { try { conn.rollback(); } catch (SQLException e1) { log.error("Failed to rollback the update subscription ", e1); } } handleException("Failed to update subscription data ", e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, null); } }
void function(SubscribedAPI subscribedAPI) throws APIManagementException { Connection conn = null; PreparedStatement ps = null; try { conn = APIMgtDBUtil.getConnection(); conn.setAutoCommit(false); String sqlQuery = SQLConstants.UPDATE_SUBSCRIPTION_OF_UUID_SQL; ps = conn.prepareStatement(sqlQuery); ps.setString(1, subscribedAPI.getSubStatus()); ps.setString(2, null); ps.setTimestamp(3, new Timestamp(System.currentTimeMillis())); ps.setString(4, subscribedAPI.getUUID()); ps.execute(); conn.commit(); } catch (SQLException e) { if (conn != null) { try { conn.rollback(); } catch (SQLException e1) { log.error(STR, e1); } } handleException(STR, e); } finally { APIMgtDBUtil.closeAllConnections(ps, conn, null); } }
/** * This method is used to update the subscription * * @param subscribedAPI subscribedAPI object that represents the new subscription detals * @throws APIManagementException if failed to update subscription */
This method is used to update the subscription
updateSubscription
{ "repo_name": "tharikaGitHub/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java", "license": "apache-2.0", "size": 805423 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "java.sql.Timestamp", "org.wso2.carbon.apimgt.api.APIManagementException", "org.wso2.carbon.apimgt.api.model.SubscribedAPI", "org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants", "org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Timestamp; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.SubscribedAPI; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
import java.sql.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*;
[ "java.sql", "org.wso2.carbon" ]
java.sql; org.wso2.carbon;
1,410,214
public static <T> Set<T> emptyIfNull(final Set<T> set) { return set == null ? Collections.<T>emptySet() : set; } /** * Tests two sets for equality as per the <code>equals()</code> contract * in {@link java.util.Set#equals(java.lang.Object)}. * <p> * This method is useful for implementing <code>Set</code> when you cannot * extend AbstractSet. The method takes Collection instances to enable other * collection types to use the Set implementation algorithm. * <p> * The relevant text (slightly paraphrased as this is a static method) is: * <blockquote> * <p>Two sets are considered equal if they have * the same size, and every member of the first set is contained in * the second. This ensures that the {@code equals} method works * properly across different implementations of the {@code Set}
static <T> Set<T> function(final Set<T> set) { return set == null ? Collections.<T>emptySet() : set; } /** * Tests two sets for equality as per the <code>equals()</code> contract * in {@link java.util.Set#equals(java.lang.Object)}. * <p> * This method is useful for implementing <code>Set</code> when you cannot * extend AbstractSet. The method takes Collection instances to enable other * collection types to use the Set implementation algorithm. * <p> * The relevant text (slightly paraphrased as this is a static method) is: * <blockquote> * <p>Two sets are considered equal if they have * the same size, and every member of the first set is contained in * the second. This ensures that the {@code equals} method works * properly across different implementations of the {@code Set}
/** * Returns an immutable empty set if the argument is <code>null</code>, * or the argument itself otherwise. * * @param <T> the element type * @param set the set, possibly <code>null</code> * @return an empty set if the argument is <code>null</code> */
Returns an immutable empty set if the argument is <code>null</code>, or the argument itself otherwise
emptyIfNull
{ "repo_name": "gonmarques/commons-collections", "path": "src/main/java/org/apache/commons/collections4/SetUtils.java", "license": "apache-2.0", "size": 12877 }
[ "java.util.Collection", "java.util.Collections", "java.util.Set" ]
import java.util.Collection; import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
67,508
void loadAll(Set<? extends K> keys, boolean replaceExistingValues, Function<Iterable<? extends K>, Map<K, V>> function);
void loadAll(Set<? extends K> keys, boolean replaceExistingValues, Function<Iterable<? extends K>, Map<K, V>> function);
/** * Invokes the cache loader for the given keys, optionally replacing the cache mappings with the loaded values. * * @param keys the keys to laod value for * @param replaceExistingValues whether to update cache mappings * @param function the function performing the loading */
Invokes the cache loader for the given keys, optionally replacing the cache mappings with the loaded values
loadAll
{ "repo_name": "akomakom/ehcache3", "path": "core/src/main/java/org/ehcache/core/Jsr107Cache.java", "license": "apache-2.0", "size": 3656 }
[ "java.util.Map", "java.util.Set", "org.ehcache.core.spi.function.Function" ]
import java.util.Map; import java.util.Set; import org.ehcache.core.spi.function.Function;
import java.util.*; import org.ehcache.core.spi.function.*;
[ "java.util", "org.ehcache.core" ]
java.util; org.ehcache.core;
907,240
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<DataLakeAnalyticsAccountBasicInner> list( String filter, Integer top, Integer skip, String select, String orderby, Boolean count, Context context);
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<DataLakeAnalyticsAccountBasicInner> list( String filter, Integer top, Integer skip, String select, String orderby, Boolean count, Context context);
/** * Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a * link to the next page, if any. * * @param filter OData filter. Optional. * @param top The number of items to return. Optional. * @param skip The number of items to skip over before returning elements. Optional. * @param select OData Select statement. Limits the properties on each entry to just those requested, e.g. * Categories?$select=CategoryName,Description. Optional. * @param orderby OrderBy clause. One or more comma-separated expressions with an optional "asc" (the default) or * "desc" depending on the order you'd like the values sorted, e.g. Categories?$orderby=CategoryName desc. * Optional. * @param count The Boolean value of true or false to request a count of the matching resources included with the * resources in the response, e.g. Categories?$count=true. Optional. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the first page of Data Lake Analytics accounts, if any, within the current subscription. */
Gets the first page of Data Lake Analytics accounts, if any, within the current subscription. This includes a link to the next page, if any
list
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/datalakeanalytics/azure-resourcemanager-datalakeanalytics/src/main/java/com/azure/resourcemanager/datalakeanalytics/fluent/AccountsClient.java", "license": "mit", "size": 22533 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context", "com.azure.resourcemanager.datalakeanalytics.fluent.models.DataLakeAnalyticsAccountBasicInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.datalakeanalytics.fluent.models.DataLakeAnalyticsAccountBasicInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.datalakeanalytics.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,327,067
public Element getInitElement() { return initElement; }
Element function() { return initElement; }
/** * DOCUMENT ME! * * @return the initElement */
DOCUMENT ME
getInitElement
{ "repo_name": "cismet/cismap-commons", "path": "src/main/java/de/cismet/cismap/commons/featureservice/AbstractFeatureService.java", "license": "lgpl-3.0", "size": 82123 }
[ "org.jdom.Element" ]
import org.jdom.Element;
import org.jdom.*;
[ "org.jdom" ]
org.jdom;
1,557,285
private void saveFile(final File file, final Logger logger) { try { // Updating the base events object with the new events set. baseEventsObject.setEvents(eventTable.getOnmsEvents()); // Normalize the Event Content (required to avoid marshaling problems) // TODO Are other normalizations required ? for (org.opennms.netmgt.xml.eventconf.Event event : baseEventsObject.getEvents()) { logger.debug("Normalizing event " + event.getUei()); final AlarmData ad = event.getAlarmData(); if (ad != null && (ad.getReductionKey() == null || ad.getReductionKey().trim().isEmpty() || ad.getAlarmType() == null || ad.getAlarmType() == 0)) { event.setAlarmData(null); } final Mask m = event.getMask(); if (m != null && m.getMaskelements().isEmpty()) { event.setMask(null); } } // Save the XML of the new events saveEvents(baseEventsObject, file, logger); // Add a reference to the new file into eventconf.xml if there are events String fileName = file.getAbsolutePath().replaceFirst(".*\\" + File.separatorChar + "events\\" + File.separatorChar + "(.*)", "events" + File.separatorChar + "$1"); final Events rootEvents = eventConfDao.getRootEvents(); final File rootFile = ConfigFileConstants.getFile(ConfigFileConstants.EVENT_CONF_FILE_NAME); if (baseEventsObject.getEvents().size() > 0) { if (!rootEvents.getEventFiles().contains(fileName)) { logger.info("Adding a reference to " + fileName + " inside eventconf.xml."); rootEvents.getEventFiles().add(0, fileName); saveEvents(rootEvents, rootFile, logger); } } else { // If a reference to an empty events file exist, it should be removed. if (rootEvents.getEventFiles().contains(fileName)) { logger.info("Removing a reference to " + fileName + " inside eventconf.xml because there are no events."); rootEvents.getEventFiles().remove(fileName); saveEvents(rootEvents, rootFile, logger); } } EventBuilder eb = new EventBuilder(EventConstants.EVENTSCONFIG_CHANGED_EVENT_UEI, "WebUI"); eventProxy.send(eb.getEvent()); logger.info("The event's configuration reload operation is being performed."); success(); } catch (Exception e) { logger.error(e.getClass() + ": " + (e.getMessage() == null ? "[No Details]" : e.getMessage())); if (e.getMessage() == null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); logger.error(sw.toString()); } failure(e.getMessage()); } }
void function(final File file, final Logger logger) { try { baseEventsObject.setEvents(eventTable.getOnmsEvents()); for (org.opennms.netmgt.xml.eventconf.Event event : baseEventsObject.getEvents()) { logger.debug(STR + event.getUei()); final AlarmData ad = event.getAlarmData(); if (ad != null && (ad.getReductionKey() == null ad.getReductionKey().trim().isEmpty() ad.getAlarmType() == null ad.getAlarmType() == 0)) { event.setAlarmData(null); } final Mask m = event.getMask(); if (m != null && m.getMaskelements().isEmpty()) { event.setMask(null); } } saveEvents(baseEventsObject, file, logger); String fileName = file.getAbsolutePath().replaceFirst(".*\\" + File.separatorChar + STR + File.separatorChar + "(.*)", STR + File.separatorChar + "$1"); final Events rootEvents = eventConfDao.getRootEvents(); final File rootFile = ConfigFileConstants.getFile(ConfigFileConstants.EVENT_CONF_FILE_NAME); if (baseEventsObject.getEvents().size() > 0) { if (!rootEvents.getEventFiles().contains(fileName)) { logger.info(STR + fileName + STR); rootEvents.getEventFiles().add(0, fileName); saveEvents(rootEvents, rootFile, logger); } } else { if (rootEvents.getEventFiles().contains(fileName)) { logger.info(STR + fileName + STR); rootEvents.getEventFiles().remove(fileName); saveEvents(rootEvents, rootFile, logger); } } EventBuilder eb = new EventBuilder(EventConstants.EVENTSCONFIG_CHANGED_EVENT_UEI, "WebUI"); eventProxy.send(eb.getEvent()); logger.info(STR); success(); } catch (Exception e) { logger.error(e.getClass() + STR + (e.getMessage() == null ? STR : e.getMessage())); if (e.getMessage() == null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); e.printStackTrace(pw); logger.error(sw.toString()); } failure(e.getMessage()); } }
/** * Save file. * * @param file the file * @param logger the logger */
Save file
saveFile
{ "repo_name": "jeffgdotorg/opennms", "path": "features/vaadin-snmp-events-and-metrics/src/main/java/org/opennms/features/vaadin/events/EventPanel.java", "license": "gpl-2.0", "size": 14513 }
[ "java.io.File", "java.io.PrintWriter", "java.io.StringWriter", "org.opennms.core.utils.ConfigFileConstants", "org.opennms.features.vaadin.api.Logger", "org.opennms.netmgt.events.api.EventConstants", "org.opennms.netmgt.model.events.EventBuilder", "org.opennms.netmgt.xml.eventconf.AlarmData", "org.opennms.netmgt.xml.eventconf.Events", "org.opennms.netmgt.xml.eventconf.Mask" ]
import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; import org.opennms.core.utils.ConfigFileConstants; import org.opennms.features.vaadin.api.Logger; import org.opennms.netmgt.events.api.EventConstants; import org.opennms.netmgt.model.events.EventBuilder; import org.opennms.netmgt.xml.eventconf.AlarmData; import org.opennms.netmgt.xml.eventconf.Events; import org.opennms.netmgt.xml.eventconf.Mask;
import java.io.*; import org.opennms.core.utils.*; import org.opennms.features.vaadin.api.*; import org.opennms.netmgt.events.api.*; import org.opennms.netmgt.model.events.*; import org.opennms.netmgt.xml.eventconf.*;
[ "java.io", "org.opennms.core", "org.opennms.features", "org.opennms.netmgt" ]
java.io; org.opennms.core; org.opennms.features; org.opennms.netmgt;
1,441,787
private File figureBaseDir() throws IOException { File homeDir = ApplicationUtils.instance().getHomeDirectory().getPath().toFile(); File baseDir = new File(homeDir, FILE_STORAGE_SUBDIRECTORY); if (!baseDir.exists()) { boolean created = baseDir.mkdir(); if (!created) { throw new IOException("Unable to create uploads directory at '" + baseDir + "'"); } } return baseDir; }
File function() throws IOException { File homeDir = ApplicationUtils.instance().getHomeDirectory().getPath().toFile(); File baseDir = new File(homeDir, FILE_STORAGE_SUBDIRECTORY); if (!baseDir.exists()) { boolean created = baseDir.mkdir(); if (!created) { throw new IOException(STR + baseDir + "'"); } } return baseDir; }
/** * Get the configuration property for the file storage base directory, and * check that it points to an existing, writeable directory. */
Get the configuration property for the file storage base directory, and check that it points to an existing, writeable directory
figureBaseDir
{ "repo_name": "vivo-project/Vitro", "path": "api/src/main/java/edu/cornell/mannlib/vitro/webapp/filestorage/impl/FileStorageImplWrapper.java", "license": "bsd-3-clause", "size": 3475 }
[ "edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils", "java.io.File", "java.io.IOException" ]
import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils; import java.io.File; import java.io.IOException;
import edu.cornell.mannlib.vitro.webapp.application.*; import java.io.*;
[ "edu.cornell.mannlib", "java.io" ]
edu.cornell.mannlib; java.io;
1,988,710
manager.applicationTypes().delete("resRg", "myCluster", "myAppType", Context.NONE); }
manager.applicationTypes().delete("resRg", STR, STR, Context.NONE); }
/** * Sample code: Delete an application type. * * @param manager Entry point to ServiceFabricManager. */
Sample code: Delete an application type
deleteAnApplicationType
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/servicefabric/azure-resourcemanager-servicefabric/src/samples/java/com/azure/resourcemanager/servicefabric/ApplicationTypesDeleteSamples.java", "license": "mit", "size": 827 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
413,675
private void closeListener(GridMessageListener lsnr) { if (lsnr instanceof GridUserMessageListener) { GridUserMessageListener userLsnr = (GridUserMessageListener)lsnr; if (userLsnr.predLsnr instanceof PlatformMessageFilter) ((PlatformMessageFilter)userLsnr.predLsnr).onClose(); } }
void function(GridMessageListener lsnr) { if (lsnr instanceof GridUserMessageListener) { GridUserMessageListener userLsnr = (GridUserMessageListener)lsnr; if (userLsnr.predLsnr instanceof PlatformMessageFilter) ((PlatformMessageFilter)userLsnr.predLsnr).onClose(); } }
/** * Closes a listener, if applicable. * * @param lsnr Listener. */
Closes a listener, if applicable
closeListener
{ "repo_name": "pperalta/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/communication/GridIoManager.java", "license": "apache-2.0", "size": 84542 }
[ "org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter" ]
import org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter;
import org.apache.ignite.internal.processors.platform.message.*;
[ "org.apache.ignite" ]
org.apache.ignite;
333,027
public RoleAssignmentPropertiesWithScope properties() { return this.properties; }
RoleAssignmentPropertiesWithScope function() { return this.properties; }
/** * Get role assignment properties. * * @return the properties value */
Get role assignment properties
properties
{ "repo_name": "navalev/azure-sdk-for-java", "path": "sdk/authorization/mgmt-v2015_07_01/src/main/java/com/microsoft/azure/management/authorization/v2015_07_01/implementation/RoleAssignmentInner.java", "license": "mit", "size": 2096 }
[ "com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignmentPropertiesWithScope" ]
import com.microsoft.azure.management.authorization.v2015_07_01.RoleAssignmentPropertiesWithScope;
import com.microsoft.azure.management.authorization.v2015_07_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
954,663
public static synchronized Pseudonym generatePseudonym(Gender gender) { if (nameGenerator == null) { nameGenerator = new NameGenerator("languages.txt", "semantics.txt"); rnd = new Random(); } String g = null; switch (gender) { case MALE: g = "Männlich"; break; case FEMALE: g = "Weiblich"; break; case RANDOM: g = rnd.nextBoolean() ? "Männlich" : "Weiblich"; break; } return new Pseudonym(nameGenerator.getRandomName("US-Zensus", g + " Top 500+", 1)[0]); }
static synchronized Pseudonym function(Gender gender) { if (nameGenerator == null) { nameGenerator = new NameGenerator(STR, STR); rnd = new Random(); } String g = null; switch (gender) { case MALE: g = STR; break; case FEMALE: g = STR; break; case RANDOM: g = rnd.nextBoolean() ? STR : STR; break; } return new Pseudonym(nameGenerator.getRandomName(STR, g + STR, 1)[0]); }
/** * Generates a pseudonym. * * @param gender * gender of the pseudonym * @return pseudonym */
Generates a pseudonym
generatePseudonym
{ "repo_name": "pezi/treedb-cmdb", "path": "src/main/java/at/treedb/at/treedb/backup/Pseudonym.java", "license": "lgpl-2.1", "size": 2682 }
[ "de.beimax.janag.NameGenerator", "java.util.Random" ]
import de.beimax.janag.NameGenerator; import java.util.Random;
import de.beimax.janag.*; import java.util.*;
[ "de.beimax.janag", "java.util" ]
de.beimax.janag; java.util;
92,535
protected Font getFont() { return JFaceResources.getFontRegistry().get(getDialogFontName()); }
Font function() { return JFaceResources.getFontRegistry().get(getDialogFontName()); }
/** * Returns the default font to use for this dialog page. * * @return the font */
Returns the default font to use for this dialog page
getFont
{ "repo_name": "AntoineDelacroix/NewSuperProject-", "path": "org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogPage.java", "license": "gpl-2.0", "size": 13208 }
[ "org.eclipse.jface.resource.JFaceResources", "org.eclipse.swt.graphics.Font" ]
import org.eclipse.jface.resource.JFaceResources; import org.eclipse.swt.graphics.Font;
import org.eclipse.jface.resource.*; import org.eclipse.swt.graphics.*;
[ "org.eclipse.jface", "org.eclipse.swt" ]
org.eclipse.jface; org.eclipse.swt;
1,444,996
default InputStream getRendered(OrchidPage page, RenderMode renderMode) { return getService(RenderService.class).getRendered(page, renderMode); }
default InputStream getRendered(OrchidPage page, RenderMode renderMode) { return getService(RenderService.class).getRendered(page, renderMode); }
/** * Dynamically use a RenderMode enum to determine which rendering operation to perform. * * @param page the page to render * @param renderMode the mode to render this page in * @return InputStream the stream used to create side-effects by the render operation * @since v1.0.0 */
Dynamically use a RenderMode enum to determine which rendering operation to perform
getRendered
{ "repo_name": "JavaEden/OrchidCore", "path": "OrchidCore/src/main/java/com/eden/orchid/api/render/RenderService.java", "license": "mit", "size": 8379 }
[ "com.eden.orchid.api.theme.pages.OrchidPage", "java.io.InputStream" ]
import com.eden.orchid.api.theme.pages.OrchidPage; import java.io.InputStream;
import com.eden.orchid.api.theme.pages.*; import java.io.*;
[ "com.eden.orchid", "java.io" ]
com.eden.orchid; java.io;
1,380,703
private boolean isLocked(DavResource res) { ActiveLock lock = res.getLock(Type.WRITE, Scope.EXCLUSIVE); if (lock == null) { return false; } else { for (String sLockToken : session.getLockTokens()) { if (sLockToken.equals(lock.getToken())) { return false; } } return true; } }
boolean function(DavResource res) { ActiveLock lock = res.getLock(Type.WRITE, Scope.EXCLUSIVE); if (lock == null) { return false; } else { for (String sLockToken : session.getLockTokens()) { if (sLockToken.equals(lock.getToken())) { return false; } } return true; } }
/** * Return true if this resource cannot be modified due to a write lock * that is not owned by the given session. * * @return true if this resource cannot be modified due to a write lock */
Return true if this resource cannot be modified due to a write lock that is not owned by the given session
isLocked
{ "repo_name": "Kast0rTr0y/jackrabbit", "path": "jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/webdav/simple/DavResourceImpl.java", "license": "apache-2.0", "size": 42435 }
[ "org.apache.jackrabbit.webdav.DavResource", "org.apache.jackrabbit.webdav.lock.ActiveLock", "org.apache.jackrabbit.webdav.lock.Scope", "org.apache.jackrabbit.webdav.lock.Type" ]
import org.apache.jackrabbit.webdav.DavResource; import org.apache.jackrabbit.webdav.lock.ActiveLock; import org.apache.jackrabbit.webdav.lock.Scope; import org.apache.jackrabbit.webdav.lock.Type;
import org.apache.jackrabbit.webdav.*; import org.apache.jackrabbit.webdav.lock.*;
[ "org.apache.jackrabbit" ]
org.apache.jackrabbit;
233,648
@Test public void testFilterAndLimitD() { List<File> results = new TestFileFinder(dirsAndFilesFilter, 5).find(javaDir); assertEquals("[D] Result Size", 1 + dirs.length + ioFiles.length, results.size()); assertTrue("[D] Start Dir", results.contains(javaDir)); checkContainsFiles("[D] Dir", dirs, results); checkContainsFiles("[D] File", ioFiles, results); }
void function() { List<File> results = new TestFileFinder(dirsAndFilesFilter, 5).find(javaDir); assertEquals(STR, 1 + dirs.length + ioFiles.length, results.size()); assertTrue(STR, results.contains(javaDir)); checkContainsFiles(STR, dirs, results); checkContainsFiles(STR, ioFiles, results); }
/** * Test Filtering and limit to depth 5 */
Test Filtering and limit to depth 5
testFilterAndLimitD
{ "repo_name": "Gasol/commons-io2", "path": "src/test/java/org/apache/commons/io/DirectoryWalkerTestCase.java", "license": "apache-2.0", "size": 21989 }
[ "java.io.File", "java.util.List", "org.junit.Assert" ]
import java.io.File; import java.util.List; import org.junit.Assert;
import java.io.*; import java.util.*; import org.junit.*;
[ "java.io", "java.util", "org.junit" ]
java.io; java.util; org.junit;
314,717
public void eraseChars(int len, boolean all) throws IOException;
void function(int len, boolean all) throws IOException;
/** * Erases characters starting at the current cursor position * * @param len the number of characters * @param all <code>true</code> to erase protected text; <code>false</code> * otherwise. */
Erases characters starting at the current cursor position
eraseChars
{ "repo_name": "appnativa/rare", "path": "source/tenletd/com/appnativa/rare/terminal/iDisplay.java", "license": "gpl-3.0", "size": 15301 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,282,666
public String toStringAtomic() { StringBuffer buf = new StringBuffer(); for (Iterator iter = condHandProb.keySet().iterator(); iter.hasNext();) { Long lhand = (Long) iter.next(); long hand = lhand.longValue(); double prob = ((Double) condHandProb.get(lhand)).doubleValue(); if (buf.length() > 1) buf.append(" "); buf.append(Deck.cardMaskString(hand, "")); int percent = (int) Math.round(10000 * Math.abs(prob)); buf.append(":" + percent); } return buf.toString(); }
String function() { StringBuffer buf = new StringBuffer(); for (Iterator iter = condHandProb.keySet().iterator(); iter.hasNext();) { Long lhand = (Long) iter.next(); long hand = lhand.longValue(); double prob = ((Double) condHandProb.get(lhand)).doubleValue(); if (buf.length() > 1) buf.append(" "); buf.append(Deck.cardMaskString(hand, STR:" + percent); } return buf.toString(); }
/** Generate a string representation of self that gives probability details for all atomic hands, conditioned on the dead cards. */
Generate a string representation of self that gives probability
toStringAtomic
{ "repo_name": "v2k/poker-eval", "path": "java/org/pokersource/enumerate/BeliefVector.java", "license": "gpl-3.0", "size": 12136 }
[ "java.util.Iterator", "org.pokersource.game.Deck" ]
import java.util.Iterator; import org.pokersource.game.Deck;
import java.util.*; import org.pokersource.game.*;
[ "java.util", "org.pokersource.game" ]
java.util; org.pokersource.game;
495,117
private void onGdbExpressionReady(GdbEvent event, XEvaluationCallback callback) { if (event instanceof GdbErrorEvent) { callback.errorOccurred(((GdbErrorEvent) event).message); return; } if (!(event instanceof GdbVariableObjects)) { callback.errorOccurred("Unexpected data received from GDB"); m_log.warn("Unexpected event " + event + " received from expression request"); return; } GdbVariableObjects variableObjects = (GdbVariableObjects) event; if (variableObjects.objects.isEmpty()) { callback.errorOccurred("Failed to evaluate expression"); return; } GdbVariableObject variableObject = variableObjects.objects.get(0); if (variableObject.value == null) { callback.errorOccurred("Failed to evaluate expression"); return; } callback.evaluated(new GdbValue(m_gdb, variableObject)); }
void function(GdbEvent event, XEvaluationCallback callback) { if (event instanceof GdbErrorEvent) { callback.errorOccurred(((GdbErrorEvent) event).message); return; } if (!(event instanceof GdbVariableObjects)) { callback.errorOccurred(STR); m_log.warn(STR + event + STR); return; } GdbVariableObjects variableObjects = (GdbVariableObjects) event; if (variableObjects.objects.isEmpty()) { callback.errorOccurred(STR); return; } GdbVariableObject variableObject = variableObjects.objects.get(0); if (variableObject.value == null) { callback.errorOccurred(STR); return; } callback.evaluated(new GdbValue(m_gdb, variableObject)); }
/** * Callback function for when GDB has responded to our expression evaluation request. * @param event The event. * @param callback The callback passed to evaluate(). */
Callback function for when GDB has responded to our expression evaluation request
onGdbExpressionReady
{ "repo_name": "consulo/consulo-gdb", "path": "src/main/java/uk/co/cwspencer/ideagdb/debug/GdbEvaluator.java", "license": "apache-2.0", "size": 2957 }
[ "uk.co.cwspencer.gdb.messages.GdbErrorEvent", "uk.co.cwspencer.gdb.messages.GdbEvent", "uk.co.cwspencer.gdb.messages.GdbVariableObject", "uk.co.cwspencer.gdb.messages.GdbVariableObjects" ]
import uk.co.cwspencer.gdb.messages.GdbErrorEvent; import uk.co.cwspencer.gdb.messages.GdbEvent; import uk.co.cwspencer.gdb.messages.GdbVariableObject; import uk.co.cwspencer.gdb.messages.GdbVariableObjects;
import uk.co.cwspencer.gdb.messages.*;
[ "uk.co.cwspencer" ]
uk.co.cwspencer;
2,592,342
public String fetchWeatherForecast(String city, Integer userId, String language, String units) { String cityFound; String responseToUser; try { String completURL = BASEURL + FORECASTPATH + "?" + getCityQuery(city) + FORECASTPARAMS.replace("@language@", language).replace("@units@", units) + APIIDEND; CloseableHttpClient client = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build(); HttpGet request = new HttpGet(completURL); CloseableHttpResponse response = client.execute(request); HttpEntity ht = response.getEntity(); BufferedHttpEntity buf = new BufferedHttpEntity(ht); String responseString = EntityUtils.toString(buf, "UTF-8"); JSONObject jsonObject = new JSONObject(responseString); log.warning(jsonObject.toString()); if (jsonObject.getInt("cod") == 200) { cityFound = jsonObject.getJSONObject("city").getString("name") + " (" + jsonObject.getJSONObject("city").getString("country") + ")"; saveRecentWeather(userId, cityFound, jsonObject.getJSONObject("city").getInt("id")); responseToUser = String.format(LocalisationService.getInstance().getString("weatherForcast", language), cityFound, convertListOfForecastToString(jsonObject, language, units, true)); } else { log.warning(jsonObject.toString()); responseToUser = LocalisationService.getInstance().getString("cityNotFound", language); } } catch (Exception e) { log.error(e); responseToUser = LocalisationService.getInstance().getString("errorFetchingWeather", language); } return responseToUser; }
String function(String city, Integer userId, String language, String units) { String cityFound; String responseToUser; try { String completURL = BASEURL + FORECASTPATH + "?" + getCityQuery(city) + FORECASTPARAMS.replace(STR, language).replace(STR, units) + APIIDEND; CloseableHttpClient client = HttpClientBuilder.create().setSSLHostnameVerifier(new NoopHostnameVerifier()).build(); HttpGet request = new HttpGet(completURL); CloseableHttpResponse response = client.execute(request); HttpEntity ht = response.getEntity(); BufferedHttpEntity buf = new BufferedHttpEntity(ht); String responseString = EntityUtils.toString(buf, "UTF-8"); JSONObject jsonObject = new JSONObject(responseString); log.warning(jsonObject.toString()); if (jsonObject.getInt("cod") == 200) { cityFound = jsonObject.getJSONObject("city").getString("name") + STR + jsonObject.getJSONObject("city").getString(STR) + ")"; saveRecentWeather(userId, cityFound, jsonObject.getJSONObject("city").getInt("id")); responseToUser = String.format(LocalisationService.getInstance().getString(STR, language), cityFound, convertListOfForecastToString(jsonObject, language, units, true)); } else { log.warning(jsonObject.toString()); responseToUser = LocalisationService.getInstance().getString(STR, language); } } catch (Exception e) { log.error(e); responseToUser = LocalisationService.getInstance().getString(STR, language); } return responseToUser; }
/** * Fetch the weather of a city * * @param city City to get the weather * @return userHash to be send to use * @note Forecast for the following 3 days */
Fetch the weather of a city
fetchWeatherForecast
{ "repo_name": "yashim/TelegramBots", "path": "src/main/java/org/telegram/services/WeatherService.java", "license": "gpl-3.0", "size": 18229 }
[ "org.apache.http.HttpEntity", "org.apache.http.client.methods.CloseableHttpResponse", "org.apache.http.client.methods.HttpGet", "org.apache.http.conn.ssl.NoopHostnameVerifier", "org.apache.http.entity.BufferedHttpEntity", "org.apache.http.impl.client.CloseableHttpClient", "org.apache.http.impl.client.HttpClientBuilder", "org.apache.http.util.EntityUtils", "org.json.JSONObject" ]
import org.apache.http.HttpEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.entity.BufferedHttpEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; import org.json.JSONObject;
import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.conn.ssl.*; import org.apache.http.entity.*; import org.apache.http.impl.client.*; import org.apache.http.util.*; import org.json.*;
[ "org.apache.http", "org.json" ]
org.apache.http; org.json;
365,691
@Nonnull public java.util.concurrent.CompletableFuture<AuthenticationMethodConfiguration> patchAsync(@Nonnull final AuthenticationMethodConfiguration sourceAuthenticationMethodConfiguration) { return sendAsync(HttpMethod.PATCH, sourceAuthenticationMethodConfiguration); }
java.util.concurrent.CompletableFuture<AuthenticationMethodConfiguration> function(@Nonnull final AuthenticationMethodConfiguration sourceAuthenticationMethodConfiguration) { return sendAsync(HttpMethod.PATCH, sourceAuthenticationMethodConfiguration); }
/** * Patches this AuthenticationMethodConfiguration with a source * * @param sourceAuthenticationMethodConfiguration the source object with updates * @return a future with the result */
Patches this AuthenticationMethodConfiguration with a source
patchAsync
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/AuthenticationMethodConfigurationRequest.java", "license": "mit", "size": 7627 }
[ "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.AuthenticationMethodConfiguration", "javax.annotation.Nonnull" ]
import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.AuthenticationMethodConfiguration; import javax.annotation.Nonnull;
import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*;
[ "com.microsoft.graph", "javax.annotation" ]
com.microsoft.graph; javax.annotation;
2,803,050
public static ArgParser createArgParser(PyObject[] args, String[] kws) { StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); // Up 2 levels in the current stack to give us the calling function StackTraceElement element = stackTrace[2]; String methodName = element.getMethodName(); String className = element.getClassName(); Class<?> clz; try { clz = Class.forName(className); } catch (ClassNotFoundException e) { LOG.log(Level.SEVERE, "Got exception: ", e); return null; } Method m; try { m = clz.getMethod(methodName, PyObject[].class, String[].class); } catch (SecurityException e) { LOG.log(Level.SEVERE, "Got exception: ", e); return null; } catch (NoSuchMethodException e) { LOG.log(Level.SEVERE, "Got exception: ", e); return null; } MonkeyRunnerExported annotation = m.getAnnotation(MonkeyRunnerExported.class); return new ArgParser(methodName, args, kws, annotation.args()); }
static ArgParser function(PyObject[] args, String[] kws) { StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); StackTraceElement element = stackTrace[2]; String methodName = element.getMethodName(); String className = element.getClassName(); Class<?> clz; try { clz = Class.forName(className); } catch (ClassNotFoundException e) { LOG.log(Level.SEVERE, STR, e); return null; } Method m; try { m = clz.getMethod(methodName, PyObject[].class, String[].class); } catch (SecurityException e) { LOG.log(Level.SEVERE, STR, e); return null; } catch (NoSuchMethodException e) { LOG.log(Level.SEVERE, STR, e); return null; } MonkeyRunnerExported annotation = m.getAnnotation(MonkeyRunnerExported.class); return new ArgParser(methodName, args, kws, annotation.args()); }
/** * Utility method to be called from Jython bindings to give proper handling of keyword and * positional arguments. * * @param args the PyObject arguments from the binding * @param kws the keyword arguments from the binding * @return an ArgParser for this binding, or null on error */
Utility method to be called from Jython bindings to give proper handling of keyword and positional arguments
createArgParser
{ "repo_name": "rex-xxx/mt6572_x201", "path": "sdk/monkeyrunner/src/com/android/monkeyrunner/JythonUtils.java", "license": "gpl-2.0", "size": 18595 }
[ "com.android.monkeyrunner.doc.MonkeyRunnerExported", "java.lang.reflect.Method", "java.util.logging.Level", "org.python.core.ArgParser", "org.python.core.PyObject" ]
import com.android.monkeyrunner.doc.MonkeyRunnerExported; import java.lang.reflect.Method; import java.util.logging.Level; import org.python.core.ArgParser; import org.python.core.PyObject;
import com.android.monkeyrunner.doc.*; import java.lang.reflect.*; import java.util.logging.*; import org.python.core.*;
[ "com.android.monkeyrunner", "java.lang", "java.util", "org.python.core" ]
com.android.monkeyrunner; java.lang; java.util; org.python.core;
1,196,694
void dispatch(List<? extends Serializable> messages, String bulkNumber, String wrv, String workerUuid);
void dispatch(List<? extends Serializable> messages, String bulkNumber, String wrv, String workerUuid);
/** * * Dispatch messges to the queue from the consumer * * @param messages the messages to dispatch * @param bulkNumber an identifier of the dispatch bulk, needed for recovery * @param wrv the worker recovery version, needed for recovery * @param workerUuid the id of the dispatching worker */
Dispatch messges to the queue from the consumer
dispatch
{ "repo_name": "orius123/slite", "path": "engine/orchestrator/score-orchestrator-api/src/main/java/org/openscore/orchestrator/services/OrchestratorDispatcherService.java", "license": "apache-2.0", "size": 1180 }
[ "java.io.Serializable", "java.util.List" ]
import java.io.Serializable; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,694,200
@Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__INPUT_CONNECTOR); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__OUTPUT_CONNECTOR); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__CONFIGURATION); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__INPUT_SCHEMA); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__OUTPUT_SCHEMA); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__XSLT_STYLE_SHEET); } return childrenFeatures; }
Collection<? extends EStructuralFeature> function(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__INPUT_CONNECTOR); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__OUTPUT_CONNECTOR); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__CONFIGURATION); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__INPUT_SCHEMA); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__OUTPUT_SCHEMA); childrenFeatures.add(EsbPackage.Literals.DATA_MAPPER_MEDIATOR__XSLT_STYLE_SHEET); } return childrenFeatures; }
/** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */
This specifies how to implement <code>#getChildren</code> and is used to deduce an appropriate feature for an <code>org.eclipse.emf.edit.command.AddCommand</code>, <code>org.eclipse.emf.edit.command.RemoveCommand</code> or <code>org.eclipse.emf.edit.command.MoveCommand</code> in <code>#createCommand</code>.
getChildrenFeatures
{ "repo_name": "prabushi/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/DataMapperMediatorItemProvider.java", "license": "apache-2.0", "size": 18469 }
[ "java.util.Collection", "org.eclipse.emf.ecore.EStructuralFeature", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import java.util.Collection; import org.eclipse.emf.ecore.EStructuralFeature; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import java.util.*; import org.eclipse.emf.ecore.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "java.util", "org.eclipse.emf", "org.wso2.developerstudio" ]
java.util; org.eclipse.emf; org.wso2.developerstudio;
1,673,905
private List<Long> getValidIdList(String ids) throws ControllerException { LOGGER.info("Get valid list of id : " + ids); List<Long> idsList = new ArrayList<>(); String[] idsTab = ids.split(","); for (String id : idsTab) { if (id != null && id.matches(RequestParameters.SEARCH_REGEX)) { idsList.add(Long.parseLong(id)); } } if (idsList.isEmpty()) { String message = "Sorry, the selection is not valid."; LOGGER.error(message); throw new ControllerException(message); } return idsList; }
List<Long> function(String ids) throws ControllerException { LOGGER.info(STR + ids); List<Long> idsList = new ArrayList<>(); String[] idsTab = ids.split(","); for (String id : idsTab) { if (id != null && id.matches(RequestParameters.SEARCH_REGEX)) { idsList.add(Long.parseLong(id)); } } if (idsList.isEmpty()) { String message = STR; LOGGER.error(message); throw new ControllerException(message); } return idsList; }
/** * Returns a valid list of identifiers. * * @param ids list of identifiers to check * @return list of identifiers * @throws ControllerException if the selection is not validate */
Returns a valid list of identifiers
getValidIdList
{ "repo_name": "gpuget/training-java", "path": "computer-database/webapp/src/main/java/com/excilys/cdb/controller/DashboardController.java", "license": "apache-2.0", "size": 6636 }
[ "com.excilys.cdb.controller.dto.RequestParameters", "com.excilys.cdb.exception.ControllerException", "java.util.ArrayList", "java.util.List" ]
import com.excilys.cdb.controller.dto.RequestParameters; import com.excilys.cdb.exception.ControllerException; import java.util.ArrayList; import java.util.List;
import com.excilys.cdb.controller.dto.*; import com.excilys.cdb.exception.*; import java.util.*;
[ "com.excilys.cdb", "java.util" ]
com.excilys.cdb; java.util;
1,636,435
public void handleContentOutlineSelection(ISelection selection) { if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { // Get the first selected element. // Object selectedElement = selectedElements.next(); // If it's the selection viewer, then we want it to select the same selection as this selection. // if (currentViewerPane.getViewer() == selectionViewer) { ArrayList<Object> selectionList = new ArrayList<Object>(); selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } // Set the selection to the widget. // selectionViewer.setSelection(new StructuredSelection(selectionList)); } else { // Set the input to the widget. // if (currentViewerPane.getViewer().getInput() != selectedElement) { currentViewerPane.getViewer().setInput(selectedElement); currentViewerPane.setTitle(selectedElement); } } } } }
void function(ISelection selection) { if (currentViewerPane != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { Iterator<?> selectedElements = ((IStructuredSelection)selection).iterator(); if (selectedElements.hasNext()) { Object selectedElement = selectedElements.next(); if (currentViewerPane.getViewer() == selectionViewer) { ArrayList<Object> selectionList = new ArrayList<Object>(); selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } selectionViewer.setSelection(new StructuredSelection(selectionList)); } else { if (currentViewerPane.getViewer().getInput() != selectedElement) { currentViewerPane.getViewer().setInput(selectedElement); currentViewerPane.setTitle(selectedElement); } } } } }
/** * This deals with how we want selection in the outliner to affect the other views. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This deals with how we want selection in the outliner to affect the other views.
handleContentOutlineSelection
{ "repo_name": "albertfdp/petrinet", "path": "src/dk.dtu.se2.geometry.editor/src/geometry/presentation/GeometryEditor.java", "license": "mit", "size": 55760 }
[ "java.util.ArrayList", "java.util.Iterator", "org.eclipse.jface.viewers.ISelection", "org.eclipse.jface.viewers.IStructuredSelection", "org.eclipse.jface.viewers.StructuredSelection" ]
import java.util.ArrayList; import java.util.Iterator; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection;
import java.util.*; import org.eclipse.jface.viewers.*;
[ "java.util", "org.eclipse.jface" ]
java.util; org.eclipse.jface;
1,608,376
public static void registerOperation(String name, OpGeneric op, Multimap<String, OpGeneric> opmap) { opmap.put(name, op); }
static void function(String name, OpGeneric op, Multimap<String, OpGeneric> opmap) { opmap.put(name, op); }
/** * Puts an operation into the given MultiMap under the given name * @param name The name under which the operation is referred to * @param op The operation to register * @param opmap The multi map holding the operations */
Puts an operation into the given MultiMap under the given name
registerOperation
{ "repo_name": "anonymous100001/maxuse", "path": "src/main/org/tzi/use/uml/ocl/expr/operations/OpGeneric.java", "license": "gpl-2.0", "size": 4260 }
[ "com.google.common.collect.Multimap" ]
import com.google.common.collect.Multimap;
import com.google.common.collect.*;
[ "com.google.common" ]
com.google.common;
1,509,044
protected final List<SyntheticChildAsPropertyResource> deserializeToSyntheticChildResources(JSONObject jsonObject) throws JSONException { final List<SyntheticChildAsPropertyResource> resources = new ArrayList<SyntheticChildAsPropertyResource>(); final Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { final String nodeName = keys.next(); JSONObject entryJSON = jsonObject.optJSONObject(nodeName); if (entryJSON == null) { continue; } final ValueMap properties = new ValueMapDecorator(new HashMap<String, Object>()); final Iterator<String> propertyNames = entryJSON.keys(); while (propertyNames.hasNext()) { final String propName = propertyNames.next(); properties.put(propName, entryJSON.optString(propName)); } resources.add(new SyntheticChildAsPropertyResource(this.getParent(), nodeName, properties)); } return resources; } private static final class ResourceNameComparator implements Comparator<Resource>, Serializable { private static final long serialVersionUID = 0L;
final List<SyntheticChildAsPropertyResource> function(JSONObject jsonObject) throws JSONException { final List<SyntheticChildAsPropertyResource> resources = new ArrayList<SyntheticChildAsPropertyResource>(); final Iterator<String> keys = jsonObject.keys(); while (keys.hasNext()) { final String nodeName = keys.next(); JSONObject entryJSON = jsonObject.optJSONObject(nodeName); if (entryJSON == null) { continue; } final ValueMap properties = new ValueMapDecorator(new HashMap<String, Object>()); final Iterator<String> propertyNames = entryJSON.keys(); while (propertyNames.hasNext()) { final String propName = propertyNames.next(); properties.put(propName, entryJSON.optString(propName)); } resources.add(new SyntheticChildAsPropertyResource(this.getParent(), nodeName, properties)); } return resources; } private static final class ResourceNameComparator implements Comparator<Resource>, Serializable { private static final long serialVersionUID = 0L;
/** * Converts a JSONObject to the list of SyntheticChildAsPropertyResources. * * @param jsonObject the JSONObject to deserialize. * @return the list of SyntheticChildAsPropertyResources the jsonObject represents. * @throws JSONException */
Converts a JSONObject to the list of SyntheticChildAsPropertyResources
deserializeToSyntheticChildResources
{ "repo_name": "badvision/acs-aem-commons", "path": "bundle/src/main/java/com/adobe/acs/commons/synth/children/ChildrenAsPropertyResource.java", "license": "apache-2.0", "size": 13379 }
[ "java.io.Serializable", "java.util.ArrayList", "java.util.Comparator", "java.util.HashMap", "java.util.Iterator", "java.util.List", "org.apache.sling.api.resource.Resource", "org.apache.sling.api.resource.ValueMap", "org.apache.sling.api.wrappers.ValueMapDecorator", "org.apache.sling.commons.json.JSONException", "org.apache.sling.commons.json.JSONObject" ]
import java.io.Serializable; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.List; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ValueMap; import org.apache.sling.api.wrappers.ValueMapDecorator; import org.apache.sling.commons.json.JSONException; import org.apache.sling.commons.json.JSONObject;
import java.io.*; import java.util.*; import org.apache.sling.api.resource.*; import org.apache.sling.api.wrappers.*; import org.apache.sling.commons.json.*;
[ "java.io", "java.util", "org.apache.sling" ]
java.io; java.util; org.apache.sling;
1,038,609
COSArray newQuadPoints = new COSArray(); newQuadPoints.setFloatArray(quadPoints); getDictionary().setItem("QuadPoints", newQuadPoints); }
COSArray newQuadPoints = new COSArray(); newQuadPoints.setFloatArray(quadPoints); getDictionary().setItem(STR, newQuadPoints); }
/** * This will set the set of quadpoints which encompass the areas of this annotation. * * @param quadPoints an array representing the set of area covered */
This will set the set of quadpoints which encompass the areas of this annotation
setQuadPoints
{ "repo_name": "sencko/NALB", "path": "nalb2013/src/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.java", "license": "gpl-2.0", "size": 3690 }
[ "org.apache.pdfbox.cos.COSArray" ]
import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
13,926
public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FormatForm formatForm = (FormatForm) form; KualiInteger processId = formatForm.getFormatProcessSummary().getProcessId(); if (processId != null) { formatService.clearUnfinishedFormat(processId.intValue()); } return mapping.findForward(KRADConstants.MAPPING_PORTAL); }
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { FormatForm formatForm = (FormatForm) form; KualiInteger processId = formatForm.getFormatProcessSummary().getProcessId(); if (processId != null) { formatService.clearUnfinishedFormat(processId.intValue()); } return mapping.findForward(KRADConstants.MAPPING_PORTAL); }
/** * This method cancels the format process * * @param mapping * @param form * @param request * @param response * @return * @throws Exception */
This method cancels the format process
cancel
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/pdp/web/struts/FormatAction.java", "license": "apache-2.0", "size": 11277 }
[ "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.kuali.rice.core.api.util.type.KualiInteger", "org.kuali.rice.krad.util.KRADConstants" ]
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.kuali.rice.core.api.util.type.KualiInteger; import org.kuali.rice.krad.util.KRADConstants;
import javax.servlet.http.*; import org.apache.struts.action.*; import org.kuali.rice.core.api.util.type.*; import org.kuali.rice.krad.util.*;
[ "javax.servlet", "org.apache.struts", "org.kuali.rice" ]
javax.servlet; org.apache.struts; org.kuali.rice;
311,795
public static double[] extractDoubles(final Scan scan) { final List<Peaks> peaksList = scan.getPeaks(); checkArgument(peaksList != null && peaksList.size() > 0, "Scan doesn't appear to contain peaks."); final Peaks peaks = peaksList.get(0); return extractDoubles(peaks.getValue(), peaks.getPrecision().equals(BigInteger.valueOf(64))); }
static double[] function(final Scan scan) { final List<Peaks> peaksList = scan.getPeaks(); checkArgument(peaksList != null && peaksList.size() > 0, STR); final Peaks peaks = peaksList.get(0); return extractDoubles(peaks.getValue(), peaks.getPrecision().equals(BigInteger.valueOf(64))); }
/** * Contract: Scan must contain at least one peak list with a specified precision or 32 or 64. * * @param scan * @return */
Contract: Scan must contain at least one peak list with a specified precision or 32 or 64
extractDoubles
{ "repo_name": "jmchilton/TINT", "path": "projects/TropixProteomicsCore/src/main/edu/umn/msi/tropix/proteomics/conversion/impl/ConversionUtils.java", "license": "epl-1.0", "size": 10944 }
[ "com.google.common.base.Preconditions", "java.math.BigInteger", "java.util.List", "net.sourceforge.sashimi.mzxml.v3_0.Scan" ]
import com.google.common.base.Preconditions; import java.math.BigInteger; import java.util.List; import net.sourceforge.sashimi.mzxml.v3_0.Scan;
import com.google.common.base.*; import java.math.*; import java.util.*; import net.sourceforge.sashimi.mzxml.v3_0.*;
[ "com.google.common", "java.math", "java.util", "net.sourceforge.sashimi" ]
com.google.common; java.math; java.util; net.sourceforge.sashimi;
1,798,623
@Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); }
List<ReactPackage> function() { return Arrays.<ReactPackage>asList( new MainReactPackage() ); }
/** * A list of packages used by the app. If the app uses additional views * or modules besides the default ones, add more packages here. */
A list of packages used by the app. If the app uses additional views or modules besides the default ones, add more packages here
getPackages
{ "repo_name": "mitrais-cdc-mobile/react-pocs", "path": "ios_MediaSocialSignIn/android/app/src/main/java/com/ios_mediasocialsignin/MainActivity.java", "license": "gpl-3.0", "size": 1056 }
[ "com.facebook.react.ReactPackage", "com.facebook.react.shell.MainReactPackage", "java.util.Arrays", "java.util.List" ]
import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import java.util.Arrays; import java.util.List;
import com.facebook.react.*; import com.facebook.react.shell.*; import java.util.*;
[ "com.facebook.react", "java.util" ]
com.facebook.react; java.util;
1,659,103
if (null == label) throw Element.Exceptions.labelCanNotBeNull(); if (label.isEmpty()) throw Element.Exceptions.labelCanNotBeEmpty(); if (Graph.Hidden.isHidden(label)) throw Element.Exceptions.labelCanNotBeAHiddenKey(label); }
if (null == label) throw Element.Exceptions.labelCanNotBeNull(); if (label.isEmpty()) throw Element.Exceptions.labelCanNotBeEmpty(); if (Graph.Hidden.isHidden(label)) throw Element.Exceptions.labelCanNotBeAHiddenKey(label); }
/** * Determine whether the {@link Element} label can be legally set. This is typically used as a pre-condition check. * * @param label the element label * @throws IllegalArgumentException whether the label is legal and if not, a clear reason exception is provided */
Determine whether the <code>Element</code> label can be legally set. This is typically used as a pre-condition check
validateLabel
{ "repo_name": "newkek/incubator-tinkerpop", "path": "gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/ElementHelper.java", "license": "apache-2.0", "size": 26054 }
[ "org.apache.tinkerpop.gremlin.structure.Element", "org.apache.tinkerpop.gremlin.structure.Graph" ]
import org.apache.tinkerpop.gremlin.structure.Element; import org.apache.tinkerpop.gremlin.structure.Graph;
import org.apache.tinkerpop.gremlin.structure.*;
[ "org.apache.tinkerpop" ]
org.apache.tinkerpop;
939,483
public final static IMessage createMessage(final Enum<? extends IMessageProtocol> protocol, final IMessageContent content) { return new Message(protocol, content, null, 0l); }
final static IMessage function(final Enum<? extends IMessageProtocol> protocol, final IMessageContent content) { return new Message(protocol, content, null, 0l); }
/** * Creates a new message. * <hr> * @param protocol Message protocol. * @param content Message content. * @return Newly created message. */
Creates a new message.
createMessage
{ "repo_name": "ressec/athena", "path": "athena-base/src/main/java/com/heliosphere/athena/base/message/Message.java", "license": "apache-2.0", "size": 4319 }
[ "com.heliosphere.athena.base.message.internal.IMessage", "com.heliosphere.athena.base.message.internal.IMessageContent", "com.heliosphere.athena.base.message.internal.protocol.IMessageProtocol" ]
import com.heliosphere.athena.base.message.internal.IMessage; import com.heliosphere.athena.base.message.internal.IMessageContent; import com.heliosphere.athena.base.message.internal.protocol.IMessageProtocol;
import com.heliosphere.athena.base.message.internal.*; import com.heliosphere.athena.base.message.internal.protocol.*;
[ "com.heliosphere.athena" ]
com.heliosphere.athena;
836,478
public void addDeviceInformation(OspfRouter ospfRouter) { controller.addDeviceDetails(ospfRouter); }
void function(OspfRouter ospfRouter) { controller.addDeviceDetails(ospfRouter); }
/** * Adds device information. * * @param ospfRouter OSPF router instance */
Adds device information
addDeviceInformation
{ "repo_name": "Phaneendra-Huawei/demo", "path": "protocols/ospf/ctl/src/main/java/org/onosproject/ospf/controller/impl/OspfInterfaceChannelHandler.java", "license": "apache-2.0", "size": 64749 }
[ "org.onosproject.ospf.controller.OspfRouter" ]
import org.onosproject.ospf.controller.OspfRouter;
import org.onosproject.ospf.controller.*;
[ "org.onosproject.ospf" ]
org.onosproject.ospf;
1,589,800
public static OneResponse diskSnapshotDelete(Client client, int id, int diskId, int snapId) { return client.call(DISKSNAPSHOTDELETE, id, diskId, snapId); }
static OneResponse function(Client client, int id, int diskId, int snapId) { return client.call(DISKSNAPSHOTDELETE, id, diskId, snapId); }
/** * Deletes a disk snapshot * * @param client XML-RPC Client. * @param id The VM id of the target VM. * @param diskId Id of the disk * @param snapId Id of the snapshot * @return If an error occurs the error message contains the reason. */
Deletes a disk snapshot
diskSnapshotDelete
{ "repo_name": "fasrc/one", "path": "src/oca/java/src/org/opennebula/client/vm/VirtualMachine.java", "license": "apache-2.0", "size": 42810 }
[ "org.opennebula.client.Client", "org.opennebula.client.OneResponse" ]
import org.opennebula.client.Client; import org.opennebula.client.OneResponse;
import org.opennebula.client.*;
[ "org.opennebula.client" ]
org.opennebula.client;
2,359,437
private static void setImageViewScaleTypeMatrix(ImageView imageView) { if (null != imageView && !(imageView instanceof IPhotoView)) { if (!ScaleType.MATRIX.equals(imageView.getScaleType())) { imageView.setScaleType(ScaleType.MATRIX); } } } private WeakReference<ImageView> mImageView; // Gesture Detectors private GestureDetector mGestureDetector; private uk.co.senab.photoview.gestures.GestureDetector mScaleDragDetector; // These are set so we don't keep allocating them on the heap private final Matrix mBaseMatrix = new Matrix(); private final Matrix mDrawMatrix = new Matrix(); private final Matrix mSuppMatrix = new Matrix(); private final RectF mDisplayRect = new RectF(); private final float[] mMatrixValues = new float[9]; // Listeners private OnMatrixChangedListener mMatrixChangeListener; private OnPhotoTapListener mPhotoTapListener; private OnViewTapListener mViewTapListener; private OnLongClickListener mLongClickListener; private int mIvTop, mIvRight, mIvBottom, mIvLeft; private FlingRunnable mCurrentFlingRunnable; private int mScrollEdge = EDGE_BOTH; private boolean mZoomEnabled; private ScaleType mScaleType = ScaleType.FIT_CENTER; public PhotoViewAttacher(ImageView imageView) { mImageView = new WeakReference<ImageView>(imageView); imageView.setDrawingCacheEnabled(true); imageView.setOnTouchListener(this); ViewTreeObserver observer = imageView.getViewTreeObserver(); if (null != observer) observer.addOnGlobalLayoutListener(this); // Make sure we using MATRIX Scale Type setImageViewScaleTypeMatrix(imageView); if (imageView.isInEditMode()) { return; } // Create Gesture Detectors... mScaleDragDetector = VersionedGestureDetector.newInstance( imageView.getContext(), this); mGestureDetector = new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() {
static void function(ImageView imageView) { if (null != imageView && !(imageView instanceof IPhotoView)) { if (!ScaleType.MATRIX.equals(imageView.getScaleType())) { imageView.setScaleType(ScaleType.MATRIX); } } } WeakReference<ImageView> mImageView; private GestureDetector mGestureDetector; private uk.co.senab.photoview.gestures.GestureDetector mScaleDragDetector; private final Matrix mBaseMatrix = new Matrix(); private final Matrix mDrawMatrix = new Matrix(); private final Matrix mSuppMatrix = new Matrix(); private final RectF mDisplayRect = new RectF(); private final float[] mMatrixValues = new float[9]; private OnMatrixChangedListener mMatrixChangeListener; private OnPhotoTapListener mPhotoTapListener; private OnViewTapListener mViewTapListener; private OnLongClickListener mLongClickListener; private int mIvTop, mIvRight, mIvBottom, mIvLeft; private FlingRunnable mCurrentFlingRunnable; private int mScrollEdge = EDGE_BOTH; private boolean mZoomEnabled; private ScaleType mScaleType = ScaleType.FIT_CENTER; public PhotoViewAttacher(ImageView imageView) { mImageView = new WeakReference<ImageView>(imageView); imageView.setDrawingCacheEnabled(true); imageView.setOnTouchListener(this); ViewTreeObserver observer = imageView.getViewTreeObserver(); if (null != observer) observer.addOnGlobalLayoutListener(this); function(imageView); if (imageView.isInEditMode()) { return; } mScaleDragDetector = VersionedGestureDetector.newInstance( imageView.getContext(), this); mGestureDetector = new GestureDetector(imageView.getContext(), new GestureDetector.SimpleOnGestureListener() {
/** * Set's the ImageView's ScaleType to Matrix. */
Set's the ImageView's ScaleType to Matrix
setImageViewScaleTypeMatrix
{ "repo_name": "akash-akya/XKCD-WebComics-APP", "path": "library/src/main/java/uk/co/senab/photoview/PhotoViewAttacher.java", "license": "lgpl-3.0", "size": 35549 }
[ "android.graphics.Matrix", "android.graphics.RectF", "android.view.GestureDetector", "android.view.View", "android.view.ViewTreeObserver", "android.widget.ImageView", "java.lang.ref.WeakReference", "uk.co.senab.photoview.gestures.VersionedGestureDetector" ]
import android.graphics.Matrix; import android.graphics.RectF; import android.view.GestureDetector; import android.view.View; import android.view.ViewTreeObserver; import android.widget.ImageView; import java.lang.ref.WeakReference; import uk.co.senab.photoview.gestures.VersionedGestureDetector;
import android.graphics.*; import android.view.*; import android.widget.*; import java.lang.ref.*; import uk.co.senab.photoview.gestures.*;
[ "android.graphics", "android.view", "android.widget", "java.lang", "uk.co.senab" ]
android.graphics; android.view; android.widget; java.lang; uk.co.senab;
2,281,234
@Test public void testCloning() throws CloneNotSupportedException { DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = (DialPointer) i1.clone(); assertNotSame(i1, i2); assertSame(i1.getClass(), i2.getClass()); assertEquals(i1, i2); // check that the listener lists are independent MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); i1.addChangeListener(l1); assertTrue(i1.hasListener(l1)); assertFalse(i2.hasListener(l1)); }
void function() throws CloneNotSupportedException { DialPointer i1 = new DialPointer.Pin(1); DialPointer i2 = (DialPointer) i1.clone(); assertNotSame(i1, i2); assertSame(i1.getClass(), i2.getClass()); assertEquals(i1, i2); MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); i1.addChangeListener(l1); assertTrue(i1.hasListener(l1)); assertFalse(i2.hasListener(l1)); }
/** * Confirm that cloning works. */
Confirm that cloning works
testCloning
{ "repo_name": "akardapolov/ASH-Viewer", "path": "jfreechart-fse/src/test/java/org/jfree/chart/plot/dial/DialPointerTest.java", "license": "gpl-3.0", "size": 6422 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,540,525
protected void testConnectionOnStartup() throws FailedToCreateConsumerException { try { LOG.debug("Testing JMS Connection on startup for destination: {}", getDestinationName()); Connection con = listenerContainer.getConnectionFactory().createConnection(); JmsUtils.closeConnection(con); LOG.debug("Successfully tested JMS Connection on startup for destination: {}", getDestinationName()); } catch (Exception e) { String msg = "Cannot get JMS Connection on startup for destination " + getDestinationName(); throw new FailedToCreateConsumerException(getEndpoint(), msg, e); } }
void function() throws FailedToCreateConsumerException { try { LOG.debug(STR, getDestinationName()); Connection con = listenerContainer.getConnectionFactory().createConnection(); JmsUtils.closeConnection(con); LOG.debug(STR, getDestinationName()); } catch (Exception e) { String msg = STR + getDestinationName(); throw new FailedToCreateConsumerException(getEndpoint(), msg, e); } }
/** * Pre tests the connection before starting the listening. * <p/> * In case of connection failure the exception is thrown which prevents Camel from starting. * * @throws FailedToCreateConsumerException is thrown if testing the connection failed */
Pre tests the connection before starting the listening. In case of connection failure the exception is thrown which prevents Camel from starting
testConnectionOnStartup
{ "repo_name": "DariusX/camel", "path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConsumer.java", "license": "apache-2.0", "size": 11872 }
[ "javax.jms.Connection", "org.apache.camel.FailedToCreateConsumerException", "org.springframework.jms.support.JmsUtils" ]
import javax.jms.Connection; import org.apache.camel.FailedToCreateConsumerException; import org.springframework.jms.support.JmsUtils;
import javax.jms.*; import org.apache.camel.*; import org.springframework.jms.support.*;
[ "javax.jms", "org.apache.camel", "org.springframework.jms" ]
javax.jms; org.apache.camel; org.springframework.jms;
1,461,984
@JsonAnyGetter public Map<String, Object> additionalProperties() { return this.additionalProperties; }
Map<String, Object> function() { return this.additionalProperties; }
/** * Get the additionalProperties property: Represents an Azure Active Directory object. The directoryObject type is * the base type for many other directory entity types. * * @return the additionalProperties value. */
Get the additionalProperties property: Represents an Azure Active Directory object. The directoryObject type is the base type for many other directory entity types
additionalProperties
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/models/MicrosoftGraphStsPolicy.java", "license": "mit", "size": 6507 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
326,298
public boolean setFieldValue(String field, String value) { JTextField textField = formMap.get(field); if (textField == null) { return false; } textField.setText(value); return true; }
boolean function(String field, String value) { JTextField textField = formMap.get(field); if (textField == null) { return false; } textField.setText(value); return true; }
/** Sets the form entry value for a form field. If the specified value is null or empty, the effect is to delete the current value of the form field. @param field the field whose text field entry will be set @param value the value to set the text field entry to @return true if the field was valid */
Sets the form entry value for a form field. If the specified value is
setFieldValue
{ "repo_name": "jwbenham/jfmi", "path": "src/jfmi/gui/FormBox.java", "license": "mit", "size": 2883 }
[ "javax.swing.JTextField" ]
import javax.swing.JTextField;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,032,444
public void testNamingConvention5Single() { String testFilename = "anything_part02.ext"; ShowStructure ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); testFilename = "anything_pt02.ext"; ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); testFilename = "anything_part_02.ext"; ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); testFilename = "anything_pt_02.ext"; ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); }
void function() { String testFilename = STR; ShowStructure ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); testFilename = STR; ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); testFilename = STR; ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); testFilename = STR; ss = new ShowStructure(testFilename); assertEquals(1, ss.getEpisodes().size()); assertEquals(1, ss.getEpisodes().get(0).getSeason()); assertEquals(2, ss.getEpisodes().get(0).getEpisode()); }
/** * Names like pt## / part## with information about a single episode */
Names like pt## / part## with information about a single episode
testNamingConvention5Single
{ "repo_name": "riezkykenzie/Mizuu", "path": "app/src/androidTest/java/com/miz/test/TvShowFilenameTests.java", "license": "apache-2.0", "size": 42615 }
[ "com.miz.identification.ShowStructure" ]
import com.miz.identification.ShowStructure;
import com.miz.identification.*;
[ "com.miz.identification" ]
com.miz.identification;
1,378,431
void doReps(ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, float[][] arrays, int nbatches) throws Exception { int ncycles = arrays.length; for (int i = 0; i < nbatches; i++) { sbuf.reset(); oout.reset(); for (int j = 0; j < ncycles; j++) { oout.writeObject(arrays[j]); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readObject(); } } }
void doReps(ObjectOutputStream oout, ObjectInputStream oin, StreamBuffer sbuf, float[][] arrays, int nbatches) throws Exception { int ncycles = arrays.length; for (int i = 0; i < nbatches; i++) { sbuf.reset(); oout.reset(); for (int j = 0; j < ncycles; j++) { oout.writeObject(arrays[j]); } oout.flush(); for (int j = 0; j < ncycles; j++) { oin.readObject(); } } }
/** * Run benchmark for given number of batches, with given number of cycles * for each batch. */
Run benchmark for given number of batches, with given number of cycles for each batch
doReps
{ "repo_name": "rokn/Count_Words_2015", "path": "testing/openjdk2/jdk/test/java/rmi/reliability/benchmark/bench/serial/FloatArrays.java", "license": "mit", "size": 2995 }
[ "java.io.ObjectInputStream", "java.io.ObjectOutputStream" ]
import java.io.ObjectInputStream; import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,746,016
public synchronized void setDragging(boolean isDragging) { this.isDragging = isDragging; } } private class ListCellDragListener implements IGestureEventListener{ private MTListCellContainer theListCellContainer; private boolean canDrag; public ListCellDragListener(MTListCellContainer cont){ this.theListCellContainer = cont; this.canDrag = false; }
synchronized void function(boolean isDragging) { this.isDragging = isDragging; } } private class ListCellDragListener implements IGestureEventListener{ private MTListCellContainer theListCellContainer; private boolean canDrag; public ListCellDragListener(MTListCellContainer cont){ this.theListCellContainer = cont; this.canDrag = false; }
/** * Restrict dragging to only 1 listcell at a time. * @param isDragging */
Restrict dragging to only 1 listcell at a time
setDragging
{ "repo_name": "nppotdar/touchtable-menu", "path": "src/org/mt4j/components/visibleComponents/widgets/MTList.java", "license": "gpl-2.0", "size": 17561 }
[ "org.mt4j.input.inputProcessors.IGestureEventListener" ]
import org.mt4j.input.inputProcessors.IGestureEventListener;
import org.mt4j.input.*;
[ "org.mt4j.input" ]
org.mt4j.input;
1,692,836
public List<GetLogCollectionResponse> getLogCollection(String serviceUrl, String datasetId, Boolean forMosaicService) throws Exception { HttpRequestBase method = methodMaker.getLogCollectionMethod(serviceUrl, datasetId, forMosaicService); //Make our request, parse it into a DOM document InputStream responseStream = httpServiceCaller.getMethodResponseAsStream(method); Document responseDoc = DOMUtil.buildDomFromStream(responseStream); //Get our dataset nodes XPathExpression expr = DOMUtil.compileXPathExpr("LogCollection/Log"); NodeList nodeList = (NodeList) expr.evaluate(responseDoc, XPathConstants.NODESET); //Parse our response objects List<GetLogCollectionResponse> responseObjs = new ArrayList<GetLogCollectionResponse>(); XPathExpression exprLogId = DOMUtil.compileXPathExpr("LogID"); XPathExpression exprLogName = null; //both logName and LogName get returned according to the value of forMosaicService if (forMosaicService != null && forMosaicService.booleanValue()) { exprLogName = DOMUtil.compileXPathExpr("LogName"); } else { exprLogName = DOMUtil.compileXPathExpr("logName"); } XPathExpression exprispublic = DOMUtil.compileXPathExpr("ispublic"); XPathExpression exprSampleCount = DOMUtil.compileXPathExpr("SampleCount"); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); String logId = (String) exprLogId.evaluate(node, XPathConstants.STRING); String logName = (String) exprLogName.evaluate(node, XPathConstants.STRING); String sampleCountString = (String) exprSampleCount.evaluate(node, XPathConstants.STRING); String ispub = (String) exprispublic.evaluate(node, XPathConstants.STRING); int sampleCount = 0; if (sampleCountString != null && !sampleCountString.isEmpty()) { sampleCount = Integer.parseInt(sampleCountString); } if(ispub==null || ispub.isEmpty() || ispub.equals("true")) { responseObjs.add(new GetLogCollectionResponse(logId, logName, sampleCount)); } } return responseObjs; }
List<GetLogCollectionResponse> function(String serviceUrl, String datasetId, Boolean forMosaicService) throws Exception { HttpRequestBase method = methodMaker.getLogCollectionMethod(serviceUrl, datasetId, forMosaicService); InputStream responseStream = httpServiceCaller.getMethodResponseAsStream(method); Document responseDoc = DOMUtil.buildDomFromStream(responseStream); XPathExpression expr = DOMUtil.compileXPathExpr(STR); NodeList nodeList = (NodeList) expr.evaluate(responseDoc, XPathConstants.NODESET); List<GetLogCollectionResponse> responseObjs = new ArrayList<GetLogCollectionResponse>(); XPathExpression exprLogId = DOMUtil.compileXPathExpr("LogID"); XPathExpression exprLogName = null; if (forMosaicService != null && forMosaicService.booleanValue()) { exprLogName = DOMUtil.compileXPathExpr(STR); } else { exprLogName = DOMUtil.compileXPathExpr(STR); } XPathExpression exprispublic = DOMUtil.compileXPathExpr(STR); XPathExpression exprSampleCount = DOMUtil.compileXPathExpr(STR); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); String logId = (String) exprLogId.evaluate(node, XPathConstants.STRING); String logName = (String) exprLogName.evaluate(node, XPathConstants.STRING); String sampleCountString = (String) exprSampleCount.evaluate(node, XPathConstants.STRING); String ispub = (String) exprispublic.evaluate(node, XPathConstants.STRING); int sampleCount = 0; if (sampleCountString != null && !sampleCountString.isEmpty()) { sampleCount = Integer.parseInt(sampleCountString); } if(ispub==null ispub.isEmpty() ispub.equals("true")) { responseObjs.add(new GetLogCollectionResponse(logId, logName, sampleCount)); } } return responseObjs; }
/** * Makes and parses a getLogCollection request to a NVCLDataService * * @param serviceUrl * The NVCLDataService url * @param datasetId * The unique dataset ID to query * @param forMosaicService * [Optional] indicates if the getLogCollection service should generate a result specifically for the use of a Mosaic Service * @throws Exception */
Makes and parses a getLogCollection request to a NVCLDataService
getLogCollection
{ "repo_name": "yan073/AuScope-Portal", "path": "src/main/java/org/auscope/portal/server/web/service/NVCLDataService.java", "license": "lgpl-3.0", "size": 17584 }
[ "java.io.InputStream", "java.util.ArrayList", "java.util.List", "javax.xml.xpath.XPathConstants", "javax.xml.xpath.XPathExpression", "org.apache.http.client.methods.HttpRequestBase", "org.auscope.portal.core.util.DOMUtil", "org.auscope.portal.server.domain.nvcldataservice.GetLogCollectionResponse", "org.w3c.dom.Document", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import java.io.InputStream; import java.util.ArrayList; import java.util.List; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import org.apache.http.client.methods.HttpRequestBase; import org.auscope.portal.core.util.DOMUtil; import org.auscope.portal.server.domain.nvcldataservice.GetLogCollectionResponse; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import java.io.*; import java.util.*; import javax.xml.xpath.*; import org.apache.http.client.methods.*; import org.auscope.portal.core.util.*; import org.auscope.portal.server.domain.nvcldataservice.*; import org.w3c.dom.*;
[ "java.io", "java.util", "javax.xml", "org.apache.http", "org.auscope.portal", "org.w3c.dom" ]
java.io; java.util; javax.xml; org.apache.http; org.auscope.portal; org.w3c.dom;
337,665
protected ResourceLocation getEntityTexture(Entity par1Entity) { return loc; }
ResourceLocation function(Entity par1Entity) { return loc; }
/** * Returns the location of an entity's texture. Doesn't seem to be called * unless you call Render.bindEntityTexture. */
Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture
getEntityTexture
{ "repo_name": "thvardhan/Youtuber-s-Lucky-Blocks", "path": "src/main/java/thvardhan/ytluckyblocks/entity/render/EntityDonutTheDogRender.java", "license": "gpl-3.0", "size": 1745 }
[ "net.minecraft.entity.Entity", "net.minecraft.util.ResourceLocation" ]
import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation;
import net.minecraft.entity.*; import net.minecraft.util.*;
[ "net.minecraft.entity", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.util;
1,074,278
public static <T> double sumDouble(Queryable<T> source, FunctionExpression<DoubleFunction1<T>> selector) { throw Extensions.todo(); }
static <T> double function(Queryable<T> source, FunctionExpression<DoubleFunction1<T>> selector) { throw Extensions.todo(); }
/** * Computes the sum of the sequence of Double values * that is obtained by invoking a projection function on each * element of the input sequence. */
Computes the sum of the sequence of Double values that is obtained by invoking a projection function on each element of the input sequence
sumDouble
{ "repo_name": "b-slim/calcite", "path": "linq4j/src/main/java/org/apache/calcite/linq4j/QueryableDefaults.java", "license": "apache-2.0", "size": 39975 }
[ "org.apache.calcite.linq4j.function.DoubleFunction1", "org.apache.calcite.linq4j.tree.FunctionExpression" ]
import org.apache.calcite.linq4j.function.DoubleFunction1; import org.apache.calcite.linq4j.tree.FunctionExpression;
import org.apache.calcite.linq4j.function.*; import org.apache.calcite.linq4j.tree.*;
[ "org.apache.calcite" ]
org.apache.calcite;
1,716,401
public void writeTableFooter(int rowCount, boolean moreRows, TableMetaData tbMetaData) { String desc = tbMetaData.getCounterDesc(rowCount); if (desc != null) { // only if set if (isSortable) { charWriter.println("<tfoot>"); } charWriter.print("<tr><td class=\"counter\" colspan=\"" + tbMetaData.getLastColumnCount() + "\">"); if (rowCount == 0) { charWriter.print(desc); } else { charWriter.print(rowCount + (moreRows ? "+ " : " ") + desc); } charWriter.println("</td></tr>"); if (isSortable) { charWriter.println("</tfoot>"); } } // desc was set } // writeTableFooter
void function(int rowCount, boolean moreRows, TableMetaData tbMetaData) { String desc = tbMetaData.getCounterDesc(rowCount); if (desc != null) { if (isSortable) { charWriter.println(STR); } charWriter.print(STRcounter\STRSTR\">"); if (rowCount == 0) { charWriter.print(desc); } else { charWriter.print(rowCount + (moreRows ? STR : " ") + desc); } charWriter.println(STR); if (isSortable) { charWriter.println(STR); } } }
/** Writes the number of selected rows, and a description of the object represented by the rows. * A "+" is added behind the number if there would have been more rows, but the * SELECT was terminated by FETCH_LIMIT. * @param rowCount number of data rows which were output * @param moreRows whether there would have been more rows in the resultset * @param tbMetaData contains the descriptive text for the counter: 1 for "row" and 0 or &gt;= 2 for "rows" */
Writes the number of selected rows, and a description of the object represented by the rows. A "+" is added behind the number if there would have been more rows, but the SELECT was terminated by FETCH_LIMIT
writeTableFooter
{ "repo_name": "gfis/dbat", "path": "src/main/java/org/teherba/dbat/format/HTMLTable.java", "license": "apache-2.0", "size": 36396 }
[ "org.teherba.dbat.TableMetaData" ]
import org.teherba.dbat.TableMetaData;
import org.teherba.dbat.*;
[ "org.teherba.dbat" ]
org.teherba.dbat;
2,334,455
EReference getinterfaceSection_InterfaceDecl();
EReference getinterfaceSection_InterfaceDecl();
/** * Returns the meta object for the containment reference list '{@link org.xtext.example.delphi.delphi.interfaceSection#getInterfaceDecl <em>Interface Decl</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Interface Decl</em>'. * @see org.xtext.example.delphi.delphi.interfaceSection#getInterfaceDecl() * @see #getinterfaceSection() * @generated */
Returns the meta object for the containment reference list '<code>org.xtext.example.delphi.delphi.interfaceSection#getInterfaceDecl Interface Decl</code>'.
getinterfaceSection_InterfaceDecl
{ "repo_name": "adolfosbh/cs2as", "path": "org.xtext.example.delphi/src-gen/org/xtext/example/delphi/delphi/DelphiPackage.java", "license": "epl-1.0", "size": 434880 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
416,102
public Hashtable newMediaObject(String blogid, String username, String password, Hashtable content) throws Exception;
Hashtable function(String blogid, String username, String password, Hashtable content) throws Exception;
/** * http://www.xmlrpc.com/metaWeblogNewMediaObject * That document does not specify how one deletes an attachment. I will assume * this is done by sending the same request but with an empty body of bytes. * @param blogid * @param username * @param password * @param content * @return * @throws Exception */
HREF That document does not specify how one deletes an attachment. I will assume this is done by sending the same request but with an empty body of bytes
newMediaObject
{ "repo_name": "thinkberg/snipsnap", "path": "src/org/snipsnap/xmlrpc/MetaWeblogAPI.java", "license": "gpl-2.0", "size": 4267 }
[ "java.util.Hashtable" ]
import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
71,807
public static boolean checkProteinIdFromEnzymaticCofactor(int cofactor_string, int protein_id, Statement stmt) throws SQLException{ boolean exists = false; ResultSet rs = stmt.executeQuery("SELECT protein_idprotein from enzymatic_cofactor WHERE protein_idprotein="+protein_id + "AND compound_idcompound="+cofactor_string); if(rs.next()) exists = true; rs.close(); return exists; }
static boolean function(int cofactor_string, int protein_id, Statement stmt) throws SQLException{ boolean exists = false; ResultSet rs = stmt.executeQuery(STR+protein_id + STR+cofactor_string); if(rs.next()) exists = true; rs.close(); return exists; }
/** * Check ProteinID from enzymatic_cofactor table for a given protein_idprotein and compound_idcompound. * @param cofactor_string * @param protein_id * @param stmt * @return boolean * @throws SQLException */
Check ProteinID from enzymatic_cofactor table for a given protein_idprotein and compound_idcompound
checkProteinIdFromEnzymaticCofactor
{ "repo_name": "merlin-sysbio/database-connector", "path": "src/main/java/pt/uminho/ceb/biosystems/merlin/database/connector/databaseAPI/ProjectAPI.java", "license": "gpl-2.0", "size": 100765 }
[ "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
395,682
void finalizeRecording(@NonNull Uri uri) { if (!mInitialized.get()) { return; } finalizeRecordingInternal(mRecordingFinalizer.getAndSet(null), uri); }
void finalizeRecording(@NonNull Uri uri) { if (!mInitialized.get()) { return; } finalizeRecordingInternal(mRecordingFinalizer.getAndSet(null), uri); }
/** * Performs final operations required to finalize this recording. * * <p>Recording finalization can only occur once. Any subsequent calls to this method or * {@link #close()} will throw an {@link AssertionError}. * * <p>Finalizing an uninitialized recording is no-op. * * @param uri The uri of the output file. */
Performs final operations required to finalize this recording. Recording finalization can only occur once. Any subsequent calls to this method or <code>#close()</code> will throw an <code>AssertionError</code>. Finalizing an uninitialized recording is no-op
finalizeRecording
{ "repo_name": "AndroidX/androidx", "path": "camera/camera-video/src/main/java/androidx/camera/video/Recorder.java", "license": "apache-2.0", "size": 133377 }
[ "android.net.Uri", "androidx.annotation.NonNull" ]
import android.net.Uri; import androidx.annotation.NonNull;
import android.net.*; import androidx.annotation.*;
[ "android.net", "androidx.annotation" ]
android.net; androidx.annotation;
472,684
StatementDMQL compileCursorSpecification() { QueryExpression queryExpression = XreadQueryExpression(); queryExpression.setAsTopLevel(); queryExpression.resolve(session); if (token.tokenType == Tokens.FOR) { read(); if (token.tokenType == Tokens.READ) { read(); readThis(Tokens.ONLY); } else { readThis(Tokens.UPDATE); if (token.tokenType == Tokens.OF) { readThis(Tokens.OF); OrderedHashSet colNames = readColumnNameList(null, false); } } } StatementDMQL cs = new StatementQuery(session, queryExpression, compileContext); return cs; }
StatementDMQL compileCursorSpecification() { QueryExpression queryExpression = XreadQueryExpression(); queryExpression.setAsTopLevel(); queryExpression.resolve(session); if (token.tokenType == Tokens.FOR) { read(); if (token.tokenType == Tokens.READ) { read(); readThis(Tokens.ONLY); } else { readThis(Tokens.UPDATE); if (token.tokenType == Tokens.OF) { readThis(Tokens.OF); OrderedHashSet colNames = readColumnNameList(null, false); } } } StatementDMQL cs = new StatementQuery(session, queryExpression, compileContext); return cs; }
/** * Retrieves a SELECT or other query expression Statement from this parse context. */
Retrieves a SELECT or other query expression Statement from this parse context
compileCursorSpecification
{ "repo_name": "anhnv-3991/VoltDB", "path": "src/hsqldb19b3/org/hsqldb_voltpatches/ParserDQL.java", "license": "agpl-3.0", "size": 139805 }
[ "org.hsqldb_voltpatches.lib.OrderedHashSet" ]
import org.hsqldb_voltpatches.lib.OrderedHashSet;
import org.hsqldb_voltpatches.lib.*;
[ "org.hsqldb_voltpatches.lib" ]
org.hsqldb_voltpatches.lib;
1,597,479
public static void checkState( boolean b, @NullableDecl String errorMessageTemplate, @NullableDecl Object p1, @NullableDecl Object p2, @NullableDecl Object p3) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2, p3)); } }
static void function( boolean b, @NullableDecl String errorMessageTemplate, @NullableDecl Object p1, @NullableDecl Object p2, @NullableDecl Object p3) { if (!b) { throw new IllegalStateException(lenientFormat(errorMessageTemplate, p1, p2, p3)); } }
/** * Ensures the truth of an expression involving the state of the calling instance, but not * involving any parameters to the calling method. * * <p>See {@link #checkState(boolean, String, Object...)} for details. * * @since 20.0 (varargs overload since 2.0) */
Ensures the truth of an expression involving the state of the calling instance, but not involving any parameters to the calling method. See <code>#checkState(boolean, String, Object...)</code> for details
checkState
{ "repo_name": "typetools/guava", "path": "android/guava/src/com/google/common/base/Preconditions.java", "license": "apache-2.0", "size": 53950 }
[ "org.checkerframework.checker.nullness.compatqual.NullableDecl" ]
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
import org.checkerframework.checker.nullness.compatqual.*;
[ "org.checkerframework.checker" ]
org.checkerframework.checker;
1,562,483
@Test public void testRecoverFailedWhenRetrieveCheckpointAllFailed() { final int ckpNum = 3; checkpointStorageHelper.setRetrieveStateFunction( (state) -> { throw new IOException( "Failed to retrieve checkpoint " + state.getCheckpointID()); }); final TestingStateHandleStore<CompletedCheckpoint> stateHandleStore = builder.setGetAllSupplier(() -> createStateHandles(ckpNum)).build(); final CompletedCheckpointStore completedCheckpointStore = createCompletedCheckpointStore(stateHandleStore); try { completedCheckpointStore.recover(); fail("We should get an exception when retrieving state failed."); } catch (Exception ex) { final String errMsg = "Could not read any of the " + ckpNum + " checkpoints from storage."; assertThat(ex, FlinkMatchers.containsMessage(errMsg)); } }
void function() { final int ckpNum = 3; checkpointStorageHelper.setRetrieveStateFunction( (state) -> { throw new IOException( STR + state.getCheckpointID()); }); final TestingStateHandleStore<CompletedCheckpoint> stateHandleStore = builder.setGetAllSupplier(() -> createStateHandles(ckpNum)).build(); final CompletedCheckpointStore completedCheckpointStore = createCompletedCheckpointStore(stateHandleStore); try { completedCheckpointStore.recover(); fail(STR); } catch (Exception ex) { final String errMsg = STR + ckpNum + STR; assertThat(ex, FlinkMatchers.containsMessage(errMsg)); } }
/** * {@link DefaultCompletedCheckpointStore#recover()} should throw exception when all the * checkpoints retrieved failed while the checkpoint pointers are not empty. */
<code>DefaultCompletedCheckpointStore#recover()</code> should throw exception when all the checkpoints retrieved failed while the checkpoint pointers are not empty
testRecoverFailedWhenRetrieveCheckpointAllFailed
{ "repo_name": "aljoscha/flink", "path": "flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/DefaultCompletedCheckpointStoreTest.java", "license": "apache-2.0", "size": 14621 }
[ "java.io.IOException", "org.apache.flink.core.testutils.FlinkMatchers", "org.apache.flink.runtime.persistence.TestingStateHandleStore", "org.junit.Assert" ]
import java.io.IOException; import org.apache.flink.core.testutils.FlinkMatchers; import org.apache.flink.runtime.persistence.TestingStateHandleStore; import org.junit.Assert;
import java.io.*; import org.apache.flink.core.testutils.*; import org.apache.flink.runtime.persistence.*; import org.junit.*;
[ "java.io", "org.apache.flink", "org.junit" ]
java.io; org.apache.flink; org.junit;
2,544,212
public SiteAssert hasSite(final String expectedSiteName) { Assertions.assertThat(siteService.hasSite(expectedSiteName)).isTrue(); return this; }
SiteAssert function(final String expectedSiteName) { Assertions.assertThat(siteService.hasSite(expectedSiteName)).isTrue(); return this; }
/** * Check if a site exists for an expected site name. * * @param expectedSiteName * @return */
Check if a site exists for an expected site name
hasSite
{ "repo_name": "ixxus/alfresco-test-assertions", "path": "src/main/java/com/ixxus/alfresco/SiteAssert.java", "license": "apache-2.0", "size": 5307 }
[ "org.assertj.core.api.Assertions" ]
import org.assertj.core.api.Assertions;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
1,888,064
public void dispose() { Shell window = getShell(); if (window != null) { if (contextMenus != null) { contextMenus.dispose(); contextMenus = null; } if (! window.isDisposed()) { window.setVisible(false); window.close(); window.dispose(); } } else { throw new RcvrUIException("No window available for recovering system resources."); } }
void function() { Shell window = getShell(); if (window != null) { if (contextMenus != null) { contextMenus.dispose(); contextMenus = null; } if (! window.isDisposed()) { window.setVisible(false); window.close(); window.dispose(); } } else { throw new RcvrUIException(STR); } }
/** * Recover any system resources being used to support this window/view. * * @author mlh */
Recover any system resources being used to support this window/view
dispose
{ "repo_name": "cogtool/cogtool", "path": "java/edu/cmu/cs/hcii/cogtool/view/View.java", "license": "lgpl-2.1", "size": 29823 }
[ "edu.cmu.cs.hcii.cogtool.util.RcvrUIException", "org.eclipse.swt.widgets.Shell" ]
import edu.cmu.cs.hcii.cogtool.util.RcvrUIException; import org.eclipse.swt.widgets.Shell;
import edu.cmu.cs.hcii.cogtool.util.*; import org.eclipse.swt.widgets.*;
[ "edu.cmu.cs", "org.eclipse.swt" ]
edu.cmu.cs; org.eclipse.swt;
706,394
int insert(FormSectionField record);
int insert(FormSectionField record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_form_section_field * * @mbggenerated Tue Sep 08 09:15:24 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_form_section_field
insert
{ "repo_name": "onlylin/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/form/dao/FormSectionFieldMapper.java", "license": "agpl-3.0", "size": 4921 }
[ "com.esofthead.mycollab.form.domain.FormSectionField" ]
import com.esofthead.mycollab.form.domain.FormSectionField;
import com.esofthead.mycollab.form.domain.*;
[ "com.esofthead.mycollab" ]
com.esofthead.mycollab;
1,686,697
LOG.debug("Creating new GcsUtil"); GcsOptions gcsOptions = options.as(GcsOptions.class); Storage.Builder storageBuilder = Transport.newStorageClient(gcsOptions); return new GcsUtil( storageBuilder.build(), storageBuilder.getHttpRequestInitializer(), gcsOptions.getExecutorService(), gcsOptions.getGcsUploadBufferSizeBytes()); }
LOG.debug(STR); GcsOptions gcsOptions = options.as(GcsOptions.class); Storage.Builder storageBuilder = Transport.newStorageClient(gcsOptions); return new GcsUtil( storageBuilder.build(), storageBuilder.getHttpRequestInitializer(), gcsOptions.getExecutorService(), gcsOptions.getGcsUploadBufferSizeBytes()); }
/** * Returns an instance of {@link GcsUtil} based on the * {@link PipelineOptions}. * * <p>If no instance has previously been created, one is created and the value * stored in {@code options}. */
Returns an instance of <code>GcsUtil</code> based on the <code>PipelineOptions</code>. If no instance has previously been created, one is created and the value stored in options
create
{ "repo_name": "axbaretto/beam", "path": "sdks/java/extensions/gcp-core/src/main/java/org/apache/beam/sdk/util/GcsUtil.java", "license": "apache-2.0", "size": 28125 }
[ "com.google.api.services.storage.Storage", "org.apache.beam.sdk.extensions.gcp.options.GcsOptions" ]
import com.google.api.services.storage.Storage; import org.apache.beam.sdk.extensions.gcp.options.GcsOptions;
import com.google.api.services.storage.*; import org.apache.beam.sdk.extensions.gcp.options.*;
[ "com.google.api", "org.apache.beam" ]
com.google.api; org.apache.beam;
1,758,328
private String getTypeArgumentImplName(ParameterizedType type, int index) { Type[] typeArgs = type.getActualTypeArguments(); if (typeArgs.length == 0) { return "Object"; } return getImplName(typeArgs[index], false); }
String function(ParameterizedType type, int index) { Type[] typeArgs = type.getActualTypeArguments(); if (typeArgs.length == 0) { return STR; } return getImplName(typeArgs[index], false); }
/** * Returns the fully-qualified type name using Java concrete implementation classes of the first type argument for a parameterized * type. If one is not specified, returns "Object". * * @param type * the parameterized type * @return the first type argument */
Returns the fully-qualified type name using Java concrete implementation classes of the first type argument for a parameterized type. If one is not specified, returns "Object"
getTypeArgumentImplName
{ "repo_name": "codenvy/che-core", "path": "platform-api/che-core-api-dto/src/main/java/org/eclipse/che/dto/generator/DtoImplServerTemplate.java", "license": "epl-1.0", "size": 32204 }
[ "java.lang.reflect.ParameterizedType", "java.lang.reflect.Type" ]
import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,327,757
private void requestSSLAttr() { try { if (sslSupport != null) { Object sslO = sslSupport.getCipherSuite(); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.CIPHER_SUITE_KEY, sslO); sslO = sslSupport.getPeerCertificateChain(false); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.CERTIFICATE_KEY, sslO); sslO = sslSupport.getKeySize(); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.KEY_SIZE_KEY, sslO); sslO = sslSupport.getSessionId(); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.SESSION_ID_KEY, sslO); } } catch (Exception e) { CoyoteLogger.HTTP_LOGGER.errorGettingSslAttributes(e); } }
void function() { try { if (sslSupport != null) { Object sslO = sslSupport.getCipherSuite(); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.CIPHER_SUITE_KEY, sslO); sslO = sslSupport.getPeerCertificateChain(false); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.CERTIFICATE_KEY, sslO); sslO = sslSupport.getKeySize(); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.KEY_SIZE_KEY, sslO); sslO = sslSupport.getSessionId(); if (sslO != null) request.setAttribute(org.apache.tomcat.util.net.Constants.SESSION_ID_KEY, sslO); } } catch (Exception e) { CoyoteLogger.HTTP_LOGGER.errorGettingSslAttributes(e); } }
/** * Get the SSL attribute */
Get the SSL attribute
requestSSLAttr
{ "repo_name": "kabir/jbw-play", "path": "src/main/java/org/apache/coyote/http11/Http11NioProcessor.java", "license": "apache-2.0", "size": 36286 }
[ "org.jboss.web.CoyoteLogger" ]
import org.jboss.web.CoyoteLogger;
import org.jboss.web.*;
[ "org.jboss.web" ]
org.jboss.web;
871,306
public void bind(Context ctx, String name, Object val,JDBCPoolMetaData meta) throws NamingException { try { initctx(meta); ctx.rebind(name, val); log.debug("binding datasource to container context with: " + name); } catch (Exception e) { Name n = ctx.getNameParser("").parse(name); while (n.size() > 1) { String ctxName = n.get(0); Context subctx = null; try { log.debug("lookup: " + ctxName); subctx = (Context) ctx.lookup(ctxName); } catch (NameNotFoundException nfe) { } if (subctx != null) { log.debug("Found subcontext: " + ctxName); ctx = subctx; } else { log.info("Creating subcontext: " + ctxName); ctx = ctx.createSubcontext(ctxName); } n = n.getSuffix(1); } log.debug("binding: " + n); ctx.rebind(n, val); } finally { this.dummyctx.rebind(name, val); log.debug("Bound name " + name + " to dummy context."); } }
void function(Context ctx, String name, Object val,JDBCPoolMetaData meta) throws NamingException { try { initctx(meta); ctx.rebind(name, val); log.debug(STR + name); } catch (Exception e) { Name n = ctx.getNameParser(STRlookup: STRFound subcontext: STRCreating subcontext: STRbinding: STRBound name STR to dummy context."); } }
/** * Bind val to name in ctx, and make sure that all intermediate contexts * exist. * * @param ctx * the root context * @param name * the name as a string * @param val * the object to be bound * @throws NamingException */
Bind val to name in ctx, and make sure that all intermediate contexts exist
bind
{ "repo_name": "WilliamRen/bbossgroups-3.5", "path": "bboss-persistent/src/com/frameworkset/common/poolman/util/JDBCPool.java", "license": "apache-2.0", "size": 67455 }
[ "javax.naming.Context", "javax.naming.Name", "javax.naming.NamingException" ]
import javax.naming.Context; import javax.naming.Name; import javax.naming.NamingException;
import javax.naming.*;
[ "javax.naming" ]
javax.naming;
807,809
// write String //----------------------------------------------------------------------- public static void write(String data, Writer output) throws IOException { if (data != null) { output.write(data); } }
static void function(String data, Writer output) throws IOException { if (data != null) { output.write(data); } }
/** * Writes chars from a <code>String</code> to a <code>Writer</code>. * * @param data the <code>String</code> to write, null ignored * @param output the <code>Writer</code> to write to * @throws NullPointerException if output is null * @throws IOException if an I/O error occurs * @since Commons IO 1.1 */
Writes chars from a <code>String</code> to a <code>Writer</code>
write
{ "repo_name": "rex-xxx/mt6572_x201", "path": "packages/apps/Email/src/org/apache/commons/io/IOUtils.java", "license": "gpl-2.0", "size": 48056 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,422,138
public void put(byte[] key, byte[] value) { synchronized (myDatabase) { myDatabase.put(new ByteArrayWrapper(key), value); } }
void function(byte[] key, byte[] value) { synchronized (myDatabase) { myDatabase.put(new ByteArrayWrapper(key), value); } }
/** * Put password in the database * * @param key the encrypted key * @param value the encrypted value */
Put password in the database
put
{ "repo_name": "consulo/consulo", "path": "modules/base/platform-impl/src/main/java/com/intellij/ide/passwordSafe/impl/providers/masterKey/PasswordDatabase.java", "license": "apache-2.0", "size": 6416 }
[ "com.intellij.ide.passwordSafe.impl.providers.ByteArrayWrapper" ]
import com.intellij.ide.passwordSafe.impl.providers.ByteArrayWrapper;
import com.intellij.ide.*;
[ "com.intellij.ide" ]
com.intellij.ide;
2,865,441
public void setVertx(@Nonnull final Vertx vertx) { }
void function(@Nonnull final Vertx vertx) { }
/** * Allows externally setting the vertx instance for collectors that need it * @param vertx fully instantiated vertx instance */
Allows externally setting the vertx instance for collectors that need it
setVertx
{ "repo_name": "statful/statful-client-vertx", "path": "src/main/java/com/statful/collector/StatfulMetrics.java", "license": "mit", "size": 2272 }
[ "io.vertx.core.Vertx", "javax.annotation.Nonnull" ]
import io.vertx.core.Vertx; import javax.annotation.Nonnull;
import io.vertx.core.*; import javax.annotation.*;
[ "io.vertx.core", "javax.annotation" ]
io.vertx.core; javax.annotation;
2,036,989
public void actionPerformed(ActionEvent e) { // Edits mediator.editUserClasses(); }
void function(ActionEvent e) { mediator.editUserClasses(); }
/** * Invoked when an action occurs. */
Invoked when an action occurs
actionPerformed
{ "repo_name": "HOMlab/QN-ACTR-Release", "path": "QN-ACTR Java/src/jmt/gui/jmodel/controller/actions/EditUserClasses.java", "license": "lgpl-3.0", "size": 1665 }
[ "java.awt.event.ActionEvent" ]
import java.awt.event.ActionEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,887,791
List<File> files = new ArrayList<File>(); if (file.isDirectory()) { files = processDirectory(file); for (File f : files) { doProcess(f); } } else { doProcess(file); } if (checkCompatible) { //processCompatible(file, jarFile, classMap); } }
List<File> files = new ArrayList<File>(); if (file.isDirectory()) { files = processDirectory(file); for (File f : files) { doProcess(f); } } else { doProcess(file); } if (checkCompatible) { } }
/** * Recursively finds class files and process * * @param file Directory full of class files or jar files (in which case all * of them are processed recursively), or a class file (in which * case that single class is processed), or a jar file (in which * case all the classes in this jar file are processed.) */
Recursively finds class files and process
process
{ "repo_name": "vongosling/dependency-mediator", "path": "dependency-mediator-core/src/main/java/com/creative/studio/component/dependency/DependencyMediator.java", "license": "apache-2.0", "size": 13330 }
[ "java.io.File", "java.util.ArrayList", "java.util.List" ]
import java.io.File; import java.util.ArrayList; import java.util.List;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,124,262
@After public void close() { try { if (this.connection != null) { this.connection.close(); } } catch (SQLException e) { e.printStackTrace(); } }
void function() { try { if (this.connection != null) { this.connection.close(); } } catch (SQLException e) { e.printStackTrace(); } }
/** * Close connection. */
Close connection
close
{ "repo_name": "degauhta/dgagarsky", "path": "chapter_008/src/test/java/ru/job4j/FiltersTest.java", "license": "apache-2.0", "size": 3385 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,903,497
private void setupRefreshTimer(int initialWaitTime) { BigDecimal intervalConfig = (BigDecimal) thing.getConfiguration() .get(YamahaReceiverBindingConstants.CONFIG_REFRESH); if (intervalConfig != null && intervalConfig.intValue() != refrehInterval) { refrehInterval = intervalConfig.intValue(); } if (refreshTimer != null) { refreshTimer.cancel(false); } refreshTimer = scheduler.scheduleWithFixedDelay(() -> updateAllZoneInformation(), initialWaitTime, refrehInterval, TimeUnit.SECONDS); }
void function(int initialWaitTime) { BigDecimal intervalConfig = (BigDecimal) thing.getConfiguration() .get(YamahaReceiverBindingConstants.CONFIG_REFRESH); if (intervalConfig != null && intervalConfig.intValue() != refrehInterval) { refrehInterval = intervalConfig.intValue(); } if (refreshTimer != null) { refreshTimer.cancel(false); } refreshTimer = scheduler.scheduleWithFixedDelay(() -> updateAllZoneInformation(), initialWaitTime, refrehInterval, TimeUnit.SECONDS); }
/** * Sets up a refresh timer (using the scheduler) with the CONFIG_REFRESH interval. * * @param initialWaitTime The delay before the first refresh. Maybe 0 to immediately * initiate a refresh. */
Sets up a refresh timer (using the scheduler) with the CONFIG_REFRESH interval
setupRefreshTimer
{ "repo_name": "Jamstah/openhab2-addons", "path": "addons/binding/org.openhab.binding.yamahareceiver/src/main/java/org/openhab/binding/yamahareceiver/handler/YamahaBridgeHandler.java", "license": "epl-1.0", "size": 13287 }
[ "java.math.BigDecimal", "java.util.concurrent.TimeUnit", "org.openhab.binding.yamahareceiver.YamahaReceiverBindingConstants" ]
import java.math.BigDecimal; import java.util.concurrent.TimeUnit; import org.openhab.binding.yamahareceiver.YamahaReceiverBindingConstants;
import java.math.*; import java.util.concurrent.*; import org.openhab.binding.yamahareceiver.*;
[ "java.math", "java.util", "org.openhab.binding" ]
java.math; java.util; org.openhab.binding;
1,364,446
public List<DnsResource> authorityResources() { if (authority == null) { return Collections.emptyList(); } return Collections.unmodifiableList(authority); }
List<DnsResource> function() { if (authority == null) { return Collections.emptyList(); } return Collections.unmodifiableList(authority); }
/** * Returns a list of all the authority resource records in this message. */
Returns a list of all the authority resource records in this message
authorityResources
{ "repo_name": "kaustubh-walokar/grpc-poll-lab2", "path": "lib/netty/codec-dns/src/main/java/io/netty/handler/codec/dns/DnsMessage.java", "license": "bsd-3-clause", "size": 6694 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,592,176
Collection<ProcessInstanceDesc> getProcessInstancesByCorrelationKeyAndStatus(CorrelationKey correlationKey, List<Integer> states, QueryContext queryContext);
Collection<ProcessInstanceDesc> getProcessInstancesByCorrelationKeyAndStatus(CorrelationKey correlationKey, List<Integer> states, QueryContext queryContext);
/** * Returns process instances descriptions filtered by their states found for given correlation key if found otherwise empty list. * This query uses 'like' to match correlation key so it allows to pass only partial keys - though matching * is done based on 'starts with' * @param correlationKey correlation key assigned to process instance * @param states A list of possible state (int) values that the {@link ProcessInstance} can have. * @return A list of {@link ProcessInstanceDesc} instances representing the process instances that match * the given correlation key */
Returns process instances descriptions filtered by their states found for given correlation key if found otherwise empty list. This query uses 'like' to match correlation key so it allows to pass only partial keys - though matching is done based on 'starts with'
getProcessInstancesByCorrelationKeyAndStatus
{ "repo_name": "pleacu/jbpm", "path": "jbpm-services/jbpm-services-api/src/main/java/org/jbpm/services/api/RuntimeDataService.java", "license": "apache-2.0", "size": 26171 }
[ "java.util.Collection", "java.util.List", "org.jbpm.services.api.model.ProcessInstanceDesc", "org.kie.api.runtime.query.QueryContext", "org.kie.internal.process.CorrelationKey" ]
import java.util.Collection; import java.util.List; import org.jbpm.services.api.model.ProcessInstanceDesc; import org.kie.api.runtime.query.QueryContext; import org.kie.internal.process.CorrelationKey;
import java.util.*; import org.jbpm.services.api.model.*; import org.kie.api.runtime.query.*; import org.kie.internal.process.*;
[ "java.util", "org.jbpm.services", "org.kie.api", "org.kie.internal" ]
java.util; org.jbpm.services; org.kie.api; org.kie.internal;
383,114
void removeAllFromBag(ObjectStoreBag osb, Collection<Integer> coll) throws ObjectStoreException;
void removeAllFromBag(ObjectStoreBag osb, Collection<Integer> coll) throws ObjectStoreException;
/** * Removes a collection of elements from an ObjectStoreBag. * * @param osb an ObjectStoreBag * @param coll a Collection of Integers * @throws ObjectStoreException if an error occurs */
Removes a collection of elements from an ObjectStoreBag
removeAllFromBag
{ "repo_name": "tomck/intermine", "path": "intermine/objectstore/main/src/org/intermine/objectstore/ObjectStoreWriter.java", "license": "lgpl-2.1", "size": 8152 }
[ "java.util.Collection", "org.intermine.objectstore.query.ObjectStoreBag" ]
import java.util.Collection; import org.intermine.objectstore.query.ObjectStoreBag;
import java.util.*; import org.intermine.objectstore.query.*;
[ "java.util", "org.intermine.objectstore" ]
java.util; org.intermine.objectstore;
2,814,885
protected TemporalGraph toTemporalGraph(BaseGraph<?, ?, ?, ?, ?> graph) { return getConfig().getTemporalGraphFactory().fromNonTemporalGraph(graph); }
TemporalGraph function(BaseGraph<?, ?, ?, ?, ?> graph) { return getConfig().getTemporalGraphFactory().fromNonTemporalGraph(graph); }
/** * Convert some graph to a {@link TemporalGraph}. * * @param graph The graph. * @return The resulting temporal graph. */
Convert some graph to a <code>TemporalGraph</code>
toTemporalGraph
{ "repo_name": "galpha/gradoop", "path": "gradoop-temporal/src/test/java/org/gradoop/temporal/util/TemporalGradoopTestBase.java", "license": "apache-2.0", "size": 17929 }
[ "org.gradoop.flink.model.api.epgm.BaseGraph", "org.gradoop.temporal.model.impl.TemporalGraph" ]
import org.gradoop.flink.model.api.epgm.BaseGraph; import org.gradoop.temporal.model.impl.TemporalGraph;
import org.gradoop.flink.model.api.epgm.*; import org.gradoop.temporal.model.impl.*;
[ "org.gradoop.flink", "org.gradoop.temporal" ]
org.gradoop.flink; org.gradoop.temporal;
808,689
@RequestMapping(value = PREFERENCE_URI_PREFIX + "qiniu", method = RequestMethod.PUT) public void updateQiniu(final HttpServletRequest request, final HttpServletResponse response, @RequestParam String body) throws Exception { if (!userQueryService.isAdminLoggedIn(request)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } final JSONRenderer renderer = new JSONRenderer(); try { body = URLDecoder.decode(body, "UTF-8");final JSONObject requestJSONObject = new JSONObject(body); final String accessKey = requestJSONObject.optString(Option.ID_C_QINIU_ACCESS_KEY).trim(); final String secretKey = requestJSONObject.optString(Option.ID_C_QINIU_SECRET_KEY).trim(); String domain = requestJSONObject.optString(Option.ID_C_QINIU_DOMAIN).trim(); final String bucket = requestJSONObject.optString(Option.ID_C_QINIU_BUCKET).trim(); final JSONObject ret = new JSONObject(); renderer.setJSONObject(ret); if (StringUtils.isNotBlank(domain) && !StringUtils.endsWith(domain, "/")) { domain += "/"; } final JSONObject accessKeyOpt = new JSONObject(); accessKeyOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_ACCESS_KEY); accessKeyOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); accessKeyOpt.put(Option.OPTION_VALUE, accessKey); final JSONObject secretKeyOpt = new JSONObject(); secretKeyOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_SECRET_KEY); secretKeyOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); secretKeyOpt.put(Option.OPTION_VALUE, secretKey); final JSONObject domainOpt = new JSONObject(); domainOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_DOMAIN); domainOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); domainOpt.put(Option.OPTION_VALUE, domain); final JSONObject bucketOpt = new JSONObject(); bucketOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_BUCKET); bucketOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); bucketOpt.put(Option.OPTION_VALUE, bucket); optionMgmtService.addOrUpdateOption(accessKeyOpt); optionMgmtService.addOrUpdateOption(secretKeyOpt); optionMgmtService.addOrUpdateOption(domainOpt); optionMgmtService.addOrUpdateOption(bucketOpt); ret.put(Keys.STATUS_CODE, true); ret.put(Keys.MSG, langPropsService.get("updateSuccLabel")); } catch (final ServiceException e) { logger.error(e.getMessage(), e); final JSONObject jsonObject = QueryResults.defaultResult(); renderer.setJSONObject(jsonObject); jsonObject.put(Keys.MSG, e.getMessage()); } renderer.render(request, response); }
@RequestMapping(value = PREFERENCE_URI_PREFIX + "qiniu", method = RequestMethod.PUT) void function(final HttpServletRequest request, final HttpServletResponse response, @RequestParam String body) throws Exception { if (!userQueryService.isAdminLoggedIn(request)) { response.sendError(HttpServletResponse.SC_FORBIDDEN); return; } final JSONRenderer renderer = new JSONRenderer(); try { body = URLDecoder.decode(body, "UTF-8");final JSONObject requestJSONObject = new JSONObject(body); final String accessKey = requestJSONObject.optString(Option.ID_C_QINIU_ACCESS_KEY).trim(); final String secretKey = requestJSONObject.optString(Option.ID_C_QINIU_SECRET_KEY).trim(); String domain = requestJSONObject.optString(Option.ID_C_QINIU_DOMAIN).trim(); final String bucket = requestJSONObject.optString(Option.ID_C_QINIU_BUCKET).trim(); final JSONObject ret = new JSONObject(); renderer.setJSONObject(ret); if (StringUtils.isNotBlank(domain) && !StringUtils.endsWith(domain, "/")) { domain += "/"; } final JSONObject accessKeyOpt = new JSONObject(); accessKeyOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_ACCESS_KEY); accessKeyOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); accessKeyOpt.put(Option.OPTION_VALUE, accessKey); final JSONObject secretKeyOpt = new JSONObject(); secretKeyOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_SECRET_KEY); secretKeyOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); secretKeyOpt.put(Option.OPTION_VALUE, secretKey); final JSONObject domainOpt = new JSONObject(); domainOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_DOMAIN); domainOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); domainOpt.put(Option.OPTION_VALUE, domain); final JSONObject bucketOpt = new JSONObject(); bucketOpt.put(Keys.OBJECT_ID, Option.ID_C_QINIU_BUCKET); bucketOpt.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_QINIU); bucketOpt.put(Option.OPTION_VALUE, bucket); optionMgmtService.addOrUpdateOption(accessKeyOpt); optionMgmtService.addOrUpdateOption(secretKeyOpt); optionMgmtService.addOrUpdateOption(domainOpt); optionMgmtService.addOrUpdateOption(bucketOpt); ret.put(Keys.STATUS_CODE, true); ret.put(Keys.MSG, langPropsService.get(STR)); } catch (final ServiceException e) { logger.error(e.getMessage(), e); final JSONObject jsonObject = QueryResults.defaultResult(); renderer.setJSONObject(jsonObject); jsonObject.put(Keys.MSG, e.getMessage()); } renderer.render(request, response); }
/** * Updates the Qiniu preference by the specified request. * * @param request * the specified http servlet request, for example, * * <pre> * { * "qiniuAccessKey": "", * "qiniuSecretKey": "", * "qiniuDomain": "", * "qiniuBucket": "" * }, see {@link org.b3log.solo.model.Option} for more details * </pre> * * @param response * the specified http servlet response * @param context * the specified http request context * @throws Exception * exception */
Updates the Qiniu preference by the specified request
updateQiniu
{ "repo_name": "daima/solo-spring", "path": "src/main/java/org/b3log/solo/controller/console/PreferenceConsole.java", "license": "apache-2.0", "size": 23240 }
[ "java.net.URLDecoder", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.commons.lang3.StringUtils", "org.b3log.solo.Keys", "org.b3log.solo.model.Option", "org.b3log.solo.module.util.QueryResults", "org.b3log.solo.renderer.JSONRenderer", "org.b3log.solo.service.ServiceException", "org.json.JSONObject", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam" ]
import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.b3log.solo.Keys; import org.b3log.solo.model.Option; import org.b3log.solo.module.util.QueryResults; import org.b3log.solo.renderer.JSONRenderer; import org.b3log.solo.service.ServiceException; import org.json.JSONObject; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam;
import java.net.*; import javax.servlet.http.*; import org.apache.commons.lang3.*; import org.b3log.solo.*; import org.b3log.solo.model.*; import org.b3log.solo.module.util.*; import org.b3log.solo.renderer.*; import org.b3log.solo.service.*; import org.json.*; import org.springframework.web.bind.annotation.*;
[ "java.net", "javax.servlet", "org.apache.commons", "org.b3log.solo", "org.json", "org.springframework.web" ]
java.net; javax.servlet; org.apache.commons; org.b3log.solo; org.json; org.springframework.web;
2,208,503
public List<CompField> getComponentsWithPrefix(final String prefix) { checkUniqueness(CompilationTimeStamp.getBaseTimestamp()); List<CompField> compFields = new ArrayList<CompField>(); Identifier id = null; for (int i = 0; i < fields.size(); i++) { id = fields.get(i).getIdentifier(); if(id!=null){ if(id.getName().startsWith(prefix)){ compFields.add(fields.get(i)); } } } return compFields; }
List<CompField> function(final String prefix) { checkUniqueness(CompilationTimeStamp.getBaseTimestamp()); List<CompField> compFields = new ArrayList<CompField>(); Identifier id = null; for (int i = 0; i < fields.size(); i++) { id = fields.get(i).getIdentifier(); if(id!=null){ if(id.getName().startsWith(prefix)){ compFields.add(fields.get(i)); } } } return compFields; }
/** * Returns a list of the components whose identifier starts with the given * prefix. * * @param prefix the prefix used to select the component fields. * @return the list of component fields which start with the provided * prefix. * */
Returns a list of the components whose identifier starts with the given prefix
getComponentsWithPrefix
{ "repo_name": "eroslevi/titan.EclipsePlug-ins", "path": "org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/TTCN3/types/CompFieldMap.java", "license": "epl-1.0", "size": 15364 }
[ "java.util.ArrayList", "java.util.List", "org.eclipse.titan.designer.AST", "org.eclipse.titan.designer.parsers.CompilationTimeStamp" ]
import java.util.ArrayList; import java.util.List; import org.eclipse.titan.designer.AST; import org.eclipse.titan.designer.parsers.CompilationTimeStamp;
import java.util.*; import org.eclipse.titan.designer.*; import org.eclipse.titan.designer.parsers.*;
[ "java.util", "org.eclipse.titan" ]
java.util; org.eclipse.titan;
2,220,936
@Test public void testReplicantThrottle() { mockCoordinator(); mockPeon.loadSegment(EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.expectLastCall().atLeastOnce(); mockEmptyPeon(); EasyMock .expect(databaseRuleManager.getRulesWithDefault(EasyMock.anyObject())) .andReturn( Collections.singletonList( new IntervalLoadRule( Intervals.of("2012-01-01T00:00:00.000Z/2013-01-01T00:00:00.000Z"), ImmutableMap.of("hot", 2) ) ) ) .atLeastOnce(); EasyMock.replay(databaseRuleManager); DruidCluster druidCluster = DruidClusterBuilder .newBuilder() .addTier( "hot", new ServerHolder( new DruidServer("serverHot", "hostHot", null, 1000, ServerType.HISTORICAL, "hot", 0) .toImmutableDruidServer(), mockPeon ), new ServerHolder( new DruidServer("serverHot2", "hostHot2", null, 1000, ServerType.HISTORICAL, "hot", 0) .toImmutableDruidServer(), mockPeon ) ) .build(); ListeningExecutorService exec = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1)); BalancerStrategy balancerStrategy = new CostBalancerStrategyFactory().createBalancerStrategy(exec); DruidCoordinatorRuntimeParams params = makeCoordinatorRuntimeParams(druidCluster, balancerStrategy).build(); DruidCoordinatorRuntimeParams afterParams = ruleRunner.run(params); CoordinatorStats stats = afterParams.getCoordinatorStats(); Assert.assertEquals(48L, stats.getTieredStat("assignedCount", "hot")); Assert.assertTrue(stats.getTiers("unassignedCount").isEmpty()); Assert.assertTrue(stats.getTiers("unassignedSize").isEmpty()); DataSegment overFlowSegment = new DataSegment( "test", Intervals.of("2012-02-01/2012-02-02"), DateTimes.nowUtc().toString(), new HashMap<>(), new ArrayList<>(), new ArrayList<>(), NoneShardSpec.instance(), 1, 0 ); afterParams = ruleRunner.run( CoordinatorRuntimeParamsTestHelpers .newBuilder() .withDruidCluster(druidCluster) .withEmitter(emitter) .withUsedSegmentsInTest(overFlowSegment) .withDatabaseRuleManager(databaseRuleManager) .withBalancerStrategy(balancerStrategy) .withSegmentReplicantLookup(SegmentReplicantLookup.make(new DruidCluster())) .build() ); stats = afterParams.getCoordinatorStats(); Assert.assertEquals(1L, stats.getTieredStat("assignedCount", "hot")); Assert.assertTrue(stats.getTiers("unassignedCount").isEmpty()); Assert.assertTrue(stats.getTiers("unassignedSize").isEmpty()); EasyMock.verify(mockPeon); exec.shutdown(); }
void function() { mockCoordinator(); mockPeon.loadSegment(EasyMock.anyObject(), EasyMock.anyObject()); EasyMock.expectLastCall().atLeastOnce(); mockEmptyPeon(); EasyMock .expect(databaseRuleManager.getRulesWithDefault(EasyMock.anyObject())) .andReturn( Collections.singletonList( new IntervalLoadRule( Intervals.of(STR), ImmutableMap.of("hot", 2) ) ) ) .atLeastOnce(); EasyMock.replay(databaseRuleManager); DruidCluster druidCluster = DruidClusterBuilder .newBuilder() .addTier( "hot", new ServerHolder( new DruidServer(STR, STR, null, 1000, ServerType.HISTORICAL, "hot", 0) .toImmutableDruidServer(), mockPeon ), new ServerHolder( new DruidServer(STR, STR, null, 1000, ServerType.HISTORICAL, "hot", 0) .toImmutableDruidServer(), mockPeon ) ) .build(); ListeningExecutorService exec = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(1)); BalancerStrategy balancerStrategy = new CostBalancerStrategyFactory().createBalancerStrategy(exec); DruidCoordinatorRuntimeParams params = makeCoordinatorRuntimeParams(druidCluster, balancerStrategy).build(); DruidCoordinatorRuntimeParams afterParams = ruleRunner.run(params); CoordinatorStats stats = afterParams.getCoordinatorStats(); Assert.assertEquals(48L, stats.getTieredStat(STR, "hot")); Assert.assertTrue(stats.getTiers(STR).isEmpty()); Assert.assertTrue(stats.getTiers(STR).isEmpty()); DataSegment overFlowSegment = new DataSegment( "test", Intervals.of(STR), DateTimes.nowUtc().toString(), new HashMap<>(), new ArrayList<>(), new ArrayList<>(), NoneShardSpec.instance(), 1, 0 ); afterParams = ruleRunner.run( CoordinatorRuntimeParamsTestHelpers .newBuilder() .withDruidCluster(druidCluster) .withEmitter(emitter) .withUsedSegmentsInTest(overFlowSegment) .withDatabaseRuleManager(databaseRuleManager) .withBalancerStrategy(balancerStrategy) .withSegmentReplicantLookup(SegmentReplicantLookup.make(new DruidCluster())) .build() ); stats = afterParams.getCoordinatorStats(); Assert.assertEquals(1L, stats.getTieredStat(STR, "hot")); Assert.assertTrue(stats.getTiers(STR).isEmpty()); Assert.assertTrue(stats.getTiers(STR).isEmpty()); EasyMock.verify(mockPeon); exec.shutdown(); }
/** * Nodes: * hot - 2 replicants */
Nodes: hot - 2 replicants
testReplicantThrottle
{ "repo_name": "pjain1/druid", "path": "server/src/test/java/org/apache/druid/server/coordinator/RunRulesTest.java", "license": "apache-2.0", "size": 51668 }
[ "com.google.common.collect.ImmutableMap", "com.google.common.util.concurrent.ListeningExecutorService", "com.google.common.util.concurrent.MoreExecutors", "java.util.ArrayList", "java.util.Collections", "java.util.HashMap", "java.util.concurrent.Executors", "org.apache.druid.client.DruidServer", "org.apache.druid.java.util.common.DateTimes", "org.apache.druid.java.util.common.Intervals", "org.apache.druid.server.coordination.ServerType", "org.apache.druid.server.coordinator.rules.IntervalLoadRule", "org.apache.druid.timeline.DataSegment", "org.apache.druid.timeline.partition.NoneShardSpec", "org.easymock.EasyMock", "org.junit.Assert" ]
import com.google.common.collect.ImmutableMap; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.concurrent.Executors; import org.apache.druid.client.DruidServer; import org.apache.druid.java.util.common.DateTimes; import org.apache.druid.java.util.common.Intervals; import org.apache.druid.server.coordination.ServerType; import org.apache.druid.server.coordinator.rules.IntervalLoadRule; import org.apache.druid.timeline.DataSegment; import org.apache.druid.timeline.partition.NoneShardSpec; import org.easymock.EasyMock; import org.junit.Assert;
import com.google.common.collect.*; import com.google.common.util.concurrent.*; import java.util.*; import java.util.concurrent.*; import org.apache.druid.client.*; import org.apache.druid.java.util.common.*; import org.apache.druid.server.coordination.*; import org.apache.druid.server.coordinator.rules.*; import org.apache.druid.timeline.*; import org.apache.druid.timeline.partition.*; import org.easymock.*; import org.junit.*;
[ "com.google.common", "java.util", "org.apache.druid", "org.easymock", "org.junit" ]
com.google.common; java.util; org.apache.druid; org.easymock; org.junit;
963,956
protected static int getRSAKeyLength(PublicKey pk) throws NoSuchAlgorithmException, InvalidKeySpecException { BigInteger mod; if (pk instanceof RSAKey) { mod = ((RSAKey) pk).getModulus(); } else { KeyFactory kf = KeyFactory.getInstance("RSA"); mod = kf.getKeySpec(pk, RSAPublicKeySpec.class) .getModulus(); } return mod.bitLength(); }
static int function(PublicKey pk) throws NoSuchAlgorithmException, InvalidKeySpecException { BigInteger mod; if (pk instanceof RSAKey) { mod = ((RSAKey) pk).getModulus(); } else { KeyFactory kf = KeyFactory.getInstance("RSA"); mod = kf.getKeySpec(pk, RSAPublicKeySpec.class) .getModulus(); } return mod.bitLength(); }
/** * Returns RSA key length * @param pk * @return * @throws NoSuchAlgorithmException * @throws InvalidKeySpecException */
Returns RSA key length
getRSAKeyLength
{ "repo_name": "indashnet/InDashNet.Open.UN2000", "path": "android/libcore/crypto/src/main/java/org/conscrypt/HandshakeProtocol.java", "license": "apache-2.0", "size": 15853 }
[ "java.math.BigInteger", "java.security.KeyFactory", "java.security.NoSuchAlgorithmException", "java.security.PublicKey", "java.security.interfaces.RSAKey", "java.security.spec.InvalidKeySpecException", "java.security.spec.RSAPublicKeySpec" ]
import java.math.BigInteger; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PublicKey; import java.security.interfaces.RSAKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.RSAPublicKeySpec;
import java.math.*; import java.security.*; import java.security.interfaces.*; import java.security.spec.*;
[ "java.math", "java.security" ]
java.math; java.security;
2,757,560
public AnnotationParser createAnnotationParser() { if(parser.getAnnotationParserFactory()==null) return DefaultAnnotationParser.theInstance; else return parser.getAnnotationParserFactory().create(); }
AnnotationParser function() { if(parser.getAnnotationParserFactory()==null) return DefaultAnnotationParser.theInstance; else return parser.getAnnotationParserFactory().create(); }
/** * Creates a new instance of annotation parser. */
Creates a new instance of annotation parser
createAnnotationParser
{ "repo_name": "samskivert/ikvm-openjdk", "path": "build/linux-amd64/impsrc/com/sun/xml/internal/xsom/impl/parser/NGCCRuntimeEx.java", "license": "gpl-2.0", "size": 17946 }
[ "com.sun.xml.internal.xsom.parser.AnnotationParser" ]
import com.sun.xml.internal.xsom.parser.AnnotationParser;
import com.sun.xml.internal.xsom.parser.*;
[ "com.sun.xml" ]
com.sun.xml;
2,453,723
public static void insertEmptyData(ByteBuffer buffer, int len) { byte[] buf = buffer.array(); int pos = buffer.position(); int limit = buffer.limit(); System.arraycopy(buf, pos, buf, pos + len, limit - pos); Arrays.fill(buf, pos, pos + len, (byte)0); buffer.limit(limit + len); }
static void function(ByteBuffer buffer, int len) { byte[] buf = buffer.array(); int pos = buffer.position(); int limit = buffer.limit(); System.arraycopy(buf, pos, buf, pos + len, limit - pos); Arrays.fill(buf, pos, pos + len, (byte)0); buffer.limit(limit + len); }
/** * Inserts empty data of the given length at the current position of the * given buffer (moving existing data forward the given length). The limit * of the buffer is adjusted by the given length. The buffer is expecting * to have the required capacity available. */
Inserts empty data of the given length at the current position of the given buffer (moving existing data forward the given length). The limit of the buffer is adjusted by the given length. The buffer is expecting to have the required capacity available
insertEmptyData
{ "repo_name": "jahlborn/jackcess", "path": "src/main/java/com/healthmarketscience/jackcess/impl/ByteUtil.java", "license": "apache-2.0", "size": 22831 }
[ "java.nio.ByteBuffer", "java.util.Arrays" ]
import java.nio.ByteBuffer; import java.util.Arrays;
import java.nio.*; import java.util.*;
[ "java.nio", "java.util" ]
java.nio; java.util;
1,752,969
final List<String> services = new ArrayList<String>(); services.add(ServicePackage1.class.getCanonicalName()); services.add(ServicePackage2.class.getCanonicalName()); registry.register("token1", "bundle", services); final Map<String, List<String>> map = registry.getServicePackages("token1"); assertEquals(1, map.size()); final List<String> list = map.get("bundle"); assertEquals(2, list.size()); assertEquals(ServicePackage1.class.getCanonicalName(), list.get(0)); assertEquals(ServicePackage2.class.getCanonicalName(), list.get(1)); }
final List<String> services = new ArrayList<String>(); services.add(ServicePackage1.class.getCanonicalName()); services.add(ServicePackage2.class.getCanonicalName()); registry.register(STR, STR, services); final Map<String, List<String>> map = registry.getServicePackages(STR); assertEquals(1, map.size()); final List<String> list = map.get(STR); assertEquals(2, list.size()); assertEquals(ServicePackage1.class.getCanonicalName(), list.get(0)); assertEquals(ServicePackage2.class.getCanonicalName(), list.get(1)); }
/** * Tests the register/getServicePackage couple with a single token. */
Tests the register/getServicePackage couple with a single token
registerServicesTestSingleToken
{ "repo_name": "ylussaud/M2Doc", "path": "tests/org.obeonetwork.m2doc.tests/src/org/obeonetwork/m2doc/tests/services/ServiceRegistryTests.java", "license": "epl-1.0", "size": 4356 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "org.junit.Assert" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
665,788
public Bluetooth setBluetoothName(String name) throws UpdateException;
Bluetooth function(String name) throws UpdateException;
/** * Set the device name as seen via Bluetooth connectivity. * * @param name * the name to display on other devices * @return the updated state of Bluetooth on the device * @throws UpdateException * if the update failed */
Set the device name as seen via Bluetooth connectivity
setBluetoothName
{ "repo_name": "paulianttila/openhab2", "path": "bundles/org.openhab.binding.lametrictime/src/3rdparty/java/org/openhab/binding/lametrictime/api/LaMetricTime.java", "license": "epl-1.0", "size": 17221 }
[ "org.openhab.binding.lametrictime.api.local.UpdateException", "org.openhab.binding.lametrictime.api.local.model.Bluetooth" ]
import org.openhab.binding.lametrictime.api.local.UpdateException; import org.openhab.binding.lametrictime.api.local.model.Bluetooth;
import org.openhab.binding.lametrictime.api.local.*; import org.openhab.binding.lametrictime.api.local.model.*;
[ "org.openhab.binding" ]
org.openhab.binding;
1,504,263
@SuppressWarnings("unchecked") public void run(RecordReader<K1, V1> input, OutputCollector<K2, V2> output, Reporter reporter) throws IOException { Application<K1, V1, K2, V2> application = null; try { RecordReader<FloatWritable, NullWritable> fakeInput = (!Submitter.getIsJavaRecordReader(job) && !Submitter.getIsJavaMapper(job)) ? (RecordReader<FloatWritable, NullWritable>) input : null; application = new Application<K1, V1, K2, V2>(job, fakeInput, output, reporter, (Class<? extends K2>) job.getOutputKeyClass(), (Class<? extends V2>) job.getOutputValueClass(), true); // run on GPU } catch (InterruptedException ie) { throw new RuntimeException("interrupted", ie); } DownwardProtocol<K1, V1> downlink = application.getDownlink(); boolean isJavaInput = Submitter.getIsJavaRecordReader(job); downlink.runMap(reporter.getInputSplit(), job.getNumReduceTasks(), isJavaInput); boolean skipping = job.getBoolean("mapred.skip.on", false); try { if (isJavaInput) { // allocate key & value instances that are re-used for all entries K1 key = input.createKey(); V1 value = input.createValue(); downlink.setInputTypes(key.getClass().getName(), value.getClass().getName()); while (input.next(key, value)) { // map pair to output downlink.mapItem(key, value); if(skipping) { //flush the streams on every record input if running in skip mode //so that we don't buffer other records surrounding a bad record. downlink.flush(); } } downlink.endOfInput(); } application.waitForFinish(); } catch (Throwable t) { application.abort(t); } finally { application.cleanup(); } }
@SuppressWarnings(STR) void function(RecordReader<K1, V1> input, OutputCollector<K2, V2> output, Reporter reporter) throws IOException { Application<K1, V1, K2, V2> application = null; try { RecordReader<FloatWritable, NullWritable> fakeInput = (!Submitter.getIsJavaRecordReader(job) && !Submitter.getIsJavaMapper(job)) ? (RecordReader<FloatWritable, NullWritable>) input : null; application = new Application<K1, V1, K2, V2>(job, fakeInput, output, reporter, (Class<? extends K2>) job.getOutputKeyClass(), (Class<? extends V2>) job.getOutputValueClass(), true); } catch (InterruptedException ie) { throw new RuntimeException(STR, ie); } DownwardProtocol<K1, V1> downlink = application.getDownlink(); boolean isJavaInput = Submitter.getIsJavaRecordReader(job); downlink.runMap(reporter.getInputSplit(), job.getNumReduceTasks(), isJavaInput); boolean skipping = job.getBoolean(STR, false); try { if (isJavaInput) { K1 key = input.createKey(); V1 value = input.createValue(); downlink.setInputTypes(key.getClass().getName(), value.getClass().getName()); while (input.next(key, value)) { downlink.mapItem(key, value); if(skipping) { downlink.flush(); } } downlink.endOfInput(); } application.waitForFinish(); } catch (Throwable t) { application.abort(t); } finally { application.cleanup(); } }
/** * Run the map task. * @param input the set of inputs * @param output the object to collect the outputs of the map * @param reporter the object to update with status */
Run the map task
run
{ "repo_name": "koichi626/hadoop-gpu", "path": "hadoop-gpu-0.20.1/src/mapred/org/apache/hadoop/mapred/pipes/PipesGPUMapRunner.java", "license": "apache-2.0", "size": 4165 }
[ "java.io.IOException", "org.apache.hadoop.io.FloatWritable", "org.apache.hadoop.io.NullWritable", "org.apache.hadoop.mapred.OutputCollector", "org.apache.hadoop.mapred.RecordReader", "org.apache.hadoop.mapred.Reporter" ]
import java.io.IOException; import org.apache.hadoop.io.FloatWritable; import org.apache.hadoop.io.NullWritable; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.RecordReader; import org.apache.hadoop.mapred.Reporter;
import java.io.*; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,236,509
private static void validateBootstrapLoadBalancerIp(Set<String> errors, GenericKafkaListener listener) { if (!KafkaListenerType.LOADBALANCER.equals(listener.getType()) && listener.getConfiguration().getBootstrap().getLoadBalancerIP() != null) { errors.add("listener " + listener.getName() + " cannot configure bootstrap.loadBalancerIP because it is not LoadBalancer based listener"); } }
static void function(Set<String> errors, GenericKafkaListener listener) { if (!KafkaListenerType.LOADBALANCER.equals(listener.getType()) && listener.getConfiguration().getBootstrap().getLoadBalancerIP() != null) { errors.add(STR + listener.getName() + STR); } }
/** * Validates that bootstrap.loadBalancerIP is used only with NodePort type listener * * @param errors List where any found errors will be added * @param listener Listener which needs to be validated */
Validates that bootstrap.loadBalancerIP is used only with NodePort type listener
validateBootstrapLoadBalancerIp
{ "repo_name": "ppatierno/kaas", "path": "cluster-operator/src/main/java/io/strimzi/operator/cluster/model/ListenersValidator.java", "license": "apache-2.0", "size": 29986 }
[ "io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener", "io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType", "java.util.Set" ]
import io.strimzi.api.kafka.model.listener.arraylistener.GenericKafkaListener; import io.strimzi.api.kafka.model.listener.arraylistener.KafkaListenerType; import java.util.Set;
import io.strimzi.api.kafka.model.listener.arraylistener.*; import java.util.*;
[ "io.strimzi.api", "java.util" ]
io.strimzi.api; java.util;
820,995
public Builder putProperties(String prefix, Properties properties, String[] ignorePrefixes) { for (Object key1 : properties.keySet()) { String key = (String) key1; String value = properties.getProperty(key); if (key.startsWith(prefix)) { boolean ignore = false; for (String ignorePrefix : ignorePrefixes) { if (key.startsWith(ignorePrefix)) { ignore = true; break; } } if (!ignore) { map.put(key.substring(prefix.length()), value); } } } return this; }
Builder function(String prefix, Properties properties, String[] ignorePrefixes) { for (Object key1 : properties.keySet()) { String key = (String) key1; String value = properties.getProperty(key); if (key.startsWith(prefix)) { boolean ignore = false; for (String ignorePrefix : ignorePrefixes) { if (key.startsWith(ignorePrefix)) { ignore = true; break; } } if (!ignore) { map.put(key.substring(prefix.length()), value); } } } return this; }
/** * Puts all the properties with keys starting with the provided <tt>prefix</tt>. * * @param prefix The prefix to filter property key by * @param properties The properties to put * @return The builder */
Puts all the properties with keys starting with the provided prefix
putProperties
{ "repo_name": "strapdata/elassandra-test", "path": "core/src/main/java/org/elasticsearch/common/settings/Settings.java", "license": "apache-2.0", "size": 49155 }
[ "java.util.Properties" ]
import java.util.Properties;
import java.util.*;
[ "java.util" ]
java.util;
998,608