method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public boolean validateMessageView_isAffectedBy(MessageView messageView, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate (RamPackage.Literals.MESSAGE_VIEW, messageView, diagnostics, context, "http://www.eclipse.org/emf/2002/Ecore/OCL/Pivot", "isAffectedBy", MESSAGE_VIEW__IS_AFFECTED_BY__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0); }
boolean function(MessageView messageView, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate (RamPackage.Literals.MESSAGE_VIEW, messageView, diagnostics, context, STRisAffectedBy", MESSAGE_VIEW__IS_AFFECTED_BY__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0); }
/** * Validates the isAffectedBy constraint of '<em>Message View</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Validates the isAffectedBy constraint of 'Message View'.
validateMessageView_isAffectedBy
{ "repo_name": "mschoettle/ecse429-fall15-project", "path": "ca.mcgill.sel.ram/src/ca/mcgill/sel/ram/util/RamValidator.java", "license": "gpl-2.0", "size": 147268 }
[ "ca.mcgill.sel.ram.MessageView", "ca.mcgill.sel.ram.RamPackage", "java.util.Map", "org.eclipse.emf.common.util.Diagnostic", "org.eclipse.emf.common.util.DiagnosticChain" ]
import ca.mcgill.sel.ram.MessageView; import ca.mcgill.sel.ram.RamPackage; import java.util.Map; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.DiagnosticChain;
import ca.mcgill.sel.ram.*; import java.util.*; import org.eclipse.emf.common.util.*;
[ "ca.mcgill.sel", "java.util", "org.eclipse.emf" ]
ca.mcgill.sel; java.util; org.eclipse.emf;
2,006,680
public void drawAndUpdate(Canvas canvas) { if (canvas == null) return; // Check if we have exceeded the maximum number of generations if (mEmptyTimes > MAX_EMPTY_TIMES) { // restart after a delay; mGolThread.GOLRestarting(); init(mCanvas.getWidth(), mCanvas.getHeight()); return; } // Draw a black background if this is the first generation if (mFirstTime) { mPaint.setColor(Color.BLACK); mCanvas.drawRect(0, 0, mCanvas.getWidth(), mCanvas.getHeight(), mPaint); mFirstTime = false; } if (mChangeList.isEmpty()) { mEmptyTimes++; int cellsMadeAlive = 0; // Look for unfilled spots and start a couple of cells there. int offset = mRand.nextInt(mBoard.length); int loc; for (int i = 0; i < mBoard.length; i++) { loc = (i + offset) % mBoard.length; if ((mBoard[loc] & ALIVE_MASK) == 0) { if (cellsMadeAlive >= MAX_CELLS_TO_MAKE_ALIVE) { break; } int x = loc % mWidth; int y = loc / mWidth; // cell is dead check to see if all it's neighbors are dead if (((mBoard[y * mWidth + x] & ALIVE_MASK) == 0) && ((mBoard[y * mWidth + ((x + 1) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y + 1) % mHeight) * mWidth + ((x + 1) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y - 1 + mHeight) % mHeight) * mWidth + ((x + 1) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y + 1) % mHeight) * mWidth + x] & ALIVE_MASK) == 0) && ((mBoard[((y - 1 + mHeight) % mHeight) * mWidth + x] & ALIVE_MASK) == 0) && ((mBoard[y * mWidth + ((x - 1 + mWidth) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y + 1) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y - 1 + mHeight) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)] & ALIVE_MASK) == 0)) { // all of the neighbors are dead // give this cell a chance to come alive. if (mRand.nextInt(2) == 0) { mChangeList.put(loc, true); cellsMadeAlive++; } } } } } // make changes in the changeList and draw them for (Entry<Integer, Boolean> entry : mChangeList.entrySet()) { int x = entry.getKey() % mWidth; int y = entry.getKey() / mWidth; boolean state = entry.getValue(); if (state) { // make cell alive in the board makeAlive(x, y); // draw alive cell mPaint.setColor(Color.WHITE); mCanvas.drawRect(x * CELL_WIDTH, y * CELL_HEIGHT, (x + 1) * CELL_WIDTH, (y + 1) * CELL_HEIGHT, mPaint); } else { // make cell dead in the board kill(x, y); // draw dead cell mPaint.setColor(Color.BLACK); mCanvas.drawRect(x * CELL_WIDTH, y * CELL_HEIGHT, (x + 1) * CELL_WIDTH, (y + 1) * CELL_HEIGHT, mPaint); } } // compute next changes for (Entry<Integer, Boolean> entry : mChangeList.entrySet()) { int x = entry.getKey() % mWidth; int y = entry.getKey() / mWidth; mCheckSet.add(y * mWidth + x); mCheckSet.add(y * mWidth + ((x + 1) % mWidth)); mCheckSet.add(((y + 1) % mHeight) * mWidth + ((x + 1) % mWidth)); mCheckSet.add(((y - 1 + mHeight) % mHeight) * mWidth + ((x + 1) % mWidth)); mCheckSet.add(((y + 1) % mHeight) * mWidth + x); mCheckSet.add(((y - 1 + mHeight) % mHeight) * mWidth + x); mCheckSet.add(y * mWidth + ((x - 1 + mWidth) % mWidth)); mCheckSet.add(((y + 1) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)); mCheckSet.add(((y - 1 + mHeight) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)); } // check each location in the checkSet for (int loc : mCheckSet) checkCell(loc); mCheckSet.clear(); // swap the changeLists Map<Integer, Boolean> temp = mChangeList; mChangeList = mNextChangeList; mNextChangeList = temp; mNextChangeList.clear(); canvas.drawBitmap(mCanvasBitmap, mIdentityMatrix, null); }
void function(Canvas canvas) { if (canvas == null) return; if (mEmptyTimes > MAX_EMPTY_TIMES) { mGolThread.GOLRestarting(); init(mCanvas.getWidth(), mCanvas.getHeight()); return; } if (mFirstTime) { mPaint.setColor(Color.BLACK); mCanvas.drawRect(0, 0, mCanvas.getWidth(), mCanvas.getHeight(), mPaint); mFirstTime = false; } if (mChangeList.isEmpty()) { mEmptyTimes++; int cellsMadeAlive = 0; int offset = mRand.nextInt(mBoard.length); int loc; for (int i = 0; i < mBoard.length; i++) { loc = (i + offset) % mBoard.length; if ((mBoard[loc] & ALIVE_MASK) == 0) { if (cellsMadeAlive >= MAX_CELLS_TO_MAKE_ALIVE) { break; } int x = loc % mWidth; int y = loc / mWidth; if (((mBoard[y * mWidth + x] & ALIVE_MASK) == 0) && ((mBoard[y * mWidth + ((x + 1) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y + 1) % mHeight) * mWidth + ((x + 1) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y - 1 + mHeight) % mHeight) * mWidth + ((x + 1) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y + 1) % mHeight) * mWidth + x] & ALIVE_MASK) == 0) && ((mBoard[((y - 1 + mHeight) % mHeight) * mWidth + x] & ALIVE_MASK) == 0) && ((mBoard[y * mWidth + ((x - 1 + mWidth) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y + 1) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)] & ALIVE_MASK) == 0) && ((mBoard[((y - 1 + mHeight) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)] & ALIVE_MASK) == 0)) { if (mRand.nextInt(2) == 0) { mChangeList.put(loc, true); cellsMadeAlive++; } } } } } for (Entry<Integer, Boolean> entry : mChangeList.entrySet()) { int x = entry.getKey() % mWidth; int y = entry.getKey() / mWidth; boolean state = entry.getValue(); if (state) { makeAlive(x, y); mPaint.setColor(Color.WHITE); mCanvas.drawRect(x * CELL_WIDTH, y * CELL_HEIGHT, (x + 1) * CELL_WIDTH, (y + 1) * CELL_HEIGHT, mPaint); } else { kill(x, y); mPaint.setColor(Color.BLACK); mCanvas.drawRect(x * CELL_WIDTH, y * CELL_HEIGHT, (x + 1) * CELL_WIDTH, (y + 1) * CELL_HEIGHT, mPaint); } } for (Entry<Integer, Boolean> entry : mChangeList.entrySet()) { int x = entry.getKey() % mWidth; int y = entry.getKey() / mWidth; mCheckSet.add(y * mWidth + x); mCheckSet.add(y * mWidth + ((x + 1) % mWidth)); mCheckSet.add(((y + 1) % mHeight) * mWidth + ((x + 1) % mWidth)); mCheckSet.add(((y - 1 + mHeight) % mHeight) * mWidth + ((x + 1) % mWidth)); mCheckSet.add(((y + 1) % mHeight) * mWidth + x); mCheckSet.add(((y - 1 + mHeight) % mHeight) * mWidth + x); mCheckSet.add(y * mWidth + ((x - 1 + mWidth) % mWidth)); mCheckSet.add(((y + 1) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)); mCheckSet.add(((y - 1 + mHeight) % mHeight) * mWidth + ((x - 1 + mWidth) % mWidth)); } for (int loc : mCheckSet) checkCell(loc); mCheckSet.clear(); Map<Integer, Boolean> temp = mChangeList; mChangeList = mNextChangeList; mNextChangeList = temp; mNextChangeList.clear(); canvas.drawBitmap(mCanvasBitmap, mIdentityMatrix, null); }
/** * Computes and draws the next generation in the game of life. Uses a list * of changes so not every cell needs to be checked. */
Computes and draws the next generation in the game of life. Uses a list of changes so not every cell needs to be checked
drawAndUpdate
{ "repo_name": "GavinDBrown/Amazing", "path": "src/com/GavinDev/Amazing/Maze/GameOfLife.java", "license": "gpl-3.0", "size": 15855 }
[ "android.graphics.Canvas", "android.graphics.Color", "java.util.Map" ]
import android.graphics.Canvas; import android.graphics.Color; import java.util.Map;
import android.graphics.*; import java.util.*;
[ "android.graphics", "java.util" ]
android.graphics; java.util;
1,656,668
public static List<Long> grubbsTest(GeoTimeSerie gts, boolean useMedian, double alpha) throws WarpScriptException { doubleCheck(gts); List<Long> anomalous_ticks = new ArrayList<Long>(); int N = gts.values; if (N < 3) { // no anomalous tick in this case return anomalous_ticks; } double[] musigma = madsigma(gts, useMedian); double m = musigma[0]; double std = musigma[1]; if (0.0D == std) { return anomalous_ticks; } double z = 0.0D; double max = Double.NEGATIVE_INFINITY; long suspicious_tick = 0L; for (int i = 0; i < N; i++) { z = Math.abs((gts.doubleValues[i] - m) / std); if (z > max) { max = z; suspicious_tick = gts.ticks[i]; } } // // Calculate critical value // double t = new TDistribution(N - 2).inverseCumulativeProbability(alpha / (2 * N)); // // Calculate threshold // double Ginf = (N - 1) * Math.abs(t) / Math.sqrt(N * (N - 2 + t * t)); // // Test // if (max > Ginf) { anomalous_ticks.add(suspicious_tick); } return anomalous_ticks; }
static List<Long> function(GeoTimeSerie gts, boolean useMedian, double alpha) throws WarpScriptException { doubleCheck(gts); List<Long> anomalous_ticks = new ArrayList<Long>(); int N = gts.values; if (N < 3) { return anomalous_ticks; } double[] musigma = madsigma(gts, useMedian); double m = musigma[0]; double std = musigma[1]; if (0.0D == std) { return anomalous_ticks; } double z = 0.0D; double max = Double.NEGATIVE_INFINITY; long suspicious_tick = 0L; for (int i = 0; i < N; i++) { z = Math.abs((gts.doubleValues[i] - m) / std); if (z > max) { max = z; suspicious_tick = gts.ticks[i]; } } double t = new TDistribution(N - 2).inverseCumulativeProbability(alpha / (2 * N)); double Ginf = (N - 1) * Math.abs(t) / Math.sqrt(N * (N - 2 + t * t)); if (max > Ginf) { anomalous_ticks.add(suspicious_tick); } return anomalous_ticks; }
/** * Applying Grubbs' test using mean/std or median/mad * @see http://www.itl.nist.gov/div898/handbook/eda/section3/eda35h1.htm * * @param gts * @param useMedian Should the test use median/mad instead of mean/std * @param alpha Significance level with which to accept or reject anomalies. Default is 0.05 * * @return anomalous_ticks * * @throws WarpScriptException */
Applying Grubbs' test using mean/std or median/mad
grubbsTest
{ "repo_name": "hbs/warp10-platform", "path": "warp10/src/main/java/io/warp10/continuum/gts/GTSOutliersHelper.java", "license": "apache-2.0", "size": 25525 }
[ "io.warp10.script.WarpScriptException", "java.util.ArrayList", "java.util.List", "org.apache.commons.math3.distribution.TDistribution" ]
import io.warp10.script.WarpScriptException; import java.util.ArrayList; import java.util.List; import org.apache.commons.math3.distribution.TDistribution;
import io.warp10.script.*; import java.util.*; import org.apache.commons.math3.distribution.*;
[ "io.warp10.script", "java.util", "org.apache.commons" ]
io.warp10.script; java.util; org.apache.commons;
1,730,009
@DoesServiceRequest public ServiceStats getServiceStats() throws StorageException { return this.getServiceStats(null , null ); }
ServiceStats function() throws StorageException { return this.getServiceStats(null , null ); }
/** * Queries the service for the {@link ServiceStats}. * * @return A {@link ServiceStats} object for the given storage service. * * @throws StorageException * If a storage service error occurred. */
Queries the service for the <code>ServiceStats</code>
getServiceStats
{ "repo_name": "horizon-institute/runspotrun-android-client", "path": "src/com/microsoft/azure/storage/blob/CloudBlobClient.java", "license": "agpl-3.0", "size": 29857 }
[ "com.microsoft.azure.storage.ServiceStats", "com.microsoft.azure.storage.StorageException" ]
import com.microsoft.azure.storage.ServiceStats; import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
426,977
public void printThreadPoolStats(PrintStream outs) { ObjectName query; try { query = new ObjectName("org.apache.cassandra.concurrent:type=*"); Set<ObjectName> result = mbeanServerConn.queryNames(query, null); for (ObjectName objectName : result) { String poolName = objectName.getKeyProperty("type"); IExecutorMBean threadPoolProxy = JMX.newMBeanProxy(mbeanServerConn, objectName, IExecutorMBean.class); outs.println(poolName + ", pending tasks=" + threadPoolProxy.getPendingTasks()); } } catch (MalformedObjectNameException e) { throw new RuntimeException("Invalid ObjectName? Please report this as a bug.", e); } catch (IOException e) { throw new RuntimeException("Could not retrieve list of stat mbeans.", e); } }
void function(PrintStream outs) { ObjectName query; try { query = new ObjectName(STR); Set<ObjectName> result = mbeanServerConn.queryNames(query, null); for (ObjectName objectName : result) { String poolName = objectName.getKeyProperty("type"); IExecutorMBean threadPoolProxy = JMX.newMBeanProxy(mbeanServerConn, objectName, IExecutorMBean.class); outs.println(poolName + STR + threadPoolProxy.getPendingTasks()); } } catch (MalformedObjectNameException e) { throw new RuntimeException(STR, e); } catch (IOException e) { throw new RuntimeException(STR, e); } }
/** * Print out the size of the queues in the thread pools * * @param outs Output stream to generate the output on. */
Print out the size of the queues in the thread pools
printThreadPoolStats
{ "repo_name": "sammyyu/Cassandra", "path": "src/java/org/apache/cassandra/tools/NodeProbe.java", "license": "apache-2.0", "size": 21669 }
[ "java.io.IOException", "java.io.PrintStream", "java.util.Set", "javax.management.JMX", "javax.management.MalformedObjectNameException", "javax.management.ObjectName", "org.apache.cassandra.concurrent.IExecutorMBean" ]
import java.io.IOException; import java.io.PrintStream; import java.util.Set; import javax.management.JMX; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; import org.apache.cassandra.concurrent.IExecutorMBean;
import java.io.*; import java.util.*; import javax.management.*; import org.apache.cassandra.concurrent.*;
[ "java.io", "java.util", "javax.management", "org.apache.cassandra" ]
java.io; java.util; javax.management; org.apache.cassandra;
1,077,919
String getVApp(String org, String vdc, String service, String vmName, PaasManagerUser user) throws IPNotRetrievedException, ClaudiaResourceNotFoundException, NetworkNotRetrievedException, OSNotRetrievedException;
String getVApp(String org, String vdc, String service, String vmName, PaasManagerUser user) throws IPNotRetrievedException, ClaudiaResourceNotFoundException, NetworkNotRetrievedException, OSNotRetrievedException;
/** * Get VApp of a Virtual Machine. */
Get VApp of a Virtual Machine
getVApp
{ "repo_name": "hmunfru/fiware-paas", "path": "core/src/main/java/com/telefonica/euro_iaas/paasmanager/claudia/ClaudiaClient.java", "license": "apache-2.0", "size": 7534 }
[ "com.telefonica.euro_iaas.paasmanager.exception.ClaudiaResourceNotFoundException", "com.telefonica.euro_iaas.paasmanager.exception.IPNotRetrievedException", "com.telefonica.euro_iaas.paasmanager.exception.NetworkNotRetrievedException", "com.telefonica.euro_iaas.paasmanager.exception.OSNotRetrievedException", "com.telefonica.euro_iaas.paasmanager.model.dto.PaasManagerUser" ]
import com.telefonica.euro_iaas.paasmanager.exception.ClaudiaResourceNotFoundException; import com.telefonica.euro_iaas.paasmanager.exception.IPNotRetrievedException; import com.telefonica.euro_iaas.paasmanager.exception.NetworkNotRetrievedException; import com.telefonica.euro_iaas.paasmanager.exception.OSNotRetrievedException; import com.telefonica.euro_iaas.paasmanager.model.dto.PaasManagerUser;
import com.telefonica.euro_iaas.paasmanager.exception.*; import com.telefonica.euro_iaas.paasmanager.model.dto.*;
[ "com.telefonica.euro_iaas" ]
com.telefonica.euro_iaas;
2,561,855
@Test public void statesLongTest() { DataPipe pipeToTransform = new DataPipe(); EquivalenceClassTransformer eqTransformer = new EquivalenceClassTransformer(); String[] statesLong = { "Alabama", "Alaska", "American Samoa", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Dist. of Columbia", "Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Marshall Islands", "Massachusetts", "Michigan", "Micronesia", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northern Marianas", "Ohio", "Oklahoma", "Oregon", "Palau", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Virgin Islands", "Washington", "West Virginia", "Wisconsin", "Wyoming"}; Assert.assertTrue("Missed state long name(s)!", EquivalenceClassTransformer.STATE_LONG.length == 59); HashSet<String> statesLongLookUp = new HashSet<>(Arrays.asList(statesLong)); // check 'state' for (int i = 0; i < 500; i++) { pipeToTransform.getDataMap().put("TEST_states", "%state"); eqTransformer.transform(pipeToTransform); Assert.assertTrue("Wrong state name(s)! Have '" + pipeToTransform.getDataMap().get("TEST_states") + "'," + " but wait for one of '" + statesLongLookUp + "'...", statesLongLookUp.contains(pipeToTransform.getDataMap().get("TEST_states"))); } // check 'stateLong' for (int i = 0; i < 500; i++) { pipeToTransform.getDataMap().put("TEST_statesLong", "%stateLong"); eqTransformer.transform(pipeToTransform); Assert.assertTrue("Wrong state long name(s)! Have '" + pipeToTransform.getDataMap().get("TEST_statesLong") + "'," + " but wait for one of '" + statesLongLookUp + "'...", statesLongLookUp.contains(pipeToTransform.getDataMap().get("TEST_statesLong"))); } }
void function() { DataPipe pipeToTransform = new DataPipe(); EquivalenceClassTransformer eqTransformer = new EquivalenceClassTransformer(); String[] statesLong = { STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, "Guam", STR, "Idaho", STR, STR, "Iowa", STR, STR, STR, "Maine", STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, STR, "Ohio", STR, STR, "Palau", STR, STR, STR, STR, STR, STR, "Texas", "Utah", STR, STR, STR, STR, STR, STR, STR}; Assert.assertTrue(STR, EquivalenceClassTransformer.STATE_LONG.length == 59); HashSet<String> statesLongLookUp = new HashSet<>(Arrays.asList(statesLong)); for (int i = 0; i < 500; i++) { pipeToTransform.getDataMap().put(STR, STR); eqTransformer.transform(pipeToTransform); Assert.assertTrue(STR + pipeToTransform.getDataMap().get(STR) + "'," + STR + statesLongLookUp + "'...", statesLongLookUp.contains(pipeToTransform.getDataMap().get(STR))); } for (int i = 0; i < 500; i++) { pipeToTransform.getDataMap().put(STR, STR); eqTransformer.transform(pipeToTransform); Assert.assertTrue(STR + pipeToTransform.getDataMap().get(STR) + "'," + STR + statesLongLookUp + "'...", statesLongLookUp.contains(pipeToTransform.getDataMap().get(STR))); } }
/** * %state or $stateLong generates from a predefined list */
%state or $stateLong generates from a predefined list
statesLongTest
{ "repo_name": "leeny324/DataGenerator", "path": "dg-core/src/test/java/org/finra/datagenerator/consumer/EquivalenceClassTransformerTest.java", "license": "apache-2.0", "size": 27496 }
[ "java.util.Arrays", "java.util.HashSet", "org.junit.Assert" ]
import java.util.Arrays; import java.util.HashSet; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,619,507
@Test public void testToManyReadOnly() throws DatabaseException { open(); PrimaryIndex<Integer, ToManyKeyEntity> priIndex = store.getPrimaryIndex(Integer.class, ToManyKeyEntity.class); priIndex.put(new ToManyKeyEntity()); close(); openReadOnly(); priIndex = store.getPrimaryIndex(Integer.class, ToManyKeyEntity.class); SecondaryIndex<ToManyKey, Integer, ToManyKeyEntity> secIndex = store.getSecondaryIndex(priIndex, ToManyKey.class, "key2"); secIndex.get(new ToManyKey()); close(); } @Persistent static class ToManyKey { @KeyField(1) int value = 99; } @Entity static class ToManyKeyEntity { @PrimaryKey int key = 88; @SecondaryKey(relate=ONE_TO_MANY) Set<ToManyKey> key2; ToManyKeyEntity() { key2 = new HashSet<ToManyKey>(); key2.add(new ToManyKey()); } }
void function() throws DatabaseException { open(); PrimaryIndex<Integer, ToManyKeyEntity> priIndex = store.getPrimaryIndex(Integer.class, ToManyKeyEntity.class); priIndex.put(new ToManyKeyEntity()); close(); openReadOnly(); priIndex = store.getPrimaryIndex(Integer.class, ToManyKeyEntity.class); SecondaryIndex<ToManyKey, Integer, ToManyKeyEntity> secIndex = store.getSecondaryIndex(priIndex, ToManyKey.class, "key2"); secIndex.get(new ToManyKey()); close(); } static class ToManyKey { @KeyField(1) int value = 99; } static class ToManyKeyEntity { int key = 88; @SecondaryKey(relate=ONE_TO_MANY) Set<ToManyKey> key2; ToManyKeyEntity() { key2 = new HashSet<ToManyKey>(); key2.add(new ToManyKey()); } }
/** * Test a fix for a bug where opening a TO_MANY secondary index would fail * fail with "IllegalArgumentException: Wrong secondary key class: ..." * when the store was opened read-only. [#15156] */
Test a fix for a bug where opening a TO_MANY secondary index would fail fail with "IllegalArgumentException: Wrong secondary key class: ..." when the store was opened read-only. [#15156]
testToManyReadOnly
{ "repo_name": "hyc/BerkeleyDB", "path": "test/java/compat/src/com/sleepycat/persist/test/OperationTest.java", "license": "agpl-3.0", "size": 50010 }
[ "com.sleepycat.db.DatabaseException", "com.sleepycat.persist.PrimaryIndex", "com.sleepycat.persist.SecondaryIndex", "com.sleepycat.persist.model.KeyField", "com.sleepycat.persist.model.SecondaryKey", "java.util.HashSet", "java.util.Set" ]
import com.sleepycat.db.DatabaseException; import com.sleepycat.persist.PrimaryIndex; import com.sleepycat.persist.SecondaryIndex; import com.sleepycat.persist.model.KeyField; import com.sleepycat.persist.model.SecondaryKey; import java.util.HashSet; import java.util.Set;
import com.sleepycat.db.*; import com.sleepycat.persist.*; import com.sleepycat.persist.model.*; import java.util.*;
[ "com.sleepycat.db", "com.sleepycat.persist", "java.util" ]
com.sleepycat.db; com.sleepycat.persist; java.util;
685,002
private static void assertEquals(int expected, Integer actual) { Assert.assertNotNull(actual); Assert.assertEquals(expected, actual.intValue()); }
static void function(int expected, Integer actual) { Assert.assertNotNull(actual); Assert.assertEquals(expected, actual.intValue()); }
/** * Asserts that <code>expected</code> and actual are equal. * * @param expected the expected value * @param actual the actual value */
Asserts that <code>expected</code> and actual are equal
assertEquals
{ "repo_name": "QualiMaster/Infrastructure", "path": "CoordinationLayer/src/tests/eu/qualimaster/coordination/ManagerTests.java", "license": "apache-2.0", "size": 23468 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,849,438
public static ClassLoader getClassLoader(DeploymentId deploymentId, IServiceContext appCtx) throws HyracksException { IJobSerializerDeserializerContainer jobSerDeContainer = appCtx.getJobSerializerDeserializerContainer(); IJobSerializerDeserializer jobSerDe = deploymentId == null ? null : jobSerDeContainer.getJobSerializerDeserializer(deploymentId); return jobSerDe == null ? DeploymentUtils.class.getClassLoader() : jobSerDe.getClassLoader(); }
static ClassLoader function(DeploymentId deploymentId, IServiceContext appCtx) throws HyracksException { IJobSerializerDeserializerContainer jobSerDeContainer = appCtx.getJobSerializerDeserializerContainer(); IJobSerializerDeserializer jobSerDe = deploymentId == null ? null : jobSerDeContainer.getJobSerializerDeserializer(deploymentId); return jobSerDe == null ? DeploymentUtils.class.getClassLoader() : jobSerDe.getClassLoader(); }
/** * Get the classloader of a specific deployment * * @param deploymentId * @param appCtx * @return * @throws HyracksException */
Get the classloader of a specific deployment
getClassLoader
{ "repo_name": "ecarm002/incubator-asterixdb", "path": "hyracks-fullstack/hyracks/hyracks-control/hyracks-control-common/src/main/java/org/apache/hyracks/control/common/deployment/DeploymentUtils.java", "license": "apache-2.0", "size": 8926 }
[ "org.apache.hyracks.api.application.IServiceContext", "org.apache.hyracks.api.deployment.DeploymentId", "org.apache.hyracks.api.exceptions.HyracksException", "org.apache.hyracks.api.job.IJobSerializerDeserializer", "org.apache.hyracks.api.job.IJobSerializerDeserializerContainer" ]
import org.apache.hyracks.api.application.IServiceContext; import org.apache.hyracks.api.deployment.DeploymentId; import org.apache.hyracks.api.exceptions.HyracksException; import org.apache.hyracks.api.job.IJobSerializerDeserializer; import org.apache.hyracks.api.job.IJobSerializerDeserializerContainer;
import org.apache.hyracks.api.application.*; import org.apache.hyracks.api.deployment.*; import org.apache.hyracks.api.exceptions.*; import org.apache.hyracks.api.job.*;
[ "org.apache.hyracks" ]
org.apache.hyracks;
221,542
@ApiModelProperty(example = "null", value = "The first section in a Word or Excel document the watermark is visible") public Integer getStartSection() { return startSection; }
@ApiModelProperty(example = "null", value = STR) Integer function() { return startSection; }
/** * The first section in a Word or Excel document the watermark is visible * @return startSection **/
The first section in a Word or Excel document the watermark is visible
getStartSection
{ "repo_name": "Muhimbi/PDF-Converter-Services-Online", "path": "clients/v1/java/client/src/main/java/com/muhimbi/online/client/model/QrCodeWatermarkData.java", "license": "apache-2.0", "size": 26617 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
2,194,427
PointF getOutputSize(@NonNull Point inputSize) { Matrix matrix = new Matrix(); matrix.preConcat(flipRotate.getLocalMatrix()); matrix.preConcat(cropEditorElement.getLocalMatrix()); matrix.preConcat(cropEditorElement.getEditorMatrix()); EditorElement mainImage = getMainImage(); if (mainImage != null) { float xScale = 1f / (xScale(mainImage.getLocalMatrix()) * xScale(mainImage.getEditorMatrix())); matrix.preScale(xScale, xScale); } float[] dst = new float[4]; matrix.mapPoints(dst, new float[]{ 0, 0, inputSize.x, inputSize.y }); float widthF = Math.abs(dst[0] - dst[2]); float heightF = Math.abs(dst[1] - dst[3]); return new PointF(widthF, heightF); }
PointF getOutputSize(@NonNull Point inputSize) { Matrix matrix = new Matrix(); matrix.preConcat(flipRotate.getLocalMatrix()); matrix.preConcat(cropEditorElement.getLocalMatrix()); matrix.preConcat(cropEditorElement.getEditorMatrix()); EditorElement mainImage = getMainImage(); if (mainImage != null) { float xScale = 1f / (xScale(mainImage.getLocalMatrix()) * xScale(mainImage.getEditorMatrix())); matrix.preScale(xScale, xScale); } float[] dst = new float[4]; matrix.mapPoints(dst, new float[]{ 0, 0, inputSize.x, inputSize.y }); float widthF = Math.abs(dst[0] - dst[2]); float heightF = Math.abs(dst[1] - dst[3]); return new PointF(widthF, heightF); }
/** * Calculates the exact output size based upon the crops/rotates and zooms in the hierarchy. * * @param inputSize Main image size * @return Size after applying all zooms/rotates and crops */
Calculates the exact output size based upon the crops/rotates and zooms in the hierarchy
getOutputSize
{ "repo_name": "WhisperSystems/TextSecure", "path": "app/src/main/java/org/thoughtcrime/securesms/imageeditor/model/EditorElementHierarchy.java", "license": "gpl-3.0", "size": 11788 }
[ "android.graphics.Matrix", "android.graphics.Point", "android.graphics.PointF", "androidx.annotation.NonNull" ]
import android.graphics.Matrix; import android.graphics.Point; import android.graphics.PointF; import androidx.annotation.NonNull;
import android.graphics.*; import androidx.annotation.*;
[ "android.graphics", "androidx.annotation" ]
android.graphics; androidx.annotation;
491,841
@Override public JComponent prepareRenderingComponent(JXMonthView monthView, Calendar calendar, CalendarState dayState) { JComponent component = super.prepareRenderingComponent(monthView, calendar, dayState); return (JComponent) getHighlighter().highlight( component, getCalendarAdapter(monthView, calendar, dayState)); }
JComponent function(JXMonthView monthView, Calendar calendar, CalendarState dayState) { JComponent component = super.prepareRenderingComponent(monthView, calendar, dayState); return (JComponent) getHighlighter().highlight( component, getCalendarAdapter(monthView, calendar, dayState)); }
/** * Overridden to apply the additional highlighters, if any. */
Overridden to apply the additional highlighters, if any
prepareRenderingComponent
{ "repo_name": "trejkaz/swingx", "path": "swingx-demos/swingx-demos-content/src/main/java/org/jdesktop/swingx/plaf/basic/DemoCalendarRenderingHandler.java", "license": "lgpl-2.1", "size": 5808 }
[ "java.util.Calendar", "javax.swing.JComponent", "org.jdesktop.swingx.JXMonthView" ]
import java.util.Calendar; import javax.swing.JComponent; import org.jdesktop.swingx.JXMonthView;
import java.util.*; import javax.swing.*; import org.jdesktop.swingx.*;
[ "java.util", "javax.swing", "org.jdesktop.swingx" ]
java.util; javax.swing; org.jdesktop.swingx;
2,698,363
public static boolean setSystemCursor(int cursorID) { int cursor_type = 0; //PointerIcon.TYPE_NULL; switch (cursorID) { case SDL_SYSTEM_CURSOR_ARROW: cursor_type = 1000; //PointerIcon.TYPE_ARROW; break; case SDL_SYSTEM_CURSOR_IBEAM: cursor_type = 1008; //PointerIcon.TYPE_TEXT; break; case SDL_SYSTEM_CURSOR_WAIT: cursor_type = 1004; //PointerIcon.TYPE_WAIT; break; case SDL_SYSTEM_CURSOR_CROSSHAIR: cursor_type = 1007; //PointerIcon.TYPE_CROSSHAIR; break; case SDL_SYSTEM_CURSOR_WAITARROW: cursor_type = 1004; //PointerIcon.TYPE_WAIT; break; case SDL_SYSTEM_CURSOR_SIZENWSE: cursor_type = 1017; //PointerIcon.TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW; break; case SDL_SYSTEM_CURSOR_SIZENESW: cursor_type = 1016; //PointerIcon.TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW; break; case SDL_SYSTEM_CURSOR_SIZEWE: cursor_type = 1014; //PointerIcon.TYPE_HORIZONTAL_DOUBLE_ARROW; break; case SDL_SYSTEM_CURSOR_SIZENS: cursor_type = 1015; //PointerIcon.TYPE_VERTICAL_DOUBLE_ARROW; break; case SDL_SYSTEM_CURSOR_SIZEALL: cursor_type = 1020; //PointerIcon.TYPE_GRAB; break; case SDL_SYSTEM_CURSOR_NO: cursor_type = 1012; //PointerIcon.TYPE_NO_DROP; break; case SDL_SYSTEM_CURSOR_HAND: cursor_type = 1002; //PointerIcon.TYPE_HAND; break; } if (Build.VERSION.SDK_INT >= 24) { try { mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type)); } catch (Exception e) { return false; } } return true; }
static boolean function(int cursorID) { int cursor_type = 0; switch (cursorID) { case SDL_SYSTEM_CURSOR_ARROW: cursor_type = 1000; break; case SDL_SYSTEM_CURSOR_IBEAM: cursor_type = 1008; break; case SDL_SYSTEM_CURSOR_WAIT: cursor_type = 1004; break; case SDL_SYSTEM_CURSOR_CROSSHAIR: cursor_type = 1007; break; case SDL_SYSTEM_CURSOR_WAITARROW: cursor_type = 1004; break; case SDL_SYSTEM_CURSOR_SIZENWSE: cursor_type = 1017; break; case SDL_SYSTEM_CURSOR_SIZENESW: cursor_type = 1016; break; case SDL_SYSTEM_CURSOR_SIZEWE: cursor_type = 1014; break; case SDL_SYSTEM_CURSOR_SIZENS: cursor_type = 1015; break; case SDL_SYSTEM_CURSOR_SIZEALL: cursor_type = 1020; break; case SDL_SYSTEM_CURSOR_NO: cursor_type = 1012; break; case SDL_SYSTEM_CURSOR_HAND: cursor_type = 1002; break; } if (Build.VERSION.SDK_INT >= 24) { try { mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type)); } catch (Exception e) { return false; } } return true; }
/** * This method is called by SDL using JNI. */
This method is called by SDL using JNI
setSystemCursor
{ "repo_name": "nrz/ylikuutio", "path": "external/SDL2-2.0.14/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java", "license": "agpl-3.0", "size": 83693 }
[ "android.os.Build", "android.view.PointerIcon" ]
import android.os.Build; import android.view.PointerIcon;
import android.os.*; import android.view.*;
[ "android.os", "android.view" ]
android.os; android.view;
2,149,169
Calendar getEnableDate(Currency currency, RateType rateType);
Calendar getEnableDate(Currency currency, RateType rateType);
/** * gets the enabling date of the specified rate type. Returns null if no rateType specified, or no rate enabled. This is not necessarily the * enableDate of the present valid RateParameters. This method seeks the enabling date of the rate regardless of any field value changes in the * meantime. */
gets the enabling date of the specified rate type. Returns null if no rateType specified, or no rate enabled. This is not necessarily the enableDate of the present valid RateParameters. This method seeks the enabling date of the rate regardless of any field value changes in the meantime
getEnableDate
{ "repo_name": "robertoandrade/cyclos", "path": "src/nl/strohalm/cyclos/services/accounts/rates/RateService.java", "license": "gpl-2.0", "size": 5612 }
[ "java.util.Calendar", "nl.strohalm.cyclos.entities.accounts.Currency" ]
import java.util.Calendar; import nl.strohalm.cyclos.entities.accounts.Currency;
import java.util.*; import nl.strohalm.cyclos.entities.accounts.*;
[ "java.util", "nl.strohalm.cyclos" ]
java.util; nl.strohalm.cyclos;
1,644,443
private Object[] evaluateParameterExpressions(Exchange exchange, Object body, Iterator<?> it) { Object[] answer = new Object[expressions.length]; for (int i = 0; i < expressions.length; i++) { if (body instanceof StreamCache) { // need to reset stream cache for each expression as you may access the message body in multiple parameters ((StreamCache) body).reset(); } // grab the parameter value for the given index Object parameterValue = it != null && it.hasNext() ? it.next() : null; // and the expected parameter type Class<?> parameterType = parameters.get(i).getType(); // the value for the parameter to use Object value = null; // prefer to use parameter value if given, as they override any bean parameter binding // we should skip * as its a type placeholder to indicate any type if (parameterValue != null && !parameterValue.equals("*")) { // evaluate the parameter value binding value = evaluateParameterValue(exchange, i, parameterValue, parameterType); } // use bean parameter binding, if still no value Expression expression = expressions[i]; if (value == null && expression != null) { value = evaluateParameterBinding(exchange, expression, i, parameterType); } // remember the value to use if (value != Void.TYPE) { answer[i] = value; } } return answer; }
Object[] function(Exchange exchange, Object body, Iterator<?> it) { Object[] answer = new Object[expressions.length]; for (int i = 0; i < expressions.length; i++) { if (body instanceof StreamCache) { ((StreamCache) body).reset(); } Object parameterValue = it != null && it.hasNext() ? it.next() : null; Class<?> parameterType = parameters.get(i).getType(); Object value = null; if (parameterValue != null && !parameterValue.equals("*")) { value = evaluateParameterValue(exchange, i, parameterValue, parameterType); } Expression expression = expressions[i]; if (value == null && expression != null) { value = evaluateParameterBinding(exchange, expression, i, parameterType); } if (value != Void.TYPE) { answer[i] = value; } } return answer; }
/** * Evaluates all the parameter expressions */
Evaluates all the parameter expressions
evaluateParameterExpressions
{ "repo_name": "objectiser/camel", "path": "components/camel-bean/src/main/java/org/apache/camel/component/bean/MethodInfo.java", "license": "apache-2.0", "size": 34073 }
[ "java.util.Iterator", "org.apache.camel.Exchange", "org.apache.camel.Expression", "org.apache.camel.StreamCache" ]
import java.util.Iterator; import org.apache.camel.Exchange; import org.apache.camel.Expression; import org.apache.camel.StreamCache;
import java.util.*; import org.apache.camel.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
1,340,333
@ExcludeBrowsers({ BrowserType.IPAD, BrowserType.IPHONE }) public void testComponentWithRegisteredEventsAsync() throws Exception { DefDescriptor<ComponentDef> stub = addSourceAutoCleanup( ComponentDef.class, getIntegrationStubMarkup( "java://org.auraframework.impl.renderer.sampleJavaRenderers.RendererForAISWithCustomJScript", true, true, true, true) ); verifyComponentWithRegisteredEvents(stub, false); }
@ExcludeBrowsers({ BrowserType.IPAD, BrowserType.IPHONE }) void function() throws Exception { DefDescriptor<ComponentDef> stub = addSourceAutoCleanup( ComponentDef.class, getIntegrationStubMarkup( "java: true, true, true, true) ); verifyComponentWithRegisteredEvents(stub, false); }
/** * Verify use of integration service to inject a component and initialize events with javascript function handlers. * (ASYNC) */
Verify use of integration service to inject a component and initialize events with javascript function handlers. (ASYNC)
testComponentWithRegisteredEventsAsync
{ "repo_name": "badlogicmanpreet/aura", "path": "aura-integration-test/src/test/java/org/auraframework/integration/test/IntegrationServiceImplUITest.java", "license": "apache-2.0", "size": 43019 }
[ "org.auraframework.def.ComponentDef", "org.auraframework.def.DefDescriptor", "org.auraframework.test.util.WebDriverUtil" ]
import org.auraframework.def.ComponentDef; import org.auraframework.def.DefDescriptor; import org.auraframework.test.util.WebDriverUtil;
import org.auraframework.def.*; import org.auraframework.test.util.*;
[ "org.auraframework.def", "org.auraframework.test" ]
org.auraframework.def; org.auraframework.test;
988,421
@Test public void testDateTimeSerialization() throws IOException { LocalDateTime now = LocalDateTime.now(); FsJob job = FsJob.builder().setLastrun(now).build(); String json = prettyMapper.writeValueAsString(job); FsJob generated = prettyMapper.readValue(json, FsJob.class); assertThat(generated.getLastrun(), is(now)); }
void function() throws IOException { LocalDateTime now = LocalDateTime.now(); FsJob job = FsJob.builder().setLastrun(now).build(); String json = prettyMapper.writeValueAsString(job); FsJob generated = prettyMapper.readValue(json, FsJob.class); assertThat(generated.getLastrun(), is(now)); }
/** * We check that the date which is generated on disk does not change when we read it again * @throws IOException In case of serialization problem */
We check that the date which is generated on disk does not change when we read it again
testDateTimeSerialization
{ "repo_name": "dadoonet/fscrawler", "path": "beans/src/test/java/fr/pilato/elasticsearch/crawler/fs/beans/FsJobParserTest.java", "license": "apache-2.0", "size": 2636 }
[ "java.io.IOException", "java.time.LocalDateTime", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import java.io.IOException; import java.time.LocalDateTime; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import java.io.*; import java.time.*; import org.hamcrest.*;
[ "java.io", "java.time", "org.hamcrest" ]
java.io; java.time; org.hamcrest;
668,899
public XYItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = new State(info); state.seriesPath = new GeneralPath(); state.seriesIndex = -1; return state; }
XYItemRendererState function(Graphics2D g2, Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info) { State state = new State(info); state.seriesPath = new GeneralPath(); state.seriesIndex = -1; return state; }
/** * Initialises the renderer. * <P> * This method will be called before the first item is rendered, giving the * renderer an opportunity to initialise any state information it wants to * maintain. The renderer can do nothing if it chooses. * * @param g2 the graphics device. * @param dataArea the area inside the axes. * @param plot the plot. * @param data the data. * @param info an optional info collection object to return data back to * the caller. * * @return The renderer state. */
Initialises the renderer. This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses
initialise
{ "repo_name": "ibestvina/multithread-centiscape", "path": "CentiScaPe2.1/src/main/java/org/jfree/chart/renderer/xy/StandardXYItemRenderer.java", "license": "mit", "size": 40508 }
[ "java.awt.Graphics2D", "java.awt.geom.GeneralPath", "java.awt.geom.Rectangle2D", "org.jfree.chart.plot.PlotRenderingInfo", "org.jfree.chart.plot.XYPlot", "org.jfree.data.xy.XYDataset" ]
import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import org.jfree.chart.plot.PlotRenderingInfo; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset;
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.plot.*; import org.jfree.data.xy.*;
[ "java.awt", "org.jfree.chart", "org.jfree.data" ]
java.awt; org.jfree.chart; org.jfree.data;
2,716,008
@Override public NBTTagCompound writeToNBT(NBTTagCompound tCompound) { super.writeToNBT(tCompound); for (int i = 0; i < 9; i++) { NBTTagCompound tc = new NBTTagCompound(); inventory.get(i).writeToNBT(tc); tCompound.setTag("inventory" + i, tc); } tCompound.setByte("mode", (byte) mode); tCompound.setByte("fuzzySetting", (byte) fuzzySetting); tCompound.setInteger("savedPulses", savedPulses); return tCompound; }
NBTTagCompound function(NBTTagCompound tCompound) { super.writeToNBT(tCompound); for (int i = 0; i < 9; i++) { NBTTagCompound tc = new NBTTagCompound(); inventory.get(i).writeToNBT(tc); tCompound.setTag(STR + i, tc); } tCompound.setByte("mode", (byte) mode); tCompound.setByte(STR, (byte) fuzzySetting); tCompound.setInteger(STR, savedPulses); return tCompound; }
/** * This function gets called whenever the world/chunk is saved */
This function gets called whenever the world/chunk is saved
writeToNBT
{ "repo_name": "MoreThanHidden/BluePower", "path": "src/main/java/com/bluepowermod/tile/tier1/TileItemDetector.java", "license": "gpl-3.0", "size": 7509 }
[ "net.minecraft.nbt.NBTTagCompound" ]
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.*;
[ "net.minecraft.nbt" ]
net.minecraft.nbt;
439,290
public void persist(String fileName) throws IOException { for(V v : getGraph().getVertices()) { Point p = new Point(transform(v)); locations.put(v, p); } ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream( fileName)); oos.writeObject(locations); oos.close(); }
void function(String fileName) throws IOException { for(V v : getGraph().getVertices()) { Point p = new Point(transform(v)); locations.put(v, p); } ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream( fileName)); oos.writeObject(locations); oos.close(); }
/** * save the Vertex locations to a file * @param fileName the file to save to * @throws IOException if the file cannot be used */
save the Vertex locations to a file
persist
{ "repo_name": "drzhonghao/grapa", "path": "jung-visualization/src/main/java/edu/uci/ics/jung/visualization/layout/PersistentLayoutImpl.java", "license": "lgpl-3.0", "size": 5076 }
[ "java.io.FileOutputStream", "java.io.IOException", "java.io.ObjectOutputStream" ]
import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,252,387
public Set<Integer> getWords() { return Collections.unmodifiableSet(wordToTag.keySet()); }
Set<Integer> function() { return Collections.unmodifiableSet(wordToTag.keySet()); }
/** * Get the numbers of all words in this lexicon. * @return An unmodifiable set of integers. */
Get the numbers of all words in this lexicon
getWords
{ "repo_name": "wmaier/rparse", "path": "src/de/tuebingen/rparse/treebank/lex/Lexicon.java", "license": "gpl-2.0", "size": 7591 }
[ "java.util.Collections", "java.util.Set" ]
import java.util.Collections; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,511,272
public KeyNamePair getKeyNamePair() { return new KeyNamePair(get_ID(), String.valueOf(getS_Resource_ID())); }
KeyNamePair function() { return new KeyNamePair(get_ID(), String.valueOf(getS_Resource_ID())); }
/** Get Record ID/ColumnName @return ID/ColumnName pair */
Get Record ID/ColumnName
getKeyNamePair
{ "repo_name": "geneos/adempiere", "path": "base/src/org/compiere/model/X_S_ResourceUnAvailable.java", "license": "gpl-2.0", "size": 5386 }
[ "org.compiere.util.KeyNamePair" ]
import org.compiere.util.KeyNamePair;
import org.compiere.util.*;
[ "org.compiere.util" ]
org.compiere.util;
2,456,400
private void createModuleOutputFolder(AbstractFile file) throws IOException, NoCurrentCaseException { final Path moduleOutputFolder = getModuleOutputFolder(file); if (!Files.exists(moduleOutputFolder)) { Files.createDirectories(moduleOutputFolder); } }
void function(AbstractFile file) throws IOException, NoCurrentCaseException { final Path moduleOutputFolder = getModuleOutputFolder(file); if (!Files.exists(moduleOutputFolder)) { Files.createDirectories(moduleOutputFolder); } }
/** * Create any sub directories within the module output folder. */
Create any sub directories within the module output folder
createModuleOutputFolder
{ "repo_name": "eugene7646/autopsy", "path": "Core/src/org/sleuthkit/autopsy/modules/pictureanalyzer/impls/HEICProcessor.java", "license": "apache-2.0", "size": 10231 }
[ "java.io.IOException", "java.nio.file.Files", "java.nio.file.Path", "org.sleuthkit.autopsy.casemodule.NoCurrentCaseException", "org.sleuthkit.datamodel.AbstractFile" ]
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException; import org.sleuthkit.datamodel.AbstractFile;
import java.io.*; import java.nio.file.*; import org.sleuthkit.autopsy.casemodule.*; import org.sleuthkit.datamodel.*;
[ "java.io", "java.nio", "org.sleuthkit.autopsy", "org.sleuthkit.datamodel" ]
java.io; java.nio; org.sleuthkit.autopsy; org.sleuthkit.datamodel;
1,545,886
FileSystem getFileSytem() { return rootFileSystem; }
FileSystem getFileSytem() { return rootFileSystem; }
/** * Returns the file system where metadata is stored. * * @return a FileSystem * * @since 0.8.0 */
Returns the file system where metadata is stored
getFileSytem
{ "repo_name": "rbrush/kite", "path": "kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/filesystem/FileSystemMetadataProvider.java", "license": "apache-2.0", "size": 21765 }
[ "org.apache.hadoop.fs.FileSystem" ]
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
65,048
public static String shortenURI(String inputURI) { String result = ""; int index0 = inputURI.indexOf("^^"); int index1 = inputURI.lastIndexOf('#'); int index2 = inputURI.lastIndexOf('/'); boolean isResource = inputURI.startsWith("<") && inputURI.endsWith(">"); // If we found a literal, we do not shorten the URI at all. if (!isResource || index0 > 0) { return ""; } if (index1 > index2) { result = inputURI.substring(index1 + 1, inputURI.length() - 1); } else if (index2 > index1) { result = inputURI.substring(index2 + 1, inputURI.length() - 1); } try { result = java.net.URLDecoder.decode(result, "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return result; }
static String function(String inputURI) { String result = STR^^STR<STR>STRSTRUTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return result; }
/** * Converts a URI to a shorter representation which is shown to users. * * @param inputURI * @return */
Converts a URI to a shorter representation which is shown to users
shortenURI
{ "repo_name": "martinpz/Spark-RDF-Analyzer", "path": "src/main/java/rdfanalyzer/spark/RDFgraph.java", "license": "apache-2.0", "size": 2356 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
1,122,163
public RouteDefinition getOriginalRoute() { return originalRoute; }
RouteDefinition function() { return originalRoute; }
/** * Gets the original route to be adviced. * * @return the original route. */
Gets the original route to be adviced
getOriginalRoute
{ "repo_name": "gnodet/camel", "path": "core/camel-core-model/src/main/java/org/apache/camel/builder/AdviceWithRouteBuilder.java", "license": "apache-2.0", "size": 13543 }
[ "org.apache.camel.model.RouteDefinition" ]
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.*;
[ "org.apache.camel" ]
org.apache.camel;
1,795,772
public final void filter(CharSequence constraint, net.programmierecke.radiodroid2.utils.CustomFilter.FilterListener listener) { synchronized (mLock) { if (mThreadHandler == null) { HandlerThread thread = new HandlerThread( THREAD_NAME, android.os.Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mThreadHandler = new RequestHandler(thread.getLooper()); } final long delay = (mDelayer == null) ? 0 : mDelayer.getPostingDelay(constraint); Message message = mThreadHandler.obtainMessage(FILTER_TOKEN); RequestArguments args = new RequestArguments(); // make sure we use an immutable copy of the constraint, so that // it doesn't change while the filter operation is in progress args.constraint = constraint != null ? constraint.toString() : null; args.listener = listener; message.obj = args; mThreadHandler.removeMessages(FILTER_TOKEN); mThreadHandler.removeMessages(FINISH_TOKEN); mThreadHandler.sendMessageDelayed(message, delay); } }
final void function(CharSequence constraint, net.programmierecke.radiodroid2.utils.CustomFilter.FilterListener listener) { synchronized (mLock) { if (mThreadHandler == null) { HandlerThread thread = new HandlerThread( THREAD_NAME, android.os.Process.THREAD_PRIORITY_BACKGROUND); thread.start(); mThreadHandler = new RequestHandler(thread.getLooper()); } final long delay = (mDelayer == null) ? 0 : mDelayer.getPostingDelay(constraint); Message message = mThreadHandler.obtainMessage(FILTER_TOKEN); RequestArguments args = new RequestArguments(); args.constraint = constraint != null ? constraint.toString() : null; args.listener = listener; message.obj = args; mThreadHandler.removeMessages(FILTER_TOKEN); mThreadHandler.removeMessages(FINISH_TOKEN); mThreadHandler.sendMessageDelayed(message, delay); } }
/** * <p>Starts an asynchronous filtering operation. Calling this method * cancels all previous non-executed filtering requests and posts a new * filtering request that will be executed later.</p> * * <p>Upon completion, the listener is notified.</p> * * @param constraint the constraint used to filter the data * @param listener a listener notified upon completion of the operation * * @see #filter(CharSequence) * @see #performFiltering(CharSequence) * @see #publishResults(CharSequence, net.programmierecke.radiodroid2.utils.CustomFilter.FilterResults) */
Starts an asynchronous filtering operation. Calling this method cancels all previous non-executed filtering requests and posts a new filtering request that will be executed later. Upon completion, the listener is notified
filter
{ "repo_name": "segler-alex/RadioDroid", "path": "app/src/main/java/net/programmierecke/radiodroid2/utils/CustomFilter.java", "license": "gpl-3.0", "size": 12048 }
[ "android.os.HandlerThread", "android.os.Message" ]
import android.os.HandlerThread; import android.os.Message;
import android.os.*;
[ "android.os" ]
android.os;
1,391,558
@SmallTest @Feature({"Download"}) public void testPausingWithoutOngoingDownloads() { setupService(); startNotificationService(); assertTrue(getService().isPaused()); assertTrue(getService().getNotificationIds().isEmpty()); }
@Feature({STR}) void function() { setupService(); startNotificationService(); assertTrue(getService().isPaused()); assertTrue(getService().getNotificationIds().isEmpty()); }
/** * Tests that creating the service without launching chrome will do nothing if there is no * ongoing download. */
Tests that creating the service without launching chrome will do nothing if there is no ongoing download
testPausingWithoutOngoingDownloads
{ "repo_name": "axinging/chromium-crosswalk", "path": "chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadNotificationServiceTest.java", "license": "bsd-3-clause", "size": 10734 }
[ "org.chromium.base.test.util.Feature" ]
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.*;
[ "org.chromium.base" ]
org.chromium.base;
785,229
public static final void registerDefaultMatcher(final IProductPriceQueryMatcher matcher) { Check.assumeNotNull(matcher, "Parameter matcher is not null"); _defaultMatchers.addIfAbsent(matcher); logger.info("Registered default matcher: {}", matcher); }
static final void function(final IProductPriceQueryMatcher matcher) { Check.assumeNotNull(matcher, STR); _defaultMatchers.addIfAbsent(matcher); logger.info(STR, matcher); }
/** * Allows to add a matcher that will be applied when this rule looks for a matching product price. * * @param matcher */
Allows to add a matcher that will be applied when this rule looks for a matching product price
registerDefaultMatcher
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.business/src/main/java/de/metas/pricing/attributebased/impl/AttributePricing.java", "license": "gpl-2.0", "size": 12400 }
[ "org.adempiere.pricing.api.ProductPriceQuery", "org.adempiere.util.Check" ]
import org.adempiere.pricing.api.ProductPriceQuery; import org.adempiere.util.Check;
import org.adempiere.pricing.api.*; import org.adempiere.util.*;
[ "org.adempiere.pricing", "org.adempiere.util" ]
org.adempiere.pricing; org.adempiere.util;
2,584,082
public GblocksOutput runGblocks(GblocksParams params, RpcContext... jsonRpcContext) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(params); TypeReference<List<GblocksOutput>> retType = new TypeReference<List<GblocksOutput>>() {}; List<GblocksOutput> res = caller.jsonrpcCall("kb_gblocks.run_Gblocks", args, retType, true, true, jsonRpcContext, this.serviceVersion); return res.get(0); }
GblocksOutput function(GblocksParams params, RpcContext... jsonRpcContext) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(params); TypeReference<List<GblocksOutput>> retType = new TypeReference<List<GblocksOutput>>() {}; List<GblocksOutput> res = caller.jsonrpcCall(STR, args, retType, true, true, jsonRpcContext, this.serviceVersion); return res.get(0); }
/** * <p>Original spec-file function name: run_Gblocks</p> * <pre> * Method for trimming MSAs of either DNA or PROTEIN sequences * ** * ** input_type: MSA * ** output_type: MSA * </pre> * @param params instance of type {@link us.kbase.kbgblocks.GblocksParams GblocksParams} (original type "Gblocks_Params") * @return instance of type {@link us.kbase.kbgblocks.GblocksOutput GblocksOutput} (original type "Gblocks_Output") * @throws IOException if an IO exception occurs * @throws JsonClientException if a JSON RPC exception occurs */
Original spec-file function name: run_Gblocks <code> Method for trimming MSAs of either DNA or PROTEIN sequences input_type: MSA output_type: MSA </code>
runGblocks
{ "repo_name": "dcchivian/kb_gblocks", "path": "lib/src/us/kbase/kbgblocks/KbGblocksClient.java", "license": "mit", "size": 7467 }
[ "com.fasterxml.jackson.core.type.TypeReference", "java.io.IOException", "java.util.ArrayList", "java.util.List", "us.kbase.common.service.JsonClientException", "us.kbase.common.service.RpcContext" ]
import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.RpcContext;
import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*;
[ "com.fasterxml.jackson", "java.io", "java.util", "us.kbase.common" ]
com.fasterxml.jackson; java.io; java.util; us.kbase.common;
943,971
private boolean readRoleForm(RunData data, SessionState state) { // get the realm AuthzGroup realm = (AuthzGroup) state.getAttribute("realm"); // get the locks String[] locks = data.getParameters().getStrings("locks"); // we are setting for either a new role or this role Role role = (Role) state.getAttribute("role"); //Read the locks if they're null and the role is not null to avoid passing them around if (locks == null && role != null) { Collection realms = new ArrayList<String>(Arrays.asList(realm.getId())); List <String> newlocks = new ArrayList(AuthzGroupService.getAllowedFunctions(role.getId(), realms)); locks = newlocks.toArray(new String[0]); } if (realm != null && role == null) { // read the form String id = StringUtils.trimToNull(data.getParameters().getString("id")); // if the field is missing, and there are no locks, just be done with no change if ((id == null) && (locks == null)) return true; if (id == null) { addAlert(state, rb.getString("realm.please")); return false; // TODO: would be nice to read the locks, and restore them when the form returns -ggolden } // create the role try { role = realm.addRole(id); } catch (RoleAlreadyDefinedException e) { addAlert(state, rb.getFormattedMessage("realm.defined", new Object[]{id}) ); return false; // TODO: would be nice to read the locks, and restore them when the form returns -ggolden } } // clear out the role role.disallowAll(); String descriptionString = StringUtils.trimToNull(data.getParameters().getString("description")); String providerOnlyString = StringUtils.trimToNull(data.getParameters().getString("providerOnly")); //Role can't be null at this point if (descriptionString == null) { descriptionString = role.getDescription(); } if (providerOnlyString == null) { providerOnlyString = String.valueOf(role.isProviderOnly()); } // description role.setDescription(StringUtils.trimToNull(descriptionString)); // providerOnly role.setProviderOnly("true".equals(providerOnlyString)); // for each lock set, give it to the role if (locks != null) { for (int i = 0; i < locks.length; i++) { role.allowFunction(locks[i]); } } return true; } // readRoleForm
boolean function(RunData data, SessionState state) { AuthzGroup realm = (AuthzGroup) state.getAttribute("realm"); String[] locks = data.getParameters().getStrings("locks"); Role role = (Role) state.getAttribute("role"); if (locks == null && role != null) { Collection realms = new ArrayList<String>(Arrays.asList(realm.getId())); List <String> newlocks = new ArrayList(AuthzGroupService.getAllowedFunctions(role.getId(), realms)); locks = newlocks.toArray(new String[0]); } if (realm != null && role == null) { String id = StringUtils.trimToNull(data.getParameters().getString("id")); if ((id == null) && (locks == null)) return true; if (id == null) { addAlert(state, rb.getString(STR)); return false; } try { role = realm.addRole(id); } catch (RoleAlreadyDefinedException e) { addAlert(state, rb.getFormattedMessage(STR, new Object[]{id}) ); return false; } } role.disallowAll(); String descriptionString = StringUtils.trimToNull(data.getParameters().getString(STR)); String providerOnlyString = StringUtils.trimToNull(data.getParameters().getString(STR)); if (descriptionString == null) { descriptionString = role.getDescription(); } if (providerOnlyString == null) { providerOnlyString = String.valueOf(role.isProviderOnly()); } role.setDescription(StringUtils.trimToNull(descriptionString)); role.setProviderOnly("true".equals(providerOnlyString)); if (locks != null) { for (int i = 0; i < locks.length; i++) { role.allowFunction(locks[i]); } } return true; }
/** * Read the user form and update the realm in state. * * @return true if the form is accepted, false if there's a validation error (an alertMessage will be set) */
Read the user form and update the realm in state
readRoleForm
{ "repo_name": "whumph/sakai", "path": "authz/authz-tool/tool/src/java/org/sakaiproject/authz/tool/RealmsAction.java", "license": "apache-2.0", "size": 43019 }
[ "java.util.ArrayList", "java.util.Arrays", "java.util.Collection", "java.util.List", "org.apache.commons.lang.StringUtils", "org.sakaiproject.authz.api.AuthzGroup", "org.sakaiproject.authz.api.Role", "org.sakaiproject.authz.api.RoleAlreadyDefinedException", "org.sakaiproject.authz.cover.AuthzGroupService", "org.sakaiproject.cheftool.RunData", "org.sakaiproject.event.api.SessionState" ]
import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.List; import org.apache.commons.lang.StringUtils; import org.sakaiproject.authz.api.AuthzGroup; import org.sakaiproject.authz.api.Role; import org.sakaiproject.authz.api.RoleAlreadyDefinedException; import org.sakaiproject.authz.cover.AuthzGroupService; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState;
import java.util.*; import org.apache.commons.lang.*; import org.sakaiproject.authz.api.*; import org.sakaiproject.authz.cover.*; import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*;
[ "java.util", "org.apache.commons", "org.sakaiproject.authz", "org.sakaiproject.cheftool", "org.sakaiproject.event" ]
java.util; org.apache.commons; org.sakaiproject.authz; org.sakaiproject.cheftool; org.sakaiproject.event;
526,918
public QueryList executeQuery(Object key, Operator operator) { List dataList = (List)dataCollection.get(key); if(dataList == null) return new QueryList(); return cloneListData(new QueryList(dataList).filter(operator)); }
QueryList function(Object key, Operator operator) { List dataList = (List)dataCollection.get(key); if(dataList == null) return new QueryList(); return cloneListData(new QueryList(dataList).filter(operator)); }
/** * returns a subset of Data Collection. This subset is got by applying the * operator parameter. Operator can be a combination of multiple logical and * relational conditions. * @return returns results in this Query List * @param collectionKey collection key * @param key data key * @param operator Operator */
returns a subset of Data Collection. This subset is got by applying the operator parameter. Operator can be a combination of multiple logical and relational conditions
executeQuery
{ "repo_name": "vivantech/kc_fixes", "path": "src/main/java/org/kuali/kra/budget/calculator/query/QueryEngine.java", "license": "apache-2.0", "size": 9008 }
[ "java.util.List", "org.kuali.kra.budget.calculator.QueryList" ]
import java.util.List; import org.kuali.kra.budget.calculator.QueryList;
import java.util.*; import org.kuali.kra.budget.calculator.*;
[ "java.util", "org.kuali.kra" ]
java.util; org.kuali.kra;
1,082,177
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final DefaultTableModel dtm = (DefaultTableModel) table.getModel(); final FileElement element = (FileElement) dtm.getValueAt(row, column); if (element.isDirectory()) setIcon(DIRECTORY_ICON); else setIcon(FILE_ICON); setText(element.toString()); return this; }
Component function(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); final DefaultTableModel dtm = (DefaultTableModel) table.getModel(); final FileElement element = (FileElement) dtm.getValueAt(row, column); if (element.isDirectory()) setIcon(DIRECTORY_ICON); else setIcon(FILE_ICON); setText(element.toString()); return this; }
/** * Overridden to set the correct renderer. * @see DefaultTableCellRenderer#getTableCellRendererComponent(JTable, * Object, boolean, boolean, int, int) */
Overridden to set the correct renderer
getTableCellRendererComponent
{ "repo_name": "dominikl/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/fsimporter/chooser/FileTableRendererFileColumn.java", "license": "gpl-2.0", "size": 3045 }
[ "java.awt.Component", "javax.swing.JTable", "javax.swing.table.DefaultTableModel" ]
import java.awt.Component; import javax.swing.JTable; import javax.swing.table.DefaultTableModel;
import java.awt.*; import javax.swing.*; import javax.swing.table.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
568,539
KeyMapper<Object> getKeyMapper() { return datasourceExtension.getKeyMapper(); }
KeyMapper<Object> getKeyMapper() { return datasourceExtension.getKeyMapper(); }
/** * Gets the {@link KeyMapper } being used by the data source. * * @return the key mapper being used by the data source */
Gets the <code>KeyMapper </code> being used by the data source
getKeyMapper
{ "repo_name": "mstahv/framework", "path": "compatibility-server/src/main/java/com/vaadin/v7/ui/Grid.java", "license": "apache-2.0", "size": 273176 }
[ "com.vaadin.server.KeyMapper" ]
import com.vaadin.server.KeyMapper;
import com.vaadin.server.*;
[ "com.vaadin.server" ]
com.vaadin.server;
19,867
@CalledByNative static MidiManagerAndroid create(long nativeManagerPointer) { return new MidiManagerAndroid(nativeManagerPointer); } private MidiManagerAndroid(long nativeManagerPointer) { assert !ThreadUtils.runningOnUiThread(); mManager = (MidiManager) ContextUtils.getApplicationContext().getSystemService( Context.MIDI_SERVICE); mHandler = new Handler(ThreadUtils.getUiThreadLooper()); mNativeManagerPointer = nativeManagerPointer; }
static MidiManagerAndroid create(long nativeManagerPointer) { return new MidiManagerAndroid(nativeManagerPointer); } private MidiManagerAndroid(long nativeManagerPointer) { assert !ThreadUtils.runningOnUiThread(); mManager = (MidiManager) ContextUtils.getApplicationContext().getSystemService( Context.MIDI_SERVICE); mHandler = new Handler(ThreadUtils.getUiThreadLooper()); mNativeManagerPointer = nativeManagerPointer; }
/** * A creation function called by C++. * @param nativeManagerPointer The native pointer to a midi::MidiManagerAndroid object. */
A creation function called by C++
create
{ "repo_name": "youtube/cobalt", "path": "third_party/chromium/media/midi/java/src/org/chromium/midi/MidiManagerAndroid.java", "license": "bsd-3-clause", "size": 7349 }
[ "android.content.Context", "android.media.midi.MidiManager", "android.os.Handler", "org.chromium.base.ContextUtils", "org.chromium.base.ThreadUtils" ]
import android.content.Context; import android.media.midi.MidiManager; import android.os.Handler; import org.chromium.base.ContextUtils; import org.chromium.base.ThreadUtils;
import android.content.*; import android.media.midi.*; import android.os.*; import org.chromium.base.*;
[ "android.content", "android.media", "android.os", "org.chromium.base" ]
android.content; android.media; android.os; org.chromium.base;
589,211
public void sessionFlushed(ISession session) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "sessionFlushed", "sessionObservers.size()=" + _sessionObservers.size()); } if (_sessionObservers == null || _sessionObservers.size() < 1) { return; } ISessionObserver sessionObserver = null; for (int i = 0; i < _sessionObservers.size(); i++) { sessionObserver = (ISessionObserver) _sessionObservers.get(i); sessionObserver.sessionFlushed(session); } }
void function(ISession session) { if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) { LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, STR, STR + _sessionObservers.size()); } if (_sessionObservers == null _sessionObservers.size() < 1) { return; } ISessionObserver sessionObserver = null; for (int i = 0; i < _sessionObservers.size(); i++) { sessionObserver = (ISessionObserver) _sessionObservers.get(i); sessionObserver.sessionFlushed(session); } }
/** * Method sessionSynched * <p> * * @see com.ibm.wsspi.session.ISessionObserver#sessionFlushed(com.ibm.wsspi.session.ISession) */
Method sessionSynched
sessionFlushed
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.session/src/com/ibm/ws/session/SessionEventDispatcher.java", "license": "epl-1.0", "size": 14815 }
[ "com.ibm.ws.session.utils.LoggingUtil", "com.ibm.wsspi.session.ISession", "com.ibm.wsspi.session.ISessionObserver", "java.util.logging.Level" ]
import com.ibm.ws.session.utils.LoggingUtil; import com.ibm.wsspi.session.ISession; import com.ibm.wsspi.session.ISessionObserver; import java.util.logging.Level;
import com.ibm.ws.session.utils.*; import com.ibm.wsspi.session.*; import java.util.logging.*;
[ "com.ibm.ws", "com.ibm.wsspi", "java.util" ]
com.ibm.ws; com.ibm.wsspi; java.util;
360,744
@Test(expectedExceptions = { LDAPException.class }) public void testDecodeControlWithValue() throws Exception { final Control genericControl = new Control("1.3.6.1.4.1.30221.2.5.54", false, new ASN1OctetString("unexpected value")); new RejectUnindexedSearchRequestControl(genericControl); }
@Test(expectedExceptions = { LDAPException.class }) void function() throws Exception { final Control genericControl = new Control(STR, false, new ASN1OctetString(STR)); new RejectUnindexedSearchRequestControl(genericControl); }
/** * Tests the behavior when trying to decode a control that has a value. * * @throws Exception If an unexpected problem occurs. */
Tests the behavior when trying to decode a control that has a value
testDecodeControlWithValue
{ "repo_name": "UnboundID/ldapsdk", "path": "tests/unit/src/com/unboundid/ldap/sdk/unboundidds/controls/RejectUnindexedSearchRequestControlTestCase.java", "license": "gpl-2.0", "size": 4217 }
[ "com.unboundid.asn1.ASN1OctetString", "com.unboundid.ldap.sdk.Control", "com.unboundid.ldap.sdk.LDAPException", "org.testng.annotations.Test" ]
import com.unboundid.asn1.ASN1OctetString; import com.unboundid.ldap.sdk.Control; import com.unboundid.ldap.sdk.LDAPException; import org.testng.annotations.Test;
import com.unboundid.asn1.*; import com.unboundid.ldap.sdk.*; import org.testng.annotations.*;
[ "com.unboundid.asn1", "com.unboundid.ldap", "org.testng.annotations" ]
com.unboundid.asn1; com.unboundid.ldap; org.testng.annotations;
270,302
private static List<SparseRowDto> readAll(Iterator<SparseRowDto> iterator) { List<SparseRowDto> list = new LinkedList<SparseRowDto>(); while (iterator.hasNext()) { list.add(iterator.next()); } return list; }
static List<SparseRowDto> function(Iterator<SparseRowDto> iterator) { List<SparseRowDto> list = new LinkedList<SparseRowDto>(); while (iterator.hasNext()) { list.add(iterator.next()); } return list; }
/** * Read all data from the iterator into a list. * * @param iterator * @return */
Read all data from the iterator into a list
readAll
{ "repo_name": "hhu94/Synapse-Repository-Services", "path": "lib/jdomodels/src/test/java/org/sagebionetworks/repo/model/dbo/dao/table/CSVToRowIteratorTest.java", "license": "apache-2.0", "size": 14697 }
[ "java.util.Iterator", "java.util.LinkedList", "java.util.List", "org.sagebionetworks.repo.model.table.SparseRowDto" ]
import java.util.Iterator; import java.util.LinkedList; import java.util.List; import org.sagebionetworks.repo.model.table.SparseRowDto;
import java.util.*; import org.sagebionetworks.repo.model.table.*;
[ "java.util", "org.sagebionetworks.repo" ]
java.util; org.sagebionetworks.repo;
661,582
public ITask setCreatedDate(OffsetDateTime value);
ITask function(OffsetDateTime value);
/** * Setter for <code>public.task.created_date</code>. */
Setter for <code>public.task.created_date</code>
setCreatedDate
{ "repo_name": "nickguletskii/OpenOlympus", "path": "src-gen/main/java/org/ng200/openolympus/jooq/tables/interfaces/ITask.java", "license": "mit", "size": 3597 }
[ "java.time.OffsetDateTime" ]
import java.time.OffsetDateTime;
import java.time.*;
[ "java.time" ]
java.time;
1,524,523
public String toPem( final StringWriterFactoryInterface stringWriterFactory, final PemWriterFactoryInterface pemWriterFactory ) { return this.toPem(null, null, stringWriterFactory, pemWriterFactory); }
String function( final StringWriterFactoryInterface stringWriterFactory, final PemWriterFactoryInterface pemWriterFactory ) { return this.toPem(null, null, stringWriterFactory, pemWriterFactory); }
/** * Get this key as a PEM formatted string. * * @param stringWriterFactory The string writer factory to use. * @param pemWriterFactory The PEM writer factory to use. * * @return The PEM formatted key. */
Get this key as a PEM formatted string
toPem
{ "repo_name": "eloquent/lockbox-java", "path": "src/main/java/co/lqnt/lockbox/key/PrivateKey.java", "license": "mit", "size": 10745 }
[ "co.lqnt.lockbox.util.PemWriterFactoryInterface", "co.lqnt.lockbox.util.StringWriterFactoryInterface" ]
import co.lqnt.lockbox.util.PemWriterFactoryInterface; import co.lqnt.lockbox.util.StringWriterFactoryInterface;
import co.lqnt.lockbox.util.*;
[ "co.lqnt.lockbox" ]
co.lqnt.lockbox;
2,840,302
public void removeSubscription(Subscription subscription) { if (!(this == subscription.getUser())) { throw new IllegalArgumentException ("Subscription not associated with this user"); } synchronized (subscriptions) { subscriptions.remove(subscription.getHost()); } }
void function(Subscription subscription) { if (!(this == subscription.getUser())) { throw new IllegalArgumentException (STR); } synchronized (subscriptions) { subscriptions.remove(subscription.getHost()); } }
/** * Remove the specified {@link Subscription} from being associated * with this User. * * @param subscription Subscription to be removed * * @exception IllegalArgumentException if the specified subscription is not * associated with this User */
Remove the specified <code>Subscription</code> from being associated with this User
removeSubscription
{ "repo_name": "davcamer/clients", "path": "projects-for-testing/struts/apps/faces-example1/src/main/java/org/apache/struts/webapp/example/memory/MemoryUser.java", "license": "apache-2.0", "size": 7173 }
[ "org.apache.struts.webapp.example.Subscription" ]
import org.apache.struts.webapp.example.Subscription;
import org.apache.struts.webapp.example.*;
[ "org.apache.struts" ]
org.apache.struts;
250,782
List<Directive> getDirectives();
List<Directive> getDirectives();
/** * This will return a list of all the directives that have been put on {@link com.intellij.lang.jsgraphql.types.language.Node} as a flat list, which may contain repeatable * and non repeatable directives. * * @return a list of all the directives associated with this Node */
This will return a list of all the directives that have been put on <code>com.intellij.lang.jsgraphql.types.language.Node</code> as a flat list, which may contain repeatable and non repeatable directives
getDirectives
{ "repo_name": "jimkyndemeyer/js-graphql-intellij-plugin", "path": "src/main/com/intellij/lang/jsgraphql/types/language/DirectivesContainer.java", "license": "mit", "size": 3489 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,510,922
try { AddProductDialog dialog = new AddProductDialog(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } public AddProductDialog() { setTitle("Add New Product"); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); lblProductId = new JLabel("Product ID:"); JLabel lblNewLabel = new JLabel("Product Name:"); JLabel lblPrice = new JLabel("Price:"); JLabel lblSupplier = new JLabel("Supplier:"); JLabel lblDescription = new JLabel("Description:"); tfProductID = new JTextField(); tfProductID.setColumns(10); tfName = new JTextField(); tfName.setColumns(10); tfPrice = new JTextField(); tfPrice.setColumns(10); tfSupplier = new JTextField(); tfSupplier.setColumns(10); JTextArea taDescription = new JTextArea();
try { AddProductDialog dialog = new AddProductDialog(); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } public AddProductDialog() { setTitle(STR); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); lblProductId = new JLabel(STR); JLabel lblNewLabel = new JLabel(STR); JLabel lblPrice = new JLabel(STR); JLabel lblSupplier = new JLabel(STR); JLabel lblDescription = new JLabel(STR); tfProductID = new JTextField(); tfProductID.setColumns(10); tfName = new JTextField(); tfName.setColumns(10); tfPrice = new JTextField(); tfPrice.setColumns(10); tfSupplier = new JTextField(); tfSupplier.setColumns(10); JTextArea taDescription = new JTextArea();
/** * Launch the application. */
Launch the application
main
{ "repo_name": "iproduct/IPT-Course-Java-8", "path": "IPT-Course-Java-29ed/IPTInvoicing/src/invoicing/gui/AddProductDialog.java", "license": "gpl-2.0", "size": 7744 }
[ "java.awt.BorderLayout", "javax.swing.JDialog", "javax.swing.JLabel", "javax.swing.JTextArea", "javax.swing.JTextField", "javax.swing.border.EmptyBorder" ]
import java.awt.BorderLayout; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.border.EmptyBorder;
import java.awt.*; import javax.swing.*; import javax.swing.border.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,588,039
void unRegisterXATxn(Xid xid, boolean isCommit) throws DatabaseException { if (allXATxns.remove(xid) == null) { throw new DatabaseException ("XA Transaction " + xid + " can not be unregistered."); } env.getMemoryBudget().updateMiscMemoryUsage (0 - MemoryBudget.HASHMAP_ENTRY_OVERHEAD); if (isCommit) { numXACommits++; } else { numXAAborts++; } }
void unRegisterXATxn(Xid xid, boolean isCommit) throws DatabaseException { if (allXATxns.remove(xid) == null) { throw new DatabaseException (STR + xid + STR); } env.getMemoryBudget().updateMiscMemoryUsage (0 - MemoryBudget.HASHMAP_ENTRY_OVERHEAD); if (isCommit) { numXACommits++; } else { numXAAborts++; } }
/** * Called when txn ends. */
Called when txn ends
unRegisterXATxn
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/je-3.2.74/src/com/sleepycat/je/txn/TxnManager.java", "license": "gpl-2.0", "size": 8929 }
[ "com.sleepycat.je.DatabaseException", "com.sleepycat.je.dbi.MemoryBudget", "javax.transaction.xa.Xid" ]
import com.sleepycat.je.DatabaseException; import com.sleepycat.je.dbi.MemoryBudget; import javax.transaction.xa.Xid;
import com.sleepycat.je.*; import com.sleepycat.je.dbi.*; import javax.transaction.xa.*;
[ "com.sleepycat.je", "javax.transaction" ]
com.sleepycat.je; javax.transaction;
2,073,510
void log(Level logLevel, String message, HttpServiceContext hsc);
void log(Level logLevel, String message, HttpServiceContext hsc);
/** * Request the following message be written to the output file. This is * based on the input requested log level versus the currently enabled value * on the log. * * @param logLevel * @param message * @param hsc */
Request the following message be written to the output file. This is based on the input requested log level versus the currently enabled value on the log
log
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.transport.http/src/com/ibm/wsspi/http/logging/DebugLog.java", "license": "epl-1.0", "size": 3561 }
[ "com.ibm.wsspi.http.channel.HttpServiceContext" ]
import com.ibm.wsspi.http.channel.HttpServiceContext;
import com.ibm.wsspi.http.channel.*;
[ "com.ibm.wsspi" ]
com.ibm.wsspi;
344,035
public void startTrasmit() { try { LOGGER.fine("start"); mediaSession.start(true); this.mediaReceived(""); } catch (IOException e) { e.printStackTrace(); } }
void function() { try { LOGGER.fine("start"); mediaSession.start(true); this.mediaReceived(""); } catch (IOException e) { e.printStackTrace(); } }
/** * Starts transmission and for NAT Traversal reasons start receiving also. */
Starts transmission and for NAT Traversal reasons start receiving also
startTrasmit
{ "repo_name": "TTalkIM/Smack", "path": "smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/mediaimpl/jspeex/AudioMediaSession.java", "license": "apache-2.0", "size": 8715 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,814,813
public PagerAdapter getAdapter() { return mAdapter; }
PagerAdapter function() { return mAdapter; }
/** * Retrieve the current adapter supplying pages. * * @return The currently registered PagerAdapter */
Retrieve the current adapter supplying pages
getAdapter
{ "repo_name": "gzsll/TLint", "path": "app/src/main/java/com/gzsll/hupu/widget/VerticalViewPager.java", "license": "apache-2.0", "size": 109046 }
[ "android.support.v4.view.PagerAdapter" ]
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.*;
[ "android.support" ]
android.support;
2,088,629
public SearchRequestBuilder setScroll(TimeValue keepAlive) { request.scroll(keepAlive); return this; }
SearchRequestBuilder function(TimeValue keepAlive) { request.scroll(keepAlive); return this; }
/** * If set, will enable scrolling of the search request for the specified timeout. */
If set, will enable scrolling of the search request for the specified timeout
setScroll
{ "repo_name": "jprante/elasticsearch-client", "path": "elasticsearch-client-search/src/main/java/org/elasticsearch/action/search/SearchRequestBuilder.java", "license": "apache-2.0", "size": 26853 }
[ "org.elasticsearch.common.unit.TimeValue" ]
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
1,346,881
@Override public void addStatement(UpdateContext op, Resource subj, URI pred, Value obj, Resource... contexts) throws SailException { throw new SailException(ERR_OPENRDF_QUERY_MODEL); }
void function(UpdateContext op, Resource subj, URI pred, Value obj, Resource... contexts) throws SailException { throw new SailException(ERR_OPENRDF_QUERY_MODEL); }
/** * Unsupported API. */
Unsupported API
addStatement
{ "repo_name": "wikimedia/wikidata-query-blazegraph", "path": "bigdata-core/bigdata-sails/src/java/com/bigdata/rdf/sail/BigdataSail.java", "license": "gpl-2.0", "size": 195000 }
[ "org.openrdf.model.Resource", "org.openrdf.model.Value", "org.openrdf.sail.SailException", "org.openrdf.sail.UpdateContext" ]
import org.openrdf.model.Resource; import org.openrdf.model.Value; import org.openrdf.sail.SailException; import org.openrdf.sail.UpdateContext;
import org.openrdf.model.*; import org.openrdf.sail.*;
[ "org.openrdf.model", "org.openrdf.sail" ]
org.openrdf.model; org.openrdf.sail;
1,153,024
public void setIngameNotInFocus() { if (this.inGameHasFocus) { KeyBinding.unPressAllKeys(); this.inGameHasFocus = false; this.mouseHelper.ungrabMouseCursor(); } }
void function() { if (this.inGameHasFocus) { KeyBinding.unPressAllKeys(); this.inGameHasFocus = false; this.mouseHelper.ungrabMouseCursor(); } }
/** * Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor. */
Resets the player keystate, disables the ingame focus, and ungrabs the mouse cursor
setIngameNotInFocus
{ "repo_name": "dogjaw2233/tiu-s-mod", "path": "build/tmp/recompileMc/sources/net/minecraft/client/Minecraft.java", "license": "lgpl-2.1", "size": 129685 }
[ "net.minecraft.client.settings.KeyBinding" ]
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.settings.*;
[ "net.minecraft.client" ]
net.minecraft.client;
994,181
public Single<BlobCopyFromURLResponse> syncCopyFromURL(URL copySource) { return this.syncCopyFromURL(copySource, null, null, null, null); } /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * For more information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/copy-blob">Azure Docs</a> * * @param copySource * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata * {@link Metadata}
Single<BlobCopyFromURLResponse> function(URL copySource) { return this.syncCopyFromURL(copySource, null, null, null, null); } /** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * For more information, see the <a href="https: * * @param copySource * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. * @param metadata * {@link Metadata}
/** * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. * For more information, see the <a href="https://docs.microsoft.com/rest/api/storageservices/copy-blob">Azure Docs</a> * * @param copySource * The source URL to copy from. * * @return Emits the successful response. * * @apiNote ## Sample Code \n * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=sync_copy "Sample code for BlobURL.syncCopyFromURL")] \n * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) */
Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. For more information, see the Azure Docs
syncCopyFromURL
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/BlobURL.java", "license": "mit", "size": 60237 }
[ "com.microsoft.azure.storage.blob.models.BlobCopyFromURLResponse", "io.reactivex.Single" ]
import com.microsoft.azure.storage.blob.models.BlobCopyFromURLResponse; import io.reactivex.Single;
import com.microsoft.azure.storage.blob.models.*; import io.reactivex.*;
[ "com.microsoft.azure", "io.reactivex" ]
com.microsoft.azure; io.reactivex;
1,775,403
public static LenskitRecommender build(LenskitConfiguration config) throws RecommenderBuildException { return LenskitRecommenderEngine.build(config).createRecommender(); }
static LenskitRecommender function(LenskitConfiguration config) throws RecommenderBuildException { return LenskitRecommenderEngine.build(config).createRecommender(); }
/** * Build a recommender from a configuration. The recommender is immediately usable. This is * mostly useful for evaluations and test programs; more sophisticated applications that need * to build multiple recommenders from the same model should use a {@linkplain LenskitRecommenderEngine * recommender engine}. * * @param config The configuration. * @return The recommender. * @throws RecommenderBuildException If there is an error building the recommender. * @since 2.0 */
Build a recommender from a configuration. The recommender is immediately usable. This is mostly useful for evaluations and test programs; more sophisticated applications that need to build multiple recommenders from the same model should use a LenskitRecommenderEngine recommender engine
build
{ "repo_name": "aglne/lenskit", "path": "lenskit-core/src/main/java/org/lenskit/LenskitRecommender.java", "license": "lgpl-2.1", "size": 5839 }
[ "org.grouplens.lenskit.RecommenderBuildException", "org.grouplens.lenskit.core.LenskitConfiguration" ]
import org.grouplens.lenskit.RecommenderBuildException; import org.grouplens.lenskit.core.LenskitConfiguration;
import org.grouplens.lenskit.*; import org.grouplens.lenskit.core.*;
[ "org.grouplens.lenskit" ]
org.grouplens.lenskit;
1,412,187
private static long getTgtEntityIdOfAttribute(long associationId, JDBCDAO jdbcdao) throws SQLException, DAOException { Long entityId = null; String getEntityIdQuery = "select TARGET_ENTITY_ID from DYEXTN_ASSOCIATION where IDENTIFIER = " + associationId; ResultSet resultSet = jdbcdao.getQueryResultSet(getEntityIdQuery); if (resultSet.next()) { entityId = resultSet.getLong(1); } jdbcdao.closeStatement(resultSet); return entityId; }
static long function(long associationId, JDBCDAO jdbcdao) throws SQLException, DAOException { Long entityId = null; String getEntityIdQuery = STR + associationId; ResultSet resultSet = jdbcdao.getQueryResultSet(getEntityIdQuery); if (resultSet.next()) { entityId = resultSet.getLong(1); } jdbcdao.closeStatement(resultSet); return entityId; }
/** * It will retrieve the TargetEntity Id of the given association Id * @param associationId whose target entity id is to be searched * @return target entity Id of the given association Id * @throws SQLException * @throws DAOException */
It will retrieve the TargetEntity Id of the given association Id
getTgtEntityIdOfAttribute
{ "repo_name": "NCIP/catissue-tools", "path": "WEB-INF/src/edu/wustl/clinportal/querysuite/metadata/UpdateSchemaForConstraintProperties.java", "license": "bsd-3-clause", "size": 20501 }
[ "edu.wustl.dao.exception.DAOException", "java.sql.ResultSet", "java.sql.SQLException" ]
import edu.wustl.dao.exception.DAOException; import java.sql.ResultSet; import java.sql.SQLException;
import edu.wustl.dao.exception.*; import java.sql.*;
[ "edu.wustl.dao", "java.sql" ]
edu.wustl.dao; java.sql;
2,839,200
public static File createRepositoryBakFile(String filename) { return FileUtil.createFile(FileUtil.repositoryFolder, filename + FileUtil.BAK_EXTENSION); }
static File function(String filename) { return FileUtil.createFile(FileUtil.repositoryFolder, filename + FileUtil.BAK_EXTENSION); }
/** * Procedure to create a Repository Bak File * @param filename * @return */
Procedure to create a Repository Bak File
createRepositoryBakFile
{ "repo_name": "LucasBassetti/nemo-platform", "path": "br.ufes.inf.nemo.platform/src/main/java/br/ufes/inf/nemo/platform/util/FileUtil.java", "license": "mit", "size": 5937 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
5,322
private void unregisterListener() { Case.removeEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, weakListener); }
void function() { Case.removeEventTypeSubscriber(CASE_EVENTS_OF_INTEREST, weakListener); }
/** * Unregisters this node's application event listener. */
Unregisters this node's application event listener
unregisterListener
{ "repo_name": "sleuthkit/autopsy", "path": "Core/src/org/sleuthkit/autopsy/datamodel/BlackboardArtifactNode.java", "license": "apache-2.0", "size": 80029 }
[ "org.sleuthkit.autopsy.casemodule.Case" ]
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.*;
[ "org.sleuthkit.autopsy" ]
org.sleuthkit.autopsy;
1,755,673
public CassandraLinkedService withAuthenticationType(Object authenticationType) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CassandraLinkedServiceTypeProperties(); } this.innerTypeProperties().withAuthenticationType(authenticationType); return this; }
CassandraLinkedService function(Object authenticationType) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new CassandraLinkedServiceTypeProperties(); } this.innerTypeProperties().withAuthenticationType(authenticationType); return this; }
/** * Set the authenticationType property: AuthenticationType to be used for connection. Type: string (or Expression * with resultType string). * * @param authenticationType the authenticationType value to set. * @return the CassandraLinkedService object itself. */
Set the authenticationType property: AuthenticationType to be used for connection. Type: string (or Expression with resultType string)
withAuthenticationType
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/CassandraLinkedService.java", "license": "mit", "size": 8252 }
[ "com.azure.resourcemanager.datafactory.fluent.models.CassandraLinkedServiceTypeProperties" ]
import com.azure.resourcemanager.datafactory.fluent.models.CassandraLinkedServiceTypeProperties;
import com.azure.resourcemanager.datafactory.fluent.models.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
71,398
@PUT @Path("timestamps/current") @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public String getTimestampForUserCurrent(String jsonUser) throws MetalyzerAPIException { User user = gson.fromJson(jsonUser, User.class); semCon.setConnection(connectionName); log.info("Request for getTimestampForUser at current timestamp"); return gson.toJson(semCon.getUserService().getTimestamp(RequestType.CURRENT_REQUEST, user)); }
@Path(STR) @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) String function(String jsonUser) throws MetalyzerAPIException { User user = gson.fromJson(jsonUser, User.class); semCon.setConnection(connectionName); log.info(STR); return gson.toJson(semCon.getUserService().getTimestamp(RequestType.CURRENT_REQUEST, user)); }
/** * Query to get the Unix-Timestamp of a specific user. * @param user * User to which the Unix-Timestamp should be searched. * @return * Returns a JSON-String of the Unix-Timestamp of the given user. */
Query to get the Unix-Timestamp of a specific user
getTimestampForUserCurrent
{ "repo_name": "trustathsh/metalyzer", "path": "dataservice-module/src/main/java/de/hshannover/f4/trust/metalyzer/semantic/rest/SemanticsUserResource.java", "license": "apache-2.0", "size": 13368 }
[ "de.hshannover.f4.trust.metalyzer.api.exception.MetalyzerAPIException", "de.hshannover.f4.trust.metalyzer.semantic.entities.User", "de.hshannover.f4.trust.metalyzer.semantic.services.SemanticsController", "javax.ws.rs.Consumes", "javax.ws.rs.Path", "javax.ws.rs.Produces", "javax.ws.rs.core.MediaType" ]
import de.hshannover.f4.trust.metalyzer.api.exception.MetalyzerAPIException; import de.hshannover.f4.trust.metalyzer.semantic.entities.User; import de.hshannover.f4.trust.metalyzer.semantic.services.SemanticsController; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType;
import de.hshannover.f4.trust.metalyzer.api.exception.*; import de.hshannover.f4.trust.metalyzer.semantic.entities.*; import de.hshannover.f4.trust.metalyzer.semantic.services.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "de.hshannover.f4", "javax.ws" ]
de.hshannover.f4; javax.ws;
2,430,470
protected boolean checkRequired(FormComponent<?> formComponent) { final String input = formComponent.getInput(); // when null, check whether this is natural for that component, or // whether - as is the case with text fields - this can only happen // when the component was disabled if (input == null && !formComponent.isInputNullable() && !formComponent.isEnabledInHierarchy()) { // this value must have come from a disabled field // do not perform validation return true; } // peform validation by looking whether the value is null or empty return !Strings.isEmpty(input); } public enum OneRequiredMode { ONE_OR_MORE, ONE_ONLY }
boolean function(FormComponent<?> formComponent) { final String input = formComponent.getInput(); if (input == null && !formComponent.isInputNullable() && !formComponent.isEnabledInHierarchy()) { return true; } return !Strings.isEmpty(input); } public enum OneRequiredMode { ONE_OR_MORE, ONE_ONLY }
/** * Code copied from FormComponent#checkRequired, which is unfortunately useless as long as FormComponent#required is false. */
Code copied from FormComponent#checkRequired, which is unfortunately useless as long as FormComponent#required is false
checkRequired
{ "repo_name": "openwide-java/owsi-core-parent", "path": "owsi-core/owsi-core-components/owsi-core-component-wicket-more/src/main/java/fr/openwide/core/wicket/more/markup/html/form/validation/OneRequiredFormValidator.java", "license": "apache-2.0", "size": 3958 }
[ "org.apache.wicket.markup.html.form.FormComponent", "org.apache.wicket.util.string.Strings" ]
import org.apache.wicket.markup.html.form.FormComponent; import org.apache.wicket.util.string.Strings;
import org.apache.wicket.markup.html.form.*; import org.apache.wicket.util.string.*;
[ "org.apache.wicket" ]
org.apache.wicket;
1,929,675
@Override protected Hashtable<String,Object> backupState() { Hashtable<String,Object> result; result = super.backupState(); if (m_ScriptObject != null) result.put(BACKUP_SCRIPTOBJECT, m_ScriptObject); return result; }
Hashtable<String,Object> function() { Hashtable<String,Object> result; result = super.backupState(); if (m_ScriptObject != null) result.put(BACKUP_SCRIPTOBJECT, m_ScriptObject); return result; }
/** * Backs up the current state of the actor before update the variables. * * @return the backup */
Backs up the current state of the actor before update the variables
backupState
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/flow/core/AbstractScriptedActor.java", "license": "gpl-3.0", "size": 6193 }
[ "java.util.Hashtable" ]
import java.util.Hashtable;
import java.util.*;
[ "java.util" ]
java.util;
2,504,047
public String getExItemId(ItemStack item, IdentifierType idType) { if (item == null) { return null; } switch (idType) { case DISPLAY_NAME: if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) { return item.getItemMeta().getDisplayName().replace(identifierPrefix, ""); } else { return null; } case LORE: if (item.hasItemMeta() && item.getItemMeta().hasLore()) { return item.getItemMeta().getLore().get(0).replace(identifierPrefix, ""); } else { return null; } case PERSISTENT_DATA_CONTAINER: if (isAtLeast1_14 && item.hasItemMeta()) { return item.getItemMeta().getPersistentDataContainer().getOrDefault(new NamespacedKey("caliburn", "id"), PersistentDataType.STRING, null); } else { return null; } case VANILLA: return item.getType().toString(); default: return null; } }
String function(ItemStack item, IdentifierType idType) { if (item == null) { return null; } switch (idType) { case DISPLAY_NAME: if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) { return item.getItemMeta().getDisplayName().replace(identifierPrefix, STRSTRcaliburnSTRid"), PersistentDataType.STRING, null); } else { return null; } case VANILLA: return item.getType().toString(); default: return null; } }
/** * Returns the ID of the {@link ExItem} that the given ItemStack is an instance of. If there is no {@link CustomItem} registered, the {@link VanillaItem} of * the stack's material is used. * * @param item the ItemStack * @param idType the ID storage method * @return the ID of the {@link ExItem} that the given ItemStack is an instance of. If there is no {@link CustomItem} registered, the {@link VanillaItem} of * the stack's material is used */
Returns the ID of the <code>ExItem</code> that the given ItemStack is an instance of. If there is no <code>CustomItem</code> registered, the <code>VanillaItem</code> of the stack's material is used
getExItemId
{ "repo_name": "DRE2N/CaliburnAPI", "path": "src/main/java/de/erethon/caliburn/CaliburnAPI.java", "license": "lgpl-3.0", "size": 28205 }
[ "de.erethon.caliburn.category.IdentifierType", "org.bukkit.inventory.ItemStack", "org.bukkit.persistence.PersistentDataType" ]
import de.erethon.caliburn.category.IdentifierType; import org.bukkit.inventory.ItemStack; import org.bukkit.persistence.PersistentDataType;
import de.erethon.caliburn.category.*; import org.bukkit.inventory.*; import org.bukkit.persistence.*;
[ "de.erethon.caliburn", "org.bukkit.inventory", "org.bukkit.persistence" ]
de.erethon.caliburn; org.bukkit.inventory; org.bukkit.persistence;
619,720
@Override public Report test(Request request) { Logger.getLogger(Home.class.getName()).log(Priority.LOWEST, "Running test: {0}", this.toString()); Report report = new Report(1, 1, "100%", ""); Long start = System.currentTimeMillis(); main(request); Long end = System.currentTimeMillis(); if (end - start > 10) { report.setSuccessful(report.getSuccessful() - 1); } report.setPercentage(report.calculatePercentage(report.getTotal(), report.getSuccessful())); return report; }
Report function(Request request) { Logger.getLogger(Home.class.getName()).log(Priority.LOWEST, STR, this.toString()); Report report = new Report(1, 1, "100%", ""); Long start = System.currentTimeMillis(); main(request); Long end = System.currentTimeMillis(); if (end - start > 10) { report.setSuccessful(report.getSuccessful() - 1); } report.setPercentage(report.calculatePercentage(report.getTotal(), report.getSuccessful())); return report; }
/** * Acceptance requirements: * * <ol> * <li> * Ensure that processing completes in under 10 ms. * </li> * </ol> * * @return Report */
Acceptance requirements: Ensure that processing completes in under 10 ms.
test
{ "repo_name": "ThreaT/blink", "path": "site/src/main/java/cool/blink/site/htmltofront/read/HtmlToFront.java", "license": "unlicense", "size": 1806 }
[ "cool.blink.back.utilities.LogUtilities", "cool.blink.back.webserver.Report", "cool.blink.back.webserver.Request", "cool.blink.site.home.read.Home", "java.util.logging.Logger" ]
import cool.blink.back.utilities.LogUtilities; import cool.blink.back.webserver.Report; import cool.blink.back.webserver.Request; import cool.blink.site.home.read.Home; import java.util.logging.Logger;
import cool.blink.back.utilities.*; import cool.blink.back.webserver.*; import cool.blink.site.home.read.*; import java.util.logging.*;
[ "cool.blink.back", "cool.blink.site", "java.util" ]
cool.blink.back; cool.blink.site; java.util;
802,930
try { return new URL(cleanPath(originalPath)); } catch (MalformedURLException ex) { // Cleaned URL path cannot be converted to URL // -> take original URL. return originalUrl; } }
try { return new URL(cleanPath(originalPath)); } catch (MalformedURLException ex) { return originalUrl; } }
/** * Determine a cleaned URL for the given original URL. * * @param originalUrl * the original URL * @param originalPath * the original URL path * @return the cleaned URL * @see org.springframework.util.StringUtils#cleanPath */
Determine a cleaned URL for the given original URL
getCleanedUrl
{ "repo_name": "xuse/ef-orm", "path": "common-core/src/main/java/jef/tools/resource/UrlResource.java", "license": "apache-2.0", "size": 7855 }
[ "java.net.MalformedURLException" ]
import java.net.MalformedURLException;
import java.net.*;
[ "java.net" ]
java.net;
2,442,624
public boolean deleteUser(User user) { getCacheService().getUserMap().remove(user.getId()); logger.debug("User has been deleted from cache. User : "+user); return true; }
boolean function(User user) { getCacheService().getUserMap().remove(user.getId()); logger.debug(STR+user); return true; }
/** * Delete User * * @param User user * @return boolean response of the method */
Delete User
deleteUser
{ "repo_name": "feiyue/maven-framework-project", "path": "spring3-rmi-httpinvoker-example/src/main/java/net/aimeizi/rmi/httpinvoke/example/http/server/HttpUserService.java", "license": "mit", "size": 1815 }
[ "net.aimeizi.rmi.httpinvoke.example.model.User" ]
import net.aimeizi.rmi.httpinvoke.example.model.User;
import net.aimeizi.rmi.httpinvoke.example.model.*;
[ "net.aimeizi.rmi" ]
net.aimeizi.rmi;
265,563
@Override protected void entryRemoved(boolean evicted, String key, BitmapDrawable oldValue, BitmapDrawable newValue) { if (RecyclingBitmapDrawable.class.isInstance(oldValue)) { // The removed entry is a recycling drawable, so notify // it // that it has been removed from the memory cache ((RecyclingBitmapDrawable) oldValue).setIsCached(false); } else { // The removed entry is a standard BitmapDrawable if (VersionUtils.hasHoneycomb()) { // We're running on Honeycomb or later, so add the // bitmap // to a SoftReference set for possible use with // inBitmap later mReusableBitmaps.add(new SoftReference<Bitmap>(oldValue.getBitmap())); } } }
void function(boolean evicted, String key, BitmapDrawable oldValue, BitmapDrawable newValue) { if (RecyclingBitmapDrawable.class.isInstance(oldValue)) { ((RecyclingBitmapDrawable) oldValue).setIsCached(false); } else { if (VersionUtils.hasHoneycomb()) { mReusableBitmaps.add(new SoftReference<Bitmap>(oldValue.getBitmap())); } } }
/** * Notify the removed entry that is no longer being cached */
Notify the removed entry that is no longer being cached
entryRemoved
{ "repo_name": "almiso/CollageApp", "path": "app/src/main/java/org/almiso/collageapp/android/media/util/ImageCache.java", "license": "mit", "size": 29484 }
[ "android.graphics.Bitmap", "android.graphics.drawable.BitmapDrawable", "java.lang.ref.SoftReference" ]
import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import java.lang.ref.SoftReference;
import android.graphics.*; import android.graphics.drawable.*; import java.lang.ref.*;
[ "android.graphics", "java.lang" ]
android.graphics; java.lang;
2,124,915
public int getLoginTimeout() throws SQLException { return loginTimeOut; }
int function() throws SQLException { return loginTimeOut; }
/** * Returns the amount of time that login will wait for the connection to happen before it gets * time out. * * @throws SQLException * @return int login time out. */
Returns the amount of time that login will wait for the connection to happen before it gets time out
getLoginTimeout
{ "repo_name": "smanvi-pivotal/geode", "path": "geode-core/src/main/java/org/apache/geode/internal/datasource/AbstractDataSource.java", "license": "apache-2.0", "size": 6744 }
[ "java.sql.SQLException" ]
import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,885,819
public void testLoginAsSomeoneElse() throws IOException { final String encodedService = URLEncoder.encode(getServiceUrl(), "UTF-8"); // establish SSO session as the first user beginAt("/login?service=" + encodedService); setFormElement(FORM_USERNAME, getUsername()); setFormElement(FORM_PASSWORD, getGoodPassword()); submit(); // get the service ticket final String firstServiceTicket = LoginHelper.serviceTicketFromResponse(getDialog().getResponse()); // now login via renew as someone else beginAt("/login?renew=true&service=" + encodedService); setFormElement(FORM_USERNAME, getAlternateUsername()); setFormElement(FORM_PASSWORD, getAlternatePassword()); submit(); // get the service ticket final String secondServiceTicket = LoginHelper.serviceTicketFromResponse(getDialog().getResponse()); // validate the second service ticket beginAt("/serviceValidate?ticket=" + secondServiceTicket + "&service=" + encodedService); assertTextPresent("<cas:user>" + getAlternateUsername() + "</cas:user>"); // okay, now attempt to validate the original service ticket // and see that it has been invalidated beginAt("/serviceValidate?ticket=" + firstServiceTicket + "&service=" + encodedService); assertTextPresent("<cas:authenticationFailure"); }
void function() throws IOException { final String encodedService = URLEncoder.encode(getServiceUrl(), "UTF-8"); beginAt(STR + encodedService); setFormElement(FORM_USERNAME, getUsername()); setFormElement(FORM_PASSWORD, getGoodPassword()); submit(); final String firstServiceTicket = LoginHelper.serviceTicketFromResponse(getDialog().getResponse()); beginAt(STR + encodedService); setFormElement(FORM_USERNAME, getAlternateUsername()); setFormElement(FORM_PASSWORD, getAlternatePassword()); submit(); final String secondServiceTicket = LoginHelper.serviceTicketFromResponse(getDialog().getResponse()); beginAt(STR + secondServiceTicket + STR + encodedService); assertTextPresent(STR + getAlternateUsername() + STR); beginAt(STR + firstServiceTicket + STR + encodedService); assertTextPresent(STR); }
/** * Test that logging in as someone else destroys the TGT and outstanding * service tickets for the previously authenticated user. * @throws IOException */
Test that logging in as someone else destroys the TGT and outstanding service tickets for the previously authenticated user
testLoginAsSomeoneElse
{ "repo_name": "0be1/cas", "path": "cas-server-compatibility/src/test/java/org/jasig/cas/login/LoginAsCredentialsAcceptorCompatibilityTests.java", "license": "apache-2.0", "size": 5659 }
[ "java.io.IOException", "java.net.URLEncoder" ]
import java.io.IOException; import java.net.URLEncoder;
import java.io.*; import java.net.*;
[ "java.io", "java.net" ]
java.io; java.net;
2,852,301
@Override public void cleanResourceReferences(String key) throws YarnException { String interned = intern(key); synchronized (interned) { super.cleanResourceReferences(key); } }
void function(String key) throws YarnException { String interned = intern(key); synchronized (interned) { super.cleanResourceReferences(key); } }
/** * Provides atomicity for the method. */
Provides atomicity for the method
cleanResourceReferences
{ "repo_name": "apurtell/hadoop", "path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-sharedcachemanager/src/main/java/org/apache/hadoop/yarn/server/sharedcachemanager/store/InMemorySCMStore.java", "license": "apache-2.0", "size": 19226 }
[ "org.apache.hadoop.yarn.exceptions.YarnException" ]
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,579,632
public List<Contact> Contacts(String data) throws IllegalArgumentException, ParserException, MalformedURLException { List<Contact> result = null; List<IODataEntry> parsedSDMODataEntries = getParsedSDMODataEntries(data, parser, schema, "BusinessPartner","Contacts"); result = new LinkedList<Contact>(); for (IODataEntry entry : parsedSDMODataEntries) { result.add(new Contact(entry, parser, schema)); } return result; }
List<Contact> function(String data) throws IllegalArgumentException, ParserException, MalformedURLException { List<Contact> result = null; List<IODataEntry> parsedSDMODataEntries = getParsedSDMODataEntries(data, parser, schema, STR,STR); result = new LinkedList<Contact>(); for (IODataEntry entry : parsedSDMODataEntries) { result.add(new Contact(entry, parser, schema)); } return result; }
/** * Get Contacts * @return - List&ltContact&gt * @throws - IllegalArgumentException, ParserException, MalformedURLException */
Get Contacts
Contacts
{ "repo_name": "liangyaohua/SalesOrder", "path": "src/com/capgemini/SalesOrder/zgwsample_srv/v0/entitytypes/BusinessPartner.java", "license": "gpl-2.0", "size": 17063 }
[ "com.sap.mobile.lib.parser.IODataEntry", "com.sap.mobile.lib.parser.ParserException", "java.net.MalformedURLException", "java.util.LinkedList", "java.util.List" ]
import com.sap.mobile.lib.parser.IODataEntry; import com.sap.mobile.lib.parser.ParserException; import java.net.MalformedURLException; import java.util.LinkedList; import java.util.List;
import com.sap.mobile.lib.parser.*; import java.net.*; import java.util.*;
[ "com.sap.mobile", "java.net", "java.util" ]
com.sap.mobile; java.net; java.util;
1,708,194
public boolean copyFile(String srcPath, String destPath) { File checkFile = new File(srcPath); if (checkFile.exists()==false) return false; boolean successful = false; FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(srcPath); fos = new FileOutputStream(destPath); this.copy(fis, fos); successful = true; } catch (IOException ioEx) { ioEx.printStackTrace(); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } if (fos!=null) { try { fos.close(); } catch (IOException e) { } } } return successful; }
boolean function(String srcPath, String destPath) { File checkFile = new File(srcPath); if (checkFile.exists()==false) return false; boolean successful = false; FileInputStream fis = null; FileOutputStream fos = null; try { fis = new FileInputStream(srcPath); fos = new FileOutputStream(destPath); this.copy(fis, fos); successful = true; } catch (IOException ioEx) { ioEx.printStackTrace(); } finally { if (fis!=null) { try { fis.close(); } catch (IOException e) { } } if (fos!=null) { try { fos.close(); } catch (IOException e) { } } } return successful; }
/** * This method allows to copy a file from one location to another one. * * @param srcPath the source path * @param destPath the destination path * @return true, if successful */
This method allows to copy a file from one location to another one
copyFile
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/de.enflexit.common/src/de/enflexit/common/transfer/FileCopier.java", "license": "lgpl-2.1", "size": 2874 }
[ "java.io.File", "java.io.FileInputStream", "java.io.FileOutputStream", "java.io.IOException" ]
import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,550,523
public ArrayList<RProject> getProjects(int page, int perPage, boolean descending, int sortOn, String search) { ArrayList<RProject> result = new ArrayList<RProject>(); try { String order = descending ? "DESC" : "ASC"; String sortMode = ""; if (sortOn == CREATED_AT) { sortMode = "created_at"; } else { sortMode = "updated_at"; } String reqResult = makeRequest(baseURL, "projects", "page=" + page + "&per_page=" + perPage + "&sort=" + sortMode + "&order=" + order + "&search=" + URLEncoder.encode(search, "UTF-8"), "GET", null); JSONArray j = new JSONArray(reqResult); for (int i = 0; i < j.length(); i++) { JSONObject inner = j.getJSONObject(i); RProject proj = new RProject(); proj.project_id = inner.getInt("id"); proj.name = inner.getString("name"); proj.url = inner.getString("url"); proj.hidden = inner.getBoolean("hidden"); proj.featured = inner.getBoolean("featured"); proj.like_count = inner.getInt("likeCount"); proj.timecreated = inner.getString("createdAt"); proj.owner_name = inner.getString("ownerName"); proj.owner_url = inner.getString("ownerUrl"); result.add(proj); } } catch (Exception e) { e.printStackTrace(); } return result; }
ArrayList<RProject> function(int page, int perPage, boolean descending, int sortOn, String search) { ArrayList<RProject> result = new ArrayList<RProject>(); try { String order = descending ? "DESC" : "ASC"; String sortMode = STRcreated_atSTRupdated_atSTRprojectsSTRpage=STR&per_page=STR&sort=STR&order=STR&search=STRUTF-8STRGETSTRidSTRnameSTRurlSTRhiddenSTRfeaturedSTRlikeCountSTRcreatedAtSTRownerNameSTRownerUrl"); result.add(proj); } } catch (Exception e) { e.printStackTrace(); } return result; }
/** * Retrieves multiple projects off of iSENSE. * * @param page * Which page of results to start from. 1-indexed * @param perPage * How many results to display per page * @param descending * Whether to display the results in descending order (true) or * ascending order (false) * @param search * A string to search all projects for * @return An ArrayList of Project objects */
Retrieves multiple projects off of iSENSE
getProjects
{ "repo_name": "JasonD94/iSENSE-API", "path": "Java/API/src/edu/uml/cs/isense/api/API.java", "license": "mit", "size": 30138 }
[ "edu.uml.cs.isense.objects.RProject", "java.util.ArrayList" ]
import edu.uml.cs.isense.objects.RProject; import java.util.ArrayList;
import edu.uml.cs.isense.objects.*; import java.util.*;
[ "edu.uml.cs", "java.util" ]
edu.uml.cs; java.util;
2,702,761
@SuppressWarnings("removal") public static boolean getDefaultHeadlessProperty() { return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> { final String display = System.getenv("DISPLAY"); return display == null || display.trim().isEmpty(); }); }
@SuppressWarnings(STR) static boolean function() { return AccessController.doPrivileged((PrivilegedAction<Boolean>) () -> { final String display = System.getenv(STR); return display == null display.trim().isEmpty(); }); }
/** * Called from java.awt.GraphicsEnvironment when * to check if on this platform, the JDK should default to * headless mode, in the case the application did specify * a value for the java.awt.headless system property. */
Called from java.awt.GraphicsEnvironment when to check if on this platform, the JDK should default to headless mode, in the case the application did specify a value for the java.awt.headless system property
getDefaultHeadlessProperty
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/sun/awt/PlatformGraphicsInfo.java", "license": "apache-2.0", "size": 2604 }
[ "java.security.AccessController", "java.security.PrivilegedAction" ]
import java.security.AccessController; import java.security.PrivilegedAction;
import java.security.*;
[ "java.security" ]
java.security;
1,683,480
public void updateIncomeExpensesButtons() { if (controller.getCurrentMainCategory().getId() == Constants.EXPENSE_ID) { view.findViewById(R.id.transactionListIncomeSwitchButton) .setEnabled(true); view.findViewById(R.id.transactionListExpensesSwitchButton) .setEnabled(false); } else { view.findViewById(R.id.transactionListIncomeSwitchButton) .setEnabled(false); view.findViewById(R.id.transactionListExpensesSwitchButton) .setEnabled(true); } }
void function() { if (controller.getCurrentMainCategory().getId() == Constants.EXPENSE_ID) { view.findViewById(R.id.transactionListIncomeSwitchButton) .setEnabled(true); view.findViewById(R.id.transactionListExpensesSwitchButton) .setEnabled(false); } else { view.findViewById(R.id.transactionListIncomeSwitchButton) .setEnabled(false); view.findViewById(R.id.transactionListExpensesSwitchButton) .setEnabled(true); } }
/** * Switches the income/expenses buttons "on" and "off". */
Switches the income/expenses buttons "on" and "off"
updateIncomeExpensesButtons
{ "repo_name": "daubigne/Android-Budget-Project", "path": "Android_Budget_App/src/it/chalmers/mufasa/android_budget_app/activities/TransactionListFragment.java", "license": "gpl-3.0", "size": 5410 }
[ "it.chalmers.mufasa.android_budget_app.settings.Constants" ]
import it.chalmers.mufasa.android_budget_app.settings.Constants;
import it.chalmers.mufasa.android_budget_app.settings.*;
[ "it.chalmers.mufasa" ]
it.chalmers.mufasa;
856,819
public IsolateRef getIsolate() { JsonObject obj = (JsonObject) json.get("isolate"); if (obj == null) return null; final String type = json.get("type").getAsString(); if ("Instance".equals(type) || "@Instance".equals(type)) { final String kind = json.get("kind").getAsString(); if ("Null".equals(kind)) return null; } return new IsolateRef(obj); }
IsolateRef function() { JsonObject obj = (JsonObject) json.get(STR); if (obj == null) return null; final String type = json.get("type").getAsString(); if (STR.equals(type) STR.equals(type)) { final String kind = json.get("kind").getAsString(); if ("Null".equals(kind)) return null; } return new IsolateRef(obj); }
/** * The isolate with which this event is associated. * * This is provided for all event kinds except for: * - VMUpdate * * Can return <code>null</code>. */
The isolate with which this event is associated. This is provided for all event kinds except for: - VMUpdate Can return <code>null</code>
getIsolate
{ "repo_name": "dart-archive/vm_service_drivers", "path": "java/src/org/dartlang/vm/service/element/Event.java", "license": "bsd-3-clause", "size": 9926 }
[ "com.google.gson.JsonObject" ]
import com.google.gson.JsonObject;
import com.google.gson.*;
[ "com.google.gson" ]
com.google.gson;
1,602,586
boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException;
boolean checkAndPut(byte[] row, byte[] family, byte[] qualifier, byte[] value, Put put) throws IOException;
/** * Atomically checks if a row/family/qualifier value matches the expected * value. If it does, it adds the put. If the passed value is null, the check * is for the lack of column (ie: non-existance) * * @param row to check * @param family column family to check * @param qualifier column qualifier to check * @param value the expected value * @param put data to put if check succeeds * @throws IOException e * @return true if the new put was executed, false otherwise */
Atomically checks if a row/family/qualifier value matches the expected value. If it does, it adds the put. If the passed value is null, the check is for the lack of column (ie: non-existance)
checkAndPut
{ "repo_name": "lifeng5042/RStore", "path": "src/org/apache/hadoop/hbase/client/HTableInterface.java", "license": "gpl-2.0", "size": 17905 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,201,865
public AnalysisEngine getAe() { return this.ae; }
AnalysisEngine function() { return this.ae; }
/** * Gets the ae. * * @return the ae */
Gets the ae
getAe
{ "repo_name": "apache/uima-uimaj", "path": "uimaj-tools/src/main/java/org/apache/uima/tools/cvd/MainFrame.java", "license": "apache-2.0", "size": 89935 }
[ "org.apache.uima.analysis_engine.AnalysisEngine" ]
import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.analysis_engine.*;
[ "org.apache.uima" ]
org.apache.uima;
1,858,855
public static void installKinesisPlugin(QueryRunner queryRunner, String tableDescriptionLocation, String accessKey, String secretKey) { KinesisPlugin kinesisPlugin = new KinesisPlugin(); queryRunner.installPlugin(kinesisPlugin); Map<String, String> kinesisConfig = ImmutableMap.of( "kinesis.default-schema", "default", "kinesis.access-key", accessKey, "kinesis.secret-key", secretKey, "kinesis.table-description-location", tableDescriptionLocation); queryRunner.createCatalog("kinesis", "kinesis", kinesisConfig); }
static void function(QueryRunner queryRunner, String tableDescriptionLocation, String accessKey, String secretKey) { KinesisPlugin kinesisPlugin = new KinesisPlugin(); queryRunner.installPlugin(kinesisPlugin); Map<String, String> kinesisConfig = ImmutableMap.of( STR, STR, STR, accessKey, STR, secretKey, STR, tableDescriptionLocation); queryRunner.createCatalog(STR, STR, kinesisConfig); }
/** * Install the plug in into the given query runner, using normal setup but with the given table descriptions. * <p> * Note that this uses the actual client and will incur charges from AWS when run. Mainly for full * integration tests. */
Install the plug in into the given query runner, using normal setup but with the given table descriptions. Note that this uses the actual client and will incur charges from AWS when run. Mainly for full integration tests
installKinesisPlugin
{ "repo_name": "11xor6/presto", "path": "plugin/trino-kinesis/src/test/java/io/trino/plugin/kinesis/util/TestUtils.java", "license": "apache-2.0", "size": 4182 }
[ "com.google.common.collect.ImmutableMap", "io.trino.plugin.kinesis.KinesisPlugin", "io.trino.testing.QueryRunner", "java.util.Map" ]
import com.google.common.collect.ImmutableMap; import io.trino.plugin.kinesis.KinesisPlugin; import io.trino.testing.QueryRunner; import java.util.Map;
import com.google.common.collect.*; import io.trino.plugin.kinesis.*; import io.trino.testing.*; import java.util.*;
[ "com.google.common", "io.trino.plugin", "io.trino.testing", "java.util" ]
com.google.common; io.trino.plugin; io.trino.testing; java.util;
1,071,262
public IMethod getMethod() { return getMethodCall().getMethod(); }
IMethod function() { return getMethodCall().getMethod(); }
/** * Method getMethod. * @return Object */
Method getMethod
getMethod
{ "repo_name": "linnet/eclipse-tools", "path": "dk.kamstruplinnet.callers/src/dk/kamstruplinnet/callers/search/MethodWrapper.java", "license": "epl-1.0", "size": 8175 }
[ "org.eclipse.jdt.core.IMethod" ]
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
2,803,129
public void close() throws IOException { RandomAccessFile raf = this.raf; if (raf == null) return; synchronized (raf) { closed = true; entries = null; raf.close(); } }
void function() throws IOException { RandomAccessFile raf = this.raf; if (raf == null) return; synchronized (raf) { closed = true; entries = null; raf.close(); } }
/** * Closes the ZipFile. This also closes all input streams given by * this class. After this is called, no further method should be * called. * * @exception IOException if a i/o error occured. */
Closes the ZipFile. This also closes all input streams given by this class. After this is called, no further method should be called
close
{ "repo_name": "rhuitl/uClinux", "path": "lib/classpath/java/util/zip/ZipFile.java", "license": "gpl-2.0", "size": 21581 }
[ "java.io.IOException", "java.io.RandomAccessFile" ]
import java.io.IOException; import java.io.RandomAccessFile;
import java.io.*;
[ "java.io" ]
java.io;
2,312,811
@Test public void testUpdateNodeStateComplete() { K8sNode updated = DefaultK8sNode.from(MINION_2) .state(COMPLETE) .build(); target.updateNode(updated); assertEquals(ERR_NOT_MATCH, updated, target.node(MINION_2_HOSTNAME)); validateEvents(K8S_NODE_UPDATED, K8S_NODE_COMPLETE); }
void function() { K8sNode updated = DefaultK8sNode.from(MINION_2) .state(COMPLETE) .build(); target.updateNode(updated); assertEquals(ERR_NOT_MATCH, updated, target.node(MINION_2_HOSTNAME)); validateEvents(K8S_NODE_UPDATED, K8S_NODE_COMPLETE); }
/** * Checks if updating a node state to complete generates proper events. */
Checks if updating a node state to complete generates proper events
testUpdateNodeStateComplete
{ "repo_name": "opennetworkinglab/onos", "path": "apps/k8s-node/app/src/test/java/org/onosproject/k8snode/impl/K8sNodeManagerTest.java", "license": "apache-2.0", "size": 13402 }
[ "org.junit.Assert", "org.onosproject.k8snode.api.DefaultK8sNode", "org.onosproject.k8snode.api.K8sNode" ]
import org.junit.Assert; import org.onosproject.k8snode.api.DefaultK8sNode; import org.onosproject.k8snode.api.K8sNode;
import org.junit.*; import org.onosproject.k8snode.api.*;
[ "org.junit", "org.onosproject.k8snode" ]
org.junit; org.onosproject.k8snode;
2,660,728
EEnum getAlineacion();
EEnum getAlineacion();
/** * Returns the meta object for enum '{@link visualizacionMetricas3.visualizacion.Alineacion <em>Alineacion</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for enum '<em>Alineacion</em>'. * @see visualizacionMetricas3.visualizacion.Alineacion * @generated */
Returns the meta object for enum '<code>visualizacionMetricas3.visualizacion.Alineacion Alineacion</code>'.
getAlineacion
{ "repo_name": "lfmendivelso10/AppModernization", "path": "source/i2/VisualizacionMetricas3/src/visualizacionMetricas3/visualizacion/VisualizacionPackage.java", "license": "mit", "size": 96014 }
[ "org.eclipse.emf.ecore.EEnum" ]
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,504,838
public static void updateRepositoryUuidInMetadata( ClusterService clusterService, final String repositoryName, RepositoryData repositoryData, ActionListener<Void> listener) { final String repositoryUuid = repositoryData.getUuid(); if (repositoryUuid.equals(RepositoryData.MISSING_UUID)) { listener.onResponse(null); return; } final RepositoriesMetadata currentReposMetadata = clusterService.state().metadata().custom(RepositoriesMetadata.TYPE, RepositoriesMetadata.EMPTY); final RepositoryMetadata repositoryMetadata = currentReposMetadata.repository(repositoryName); if (repositoryMetadata == null || repositoryMetadata.uuid().equals(repositoryUuid)) { listener.onResponse(null); return; }
static void function( ClusterService clusterService, final String repositoryName, RepositoryData repositoryData, ActionListener<Void> listener) { final String repositoryUuid = repositoryData.getUuid(); if (repositoryUuid.equals(RepositoryData.MISSING_UUID)) { listener.onResponse(null); return; } final RepositoriesMetadata currentReposMetadata = clusterService.state().metadata().custom(RepositoriesMetadata.TYPE, RepositoriesMetadata.EMPTY); final RepositoryMetadata repositoryMetadata = currentReposMetadata.repository(repositoryName); if (repositoryMetadata == null repositoryMetadata.uuid().equals(repositoryUuid)) { listener.onResponse(null); return; }
/** * Set the repository UUID in the named repository's {@link RepositoryMetadata} to match the UUID in its {@link RepositoryData}, * which may involve a cluster state update. * * @param listener notified when the {@link RepositoryMetadata} is updated, possibly on this thread or possibly on the master service * thread */
Set the repository UUID in the named repository's <code>RepositoryMetadata</code> to match the UUID in its <code>RepositoryData</code>, which may involve a cluster state update
updateRepositoryUuidInMetadata
{ "repo_name": "robin13/elasticsearch", "path": "server/src/main/java/org/elasticsearch/repositories/RepositoriesService.java", "license": "apache-2.0", "size": 34604 }
[ "org.elasticsearch.action.ActionListener", "org.elasticsearch.cluster.metadata.RepositoriesMetadata", "org.elasticsearch.cluster.metadata.RepositoryMetadata", "org.elasticsearch.cluster.service.ClusterService" ]
import org.elasticsearch.action.ActionListener; import org.elasticsearch.cluster.metadata.RepositoriesMetadata; import org.elasticsearch.cluster.metadata.RepositoryMetadata; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.action.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.cluster.service.*;
[ "org.elasticsearch.action", "org.elasticsearch.cluster" ]
org.elasticsearch.action; org.elasticsearch.cluster;
86,918
// TODO: Images selected from SDCARD don't display correctly, but from CAMERA ALBUM do! public void getImage(int srcType, int returnType) { Intent intent = new Intent(); String title = GET_PICTURE; if (this.mediaType == PICTURE) { intent.setType("image*"); title = GET_All; } //开启系统图像裁切功能 Add By ZhuShunqing if(this.allowEdit){ // intent.putExtra("crop", "true"); // intent.putExtra("aspectX", this.aspectX);// 裁剪框比例 // intent.putExtra("aspectY", this.aspectY); // if(targetWidth > 0) //如果指定输出宽度 // intent.putExtra("outputX", targetWidth); // if(targetHeight > 0) //如果指定输出高度 // intent.putExtra("outputY", targetHeight); // // Specify file so that large image is captured and returned File photo = createCaptureFile(encodingType); // intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); this.imageUri = Uri.fromFile(photo); } intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); if (this.cordova != null) { this.cordova.startActivityForResult((CordovaPlugin) this, Intent.createChooser(intent, new String(title)), (srcType + 1) * 16 + returnType + 1); } }
void function(int srcType, int returnType) { Intent intent = new Intent(); String title = GET_PICTURE; if (this.mediaType == PICTURE) { intent.setType(STR); title = GET_All; } if(this.allowEdit){ File photo = createCaptureFile(encodingType); this.imageUri = Uri.fromFile(photo); } intent.setAction(Intent.ACTION_GET_CONTENT); intent.addCategory(Intent.CATEGORY_OPENABLE); if (this.cordova != null) { this.cordova.startActivityForResult((CordovaPlugin) this, Intent.createChooser(intent, new String(title)), (srcType + 1) * 16 + returnType + 1); } }
/** * Get image from photo library. * * @param quality Compression quality hint (0-100: 0=low quality & high compression, 100=compress of max quality) * @param srcType The album to get image from. * @param returnType Set the type of image to return. */
Get image from photo library
getImage
{ "repo_name": "zhushunqing/cordova-camera-android-crop-available", "path": "src/android/CameraLauncher.java", "license": "apache-2.0", "size": 39069 }
[ "android.content.Intent", "android.net.Uri", "java.io.File", "org.apache.cordova.CordovaPlugin" ]
import android.content.Intent; import android.net.Uri; import java.io.File; import org.apache.cordova.CordovaPlugin;
import android.content.*; import android.net.*; import java.io.*; import org.apache.cordova.*;
[ "android.content", "android.net", "java.io", "org.apache.cordova" ]
android.content; android.net; java.io; org.apache.cordova;
1,213,194
void execute(FHActCallback pCallback) throws Exception;
void execute(FHActCallback pCallback) throws Exception;
/** * Executes the request asynchronously. Executes the pCallback function when * it finishes. * * @param pCallback the callback function * @throws Exception this method is allowed to throw an exception */
Executes the request asynchronously. Executes the pCallback function when it finishes
execute
{ "repo_name": "matzew/fh-android-sdk", "path": "fh-android-sdk/src/main/java/com/feedhenry/sdk2/FHAct.java", "license": "apache-2.0", "size": 1518 }
[ "com.feedhenry.sdk.FHActCallback" ]
import com.feedhenry.sdk.FHActCallback;
import com.feedhenry.sdk.*;
[ "com.feedhenry.sdk" ]
com.feedhenry.sdk;
892,115
this.actionButtonsTag = actionButtonsTag; } public ActionButtonsColumnTag() { this.setMedia(MediaTypeEnum.HTML.getName()); this.actionButtonsTag = new ActionButtonsTag(); this.actionButtonsTag.showOnlyActionWithIcon(); }
this.actionButtonsTag = actionButtonsTag; } public ActionButtonsColumnTag() { this.setMedia(MediaTypeEnum.HTML.getName()); this.actionButtonsTag = new ActionButtonsTag(); this.actionButtonsTag.showOnlyActionWithIcon(); }
/** * Sets the action buttons tag. * * @param actionButtonsTag * the new action buttons tag */
Sets the action buttons tag
setActionButtonsTag
{ "repo_name": "alarulrajan/CodeFest", "path": "src/com/technoetic/xplanner/tags/displaytag/ActionButtonsColumnTag.java", "license": "gpl-2.0", "size": 4415 }
[ "org.displaytag.properties.MediaTypeEnum" ]
import org.displaytag.properties.MediaTypeEnum;
import org.displaytag.properties.*;
[ "org.displaytag.properties" ]
org.displaytag.properties;
2,230,521
public static DeleteType toDeleteType( KeyValue.Type type) throws IOException { switch (type) { case Delete: return DeleteType.DELETE_ONE_VERSION; case DeleteColumn: return DeleteType.DELETE_MULTIPLE_VERSIONS; case DeleteFamily: return DeleteType.DELETE_FAMILY; case DeleteFamilyVersion: return DeleteType.DELETE_FAMILY_VERSION; default: throw new IOException("Unknown delete type: " + type); } }
static DeleteType function( KeyValue.Type type) throws IOException { switch (type) { case Delete: return DeleteType.DELETE_ONE_VERSION; case DeleteColumn: return DeleteType.DELETE_MULTIPLE_VERSIONS; case DeleteFamily: return DeleteType.DELETE_FAMILY; case DeleteFamilyVersion: return DeleteType.DELETE_FAMILY_VERSION; default: throw new IOException(STR + type); } }
/** * Convert a delete KeyValue type to protocol buffer DeleteType. * * @param type * @return protocol buffer DeleteType * @throws IOException */
Convert a delete KeyValue type to protocol buffer DeleteType
toDeleteType
{ "repo_name": "drewpope/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java", "license": "apache-2.0", "size": 114457 }
[ "java.io.IOException", "java.lang.reflect.Type", "org.apache.hadoop.hbase.KeyValue", "org.apache.hadoop.hbase.client.Delete", "org.apache.hadoop.hbase.protobuf.generated.ClientProtos" ]
import java.io.IOException; import java.lang.reflect.Type; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Delete; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos;
import java.io.*; import java.lang.reflect.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.protobuf.generated.*;
[ "java.io", "java.lang", "org.apache.hadoop" ]
java.io; java.lang; org.apache.hadoop;
106,021
SqlValidatorScope getGroupScope(SqlSelect select);
SqlValidatorScope getGroupScope(SqlSelect select);
/** * Returns a scope containing the objects visible from the GROUP BY clause * of a query. * * @param select SELECT statement * @return naming scope for GROUP BY clause */
Returns a scope containing the objects visible from the GROUP BY clause of a query
getGroupScope
{ "repo_name": "wanglan/calcite", "path": "core/src/main/java/org/apache/calcite/sql/validate/SqlValidator.java", "license": "apache-2.0", "size": 24553 }
[ "org.apache.calcite.sql.SqlSelect" ]
import org.apache.calcite.sql.SqlSelect;
import org.apache.calcite.sql.*;
[ "org.apache.calcite" ]
org.apache.calcite;
1,626,324
private void installHttpSelector(Properties settings, ProtocolDispatchSelector ps) throws NumberFormatException { String proxyHost = settings.getProperty("org.gnome.system.proxy.http host", null); int proxyPort = Integer.parseInt(settings.getProperty("org.gnome.system.proxy.http port", "0").trim()); if (proxyHost != null && proxyHost.length() > 0 && proxyPort > 0) { Logger.log(getClass(), LogLevel.TRACE, "Gnome http proxy is {0}:{1}", proxyHost, proxyPort); ps.setSelector("http", new FixedProxySelector(proxyHost.trim(), proxyPort)); } }
void function(Properties settings, ProtocolDispatchSelector ps) throws NumberFormatException { String proxyHost = settings.getProperty(STR, null); int proxyPort = Integer.parseInt(settings.getProperty(STR, "0").trim()); if (proxyHost != null && proxyHost.length() > 0 && proxyPort > 0) { Logger.log(getClass(), LogLevel.TRACE, STR, proxyHost, proxyPort); ps.setSelector("http", new FixedProxySelector(proxyHost.trim(), proxyPort)); } }
/************************************************************************* * Install a http proxy from the given settings. * @param settings to inspect * @param ps the dispatch selector to configure. * @throws NumberFormatException ************************************************************************/
Install a http proxy from the given settings
installHttpSelector
{ "repo_name": "brsanthu/proxy-vole", "path": "src/main/java/com/btr/proxy/search/desktop/gnome/GnomeDConfProxySearchStrategy.java", "license": "bsd-3-clause", "size": 12811 }
[ "com.btr.proxy.selector.fixed.FixedProxySelector", "com.btr.proxy.selector.misc.ProtocolDispatchSelector", "com.btr.proxy.util.Logger", "java.util.Properties" ]
import com.btr.proxy.selector.fixed.FixedProxySelector; import com.btr.proxy.selector.misc.ProtocolDispatchSelector; import com.btr.proxy.util.Logger; import java.util.Properties;
import com.btr.proxy.selector.fixed.*; import com.btr.proxy.selector.misc.*; import com.btr.proxy.util.*; import java.util.*;
[ "com.btr.proxy", "java.util" ]
com.btr.proxy; java.util;
81,934
public static String resultSetToString(ResultSet resultSet) throws IllegalAccessException { StringBuilder resultSetStringBuilder = new StringBuilder(); List<String[]> resultSetStringArrayList = resultSetToStringArrayList(resultSet); List<Integer> maxColumnSizes = getMaxColumnSizes(resultSetStringArrayList); String rowTemplate = createRowTemplate(maxColumnSizes); String rowSeparator = createRowSeperator(maxColumnSizes); resultSetStringBuilder.append(rowSeparator); for (int i = 0; i < resultSetStringArrayList.size(); i++) { resultSetStringBuilder.append( String.format(rowTemplate, (Object[]) resultSetStringArrayList.get(i))).append( rowSeparator); } return resultSetStringBuilder.toString(); }
static String function(ResultSet resultSet) throws IllegalAccessException { StringBuilder resultSetStringBuilder = new StringBuilder(); List<String[]> resultSetStringArrayList = resultSetToStringArrayList(resultSet); List<Integer> maxColumnSizes = getMaxColumnSizes(resultSetStringArrayList); String rowTemplate = createRowTemplate(maxColumnSizes); String rowSeparator = createRowSeperator(maxColumnSizes); resultSetStringBuilder.append(rowSeparator); for (int i = 0; i < resultSetStringArrayList.size(); i++) { resultSetStringBuilder.append( String.format(rowTemplate, (Object[]) resultSetStringArrayList.get(i))).append( rowSeparator); } return resultSetStringBuilder.toString(); }
/** * Gets the result set as a table representation in the form of: * * <pre> * +-------+-------+-------+ * |column1|column2|column3| * +-------+-------+-------+ * |value1 |value2 |value3 | * +-------+-------+-------+ * |value1 |value2 |value3 | * +-------+-------+-------+ * </pre> * * @param resultSet the result set to display as a string * @return the string representation of result set as a table * @throws IllegalAccessException if the values of the result set cannot be * accessed */
Gets the result set as a table representation in the form of: <code> +-------+-------+-------+ |column1|column2|column3| +-------+-------+-------+ |value1 |value2 |value3 | +-------+-------+-------+ |value1 |value2 |value3 | +-------+-------+-------+ </code>
resultSetToString
{ "repo_name": "nafae/developer", "path": "modules/dfp_axis/src/main/java/com/google/api/ads/dfp/axis/utils/v201411/Pql.java", "license": "apache-2.0", "size": 18525 }
[ "com.google.api.ads.dfp.axis.v201411.ResultSet", "java.util.List" ]
import com.google.api.ads.dfp.axis.v201411.ResultSet; import java.util.List;
import com.google.api.ads.dfp.axis.v201411.*; import java.util.*;
[ "com.google.api", "java.util" ]
com.google.api; java.util;
2,744,649
void disableSSL() { if (logger.isLoggable(Level.FINER)) logger.finer(toString() + " Disabling SSL..."); // Create a couple of cheap closed streams InputStream is = new ByteArrayInputStream(new byte[0]); try { is.close(); } catch (IOException e) { // No reason to expect a brand new ByteArrayInputStream not to close, // but just in case... logger.fine("Ignored error closing InputStream: " + e.getMessage()); } OutputStream os = new ByteArrayOutputStream(); try { os.close(); } catch (IOException e) { // No reason to expect a brand new ByteArrayOutputStream not to close, // but just in case... logger.fine("Ignored error closing OutputStream: " + e.getMessage()); } // Rewire the proxy socket to the closed streams if (logger.isLoggable(Level.FINEST)) logger.finest(toString() + " Rewiring proxy streams for SSL socket close"); proxySocket.setStreams(is, os); // Now close the SSL socket. It will see that the proxy socket's streams // are closed and not try to do any further I/O over them. try { if (logger.isLoggable(Level.FINER)) logger.finer(toString() + " Closing SSL socket"); sslSocket.close(); } catch (IOException e) { // Don't care if we can't close the SSL socket. We're done with it anyway. logger.fine("Ignored error closing SSLSocket: " + e.getMessage()); } // Do not close the proxy socket. Doing so would close our TCP socket // to which the proxy socket is bound. Instead, just null out the reference // to free up the few resources it holds onto. proxySocket = null; // Finally, with all of the SSL support out of the way, put the TDSChannel // back to using the TCP/IP socket and streams directly. inputStream = tcpInputStream; outputStream = tcpOutputStream; channelSocket = tcpSocket; sslSocket = null; if (logger.isLoggable(Level.FINER)) logger.finer(toString() + " SSL disabled"); } private class SSLHandshakeInputStream extends InputStream { private final TDSReader tdsReader; private final SSLHandshakeOutputStream sslHandshakeOutputStream; private final Logger logger; private final String logContext; SSLHandshakeInputStream(TDSChannel tdsChannel, SSLHandshakeOutputStream sslHandshakeOutputStream) { this.tdsReader = tdsChannel.getReader(null); this.sslHandshakeOutputStream = sslHandshakeOutputStream; this.logger = tdsChannel.getLogger(); this.logContext = tdsChannel.toString() + " (SSLHandshakeInputStream):"; }
void disableSSL() { if (logger.isLoggable(Level.FINER)) logger.finer(toString() + STR); InputStream is = new ByteArrayInputStream(new byte[0]); try { is.close(); } catch (IOException e) { logger.fine(STR + e.getMessage()); } OutputStream os = new ByteArrayOutputStream(); try { os.close(); } catch (IOException e) { logger.fine(STR + e.getMessage()); } if (logger.isLoggable(Level.FINEST)) logger.finest(toString() + STR); proxySocket.setStreams(is, os); try { if (logger.isLoggable(Level.FINER)) logger.finer(toString() + STR); sslSocket.close(); } catch (IOException e) { logger.fine(STR + e.getMessage()); } proxySocket = null; inputStream = tcpInputStream; outputStream = tcpOutputStream; channelSocket = tcpSocket; sslSocket = null; if (logger.isLoggable(Level.FINER)) logger.finer(toString() + STR); } private class SSLHandshakeInputStream extends InputStream { private final TDSReader tdsReader; private final SSLHandshakeOutputStream sslHandshakeOutputStream; private final Logger logger; private final String logContext; SSLHandshakeInputStream(TDSChannel tdsChannel, SSLHandshakeOutputStream sslHandshakeOutputStream) { this.tdsReader = tdsChannel.getReader(null); this.sslHandshakeOutputStream = sslHandshakeOutputStream; this.logger = tdsChannel.getLogger(); this.logContext = tdsChannel.toString() + STR; }
/** * Disables SSL on this TDS channel. */
Disables SSL on this TDS channel
disableSSL
{ "repo_name": "pierresouchay/mssql-jdbc", "path": "src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java", "license": "mit", "size": 322046 }
[ "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream", "java.util.logging.Level", "java.util.logging.Logger" ]
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.logging.Level; import java.util.logging.Logger;
import java.io.*; import java.util.logging.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,023,296
static final void setAccelerator(JMenuItem item, KeyStroke keystroke) { if (keystroke != null) { item.setAccelerator(keystroke); } }
static final void setAccelerator(JMenuItem item, KeyStroke keystroke) { if (keystroke != null) { item.setAccelerator(keystroke); } }
/** * Set the accelerator of a given item. * * @param item The item. * @param keystroke The key stroke. */
Set the accelerator of a given item
setAccelerator
{ "repo_name": "carvalhomb/tsmells", "path": "sample/argouml/argouml/org/argouml/ui/cmd/GenericArgoMenuBar.java", "license": "gpl-2.0", "size": 30333 }
[ "javax.swing.JMenuItem", "javax.swing.KeyStroke" ]
import javax.swing.JMenuItem; import javax.swing.KeyStroke;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
2,221,015
try { final JavaFileSystem files = new JavaFileSystem(args[0]); final ResourceFactory resources = new StaticResources(files); ServerUtil.launchJettyServer(8080, new DefaultDispatcher(), new FileServerSessionsApp(resources)); } catch (final Exception e) { e.printStackTrace(); } } private final ResourceFactory resources; public FileServerSessionsApp(final ResourceFactory resources) { this.resources = resources; }
try { final JavaFileSystem files = new JavaFileSystem(args[0]); final ResourceFactory resources = new StaticResources(files); ServerUtil.launchJettyServer(8080, new DefaultDispatcher(), new FileServerSessionsApp(resources)); } catch (final Exception e) { e.printStackTrace(); } } private final ResourceFactory resources; public FileServerSessionsApp(final ResourceFactory resources) { this.resources = resources; }
/** This is the main method to start this application server instance. @param args The command line arguments, however, this application only takes one: The path to read files from to respond to HTTP requests. */
This is the main method to start this application server instance
main
{ "repo_name": "emily-e/webframework", "path": "src/main/java/net/metanotion/web/examples/FileServerSessionsApp.java", "license": "apache-2.0", "size": 4140 }
[ "net.metanotion.io.JavaFileSystem", "net.metanotion.simpletemplate.ResourceFactory", "net.metanotion.simpletemplate.StaticResources", "net.metanotion.web.concrete.DefaultDispatcher", "net.metanotion.web.servlets.ServerUtil" ]
import net.metanotion.io.JavaFileSystem; import net.metanotion.simpletemplate.ResourceFactory; import net.metanotion.simpletemplate.StaticResources; import net.metanotion.web.concrete.DefaultDispatcher; import net.metanotion.web.servlets.ServerUtil;
import net.metanotion.io.*; import net.metanotion.simpletemplate.*; import net.metanotion.web.concrete.*; import net.metanotion.web.servlets.*;
[ "net.metanotion.io", "net.metanotion.simpletemplate", "net.metanotion.web" ]
net.metanotion.io; net.metanotion.simpletemplate; net.metanotion.web;
1,291,335
EEnum getAction();
EEnum getAction();
/** * Returns the meta object for enum '{@link datacenter.types.Action <em>Action</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for enum '<em>Action</em>'. * @see datacenter.types.Action * @generated */
Returns the meta object for enum '<code>datacenter.types.Action Action</code>'.
getAction
{ "repo_name": "diverse-project/flink-datacenter", "path": "datacenter/src/datacenter/types/TypesPackage.java", "license": "mit", "size": 4486 }
[ "org.eclipse.emf.ecore.EEnum" ]
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,799,841
//Executed inside a thread to have more responsive ui UIUtils.getDisplay().asyncExec(new Runnable() {
UIUtils.getDisplay().asyncExec(new Runnable() {
/** * Method to call when the selection changes. It will update the current selection and * refresh the toolbar removing the necessary control and adding the missing one. * The method is visible is used to know if a control should be visible or not * * @param activeEditor the active editor where the selection is done * @param selection the new selection * @param bars the current action bars, where the new controls will be placed */
Method to call when the selection changes. It will update the current selection and refresh the toolbar removing the necessary control and adding the missing one. The method is visible is used to know if a control should be visible or not
updateSelection
{ "repo_name": "OpenSoftwareSolutions/PDFReporter-Studio", "path": "com.jaspersoft.studio/src/com/jaspersoft/studio/toolbars/CommonToolbarHandler.java", "license": "lgpl-3.0", "size": 14252 }
[ "net.sf.jasperreports.eclipse.ui.util.UIUtils" ]
import net.sf.jasperreports.eclipse.ui.util.UIUtils;
import net.sf.jasperreports.eclipse.ui.util.*;
[ "net.sf.jasperreports" ]
net.sf.jasperreports;
99,330
@ApiModelProperty(example = "null", value = "") public String getType() { return type; }
@ApiModelProperty(example = "null", value = "") String function() { return type; }
/** * Get type * @return type **/
Get type
getType
{ "repo_name": "Metatavu/kunta-api-spec", "path": "java-client-generated/src/main/java/fi/metatavu/kuntaapi/client/model/Phone.java", "license": "agpl-3.0", "size": 7181 }
[ "io.swagger.annotations.ApiModelProperty" ]
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.*;
[ "io.swagger.annotations" ]
io.swagger.annotations;
1,176,560
TDBInternal.expel(Location.mem(), true); }
TDBInternal.expel(Location.mem(), true); }
/** * Clean up test resources */
Clean up test resources
cleanupTest
{ "repo_name": "apache/jena", "path": "jena-jdbc/jena-jdbc-driver-tdb/src/test/java/org/apache/jena/jdbc/tdb/connections/TestTdbMemConnection.java", "license": "apache-2.0", "size": 2343 }
[ "org.apache.jena.tdb.sys.TDBInternal" ]
import org.apache.jena.tdb.sys.TDBInternal;
import org.apache.jena.tdb.sys.*;
[ "org.apache.jena" ]
org.apache.jena;
1,471,325
public boolean isPanningEvent(UIMouse e) { return (e.has(Button.RIGHT) && !config.classicControls && !e.has(Modifier.CTRL)) || (e.has(Button.MIDDLE) && config.classicControls); }
boolean function(UIMouse e) { return (e.has(Button.RIGHT) && !config.classicControls && !e.has(Modifier.CTRL)) (e.has(Button.MIDDLE) && config.classicControls); }
/** * Check if the mouse event is a panning event. * @param e the event * @return true if panning event */
Check if the mouse event is a panning event
isPanningEvent
{ "repo_name": "akarnokd/open-ig", "path": "src/hu/openig/screen/CommonResources.java", "license": "lgpl-3.0", "size": 46061 }
[ "hu.openig.ui.UIMouse" ]
import hu.openig.ui.UIMouse;
import hu.openig.ui.*;
[ "hu.openig.ui" ]
hu.openig.ui;
727,259
private static String getCommentsBefore(Node node) { Token token = getFirstToken(node); if (token != null) { token = token.getPreviousToken(); } ArrayList<String> comments = new ArrayList<String>(); while (token != null) { if (token.getId() == Asn1Constants.WHITESPACE) { comments.add(getLineBreaks(token.getImage())); } else if (token.getId() == Asn1Constants.COMMENT && !commentTokens.contains(token)) { commentTokens.add(token); comments.add(token.getImage().substring(2).trim()); } else { break; } token = token.getPreviousToken(); } StringBuilder buffer = new StringBuilder(); for (int i = comments.size() - 1; i >= 0; i--) { buffer.append(comments.get(i)); } String res = buffer.toString().trim(); return res.length() <= 0 ? null : res; }
static String function(Node node) { Token token = getFirstToken(node); if (token != null) { token = token.getPreviousToken(); } ArrayList<String> comments = new ArrayList<String>(); while (token != null) { if (token.getId() == Asn1Constants.WHITESPACE) { comments.add(getLineBreaks(token.getImage())); } else if (token.getId() == Asn1Constants.COMMENT && !commentTokens.contains(token)) { commentTokens.add(token); comments.add(token.getImage().substring(2).trim()); } else { break; } token = token.getPreviousToken(); } StringBuilder buffer = new StringBuilder(); for (int i = comments.size() - 1; i >= 0; i--) { buffer.append(comments.get(i)); } String res = buffer.toString().trim(); return res.length() <= 0 ? null : res; }
/** * Returns all the comments before the specified node. If * there are multiple comment lines possibly separated by * whitespace, they will be concatenated into one string. * * @param node the production or token node * * @return the comment string, or * null if no comments were found */
Returns all the comments before the specified node. If there are multiple comment lines possibly separated by whitespace, they will be concatenated into one string
getCommentsBefore
{ "repo_name": "runner-mei/mibble", "path": "src/main/java/net/percederberg/mibble/MibAnalyzerUtil.java", "license": "gpl-2.0", "size": 10258 }
[ "java.util.ArrayList", "net.percederberg.grammatica.parser.Node", "net.percederberg.grammatica.parser.Token", "net.percederberg.mibble.asn1.Asn1Constants" ]
import java.util.ArrayList; import net.percederberg.grammatica.parser.Node; import net.percederberg.grammatica.parser.Token; import net.percederberg.mibble.asn1.Asn1Constants;
import java.util.*; import net.percederberg.grammatica.parser.*; import net.percederberg.mibble.asn1.*;
[ "java.util", "net.percederberg.grammatica", "net.percederberg.mibble" ]
java.util; net.percederberg.grammatica; net.percederberg.mibble;
181,156
//------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF public static IndexFamily.Meta meta() { return IndexFamily.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(IndexFamily.Meta.INSTANCE); }
static IndexFamily.Meta function() { return IndexFamily.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(IndexFamily.Meta.INSTANCE); }
/** * The meta-bean for {@code IndexFamily}. * @return the meta-bean, not null */
The meta-bean for IndexFamily
meta
{ "repo_name": "jeorme/OG-Platform", "path": "projects/OG-FinancialTypes/src/main/java/com/opengamma/financial/security/index/IndexFamily.java", "license": "apache-2.0", "size": 6771 }
[ "org.joda.beans.JodaBeanUtils" ]
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.*;
[ "org.joda.beans" ]
org.joda.beans;
2,796,760
private static String deepCleanInternal(String email) throws IOException, ContextedException { if(null == sAPIKey) { ContextedException cre; cre = new ContextedException("No API key, must call registerAPIKey(String) first"); cre.addContextValue("apiKey", null); throw cre; } String apiUrl; apiUrl = String.format(LIST_WISE_API_URL_FORMAT, email, sAPIKey); URL url = new URL(apiUrl); URLConnection conn = url.openConnection(); BufferedReader in; in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; StringBuilder buf = new StringBuilder(); while ((inputLine = in.readLine()) != null) { LOG.debug(inputLine); buf.append(inputLine); } in.close(); return buf.toString(); }
static String function(String email) throws IOException, ContextedException { if(null == sAPIKey) { ContextedException cre; cre = new ContextedException(STR); cre.addContextValue(STR, null); throw cre; } String apiUrl; apiUrl = String.format(LIST_WISE_API_URL_FORMAT, email, sAPIKey); URL url = new URL(apiUrl); URLConnection conn = url.openConnection(); BufferedReader in; in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String inputLine; StringBuilder buf = new StringBuilder(); while ((inputLine = in.readLine()) != null) { LOG.debug(inputLine); buf.append(inputLine); } in.close(); return buf.toString(); }
/** * Returns a JSON string from the deep clean API * @param email * The email address to clean * @return A JSON string from the deep clean API * @throws IOException if an I/O error occurs * @throws ContextedException if no API key exists */
Returns a JSON string from the deep clean API
deepCleanInternal
{ "repo_name": "johnboyer/listwise-manager", "path": "listwise-manager/src/com/rodaxsoft/listwise/ListWiseManager.java", "license": "apache-2.0", "size": 5215 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.InputStreamReader", "java.net.URLConnection", "org.apache.commons.lang3.exception.ContextedException" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLConnection; import org.apache.commons.lang3.exception.ContextedException;
import java.io.*; import java.net.*; import org.apache.commons.lang3.exception.*;
[ "java.io", "java.net", "org.apache.commons" ]
java.io; java.net; org.apache.commons;
1,257,936