method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public static synchronized void disposeAll() {
for (Iterator iter = instances.iterator(); iter.hasNext();) {
RiTextBehavior rtb = ((RiTextBehavior) iter.next());
rtb.delete();
}
} | static synchronized void function() { for (Iterator iter = instances.iterator(); iter.hasNext();) { RiTextBehavior rtb = ((RiTextBehavior) iter.next()); rtb.delete(); } } | /**
* Calls delete() on all existing behaviors
*/ | Calls delete() on all existing behaviors | disposeAll | {
"repo_name": "cqx931/RiTa",
"path": "java/rita/render/RiTextBehavior.java",
"license": "gpl-3.0",
"size": 15584
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,070,612 |
ClusterNode pickWeightedNode() {
double weight = RAND.nextDouble();
SortedMap<Double, ClusterNode> pick = circle.tailMap(weight);
ClusterNode node = pick.get(pick.firstKey());
rwLock.readLock().lock();
try {
AtomicInteger cnt = nodeJobs.get(node.id());
if (cnt != null)
cnt.incrementAndGet();
}
finally {
rwLock.readLock().unlock();
}
return node;
}
} | ClusterNode pickWeightedNode() { double weight = RAND.nextDouble(); SortedMap<Double, ClusterNode> pick = circle.tailMap(weight); ClusterNode node = pick.get(pick.firstKey()); rwLock.readLock().lock(); try { AtomicInteger cnt = nodeJobs.get(node.id()); if (cnt != null) cnt.incrementAndGet(); } finally { rwLock.readLock().unlock(); } return node; } } | /**
* Gets weighted node in random fashion.
*
* @return Weighted node.
*/ | Gets weighted node in random fashion | pickWeightedNode | {
"repo_name": "shroman/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/loadbalancing/adaptive/AdaptiveLoadBalancingSpi.java",
"license": "apache-2.0",
"size": 24150
} | [
"java.util.SortedMap",
"java.util.concurrent.atomic.AtomicInteger",
"org.apache.ignite.cluster.ClusterNode"
] | import java.util.SortedMap; import java.util.concurrent.atomic.AtomicInteger; import org.apache.ignite.cluster.ClusterNode; | import java.util.*; import java.util.concurrent.atomic.*; import org.apache.ignite.cluster.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 172,003 |
public Object removePackageFromRepository(String pack) throws IOException, ClassNotFoundException, IllegalAccessException
{
RelatrixKVStatement rs = new RelatrixKVStatement("removePackageFromRepository", pack);
CountDownLatch cdl = new CountDownLatch(1);
rs.setCountDownLatch(cdl);
send(rs);
try {
cdl.await();
} catch (InterruptedException e) {
}
//IOException, IllegalArgumentException, ClassNotFoundException, IllegalAccessException
Object o = rs.getObjectReturn();
outstandingRequests.remove(rs.getSession());
if(o instanceof IllegalArgumentException)
throw (IllegalArgumentException)o;
else
if(o instanceof ClassNotFoundException)
throw (ClassNotFoundException)o;
else
if(o instanceof IllegalAccessException)
throw (IllegalAccessException)o;
else
if(o instanceof IOException)
throw (IOException)o;
else
if(o instanceof Exception)
throw new IOException("Repackaged remote exception pertaining to "+(((Exception)o).getMessage()));
return o;
}
| Object function(String pack) throws IOException, ClassNotFoundException, IllegalAccessException { RelatrixKVStatement rs = new RelatrixKVStatement(STR, pack); CountDownLatch cdl = new CountDownLatch(1); rs.setCountDownLatch(cdl); send(rs); try { cdl.await(); } catch (InterruptedException e) { } Object o = rs.getObjectReturn(); outstandingRequests.remove(rs.getSession()); if(o instanceof IllegalArgumentException) throw (IllegalArgumentException)o; else if(o instanceof ClassNotFoundException) throw (ClassNotFoundException)o; else if(o instanceof IllegalAccessException) throw (IllegalAccessException)o; else if(o instanceof IOException) throw (IOException)o; else if(o instanceof Exception) throw new IOException(STR+(((Exception)o).getMessage())); return o; } | /**
* Remove package in handlerclassloader and from repository.
* @param pack The package designation, everything starting with this descriptor will be removed
* @param path
* @return
* @throws IOException
* @throws ClassNotFoundException
* @throws IllegalAccessException
*/ | Remove package in handlerclassloader and from repository | removePackageFromRepository | {
"repo_name": "neocoretechs/Relatrix",
"path": "src/com/neocoretechs/relatrix/client/RelatrixKVClient.java",
"license": "apache-2.0",
"size": 61869
} | [
"java.io.IOException",
"java.util.concurrent.CountDownLatch"
] | import java.io.IOException; import java.util.concurrent.CountDownLatch; | import java.io.*; import java.util.concurrent.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,425,850 |
private String generateRegistrationKey() {
String uniqueId = getUniqueId();
SecureRandom prng = new SecureRandom();
return uniqueId + prng.nextInt();
} | String function() { String uniqueId = getUniqueId(); SecureRandom prng = new SecureRandom(); return uniqueId + prng.nextInt(); } | /**
* Generate unique registration key for the instructor.
* The key contains random elements to avoid being guessed.
*/ | Generate unique registration key for the instructor. The key contains random elements to avoid being guessed | generateRegistrationKey | {
"repo_name": "LiHaoTan/teammates",
"path": "src/main/java/teammates/storage/entity/Instructor.java",
"license": "gpl-2.0",
"size": 6204
} | [
"java.security.SecureRandom"
] | import java.security.SecureRandom; | import java.security.*; | [
"java.security"
] | java.security; | 2,356,376 |
public void surfaceCreated(SurfaceHolder holder) {
mGLThread.surfaceCreated();
} | void function(SurfaceHolder holder) { mGLThread.surfaceCreated(); } | /**
* This method is part of the SurfaceHolder.Callback interface, and is
* not normally called or subclassed by clients of GLTextureView.
*/ | This method is part of the SurfaceHolder.Callback interface, and is not normally called or subclassed by clients of GLTextureView | surfaceCreated | {
"repo_name": "noobyang/AndroidStudy",
"path": "game/src/main/java/com/lee/game/opengl/sample/egl/GLTextureView.java",
"license": "apache-2.0",
"size": 75805
} | [
"android.view.SurfaceHolder"
] | import android.view.SurfaceHolder; | import android.view.*; | [
"android.view"
] | android.view; | 2,074,496 |
private void allReleased() {
jProgressBar2.setString("Sperren freigegeben");
jProgressBar2.setValue(0);
jButton4.setEnabled(true);
jButton5.setEnabled(true);
SwingUtilities.invokeLater(new Runnable() { | void function() { jProgressBar2.setString(STR); jProgressBar2.setValue(0); jButton4.setEnabled(true); jButton5.setEnabled(true); SwingUtilities.invokeLater(new Runnable() { | /**
* DOCUMENT ME!
*/ | DOCUMENT ME | allReleased | {
"repo_name": "cismet/verdis",
"path": "src/main/java/de/cismet/verdis/gui/KassenzeichenListPanel.java",
"license": "gpl-3.0",
"size": 66008
} | [
"javax.swing.SwingUtilities"
] | import javax.swing.SwingUtilities; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,212,091 |
private Object deserializeValue(@Nullable QName key, String value) {
// FIXME: Use codec to deserialize value to correct Java type
return value;
} | Object function(@Nullable QName key, String value) { return value; } | /**
*
* Deserializes value for supplied key
*
* @param key Name of referenced key, If null, referenced leaf is previous encountered item.
* @param value Value to be checked and deserialized
* @return Object representing value in yang-data-api format.
*/ | Deserializes value for supplied key | deserializeValue | {
"repo_name": "522986491/yangtools",
"path": "yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/XpathStringParsingPathArgumentBuilder.java",
"license": "epl-1.0",
"size": 11416
} | [
"javax.annotation.Nullable",
"org.opendaylight.yangtools.yang.common.QName"
] | import javax.annotation.Nullable; import org.opendaylight.yangtools.yang.common.QName; | import javax.annotation.*; import org.opendaylight.yangtools.yang.common.*; | [
"javax.annotation",
"org.opendaylight.yangtools"
] | javax.annotation; org.opendaylight.yangtools; | 2,283,497 |
private void generateManySpheres(int numSpheres)
{
Random rnd = new Random();
Scene gameSurface = getGameSurface();
for (int i = 0; i < numSpheres; i++)
{
Color c = Color
.rgb(rnd.nextInt(255), rnd.nextInt(255), rnd.nextInt(255));
Atom b = new Atom(rnd.nextInt(15) + 5, c);
Circle circle = b.getAsCircle();
// random 0 to 2 + (.0 to 1) * random (1 or -1)
b.vX = (rnd.nextInt(2) + rnd.nextDouble()) * (rnd
.nextBoolean() ? 1 : -1);
b.vY = (rnd.nextInt(2) + rnd.nextDouble()) * (rnd
.nextBoolean() ? 1 : -1);
// random x between 0 to width of scene
double newX = rnd.nextInt((int) gameSurface.getWidth());
// check for the right of the width newX is greater than width
// minus radius times 2(width of sprite)
if (newX > (gameSurface.getWidth() - (circle.getRadius() * 2)))
{
newX = gameSurface.getWidth() - (circle.getRadius() * 2);
}
// check for the bottom of screen the height newY is greater than height
// minus radius times 2(height of sprite)
double newY = rnd.nextInt((int) gameSurface.getHeight());
if (newY > (gameSurface.getHeight() - (circle.getRadius() * 2)))
{
newY = gameSurface.getHeight() - (circle.getRadius() * 2);
}
circle.setTranslateX(newX);
circle.setTranslateY(newY);
circle.setVisible(true);
circle.setId(b.toString());
// add to actors in play (sprite objects)
getSpriteManager().addSprites(b);
// add sprite's
getSceneNodes().getChildren().add(0, b.node);
}
} | void function(int numSpheres) { Random rnd = new Random(); Scene gameSurface = getGameSurface(); for (int i = 0; i < numSpheres; i++) { Color c = Color .rgb(rnd.nextInt(255), rnd.nextInt(255), rnd.nextInt(255)); Atom b = new Atom(rnd.nextInt(15) + 5, c); Circle circle = b.getAsCircle(); b.vX = (rnd.nextInt(2) + rnd.nextDouble()) * (rnd .nextBoolean() ? 1 : -1); b.vY = (rnd.nextInt(2) + rnd.nextDouble()) * (rnd .nextBoolean() ? 1 : -1); double newX = rnd.nextInt((int) gameSurface.getWidth()); if (newX > (gameSurface.getWidth() - (circle.getRadius() * 2))) { newX = gameSurface.getWidth() - (circle.getRadius() * 2); } double newY = rnd.nextInt((int) gameSurface.getHeight()); if (newY > (gameSurface.getHeight() - (circle.getRadius() * 2))) { newY = gameSurface.getHeight() - (circle.getRadius() * 2); } circle.setTranslateX(newX); circle.setTranslateY(newY); circle.setVisible(true); circle.setId(b.toString()); getSpriteManager().addSprites(b); getSceneNodes().getChildren().add(0, b.node); } } | /**
* Make some more space spheres (Atomic particles)
*/ | Make some more space spheres (Atomic particles) | generateManySpheres | {
"repo_name": "Quillion/GameEngine",
"path": "Games/test8_fx/AtomSmasher.java",
"license": "cc0-1.0",
"size": 6554
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 1,726,337 |
@Test
public void testEntryIdleTtl() {
final String name = this.getUniqueName();
// test no longer waits for this timeout to expire
final int timeout = 2000; // seconds
final String key = "IDLE_TTL_KEY";
final String value = "IDLE_TTL_VALUE";
RegionFactory<Object, Object> factory = getCache().createRegionFactory(getRegionAttributes());
ExpirationAttributes expireIdle =
new ExpirationAttributes(timeout / 2, ExpirationAction.DESTROY);
factory.setEntryIdleTimeout(expireIdle);
ExpirationAttributes expireTtl = new ExpirationAttributes(timeout, ExpirationAction.DESTROY);
factory.setEntryTimeToLive(expireTtl);
factory.setStatisticsEnabled(true);
LocalRegion region = (LocalRegion) createRegion(name, factory);
region.create(key, value);
EntryExpiryTask eet = region.getEntryExpiryTask(key);
final long firstIdleExpiryTime = eet.getIdleExpirationTime();
final long firstTTLExpiryTime = eet.getTTLExpirationTime();
if ((firstIdleExpiryTime - firstTTLExpiryTime) >= 0) {
fail("idle should be less than ttl: idle=" + firstIdleExpiryTime + " ttl="
+ firstTTLExpiryTime);
}
Wait.waitForExpiryClockToChange(region);
region.get(key);
eet = region.getEntryExpiryTask(key);
final long secondIdleExpiryTime = eet.getIdleExpirationTime();
final long secondTTLExpiryTime = eet.getTTLExpirationTime();
// make sure the get does not change the ttl expiry time
assertEquals(firstTTLExpiryTime, secondTTLExpiryTime);
// and does change the idle expiry time
if ((secondIdleExpiryTime - firstIdleExpiryTime) <= 0) {
fail("idle should have increased: idle=" + firstIdleExpiryTime + " idle2="
+ secondIdleExpiryTime);
}
} | void function() { final String name = this.getUniqueName(); final int timeout = 2000; final String key = STR; final String value = STR; RegionFactory<Object, Object> factory = getCache().createRegionFactory(getRegionAttributes()); ExpirationAttributes expireIdle = new ExpirationAttributes(timeout / 2, ExpirationAction.DESTROY); factory.setEntryIdleTimeout(expireIdle); ExpirationAttributes expireTtl = new ExpirationAttributes(timeout, ExpirationAction.DESTROY); factory.setEntryTimeToLive(expireTtl); factory.setStatisticsEnabled(true); LocalRegion region = (LocalRegion) createRegion(name, factory); region.create(key, value); EntryExpiryTask eet = region.getEntryExpiryTask(key); final long firstIdleExpiryTime = eet.getIdleExpirationTime(); final long firstTTLExpiryTime = eet.getTTLExpirationTime(); if ((firstIdleExpiryTime - firstTTLExpiryTime) >= 0) { fail(STR + firstIdleExpiryTime + STR + firstTTLExpiryTime); } Wait.waitForExpiryClockToChange(region); region.get(key); eet = region.getEntryExpiryTask(key); final long secondIdleExpiryTime = eet.getIdleExpirationTime(); final long secondTTLExpiryTime = eet.getTTLExpirationTime(); assertEquals(firstTTLExpiryTime, secondTTLExpiryTime); if ((secondIdleExpiryTime - firstIdleExpiryTime) <= 0) { fail(STR + firstIdleExpiryTime + STR + secondIdleExpiryTime); } } | /**
* Verify that accessing an entry does not delay expiration due to TTL
*/ | Verify that accessing an entry does not delay expiration due to TTL | testEntryIdleTtl | {
"repo_name": "smgoller/geode",
"path": "geode-dunit/src/main/java/org/apache/geode/cache30/RegionTestCase.java",
"license": "apache-2.0",
"size": 114817
} | [
"org.apache.geode.cache.ExpirationAction",
"org.apache.geode.cache.ExpirationAttributes",
"org.apache.geode.cache.RegionFactory",
"org.apache.geode.internal.cache.EntryExpiryTask",
"org.apache.geode.internal.cache.LocalRegion",
"org.apache.geode.test.dunit.Wait",
"org.junit.Assert"
] | import org.apache.geode.cache.ExpirationAction; import org.apache.geode.cache.ExpirationAttributes; import org.apache.geode.cache.RegionFactory; import org.apache.geode.internal.cache.EntryExpiryTask; import org.apache.geode.internal.cache.LocalRegion; import org.apache.geode.test.dunit.Wait; import org.junit.Assert; | import org.apache.geode.cache.*; import org.apache.geode.internal.cache.*; import org.apache.geode.test.dunit.*; import org.junit.*; | [
"org.apache.geode",
"org.junit"
] | org.apache.geode; org.junit; | 1,099,415 |
public Query asImmutable() {
return new ImmutableQueryImpl(this);
}
}
private static class ImmutableQueryImpl extends AbstractQueryImpl {
private final ImmutableList<Feature> list;
private ImmutableQueryImpl(List<Feature> list) {
this.list = ImmutableList.copyOf(list);
}
| Query function() { return new ImmutableQueryImpl(this); } } private static class ImmutableQueryImpl extends AbstractQueryImpl { private final ImmutableList<Feature> list; private ImmutableQueryImpl(List<Feature> list) { this.list = ImmutableList.copyOf(list); } | /**
* Returned value is a snapshot, i.e. will not change after the call.
*/ | Returned value is a snapshot, i.e. will not change after the call | asImmutable | {
"repo_name": "daisy/pipeline-issues",
"path": "modules/braille/common-utils/src/main/java/org/daisy/pipeline/braille/common/Query.java",
"license": "apache-2.0",
"size": 9296
} | [
"com.google.common.collect.ImmutableList",
"java.util.List"
] | import com.google.common.collect.ImmutableList; import java.util.List; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 1,985,533 |
public native void post(OcRepresentation ocRepresentation,
Map<String, String> queryParamsMap,
OnPostListener onPostListener) throws OcException; | native void function(OcRepresentation ocRepresentation, Map<String, String> queryParamsMap, OnPostListener onPostListener) throws OcException; | /**
* Method to POST on a resource
*
* @param ocRepresentation representation of the resource
* @param queryParamsMap Map which can have the query parameter name and value
* @param onPostListener event handler The event handler will be invoked with a map of
* attribute name and values.
* @throws OcException if failure
*/ | Method to POST on a resource | post | {
"repo_name": "iotk/iochibity-java",
"path": "jni-cxx/src/java/org/iotivity/base/OcResource.java",
"license": "epl-1.0",
"size": 23750
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 954,683 |
public void cleanupAllVolumes() throws IOException {
for (int v = 0; v < volumes.length; v++) {
// List all files inside the volumes
FileStatus[] files = null;
try {
files = localFileSystem.listStatus(new Path(volumes[v]));
} catch (Exception e) {
// Ignore exceptions in listStatus
// We tolerate missing volumes.
}
if (files != null) {
for (int f = 0; f < files.length; f++) {
// Get the file name - the last component of the Path
String entryName = files[f].getPath().getName();
// Do not delete the current TOBEDELETED
if (!TOBEDELETED.equals(entryName)) {
moveAndDeleteRelativePath(volumes[v], entryName);
}
}
}
}
} | void function() throws IOException { for (int v = 0; v < volumes.length; v++) { FileStatus[] files = null; try { files = localFileSystem.listStatus(new Path(volumes[v])); } catch (Exception e) { } if (files != null) { for (int f = 0; f < files.length; f++) { String entryName = files[f].getPath().getName(); if (!TOBEDELETED.equals(entryName)) { moveAndDeleteRelativePath(volumes[v], entryName); } } } } } | /**
* Move all files/directories inside volume into TOBEDELETED, and then
* delete them. The TOBEDELETED directory itself is ignored.
*/ | Move all files/directories inside volume into TOBEDELETED, and then delete them. The TOBEDELETED directory itself is ignored | cleanupAllVolumes | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/util/MRAsyncDiskService.java",
"license": "apache-2.0",
"size": 13634
} | [
"java.io.IOException",
"org.apache.hadoop.fs.FileStatus",
"org.apache.hadoop.fs.Path"
] | import java.io.IOException; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 256,433 |
public boolean checkUserControlItemGroup(String userId, EvalItemGroup itemGroup) {
log.debug("itemGroup: " + itemGroup.getId() + ", userId: " + userId);
if (! evalBeanUtils.checkUserPermission(userId, itemGroup.getOwner()) ) {
throw new SecurityException("User ("+userId+") cannot control itemGroup ("+itemGroup.getId()+") without permissions");
}
return true;
}
/**
* Check if user can control this AssignGroup/Hierarchy
* @param userId internal user id
* @param assignGroup can be an {@link EvalAssignGroup} or {@link EvalAssignHierarchy} | boolean function(String userId, EvalItemGroup itemGroup) { log.debug(STR + itemGroup.getId() + STR + userId); if (! evalBeanUtils.checkUserPermission(userId, itemGroup.getOwner()) ) { throw new SecurityException(STR+userId+STR+itemGroup.getId()+STR); } return true; } /** * Check if user can control this AssignGroup/Hierarchy * @param userId internal user id * @param assignGroup can be an {@link EvalAssignGroup} or {@link EvalAssignHierarchy} | /**
* Check if a user can control (remove/update) a template item
* @param userId internal user id
* @param itemGroup
* @return true if they can, false otherwise
* @throws SecurityException if user not allowed
*/ | Check if a user can control (remove/update) a template item | checkUserControlItemGroup | {
"repo_name": "buckett/evaluation",
"path": "impl/src/java/org/sakaiproject/evaluation/logic/externals/EvalSecurityChecksImpl.java",
"license": "apache-2.0",
"size": 18903
} | [
"org.sakaiproject.evaluation.model.EvalAssignGroup",
"org.sakaiproject.evaluation.model.EvalAssignHierarchy",
"org.sakaiproject.evaluation.model.EvalItemGroup"
] | import org.sakaiproject.evaluation.model.EvalAssignGroup; import org.sakaiproject.evaluation.model.EvalAssignHierarchy; import org.sakaiproject.evaluation.model.EvalItemGroup; | import org.sakaiproject.evaluation.model.*; | [
"org.sakaiproject.evaluation"
] | org.sakaiproject.evaluation; | 1,582,194 |
// TODO(crbug/1056346): onContentCreated is made public to allow access from InfoBar. Once
// InfoBar is modularized, restore access to package private.
public void onContentCreated() {
// Add the child views in the desired focus order.
if (mIconView != null) addView(mIconView);
addView(mMessageLayout);
for (View v : mControlLayouts) addView(v);
if (mButtonRowLayout != null) addView(mButtonRowLayout);
addView(mCloseButton);
} | void function() { if (mIconView != null) addView(mIconView); addView(mMessageLayout); for (View v : mControlLayouts) addView(v); if (mButtonRowLayout != null) addView(mButtonRowLayout); addView(mCloseButton); } | /**
* Must be called after the message, buttons, and custom content have been set, and before the
* first call to onMeasure().
*/ | Must be called after the message, buttons, and custom content have been set, and before the first call to onMeasure() | onContentCreated | {
"repo_name": "endlessm/chromium-browser",
"path": "chrome/browser/ui/messages/android/java/src/org/chromium/chrome/browser/ui/messages/infobar/InfoBarLayout.java",
"license": "bsd-3-clause",
"size": 24979
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 151,218 |
public static Path decodeUserHome(final String path) {
if (path != null && path.startsWith("~") && path.length() > 1) {
return Paths.get(System.getProperty("user.home")).resolve(path.substring(1));
} else {
return Paths.get(path);
}
} | static Path function(final String path) { if (path != null && path.startsWith("~") && path.length() > 1) { return Paths.get(System.getProperty(STR)).resolve(path.substring(1)); } else { return Paths.get(path); } } | /**
* Resolves the given path by means of eventually replacing <tt>~</tt> with the users
* home directory, taken from the system property <code>user.home</code>.
*
* @param path the path to resolve
* @return the resolved path
*/ | Resolves the given path by means of eventually replacing ~ with the users home directory, taken from the system property <code>user.home</code> | decodeUserHome | {
"repo_name": "opax/exist",
"path": "src/org/exist/util/ConfigurationHelper.java",
"license": "lgpl-2.1",
"size": 7091
} | [
"java.nio.file.Path",
"java.nio.file.Paths"
] | import java.nio.file.Path; import java.nio.file.Paths; | import java.nio.file.*; | [
"java.nio"
] | java.nio; | 1,777,659 |
public static void main(String[] args)
throws ClassNotFoundException, IOException, InterruptedException {
if (!new IsolationRunner().run(args)) {
System.exit(1);
}
} | static void function(String[] args) throws ClassNotFoundException, IOException, InterruptedException { if (!new IsolationRunner().run(args)) { System.exit(1); } } | /**
* Run a single task.
*
* @param args the first argument is the task directory
*/ | Run a single task | main | {
"repo_name": "rekhajoshm/mapreduce-fork",
"path": "src/java/org/apache/hadoop/mapred/IsolationRunner.java",
"license": "apache-2.0",
"size": 8651
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,617,244 |
boolean matchesSearch(@NonNull String search); | boolean matchesSearch(@NonNull String search); | /**
* Returns true when card matches the search string, false otherwise.
*
* @param search
* @return
*/ | Returns true when card matches the search string, false otherwise | matchesSearch | {
"repo_name": "futurice/vor",
"path": "vor-android/mobile/src/main/java/com/futurice/vor/card/ICard.java",
"license": "mit",
"size": 1257
} | [
"android.support.annotation.NonNull"
] | import android.support.annotation.NonNull; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,479,946 |
private void replaceTop(JsonScope newTop) {
stack.set(stack.size() - 1, newTop);
} | void function(JsonScope newTop) { stack.set(stack.size() - 1, newTop); } | /**
* Replace the value on the top of the stack with the given value.
*/ | Replace the value on the top of the stack with the given value | replaceTop | {
"repo_name": "EuphoriaDev/app-common",
"path": "library/src/main/java/ru/euphoria/commons/io/JsonReader.java",
"license": "mit",
"size": 33107
} | [
"ru.euphoria.commons.json.JsonScope"
] | import ru.euphoria.commons.json.JsonScope; | import ru.euphoria.commons.json.*; | [
"ru.euphoria.commons"
] | ru.euphoria.commons; | 1,644,853 |
public com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage getDigitalPackage(String orderId, String digitalPackageId, String responseFields) throws Exception
{
MozuClient<com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage> client = com.mozu.api.clients.commerce.orders.DigitalPackageClient.getDigitalPackageClient( orderId, digitalPackageId, responseFields);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
}
| com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage function(String orderId, String digitalPackageId, String responseFields) throws Exception { MozuClient<com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage> client = com.mozu.api.clients.commerce.orders.DigitalPackageClient.getDigitalPackageClient( orderId, digitalPackageId, responseFields); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* This operation retreives a digital package within an order and it requires two parameters: orderId and digitalPackageId.
* <p><pre><code>
* DigitalPackage digitalpackage = new DigitalPackage();
* DigitalPackage digitalPackage = digitalpackage.getDigitalPackage( orderId, digitalPackageId, responseFields);
* </code></pre></p>
* @param digitalPackageId This parameter supplies package ID to get fulfillment actions for the digital package.
* @param orderId Unique identifier of the order.
* @param responseFields Use this field to include those fields which are not included by default.
* @return com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage
* @see com.mozu.api.contracts.commerceruntime.fulfillment.DigitalPackage
*/ | This operation retreives a digital package within an order and it requires two parameters: orderId and digitalPackageId. <code><code> DigitalPackage digitalpackage = new DigitalPackage(); DigitalPackage digitalPackage = digitalpackage.getDigitalPackage( orderId, digitalPackageId, responseFields); </code></code> | getDigitalPackage | {
"repo_name": "johngatti/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/resources/commerce/orders/DigitalPackageResource.java",
"license": "mit",
"size": 10407
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 900,026 |
public int getToolButtonCount() {
final HorizontalPanel titleBar = (HorizontalPanel) super.getWidget(HEADER_INDEX);
final FlowPanel toolButtonPanel = (FlowPanel) titleBar.getWidget(1);
return toolButtonPanel.getWidgetCount();
} | int function() { final HorizontalPanel titleBar = (HorizontalPanel) super.getWidget(HEADER_INDEX); final FlowPanel toolButtonPanel = (FlowPanel) titleBar.getWidget(1); return toolButtonPanel.getWidgetCount(); } | /**
* Returns the current number of tool buttons displayed by this panel.
* @return the number of tool button.
*/ | Returns the current number of tool buttons displayed by this panel | getToolButtonCount | {
"repo_name": "spMohanty/sigmah_svn_to_git_migration_test",
"path": "sigmah/src/main/java/org/sigmah/client/ui/FoldPanel.java",
"license": "gpl-3.0",
"size": 8194
} | [
"com.google.gwt.user.client.ui.FlowPanel",
"com.google.gwt.user.client.ui.HorizontalPanel"
] | import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HorizontalPanel; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 877,764 |
public NoopSearchRequestBuilder setFetchSource(@Nullable String[] includes, @Nullable String[] excludes) {
sourceBuilder().fetchSource(includes, excludes);
return this;
} | NoopSearchRequestBuilder function(@Nullable String[] includes, @Nullable String[] excludes) { sourceBuilder().fetchSource(includes, excludes); return this; } | /**
* Indicate that _source should be returned with every hit, with an "include" and/or "exclude" set which can include simple wildcard
* elements.
*
* @param includes An optional list of include (optionally wildcarded) pattern to filter the returned _source
* @param excludes An optional list of exclude (optionally wildcarded) pattern to filter the returned _source
*/ | Indicate that _source should be returned with every hit, with an "include" and/or "exclude" set which can include simple wildcard elements | setFetchSource | {
"repo_name": "strahanjen/strahanjen.github.io",
"path": "elasticsearch-master/client/client-benchmark-noop-api-plugin/src/main/java/org/elasticsearch/plugin/noop/action/search/NoopSearchRequestBuilder.java",
"license": "bsd-3-clause",
"size": 16701
} | [
"org.elasticsearch.common.Nullable"
] | import org.elasticsearch.common.Nullable; | import org.elasticsearch.common.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 45,880 |
@Override
public Adapter createResourceAdapter() {
if (resourceItemProvider == null) {
resourceItemProvider = new ResourceItemProvider(this);
}
return resourceItemProvider;
}
protected ResourcesTypeItemProvider resourcesTypeItemProvider;
| Adapter function() { if (resourceItemProvider == null) { resourceItemProvider = new ResourceItemProvider(this); } return resourceItemProvider; } protected ResourcesTypeItemProvider resourcesTypeItemProvider; | /**
* This creates an adapter for a {@link eu.hohenegger.xsd.pom.Resource}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This creates an adapter for a <code>eu.hohenegger.xsd.pom.Resource</code>. | createResourceAdapter | {
"repo_name": "Treehopper/EclipseAugments",
"path": "pom-editor/eu.hohenegger.xsd.pom.ui/src-gen/eu/hohenegger/xsd/pom/provider/PomItemProviderAdapterFactory.java",
"license": "epl-1.0",
"size": 67666
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,740,828 |
private boolean validateObject(Object actual, Object expected)
throws AssertionError {
// check if primitive or String or java lang object
DataTypeEnum type = ObjectUtil.resolveType(actual.getClass());
if (type.equals(DataTypeEnum.JAVA_DOT_LANG_OBJECT) || type.equals(DataTypeEnum.STRING)
|| actual.getClass().isPrimitive()) {
return validatePrimitiveField(actual, expected);
}
Method[] expectedMethods = actual.getClass().getDeclaredMethods();
Class clazz = actual.getClass();
// check every field matches
// condition every field value must match
boolean isMatched = false;
for (Method m : expectedMethods) {
int numberOfArgs = m.getParameterTypes().length;
String methodName = m.getName();
if ((numberOfArgs != 0) || (!methodName.startsWith("get"))) {
continue;
}
if (!matchFieldName(methodName, clazz)) {
// raise a failure
AssertionUtils.jettAssertFalse(" Expected field name " + methodName + " not found ", true);
return false;
}
isMatched = validateField(m, actual, expected);
if (!isMatched) {
return false;
}
}
return isMatched;
} | boolean function(Object actual, Object expected) throws AssertionError { DataTypeEnum type = ObjectUtil.resolveType(actual.getClass()); if (type.equals(DataTypeEnum.JAVA_DOT_LANG_OBJECT) type.equals(DataTypeEnum.STRING) actual.getClass().isPrimitive()) { return validatePrimitiveField(actual, expected); } Method[] expectedMethods = actual.getClass().getDeclaredMethods(); Class clazz = actual.getClass(); boolean isMatched = false; for (Method m : expectedMethods) { int numberOfArgs = m.getParameterTypes().length; String methodName = m.getName(); if ((numberOfArgs != 0) (!methodName.startsWith("get"))) { continue; } if (!matchFieldName(methodName, clazz)) { AssertionUtils.jettAssertFalse(STR + methodName + STR, true); return false; } isMatched = validateField(m, actual, expected); if (!isMatched) { return false; } } return isMatched; } | /**
* main validation function for expected/actual object comparison
* if actual object is primitive, java.dot.lang.* or String then {@link #validatePrimitiveField(Object, Object)} is
* used for comparison, otherwise get* () methods of expected object are used for comparison
*
* @param actual
* @param expected
* @return true if every get*() function value of expected object matches to each field value of actual object respectively.
* @throws AssertionError
*/ | main validation function for expected/actual object comparison if actual object is primitive, java.dot.lang.* or String then <code>#validatePrimitiveField(Object, Object)</code> is used for comparison, otherwise get* () methods of expected object are used for comparison | validateObject | {
"repo_name": "eswdd/disco",
"path": "disco-test/disco-test-utils/src/main/java/uk/co/exemel/testing/utils/disco/assertions/SetAssertion.java",
"license": "apache-2.0",
"size": 14074
} | [
"java.lang.reflect.Method",
"uk.co.exemel.testing.utils.disco.misc.DataTypeEnum",
"uk.co.exemel.testing.utils.disco.misc.ObjectUtil"
] | import java.lang.reflect.Method; import uk.co.exemel.testing.utils.disco.misc.DataTypeEnum; import uk.co.exemel.testing.utils.disco.misc.ObjectUtil; | import java.lang.reflect.*; import uk.co.exemel.testing.utils.disco.misc.*; | [
"java.lang",
"uk.co.exemel"
] | java.lang; uk.co.exemel; | 2,793,431 |
public List<Address> listAddresses (int confirmations) throws APIException, IOException {
Map<String, String> params = buildBasicRequest();
params.put("confirmations", String.valueOf(confirmations));
String response = HttpClient.getInstance().get(serviceURL, String.format("merchant/%s/list", identifier), params);
JsonObject topElem = parseResponse(response);
List<Address> addresses = new ArrayList<Address>();
for (JsonElement jAddr : topElem.get("addresses").getAsJsonArray()) {
JsonObject a = jAddr.getAsJsonObject();
Address address = new Address(a.get("balance").getAsLong(), a.get("address").getAsString(), a.has("label") && !a.get("label").isJsonNull() ? a.get("label").getAsString() : null, a.get("total_received").getAsLong());
addresses.add(address);
}
return addresses;
} | List<Address> function (int confirmations) throws APIException, IOException { Map<String, String> params = buildBasicRequest(); params.put(STR, String.valueOf(confirmations)); String response = HttpClient.getInstance().get(serviceURL, String.format(STR, identifier), params); JsonObject topElem = parseResponse(response); List<Address> addresses = new ArrayList<Address>(); for (JsonElement jAddr : topElem.get(STR).getAsJsonArray()) { JsonObject a = jAddr.getAsJsonObject(); Address address = new Address(a.get(STR).getAsLong(), a.get(STR).getAsString(), a.has("label") && !a.get("label").isJsonNull() ? a.get("label").getAsString() : null, a.get(STR).getAsLong()); addresses.add(address); } return addresses; } | /**
* Lists all active addresses in the wallet.
*
* @param confirmations Minimum number of confirmations transactions
* must have before being included in the balance of addresses (can be 0)
* @return A list of Address objects
* @throws APIException If the server returns an error
*/ | Lists all active addresses in the wallet | listAddresses | {
"repo_name": "bcvictor/BitcoinRandomnessBeacon",
"path": "src/main/java/info/blockchain/api/wallet/Wallet.java",
"license": "mit",
"size": 11864
} | [
"com.google.gson.JsonElement",
"com.google.gson.JsonObject",
"info.blockchain.api.APIException",
"info.blockchain.api.HttpClient",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import com.google.gson.JsonElement; import com.google.gson.JsonObject; import info.blockchain.api.APIException; import info.blockchain.api.HttpClient; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; | import com.google.gson.*; import info.blockchain.api.*; import java.io.*; import java.util.*; | [
"com.google.gson",
"info.blockchain.api",
"java.io",
"java.util"
] | com.google.gson; info.blockchain.api; java.io; java.util; | 2,459,534 |
public List<String> getFunctions(String dbName, String pattern) throws MetaException; | List<String> function(String dbName, String pattern) throws MetaException; | /**
* Retrieve list of function names based on name pattern.
* @param dbName
* @param pattern
* @return
* @throws MetaException
*/ | Retrieve list of function names based on name pattern | getFunctions | {
"repo_name": "brightchen/Impala",
"path": "thirdparty/hive-1.1.0-cdh5.7.0-SNAPSHOT/src/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java",
"license": "apache-2.0",
"size": 24650
} | [
"java.util.List",
"org.apache.hadoop.hive.metastore.api.MetaException"
] | import java.util.List; import org.apache.hadoop.hive.metastore.api.MetaException; | import java.util.*; import org.apache.hadoop.hive.metastore.api.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 2,892,848 |
@Override
public String getText(Object object) {
SimulationConfiguration simulationConfiguration = (SimulationConfiguration)object;
return getString("_UI_SimulationConfiguration_type") + " " + simulationConfiguration.getOnResettingDuration();
}
| String function(Object object) { SimulationConfiguration simulationConfiguration = (SimulationConfiguration)object; return getString(STR) + " " + simulationConfiguration.getOnResettingDuration(); } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "BaSys-PC1/models",
"path": "de.dfki.iui.basys.model.runtime.edit/src/de/dfki/iui/basys/model/runtime/component/provider/SimulationConfigurationItemProvider.java",
"license": "epl-1.0",
"size": 17784
} | [
"de.dfki.iui.basys.model.runtime.component.SimulationConfiguration"
] | import de.dfki.iui.basys.model.runtime.component.SimulationConfiguration; | import de.dfki.iui.basys.model.runtime.component.*; | [
"de.dfki.iui"
] | de.dfki.iui; | 2,156,419 |
private boolean checkPathLength(String src) {
Path srcPath = new Path(src);
return (src.length() <= MAX_PATH_LENGTH &&
srcPath.depth() <= MAX_PATH_DEPTH);
} | boolean function(String src) { Path srcPath = new Path(src); return (src.length() <= MAX_PATH_LENGTH && srcPath.depth() <= MAX_PATH_DEPTH); } | /**
* Check path length does not exceed maximum. Returns true if
* length and depth are okay. Returns false if length is too long
* or depth is too great.
*/ | Check path length does not exceed maximum. Returns true if length and depth are okay. Returns false if length is too long or depth is too great | checkPathLength | {
"repo_name": "zjshen/hadoop-in-docker",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java",
"license": "apache-2.0",
"size": 74369
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,423,770 |
private void computeNodeLogPrior(
HashMap<SGHLDANode, Double> nodeLogProbs,
SGHLDANode curNode,
double parentLogProb) {
nodeLogProbs.put(curNode, parentLogProb);
if (!isLeafNode(curNode)) {
int curLevel = curNode.getLevel();
double logNorm = Math.log(curNode.getNumCustomers() + gammas[curLevel]);
// pseudo child
double pseudoChildLogProb = logGammas[curLevel] - logNorm;
nodeLogProbs.put(curNode.getPseudoChild(), pseudoChildLogProb);
for (SGHLDANode child : curNode.getChildren()) {
double childLogProb = Math.log(child.getNumCustomers()) - logNorm;
computeNodeLogPrior(nodeLogProbs, child, childLogProb);
}
}
} | void function( HashMap<SGHLDANode, Double> nodeLogProbs, SGHLDANode curNode, double parentLogProb) { nodeLogProbs.put(curNode, parentLogProb); if (!isLeafNode(curNode)) { int curLevel = curNode.getLevel(); double logNorm = Math.log(curNode.getNumCustomers() + gammas[curLevel]); double pseudoChildLogProb = logGammas[curLevel] - logNorm; nodeLogProbs.put(curNode.getPseudoChild(), pseudoChildLogProb); for (SGHLDANode child : curNode.getChildren()) { double childLogProb = Math.log(child.getNumCustomers()) - logNorm; computeNodeLogPrior(nodeLogProbs, child, childLogProb); } } } | /**
* Compute the log prior of all possible nodes in the tree. The probability
* associated with each node is the probability of the path from the root to
* the given node.
*
* @param nodeLogProbs Hash table to store results
* @param curNode The current node
* @param parentLogProb The log probability passed from the parent node
*/ | Compute the log prior of all possible nodes in the tree. The probability associated with each node is the probability of the path from the root to the given node | computeNodeLogPrior | {
"repo_name": "vietansegan/segan",
"path": "src/sampler/backup/SGHLDASampler.java",
"license": "apache-2.0",
"size": 103253
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,705,201 |
public boolean getBotVerified(String channel) {
JSONObject jsonInput = GetData(request_type.GET, base_url + "/users/" + getIDFromChannel(channel) + "/chat", false);
if (jsonInput.has("is_verified_bot")) {
return jsonInput.getBoolean("is_verified_bot");
}
return false;
} | boolean function(String channel) { JSONObject jsonInput = GetData(request_type.GET, base_url + STR + getIDFromChannel(channel) + "/chat", false); if (jsonInput.has(STR)) { return jsonInput.getBoolean(STR); } return false; } | /**
* Checks to see if the bot account is verified by Twitch.
*
* @param channel
* @return boolean true if verified
*/ | Checks to see if the bot account is verified by Twitch | getBotVerified | {
"repo_name": "ScaniaTV/PhantomBot",
"path": "source/com/gmt2001/TwitchAPIv5.java",
"license": "gpl-3.0",
"size": 31150
} | [
"org.json.JSONObject"
] | import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 827,002 |
@Test
public void testReadDatasetMetadata() throws Exception {
MetadataDocument document = getDocument("dataset_metadata.xml");
Date date = document.getDatasetPublicationDate();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
assertEquals(2013, calendar.get(Calendar.YEAR));
assertEquals(Calendar.NOVEMBER, calendar.get(Calendar.MONTH));
assertEquals(19, calendar.get(Calendar.DAY_OF_MONTH));
String result = document.getDatasetResponsiblePartyName("custodian");
assertTrue("wrong ResponsiblePartyName", result.startsWith("Provincie Overijssel"));
result = document.getDatasetResponsiblePartyEmail("custodian");
assertTrue("wrong ResponsiblePartyEmail", result.startsWith("[email protected]"));
result = document.getDatasetResponsiblePartyName("owner");
assertTrue("wrong ResponsiblePartyName", result.startsWith("Provincie Overijssel:"));
result = document.getDatasetResponsiblePartyEmail("owner");
assertTrue("wrong ResponsiblePartyEmail", result.startsWith("[email protected]"));
result = document.getMetaDataIdentifier();
assertTrue("wrong MetaDataIdentifier", result.startsWith("46647460-d8cf-4955-bcac-f1c192d57cc4"));
result = document.getMetaDataCreationDate();
assertTrue("wrong MetaDataCreationDate", result.startsWith("2014-04-11"));
List<String> results = document.getSupplementalInformation();
assertNotNull(results);
assertEquals("wrong SupplementalInformation", Arrays.asList("layerfile| http:\\\\localhost:7000\\GeoPortal\\MIS4GIS\\lyr\\gemgrens_polygon.lyr"), results);
}
| void function() throws Exception { MetadataDocument document = getDocument(STR); Date date = document.getDatasetPublicationDate(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); assertEquals(2013, calendar.get(Calendar.YEAR)); assertEquals(Calendar.NOVEMBER, calendar.get(Calendar.MONTH)); assertEquals(19, calendar.get(Calendar.DAY_OF_MONTH)); String result = document.getDatasetResponsiblePartyName(STR); assertTrue(STR, result.startsWith(STR)); result = document.getDatasetResponsiblePartyEmail(STR); assertTrue(STR, result.startsWith(STR)); result = document.getDatasetResponsiblePartyName("owner"); assertTrue(STR, result.startsWith(STR)); result = document.getDatasetResponsiblePartyEmail("owner"); assertTrue(STR, result.startsWith(STR)); result = document.getMetaDataIdentifier(); assertTrue(STR, result.startsWith(STR)); result = document.getMetaDataCreationDate(); assertTrue(STR, result.startsWith(STR)); List<String> results = document.getSupplementalInformation(); assertNotNull(results); assertEquals(STR, Arrays.asList(STR), results); } | /**
*
* Dataset metadata: read several items
*/ | Dataset metadata: read several items | testReadDatasetMetadata | {
"repo_name": "IDgis/geo-publisher",
"path": "publisher-commons/src/test/java/nl/idgis/publisher/metadata/MetadataDocumentTest.java",
"license": "lgpl-2.1",
"size": 25832
} | [
"java.util.Arrays",
"java.util.Calendar",
"java.util.Date",
"java.util.List",
"org.junit.Assert"
] | import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.List; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 1,625,042 |
@Test
public void testGetNodeData() throws Exception {
CuratorStateManager spyStateManager = spy(new CuratorStateManager());
final CuratorFramework mockClient = mock(CuratorFramework.class);
GetDataBuilder mockGetBuilder = mock(GetDataBuilder.class);
// Mockito doesn't support mock type-parametrized class, thus suppress the warning
@SuppressWarnings("rawtypes")
BackgroundPathable mockBackPathable = mock(BackgroundPathable.class);
final CuratorEvent mockEvent = mock(CuratorEvent.class);
Message.Builder mockBuilder = mock(Message.Builder.class);
Message mockMessage = mock(Message.class);
final byte[] data = "wy_1989".getBytes(); | void function() throws Exception { CuratorStateManager spyStateManager = spy(new CuratorStateManager()); final CuratorFramework mockClient = mock(CuratorFramework.class); GetDataBuilder mockGetBuilder = mock(GetDataBuilder.class); @SuppressWarnings(STR) BackgroundPathable mockBackPathable = mock(BackgroundPathable.class); final CuratorEvent mockEvent = mock(CuratorEvent.class); Message.Builder mockBuilder = mock(Message.Builder.class); Message mockMessage = mock(Message.class); final byte[] data = STR.getBytes(); | /**
* Test getNodeData method
* @throws Exception
*/ | Test getNodeData method | testGetNodeData | {
"repo_name": "wangli1426/heron",
"path": "heron/statemgrs/tests/java/com/twitter/heron/statemgr/zookeeper/curator/CuratorStateManagerTest.java",
"license": "apache-2.0",
"size": 11963
} | [
"com.google.protobuf.Message",
"org.apache.curator.framework.CuratorFramework",
"org.apache.curator.framework.api.BackgroundPathable",
"org.apache.curator.framework.api.CuratorEvent",
"org.apache.curator.framework.api.GetDataBuilder",
"org.mockito.Mockito"
] | import com.google.protobuf.Message; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.api.BackgroundPathable; import org.apache.curator.framework.api.CuratorEvent; import org.apache.curator.framework.api.GetDataBuilder; import org.mockito.Mockito; | import com.google.protobuf.*; import org.apache.curator.framework.*; import org.apache.curator.framework.api.*; import org.mockito.*; | [
"com.google.protobuf",
"org.apache.curator",
"org.mockito"
] | com.google.protobuf; org.apache.curator; org.mockito; | 408,845 |
@Nullable
Property getData() throws RepositoryException; | Property getData() throws RepositoryException; | /**
* Returns the jcr:data property of the package
* @return the jcr:data property
* @throws RepositoryException if an error occurrs
*/ | Returns the jcr:data property of the package | getData | {
"repo_name": "tripodsan/jackrabbit-filevault",
"path": "vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/JcrPackage.java",
"license": "apache-2.0",
"size": 9332
} | [
"javax.jcr.Property",
"javax.jcr.RepositoryException"
] | import javax.jcr.Property; import javax.jcr.RepositoryException; | import javax.jcr.*; | [
"javax.jcr"
] | javax.jcr; | 2,409,662 |
public void write(OutputStream stream, Object o) throws Exception {
toXML(o).write(stream);
} | void function(OutputStream stream, Object o) throws Exception { toXML(o).write(stream); } | /**
* writes the given object into the stream
*
* @param stream the filename to write to
* @param o the object to serialize as XML
* @throws Exception if something goes wrong with the parsing
*/ | writes the given object into the stream | write | {
"repo_name": "williamClanton/singularity",
"path": "weka/src/main/java/weka/core/xml/XMLSerialization.java",
"license": "mit",
"size": 59593
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 503,470 |
public java.util.List<com.floreantpos.model.Gratuity> findAll (Order defaultOrder) {
return super.findAll(defaultOrder);
}
| java.util.List<com.floreantpos.model.Gratuity> function (Order defaultOrder) { return super.findAll(defaultOrder); } | /**
* Return all objects related to the implementation of this DAO with no filter.
*/ | Return all objects related to the implementation of this DAO with no filter | findAll | {
"repo_name": "meyerdg/floreant",
"path": "src/com/floreantpos/model/dao/BaseGratuityDAO.java",
"license": "gpl-2.0",
"size": 8137
} | [
"org.hibernate.criterion.Order"
] | import org.hibernate.criterion.Order; | import org.hibernate.criterion.*; | [
"org.hibernate.criterion"
] | org.hibernate.criterion; | 310,194 |
public void addHeader(String s) {
header.add(s);
data.put(s, new ArrayList<>(Math.max(size(), 100)));
}
| void function(String s) { header.add(s); data.put(s, new ArrayList<>(Math.max(size(), 100))); } | /**
* Adds a header name to the Data object.
*
* @param s
* name of header.
*/ | Adds a header name to the Data object | addHeader | {
"repo_name": "yuyupapa/OpenSource",
"path": "apache-jmeter-3.0/src/jorphan/org/apache/jorphan/collections/Data.java",
"license": "apache-2.0",
"size": 21059
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 2,566,543 |
@Action(name = "list")
@Nonnull
@WithSpan
public Task<IngestionRunSummaryArray> list(@ActionParam("pageOffset") @Optional @Nullable Integer pageOffset,
@ActionParam("pageSize") @Optional @Nullable Integer pageSize) {
log.info("LIST RUNS offset: {} size: {}", pageOffset, pageSize);
return RestliUtil.toTask(() -> new IngestionRunSummaryArray(
_systemMetadataService.listRuns(pageOffset != null ? pageOffset : DEFAULT_OFFSET,
pageSize != null ? pageSize : DEFAULT_PAGE_SIZE)), MetricRegistry.name(this.getClass(), "list"));
} | @Action(name = "list") Task<IngestionRunSummaryArray> function(@ActionParam(STR) @Optional @Nullable Integer pageOffset, @ActionParam(STR) @Optional @Nullable Integer pageSize) { log.info(STR, pageOffset, pageSize); return RestliUtil.toTask(() -> new IngestionRunSummaryArray( _systemMetadataService.listRuns(pageOffset != null ? pageOffset : DEFAULT_OFFSET, pageSize != null ? pageSize : DEFAULT_PAGE_SIZE)), MetricRegistry.name(this.getClass(), "list")); } | /**
* Retrieves the value for an entity that is made up of latest versions of specified aspects.
*/ | Retrieves the value for an entity that is made up of latest versions of specified aspects | list | {
"repo_name": "linkedin/WhereHows",
"path": "metadata-service/restli-servlet-impl/src/main/java/com/linkedin/metadata/resources/entity/BatchIngestionRunResource.java",
"license": "apache-2.0",
"size": 5784
} | [
"com.codahale.metrics.MetricRegistry",
"com.linkedin.metadata.restli.RestliUtil",
"com.linkedin.metadata.run.IngestionRunSummaryArray",
"com.linkedin.parseq.Task",
"com.linkedin.restli.server.annotations.Action",
"com.linkedin.restli.server.annotations.ActionParam",
"com.linkedin.restli.server.annotations.Optional",
"javax.annotation.Nullable"
] | import com.codahale.metrics.MetricRegistry; import com.linkedin.metadata.restli.RestliUtil; import com.linkedin.metadata.run.IngestionRunSummaryArray; import com.linkedin.parseq.Task; import com.linkedin.restli.server.annotations.Action; import com.linkedin.restli.server.annotations.ActionParam; import com.linkedin.restli.server.annotations.Optional; import javax.annotation.Nullable; | import com.codahale.metrics.*; import com.linkedin.metadata.restli.*; import com.linkedin.metadata.run.*; import com.linkedin.parseq.*; import com.linkedin.restli.server.annotations.*; import javax.annotation.*; | [
"com.codahale.metrics",
"com.linkedin.metadata",
"com.linkedin.parseq",
"com.linkedin.restli",
"javax.annotation"
] | com.codahale.metrics; com.linkedin.metadata; com.linkedin.parseq; com.linkedin.restli; javax.annotation; | 494,503 |
public void unmutePicture() throws SonyProjectorException {
setSetting(SonyProjectorItem.PICTURE_MUTING, PICTURE_OFF);
} | void function() throws SonyProjectorException { setSetting(SonyProjectorItem.PICTURE_MUTING, PICTURE_OFF); } | /**
* Request the projector to unmute the picture
*
* @throws SonyProjectorException - In case of any problem
*/ | Request the projector to unmute the picture | unmutePicture | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/SonyProjectorConnector.java",
"license": "epl-1.0",
"size": 43215
} | [
"org.openhab.binding.sonyprojector.internal.SonyProjectorException"
] | import org.openhab.binding.sonyprojector.internal.SonyProjectorException; | import org.openhab.binding.sonyprojector.internal.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 93,697 |
public static boolean hasPasswordlessAuthenticationAccount(final RequestContext requestContext) {
return requestContext.getFlowScope().contains("passwordlessAccount");
} | static boolean function(final RequestContext requestContext) { return requestContext.getFlowScope().contains(STR); } | /**
* Has passwordless authentication account.
*
* @param requestContext the request context
* @return the boolean
*/ | Has passwordless authentication account | hasPasswordlessAuthenticationAccount | {
"repo_name": "GIP-RECIA/cas",
"path": "core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java",
"license": "apache-2.0",
"size": 37755
} | [
"org.springframework.webflow.execution.RequestContext"
] | import org.springframework.webflow.execution.RequestContext; | import org.springframework.webflow.execution.*; | [
"org.springframework.webflow"
] | org.springframework.webflow; | 2,150,091 |
@Override
@GET
@GZIP
@Produces("application/json")
@Path("node/mbean")
public Object getNodeMBeanInfo(@HeaderParam("sessionid") String sessionId,
@QueryParam("nodejmxurl") String nodeJmxUrl, @QueryParam("objectname") String objectName,
@QueryParam("attrs") List<String> attrs)
throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException,
NotConnectedException, MalformedObjectNameException, NullPointerException {
// checking that still connected to the RM
RMProxyUserInterface rmProxy = checkAccess(sessionId);
return rmProxy.getNodeMBeanInfo(nodeJmxUrl, objectName, attrs);
} | @Produces(STR) @Path(STR) Object function(@HeaderParam(STR) String sessionId, @QueryParam(STR) String nodeJmxUrl, @QueryParam(STR) String objectName, @QueryParam("attrs") List<String> attrs) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException, NotConnectedException, MalformedObjectNameException, NullPointerException { RMProxyUserInterface rmProxy = checkAccess(sessionId); return rmProxy.getNodeMBeanInfo(nodeJmxUrl, objectName, attrs); } | /**
* Retrieves attributes of the specified mbean.
*
* @param sessionId current session
* @param nodeJmxUrl mbean server url
* @param objectName name of mbean
* @param attrs set of mbean attributes
*
* @return mbean attributes values
*/ | Retrieves attributes of the specified mbean | getNodeMBeanInfo | {
"repo_name": "laurianed/scheduling",
"path": "rest/rest-server/src/main/java/org/ow2/proactive_grid_cloud_portal/rm/RMRest.java",
"license": "agpl-3.0",
"size": 36732
} | [
"java.io.IOException",
"java.util.List",
"javax.management.InstanceNotFoundException",
"javax.management.IntrospectionException",
"javax.management.MalformedObjectNameException",
"javax.management.ReflectionException",
"javax.ws.rs.HeaderParam",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface",
"org.ow2.proactive.scheduler.common.exception.NotConnectedException"
] | import java.io.IOException; import java.util.List; import javax.management.InstanceNotFoundException; import javax.management.IntrospectionException; import javax.management.MalformedObjectNameException; import javax.management.ReflectionException; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import org.ow2.proactive.resourcemanager.common.util.RMProxyUserInterface; import org.ow2.proactive.scheduler.common.exception.NotConnectedException; | import java.io.*; import java.util.*; import javax.management.*; import javax.ws.rs.*; import org.ow2.proactive.resourcemanager.common.util.*; import org.ow2.proactive.scheduler.common.exception.*; | [
"java.io",
"java.util",
"javax.management",
"javax.ws",
"org.ow2.proactive"
] | java.io; java.util; javax.management; javax.ws; org.ow2.proactive; | 520,849 |
@Override
public final Enumeration<String> getKeys() {
return new KeyEnum(getKeyConstants().getKeyNames());
}
private static final class KeyEnum implements Enumeration<String> {
private final String[] keys;
private int next;
KeyEnum(final String[] keys) {
this.keys = keys;
} | final Enumeration<String> function() { return new KeyEnum(getKeyConstants().getKeyNames()); } private static final class KeyEnum implements Enumeration<String> { private final String[] keys; private int next; KeyEnum(final String[] keys) { this.keys = keys; } | /**
* Returns an enumeration of the keys.
*
* @return all keys in this resource bundle.
*/ | Returns an enumeration of the keys | getKeys | {
"repo_name": "Geomatys/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java",
"license": "apache-2.0",
"size": 31782
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 776,694 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<SelfHostedIntegrationRuntimeNodeInner>> getWithResponseAsync(
String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, Context context) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (factoryName == null) {
return Mono.error(new IllegalArgumentException("Parameter factoryName is required and cannot be null."));
}
if (integrationRuntimeName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter integrationRuntimeName is required and cannot be null."));
}
if (nodeName == null) {
return Mono.error(new IllegalArgumentException("Parameter nodeName is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.get(
this.client.getEndpoint(),
this.client.getSubscriptionId(),
resourceGroupName,
factoryName,
integrationRuntimeName,
nodeName,
this.client.getApiVersion(),
accept,
context);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<SelfHostedIntegrationRuntimeNodeInner>> function( String resourceGroupName, String factoryName, String integrationRuntimeName, String nodeName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (factoryName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (integrationRuntimeName == null) { return Mono .error( new IllegalArgumentException(STR)); } if (nodeName == null) { return Mono.error(new IllegalArgumentException(STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, factoryName, integrationRuntimeName, nodeName, this.client.getApiVersion(), accept, context); } | /**
* Gets a self-hosted integration runtime node.
*
* @param resourceGroupName The resource group name.
* @param factoryName The factory name.
* @param integrationRuntimeName The integration runtime name.
* @param nodeName The integration runtime node name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a self-hosted integration runtime node along with {@link Response} on successful completion of {@link
* Mono}.
*/ | Gets a self-hosted integration runtime node | getWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/implementation/IntegrationRuntimeNodesClientImpl.java",
"license": "mit",
"size": 44878
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.datafactory.fluent.models.SelfHostedIntegrationRuntimeNodeInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.datafactory.fluent.models.SelfHostedIntegrationRuntimeNodeInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.datafactory.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 993,675 |
public void setSqlSessionFactoryBuilder(SqlSessionFactoryBuilder sqlSessionFactoryBuilder) {
this.sqlSessionFactoryBuilder = sqlSessionFactoryBuilder;
}
/**
* Set the MyBatis TransactionFactory to use. Default is {@code SpringManagedTransactionFactory} | void function(SqlSessionFactoryBuilder sqlSessionFactoryBuilder) { this.sqlSessionFactoryBuilder = sqlSessionFactoryBuilder; } /** * Set the MyBatis TransactionFactory to use. Default is {@code SpringManagedTransactionFactory} | /**
* Sets the {@code SqlSessionFactoryBuilder} to use when creating the {@code SqlSessionFactory}.
*
* This is mainly meant for testing so that mock SqlSessionFactory classes can be injected. By
* default, {@code SqlSessionFactoryBuilder} creates {@code DefaultSqlSessionFactory} instances.
*
*/ | Sets the SqlSessionFactoryBuilder to use when creating the SqlSessionFactory. This is mainly meant for testing so that mock SqlSessionFactory classes can be injected. By default, SqlSessionFactoryBuilder creates DefaultSqlSessionFactory instances | setSqlSessionFactoryBuilder | {
"repo_name": "chanedi/QuickProject",
"path": "QuickProject-Core/src/main/java/chanedi/dao/impl/mybatis/session/SqlSessionFactoryBean.java",
"license": "apache-2.0",
"size": 18608
} | [
"org.apache.ibatis.session.SqlSessionFactoryBuilder",
"org.apache.ibatis.transaction.TransactionFactory",
"org.mybatis.spring.transaction.SpringManagedTransactionFactory"
] | import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.apache.ibatis.transaction.TransactionFactory; import org.mybatis.spring.transaction.SpringManagedTransactionFactory; | import org.apache.ibatis.session.*; import org.apache.ibatis.transaction.*; import org.mybatis.spring.transaction.*; | [
"org.apache.ibatis",
"org.mybatis.spring"
] | org.apache.ibatis; org.mybatis.spring; | 419,544 |
public void setActivitySchedulingOptions(ActivitySchedulingOptions activitySchedulingOptions) {
this.activitySchedulingOptions = activitySchedulingOptions;
} | void function(ActivitySchedulingOptions activitySchedulingOptions) { this.activitySchedulingOptions = activitySchedulingOptions; } | /**
* Activity scheduling options
*/ | Activity scheduling options | setActivitySchedulingOptions | {
"repo_name": "adessaigne/camel",
"path": "components/camel-aws-swf/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java",
"license": "apache-2.0",
"size": 12420
} | [
"com.amazonaws.services.simpleworkflow.flow.ActivitySchedulingOptions"
] | import com.amazonaws.services.simpleworkflow.flow.ActivitySchedulingOptions; | import com.amazonaws.services.simpleworkflow.flow.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 2,267,740 |
@Test
public void testWithOneReader() throws Exception {
final int NUM_ELEMENTS = 20;
final Object checkpointLock = new Object();
PipelineOptions options = PipelineOptionsFactory.create();
// this source will emit exactly NUM_ELEMENTS across all parallel readers,
// afterwards it will stall. We check whether we also receive NUM_ELEMENTS
// elements later.
TestCountingSource source = new TestCountingSource(NUM_ELEMENTS);
UnboundedSourceWrapper<KV<Integer, Integer>, TestCountingSource.CounterMark> flinkWrapper =
new UnboundedSourceWrapper<>(options, source, 1);
assertEquals(1, flinkWrapper.getSplitSources().size());
StreamSource<
WindowedValue<KV<Integer, Integer>>,
UnboundedSourceWrapper<
KV<Integer, Integer>,
TestCountingSource.CounterMark>> sourceOperator = new StreamSource<>(flinkWrapper);
setupSourceOperator(sourceOperator);
try {
sourceOperator.run(checkpointLock,
new Output<StreamRecord<WindowedValue<KV<Integer, Integer>>>>() {
private int count = 0; | void function() throws Exception { final int NUM_ELEMENTS = 20; final Object checkpointLock = new Object(); PipelineOptions options = PipelineOptionsFactory.create(); TestCountingSource source = new TestCountingSource(NUM_ELEMENTS); UnboundedSourceWrapper<KV<Integer, Integer>, TestCountingSource.CounterMark> flinkWrapper = new UnboundedSourceWrapper<>(options, source, 1); assertEquals(1, flinkWrapper.getSplitSources().size()); StreamSource< WindowedValue<KV<Integer, Integer>>, UnboundedSourceWrapper< KV<Integer, Integer>, TestCountingSource.CounterMark>> sourceOperator = new StreamSource<>(flinkWrapper); setupSourceOperator(sourceOperator); try { sourceOperator.run(checkpointLock, new Output<StreamRecord<WindowedValue<KV<Integer, Integer>>>>() { private int count = 0; | /**
* Creates a {@link UnboundedSourceWrapper} that has exactly one reader per source, since we
* specify a parallelism of 1 and also at runtime tell the source that it has 1 parallel subtask.
*/ | Creates a <code>UnboundedSourceWrapper</code> that has exactly one reader per source, since we specify a parallelism of 1 and also at runtime tell the source that it has 1 parallel subtask | testWithOneReader | {
"repo_name": "tweise/beam",
"path": "runners/flink/runner/src/test/java/org/apache/beam/runners/flink/streaming/UnboundedSourceWrapperTest.java",
"license": "apache-2.0",
"size": 11545
} | [
"org.apache.beam.runners.flink.translation.wrappers.streaming.io.UnboundedSourceWrapper",
"org.apache.beam.sdk.options.PipelineOptions",
"org.apache.beam.sdk.options.PipelineOptionsFactory",
"org.apache.beam.sdk.util.WindowedValue",
"org.apache.flink.streaming.api.operators.Output",
"org.apache.flink.streaming.api.operators.StreamSource",
"org.apache.flink.streaming.runtime.streamrecord.StreamRecord",
"org.junit.Assert"
] | import org.apache.beam.runners.flink.translation.wrappers.streaming.io.UnboundedSourceWrapper; import org.apache.beam.sdk.options.PipelineOptions; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.util.WindowedValue; import org.apache.flink.streaming.api.operators.Output; import org.apache.flink.streaming.api.operators.StreamSource; import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; import org.junit.Assert; | import org.apache.beam.runners.flink.translation.wrappers.streaming.io.*; import org.apache.beam.sdk.options.*; import org.apache.beam.sdk.util.*; import org.apache.flink.streaming.api.operators.*; import org.apache.flink.streaming.runtime.streamrecord.*; import org.junit.*; | [
"org.apache.beam",
"org.apache.flink",
"org.junit"
] | org.apache.beam; org.apache.flink; org.junit; | 567,877 |
public int[] twoSumB(int[] nums, int target) {
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < nums.length; i++) {
int newTarget = target - nums[i];
if (map.containsKey(newTarget) && i != map.get(newTarget)) {
return new int[]{map.get(newTarget), i};
}
map.put(nums[i], i);
}
return null;
} | int[] function(int[] nums, int target) { Map<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < nums.length; i++) { int newTarget = target - nums[i]; if (map.containsKey(newTarget) && i != map.get(newTarget)) { return new int[]{map.get(newTarget), i}; } map.put(nums[i], i); } return null; } | /**
* Hash Table. One loop.
* Just put numbers into the map as looping through.
* So we can search numbers already looped in O(1).
* Note that if we find an answer, we current index will be larger than the index in map.
* So put it behind.
*/ | Hash Table. One loop. Just put numbers into the map as looping through. So we can search numbers already looped in O(1). Note that if we find an answer, we current index will be larger than the index in map. So put it behind | twoSumB | {
"repo_name": "bssrdf/LeetCode-Sol-Res",
"path": "src/com/freetymekiyan/algorithms/level/Medium/TwoSum.java",
"license": "mit",
"size": 3101
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,048,092 |
public void testOldVersion() throws SQLException
{
switch (getPhase())
{
case PH_CREATE:
case PH_POST_SOFT_UPGRADE:
DatabaseMetaData dmd = getConnection().getMetaData();
assertEquals("Old major (driver): ",
getOldMajor(), dmd.getDriverMajorVersion());
assertEquals("Old minor (driver): ",
getOldMinor(), dmd.getDriverMinorVersion());
assertEquals("Old major (database): ",
getOldMajor(), dmd.getDatabaseMajorVersion());
assertEquals("Old minor (database): ",
getOldMinor(), dmd.getDatabaseMinorVersion());
break;
}
} | void function() throws SQLException { switch (getPhase()) { case PH_CREATE: case PH_POST_SOFT_UPGRADE: DatabaseMetaData dmd = getConnection().getMetaData(); assertEquals(STR, getOldMajor(), dmd.getDriverMajorVersion()); assertEquals(STR, getOldMinor(), dmd.getDriverMinorVersion()); assertEquals(STR, getOldMajor(), dmd.getDatabaseMajorVersion()); assertEquals(STR, getOldMinor(), dmd.getDatabaseMinorVersion()); break; } } | /**
* Simple test of the old version from the meta data.
*/ | Simple test of the old version from the meta data | testOldVersion | {
"repo_name": "lpxz/grail-derby104",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/upgradeTests/BasicSetup.java",
"license": "apache-2.0",
"size": 18145
} | [
"java.sql.DatabaseMetaData",
"java.sql.SQLException"
] | import java.sql.DatabaseMetaData; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,340,266 |
@JsonProperty("status")
public String getStatus() {
return this.status;
} | @JsonProperty(STR) String function() { return this.status; } | /**
* "status": 'ok'
*/ | "status": 'ok' | getStatus | {
"repo_name": "paolodenti/openhab",
"path": "bundles/binding/org.openhab.binding.enphaseenergy/src/main/java/org/openhab/binding/enphaseenergy/internal/messages/SystemsResponse.java",
"license": "epl-1.0",
"size": 4503
} | [
"org.codehaus.jackson.annotate.JsonProperty"
] | import org.codehaus.jackson.annotate.JsonProperty; | import org.codehaus.jackson.annotate.*; | [
"org.codehaus.jackson"
] | org.codehaus.jackson; | 1,067,373 |
default AdvancedS3EndpointConsumerBuilder pollStrategy(
PollingConsumerPollStrategy pollStrategy) {
doSetProperty("pollStrategy", pollStrategy);
return this;
} | default AdvancedS3EndpointConsumerBuilder pollStrategy( PollingConsumerPollStrategy pollStrategy) { doSetProperty(STR, pollStrategy); return this; } | /**
* A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing
* you to provide your custom implementation to control error handling
* usually occurred during the poll operation before an Exchange have
* been created and being routed in Camel.
*
* The option is a:
* <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type.
*
* Group: consumer (advanced)
*/ | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. The option is a: <code>org.apache.camel.spi.PollingConsumerPollStrategy</code> type. Group: consumer (advanced) | pollStrategy | {
"repo_name": "DariusX/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/S3EndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 92676
} | [
"org.apache.camel.spi.PollingConsumerPollStrategy"
] | import org.apache.camel.spi.PollingConsumerPollStrategy; | import org.apache.camel.spi.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,518,783 |
final public Event getNextEvent() throws IOException {
return getNextElement();
}
| final Event function() throws IOException { return getNextElement(); } | /**
* Returns the next event in the event stream.
*
* @return The map of key-value pairs for an event.
* The format of multi-item values is implementation-specific.
* We recommend using the methods from the
* {@link Event} class to interpret multi-item values.
* @throws IOException On IO exception.
*/ | Returns the next event in the event stream | getNextEvent | {
"repo_name": "splunk/splunk-sdk-java",
"path": "splunk/src/main/java/com/splunk/ResultsReader.java",
"license": "apache-2.0",
"size": 6111
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,349,918 |
void enterDistinct(@NotNull CQLParser.DistinctContext ctx);
void exitDistinct(@NotNull CQLParser.DistinctContext ctx); | void enterDistinct(@NotNull CQLParser.DistinctContext ctx); void exitDistinct(@NotNull CQLParser.DistinctContext ctx); | /**
* Exit a parse tree produced by {@link CQLParser#distinct}.
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>CQLParser#distinct</code> | exitDistinct | {
"repo_name": "jack6215/StreamCQL",
"path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserListener.java",
"license": "apache-2.0",
"size": 62500
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,115,665 |
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.paint = SerialUtilities.readPaint(stream);
this.basePaint = SerialUtilities.readPaint(stream);
this.fillPaint = SerialUtilities.readPaint(stream);
this.baseFillPaint = SerialUtilities.readPaint(stream);
this.outlinePaint = SerialUtilities.readPaint(stream);
this.baseOutlinePaint = SerialUtilities.readPaint(stream);
this.stroke = SerialUtilities.readStroke(stream);
this.baseStroke = SerialUtilities.readStroke(stream);
this.outlineStroke = SerialUtilities.readStroke(stream);
this.baseOutlineStroke = SerialUtilities.readStroke(stream);
this.shape = SerialUtilities.readShape(stream);
this.baseShape = SerialUtilities.readShape(stream);
this.itemLabelPaint = SerialUtilities.readPaint(stream);
this.baseItemLabelPaint = SerialUtilities.readPaint(stream);
this.baseLegendShape = SerialUtilities.readShape(stream);
this.baseLegendTextPaint = SerialUtilities.readPaint(stream);
// listeners are not restored automatically, but storage must be
// provided...
this.listenerList = new EventListenerList();
}
// === DEPRECATED CODE ===
private Boolean seriesVisible;
private Boolean seriesVisibleInLegend;
private transient Paint paint;
private transient Paint fillPaint;
private transient Paint outlinePaint;
private transient Stroke stroke;
private transient Stroke outlineStroke;
private transient Shape shape;
private Boolean itemLabelsVisible;
private Font itemLabelFont;
private transient Paint itemLabelPaint;
private ItemLabelPosition positiveItemLabelPosition;
private ItemLabelPosition negativeItemLabelPosition;
private Boolean createEntities;
| void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.paint = SerialUtilities.readPaint(stream); this.basePaint = SerialUtilities.readPaint(stream); this.fillPaint = SerialUtilities.readPaint(stream); this.baseFillPaint = SerialUtilities.readPaint(stream); this.outlinePaint = SerialUtilities.readPaint(stream); this.baseOutlinePaint = SerialUtilities.readPaint(stream); this.stroke = SerialUtilities.readStroke(stream); this.baseStroke = SerialUtilities.readStroke(stream); this.outlineStroke = SerialUtilities.readStroke(stream); this.baseOutlineStroke = SerialUtilities.readStroke(stream); this.shape = SerialUtilities.readShape(stream); this.baseShape = SerialUtilities.readShape(stream); this.itemLabelPaint = SerialUtilities.readPaint(stream); this.baseItemLabelPaint = SerialUtilities.readPaint(stream); this.baseLegendShape = SerialUtilities.readShape(stream); this.baseLegendTextPaint = SerialUtilities.readPaint(stream); this.listenerList = new EventListenerList(); } private Boolean seriesVisible; private Boolean seriesVisibleInLegend; private transient Paint paint; private transient Paint fillPaint; private transient Paint outlinePaint; private transient Stroke stroke; private transient Stroke outlineStroke; private transient Shape shape; private Boolean itemLabelsVisible; private Font itemLabelFont; private transient Paint itemLabelPaint; private ItemLabelPosition positiveItemLabelPosition; private ItemLabelPosition negativeItemLabelPosition; private Boolean createEntities; | /**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/ | Provides serialization support | readObject | {
"repo_name": "sebkur/JFreeChart",
"path": "src/main/java/org/jfree/chart/renderer/AbstractRenderer.java",
"license": "lgpl-3.0",
"size": 142687
} | [
"java.awt.Font",
"java.awt.Paint",
"java.awt.Shape",
"java.awt.Stroke",
"java.io.IOException",
"java.io.ObjectInputStream",
"javax.swing.event.EventListenerList",
"org.jfree.chart.labels.ItemLabelPosition",
"org.jfree.io.SerialUtilities"
] | import java.awt.Font; import java.awt.Paint; import java.awt.Shape; import java.awt.Stroke; import java.io.IOException; import java.io.ObjectInputStream; import javax.swing.event.EventListenerList; import org.jfree.chart.labels.ItemLabelPosition; import org.jfree.io.SerialUtilities; | import java.awt.*; import java.io.*; import javax.swing.event.*; import org.jfree.chart.labels.*; import org.jfree.io.*; | [
"java.awt",
"java.io",
"javax.swing",
"org.jfree.chart",
"org.jfree.io"
] | java.awt; java.io; javax.swing; org.jfree.chart; org.jfree.io; | 1,469,538 |
public void add(Switchport switchportObj, Integer interfaceId); | void function(Switchport switchportObj, Integer interfaceId); | /**
* Adds a switchport attached to Interfaceid
*
* @param switchportObj The Switchport object to store
* @param interfaceId The ID of the interface to connect it to
*/ | Adds a switchport attached to Interfaceid | add | {
"repo_name": "rob-murray/ipac",
"path": "WEBAPP/src/main/java/com/ipac/app/service/SwitchportService.java",
"license": "gpl-3.0",
"size": 1222
} | [
"com.ipac.app.model.Switchport"
] | import com.ipac.app.model.Switchport; | import com.ipac.app.model.*; | [
"com.ipac.app"
] | com.ipac.app; | 549,485 |
public static byte[] getAssetFileBytes(Context testContext, String assetPath)
throws IOException {
InputStream assetFile = getAssetFileStream(testContext, assetPath);
ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = assetFile.read(buffer)) > 0) {
byteStream.write(buffer, 0, length);
}
byte[] bytes = byteStream.toByteArray();
byteStream.close();
assetFile.close();
return bytes;
} | static byte[] function(Context testContext, String assetPath) throws IOException { InputStream assetFile = getAssetFileStream(testContext, assetPath); ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = assetFile.read(buffer)) > 0) { byteStream.write(buffer, 0, length); } byte[] bytes = byteStream.toByteArray(); byteStream.close(); assetFile.close(); return bytes; } | /**
* Get asset file bytes
*
* @param testContext
* @param assetPath
* @return
* @throws IOException
*/ | Get asset file bytes | getAssetFileBytes | {
"repo_name": "boundlessgeo/geopackage-android",
"path": "geopackage-sdk/src/androidTest/java/mil/nga/geopackage/test/TestUtils.java",
"license": "mit",
"size": 16456
} | [
"android.content.Context",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import android.content.Context; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; | import android.content.*; import java.io.*; | [
"android.content",
"java.io"
] | android.content; java.io; | 2,842,271 |
public void setTargetPosition(TimeStamp timeStamp,
InstrumentSpecification spec, int tgtPosition, double limit) {
// send the reporting ..
// getAlgoEnv().getValueReporter().report(timeStamp, "TGTPOS", new
// Double(tgtPosition));
//
double currentPosition = 0.0;
if (algoEnv.getBrokerAccount().getPortfolio().hasPosition(spec)) {
currentPosition = algoEnv.getBrokerAccount().getPortfolio()
.getPosition(spec).getQuantity();
}
log.debug("Current position in " + spec.toString() + ": "
+ currentPosition);
log.debug("Target position: " + tgtPosition + " at " + limit);
if (tgtPosition != currentPosition) {
if (tgtPosition > currentPosition) {
log.debug("Tgt position > currentPosition.");
// have to go further long.
// check if there is a long order to reach this position active
// ...
double positionDifference = tgtPosition - currentPosition;
for (OrderHistory h : algoEnv.getBrokerAccount().getOrderBook()
.getOpenHistories()) {
if (h.getOrder().getInstrumentSpecification() != spec)
continue;
if (h.getOrder().getOrderSide().equals(OrderSide.BUY)) {
if (h.getOrder().getQuantity() <= positionDifference) {
positionDifference = positionDifference
- h.getOrder().getQuantity();
// update the order.
h.getOrder().setLimitPrice(limit);
orderTrackers.get(h.getOrder())
.update(h.getOrder());
log.debug("Updated limit price of existing order.");
} else {
orderTrackers.get(h.getOrder()).cancel();
log.debug("Cancelled existing order.");
}
} else {
// cancel any sell order.
orderTrackers.get(h.getOrder()).cancel();
log.debug("Cancelled existing order.");
}
} | void function(TimeStamp timeStamp, InstrumentSpecification spec, int tgtPosition, double limit) { if (algoEnv.getBrokerAccount().getPortfolio().hasPosition(spec)) { currentPosition = algoEnv.getBrokerAccount().getPortfolio() .getPosition(spec).getQuantity(); } log.debug(STR + spec.toString() + STR + currentPosition); log.debug(STR + tgtPosition + STR + limit); if (tgtPosition != currentPosition) { if (tgtPosition > currentPosition) { log.debug(STR); double positionDifference = tgtPosition - currentPosition; for (OrderHistory h : algoEnv.getBrokerAccount().getOrderBook() .getOpenHistories()) { if (h.getOrder().getInstrumentSpecification() != spec) continue; if (h.getOrder().getOrderSide().equals(OrderSide.BUY)) { if (h.getOrder().getQuantity() <= positionDifference) { positionDifference = positionDifference - h.getOrder().getQuantity(); h.getOrder().setLimitPrice(limit); orderTrackers.get(h.getOrder()) .update(h.getOrder()); log.debug(STR); } else { orderTrackers.get(h.getOrder()).cancel(); log.debug(STR); } } else { orderTrackers.get(h.getOrder()).cancel(); log.debug(STR); } } | /**
* Sets the target position for a specific instrument specification. Logic
* description:
*
*
* @param spec
* @param tgtPosition
* @param limit
*/ | Sets the target position for a specific instrument specification. Logic description: | setTargetPosition | {
"repo_name": "activequant/p2",
"path": "src/main/java/org/activequant/tradesystems/BasicTradeSystem.java",
"license": "apache-2.0",
"size": 8075
} | [
"org.activequant.core.domainmodel.InstrumentSpecification",
"org.activequant.core.domainmodel.account.OrderHistory",
"org.activequant.core.types.OrderSide",
"org.activequant.core.types.TimeStamp"
] | import org.activequant.core.domainmodel.InstrumentSpecification; import org.activequant.core.domainmodel.account.OrderHistory; import org.activequant.core.types.OrderSide; import org.activequant.core.types.TimeStamp; | import org.activequant.core.domainmodel.*; import org.activequant.core.domainmodel.account.*; import org.activequant.core.types.*; | [
"org.activequant.core"
] | org.activequant.core; | 1,869,774 |
protected void addDeviceLocation(String hardwareId, Item item, PointType point) throws SiteWhereAgentException {
sitewhere.sendLocation(hardwareId, point.getLatitude().doubleValue(), point.getLongitude().doubleValue(),
point.getAltitude().doubleValue(), null);
}
| void function(String hardwareId, Item item, PointType point) throws SiteWhereAgentException { sitewhere.sendLocation(hardwareId, point.getLatitude().doubleValue(), point.getLongitude().doubleValue(), point.getAltitude().doubleValue(), null); } | /**
* Send a device location to SiteWhere.
*
* @param hardwareId
* @param item
* @param point
* @throws SiteWhereAgentException
*/ | Send a device location to SiteWhere | addDeviceLocation | {
"repo_name": "computergeek1507/openhab",
"path": "bundles/persistence/org.openhab.persistence.sitewhere/src/main/java/org/openhab/persistence/sitewhere/internal/SiteWherePersistenceService.java",
"license": "epl-1.0",
"size": 13964
} | [
"com.sitewhere.agent.SiteWhereAgentException",
"org.openhab.core.items.Item",
"org.openhab.core.library.types.PointType"
] | import com.sitewhere.agent.SiteWhereAgentException; import org.openhab.core.items.Item; import org.openhab.core.library.types.PointType; | import com.sitewhere.agent.*; import org.openhab.core.items.*; import org.openhab.core.library.types.*; | [
"com.sitewhere.agent",
"org.openhab.core"
] | com.sitewhere.agent; org.openhab.core; | 669,980 |
public IgniteConfiguration config(); | IgniteConfiguration function(); | /**
* Gets grid configuration.
*
* @return Grid configuration.
*/ | Gets grid configuration | config | {
"repo_name": "SomeFire/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/GridKernalContext.java",
"license": "apache-2.0",
"size": 22514
} | [
"org.apache.ignite.configuration.IgniteConfiguration"
] | import org.apache.ignite.configuration.IgniteConfiguration; | import org.apache.ignite.configuration.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,213,016 |
public String toString() {
DecimalFormat formatter = new DecimalFormat(" 0.000E0; -"); //$NON-NLS-1$
return toString(formatter).replaceAll("E(\\d+)", "E+$1"); //$NON-NLS-1$ //$NON-NLS-2$
} | String function() { DecimalFormat formatter = new DecimalFormat(STR); return toString(formatter).replaceAll(STR, "E+$1"); } | /**
* Return a string representation of this matrix.
* <p>
* This method creates a new {@link DecimalFormat} on every invocation with the format string "<tt> 0.000E0; -</tt>".
*
* @return the string representation
*/ | Return a string representation of this matrix. This method creates a new <code>DecimalFormat</code> on every invocation with the format string " 0.000E0; -" | toString | {
"repo_name": "HunterFP/MineWorld",
"path": "src/org/joml/Matrix3f.java",
"license": "gpl-2.0",
"size": 86156
} | [
"java.text.DecimalFormat"
] | import java.text.DecimalFormat; | import java.text.*; | [
"java.text"
] | java.text; | 1,626,791 |
protected void close() throws IOException {
synchronized(fdLock) {
if (fd != null) {
if (!stream) {
ResourceManager.afterUdpClose();
}
if (fdUseCount == 0) {
if (closePending) {
return;
}
closePending = true;
try {
socketPreClose();
} finally {
socketClose();
}
fd = null;
return;
} else {
if (!closePending) {
closePending = true;
fdUseCount--;
socketPreClose();
}
}
}
}
} | void function() throws IOException { synchronized(fdLock) { if (fd != null) { if (!stream) { ResourceManager.afterUdpClose(); } if (fdUseCount == 0) { if (closePending) { return; } closePending = true; try { socketPreClose(); } finally { socketClose(); } fd = null; return; } else { if (!closePending) { closePending = true; fdUseCount--; socketPreClose(); } } } } } | /**
* Closes the socket.
*/ | Closes the socket | close | {
"repo_name": "universsky/openjdk",
"path": "jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java",
"license": "gpl-2.0",
"size": 23431
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,763,315 |
protected void writeLSDgct() throws IOException {
// logical screen size
writeShort(width);
writeShort(height);
// packed fields
out.write((0x80 | // 1 : global color table flag = 0 (nn
0x70 | // 2-4 : color resolution = 7
0x00 | // 5 : gct sort flag = 0
lctSize)); // 6-8 : gct size = 0
out.write(0); // background color index
out.write(0); // pixel aspect ratio - assume 1:1
}
| void function() throws IOException { writeShort(width); writeShort(height); out.write((0x80 0x70 0x00 lctSize)); out.write(0); out.write(0); } | /**
* Writes Logical Screen Descriptor with global color table
*/ | Writes Logical Screen Descriptor with global color table | writeLSDgct | {
"repo_name": "sul-dlss/adore-djatoka",
"path": "src/gov/lanl/adore/djatoka/io/writer/GIFWriter.java",
"license": "lgpl-2.1",
"size": 27467
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 34,421 |
@javax.annotation.Nullable
@ApiModelProperty(
value =
"Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations")
public Map<String, String> getAnnotations() {
return annotations;
} | @javax.annotation.Nullable @ApiModelProperty( value = "Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: http: Map<String, String> function() { return annotations; } | /**
* Annotations is an unstructured key value map stored with a resource that may be set by external
* tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved
* when modifying objects. More info: http://kubernetes.io/docs/user-guide/annotations
*
* @return annotations
*/ | Annotations is an unstructured key value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: HREF | getAnnotations | {
"repo_name": "kubernetes-client/java",
"path": "client-java-contrib/prometheus-operator/src/main/java/com/coreos/monitoring/models/V1ThanosRulerSpecPodMetadata.java",
"license": "apache-2.0",
"size": 5062
} | [
"io.swagger.annotations.ApiModelProperty",
"java.util.Map"
] | import io.swagger.annotations.ApiModelProperty; import java.util.Map; | import io.swagger.annotations.*; import java.util.*; | [
"io.swagger.annotations",
"java.util"
] | io.swagger.annotations; java.util; | 2,813,682 |
EList<EObject> getGenericApplicationPropertyOfWaterClosureSurface(); | EList<EObject> getGenericApplicationPropertyOfWaterClosureSurface(); | /**
* Returns the value of the '<em><b>Generic Application Property Of Water Closure Surface</b></em>' containment reference list.
* The list contents are of type {@link org.eclipse.emf.ecore.EObject}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Generic Application Property Of Water Closure Surface</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Generic Application Property Of Water Closure Surface</em>' containment reference list.
* @see net.opengis.citygml.waterbody.WaterbodyPackage#getWaterClosureSurfaceType_GenericApplicationPropertyOfWaterClosureSurface()
* @model containment="true" transient="true" changeable="false" volatile="true" derived="true"
* extendedMetaData="kind='element' name='_GenericApplicationPropertyOfWaterClosureSurface' namespace='##targetNamespace' group='_GenericApplicationPropertyOfWaterClosureSurface:group'"
* @generated
*/ | Returns the value of the 'Generic Application Property Of Water Closure Surface' containment reference list. The list contents are of type <code>org.eclipse.emf.ecore.EObject</code>. If the meaning of the 'Generic Application Property Of Water Closure Surface' containment reference list isn't clear, there really should be more of a description here... | getGenericApplicationPropertyOfWaterClosureSurface | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore/src/net/opengis/citygml/waterbody/WaterClosureSurfaceType.java",
"license": "apache-2.0",
"size": 3587
} | [
"org.eclipse.emf.common.util.EList",
"org.eclipse.emf.ecore.EObject"
] | import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; | import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 83,718 |
public static int maxInRow(DoubleMatrix2D A, int row)
{
int index = 0;
double max = A.getQuick(row, index);
for (int c = 1; c < A.columns(); c++)
{
if (max < A.getQuick(row, c))
{
max = A.getQuick(row, c);
index = c;
}
}
return index;
} | static int function(DoubleMatrix2D A, int row) { int index = 0; double max = A.getQuick(row, index); for (int c = 1; c < A.columns(); c++) { if (max < A.getQuick(row, c)) { max = A.getQuick(row, c); index = c; } } return index; } | /**
* Finds the index of the first maximum element in given row of <code>A</code>.
*
* @param A the matrix to search
* @param row the row to search
* @return index of the first maximum element or -1 if the input matrix is
* <code>null</code> or has zero size.
*/ | Finds the index of the first maximum element in given row of <code>A</code> | maxInRow | {
"repo_name": "MjAbuz/carrot2",
"path": "core/carrot2-util-matrix/src/org/carrot2/matrix/MatrixUtils.java",
"license": "bsd-3-clause",
"size": 14576
} | [
"org.apache.mahout.math.matrix.DoubleMatrix2D"
] | import org.apache.mahout.math.matrix.DoubleMatrix2D; | import org.apache.mahout.math.matrix.*; | [
"org.apache.mahout"
] | org.apache.mahout; | 1,950,574 |
void apply(Timer.Builder builder); | void apply(Timer.Builder builder); | /**
* Called to apply any auto-timer settings to the given {@link Builder Timer.Builder}.
* @param builder the builder to apply settings to
*/ | Called to apply any auto-timer settings to the given <code>Builder Timer.Builder</code> | apply | {
"repo_name": "mbenson/spring-boot",
"path": "spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/AutoTimer.java",
"license": "apache-2.0",
"size": 2696
} | [
"io.micrometer.core.instrument.Timer"
] | import io.micrometer.core.instrument.Timer; | import io.micrometer.core.instrument.*; | [
"io.micrometer.core"
] | io.micrometer.core; | 2,413,530 |
public ServiceResponseWithHeaders<Void, HttpRedirectsDelete307Headers> delete307(Boolean booleanValue) throws ErrorException, IOException {
Call<ResponseBody> call = service.delete307(booleanValue);
return delete307Delegate(call.execute());
} | ServiceResponseWithHeaders<Void, HttpRedirectsDelete307Headers> function(Boolean booleanValue) throws ErrorException, IOException { Call<ResponseBody> call = service.delete307(booleanValue); return delete307Delegate(call.execute()); } | /**
* Delete redirected with 307, resulting in a 200 after redirect.
*
* @param booleanValue Simple boolean value true
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/ | Delete redirected with 307, resulting in a 200 after redirect | delete307 | {
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperationsImpl.java",
"license": "mit",
"size": 53468
} | [
"com.microsoft.rest.ServiceResponseWithHeaders",
"java.io.IOException"
] | import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException; | import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.rest",
"java.io"
] | com.microsoft.rest; java.io; | 413,595 |
@SuppressWarnings("unused")
private void verifySystemNotifications(final String regionName, final int expectedMembers) {
assertThat(SYSTEM_NOTIFICATIONS.get()).isNotNull();
assertThat(SYSTEM_NOTIFICATIONS.get()).hasSize(expectedMembers + 2); // 2 for the manager
int regionCreatedCount = 0;
int regionDestroyedCount = 0;
for (Notification notification : SYSTEM_NOTIFICATIONS.get()) {
if (JMXNotificationType.REGION_CREATED.equals(notification.getType())) {
regionCreatedCount++;
assertThat(notification.getMessage()).contains(regionName);
} else if (JMXNotificationType.REGION_CLOSED.equals(notification.getType())) {
regionDestroyedCount++;
assertThat(notification.getMessage()).contains(regionName);
} else {
fail("Unexpected notification type: " + notification.getType());
}
}
assertThat(regionCreatedCount).isEqualTo(1); // just the manager
assertThat(regionDestroyedCount).isEqualTo(expectedMembers + 1); // all 3 members + manager
// <[javax.management.Notification[source=192.168.1.72(18496)<v27>-32770][type=gemfire.distributedsystem.cache.region.created][message=Region
// Created With Name /MANAGEMENT_TEST_REGION],
// javax.management.Notification[source=192.168.1.72(18497)<v28>-32771][type=gemfire.distributedsystem.cache.region.closed][message=Region
// Destroyed/Closed With Name /MANAGEMENT_TEST_REGION],
// javax.management.Notification[source=192.168.1.72(18498)<v29>-32772][type=gemfire.distributedsystem.cache.region.closed][message=Region
// Destroyed/Closed With Name /MANAGEMENT_TEST_REGION],
// javax.management.Notification[source=192.168.1.72(18499)<v30>-32773][type=gemfire.distributedsystem.cache.region.closed][message=Region
// Destroyed/Closed With Name /MANAGEMENT_TEST_REGION],
// javax.management.Notification[source=192.168.1.72(18496)<v27>-32770][type=gemfire.distributedsystem.cache.region.closed][message=Region
// Destroyed/Closed With Name /MANAGEMENT_TEST_REGION]]>
} | @SuppressWarnings(STR) void function(final String regionName, final int expectedMembers) { assertThat(SYSTEM_NOTIFICATIONS.get()).isNotNull(); assertThat(SYSTEM_NOTIFICATIONS.get()).hasSize(expectedMembers + 2); int regionCreatedCount = 0; int regionDestroyedCount = 0; for (Notification notification : SYSTEM_NOTIFICATIONS.get()) { if (JMXNotificationType.REGION_CREATED.equals(notification.getType())) { regionCreatedCount++; assertThat(notification.getMessage()).contains(regionName); } else if (JMXNotificationType.REGION_CLOSED.equals(notification.getType())) { regionDestroyedCount++; assertThat(notification.getMessage()).contains(regionName); } else { fail(STR + notification.getType()); } } assertThat(regionCreatedCount).isEqualTo(1); assertThat(regionDestroyedCount).isEqualTo(expectedMembers + 1); } | /**
* Please don't delete verifySystemNotifications. We need to improve verification in this test
* class and fix whatever flakiness is in this method.
*/ | Please don't delete verifySystemNotifications. We need to improve verification in this test class and fix whatever flakiness is in this method | verifySystemNotifications | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/management/RegionManagementDUnitTest.java",
"license": "apache-2.0",
"size": 47871
} | [
"javax.management.Notification",
"org.assertj.core.api.Assertions"
] | import javax.management.Notification; import org.assertj.core.api.Assertions; | import javax.management.*; import org.assertj.core.api.*; | [
"javax.management",
"org.assertj.core"
] | javax.management; org.assertj.core; | 1,376,127 |
private boolean isIgnoredSetterParam(DetailAST aAST, String aName)
{
if (aAST.getType() != TokenTypes.PARAMETER_DEF
|| !mIgnoreSetter)
{
return false;
}
//single parameter?
final DetailAST parametersAST = aAST.getParent();
if (parametersAST.getChildCount() != 1) {
return false;
}
//method parameter, not constructor parameter?
final DetailAST methodAST = parametersAST.getParent();
if (methodAST.getType() != TokenTypes.METHOD_DEF) {
return false;
}
//void?
final DetailAST typeAST = methodAST.findFirstToken(TokenTypes.TYPE);
if (!typeAST.branchContains(TokenTypes.LITERAL_VOID)) {
return false;
}
//property setter name?
final String methodName =
methodAST.findFirstToken(TokenTypes.IDENT).getText();
final String expectedName = "set" + capitalize(aName);
return methodName.equals(expectedName);
} | boolean function(DetailAST aAST, String aName) { if (aAST.getType() != TokenTypes.PARAMETER_DEF !mIgnoreSetter) { return false; } final DetailAST parametersAST = aAST.getParent(); if (parametersAST.getChildCount() != 1) { return false; } final DetailAST methodAST = parametersAST.getParent(); if (methodAST.getType() != TokenTypes.METHOD_DEF) { return false; } final DetailAST typeAST = methodAST.findFirstToken(TokenTypes.TYPE); if (!typeAST.branchContains(TokenTypes.LITERAL_VOID)) { return false; } final String methodName = methodAST.findFirstToken(TokenTypes.IDENT).getText(); final String expectedName = "set" + capitalize(aName); return methodName.equals(expectedName); } | /**
* Decides whether to ignore an AST node that is the parameter of a
* setter method, where the property setter method for field 'xyz' has
* name 'setXyz', one parameter named 'xyz', and return type void.
* @param aAST the AST to check.
* @param aName the name of aAST.
* @return true if aAST should be ignored because check property
* ignoreSetter is true and aAST is the parameter of a setter method.
*/ | Decides whether to ignore an AST node that is the parameter of a setter method, where the property setter method for field 'xyz' has name 'setXyz', one parameter named 'xyz', and return type void | isIgnoredSetterParam | {
"repo_name": "gkzhong/checkstyle",
"path": "src/checkstyle/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java",
"license": "lgpl-2.1",
"size": 16211
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.TokenTypes"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 1,368,639 |
@NonNull
@CheckResult
public static <P, T, R, N, ET extends Number, X extends NumericColumn<T, R, ET, P, N>> NumericColumn<T, R, ET, P, N> abs(@NonNull X column) {
return new FunctionCopyColumn<>(column.table.internalAlias(""), column, "abs(", ')', column.nullable, null);
} | static <P, T, R, N, ET extends Number, X extends NumericColumn<T, R, ET, P, N>> NumericColumn<T, R, ET, P, N> function(@NonNull X column) { return new FunctionCopyColumn<>(column.table.internalAlias(STRabs(", ')', column.nullable, null); } | /**
* The abs(X) function returns the absolute value of the numeric argument X.
* Abs(X) returns NULL if X is NULL. If X is the integer -9223372036854775808 then abs(X)
* throws an integer overflow error since there is no equivalent positive 64-bit two complement value.
*
* @param column Input of this function
* @return Column representing the result of this function
* @see <a href="http://www.sqlite.org/lang_corefunc.html">SQLite documentation: Core Functions</a>
*/ | The abs(X) function returns the absolute value of the numeric argument X. Abs(X) returns NULL if X is NULL. If X is the integer -9223372036854775808 then abs(X) throws an integer overflow error since there is no equivalent positive 64-bit two complement value | abs | {
"repo_name": "SiimKinks/sqlitemagic",
"path": "runtime/src/main/java/com/siimkinks/sqlitemagic/Select.java",
"license": "apache-2.0",
"size": 61233
} | [
"androidx.annotation.NonNull"
] | import androidx.annotation.NonNull; | import androidx.annotation.*; | [
"androidx.annotation"
] | androidx.annotation; | 756,137 |
public Coder<T> getCoder() {
if (coder == null) {
coder = inferCoderOrFail();
}
return coder;
} | Coder<T> function() { if (coder == null) { coder = inferCoderOrFail(); } return coder; } | /**
* Returns the {@link Coder} used by this {@link TypedPValue} to encode and decode
* the values stored in it.
*
* @throws IllegalStateException if the {@link Coder} hasn't been set, and
* couldn't be inferred.
*/ | Returns the <code>Coder</code> used by this <code>TypedPValue</code> to encode and decode the values stored in it | getCoder | {
"repo_name": "shakamunyi/beam",
"path": "sdks/java/core/src/main/java/com/google/cloud/dataflow/sdk/values/TypedPValue.java",
"license": "apache-2.0",
"size": 7705
} | [
"com.google.cloud.dataflow.sdk.coders.Coder"
] | import com.google.cloud.dataflow.sdk.coders.Coder; | import com.google.cloud.dataflow.sdk.coders.*; | [
"com.google.cloud"
] | com.google.cloud; | 1,845,105 |
public LogisticRegressionModel withWeights(Vector weights) {
this.weights = weights;
return this;
} | LogisticRegressionModel function(Vector weights) { this.weights = weights; return this; } | /**
* Set up the weights.
*
* @param weights The parameter value.
* @return Model with new weights parameter value.
*/ | Set up the weights | withWeights | {
"repo_name": "irudyak/ignite",
"path": "modules/ml/src/main/java/org/apache/ignite/ml/regressions/logistic/binomial/LogisticRegressionModel.java",
"license": "apache-2.0",
"size": 5947
} | [
"org.apache.ignite.ml.math.Vector"
] | import org.apache.ignite.ml.math.Vector; | import org.apache.ignite.ml.math.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,909,580 |
public static String getText(File file, String encoding) {
Charset charset;
try { charset = Charset.forName(encoding); }
catch (Exception ex) { charset = utf8; }
return getText(file, charset);
} | static String function(File file, String encoding) { Charset charset; try { charset = Charset.forName(encoding); } catch (Exception ex) { charset = utf8; } return getText(file, charset); } | /**
* Read a text file completely, using the specified encoding, or
* UTF-8 if the specified encoding is not supported.
* @param file the file to read.
* @param encoding the name of the charset to use.
* @return the text of the file, or an empty string if an error occurred.
*/ | Read a text file completely, using the specified encoding, or UTF-8 if the specified encoding is not supported | getText | {
"repo_name": "blezek/Notion",
"path": "src/main/java/org/rsna/util/FileUtil.java",
"license": "bsd-3-clause",
"size": 30010
} | [
"java.io.File",
"java.nio.charset.Charset"
] | import java.io.File; import java.nio.charset.Charset; | import java.io.*; import java.nio.charset.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 954,966 |
// Unit Tested
public static DoubleMatrix exp(DoubleMatrix m1) {
DoubleMatrix matrix = m1.dup();
for (int i = 0; i < matrix.length; i++) {
matrix.put(i, Math.exp(m1.get(i)));
}
return matrix;
}
| static DoubleMatrix function(DoubleMatrix m1) { DoubleMatrix matrix = m1.dup(); for (int i = 0; i < matrix.length; i++) { matrix.put(i, Math.exp(m1.get(i))); } return matrix; } | /**
* Returns a new matrix with values exponentiated
* @param matrix
* @return new matrix with values exponentiated
*/ | Returns a new matrix with values exponentiated | exp | {
"repo_name": "sgsinclair/trombone",
"path": "src/main/java/com/jujutsu/utils/BlasOps.java",
"license": "gpl-3.0",
"size": 10689
} | [
"org.jblas.DoubleMatrix"
] | import org.jblas.DoubleMatrix; | import org.jblas.*; | [
"org.jblas"
] | org.jblas; | 1,694,949 |
public int assignTableAliasesStartingAt(int initialValue) {
if (hasBeenAliased()) {
return initialValue;
}
if (doesNotRepresentAnObjectInTheQuery()) {
return initialValue;
}
// This block should be removed I think.
// The only reason to clone might be to
// preserve the qualifier, but aliases need
// qualifiers? That seems strange.
// Also this will break AsOf queries. By
// inference if has view table the AliasTableLookup
// will contain one table, and that will be the
// table of the view...
if (hasViewTable()) {
DatabaseTable aliased = viewTable.clone();
String alias = "t" + initialValue;
aliased.setName(alias);
assignAlias(alias, viewTable);
aliasedViewTable = aliased;
hasBeenAliased = true;
return initialValue + 1;
}
return super.assignTableAliasesStartingAt(initialValue);
} | int function(int initialValue) { if (hasBeenAliased()) { return initialValue; } if (doesNotRepresentAnObjectInTheQuery()) { return initialValue; } if (hasViewTable()) { DatabaseTable aliased = viewTable.clone(); String alias = "t" + initialValue; aliased.setName(alias); assignAlias(alias, viewTable); aliasedViewTable = aliased; hasBeenAliased = true; return initialValue + 1; } return super.assignTableAliasesStartingAt(initialValue); } | /**
* INTERNAL:
* Assign aliases to any tables which I own. Start with t(initialValue),
* and return the new value of the counter , i.e. if initialValue is one
* and I have tables ADDRESS and EMPLOYEE I will assign them t1 and t2 respectively, and return 3.
*/ | Assign aliases to any tables which I own. Start with t(initialValue), and return the new value of the counter , i.e. if initialValue is one and I have tables ADDRESS and EMPLOYEE I will assign them t1 and t2 respectively, and return 3 | assignTableAliasesStartingAt | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/expressions/ExpressionBuilder.java",
"license": "epl-1.0",
"size": 19037
} | [
"org.eclipse.persistence.internal.helper.DatabaseTable"
] | import org.eclipse.persistence.internal.helper.DatabaseTable; | import org.eclipse.persistence.internal.helper.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 287,594 |
public static class DimensionalComparator
implements Comparator
{
public static int compare(double a, double b)
{
if (a < b) return -1;
if (a > b) return 1;
if (Double.isNaN(a)) {
if (Double.isNaN(b)) return 0;
return -1;
}
if (Double.isNaN(b)) return 1;
return 0;
}
private int dimensionsToTest = 2;
public DimensionalComparator()
{
this(2);
}
public DimensionalComparator(int dimensionsToTest)
{
if (dimensionsToTest != 2 && dimensionsToTest != 3)
throw new IllegalArgumentException("only 2 or 3 dimensions may be specified");
this.dimensionsToTest = dimensionsToTest;
}
/**
* Compares two {@link Coordinate}s along to the number of
* dimensions specified.
*
* @param o1 a {@link Coordinate}
* @param o2 a {link Coordinate}
| static class DimensionalComparator implements Comparator { public static int function(double a, double b) { if (a < b) return -1; if (a > b) return 1; if (Double.isNaN(a)) { if (Double.isNaN(b)) return 0; return -1; } if (Double.isNaN(b)) return 1; return 0; } private int dimensionsToTest = 2; public DimensionalComparator() { this(2); } public DimensionalComparator(int dimensionsToTest) { if (dimensionsToTest != 2 && dimensionsToTest != 3) throw new IllegalArgumentException(STR); this.dimensionsToTest = dimensionsToTest; } /** * Compares two {@link Coordinate}s along to the number of * dimensions specified. * * @param o1 a {@link Coordinate} * @param o2 a {link Coordinate} | /**
* Compare two <code>double</code>s, allowing for NaN values.
* NaN is treated as being less than any valid number.
*
* @param a a <code>double</code>
* @param b a <code>double</code>
* @return -1, 0, or 1 depending on whether a is less than, equal to or greater than b
*/ | Compare two <code>double</code>s, allowing for NaN values. NaN is treated as being less than any valid number | compare | {
"repo_name": "jprante/elasticsearch-client",
"path": "elasticsearch-client-jts-jdk5/src/main/java/com/vividsolutions/jts/geom/Coordinate.java",
"license": "apache-2.0",
"size": 10487
} | [
"java.util.Comparator"
] | import java.util.Comparator; | import java.util.*; | [
"java.util"
] | java.util; | 765,375 |
void storeLocalState(
@Nonnegative long checkpointId,
@Nullable TaskStateSnapshot localState); | void storeLocalState( @Nonnegative long checkpointId, @Nullable TaskStateSnapshot localState); | /**
* Stores the local state for the given checkpoint id.
*
* @param checkpointId id for the checkpoint that created the local state that will be stored.
* @param localState the local state to store.
*/ | Stores the local state for the given checkpoint id | storeLocalState | {
"repo_name": "ueshin/apache-flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/state/TaskLocalStateStore.java",
"license": "apache-2.0",
"size": 3006
} | [
"javax.annotation.Nonnegative",
"javax.annotation.Nullable",
"org.apache.flink.runtime.checkpoint.TaskStateSnapshot"
] | import javax.annotation.Nonnegative; import javax.annotation.Nullable; import org.apache.flink.runtime.checkpoint.TaskStateSnapshot; | import javax.annotation.*; import org.apache.flink.runtime.checkpoint.*; | [
"javax.annotation",
"org.apache.flink"
] | javax.annotation; org.apache.flink; | 397,434 |
protected final int slowAdvance(int target) throws IOException {
assert docID() < target;
int doc;
do {
doc = nextDoc();
} while (doc < target);
return doc;
} | final int function(int target) throws IOException { assert docID() < target; int doc; do { doc = nextDoc(); } while (doc < target); return doc; } | /** Slow (linear) implementation of {@link #advance} relying on
* {@link #nextDoc()} to advance beyond the target position. */ | Slow (linear) implementation of <code>#advance</code> relying on | slowAdvance | {
"repo_name": "PATRIC3/p3_solr",
"path": "lucene/core/src/java/org/apache/lucene/search/DocIdSetIterator.java",
"license": "apache-2.0",
"size": 5438
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 282,099 |
public void sendMessage(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC)
throws IgniteSpiException {
sendMessage0(node, msg, ackC);
} | void function(ClusterNode node, Message msg, IgniteInClosure<IgniteException> ackC) throws IgniteSpiException { sendMessage0(node, msg, ackC); } | /**
* Sends given message to destination node. Note that characteristics of the
* exchange such as durability, guaranteed delivery or error notification is
* dependant on SPI implementation.
*
* @param node Destination node.
* @param msg Message to send.
* @param ackC Ack closure.
* @throws org.apache.ignite.spi.IgniteSpiException Thrown in case of any error during sending the message.
* Note that this is not guaranteed that failed communication will result
* in thrown exception as this is dependant on SPI implementation.
*/ | Sends given message to destination node. Note that characteristics of the exchange such as durability, guaranteed delivery or error notification is dependant on SPI implementation | sendMessage | {
"repo_name": "pperalta/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java",
"license": "apache-2.0",
"size": 175806
} | [
"org.apache.ignite.IgniteException",
"org.apache.ignite.cluster.ClusterNode",
"org.apache.ignite.lang.IgniteInClosure",
"org.apache.ignite.plugin.extensions.communication.Message",
"org.apache.ignite.spi.IgniteSpiException"
] | import org.apache.ignite.IgniteException; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.lang.IgniteInClosure; import org.apache.ignite.plugin.extensions.communication.Message; import org.apache.ignite.spi.IgniteSpiException; | import org.apache.ignite.*; import org.apache.ignite.cluster.*; import org.apache.ignite.lang.*; import org.apache.ignite.plugin.extensions.communication.*; import org.apache.ignite.spi.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,163,747 |
public void setExitUserUrl(String exitUserUrl) {
Assert.isTrue(UrlUtils.isValidRedirectUrl(exitUserUrl),
"exitUserUrl cannot be empty and must be a valid redirect URL");
this.exitUserUrl = exitUserUrl;
} | void function(String exitUserUrl) { Assert.isTrue(UrlUtils.isValidRedirectUrl(exitUserUrl), STR); this.exitUserUrl = exitUserUrl; } | /**
* Set the URL to respond to exit user processing.
*
* @param exitUserUrl The exit user URL.
*/ | Set the URL to respond to exit user processing | setExitUserUrl | {
"repo_name": "vitorgv/spring-security",
"path": "web/src/main/java/org/springframework/security/web/authentication/switchuser/SwitchUserFilter.java",
"license": "apache-2.0",
"size": 22340
} | [
"org.springframework.security.web.util.UrlUtils",
"org.springframework.util.Assert"
] | import org.springframework.security.web.util.UrlUtils; import org.springframework.util.Assert; | import org.springframework.security.web.util.*; import org.springframework.util.*; | [
"org.springframework.security",
"org.springframework.util"
] | org.springframework.security; org.springframework.util; | 875,478 |
public final InstructionList compile(ClassGenerator classGen,
MethodGenerator methodGen) {
final InstructionList result, save = methodGen.getInstructionList();
methodGen.setInstructionList(result = new InstructionList());
translate(classGen, methodGen);
methodGen.setInstructionList(save);
return result;
} | final InstructionList function(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList result, save = methodGen.getInstructionList(); methodGen.setInstructionList(result = new InstructionList()); translate(classGen, methodGen); methodGen.setInstructionList(save); return result; } | /**
* Translate this node into a fresh instruction list.
* The original instruction list is saved and restored.
*/ | Translate this node into a fresh instruction list. The original instruction list is saved and restored | compile | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xalan/internal/xsltc/compiler/Expression.java",
"license": "apache-2.0",
"size": 7951
} | [
"com.sun.org.apache.bcel.internal.generic.InstructionList",
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator",
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator"
] | import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; | import com.sun.org.apache.bcel.internal.generic.*; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*; | [
"com.sun.org"
] | com.sun.org; | 2,807,004 |
public void addRecord(NamedQueuePayload namedQueuePayload) {
RingBuffer<RingBufferEnvelope> ringBuffer = this.disruptor.getRingBuffer();
long seqId = ringBuffer.next();
try {
ringBuffer.get(seqId).load(namedQueuePayload);
} finally {
ringBuffer.publish(seqId);
}
} | void function(NamedQueuePayload namedQueuePayload) { RingBuffer<RingBufferEnvelope> ringBuffer = this.disruptor.getRingBuffer(); long seqId = ringBuffer.next(); try { ringBuffer.get(seqId).load(namedQueuePayload); } finally { ringBuffer.publish(seqId); } } | /**
* Add various NamedQueue records to ringbuffer. Based on the type of the event (e.g slowLog),
* consumer of disruptor ringbuffer will have specific logic.
* This method is producer of disruptor ringbuffer which is initialized in NamedQueueRecorder
* constructor.
*
* @param namedQueuePayload namedQueue payload sent by client of ring buffer
* service
*/ | Add various NamedQueue records to ringbuffer. Based on the type of the event (e.g slowLog), consumer of disruptor ringbuffer will have specific logic. This method is producer of disruptor ringbuffer which is initialized in NamedQueueRecorder constructor | addRecord | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/namequeues/NamedQueueRecorder.java",
"license": "apache-2.0",
"size": 5802
} | [
"com.lmax.disruptor.RingBuffer"
] | import com.lmax.disruptor.RingBuffer; | import com.lmax.disruptor.*; | [
"com.lmax.disruptor"
] | com.lmax.disruptor; | 2,683,210 |
Promise<GitHubPullRequest> updatePullRequest(String user,
String repository,
String pullRequestId,
GitHubPullRequest pullRequest); | Promise<GitHubPullRequest> updatePullRequest(String user, String repository, String pullRequestId, GitHubPullRequest pullRequest); | /**
* Updates github pull request
*
* @param user
* repository owner
* @param repository
* name of repository
* @param pullRequestId
* pull request identifier
* @param pullRequest
* update body
* @return updated pull request
*/ | Updates github pull request | updatePullRequest | {
"repo_name": "snjeza/che",
"path": "plugins/plugin-github/che-plugin-github-ide/src/main/java/org/eclipse/che/plugin/github/ide/GitHubClientService.java",
"license": "epl-1.0",
"size": 7503
} | [
"org.eclipse.che.api.promises.client.Promise",
"org.eclipse.che.plugin.github.shared.GitHubPullRequest"
] | import org.eclipse.che.api.promises.client.Promise; import org.eclipse.che.plugin.github.shared.GitHubPullRequest; | import org.eclipse.che.api.promises.client.*; import org.eclipse.che.plugin.github.shared.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 2,680,449 |
protected void resumeObjectUpdates()
{
// When listeners is null this is the resume at the beginning
// before connecting to the telemetry service
if(listeners == null)
return;
Set<Observer> s = listeners.keySet();
Iterator<Observer> i = s.iterator();
while (i.hasNext()) {
Observer o = i.next();
UAVObject obj = listeners.get(o);
obj.addUpdatedObserver(o);
}
paused = false;
} | void function() { if(listeners == null) return; Set<Observer> s = listeners.keySet(); Iterator<Observer> i = s.iterator(); while (i.hasNext()) { Observer o = i.next(); UAVObject obj = listeners.get(o); obj.addUpdatedObserver(o); } paused = false; } | /**
* When an activity is resumed, reconnect all now the view
* is valid again
*/ | When an activity is resumed, reconnect all now the view is valid again | resumeObjectUpdates | {
"repo_name": "jpbarraca/dRonin",
"path": "androidgcs/src/org/dronin/androidgcs/ObjectManagerActivity.java",
"license": "gpl-3.0",
"size": 27263
} | [
"java.util.Iterator",
"java.util.Observer",
"java.util.Set",
"org.dronin.uavtalk.UAVObject"
] | import java.util.Iterator; import java.util.Observer; import java.util.Set; import org.dronin.uavtalk.UAVObject; | import java.util.*; import org.dronin.uavtalk.*; | [
"java.util",
"org.dronin.uavtalk"
] | java.util; org.dronin.uavtalk; | 1,074,316 |
public synchronized void optimize() throws IOException {
flushRamSegments();
while (segmentInfos.size() > 1 ||
(segmentInfos.size() == 1 &&
(SegmentReader.hasDeletions(segmentInfos.info(0)) ||
segmentInfos.info(0).dir != directory ||
(useCompoundFile &&
(!SegmentReader.usesCompoundFile(segmentInfos.info(0)) ||
SegmentReader.hasSeparateNorms(segmentInfos.info(0))))))) {
int minSegment = segmentInfos.size() - mergeFactor;
mergeSegments(segmentInfos, minSegment < 0 ? 0 : minSegment, segmentInfos.size());
}
} | synchronized void function() throws IOException { flushRamSegments(); while (segmentInfos.size() > 1 (segmentInfos.size() == 1 && (SegmentReader.hasDeletions(segmentInfos.info(0)) segmentInfos.info(0).dir != directory (useCompoundFile && (!SegmentReader.usesCompoundFile(segmentInfos.info(0)) SegmentReader.hasSeparateNorms(segmentInfos.info(0))))))) { int minSegment = segmentInfos.size() - mergeFactor; mergeSegments(segmentInfos, minSegment < 0 ? 0 : minSegment, segmentInfos.size()); } } | /** Merges all segments together into a single segment, optimizing an index
for search. */ | Merges all segments together into a single segment, optimizing an index | optimize | {
"repo_name": "lpxz/grail-lucene477083",
"path": "src/java/org/apache/lucene/index/IndexWriter.java",
"license": "apache-2.0",
"size": 37003
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,697,964 |
void addFillComponents( Container panel, int[] cols, int[] rows )
{
Dimension filler = new Dimension(10,10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if ( cols.length > 0 && rows.length > 0 )
{
if ( cols[0] == 1 && rows[0] == 1 )
{
panel.add( Box.createRigidArea( filler ), cc.xy(1,1) );
filled_cell_11 = true;
}
}
for( int index = 0; index < cols.length; index++ )
{
if ( cols[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) );
}
for( int index = 0; index < rows.length; index++ )
{
if ( rows[index] == 1 && filled_cell_11 )
{
continue;
}
panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) );
}
} | void addFillComponents( Container panel, int[] cols, int[] rows ) { Dimension filler = new Dimension(10,10); boolean filled_cell_11 = false; CellConstraints cc = new CellConstraints(); if ( cols.length > 0 && rows.length > 0 ) { if ( cols[0] == 1 && rows[0] == 1 ) { panel.add( Box.createRigidArea( filler ), cc.xy(1,1) ); filled_cell_11 = true; } } for( int index = 0; index < cols.length; index++ ) { if ( cols[index] == 1 && filled_cell_11 ) { continue; } panel.add( Box.createRigidArea( filler ), cc.xy(cols[index],1) ); } for( int index = 0; index < rows.length; index++ ) { if ( rows[index] == 1 && filled_cell_11 ) { continue; } panel.add( Box.createRigidArea( filler ), cc.xy(1,rows[index]) ); } } | /**
* Adds fill components to empty cells in the first row and first column of the grid.
* This ensures that the grid spacing will be the same as shown in the designer.
* @param cols an array of column indices in the first row where fill components should be added.
* @param rows an array of row indices in the first column where fill components should be added.
*/ | Adds fill components to empty cells in the first row and first column of the grid. This ensures that the grid spacing will be the same as shown in the designer | addFillComponents | {
"repo_name": "p4553d/carPirate",
"path": "server/download/launch4j/src/net/sf/launch4j/form/JreForm.java",
"license": "isc",
"size": 10482
} | [
"com.jgoodies.forms.layout.CellConstraints",
"java.awt.Container",
"java.awt.Dimension",
"javax.swing.Box"
] | import com.jgoodies.forms.layout.CellConstraints; import java.awt.Container; import java.awt.Dimension; import javax.swing.Box; | import com.jgoodies.forms.layout.*; import java.awt.*; import javax.swing.*; | [
"com.jgoodies.forms",
"java.awt",
"javax.swing"
] | com.jgoodies.forms; java.awt; javax.swing; | 411,547 |
HttpRoute getRoute();
| HttpRoute getRoute(); | /**
* Obtains the current route of this connection.
*
* @return the route established so far, or
* <code>null</code> if not connected
*/ | Obtains the current route of this connection | getRoute | {
"repo_name": "0x90sled/droidtowers",
"path": "main/source/org/apach3/http/conn/HttpRoutedConnection.java",
"license": "mit",
"size": 2965
} | [
"org.apach3.http.conn.routing.HttpRoute"
] | import org.apach3.http.conn.routing.HttpRoute; | import org.apach3.http.conn.routing.*; | [
"org.apach3.http"
] | org.apach3.http; | 2,634,479 |
public void persist(Connection connection) throws SQLException {
PreparedStatement statement = connection.prepareStatement(
"INSERT INTO Edge (syncMetaId, sourceNode, targetNode, labelValue, type) VALUES (?,?,?,?,?);", Statement.RETURN_GENERATED_KEYS);
statement.setString(1, this.syncMetaId);
statement.setString(2, this.sourceNode);
statement.setString(3, this.targetNode);
statement.setString(4, this.labelValue);
statement.setString(5, this.type);
statement.executeUpdate();
ResultSet genKeys = statement.getGeneratedKeys();
genKeys.next();
this.id = genKeys.getInt(1);
statement.close();
// attributes entries
for (int i = 0; i < this.attributes.size(); i++) {
this.attributes.get(i).persist(connection);
// AttributeToEdge entry ("connect" them)
statement = connection.prepareStatement("INSERT INTO AttributeToEdge (attributeId, edgeId) VALUES (?, ?);");
statement.setInt(1, this.attributes.get(i).getId());
statement.setInt(2, this.getId());
statement.executeUpdate();
statement.close();
}
} | void function(Connection connection) throws SQLException { PreparedStatement statement = connection.prepareStatement( STR, Statement.RETURN_GENERATED_KEYS); statement.setString(1, this.syncMetaId); statement.setString(2, this.sourceNode); statement.setString(3, this.targetNode); statement.setString(4, this.labelValue); statement.setString(5, this.type); statement.executeUpdate(); ResultSet genKeys = statement.getGeneratedKeys(); genKeys.next(); this.id = genKeys.getInt(1); statement.close(); for (int i = 0; i < this.attributes.size(); i++) { this.attributes.get(i).persist(connection); statement = connection.prepareStatement(STR); statement.setInt(1, this.attributes.get(i).getId()); statement.setInt(2, this.getId()); statement.executeUpdate(); statement.close(); } } | /**
*
* Persists the Edge entity.
*
* @param connection
* a Connection object
*
* @throws SQLException
* if something goes wrong persisting the Edge entity
*
*/ | Persists the Edge entity | persist | {
"repo_name": "PedeLa/CAE-Model-Persistence-Service",
"path": "model_persistence_service/src/main/java/i5/las2peer/services/modelPersistenceService/model/edge/Edge.java",
"license": "bsd-3-clause",
"size": 8613
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,335,850 |
private ThreadPoolProfile asThreadPoolProfile(CamelContext context, ThreadPoolProfileDefinition definition) throws Exception {
ThreadPoolProfile answer = new ThreadPoolProfile();
answer.setId(definition.getId());
answer.setDefaultProfile(definition.getDefaultProfile());
answer.setPoolSize(CamelContextHelper.parseInteger(context, definition.getPoolSize()));
answer.setMaxPoolSize(CamelContextHelper.parseInteger(context, definition.getMaxPoolSize()));
answer.setKeepAliveTime(CamelContextHelper.parseLong(context, definition.getKeepAliveTime()));
answer.setMaxQueueSize(CamelContextHelper.parseInteger(context, definition.getMaxQueueSize()));
answer.setAllowCoreThreadTimeOut(CamelContextHelper.parseBoolean(context, definition.getAllowCoreThreadTimeOut()));
answer.setRejectedPolicy(definition.getRejectedPolicy());
answer.setTimeUnit(definition.getTimeUnit());
return answer;
} | ThreadPoolProfile function(CamelContext context, ThreadPoolProfileDefinition definition) throws Exception { ThreadPoolProfile answer = new ThreadPoolProfile(); answer.setId(definition.getId()); answer.setDefaultProfile(definition.getDefaultProfile()); answer.setPoolSize(CamelContextHelper.parseInteger(context, definition.getPoolSize())); answer.setMaxPoolSize(CamelContextHelper.parseInteger(context, definition.getMaxPoolSize())); answer.setKeepAliveTime(CamelContextHelper.parseLong(context, definition.getKeepAliveTime())); answer.setMaxQueueSize(CamelContextHelper.parseInteger(context, definition.getMaxQueueSize())); answer.setAllowCoreThreadTimeOut(CamelContextHelper.parseBoolean(context, definition.getAllowCoreThreadTimeOut())); answer.setRejectedPolicy(definition.getRejectedPolicy()); answer.setTimeUnit(definition.getTimeUnit()); return answer; } | /**
* Creates a {@link ThreadPoolProfile} instance based on the definition.
*
* @param context the camel context
* @return the profile
* @throws Exception is thrown if error creating the profile
*/ | Creates a <code>ThreadPoolProfile</code> instance based on the definition | asThreadPoolProfile | {
"repo_name": "davidwilliams1978/camel",
"path": "components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelContextFactoryBean.java",
"license": "apache-2.0",
"size": 49261
} | [
"org.apache.camel.CamelContext",
"org.apache.camel.model.ThreadPoolProfileDefinition",
"org.apache.camel.spi.ThreadPoolProfile",
"org.apache.camel.util.CamelContextHelper"
] | import org.apache.camel.CamelContext; import org.apache.camel.model.ThreadPoolProfileDefinition; import org.apache.camel.spi.ThreadPoolProfile; import org.apache.camel.util.CamelContextHelper; | import org.apache.camel.*; import org.apache.camel.model.*; import org.apache.camel.spi.*; import org.apache.camel.util.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,117,041 |
public static Class<?>[] convertParams(Object[] source) {
Class<?>[] converted = null;
if (source != null) {
converted = new Class<?>[source.length];
for (int i = 0; i < source.length; i++) {
if (source[i] != null) {
// if the class is not an instance of IConnection use its class
if (!IConnection.class.isInstance(source[i])) {
converted[i] = source[i].getClass();
} else {
// if it does implement IConnection use the interface
converted[i] = IConnection.class;
}
} else {
converted[i] = null;
}
}
} else {
converted = new Class<?>[0];
}
if (log.isTraceEnabled()) {
log.trace("Converted parameters: {}", Arrays.toString(converted));
}
return converted;
}
| static Class<?>[] function(Object[] source) { Class<?>[] converted = null; if (source != null) { converted = new Class<?>[source.length]; for (int i = 0; i < source.length; i++) { if (source[i] != null) { if (!IConnection.class.isInstance(source[i])) { converted[i] = source[i].getClass(); } else { converted[i] = IConnection.class; } } else { converted[i] = null; } } } else { converted = new Class<?>[0]; } if (log.isTraceEnabled()) { log.trace(STR, Arrays.toString(converted)); } return converted; } | /**
* Convert parameters using methods of this utility class. Special handling is afforded to
* classes that implement IConnection.
*
* @param source Array of source object
* @return Array of converted objects
*/ | Convert parameters using methods of this utility class. Special handling is afforded to classes that implement IConnection | convertParams | {
"repo_name": "cwpenhale/red5-mobileconsole",
"path": "red5_server/src/main/java/org/red5/server/util/ConversionUtils.java",
"license": "apache-2.0",
"size": 15903
} | [
"java.util.Arrays",
"org.red5.server.api.IConnection"
] | import java.util.Arrays; import org.red5.server.api.IConnection; | import java.util.*; import org.red5.server.api.*; | [
"java.util",
"org.red5.server"
] | java.util; org.red5.server; | 1,790,740 |
@Override
public Carts readCart(IProtocolClient client, Integer id) throws RemoteException {
Carts cart = new Carts();
if(isClientAuthenticated(client)) {
entityController = InfestPersistence.getControllerInstance(InfestPersistence.Entity.CARTS);
switch(client.getType()) {
case CUSTOMER:
setStatus("readCart(): A/An " + client.getType().name() + " client is requesting this method. Server is now serving the client.");
cart = (Carts) entityController.read(id);
break;
default:
setStatus("readCart(): Server denied request from a/an " + client.getType().name() + " client. This client type IS NOT PERMITTED to request this method.");
cart = null;
break;
}
} else {
setStatus("readCart(): Server denied request from an UN-AUTHENTICATED " + client.getType().name() + " client.");
cart = null;
}
return cart;
}
| Carts function(IProtocolClient client, Integer id) throws RemoteException { Carts cart = new Carts(); if(isClientAuthenticated(client)) { entityController = InfestPersistence.getControllerInstance(InfestPersistence.Entity.CARTS); switch(client.getType()) { case CUSTOMER: setStatus(STR + client.getType().name() + STR); cart = (Carts) entityController.read(id); break; default: setStatus(STR + client.getType().name() + STR); cart = null; break; } } else { setStatus(STR + client.getType().name() + STR); cart = null; } return cart; } | /**
* <h2>method <code>readCart()</code></h2>
* <p>Method <code>readCart</code> is used to read <code>Carts</code> entity
* based on the ID of the <code>Carts</code> entity. This method will return
* complete <code>Carts</code> entity object <b>if and only if</b> the
* <code>IProtocolClient.Type</code> in <code>IProtocolClient</code> object
* included herein is permitted.</p>
*
* @param client <code>IProtocolClient</code> object to execute this method.
* @param id The ID of entity to be read.
* @return Result of client object.
* @throws java.rmi.RemoteException A <code>RemoteException</code> is the
* common superclass for a number of
* communication-related exceptions that
* may occur during the execution of a
* remote method call.
*/ | method <code>readCart()</code> Method <code>readCart</code> is used to read <code>Carts</code> entity based on the ID of the <code>Carts</code> entity. This method will return complete <code>Carts</code> entity object if and only if the <code>IProtocolClient.Type</code> in <code>IProtocolClient</code> object included herein is permitted | readCart | {
"repo_name": "danang-id/infest-administrator",
"path": "src/com/jogjadamai/infest/communication/ProtocolServer.java",
"license": "apache-2.0",
"size": 64092
} | [
"com.jogjadamai.infest.entity.Carts",
"com.jogjadamai.infest.persistence.InfestPersistence",
"java.rmi.RemoteException"
] | import com.jogjadamai.infest.entity.Carts; import com.jogjadamai.infest.persistence.InfestPersistence; import java.rmi.RemoteException; | import com.jogjadamai.infest.entity.*; import com.jogjadamai.infest.persistence.*; import java.rmi.*; | [
"com.jogjadamai.infest",
"java.rmi"
] | com.jogjadamai.infest; java.rmi; | 768,801 |
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Basic( optional = false )
@Column( name = "iduser", nullable = false )
public Integer getId() {
return this.id;
}
| @Id @GeneratedValue(strategy = GenerationType.AUTO) @Basic( optional = false ) @Column( name = STR, nullable = false ) Integer function() { return this.id; } | /**
* Return the value associated with the column: id.
* @return A Integer object (this.id)
*/ | Return the value associated with the column: id | getId | {
"repo_name": "rpgm/mi15",
"path": "rpgm/modules/repository/src/main/java/org/yarlithub/yschool/repository/model/obj/yschool/User.java",
"license": "apache-2.0",
"size": 9631
} | [
"javax.persistence.Basic",
"javax.persistence.Column",
"javax.persistence.GeneratedValue",
"javax.persistence.GenerationType",
"javax.persistence.Id"
] | import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 153,238 |
public Optional<E> getError() {
return Optional.ofNullable(error);
} | Optional<E> function() { return Optional.ofNullable(error); } | /**
* Returns the {@code error} value if present.
*
* @return the {@code error} value if present and not {@code null},
* {@code Optional.empty()} otherwise
*/ | Returns the error value if present | getError | {
"repo_name": "biggis-project/path-optimizer",
"path": "src/main/java/joachimrussig/heatstressrouting/util/Result.java",
"license": "mit",
"size": 7474
} | [
"java.util.Optional"
] | import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,180,667 |
protected void readFontHeader() throws IOException {
seekTab(fontFile, OFTableName.HEAD, 2 * 4 + 2 * 4);
int flags = fontFile.readTTFUShort();
if (log.isDebugEnabled()) {
log.debug("flags: " + flags + " - " + Integer.toString(flags, 2));
}
upem = fontFile.readTTFUShort();
if (log.isDebugEnabled()) {
log.debug("unit per em: " + upem);
}
fontFile.skip(16);
fontBBox1 = fontFile.readTTFShort();
fontBBox2 = fontFile.readTTFShort();
fontBBox3 = fontFile.readTTFShort();
fontBBox4 = fontFile.readTTFShort();
if (log.isDebugEnabled()) {
log.debug("font bbox: xMin=" + fontBBox1
+ " yMin=" + fontBBox2
+ " xMax=" + fontBBox3
+ " yMax=" + fontBBox4);
}
fontFile.skip(2 + 2 + 2);
locaFormat = fontFile.readTTFShort();
} | void function() throws IOException { seekTab(fontFile, OFTableName.HEAD, 2 * 4 + 2 * 4); int flags = fontFile.readTTFUShort(); if (log.isDebugEnabled()) { log.debug(STR + flags + STR + Integer.toString(flags, 2)); } upem = fontFile.readTTFUShort(); if (log.isDebugEnabled()) { log.debug(STR + upem); } fontFile.skip(16); fontBBox1 = fontFile.readTTFShort(); fontBBox2 = fontFile.readTTFShort(); fontBBox3 = fontFile.readTTFShort(); fontBBox4 = fontFile.readTTFShort(); if (log.isDebugEnabled()) { log.debug(STR + fontBBox1 + STR + fontBBox2 + STR + fontBBox3 + STR + fontBBox4); } fontFile.skip(2 + 2 + 2); locaFormat = fontFile.readTTFShort(); } | /**
* Read the "head" table, this reads the bounding box and
* sets the upem (unitsPerEM) variable
* @throws IOException in case of an I/O problem
*/ | Read the "head" table, this reads the bounding box and sets the upem (unitsPerEM) variable | readFontHeader | {
"repo_name": "StrategyObject/fop",
"path": "src/java/org/apache/fop/fonts/truetype/OpenFont.java",
"license": "apache-2.0",
"size": 73342
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,028,623 |
private void validateAndSetAPISecurity(APIProduct apiProduct) {
String apiSecurity = APIConstants.DEFAULT_API_SECURITY_OAUTH2;
String security = apiProduct.getApiSecurity();
if (security!= null) {
apiSecurity = security;
ArrayList<String> securityLevels = selectSecurityLevels(apiSecurity);
apiSecurity = String.join(",", securityLevels);
}
if (log.isDebugEnabled()) {
log.debug("APIProduct " + apiProduct.getId() + " has following enabled protocols : " + apiSecurity);
}
apiProduct.setApiSecurity(apiSecurity);
} | void function(APIProduct apiProduct) { String apiSecurity = APIConstants.DEFAULT_API_SECURITY_OAUTH2; String security = apiProduct.getApiSecurity(); if (security!= null) { apiSecurity = security; ArrayList<String> securityLevels = selectSecurityLevels(apiSecurity); apiSecurity = String.join(",", securityLevels); } if (log.isDebugEnabled()) { log.debug(STR + apiProduct.getId() + STR + apiSecurity); } apiProduct.setApiSecurity(apiSecurity); } | /**
* To validate the API Security options and set it.
*
* @param apiProduct Relevant APIProduct that need to be validated.
*/ | To validate the API Security options and set it | validateAndSetAPISecurity | {
"repo_name": "jaadds/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/APIProviderImpl.java",
"license": "apache-2.0",
"size": 563675
} | [
"java.util.ArrayList",
"org.wso2.carbon.apimgt.api.model.APIProduct"
] | import java.util.ArrayList; import org.wso2.carbon.apimgt.api.model.APIProduct; | import java.util.*; import org.wso2.carbon.apimgt.api.model.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 1,538,677 |
public void serializeXMLToObject(String file) throws FileNotFoundException, IOException{
FileOutputStream os = new FileOutputStream(file);
XMLEncoder encoder = new XMLEncoder(os);
try{
encoder.writeObject(this);
encoder.flush();
} finally{
encoder.close();
}
} | void function(String file) throws FileNotFoundException, IOException{ FileOutputStream os = new FileOutputStream(file); XMLEncoder encoder = new XMLEncoder(os); try{ encoder.writeObject(this); encoder.flush(); } finally{ encoder.close(); } } | /**
* permet de sauvegarder au format XML un fichier de configuration
* @param file nom du fichier de configuration a créer
* @throws Exception
*/ | permet de sauvegarder au format XML un fichier de configuration | serializeXMLToObject | {
"repo_name": "openpreserve/pagelyzer",
"path": "MarcAlizer/src/main/java/Scape/FileConfig.java",
"license": "apache-2.0",
"size": 4957
} | [
"java.beans.XMLEncoder",
"java.io.FileNotFoundException",
"java.io.FileOutputStream",
"java.io.IOException"
] | import java.beans.XMLEncoder; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; | import java.beans.*; import java.io.*; | [
"java.beans",
"java.io"
] | java.beans; java.io; | 2,910,003 |
protected Dimension getScaledPreferredSizeForGraph()
{
mxRectangle bounds = graph.getGraphBounds();
int border = graph.getBorder();
return new Dimension(
(int) Math.round(bounds.getX() + bounds.getWidth()) + border
+ 1, (int) Math.round(bounds.getY()
+ bounds.getHeight())
+ border + 1);
} | Dimension function() { mxRectangle bounds = graph.getGraphBounds(); int border = graph.getBorder(); return new Dimension( (int) Math.round(bounds.getX() + bounds.getWidth()) + border + 1, (int) Math.round(bounds.getY() + bounds.getHeight()) + border + 1); } | /**
* Returns the scaled preferred size for the current graph.
*/ | Returns the scaled preferred size for the current graph | getScaledPreferredSizeForGraph | {
"repo_name": "3w3rt0n/AmeacasInternas",
"path": "src/com/mxgraph/swing/mxGraphComponent.java",
"license": "apache-2.0",
"size": 102365
} | [
"java.awt.Dimension"
] | import java.awt.Dimension; | import java.awt.*; | [
"java.awt"
] | java.awt; | 616,694 |
//-------------------------------------------------------------------------
@Override
public CurrencyParameterSensitivity convertedTo(Currency resultCurrency, FxRateProvider rateProvider) {
if (currency.equals(resultCurrency)) {
return this;
}
double fxRate = rateProvider.fxRate(currency, resultCurrency);
return mapSensitivity(s -> s * fxRate, resultCurrency);
} | CurrencyParameterSensitivity function(Currency resultCurrency, FxRateProvider rateProvider) { if (currency.equals(resultCurrency)) { return this; } double fxRate = rateProvider.fxRate(currency, resultCurrency); return mapSensitivity(s -> s * fxRate, resultCurrency); } | /**
* Converts this sensitivity to an equivalent in the specified currency.
* <p>
* Any FX conversion that is required will use rates from the provider.
*
* @param resultCurrency the currency of the result
* @param rateProvider the provider of FX rates
* @return the sensitivity object expressed in terms of the result currency
* @throws RuntimeException if no FX rate could be found
*/ | Converts this sensitivity to an equivalent in the specified currency. Any FX conversion that is required will use rates from the provider | convertedTo | {
"repo_name": "OpenGamma/Strata",
"path": "modules/market/src/main/java/com/opengamma/strata/market/param/CurrencyParameterSensitivity.java",
"license": "apache-2.0",
"size": 39827
} | [
"com.opengamma.strata.basics.currency.Currency",
"com.opengamma.strata.basics.currency.FxRateProvider"
] | import com.opengamma.strata.basics.currency.Currency; import com.opengamma.strata.basics.currency.FxRateProvider; | import com.opengamma.strata.basics.currency.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 8,426 |
public void searchCommunities(String search) {
WebElement searchInput = driver.findElement(By.id("communitySearch:j_idt38"));
searchInput.clear();
searchInput.sendKeys(search);
driver.findElement(By.id("communitySearch:communitySearch")).click();
}
| void function(String search) { WebElement searchInput = driver.findElement(By.id(STR)); searchInput.clear(); searchInput.sendKeys(search); driver.findElement(By.id(STR)).click(); } | /**
* Search for Communities
*
*/ | Search for Communities | searchCommunities | {
"repo_name": "chr-krenn/fhj-ws2015-sd13-pse",
"path": "pse/src/test/selenium/at/fhj/swd13/pse/test/gui/pageobjects/CommunitiesPage.java",
"license": "mit",
"size": 5808
} | [
"org.openqa.selenium.By",
"org.openqa.selenium.WebElement"
] | import org.openqa.selenium.By; import org.openqa.selenium.WebElement; | import org.openqa.selenium.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 1,868,232 |
EAttribute getSynapseAPI_ApiName(); | EAttribute getSynapseAPI_ApiName(); | /**
* Returns the meta object for the attribute '{@link org.wso2.developerstudio.eclipse.esb.SynapseAPI#getApiName <em>Api Name</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Api Name</em>'.
* @see org.wso2.developerstudio.eclipse.esb.SynapseAPI#getApiName()
* @see #getSynapseAPI()
* @generated
*/ | Returns the meta object for the attribute '<code>org.wso2.developerstudio.eclipse.esb.SynapseAPI#getApiName Api Name</code>'. | getSynapseAPI_ApiName | {
"repo_name": "chanakaudaya/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.esb/src/org/wso2/developerstudio/eclipse/esb/EsbPackage.java",
"license": "apache-2.0",
"size": 373548
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,235,253 |
@Override
public void actionPerformed(ActionEvent event) {
if (this.main.getCas() == null) {
return;
}
org.apache.uima.tools.cvd.tsview.MainFrame tsFrame = new org.apache.uima.tools.cvd.tsview.MainFrame();
tsFrame.addWindowListener(new CloseTypeSystemHandler(this.main));
JComponent tsContentPane = (JComponent) tsFrame.getContentPane();
this.main.setPreferredSize(tsContentPane, MainFrame.tsWindowSizePref);
tsFrame.setTypeSystem(this.main.getCas().getTypeSystem());
tsFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
tsFrame.pack();
tsFrame.setVisible(true);
} | void function(ActionEvent event) { if (this.main.getCas() == null) { return; } org.apache.uima.tools.cvd.tsview.MainFrame tsFrame = new org.apache.uima.tools.cvd.tsview.MainFrame(); tsFrame.addWindowListener(new CloseTypeSystemHandler(this.main)); JComponent tsContentPane = (JComponent) tsFrame.getContentPane(); this.main.setPreferredSize(tsContentPane, MainFrame.tsWindowSizePref); tsFrame.setTypeSystem(this.main.getCas().getTypeSystem()); tsFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); tsFrame.pack(); tsFrame.setVisible(true); } | /**
* Action performed.
*
* @param event
* the event
* @see java.awt.event.ActionListener#actionPerformed(ActionEvent)
*/ | Action performed | actionPerformed | {
"repo_name": "apache/uima-uimaj",
"path": "uimaj-tools/src/main/java/org/apache/uima/tools/cvd/control/ShowTypesystemHandler.java",
"license": "apache-2.0",
"size": 2173
} | [
"java.awt.event.ActionEvent",
"javax.swing.JComponent",
"javax.swing.WindowConstants",
"org.apache.uima.tools.cvd.MainFrame"
] | import java.awt.event.ActionEvent; import javax.swing.JComponent; import javax.swing.WindowConstants; import org.apache.uima.tools.cvd.MainFrame; | import java.awt.event.*; import javax.swing.*; import org.apache.uima.tools.cvd.*; | [
"java.awt",
"javax.swing",
"org.apache.uima"
] | java.awt; javax.swing; org.apache.uima; | 614,364 |
protected boolean checkConditions(
QueryContext queryContext, JSONArray conditionsArray)
throws Exception {
if ((conditionsArray == null) || (conditionsArray.length() == 0)) {
return true;
}
ClauseConditionHandler clauseConditionHandler;
boolean valid = false;
for (int i = 0; i < conditionsArray.length(); i++) {
JSONObject condition = conditionsArray.getJSONObject(i);
String handlerName = condition.getString(
ClauseConfigurationKeys.CONDITION_HANDLER);
String occur = condition.getString(ClauseConfigurationKeys.OCCUR);
// Try to get a clause builder for the query type.
clauseConditionHandler = _clauseConditionHandlerFactory.getHandler(
handlerName);
// Check if condition is valid.
// Return false if no handler is found.
if (clauseConditionHandler != null) {
JSONObject handlerParameters = condition.getJSONObject(
ClauseConfigurationKeys.CONFIGURATION);
if (clauseConditionHandler.isTrue(
queryContext, handlerParameters)) {
valid = true;
}
else {
if (ClauseConfigurationValues.OCCUR_MUST.equals(occur)) {
return false;
}
}
}
else {
return false;
}
}
return valid;
} | boolean function( QueryContext queryContext, JSONArray conditionsArray) throws Exception { if ((conditionsArray == null) (conditionsArray.length() == 0)) { return true; } ClauseConditionHandler clauseConditionHandler; boolean valid = false; for (int i = 0; i < conditionsArray.length(); i++) { JSONObject condition = conditionsArray.getJSONObject(i); String handlerName = condition.getString( ClauseConfigurationKeys.CONDITION_HANDLER); String occur = condition.getString(ClauseConfigurationKeys.OCCUR); clauseConditionHandler = _clauseConditionHandlerFactory.getHandler( handlerName); if (clauseConditionHandler != null) { JSONObject handlerParameters = condition.getJSONObject( ClauseConfigurationKeys.CONFIGURATION); if (clauseConditionHandler.isTrue( queryContext, handlerParameters)) { valid = true; } else { if (ClauseConfigurationValues.OCCUR_MUST.equals(occur)) { return false; } } } else { return false; } } return valid; } | /**
* Checks clause conditions
*
* @param queryContext
* @param conditionsArray
* @return
* @throws Exception
*/ | Checks clause conditions | checkConditions | {
"repo_name": "peerkar/liferay-gsearch",
"path": "liferay-gsearch-workspace/modules/gsearch-core-impl/src/main/java/fi/soveltia/liferay/gsearch/core/impl/query/QueryBuilderImpl.java",
"license": "lgpl-3.0",
"size": 11372
} | [
"com.liferay.portal.kernel.json.JSONArray",
"com.liferay.portal.kernel.json.JSONObject",
"fi.soveltia.liferay.gsearch.core.api.constants.ClauseConfigurationKeys",
"fi.soveltia.liferay.gsearch.core.api.constants.ClauseConfigurationValues",
"fi.soveltia.liferay.gsearch.core.api.query.clause.ClauseConditionHandler",
"fi.soveltia.liferay.gsearch.core.api.query.context.QueryContext"
] | import com.liferay.portal.kernel.json.JSONArray; import com.liferay.portal.kernel.json.JSONObject; import fi.soveltia.liferay.gsearch.core.api.constants.ClauseConfigurationKeys; import fi.soveltia.liferay.gsearch.core.api.constants.ClauseConfigurationValues; import fi.soveltia.liferay.gsearch.core.api.query.clause.ClauseConditionHandler; import fi.soveltia.liferay.gsearch.core.api.query.context.QueryContext; | import com.liferay.portal.kernel.json.*; import fi.soveltia.liferay.gsearch.core.api.constants.*; import fi.soveltia.liferay.gsearch.core.api.query.clause.*; import fi.soveltia.liferay.gsearch.core.api.query.context.*; | [
"com.liferay.portal",
"fi.soveltia.liferay"
] | com.liferay.portal; fi.soveltia.liferay; | 687,405 |
@Test
public void testEqualitySameStart() throws InvalidDnaFormatException {
assertThat(scheme.create('A'), is(scheme.create('A')));
} | void function() throws InvalidDnaFormatException { assertThat(scheme.create('A'), is(scheme.create('A'))); } | /**
* Test Equality for AcceptUnkownDnaEncodingScheme, with same start
*/ | Test Equality for AcceptUnkownDnaEncodingScheme, with same start | testEqualitySameStart | {
"repo_name": "JMBattista/Bioinformatics",
"path": "sequence/src/test/java/com/vitreoussoftware/bioinformatics/sequence/encoding/BasicDnaEncodingSchemeTest.java",
"license": "mit",
"size": 4176
} | [
"com.vitreoussoftware.bioinformatics.sequence.InvalidDnaFormatException",
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import com.vitreoussoftware.bioinformatics.sequence.InvalidDnaFormatException; import org.hamcrest.core.Is; import org.junit.Assert; | import com.vitreoussoftware.bioinformatics.sequence.*; import org.hamcrest.core.*; import org.junit.*; | [
"com.vitreoussoftware.bioinformatics",
"org.hamcrest.core",
"org.junit"
] | com.vitreoussoftware.bioinformatics; org.hamcrest.core; org.junit; | 2,061,286 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.