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 Composite getComposite() { return composite; }
Composite function() { return composite; }
/** * Returns the current composite. * * @return the current composite */
Returns the current composite
getComposite
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/gnu/java/awt/java2d/AbstractGraphics2D.java", "license": "gpl-2.0", "size": 64351 }
[ "java.awt.Composite" ]
import java.awt.Composite;
import java.awt.*;
[ "java.awt" ]
java.awt;
15,775
protected int getNavigationLeftKey() { return KeyCodes.KEY_LEFT; }
int function() { return KeyCodes.KEY_LEFT; }
/** * Get the key that moves the selection left. By default it is the left * arrow key but by overriding this you can change the key to whatever you * want. * * @return The keycode of the key */
Get the key that moves the selection left. By default it is the left arrow key but by overriding this you can change the key to whatever you want
getNavigationLeftKey
{ "repo_name": "mstahv/framework", "path": "client/src/main/java/com/vaadin/client/ui/VMenuBar.java", "license": "apache-2.0", "size": 62170 }
[ "com.google.gwt.event.dom.client.KeyCodes" ]
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.*;
[ "com.google.gwt" ]
com.google.gwt;
2,371,448
void setEnd(float end) { Trace.enter(this, "setEnd", new Object[] { new Float(end) } ); try { this.end = end; Iterator i = endDependents.iterator(); while (i.hasNext()) { InstanceTime it = (InstanceTime) i.next(); it.dependentUpdate(end); } } finally { Trace.exit(); } }
void setEnd(float end) { Trace.enter(this, STR, new Object[] { new Float(end) } ); try { this.end = end; Iterator i = endDependents.iterator(); while (i.hasNext()) { InstanceTime it = (InstanceTime) i.next(); it.dependentUpdate(end); } } finally { Trace.exit(); } }
/** * Updates the end time for this interval. */
Updates the end time for this interval
setEnd
{ "repo_name": "Uni-Sol/batik", "path": "sources/org/apache/batik/anim/timing/Interval.java", "license": "apache-2.0", "size": 5064 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,783,502
public static boolean saveSipConfiguration(Context ctxt, String filePassword) { File dir = PreferencesWrapper.getConfigFolder(ctxt); if (dir != null) { Date d = new Date(); File file = new File(dir.getAbsoluteFile() + File.separator + "backup_" + DateFormat.format("yy-MM-dd_kkmmss", d) + ".json"); Log.d(THIS_FILE, "Out dir " + file.getAbsolutePath()); JSONObject configChain = new JSONObject(); try { configChain.put(KEY_ACCOUNTS, serializeSipProfiles(ctxt)); } catch (JSONException e) { Log.e(THIS_FILE, "Impossible to add profiles", e); } try { configChain.put(KEY_SETTINGS, serializeSipSettings(ctxt)); } catch (JSONException e) { Log.e(THIS_FILE, "Impossible to add profiles", e); } try { // Create file OutputStream fos = new FileOutputStream(file); if(!TextUtils.isEmpty(filePassword)) { Cipher c; try { c = Cipher.getInstance("AES"); SecretKeySpec k = new SecretKeySpec(filePassword.getBytes(), "AES"); c.init(Cipher.ENCRYPT_MODE, k); fos = new CipherOutputStream(fos, c); } catch (NoSuchAlgorithmException e) { Log.e(THIS_FILE, "NoSuchAlgorithmException :: ", e); } catch (NoSuchPaddingException e) { Log.e(THIS_FILE, "NoSuchPaddingException :: ", e); } catch (InvalidKeyException e) { Log.e(THIS_FILE, "InvalidKeyException :: ", e); } } FileWriter fstream = new FileWriter(file.getAbsoluteFile()); BufferedWriter out = new BufferedWriter(fstream); out.write(configChain.toString(2)); // Close the output stream out.close(); return true; } catch (Exception e) { // Catch exception if any Log.e(THIS_FILE, "Impossible to save config to disk", e); return false; } } return false; }
static boolean function(Context ctxt, String filePassword) { File dir = PreferencesWrapper.getConfigFolder(ctxt); if (dir != null) { Date d = new Date(); File file = new File(dir.getAbsoluteFile() + File.separator + STR + DateFormat.format(STR, d) + ".json"); Log.d(THIS_FILE, STR + file.getAbsolutePath()); JSONObject configChain = new JSONObject(); try { configChain.put(KEY_ACCOUNTS, serializeSipProfiles(ctxt)); } catch (JSONException e) { Log.e(THIS_FILE, STR, e); } try { configChain.put(KEY_SETTINGS, serializeSipSettings(ctxt)); } catch (JSONException e) { Log.e(THIS_FILE, STR, e); } try { OutputStream fos = new FileOutputStream(file); if(!TextUtils.isEmpty(filePassword)) { Cipher c; try { c = Cipher.getInstance("AES"); SecretKeySpec k = new SecretKeySpec(filePassword.getBytes(), "AES"); c.init(Cipher.ENCRYPT_MODE, k); fos = new CipherOutputStream(fos, c); } catch (NoSuchAlgorithmException e) { Log.e(THIS_FILE, STR, e); } catch (NoSuchPaddingException e) { Log.e(THIS_FILE, STR, e); } catch (InvalidKeyException e) { Log.e(THIS_FILE, STR, e); } } FileWriter fstream = new FileWriter(file.getAbsoluteFile()); BufferedWriter out = new BufferedWriter(fstream); out.write(configChain.toString(2)); out.close(); return true; } catch (Exception e) { Log.e(THIS_FILE, STR, e); return false; } } return false; }
/** * Save current sip configuration * * @param ctxt * @return */
Save current sip configuration
saveSipConfiguration
{ "repo_name": "xiejianying/csipsimple", "path": "src/com/csipsimple/backup/SipProfileJson.java", "license": "lgpl-3.0", "size": 13508 }
[ "android.content.Context", "android.text.TextUtils", "android.text.format.DateFormat", "com.csipsimple.utils.Log", "com.csipsimple.utils.PreferencesWrapper", "java.io.BufferedWriter", "java.io.File", "java.io.FileOutputStream", "java.io.FileWriter", "java.io.OutputStream", "java.security.InvalidKeyException", "java.security.NoSuchAlgorithmException", "java.util.Date", "javax.crypto.Cipher", "javax.crypto.CipherOutputStream", "javax.crypto.NoSuchPaddingException", "javax.crypto.spec.SecretKeySpec", "org.json.JSONException", "org.json.JSONObject" ]
import android.content.Context; import android.text.TextUtils; import android.text.format.DateFormat; import com.csipsimple.utils.Log; import com.csipsimple.utils.PreferencesWrapper; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.OutputStream; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Date; import javax.crypto.Cipher; import javax.crypto.CipherOutputStream; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; import org.json.JSONException; import org.json.JSONObject;
import android.content.*; import android.text.*; import android.text.format.*; import com.csipsimple.utils.*; import java.io.*; import java.security.*; import java.util.*; import javax.crypto.*; import javax.crypto.spec.*; import org.json.*;
[ "android.content", "android.text", "com.csipsimple.utils", "java.io", "java.security", "java.util", "javax.crypto", "org.json" ]
android.content; android.text; com.csipsimple.utils; java.io; java.security; java.util; javax.crypto; org.json;
1,996,154
public List distinct( String key, ReadPreference readPrefs ){ return distinct( key , new BasicDBObject(), readPrefs ); }
List function( String key, ReadPreference readPrefs ){ return distinct( key , new BasicDBObject(), readPrefs ); }
/** * Find the distinct values for a specified field across a collection and returns the results in an array. * * @param key Specifies the field for which to return the distinct values * @param readPrefs {@link ReadPreference} to be used for this operation * @return A {@code List} of the distinct values * @throws MongoException * @mongodb.driver.manual reference/command/distinct Distinct Command */
Find the distinct values for a specified field across a collection and returns the results in an array
distinct
{ "repo_name": "antonnik/code-classifier", "path": "naive_bayes/resources/java/DBCollection.java", "license": "apache-2.0", "size": 88389 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
291,206
public int getViewHorizontalDragRange(View child) { return 0; }
int function(View child) { return 0; }
/** * Return the magnitude of a draggable child view's horizontal range of * motion in pixels. This method should return 0 for views that cannot * move horizontally. * * @param child Child view to check * @return range of horizontal motion in pixels */
Return the magnitude of a draggable child view's horizontal range of motion in pixels. This method should return 0 for views that cannot move horizontally
getViewHorizontalDragRange
{ "repo_name": "HarryXR/SimpleNews", "path": "swipeback/src/main/java/me/imid/swipebacklayout/lib/ViewDragHelper.java", "license": "apache-2.0", "size": 62159 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,828,343
public static Vector<Double> calculateArrowVector(double startX, double startY, double endX, double endY, double angle) { double arrowHeadLengh = 4; double dx = endX - startX; double dy = endY - startY; double length = Math.sqrt(dx * dx + dy * dy); double unitDx = dx / length; double unitDy = dy / length; double point1X = endX - unitDx * arrowHeadLengh - unitDy * arrowHeadLengh; double point1Y = endY - unitDy * arrowHeadLengh + unitDx * arrowHeadLengh; double point2X = endX - unitDx * arrowHeadLengh + unitDy * arrowHeadLengh; double point2Y = endY - unitDy * arrowHeadLengh - unitDx * arrowHeadLengh; Vector<Double> result = new Vector<>(); result.addElement(point1X); result.addElement(point1Y); result.addElement(point2X); result.addElement(point2Y); return result; }
static Vector<Double> function(double startX, double startY, double endX, double endY, double angle) { double arrowHeadLengh = 4; double dx = endX - startX; double dy = endY - startY; double length = Math.sqrt(dx * dx + dy * dy); double unitDx = dx / length; double unitDy = dy / length; double point1X = endX - unitDx * arrowHeadLengh - unitDy * arrowHeadLengh; double point1Y = endY - unitDy * arrowHeadLengh + unitDx * arrowHeadLengh; double point2X = endX - unitDx * arrowHeadLengh + unitDy * arrowHeadLengh; double point2Y = endY - unitDy * arrowHeadLengh - unitDx * arrowHeadLengh; Vector<Double> result = new Vector<>(); result.addElement(point1X); result.addElement(point1Y); result.addElement(point2X); result.addElement(point2Y); return result; }
/** * Calculates the arrow vector. The result can be read like 0=x1 1=y1 2=x2 * 3=y2. * * @param startX * @param startY * @param endX * @param endY * @param angle * @return */
Calculates the arrow vector. The result can be read like 0=x1 1=y1 2=x2 3=y2
calculateArrowVector
{ "repo_name": "MayerTh/RVRPSimulator", "path": "vrpsim-visualization/src/main/java/vrpsim/visualization/support/MathUtil.java", "license": "apache-2.0", "size": 1734 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
2,203,692
public void keyReleased(KeyEvent e) { selectInteractor(e); if (interactor != null) { interactor.keyReleased(e); deselectInteractor(); } else if (eventDispatcher != null) { dispatchKeyReleased(e); } }
void function(KeyEvent e) { selectInteractor(e); if (interactor != null) { interactor.keyReleased(e); deselectInteractor(); } else if (eventDispatcher != null) { dispatchKeyReleased(e); } }
/** * Invoked when a key has been released. */
Invoked when a key has been released
keyReleased
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/swing/gvt/AbstractJGVTComponent.java", "license": "apache-2.0", "size": 38043 }
[ "java.awt.event.KeyEvent" ]
import java.awt.event.KeyEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
850,077
public void setDebugOption(final boolean debug) { if (debug == _debug) { return; } if (_debug) { try { _logfile.close(); } catch (final IOException e) { System.out.println("Problem closing logfile."); e.printStackTrace(); System.out.println("Continueing the work"); } } else { try { _logfile = new FileWriter(_debugFileName); } catch (final IOException e) { System.out.println("Error creating file polygon_triangulation_log.txt, switchin debug off, continuing."); e.printStackTrace(); _debug = false; } } _debug = debug; }
void function(final boolean debug) { if (debug == _debug) { return; } if (_debug) { try { _logfile.close(); } catch (final IOException e) { System.out.println(STR); e.printStackTrace(); System.out.println(STR); } } else { try { _logfile = new FileWriter(_debugFileName); } catch (final IOException e) { System.out.println(STR); e.printStackTrace(); _debug = false; } } _debug = debug; }
/** * output file format; */
output file format
setDebugOption
{ "repo_name": "AeroGlass/g3m", "path": "tools/externals/poly2tri-java/poly2Tri/Polygon.java", "license": "bsd-2-clause", "size": 32367 }
[ "java.io.FileWriter", "java.io.IOException" ]
import java.io.FileWriter; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,683,386
@SuppressWarnings("unchecked") @Test public void testFailsIfdirectoryIsIllegal() throws Exception { // create context Context context = new ContextBase(); // create file File dir = new File(testDirectory, randomName+"\0"); File file = new File(dir, randomXmlFileName); // create document ObjectFactory factory = new ObjectFactory(); Root root = factory.createRoot(); root.setContainer(factory.createContainerType()); ItemType item1 = factory.createItemType(); item1.setName("item1"); ItemType item2 = factory.createItemType(); item2.setName("item2"); root.getContainer().getItems().add(item1); root.getContainer().getItems().add(item2); // setup context context.put(MarshallJAXBObjectsCommand.ROOT_KEY, root); context.put(MarshallJAXBObjectsCommand.FILE_KEY, file); context.put(MarshallJAXBObjectsCommand.EXECUTIONRESULT_KEY, executionResult); // test assertFalse(file.exists()); // execute command marshallJAXBObjectsCommand.execute(context); // test assertTrue(executionResult.isError()); assertFalse(executionResult.isExecuting()); }
@SuppressWarnings(STR) void function() throws Exception { Context context = new ContextBase(); File dir = new File(testDirectory, randomName+"\0"); File file = new File(dir, randomXmlFileName); ObjectFactory factory = new ObjectFactory(); Root root = factory.createRoot(); root.setContainer(factory.createContainerType()); ItemType item1 = factory.createItemType(); item1.setName("item1"); ItemType item2 = factory.createItemType(); item2.setName("item2"); root.getContainer().getItems().add(item1); root.getContainer().getItems().add(item2); context.put(MarshallJAXBObjectsCommand.ROOT_KEY, root); context.put(MarshallJAXBObjectsCommand.FILE_KEY, file); context.put(MarshallJAXBObjectsCommand.EXECUTIONRESULT_KEY, executionResult); assertFalse(file.exists()); marshallJAXBObjectsCommand.execute(context); assertTrue(executionResult.isError()); assertFalse(executionResult.isExecuting()); }
/** * Test that marshalling fails if directory is illegal. * It is illegal to use "\0" or "/" in directory names in Windows and Linux. * * @throws Exception * If test fails. */
Test that marshalling fails if directory is illegal. It is illegal to use "\0" or "/" in directory names in Windows and Linux
testFailsIfdirectoryIsIllegal
{ "repo_name": "athrane/pineapple", "path": "modules/pineapple-core/src/test/java/com/alpha/pineapple/command/MarshallJAXBObjectsCommandIntegrationTest.java", "license": "gpl-3.0", "size": 9333 }
[ "com.alpha.pineapple.model.test.ItemType", "com.alpha.pineapple.model.test.ObjectFactory", "com.alpha.pineapple.model.test.Root", "java.io.File", "org.apache.commons.chain.Context", "org.apache.commons.chain.impl.ContextBase", "org.junit.Assert" ]
import com.alpha.pineapple.model.test.ItemType; import com.alpha.pineapple.model.test.ObjectFactory; import com.alpha.pineapple.model.test.Root; import java.io.File; import org.apache.commons.chain.Context; import org.apache.commons.chain.impl.ContextBase; import org.junit.Assert;
import com.alpha.pineapple.model.test.*; import java.io.*; import org.apache.commons.chain.*; import org.apache.commons.chain.impl.*; import org.junit.*;
[ "com.alpha.pineapple", "java.io", "org.apache.commons", "org.junit" ]
com.alpha.pineapple; java.io; org.apache.commons; org.junit;
1,526,798
private ArrayWritable createMap(Object obj, CarbonColumn carbonColumn) throws IOException { Object[] objArray = (Object[]) obj; List<CarbonDimension> childCarbonDimensions = null; CarbonDimension mapDimension = null; List<ArrayWritable> writablesList = new ArrayList<>(); if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) { childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions(); // get the map dimension wrapped inside the carbon dimension mapDimension = childCarbonDimensions.get(0); // get the child dimenesions of the map dimensions, child dimensions are - Key and Value if (null != mapDimension) { childCarbonDimensions = mapDimension.getListOfChildDimensions(); } } if (null != childCarbonDimensions && childCarbonDimensions.size() == 2) { Object[] keyObjects = (Object[]) objArray[0]; Object[] valObjects = (Object[]) objArray[1]; for (int i = 0; i < keyObjects.length; i++) { Writable keyWritable = createWritableObject(keyObjects[i], childCarbonDimensions.get(0)); Writable valWritable = createWritableObject(valObjects[i], childCarbonDimensions.get(1)); Writable[] arr = new Writable[2]; arr[0] = keyWritable; arr[1] = valWritable; writablesList.add(new ArrayWritable(Writable.class, arr)); } if (writablesList.size() > 0) { final ArrayWritable subArray = new ArrayWritable(ArrayWritable.class, writablesList.toArray(new ArrayWritable[writablesList.size()])); return new ArrayWritable(Writable.class, new Writable[] {subArray}); } } return null; }
ArrayWritable function(Object obj, CarbonColumn carbonColumn) throws IOException { Object[] objArray = (Object[]) obj; List<CarbonDimension> childCarbonDimensions = null; CarbonDimension mapDimension = null; List<ArrayWritable> writablesList = new ArrayList<>(); if (carbonColumn.isDimension() && carbonColumn.getColumnSchema().getNumberOfChild() > 0) { childCarbonDimensions = ((CarbonDimension) carbonColumn).getListOfChildDimensions(); mapDimension = childCarbonDimensions.get(0); if (null != mapDimension) { childCarbonDimensions = mapDimension.getListOfChildDimensions(); } } if (null != childCarbonDimensions && childCarbonDimensions.size() == 2) { Object[] keyObjects = (Object[]) objArray[0]; Object[] valObjects = (Object[]) objArray[1]; for (int i = 0; i < keyObjects.length; i++) { Writable keyWritable = createWritableObject(keyObjects[i], childCarbonDimensions.get(0)); Writable valWritable = createWritableObject(valObjects[i], childCarbonDimensions.get(1)); Writable[] arr = new Writable[2]; arr[0] = keyWritable; arr[1] = valWritable; writablesList.add(new ArrayWritable(Writable.class, arr)); } if (writablesList.size() > 0) { final ArrayWritable subArray = new ArrayWritable(ArrayWritable.class, writablesList.toArray(new ArrayWritable[writablesList.size()])); return new ArrayWritable(Writable.class, new Writable[] {subArray}); } } return null; }
/** * Create the Map data for Map Datatype * * @param obj * @param carbonColumn * @return * @throws IOException */
Create the Map data for Map Datatype
createMap
{ "repo_name": "jackylk/incubator-carbondata", "path": "integration/hive/src/main/java/org/apache/carbondata/hive/WritableReadSupport.java", "license": "apache-2.0", "size": 9559 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn", "org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension", "org.apache.hadoop.io.ArrayWritable", "org.apache.hadoop.io.Writable" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.metadata.schema.table.column.CarbonColumn; import org.apache.carbondata.core.metadata.schema.table.column.CarbonDimension; import org.apache.hadoop.io.ArrayWritable; import org.apache.hadoop.io.Writable;
import java.io.*; import java.util.*; import org.apache.carbondata.core.metadata.schema.table.column.*; import org.apache.hadoop.io.*;
[ "java.io", "java.util", "org.apache.carbondata", "org.apache.hadoop" ]
java.io; java.util; org.apache.carbondata; org.apache.hadoop;
1,902,002
public List<Object> setAttributeValues(String name, List<Object> values);
List<Object> function(String name, List<Object> values);
/** * Sets the specified attribute values * * @param name Name of the attribute, must not be null * @param values Values for the attribute, may be null * @return The previous values for the attribute if they existed */
Sets the specified attribute values
setAttributeValues
{ "repo_name": "jco0186/person-directory-impl", "path": "src/main/java/org/jasig/services/persondir/support/IAdditionalDescriptors.java", "license": "apache-2.0", "size": 2199 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,552,849
private void CVClusters() throws Exception { double CVLogLikely = -Double.MAX_VALUE; double templl, tll; boolean CVincreased = true; m_num_clusters = 1; int upperBoundMaxClusters = (m_upperBoundNumClustersCV > 0) ? m_upperBoundNumClustersCV : Integer.MAX_VALUE; int num_clusters = m_num_clusters; int i; Random cvr; Instances trainCopy; int numFolds = (m_theInstances.numInstances() < m_cvFolds) ? m_theInstances .numInstances() : m_cvFolds; boolean ok = true; int seed = getSeed(); int restartCount = 0; CLUSTER_SEARCH: while (CVincreased) { if (num_clusters > upperBoundMaxClusters) { break CLUSTER_SEARCH; } // theInstances.stratify(10); CVincreased = false; cvr = new Random(getSeed()); trainCopy = new Instances(m_theInstances); trainCopy.randomize(cvr); templl = 0.0; for (i = 0; i < numFolds; i++) { Instances cvTrain = trainCopy.trainCV(numFolds, i, cvr); if (num_clusters > cvTrain.numInstances()) { break CLUSTER_SEARCH; } Instances cvTest = trainCopy.testCV(numFolds, i); m_rr = new Random(seed); for (int z = 0; z < 10; z++) { m_rr.nextDouble(); } m_num_clusters = num_clusters; EM_Init(cvTrain); try { iterate(cvTrain, false); } catch (Exception ex) { // catch any problems - i.e. empty clusters occurring ex.printStackTrace(); // System.err.println("Restarting after CV training failure ("+num_clusters+" clusters"); seed++; restartCount++; ok = false; if (restartCount > 5) { break CLUSTER_SEARCH; } break; } try { tll = E(cvTest, false); } catch (Exception ex) { // catch any problems - i.e. empty clusters occurring // ex.printStackTrace(); ex.printStackTrace(); // System.err.println("Restarting after CV testing failure ("+num_clusters+" clusters"); // throw new Exception(ex); seed++; restartCount++; ok = false; if (restartCount > 5) { break CLUSTER_SEARCH; } break; } if (m_verbose) { System.out.println("# clust: " + num_clusters + " Fold: " + i + " Loglikely: " + tll); } templl += tll; } if (ok) { restartCount = 0; seed = getSeed(); templl /= numFolds; if (m_verbose) { System.out.println("===================================" + "==============\n# clust: " + num_clusters + " Mean Loglikely: " + templl + "\n================================" + "================="); } // if (templl > CVLogLikely) { if (templl - CVLogLikely > m_minLogLikelihoodImprovementCV) { CVLogLikely = templl; CVincreased = true; num_clusters++; } } } if (m_verbose) { System.out.println("Number of clusters: " + (num_clusters - 1)); } m_num_clusters = num_clusters - 1; }
void function() throws Exception { double CVLogLikely = -Double.MAX_VALUE; double templl, tll; boolean CVincreased = true; m_num_clusters = 1; int upperBoundMaxClusters = (m_upperBoundNumClustersCV > 0) ? m_upperBoundNumClustersCV : Integer.MAX_VALUE; int num_clusters = m_num_clusters; int i; Random cvr; Instances trainCopy; int numFolds = (m_theInstances.numInstances() < m_cvFolds) ? m_theInstances .numInstances() : m_cvFolds; boolean ok = true; int seed = getSeed(); int restartCount = 0; CLUSTER_SEARCH: while (CVincreased) { if (num_clusters > upperBoundMaxClusters) { break CLUSTER_SEARCH; } CVincreased = false; cvr = new Random(getSeed()); trainCopy = new Instances(m_theInstances); trainCopy.randomize(cvr); templl = 0.0; for (i = 0; i < numFolds; i++) { Instances cvTrain = trainCopy.trainCV(numFolds, i, cvr); if (num_clusters > cvTrain.numInstances()) { break CLUSTER_SEARCH; } Instances cvTest = trainCopy.testCV(numFolds, i); m_rr = new Random(seed); for (int z = 0; z < 10; z++) { m_rr.nextDouble(); } m_num_clusters = num_clusters; EM_Init(cvTrain); try { iterate(cvTrain, false); } catch (Exception ex) { ex.printStackTrace(); seed++; restartCount++; ok = false; if (restartCount > 5) { break CLUSTER_SEARCH; } break; } try { tll = E(cvTest, false); } catch (Exception ex) { ex.printStackTrace(); seed++; restartCount++; ok = false; if (restartCount > 5) { break CLUSTER_SEARCH; } break; } if (m_verbose) { System.out.println(STR + num_clusters + STR + i + STR + tll); } templl += tll; } if (ok) { restartCount = 0; seed = getSeed(); templl /= numFolds; if (m_verbose) { System.out.println(STR + STR + num_clusters + STR + templl + STR + STR); } if (templl - CVLogLikely > m_minLogLikelihoodImprovementCV) { CVLogLikely = templl; CVincreased = true; num_clusters++; } } } if (m_verbose) { System.out.println(STR + (num_clusters - 1)); } m_num_clusters = num_clusters - 1; }
/** * estimate the number of clusters by cross validation on the training data. * * @throws Exception if something goes wrong */
estimate the number of clusters by cross validation on the training data
CVClusters
{ "repo_name": "runqingz/umple", "path": "Umplificator/UmplifiedProjects/weka-umplified-0/src/main/java/weka/clusterers/EM.java", "license": "mit", "size": 59390 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
191,716
LeaderRetrievalService getResourceManagerLeaderRetriever();
LeaderRetrievalService getResourceManagerLeaderRetriever();
/** * Gets the leader retriever for the cluster's resource manager. */
Gets the leader retriever for the cluster's resource manager
getResourceManagerLeaderRetriever
{ "repo_name": "hwstreaming/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/highavailability/HighAvailabilityServices.java", "license": "apache-2.0", "size": 5920 }
[ "org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService" ]
import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService;
import org.apache.flink.runtime.leaderretrieval.*;
[ "org.apache.flink" ]
org.apache.flink;
2,074,949
public static String getElementLabel(IJavaElement element, long flags) { return getElementLabel(element, flags, false); }
static String function(IJavaElement element, long flags) { return getElementLabel(element, flags, false); }
/** * Returns the label for a Java element with the flags as defined by {@link JavaElementLabels}. * Referenced element names in the label (except the given element's name) are rendered as * header links. * * @param element the element to render * @param flags the rendering flags * @return the label of the Java element * @since 3.5 */
Returns the label for a Java element with the flags as defined by <code>JavaElementLabels</code>. Referenced element names in the label (except the given element's name) are rendered as header links
getElementLabel
{ "repo_name": "sunix/che-plugins", "path": "plugin-java/che-plugin-java-ext-java-codeassistant/src/main/java/org/eclipse/che/jdt/javadoc/JavaElementLinks.java", "license": "epl-1.0", "size": 18805 }
[ "org.eclipse.jdt.core.IJavaElement" ]
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
321,972
public static KeyPair generateKeyPair(String algorithm, int keySize) { KeyPairGenerator keyPairGenerator; try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } keyPairGenerator.initialize(keySize); return keyPairGenerator.generateKeyPair(); }
static KeyPair function(String algorithm, int keySize) { KeyPairGenerator keyPairGenerator; try { keyPairGenerator = KeyPairGenerator.getInstance(algorithm); } catch (NoSuchAlgorithmException e) { throw new IllegalArgumentException(e); } keyPairGenerator.initialize(keySize); return keyPairGenerator.generateKeyPair(); }
/** * Generate a {@link KeyPair} for the given assymmetric algorithm and keysize * * Example: CipherUtils.generateKeyPair("RSA", 2048) */
Generate a <code>KeyPair</code> for the given assymmetric algorithm and keysize Example: CipherUtils.generateKeyPair("RSA", 2048)
generateKeyPair
{ "repo_name": "openengsb/openengsb", "path": "components/util/src/main/java/org/openengsb/core/util/CipherUtils.java", "license": "apache-2.0", "size": 10081 }
[ "java.security.KeyPair", "java.security.KeyPairGenerator", "java.security.NoSuchAlgorithmException" ]
import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.NoSuchAlgorithmException;
import java.security.*;
[ "java.security" ]
java.security;
1,938,118
void setDataElementStructureForDataElementGroup( Grid grid, Integer dataElementGroupId, List<Integer> metaIds );
void setDataElementStructureForDataElementGroup( Grid grid, Integer dataElementGroupId, List<Integer> metaIds );
/** * Always called first. * * Sets the structure in DataBrowserTable for DataElements. Finds all * DataElementGroups with DataValue in betweenPeriod List and given * DataElementGroupId. Then calls on helpers internally to set it up. * * @param grid the Grid to set the structure in * @param dataElementGroupId the DataElementGroup id * @param metaIds list of MetaValue ids */
Always called first. Sets the structure in DataBrowserTable for DataElements. Finds all DataElementGroups with DataValue in betweenPeriod List and given DataElementGroupId. Then calls on helpers internally to set it up
setDataElementStructureForDataElementGroup
{ "repo_name": "minagri-rwanda/DHIS2-Agriculture", "path": "dhis-api/src/main/java/org/hisp/dhis/databrowser/DataBrowserGridStore.java", "license": "bsd-3-clause", "size": 9693 }
[ "java.util.List", "org.hisp.dhis.common.Grid" ]
import java.util.List; import org.hisp.dhis.common.Grid;
import java.util.*; import org.hisp.dhis.common.*;
[ "java.util", "org.hisp.dhis" ]
java.util; org.hisp.dhis;
993,426
public boolean loadScript(String filename) throws FileNotFoundException { String newCode = FileIO.fileToString(filename); if (newCode != null && !newCode.isEmpty()) { log.info(String.format("replacing current script with %1s", filename)); currentScript = new Script(filename, newCode); // tell other listeners we have changed // our current script broadcastState(); return true; } else { log.warn(String.format("%1s a not valid script", filename)); return false; } }
boolean function(String filename) throws FileNotFoundException { String newCode = FileIO.fileToString(filename); if (newCode != null && !newCode.isEmpty()) { log.info(String.format(STR, filename)); currentScript = new Script(filename, newCode); broadcastState(); return true; } else { log.warn(String.format(STR, filename)); return false; } }
/** * this method can be used to load a Python script from the Python's local * file system, which may not be the GUIService's local system. Because it * can be done programatically on a different machine we want to broadcast * our changed state to other listeners (possibly the GUIService) * * @param filename * - name of file to load * @return - success if loaded * @throws FileNotFoundException */
this method can be used to load a Python script from the Python's local file system, which may not be the GUIService's local system. Because it can be done programatically on a different machine we want to broadcast our changed state to other listeners (possibly the GUIService)
loadScript
{ "repo_name": "sujitbehera27/MyRoboticsProjects-Arduino", "path": "src/org/myrobotlab/service/Python.java", "license": "apache-2.0", "size": 21572 }
[ "java.io.FileNotFoundException", "org.myrobotlab.fileLib.FileIO" ]
import java.io.FileNotFoundException; import org.myrobotlab.fileLib.FileIO;
import java.io.*; import org.myrobotlab.*;
[ "java.io", "org.myrobotlab" ]
java.io; org.myrobotlab;
1,454,545
public static void downloadFeedItems(final Context context, FeedItem... items) throws DownloadRequestException { downloadFeedItems(true, context, items); }
static void function(final Context context, FeedItem... items) throws DownloadRequestException { downloadFeedItems(true, context, items); }
/** * Requests the download of a list of FeedItem objects. * * @param context Used for requesting the download and accessing the DB. * @param items The FeedItem objects. */
Requests the download of a list of FeedItem objects
downloadFeedItems
{ "repo_name": "udif/AntennaPod", "path": "core/src/main/java/de/danoeh/antennapod/core/storage/DBTasks.java", "license": "mit", "size": 34451 }
[ "android.content.Context", "de.danoeh.antennapod.core.feed.FeedItem" ]
import android.content.Context; import de.danoeh.antennapod.core.feed.FeedItem;
import android.content.*; import de.danoeh.antennapod.core.feed.*;
[ "android.content", "de.danoeh.antennapod" ]
android.content; de.danoeh.antennapod;
1,418,221
public static final Column getColumn(Class type, int nrows, int nnz, Object defaultValue) { if ( type == byte.class ) { if ( defaultValue == null ) { return new ByteColumn(nrows); } else { byte def = ((Number)defaultValue).byteValue(); return new ByteColumn(nrows, nrows, def); } } if ( type == int.class ) { if ( defaultValue == null ) { return new IntColumn(nrows); } else { int def = ((Number)defaultValue).intValue(); return new IntColumn(nrows, nrows, def); } } else if ( type == long.class ) { if ( defaultValue == null ) { return new LongColumn(nrows); } else { long def = ((Number)defaultValue).longValue(); return new LongColumn(nrows, nrows, def); } } else if ( type == float.class ) { if ( defaultValue == null ) { return new FloatColumn(nrows); } else { float def = ((Number)defaultValue).floatValue(); return new FloatColumn(nrows, nrows, def); } } else if ( type == double.class ) { if ( defaultValue == null ) { return new DoubleColumn(nrows); } else { double def = ((Number)defaultValue).doubleValue(); return new DoubleColumn(nrows, nrows, def); } } else if ( type == boolean.class ) { if ( defaultValue == null ) { return new BooleanColumn(nrows); } else { boolean def = ((Boolean)defaultValue).booleanValue(); return new BooleanColumn(nrows, nrows, def); } } else if ( Date.class.isAssignableFrom(type) ) { if ( defaultValue == null ) { return new DateColumn(type, nrows); } else { Date d = ((Date)defaultValue); return new DateColumn(type, nrows, nrows, d.getTime()); } } else if ( type == byte.class || type == short.class || type == char.class || type == void.class ) { throw new DataTypeException(type); } else { return new ObjectColumn(type, nrows, nrows, defaultValue); } }
static final Column function(Class type, int nrows, int nnz, Object defaultValue) { if ( type == byte.class ) { if ( defaultValue == null ) { return new ByteColumn(nrows); } else { byte def = ((Number)defaultValue).byteValue(); return new ByteColumn(nrows, nrows, def); } } if ( type == int.class ) { if ( defaultValue == null ) { return new IntColumn(nrows); } else { int def = ((Number)defaultValue).intValue(); return new IntColumn(nrows, nrows, def); } } else if ( type == long.class ) { if ( defaultValue == null ) { return new LongColumn(nrows); } else { long def = ((Number)defaultValue).longValue(); return new LongColumn(nrows, nrows, def); } } else if ( type == float.class ) { if ( defaultValue == null ) { return new FloatColumn(nrows); } else { float def = ((Number)defaultValue).floatValue(); return new FloatColumn(nrows, nrows, def); } } else if ( type == double.class ) { if ( defaultValue == null ) { return new DoubleColumn(nrows); } else { double def = ((Number)defaultValue).doubleValue(); return new DoubleColumn(nrows, nrows, def); } } else if ( type == boolean.class ) { if ( defaultValue == null ) { return new BooleanColumn(nrows); } else { boolean def = ((Boolean)defaultValue).booleanValue(); return new BooleanColumn(nrows, nrows, def); } } else if ( Date.class.isAssignableFrom(type) ) { if ( defaultValue == null ) { return new DateColumn(type, nrows); } else { Date d = ((Date)defaultValue); return new DateColumn(type, nrows, nrows, d.getTime()); } } else if ( type == byte.class type == short.class type == char.class type == void.class ) { throw new DataTypeException(type); } else { return new ObjectColumn(type, nrows, nrows, defaultValue); } }
/** * Get a new column of the given type. * @param type the column data type * @param nrows the number of rows to include in the column * @param nnz the number of expected non-zero entries (NOTE: currently * this value is not being used) * @param defaultValue the default value for the column * @return the new column */
Get a new column of the given type
getColumn
{ "repo_name": "ezegarra/microbrowser", "path": "src/prefuse/data/column/ColumnFactory.java", "license": "bsd-3-clause", "size": 5108 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,807,281
void delete(String resourceGroupName, String dnsForwardingRulesetName, String ifMatch, Context context);
void delete(String resourceGroupName, String dnsForwardingRulesetName, String ifMatch, Context context);
/** * Deletes a DNS forwarding ruleset. WARNING: This operation cannot be undone. All forwarding rules within the * ruleset will be deleted. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param dnsForwardingRulesetName The name of the DNS forwarding ruleset. * @param ifMatch ETag of the resource. Omit this value to always overwrite the current resource. Specify the * last-seen ETag value to prevent accidentally overwriting any concurrent changes. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */
ruleset will be deleted
delete
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/dnsresolver/azure-resourcemanager-dnsresolver/src/main/java/com/azure/resourcemanager/dnsresolver/models/DnsForwardingRulesets.java", "license": "mit", "size": 12362 }
[ "com.azure.core.util.Context" ]
import com.azure.core.util.Context;
import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,797,134
public void initListCacheAndSharedPreferences(Context context) { if (mCache == null || mCache.isEmpty()) { //Load up the ZipCode Cache with the Shared preferences values SharedPreferences weatherAppPref = context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE); HashSet<String> defaultZipcodeSet = new HashSet<>(Arrays.asList(DEFAULT_ZIPCODES)); //Shared preferences has not yet been add up if (!weatherAppPref.contains(ZIPCODE_CACHE_KEY)) { //update the cache and then update the shared preferences mCache = defaultZipcodeSet; updateSortedList(); updateCacheInDB(context); } else { //otherwise, just get the cache from the Shared preferences mCache = (HashSet<String>) weatherAppPref.getStringSet(ZIPCODE_CACHE_KEY, defaultZipcodeSet); updateSortedList(); } } }
void function(Context context) { if (mCache == null mCache.isEmpty()) { SharedPreferences weatherAppPref = context.getSharedPreferences(APP_NAME, Context.MODE_PRIVATE); HashSet<String> defaultZipcodeSet = new HashSet<>(Arrays.asList(DEFAULT_ZIPCODES)); if (!weatherAppPref.contains(ZIPCODE_CACHE_KEY)) { mCache = defaultZipcodeSet; updateSortedList(); updateCacheInDB(context); } else { mCache = (HashSet<String>) weatherAppPref.getStringSet(ZIPCODE_CACHE_KEY, defaultZipcodeSet); updateSortedList(); } } }
/** * We store the list items in the sharedPreferences * (only keeping zipcode strings for now so SqliteDatabase is unnecessary overhead) * <p> * Update in memory list cache with the current sharedPreferences * and the shared preferences with the appropriate default data as needed */
We store the list items in the sharedPreferences (only keeping zipcode strings for now so SqliteDatabase is unnecessary overhead) Update in memory list cache with the current sharedPreferences and the shared preferences with the appropriate default data as needed
initListCacheAndSharedPreferences
{ "repo_name": "laurenyew/WeatherApp", "path": "app/src/main/java/laurenyew/weatherapp/cache/ZipcodeCache.java", "license": "mit", "size": 6884 }
[ "android.content.Context", "android.content.SharedPreferences", "java.util.Arrays", "java.util.HashSet" ]
import android.content.Context; import android.content.SharedPreferences; import java.util.Arrays; import java.util.HashSet;
import android.content.*; import java.util.*;
[ "android.content", "java.util" ]
android.content; java.util;
2,819,778
public static byte[] readFile(File file) throws IOException { assert file.exists(); assert file.length() < Integer.MAX_VALUE; byte[] bytes = new byte[(int) file.length()]; try (FileInputStream fis = new FileInputStream(file)) { int readBytesCnt = fis.read(bytes); assert readBytesCnt == bytes.length; } return bytes; }
static byte[] function(File file) throws IOException { assert file.exists(); assert file.length() < Integer.MAX_VALUE; byte[] bytes = new byte[(int) file.length()]; try (FileInputStream fis = new FileInputStream(file)) { int readBytesCnt = fis.read(bytes); assert readBytesCnt == bytes.length; } return bytes; }
/** * Reads entire file into byte array. * * @param file File to read. * @return Content of file in byte array. * @throws IOException If failed. */
Reads entire file into byte array
readFile
{ "repo_name": "samaitra/ignite", "path": "modules/core/src/test/java/org/apache/ignite/testframework/GridTestUtils.java", "license": "apache-2.0", "size": 82485 }
[ "java.io.File", "java.io.FileInputStream", "java.io.IOException" ]
import java.io.File; import java.io.FileInputStream; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,069,272
public void startExecuting() { this.taskOwner.setAttackTarget(this.theTarget); EntityLivingBase entitylivingbase = this.theEntityTameable.getOwnerEntity(); if (entitylivingbase != null) { this.lastAttackerTime = entitylivingbase.getLastAttackerTime(); } super.startExecuting(); }
void function() { this.taskOwner.setAttackTarget(this.theTarget); EntityLivingBase entitylivingbase = this.theEntityTameable.getOwnerEntity(); if (entitylivingbase != null) { this.lastAttackerTime = entitylivingbase.getLastAttackerTime(); } super.startExecuting(); }
/** * Execute a one shot task or start executing a continuous task */
Execute a one shot task or start executing a continuous task
startExecuting
{ "repo_name": "SolarCactus/ARKCraft-Code", "path": "src/main/java/com/arkcraft/module/creature/common/entity/ai/EntityDinoAIOwnerHurtTarget.java", "license": "mit", "size": 1856 }
[ "net.minecraft.entity.EntityLivingBase" ]
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
669,473
private void unregister(final ServiceReference reference, final Object service) { final String name = idToNameMap.remove(reference.getProperty(Constants.SERVICE_ID)); if ( name != null ) { this.scheduler.unschedule(reference.getBundle().getBundleId(), name); } }
void function(final ServiceReference reference, final Object service) { final String name = idToNameMap.remove(reference.getProperty(Constants.SERVICE_ID)); if ( name != null ) { this.scheduler.unschedule(reference.getBundle().getBundleId(), name); } }
/** * Unregister a service. * @param ref The service reference. */
Unregister a service
unregister
{ "repo_name": "plutext/sling", "path": "bundles/commons/scheduler/src/main/java/org/apache/sling/commons/scheduler/impl/WhiteboardHandler.java", "license": "apache-2.0", "size": 9699 }
[ "org.osgi.framework.Constants", "org.osgi.framework.ServiceReference" ]
import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference;
import org.osgi.framework.*;
[ "org.osgi.framework" ]
org.osgi.framework;
1,469,167
@Override public void activateParameters() { String[] keys = listParameters(); for ( String key : keys ) { String value; try { value = getParameterValue( key ); } catch ( UnknownParamException e ) { value = ""; } String defValue; try { defValue = getParameterDefault( key ); } catch ( UnknownParamException e ) { defValue = ""; } if ( Utils.isEmpty( value ) ) { setVariable( key, Const.NVL( defValue, "" ) ); } else { setVariable( key, Const.NVL( value, "" ) ); } } }
void function() { String[] keys = listParameters(); for ( String key : keys ) { String value; try { value = getParameterValue( key ); } catch ( UnknownParamException e ) { value = STRSTRSTR" ) ); } } }
/** * Activates all parameters by setting their values. If no values already exist, the method will attempt to set the * parameter to the default value. If no default value exists, the method will set the value of the parameter to the * empty string (""). * * @see org.pentaho.di.core.parameters.NamedParams#activateParameters() */
Activates all parameters by setting their values. If no values already exist, the method will attempt to set the parameter to the default value. If no default value exists, the method will set the value of the parameter to the empty string ("")
activateParameters
{ "repo_name": "bmorrise/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/Trans.java", "license": "apache-2.0", "size": 199512 }
[ "org.pentaho.di.core.parameters.UnknownParamException" ]
import org.pentaho.di.core.parameters.UnknownParamException;
import org.pentaho.di.core.parameters.*;
[ "org.pentaho.di" ]
org.pentaho.di;
667,225
public PagedResult<SentCampaign> sentCampaigns( Date sentFromDate, Date sentToDate, String tags, Integer page, Integer pageSize, String orderDirection) throws CreateSendException { return sentCampaigns( sentFromDate != null ? JsonProvider.ApiDateFormat.format(sentFromDate) : null, sentToDate != null ? JsonProvider.ApiDateFormat.format(sentToDate) : null, tags, page, pageSize, orderDirection); }
PagedResult<SentCampaign> function( Date sentFromDate, Date sentToDate, String tags, Integer page, Integer pageSize, String orderDirection) throws CreateSendException { return sentCampaigns( sentFromDate != null ? JsonProvider.ApiDateFormat.format(sentFromDate) : null, sentToDate != null ? JsonProvider.ApiDateFormat.format(sentToDate) : null, tags, page, pageSize, orderDirection); }
/** * Gets a paged list of campaigns sent by the current client * @param sentFromDate Campaigns sent on or after the <code>sentFromDate/code> value specified will be returned. * Must be in the format YYYY-MM-DD. If not provided, results will go back to the beginning of the client’s history. * Use <code>null</code> for the default * @param sentToDate Campaigns sent on or before the <code>sentToDate/code> value specified will be returned. * Must be in the format YYYY-MM-DD. If not provided, results will include the most recent sent campaigns. * Use <code>null</code> for the default * @param tags An array of tags to filter sent campaigns. * Sent campaigns with all the tags specified will be returned. * Use <code>null</code> for the default * @param page The page number of results to get. Use <code>null</code> for the default (page=1) * @param pageSize The number of records to get on the current page. * The value can be between 1 and 1000. * Use <code>null</code> for the default. * @param orderDirection The direction to order results by. * The value can be ASC or DESC * Use <code>null</code> for the default (DESC) * @return The paged campaigns returned by the api call * @throws CreateSendException Thrown when the API responds with a HTTP Status >= 400 * @see <a href="http://www.campaignmonitor.com/api/clients/#getting_client_campaigns" target="_blank"> * Getting sent campaigns</a> */
Gets a paged list of campaigns sent by the current client
sentCampaigns
{ "repo_name": "campaignmonitor/createsend-java", "path": "src/com/createsend/Clients.java", "license": "mit", "size": 20122 }
[ "com.createsend.models.PagedResult", "com.createsend.models.campaigns.SentCampaign", "com.createsend.util.exceptions.CreateSendException", "com.createsend.util.jersey.JsonProvider", "java.util.Date" ]
import com.createsend.models.PagedResult; import com.createsend.models.campaigns.SentCampaign; import com.createsend.util.exceptions.CreateSendException; import com.createsend.util.jersey.JsonProvider; import java.util.Date;
import com.createsend.models.*; import com.createsend.models.campaigns.*; import com.createsend.util.exceptions.*; import com.createsend.util.jersey.*; import java.util.*;
[ "com.createsend.models", "com.createsend.util", "java.util" ]
com.createsend.models; com.createsend.util; java.util;
1,041,675
private RemoveNetworkCmd executeRemoveNetworkRequest(DockerClient client, Message message) { LOGGER.debug("Executing Docker Network Remove Request"); String networkId = DockerHelper.getProperty(DockerConstants.DOCKER_NETWORK, configuration, message, String.class); ObjectHelper.notNull(networkId, "Network ID must be specified"); RemoveNetworkCmd removeNetworkCmd = client.removeNetworkCmd(networkId); return removeNetworkCmd; }
RemoveNetworkCmd function(DockerClient client, Message message) { LOGGER.debug(STR); String networkId = DockerHelper.getProperty(DockerConstants.DOCKER_NETWORK, configuration, message, String.class); ObjectHelper.notNull(networkId, STR); RemoveNetworkCmd removeNetworkCmd = client.removeNetworkCmd(networkId); return removeNetworkCmd; }
/** * Produces a network remove request * * @param client * @param message * @return */
Produces a network remove request
executeRemoveNetworkRequest
{ "repo_name": "objectiser/camel", "path": "components/camel-docker/src/main/java/org/apache/camel/component/docker/producer/DockerProducer.java", "license": "apache-2.0", "size": 41056 }
[ "com.github.dockerjava.api.DockerClient", "com.github.dockerjava.api.command.RemoveNetworkCmd", "org.apache.camel.Message", "org.apache.camel.component.docker.DockerConstants", "org.apache.camel.component.docker.DockerHelper", "org.apache.camel.util.ObjectHelper" ]
import com.github.dockerjava.api.DockerClient; import com.github.dockerjava.api.command.RemoveNetworkCmd; import org.apache.camel.Message; import org.apache.camel.component.docker.DockerConstants; import org.apache.camel.component.docker.DockerHelper; import org.apache.camel.util.ObjectHelper;
import com.github.dockerjava.api.*; import com.github.dockerjava.api.command.*; import org.apache.camel.*; import org.apache.camel.component.docker.*; import org.apache.camel.util.*;
[ "com.github.dockerjava", "org.apache.camel" ]
com.github.dockerjava; org.apache.camel;
2,841,640
@Override public void accept(SocketChannel sc) { String cid = "" + port_props.get("local-hostname") + "@" + port_props.get("remote-hostname"); if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, "Accept called for service: {0}", cid); } IO serv = getXMPPIOServiceInstance(); serv.setIOServiceListener(ConnectionManager.this); serv.setSessionData(port_props); try { serv.accept(sc); if (getSocketType() == SocketType.ssl) { serv.startSSL(false); } // end of if (socket == SocketType.ssl) serviceStarted(serv); SocketThread.addSocketService(serv); } catch (SocketException e) { if (getConnectionType() == ConnectionType.connect) { // Accept side for component service is not ready yet? // Let's wait for a few secs and try again. if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, "Problem reconnecting the service: {0}, cid: {1}", new Object[] { serv, cid }); } boolean reconnect = false; Integer reconnects = (Integer) port_props.get(MAX_RECONNECTS_PROP_KEY); if (reconnects != null) { int recon = reconnects.intValue(); if (recon != 0) { port_props.put(MAX_RECONNECTS_PROP_KEY, (--recon)); reconnect = true; } // end of if (recon != 0) } if (reconnect) { reconnectService(port_props, connectionDelay); } else { reconnectionFailed(port_props); } } else { // Ignore } } catch (Exception e) { if (log.isLoggable(Level.FINEST)) { log.log(Level.FINEST, "Can not accept connection cid: " + cid, e); } log.log(Level.WARNING, "Can not accept connection.", e); serv.stop(); } // end of try-catch }
void function(SocketChannel sc) { String cid = STRlocal-hostnameSTR@STRremote-hostnameSTRAccept called for service: {0}STRProblem reconnecting the service: {0}, cid: {1}STRCan not accept connection cid: STRCan not accept connection.", e); serv.stop(); } }
/** * Method description * * * @param sc */
Method description
accept
{ "repo_name": "Smartupz/tigase-server", "path": "src/main/java/tigase/server/ConnectionManager.java", "license": "agpl-3.0", "size": 35213 }
[ "java.nio.channels.SocketChannel" ]
import java.nio.channels.SocketChannel;
import java.nio.channels.*;
[ "java.nio" ]
java.nio;
416,794
int getFlowsNumber(Node node);
int getFlowsNumber(Node node);
/** * Returns the number of flows installed on the switch in the current * container context If the context is the default container, the returned * value is the number of all the flows installed on the switch regardless * of the container they belong to * * @param node * @return number of flows on specified node or (-1) if node was not found */
Returns the number of flows installed on the switch in the current container context If the context is the default container, the returned value is the number of all the flows installed on the switch regardless of the container they belong to
getFlowsNumber
{ "repo_name": "lbchen/ODL", "path": "opendaylight/statisticsmanager/api/src/main/java/org/opendaylight/controller/statisticsmanager/IStatisticsManager.java", "license": "epl-1.0", "size": 3923 }
[ "org.opendaylight.controller.sal.core.Node" ]
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.controller.sal.core.*;
[ "org.opendaylight.controller" ]
org.opendaylight.controller;
1,987,400
public List<String> getHashSetNames() { return Collections.unmodifiableList(hashSetNames); }
List<String> function() { return Collections.unmodifiableList(hashSetNames); }
/** * Get the hash set names for this file * * @return The hash set names that matched this file. */
Get the hash set names for this file
getHashSetNames
{ "repo_name": "eugene7646/autopsy", "path": "Core/src/org/sleuthkit/autopsy/discovery/search/ResultFile.java", "license": "apache-2.0", "size": 13383 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,594,410
@Override public void enterCharacterLiteral(@NotNull BramsprParser.CharacterLiteralContext ctx) { }
@Override public void enterCharacterLiteral(@NotNull BramsprParser.CharacterLiteralContext ctx) { }
/** * {@inheritDoc} * <p/> * The default implementation does nothing. */
The default implementation does nothing
exitAssignableExpression
{ "repo_name": "bcleenders/Bramspr", "path": "src/bramspr/BramsprBaseListener.java", "license": "mit", "size": 21948 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
2,277,702
private boolean drawBufferedImage(Image img, BufferedImage bufferedImage, int width, int height, ImageObserver observer) { java.awt.Graphics2D g2d = bufferedImage.createGraphics(); try { g2d.setComposite(AlphaComposite.SrcOver); Color color = new Color(1, 1, 1, 0); g2d.setBackground(color); g2d.setPaint(color); g2d.fillRect(0, 0, width, height); int imageWidth = bufferedImage.getWidth(); int imageHeight = bufferedImage.getHeight(); Rectangle clipRect = new Rectangle(0, 0, imageWidth, imageHeight); g2d.clip(clipRect); g2d.setComposite(gc.getComposite()); return g2d.drawImage(img, 0, 0, imageWidth, imageHeight, observer); } finally { g2d.dispose(); //drawn so dispose immediately to free system resource } }
boolean function(Image img, BufferedImage bufferedImage, int width, int height, ImageObserver observer) { java.awt.Graphics2D g2d = bufferedImage.createGraphics(); try { g2d.setComposite(AlphaComposite.SrcOver); Color color = new Color(1, 1, 1, 0); g2d.setBackground(color); g2d.setPaint(color); g2d.fillRect(0, 0, width, height); int imageWidth = bufferedImage.getWidth(); int imageHeight = bufferedImage.getHeight(); Rectangle clipRect = new Rectangle(0, 0, imageWidth, imageHeight); g2d.clip(clipRect); g2d.setComposite(gc.getComposite()); return g2d.drawImage(img, 0, 0, imageWidth, imageHeight, observer); } finally { g2d.dispose(); } }
/** * Draws an AWT image into a BufferedImage using an AWT Graphics2D implementation * * @param img the AWT image * @param bufferedImage the AWT buffered image * @param width the image width * @param height the image height * @param observer the image observer * @return true if the image was drawn */
Draws an AWT image into a BufferedImage using an AWT Graphics2D implementation
drawBufferedImage
{ "repo_name": "argv-minus-one/fop", "path": "fop-core/src/main/java/org/apache/fop/afp/AFPGraphics2D.java", "license": "apache-2.0", "size": 24025 }
[ "java.awt.AlphaComposite", "java.awt.Color", "java.awt.Image", "java.awt.Rectangle", "java.awt.image.BufferedImage", "java.awt.image.ImageObserver" ]
import java.awt.AlphaComposite; import java.awt.Color; import java.awt.Image; import java.awt.Rectangle; import java.awt.image.BufferedImage; import java.awt.image.ImageObserver;
import java.awt.*; import java.awt.image.*;
[ "java.awt" ]
java.awt;
707,018
public static void addGrassSeed(@Nonnull ItemStack seed, int weight) { addGrassSeed(new SeedEntry(seed, weight)); }
static void function(@Nonnull ItemStack seed, int weight) { addGrassSeed(new SeedEntry(seed, weight)); }
/** * Register a new seed to be dropped when breaking tall grass. * * @param seed The item to drop as a seed. * @param weight The relative probability of the seeds, * where wheat seeds are 10. * * Note: These functions may be going away soon, we're looking into loot tables.... */
Register a new seed to be dropped when breaking tall grass
addGrassSeed
{ "repo_name": "SuperUnitato/UnLonely", "path": "build/tmp/recompileMc/sources/net/minecraftforge/common/MinecraftForge.java", "license": "lgpl-2.1", "size": 4536 }
[ "javax.annotation.Nonnull", "net.minecraft.item.ItemStack", "net.minecraftforge.common.ForgeHooks" ]
import javax.annotation.Nonnull; import net.minecraft.item.ItemStack; import net.minecraftforge.common.ForgeHooks;
import javax.annotation.*; import net.minecraft.item.*; import net.minecraftforge.common.*;
[ "javax.annotation", "net.minecraft.item", "net.minecraftforge.common" ]
javax.annotation; net.minecraft.item; net.minecraftforge.common;
443,845
@Test public void testBrokerProxySwitchBrokerPermissionNotGranted() throws PackageManager.NameNotFoundException, NoSuchAlgorithmException { final Context context = getMockContext(); final PackageManager mockedPackageManager = context.getPackageManager(); final SignatureData signatureData = getSignature(InstrumentationRegistry.getContext(), InstrumentationRegistry.getContext().getPackageName()); mockPackageManagerBrokerSignatureAndPermission(mockedPackageManager, signatureData.getSignature()); AuthenticationSettings.INSTANCE.setBrokerSignature(signatureData.getSignatureHash()); AuthenticationSettings.INSTANCE.setUseBroker(true); final BrokerProxy brokerProxy = new BrokerProxy(context); Assert.assertTrue(brokerProxy.canSwitchToBroker(BrokerProxyTests.TEST_AUTHORITY).equals(BrokerProxy.SwitchToBroker.CAN_SWITCH_TO_BROKER)); }
void function() throws PackageManager.NameNotFoundException, NoSuchAlgorithmException { final Context context = getMockContext(); final PackageManager mockedPackageManager = context.getPackageManager(); final SignatureData signatureData = getSignature(InstrumentationRegistry.getContext(), InstrumentationRegistry.getContext().getPackageName()); mockPackageManagerBrokerSignatureAndPermission(mockedPackageManager, signatureData.getSignature()); AuthenticationSettings.INSTANCE.setBrokerSignature(signatureData.getSignatureHash()); AuthenticationSettings.INSTANCE.setUseBroker(true); final BrokerProxy brokerProxy = new BrokerProxy(context); Assert.assertTrue(brokerProxy.canSwitchToBroker(BrokerProxyTests.TEST_AUTHORITY).equals(BrokerProxy.SwitchToBroker.CAN_SWITCH_TO_BROKER)); }
/** * Verify even if GET_ACCOUNTS permission is not granted, if BrokerAccountService exists, * {@link BrokerProxy#canSwitchToBroker(String)} will return true. */
Verify even if GET_ACCOUNTS permission is not granted, if BrokerAccountService exists, <code>BrokerProxy#canSwitchToBroker(String)</code> will return true
testBrokerProxySwitchBrokerPermissionNotGranted
{ "repo_name": "iambmelt/azure-activedirectory-library-for-android", "path": "adal/src/androidTest/java/com/microsoft/aad/adal/BrokerAccountServiceTest.java", "license": "apache-2.0", "size": 19394 }
[ "android.content.Context", "android.content.pm.PackageManager", "android.support.test.InstrumentationRegistry", "java.security.NoSuchAlgorithmException", "junit.framework.Assert", "org.junit.Assert" ]
import android.content.Context; import android.content.pm.PackageManager; import android.support.test.InstrumentationRegistry; import java.security.NoSuchAlgorithmException; import junit.framework.Assert; import org.junit.Assert;
import android.content.*; import android.content.pm.*; import android.support.test.*; import java.security.*; import junit.framework.*; import org.junit.*;
[ "android.content", "android.support", "java.security", "junit.framework", "org.junit" ]
android.content; android.support; java.security; junit.framework; org.junit;
2,820,840
return new HasId(equalTo(expectedId)); }
return new HasId(equalTo(expectedId)); }
/** * Provides a matcher that matches when {@code expectedId} is equal to the {@link * org.batfish.representation.aws.ElasticsearchDomain}'s id. */
Provides a matcher that matches when expectedId is equal to the <code>org.batfish.representation.aws.ElasticsearchDomain</code>'s id
hasId
{ "repo_name": "arifogel/batfish", "path": "projects/batfish/src/test/java/org/batfish/representation/aws/matchers/ElasticsearchDomainMatchers.java", "license": "apache-2.0", "size": 3757 }
[ "org.batfish.representation.aws.matchers.ElasticsearchDomainMatchersImpl" ]
import org.batfish.representation.aws.matchers.ElasticsearchDomainMatchersImpl;
import org.batfish.representation.aws.matchers.*;
[ "org.batfish.representation" ]
org.batfish.representation;
1,019,915
protected void addSourceTypePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_EnrichMediator_sourceType_feature"), getString("_UI_PropertyDescriptor_description", "_UI_EnrichMediator_sourceType_feature", "_UI_EnrichMediator_type"), EsbPackage.Literals.ENRICH_MEDIATOR__SOURCE_TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, "Source", null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.ENRICH_MEDIATOR__SOURCE_TYPE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, STR, null)); }
/** * This adds a property descriptor for the Source Type feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated NOT */
This adds a property descriptor for the Source Type feature.
addSourceTypePropertyDescriptor
{ "repo_name": "sohaniwso2/devstudio-tooling-esb", "path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EnrichMediatorItemProvider.java", "license": "apache-2.0", "size": 16091 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "org.eclipse.emf", "org.wso2.developerstudio" ]
org.eclipse.emf; org.wso2.developerstudio;
261,092
@Override protected Tree determineNonTrivialHead(Tree t, Tree parent) { String motherCat = tlp.basicCategory(t.label().value()); if (DEBUG) { System.err.println("At " + motherCat + ", my parent is " + parent); } // Some conj expressions seem to make more sense with the "not" or // other key words as the head. For example, "and not" means // something completely different than "and". Furthermore, // downstream code was written assuming "not" would be the head... if (motherCat.equals("CONJP")) { for (TregexPattern pattern : headOfConjpTregex) { TregexMatcher matcher = pattern.matcher(t); if (matcher.matchesAt(t)) { return matcher.getNode("head"); } } // if none of the above patterns match, use the standard method } if (motherCat.equals("SBARQ") || motherCat.equals("SINV")) { if (!makeCopulaHead) { for (TregexPattern pattern : headOfCopulaTregex) { TregexMatcher matcher = pattern.matcher(t); if (matcher.matchesAt(t)) { return matcher.getNode("head"); } } } // if none of the above patterns match, use the standard method } // do VPs with auxiliary as special case if ((motherCat.equals("VP") || motherCat.equals("SQ") || motherCat.equals("SINV"))) { Tree[] kids = t.children(); // try to find if there is an auxiliary verb if (DEBUG) { System.err.println("Semantic head finder: at VP"); System.err.println("Class is " + t.getClass().getName()); t.pennPrint(System.err); //System.err.println("hasVerbalAuxiliary = " + hasVerbalAuxiliary(kids, verbalAuxiliaries)); } // looks for auxiliaries Tree[] tmpFilteredChildren = null; if (hasVerbalAuxiliary(kids, verbalAuxiliaries, true) || hasPassiveProgressiveAuxiliary(kids)) { // String[] how = new String[] {"left", "VP", "ADJP", "NP"}; // Including NP etc seems okay for copular sentences but is // problematic for other auxiliaries, like 'he has an answer' String[] how ; if (hasVerbalAuxiliary(kids, copulars, true)) { // Only allow ADJP in copular constructions // In constructions like "It gets cold", "get" should be the head how = new String[]{ "left", "VP", "ADJP" }; } else { how = new String[]{ "left", "VP" }; } if (tmpFilteredChildren == null) { tmpFilteredChildren = ArrayUtils.filter(kids, REMOVE_TMP_AND_ADV); } Tree pti = traverseLocate(tmpFilteredChildren, how, false); if (DEBUG) { System.err.println("Determined head (case 1) for " + t.value() + " is: " + pti); } if (pti != null) { return pti; // } else { // System.err.println("------"); // System.err.println("SemanticHeadFinder failed to reassign head for"); // t.pennPrint(System.err); // System.err.println("------"); } } // looks for copular verbs if (hasVerbalAuxiliary(kids, copulars, false) && ! isExistential(t, parent) && ! isWHQ(t, parent)) { String[][] how; //TODO: also allow ADVP to be heads if (motherCat.equals("SQ")) { how = new String[][]{{"right", "VP", "ADJP", "NP", "UCP", "PP", "WHADJP", "WHNP"}}; } else { how = new String[][]{{"left", "VP", "ADJP", "NP", "UCP", "PP", "WHADJP", "WHNP"}}; } // Avoid undesirable heads by filtering them from the list of potential children if (tmpFilteredChildren == null) { tmpFilteredChildren = ArrayUtils.filter(kids, REMOVE_TMP_AND_ADV); } Tree pti = null; for (int i = 0; i < how.length && pti == null; i++) { pti = traverseLocate(tmpFilteredChildren, how[i], false); } // In SQ, only allow an NP to become head if there is another one to the left (then it's probably predicative) if (motherCat.equals("SQ") && pti != null && pti.label() != null && pti.label().value().startsWith("NP")) { boolean foundAnotherNp = false; for (Tree kid : kids) { if (kid == pti) { break; } else if (kid.label() != null && kid.label().value().startsWith("NP")) { foundAnotherNp = true; break; } } if ( ! foundAnotherNp) { pti = null; } } if (DEBUG) { System.err.println("Determined head (case 2) for " + t.value() + " is: " + pti); } if (pti != null) { return pti; } else { if (DEBUG) { System.err.println("------"); System.err.println("SemanticHeadFinder failed to reassign head for"); t.pennPrint(System.err); System.err.println("------"); } } } } Tree hd = super.determineNonTrivialHead(t, parent); if (DEBUG) { System.err.println("Determined head (case 3) for " + t.value() + " is: " + hd); } return hd; }
Tree function(Tree t, Tree parent) { String motherCat = tlp.basicCategory(t.label().value()); if (DEBUG) { System.err.println(STR + motherCat + STR + parent); } if (motherCat.equals("CONJP")) { for (TregexPattern pattern : headOfConjpTregex) { TregexMatcher matcher = pattern.matcher(t); if (matcher.matchesAt(t)) { return matcher.getNode("head"); } } } if (motherCat.equals("SBARQ") motherCat.equals("SINV")) { if (!makeCopulaHead) { for (TregexPattern pattern : headOfCopulaTregex) { TregexMatcher matcher = pattern.matcher(t); if (matcher.matchesAt(t)) { return matcher.getNode("head"); } } } } if ((motherCat.equals("VP") motherCat.equals("SQ") motherCat.equals("SINV"))) { Tree[] kids = t.children(); if (DEBUG) { System.err.println(STR); System.err.println(STR + t.getClass().getName()); t.pennPrint(System.err); } Tree[] tmpFilteredChildren = null; if (hasVerbalAuxiliary(kids, verbalAuxiliaries, true) hasPassiveProgressiveAuxiliary(kids)) { String[] how ; if (hasVerbalAuxiliary(kids, copulars, true)) { how = new String[]{ "left", "VP", "ADJP" }; } else { how = new String[]{ "left", "VP" }; } if (tmpFilteredChildren == null) { tmpFilteredChildren = ArrayUtils.filter(kids, REMOVE_TMP_AND_ADV); } Tree pti = traverseLocate(tmpFilteredChildren, how, false); if (DEBUG) { System.err.println(STR + t.value() + STR + pti); } if (pti != null) { return pti; } } if (hasVerbalAuxiliary(kids, copulars, false) && ! isExistential(t, parent) && ! isWHQ(t, parent)) { String[][] how; if (motherCat.equals("SQ")) { how = new String[][]{{"right", "VP", "ADJP", "NP", "UCP", "PP", STR, "WHNP"}}; } else { how = new String[][]{{"left", "VP", "ADJP", "NP", "UCP", "PP", STR, "WHNP"}}; } if (tmpFilteredChildren == null) { tmpFilteredChildren = ArrayUtils.filter(kids, REMOVE_TMP_AND_ADV); } Tree pti = null; for (int i = 0; i < how.length && pti == null; i++) { pti = traverseLocate(tmpFilteredChildren, how[i], false); } if (motherCat.equals("SQ") && pti != null && pti.label() != null && pti.label().value().startsWith("NP")) { boolean foundAnotherNp = false; for (Tree kid : kids) { if (kid == pti) { break; } else if (kid.label() != null && kid.label().value().startsWith("NP")) { foundAnotherNp = true; break; } } if ( ! foundAnotherNp) { pti = null; } } if (DEBUG) { System.err.println(STR + t.value() + STR + pti); } if (pti != null) { return pti; } else { if (DEBUG) { System.err.println(STR); System.err.println(STR); t.pennPrint(System.err); System.err.println(STR); } } } } Tree hd = super.determineNonTrivialHead(t, parent); if (DEBUG) { System.err.println(STR + t.value() + STR + hd); } return hd; }
/** * Determine which daughter of the current parse tree is the * head. It assumes that the daughters already have had their * heads determined. Uses special rule for VP heads * * @param t The parse tree to examine the daughters of. * This is assumed to never be a leaf * @return The parse tree that is the head */
Determine which daughter of the current parse tree is the head. It assumes that the daughters already have had their heads determined. Uses special rule for VP heads
determineNonTrivialHead
{ "repo_name": "codev777/CoreNLP", "path": "src/edu/stanford/nlp/trees/UniversalSemanticHeadFinder.java", "license": "gpl-2.0", "size": 30107 }
[ "edu.stanford.nlp.trees.tregex.TregexMatcher", "edu.stanford.nlp.trees.tregex.TregexPattern", "edu.stanford.nlp.util.ArrayUtils" ]
import edu.stanford.nlp.trees.tregex.TregexMatcher; import edu.stanford.nlp.trees.tregex.TregexPattern; import edu.stanford.nlp.util.ArrayUtils;
import edu.stanford.nlp.trees.tregex.*; import edu.stanford.nlp.util.*;
[ "edu.stanford.nlp" ]
edu.stanford.nlp;
2,495,820
public static final CmsSolrIndex getIndexSolr(CmsObject cms, Map<String, String[]> params) { String indexName = null; CmsSolrIndex index = null; // try to get the index name from the parameters: 'core' or 'index' if (params != null) { indexName = params.get(OpenCmsSolrHandler.PARAM_CORE) != null ? params.get(OpenCmsSolrHandler.PARAM_CORE)[0] : (params.get(OpenCmsSolrHandler.PARAM_INDEX) != null ? params.get(OpenCmsSolrHandler.PARAM_INDEX)[0] : null); } if (indexName == null) { // if no parameter is specified try to use the default online/offline indexes by context indexName = cms.getRequestContext().getCurrentProject().isOnlineProject() ? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE : CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE; } // try to get the index index = indexName != null ? OpenCms.getSearchManager().getIndexSolr(indexName) : null; if (index == null) { // if there is exactly one index, a missing core / index parameter doesn't matter, since there is no choice. List<CmsSolrIndex> solrs = OpenCms.getSearchManager().getAllSolrIndexes(); if ((solrs != null) && !solrs.isEmpty() && (solrs.size() == 1)) { index = solrs.get(0); } } return index; }
static final CmsSolrIndex function(CmsObject cms, Map<String, String[]> params) { String indexName = null; CmsSolrIndex index = null; if (params != null) { indexName = params.get(OpenCmsSolrHandler.PARAM_CORE) != null ? params.get(OpenCmsSolrHandler.PARAM_CORE)[0] : (params.get(OpenCmsSolrHandler.PARAM_INDEX) != null ? params.get(OpenCmsSolrHandler.PARAM_INDEX)[0] : null); } if (indexName == null) { indexName = cms.getRequestContext().getCurrentProject().isOnlineProject() ? CmsSolrIndex.DEFAULT_INDEX_NAME_ONLINE : CmsSolrIndex.DEFAULT_INDEX_NAME_OFFLINE; } index = indexName != null ? OpenCms.getSearchManager().getIndexSolr(indexName) : null; if (index == null) { List<CmsSolrIndex> solrs = OpenCms.getSearchManager().getAllSolrIndexes(); if ((solrs != null) && !solrs.isEmpty() && (solrs.size() == 1)) { index = solrs.get(0); } } return index; }
/** * Returns the Solr index configured with the parameters name. * The parameters must contain a key/value pair with an existing * Solr index, otherwise <code>null</code> is returned.<p> * * @param cms the current context * @param params the parameter map * * @return the best matching Solr index */
Returns the Solr index configured with the parameters name. The parameters must contain a key/value pair with an existing Solr index, otherwise <code>null</code> is returned
getIndexSolr
{ "repo_name": "ggiudetti/opencms-core", "path": "src/org/opencms/search/CmsSearchManager.java", "license": "lgpl-2.1", "size": 124143 }
[ "java.util.List", "java.util.Map", "org.opencms.file.CmsObject", "org.opencms.main.OpenCms", "org.opencms.main.OpenCmsSolrHandler", "org.opencms.search.solr.CmsSolrIndex" ]
import java.util.List; import java.util.Map; import org.opencms.file.CmsObject; import org.opencms.main.OpenCms; import org.opencms.main.OpenCmsSolrHandler; import org.opencms.search.solr.CmsSolrIndex;
import java.util.*; import org.opencms.file.*; import org.opencms.main.*; import org.opencms.search.solr.*;
[ "java.util", "org.opencms.file", "org.opencms.main", "org.opencms.search" ]
java.util; org.opencms.file; org.opencms.main; org.opencms.search;
2,471,674
default void forEmbeddedRoot(JavaConstant root, ScanReason reason) { }
default void forEmbeddedRoot(JavaConstant root, ScanReason reason) { }
/** * Hook for scanned embedded root. */
Hook for scanned embedded root
forEmbeddedRoot
{ "repo_name": "smarr/Truffle", "path": "substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/ObjectScanningObserver.java", "license": "gpl-2.0", "size": 3715 }
[ "com.oracle.graal.pointsto.ObjectScanner" ]
import com.oracle.graal.pointsto.ObjectScanner;
import com.oracle.graal.pointsto.*;
[ "com.oracle.graal" ]
com.oracle.graal;
2,129,502
StreamConnection performUpgrade() throws IOException;
StreamConnection performUpgrade() throws IOException;
/** * Upgrade the connection, if the underlying protocol supports it. This should only be called after an upgrade request * has been submitted and the target server has accepted the upgrade. * * @return The resulting StreamConnection */
Upgrade the connection, if the underlying protocol supports it. This should only be called after an upgrade request has been submitted and the target server has accepted the upgrade
performUpgrade
{ "repo_name": "grassjedi/undertow", "path": "core/src/main/java/io/undertow/client/ClientConnection.java", "license": "apache-2.0", "size": 3834 }
[ "java.io.IOException", "org.xnio.StreamConnection" ]
import java.io.IOException; import org.xnio.StreamConnection;
import java.io.*; import org.xnio.*;
[ "java.io", "org.xnio" ]
java.io; org.xnio;
1,185,477
public @Nonnull String build(@Nonnull CloudProvider provider) throws CloudException, InternalException { NetworkServices services = provider.getNetworkServices(); if( services == null ) { throw new OperationNotSupportedException(provider.getCloudName() + " does not support network services"); } else { VLANSupport support = services.getVlanSupport(); if( support == null ) { throw new OperationNotSupportedException(provider.getCloudName() + " does not have support for vlans"); } return support.createVlan(this).getProviderVlanId(); } }
@Nonnull String function(@Nonnull CloudProvider provider) throws CloudException, InternalException { NetworkServices services = provider.getNetworkServices(); if( services == null ) { throw new OperationNotSupportedException(provider.getCloudName() + STR); } else { VLANSupport support = services.getVlanSupport(); if( support == null ) { throw new OperationNotSupportedException(provider.getCloudName() + STR); } return support.createVlan(this).getProviderVlanId(); } }
/** * Provisions a firewall in the specified cloud based on the options described in this object. * @param provider the cloud provider in which the firewall will be created * @return the unique ID of the vlan that is provisioned * @throws org.dasein.cloud.CloudException an error occurred with the cloud provider while provisioning the vlan * @throws org.dasein.cloud.InternalException an internal error occurred within Dasein Cloud while preparing or handling the API call * @throws org.dasein.cloud.OperationNotSupportedException this cloud does not support vlan */
Provisions a firewall in the specified cloud based on the options described in this object
build
{ "repo_name": "OSS-TheWeatherCompany/dasein-cloud-core", "path": "src/main/java/org/dasein/cloud/network/VlanCreateOptions.java", "license": "apache-2.0", "size": 4810 }
[ "javax.annotation.Nonnull", "org.dasein.cloud.CloudException", "org.dasein.cloud.CloudProvider", "org.dasein.cloud.InternalException", "org.dasein.cloud.OperationNotSupportedException" ]
import javax.annotation.Nonnull; import org.dasein.cloud.CloudException; import org.dasein.cloud.CloudProvider; import org.dasein.cloud.InternalException; import org.dasein.cloud.OperationNotSupportedException;
import javax.annotation.*; import org.dasein.cloud.*;
[ "javax.annotation", "org.dasein.cloud" ]
javax.annotation; org.dasein.cloud;
1,270,696
public void setSelectable(boolean selectable) { if (!SharedUtil.equals(this.selectable, selectable)) { this.selectable = selectable; markAsDirty(); } }
void function(boolean selectable) { if (!SharedUtil.equals(this.selectable, selectable)) { this.selectable = selectable; markAsDirty(); } }
/** * Setter for property selectable. * * <p> * The table is not selectable until it's explicitly set as selectable via * this method or alternatively at least one {@link ValueChangeListener} is * added. * </p> * * @param selectable * the New value of property selectable. */
Setter for property selectable. The table is not selectable until it's explicitly set as selectable via this method or alternatively at least one <code>ValueChangeListener</code> is added.
setSelectable
{ "repo_name": "carrchang/vaadin", "path": "server/src/com/vaadin/ui/Table.java", "license": "apache-2.0", "size": 218051 }
[ "com.vaadin.shared.util.SharedUtil" ]
import com.vaadin.shared.util.SharedUtil;
import com.vaadin.shared.util.*;
[ "com.vaadin.shared" ]
com.vaadin.shared;
2,416,430
public static Entity createBullet(World entityWorld, float x, float y, float angleDeg, Entity shooter) { Entity e = entityWorld.createEntity(); e.setGroup("bullets"); Transform transform = new Transform(x, y, angleDeg); e.addComponent(transform); e.addComponent(new SpatialForm("bullet")); e.addComponent(new Expiration(1500)); Body b = PhysicsFactory.createBoxBody(0.5f, 0.5f, 0.2f); //FIXME- Reference materials list for density b.setBullet(true); b.setUserData(e); Fixture fix = b.getFixtureList().get(0); // Prevent bullets from colliding with the shooter! // b.addExcludedBody(shooter.getComponent(Physics.class).getBody()); Body srcBody = shooter.getComponent(Physics.class).getBody(); Fixture srcFix = srcBody.getFixtureList().get(0); Filter srcFilter = srcFix.getFilterData(); // TODO: Make it so you can snipe opponents bullets. // Collide with everything except other bullets and the shooter of this bullet. Filter filter = fix.getFilterData(); // b.setBitmask(1); filter.categoryBits = PhysicsInfo.BULLET_CATEGORY; filter.maskBits = (short) (PhysicsInfo.ALL_CATEGORIES & (~(srcFilter.categoryBits | PhysicsInfo.BULLET_CATEGORY))); fix.setFilterData(filter); b.setTransform(x, y, angleDeg*MathUtils.degreesToRadians); // b.setPosition(x,y); b.setRotation(angle); fix.setRestitution(0); // b.setRestitution(0); b.setLinearDamping(0.002f);// b.setDamping(0.002f); fix.setFriction(10); // b.setFriction(10); // TODO: Make a pool of bullets to avoid new allocations! b.setLinearVelocity(new Vector2(1000f * TrigLUT.cosDeg(angleDeg), 1000f * TrigLUT.sinDeg(angleDeg))); // b.adjustVelocity(new // Vector2(1000f * // TrigLUT.cosDeg(angle), // 1000f * // TrigLUT.sinDeg(angle))); e.addComponent(new Physics(b)); e.refresh(); return e; }
static Entity function(World entityWorld, float x, float y, float angleDeg, Entity shooter) { Entity e = entityWorld.createEntity(); e.setGroup(STR); Transform transform = new Transform(x, y, angleDeg); e.addComponent(transform); e.addComponent(new SpatialForm(STR)); e.addComponent(new Expiration(1500)); Body b = PhysicsFactory.createBoxBody(0.5f, 0.5f, 0.2f); b.setBullet(true); b.setUserData(e); Fixture fix = b.getFixtureList().get(0); Body srcBody = shooter.getComponent(Physics.class).getBody(); Fixture srcFix = srcBody.getFixtureList().get(0); Filter srcFilter = srcFix.getFilterData(); Filter filter = fix.getFilterData(); filter.categoryBits = PhysicsInfo.BULLET_CATEGORY; filter.maskBits = (short) (PhysicsInfo.ALL_CATEGORIES & (~(srcFilter.categoryBits PhysicsInfo.BULLET_CATEGORY))); fix.setFilterData(filter); b.setTransform(x, y, angleDeg*MathUtils.degreesToRadians); fix.setRestitution(0); b.setLinearDamping(0.002f); fix.setFriction(10); b.setLinearVelocity(new Vector2(1000f * TrigLUT.cosDeg(angleDeg), 1000f * TrigLUT.sinDeg(angleDeg))); e.addComponent(new Physics(b)); e.refresh(); return e; }
/** * Bullets consist of the following components:<br> * - <strong>Transform</strong>:<br> * - <strong>SpatialForm</strong>:<br> * - <strong>Expiration</strong>:<br> * - <strong>Physics Body</strong>:<br> * * @param entityWorld * @param x * @param y * @param angleDeg * @param shooter * - Used to prevent tank from shooting itself * @return */
Bullets consist of the following components: - Transform: - SpatialForm: - Expiration: - Physics Body:
createBullet
{ "repo_name": "minthubk/tankz", "path": "tankz/src/com/tankz/EntityFactory.java", "license": "apache-2.0", "size": 9605 }
[ "com.artemis.Entity", "com.artemis.World", "com.artemis.utils.TrigLUT", "com.badlogic.gdx.math.MathUtils", "com.badlogic.gdx.math.Vector2", "com.badlogic.gdx.physics.box2d.Body", "com.badlogic.gdx.physics.box2d.Filter", "com.badlogic.gdx.physics.box2d.Fixture", "com.tankz.components.Expiration", "com.tankz.components.Physics", "com.tankz.components.SpatialForm", "com.tankz.components.Transform", "com.tankz.systems.physics.PhysicsFactory", "com.tankz.systems.physics.PhysicsInfo" ]
import com.artemis.Entity; import com.artemis.World; import com.artemis.utils.TrigLUT; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.physics.box2d.Body; import com.badlogic.gdx.physics.box2d.Filter; import com.badlogic.gdx.physics.box2d.Fixture; import com.tankz.components.Expiration; import com.tankz.components.Physics; import com.tankz.components.SpatialForm; import com.tankz.components.Transform; import com.tankz.systems.physics.PhysicsFactory; import com.tankz.systems.physics.PhysicsInfo;
import com.artemis.*; import com.artemis.utils.*; import com.badlogic.gdx.math.*; import com.badlogic.gdx.physics.box2d.*; import com.tankz.components.*; import com.tankz.systems.physics.*;
[ "com.artemis", "com.artemis.utils", "com.badlogic.gdx", "com.tankz.components", "com.tankz.systems" ]
com.artemis; com.artemis.utils; com.badlogic.gdx; com.tankz.components; com.tankz.systems;
1,320,784
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<LoadBalancerInner> list(Context context) { return new PagedIterable<>(listAsync(context)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<LoadBalancerInner> function(Context context) { return new PagedIterable<>(listAsync(context)); }
/** * Gets all the load balancers in a subscription. * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all the load balancers in a subscription. */
Gets all the load balancers in a subscription
list
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/LoadBalancersClientImpl.java", "license": "mit", "size": 67687 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.core.util.Context", "com.azure.resourcemanager.network.fluent.models.LoadBalancerInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.network.fluent.models.LoadBalancerInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
2,782,626
LogicalCallableStatement newLogicalCallableStatement( CallableStatement cs, StatementKey stmtKey, StatementCacheInteractor cacheInteractor);
LogicalCallableStatement newLogicalCallableStatement( CallableStatement cs, StatementKey stmtKey, StatementCacheInteractor cacheInteractor);
/** * Returns a new logical callable statement object. * * @param cs underlying physical callable statement * @param stmtKey key for the underlying physical callable statement * @param cacheInteractor the statement cache interactor * @return A logical callable statement. */
Returns a new logical callable statement object
newLogicalCallableStatement
{ "repo_name": "trejkaz/derby", "path": "java/client/org/apache/derby/client/am/ClientJDBCObjectFactory.java", "license": "apache-2.0", "size": 14404 }
[ "java.sql.CallableStatement", "org.apache.derby.client.am.stmtcache.StatementKey" ]
import java.sql.CallableStatement; import org.apache.derby.client.am.stmtcache.StatementKey;
import java.sql.*; import org.apache.derby.client.am.stmtcache.*;
[ "java.sql", "org.apache.derby" ]
java.sql; org.apache.derby;
305,103
public void assignUUID(UUIDObject object) { object.setUUID(generateUUID(object.getUUIDPrefix())); }
void function(UUIDObject object) { object.setUUID(generateUUID(object.getUUIDPrefix())); }
/** * Assigns UUID to the object * * @param object */
Assigns UUID to the object
assignUUID
{ "repo_name": "kynerix/kynerix-backend", "path": "core/src/main/java/com/kynerix/server/UUIDManager.java", "license": "apache-2.0", "size": 906 }
[ "com.kynerix.shared.UUIDObject" ]
import com.kynerix.shared.UUIDObject;
import com.kynerix.shared.*;
[ "com.kynerix.shared" ]
com.kynerix.shared;
2,863,134
public Class<UIJob> getUIJobClass() { return UIJob.class; }
Class<UIJob> function() { return UIJob.class; }
/** * Important: keep for scripting */
Important: keep for scripting
getUIJobClass
{ "repo_name": "rgom/Pydev", "path": "plugins/org.python.pydev/src/org/python/pydev/editor/PyEdit.java", "license": "epl-1.0", "size": 67141 }
[ "org.eclipse.ui.progress.UIJob" ]
import org.eclipse.ui.progress.UIJob;
import org.eclipse.ui.progress.*;
[ "org.eclipse.ui" ]
org.eclipse.ui;
820,745
@ServiceMethod(returns = ReturnType.SINGLE) ConfigurationListResultInner listUpdateConfigurations( String resourceGroupName, String serverName, ConfigurationListResultInner value);
@ServiceMethod(returns = ReturnType.SINGLE) ConfigurationListResultInner listUpdateConfigurations( String resourceGroupName, String serverName, ConfigurationListResultInner value);
/** * Update a list of configurations in a given server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param value The parameters for updating a list of server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of server configurations. */
Update a list of configurations in a given server
listUpdateConfigurations
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerParametersClient.java", "license": "mit", "size": 4360 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.mariadb.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
61,680
public static void compact(DatasetGraph container, boolean shouldDeleteOld) { DatasetGraphSwitchable dsg = requireSwitchable(container); DatabaseOps.compact(dsg, shouldDeleteOld); }
static void function(DatasetGraph container, boolean shouldDeleteOld) { DatasetGraphSwitchable dsg = requireSwitchable(container); DatabaseOps.compact(dsg, shouldDeleteOld); }
/** * Compact a datasets which must be a switchable TDB database. * This is the normal dataset type for on-disk TDB2 databases. * * Deletes old database after successful compaction if `shouldDeleteOld` is `true`. * * @param container * @param shouldDeleteOld */
Compact a datasets which must be a switchable TDB database. This is the normal dataset type for on-disk TDB2 databases. Deletes old database after successful compaction if `shouldDeleteOld` is `true`
compact
{ "repo_name": "apache/jena", "path": "jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/DatabaseMgr.java", "license": "apache-2.0", "size": 4919 }
[ "org.apache.jena.sparql.core.DatasetGraph", "org.apache.jena.tdb2.store.DatasetGraphSwitchable", "org.apache.jena.tdb2.sys.DatabaseOps" ]
import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.tdb2.store.DatasetGraphSwitchable; import org.apache.jena.tdb2.sys.DatabaseOps;
import org.apache.jena.sparql.core.*; import org.apache.jena.tdb2.store.*; import org.apache.jena.tdb2.sys.*;
[ "org.apache.jena" ]
org.apache.jena;
1,289,425
protected boolean checkNewEntry(String goalWord, String searchWord, ITermSimilarity algorithm) { DictEntry testEntry = new DictEntry(goalWord, searchWord, algorithm); return dictionary.containsEntry(testEntry); }
boolean function(String goalWord, String searchWord, ITermSimilarity algorithm) { DictEntry testEntry = new DictEntry(goalWord, searchWord, algorithm); return dictionary.containsEntry(testEntry); }
/** * Return true if an entry with these components already exists * (Don't allow an entry to be modified into a duplicate of another existing * entry.) */
Return true if an entry with these components already exists (Don't allow an entry to be modified into a duplicate of another existing entry.)
checkNewEntry
{ "repo_name": "cogtool/cogtool", "path": "java/edu/cmu/cs/hcii/cogtool/controller/DictionaryEditorController.java", "license": "lgpl-2.1", "size": 35899 }
[ "edu.cmu.cs.hcii.cogtool.model.ISimilarityDictionary", "edu.cmu.cs.hcii.cogtool.model.ITermSimilarity" ]
import edu.cmu.cs.hcii.cogtool.model.ISimilarityDictionary; import edu.cmu.cs.hcii.cogtool.model.ITermSimilarity;
import edu.cmu.cs.hcii.cogtool.model.*;
[ "edu.cmu.cs" ]
edu.cmu.cs;
967,206
@Test public void whenSentEmptyListThenGetEmptyHashMap() { HashMap<Integer, User> expected = new HashMap<>(); List<User> list = new ArrayList<>(); HashMap<Integer, User> result = new UserConvert().process(list); assertThat(result, is(expected)); }
void function() { HashMap<Integer, User> expected = new HashMap<>(); List<User> list = new ArrayList<>(); HashMap<Integer, User> result = new UserConvert().process(list); assertThat(result, is(expected)); }
/** * Test process. */
Test process
whenSentEmptyListThenGetEmptyHashMap
{ "repo_name": "AlekseySidorenko/aleksey_sidorenko", "path": "chapter_003/src/test/java/ru/job4j/collections/UserConvertTest.java", "license": "apache-2.0", "size": 1120 }
[ "java.util.ArrayList", "java.util.HashMap", "java.util.List", "org.hamcrest.core.Is", "org.junit.Assert" ]
import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.hamcrest.core.Is; import org.junit.Assert;
import java.util.*; import org.hamcrest.core.*; import org.junit.*;
[ "java.util", "org.hamcrest.core", "org.junit" ]
java.util; org.hamcrest.core; org.junit;
393,737
private Intent getIntentToEnableOsPerAppPermission(Context context) { if (enabledForChrome(context)) return null; return getAppInfoIntent(context); }
Intent function(Context context) { if (enabledForChrome(context)) return null; return getAppInfoIntent(context); }
/** * Returns the OS Intent to use to enable a per-app permission, or null if the permission is * already enabled. Android M and above provides two ways of doing this for some permissions, * most notably Location, one that is per-app and another that is global. */
Returns the OS Intent to use to enable a per-app permission, or null if the permission is already enabled. Android M and above provides two ways of doing this for some permissions, most notably Location, one that is per-app and another that is global
getIntentToEnableOsPerAppPermission
{ "repo_name": "Pluto-tv/chromium-crosswalk", "path": "chrome/android/java/src/org/chromium/chrome/browser/preferences/website/SiteSettingsCategory.java", "license": "bsd-3-clause", "size": 18315 }
[ "android.content.Context", "android.content.Intent" ]
import android.content.Context; import android.content.Intent;
import android.content.*;
[ "android.content" ]
android.content;
2,438,346
private static boolean createDirIfNotExist(String path) { File f = new File(path); if (!f.exists()) { if (!f.mkdirs()) { Log.e(LOG_GPAC_CONFIG, "Failed to create directory " + path); //$NON-NLS-1$ return false; } else { Log.i(LOG_GPAC_CONFIG, "Created directory " + path); //$NON-NLS-1$ } } return true; }
static boolean function(String path) { File f = new File(path); if (!f.exists()) { if (!f.mkdirs()) { Log.e(LOG_GPAC_CONFIG, STR + path); return false; } else { Log.i(LOG_GPAC_CONFIG, STR + path); } } return true; }
/** * Creates a given directory if it does not exist * * @param path */
Creates a given directory if it does not exist
createDirIfNotExist
{ "repo_name": "wipple/GPAC-old", "path": "applications/osmo4_android/src/com/gpac/Osmo4/GpacConfig.java", "license": "lgpl-2.1", "size": 5578 }
[ "android.util.Log", "java.io.File" ]
import android.util.Log; import java.io.File;
import android.util.*; import java.io.*;
[ "android.util", "java.io" ]
android.util; java.io;
942,462
public void addValueClassification( ValueClassification valueClassification) { if (valueClassification == null) { throw new IllegalArgumentException( "valueClassification cannot be null"); } if (!classificationMatrix.containsKey(valueClassification.value)) { classificationMatrix.put(valueClassification.value, new ArrayList<>()); } lowLevelIds.add(valueClassification.lladId); classificationMatrix.get(valueClassification.value).add( new ClassificationMatrixValue(valueClassification.lladId, NominalValue.getInstance(valueClassification.lladValue))); this.valueClassifications.add(valueClassification); recalculateChildren(); }
void function( ValueClassification valueClassification) { if (valueClassification == null) { throw new IllegalArgumentException( STR); } if (!classificationMatrix.containsKey(valueClassification.value)) { classificationMatrix.put(valueClassification.value, new ArrayList<>()); } lowLevelIds.add(valueClassification.lladId); classificationMatrix.get(valueClassification.value).add( new ClassificationMatrixValue(valueClassification.lladId, NominalValue.getInstance(valueClassification.lladValue))); this.valueClassifications.add(valueClassification); recalculateChildren(); }
/** * Adds a value classification for the abstraction. If a classification of * the provided name doesn't exist, then it is created. The value definition * name must be one of the values applicable to the low-level abstraction * whose ID is also passed in. * * @param id the name of the value definition * @param lowLevelAbstractionId the name of the low-level abstraction to add * to the classification * @param lowLevelValueDefName the name of the low-level abstraction's value */
Adds a value classification for the abstraction. If a classification of the provided name doesn't exist, then it is created. The value definition name must be one of the values applicable to the low-level abstraction whose ID is also passed in
addValueClassification
{ "repo_name": "eurekaclinical/protempa", "path": "protempa-framework/src/main/java/org/protempa/CompoundLowLevelAbstractionDefinition.java", "license": "apache-2.0", "size": 13181 }
[ "java.util.ArrayList", "org.protempa.proposition.value.NominalValue" ]
import java.util.ArrayList; import org.protempa.proposition.value.NominalValue;
import java.util.*; import org.protempa.proposition.value.*;
[ "java.util", "org.protempa.proposition" ]
java.util; org.protempa.proposition;
411,084
public Range getSecondaryRangeForRow(int row) { if(row < 0 || row > getRowCount()) return null; return new Range(scores.get(row).range.getStart(), scores.get(row).range.getEnd()); }
Range function(int row) { if(row < 0 row > getRowCount()) return null; return new Range(scores.get(row).range.getStart(), scores.get(row).range.getEnd()); }
/** * Returns the redated (secondary) sample range for the specific row * * @param row * @return */
Returns the redated (secondary) sample range for the specific row
getSecondaryRangeForRow
{ "repo_name": "petebrew/tellervo", "path": "src/main/java/org/tellervo/desktop/cross/SigScoresTableModel.java", "license": "gpl-3.0", "size": 12721 }
[ "org.tellervo.desktop.Range" ]
import org.tellervo.desktop.Range;
import org.tellervo.desktop.*;
[ "org.tellervo.desktop" ]
org.tellervo.desktop;
1,150,369
@SuppressWarnings("null") // headerValue cannot be null private boolean parseHeader() throws IOException { // // Check for blank line // byte chr = 0; while (true) { // Read new bytes if needed if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString("iib.eof.error")); } chr = buf[pos]; if (chr == Constants.CR) { // Skip } else if (chr == Constants.LF) { pos++; return false; } else { break; } pos++; } // Mark the current buffer position int start = pos; // // Reading the header name // Header name is always US-ASCII // boolean colon = false; MessageBytes headerValue = null; while (!colon) { // Read new bytes if needed if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString("iib.eof.error")); } if (buf[pos] == Constants.COLON) { colon = true; headerValue = headers.addValue(buf, start, pos - start); } else if (!HTTP_TOKEN_CHAR[buf[pos]]) { // If a non-token header is detected, skip the line and // ignore the header skipLine(start); return true; } chr = buf[pos]; if ((chr >= Constants.A) && (chr <= Constants.Z)) { buf[pos] = (byte) (chr - Constants.LC_OFFSET); } pos++; } // Mark the current buffer position start = pos; int realPos = pos; // // Reading the header value (which can be spanned over multiple lines) // boolean eol = false; boolean validLine = true; while (validLine) { boolean space = true; // Skipping spaces while (space) { // Read new bytes if needed if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString("iib.eof.error")); } if ((buf[pos] == Constants.SP) || (buf[pos] == Constants.HT)) { pos++; } else { space = false; } } int lastSignificantChar = realPos; // Reading bytes until the end of the line while (!eol) { // Read new bytes if needed if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString("iib.eof.error")); } if (buf[pos] == Constants.CR) { // Skip } else if (buf[pos] == Constants.LF) { eol = true; } else if (buf[pos] == Constants.SP) { buf[realPos] = buf[pos]; realPos++; } else { buf[realPos] = buf[pos]; realPos++; lastSignificantChar = realPos; } pos++; } realPos = lastSignificantChar; // Checking the first character of the new line. If the character // is a LWS, then it's a multiline header // Read new bytes if needed if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString("iib.eof.error")); } chr = buf[pos]; if ((chr != Constants.SP) && (chr != Constants.HT)) { validLine = false; } else { eol = false; // Copying one extra space in the buffer (since there must // be at least one space inserted between the lines) buf[realPos] = chr; realPos++; } } // Set the header value headerValue.setBytes(buf, start, realPos - start); return true; }
@SuppressWarnings("null") boolean function() throws IOException { byte chr = 0; while (true) { if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString(STR)); } chr = buf[pos]; if (chr == Constants.CR) { } else if (chr == Constants.LF) { pos++; return false; } else { break; } pos++; } int start = pos; boolean colon = false; MessageBytes headerValue = null; while (!colon) { if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString(STR)); } if (buf[pos] == Constants.COLON) { colon = true; headerValue = headers.addValue(buf, start, pos - start); } else if (!HTTP_TOKEN_CHAR[buf[pos]]) { skipLine(start); return true; } chr = buf[pos]; if ((chr >= Constants.A) && (chr <= Constants.Z)) { buf[pos] = (byte) (chr - Constants.LC_OFFSET); } pos++; } start = pos; int realPos = pos; boolean eol = false; boolean validLine = true; while (validLine) { boolean space = true; while (space) { if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString(STR)); } if ((buf[pos] == Constants.SP) (buf[pos] == Constants.HT)) { pos++; } else { space = false; } } int lastSignificantChar = realPos; while (!eol) { if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString(STR)); } if (buf[pos] == Constants.CR) { } else if (buf[pos] == Constants.LF) { eol = true; } else if (buf[pos] == Constants.SP) { buf[realPos] = buf[pos]; realPos++; } else { buf[realPos] = buf[pos]; realPos++; lastSignificantChar = realPos; } pos++; } realPos = lastSignificantChar; if (pos >= lastValid) { if (!fill()) throw new EOFException(sm.getString(STR)); } chr = buf[pos]; if ((chr != Constants.SP) && (chr != Constants.HT)) { validLine = false; } else { eol = false; buf[realPos] = chr; realPos++; } } headerValue.setBytes(buf, start, realPos - start); return true; }
/** * Parse an HTTP header. * * @return false after reading a blank line (which indicates that the * HTTP header parsing is done */
Parse an HTTP header
parseHeader
{ "repo_name": "GazeboHub/ghub-portal-doc", "path": "doc/modelio/GHub Portal/mda/JavaDesigner/res/java/tomcat/java/org/apache/coyote/http11/InternalInputBuffer.java", "license": "epl-1.0", "size": 15609 }
[ "java.io.EOFException", "java.io.IOException", "org.apache.tomcat.util.buf.MessageBytes" ]
import java.io.EOFException; import java.io.IOException; import org.apache.tomcat.util.buf.MessageBytes;
import java.io.*; import org.apache.tomcat.util.buf.*;
[ "java.io", "org.apache.tomcat" ]
java.io; org.apache.tomcat;
1,959,166
Date from = date; Date to = date; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if (SerieDto.RANGE.equals(period)) { from = date; to = date; } else if (SerieDto.DAY.equals(period)) { from = date; to = date; } else if (SerieDto.WEEK.equals(period)) { calendar.set(Calendar.DAY_OF_WEEK, 1); from = calendar.getTime(); calendar.set(Calendar.DAY_OF_WEEK, 7); to = calendar.getTime(); } else if (SerieDto.MONTH.equals(period)) { calendar.set(Calendar.DAY_OF_MONTH, 1); from = calendar.getTime(); calendar.set(Calendar.DAY_OF_MONTH, 31); to = calendar.getTime(); } else if (SerieDto.YEAR.equals(period)) { calendar.set(Calendar.DAY_OF_YEAR, 1); from = calendar.getTime(); calendar.set(Calendar.DAY_OF_YEAR, 366); to = calendar.getTime(); } SerieDto serie = findByPeriod(from, to); serie.setPeriod(period); return serie; }
Date from = date; Date to = date; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); if (SerieDto.RANGE.equals(period)) { from = date; to = date; } else if (SerieDto.DAY.equals(period)) { from = date; to = date; } else if (SerieDto.WEEK.equals(period)) { calendar.set(Calendar.DAY_OF_WEEK, 1); from = calendar.getTime(); calendar.set(Calendar.DAY_OF_WEEK, 7); to = calendar.getTime(); } else if (SerieDto.MONTH.equals(period)) { calendar.set(Calendar.DAY_OF_MONTH, 1); from = calendar.getTime(); calendar.set(Calendar.DAY_OF_MONTH, 31); to = calendar.getTime(); } else if (SerieDto.YEAR.equals(period)) { calendar.set(Calendar.DAY_OF_YEAR, 1); from = calendar.getTime(); calendar.set(Calendar.DAY_OF_YEAR, 366); to = calendar.getTime(); } SerieDto serie = findByPeriod(from, to); serie.setPeriod(period); return serie; }
/** * Returns a serie. Don't use the value "range" for the parameter "period", * call findByPeriod(Date, Date) instead. * * @param period * @param date * @return SerieDto */
Returns a serie. Don't use the value "range" for the parameter "period", call findByPeriod(Date, Date) instead
findByPeriod
{ "repo_name": "Emergya/opensir", "path": "sir-admin/sir-admin-extensions/sir-admin-app-stats/src/main/java/com/emergya/ohiggins/stats/dao/impl/RequestedLayersGeoServerImpl.java", "license": "lgpl-2.1", "size": 5038 }
[ "com.emergya.ohiggins.stats.dto.SerieDto", "java.util.Calendar", "java.util.Date" ]
import com.emergya.ohiggins.stats.dto.SerieDto; import java.util.Calendar; import java.util.Date;
import com.emergya.ohiggins.stats.dto.*; import java.util.*;
[ "com.emergya.ohiggins", "java.util" ]
com.emergya.ohiggins; java.util;
859,278
public void parent(PreparedDocument rdoc, OutputStream os, ObjectPidsPath path, FontMap fontMap);
void function(PreparedDocument rdoc, OutputStream os, ObjectPidsPath path, FontMap fontMap);
/** * Generate first pdf page for title * @param rdoc Generating document model * @param os Outputstream * @param path Path for generting object * @param imgServlet IMG servlet * @param i18nServlet I18N servlet * @param fontMap Prepared FontMap object */
Generate first pdf page for title
parent
{ "repo_name": "ceskaexpedice/kramerius", "path": "shared/common/src/main/java/cz/incad/kramerius/pdf/FirstPagePDFService.java", "license": "gpl-3.0", "size": 1973 }
[ "cz.incad.kramerius.ObjectPidsPath", "cz.incad.kramerius.document.model.PreparedDocument", "cz.incad.kramerius.pdf.utils.pdf.FontMap", "java.io.OutputStream" ]
import cz.incad.kramerius.ObjectPidsPath; import cz.incad.kramerius.document.model.PreparedDocument; import cz.incad.kramerius.pdf.utils.pdf.FontMap; import java.io.OutputStream;
import cz.incad.kramerius.*; import cz.incad.kramerius.document.model.*; import cz.incad.kramerius.pdf.utils.pdf.*; import java.io.*;
[ "cz.incad.kramerius", "java.io" ]
cz.incad.kramerius; java.io;
495,113
protected List<String> getNonPrimaryKeyColumns(String tableName) { List<String> columns = getAllColumns(tableName); columns.removeAll(getPrimaryKeys(tableName)); return columns; }
List<String> function(String tableName) { List<String> columns = getAllColumns(tableName); columns.removeAll(getPrimaryKeys(tableName)); return columns; }
/** Returns all non-primary-key column names for the specified table, in the * order defined in the DDL. */
Returns all non-primary-key column names for the specified table, in the
getNonPrimaryKeyColumns
{ "repo_name": "paulmartel/voltdb", "path": "src/frontend/org/voltdb/NonVoltDBBackend.java", "license": "agpl-3.0", "size": 40578 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
885,819
@SuppressWarnings("deprecation") void registerMBean() { MXBeanImpl mxBeanInfo = MXBeanImpl.init(this); mxBean = MBeanUtil.registerMBean("RegionServer", "RegionServer", mxBeanInfo); LOG.info("Registered RegionServer MXBean"); }
@SuppressWarnings(STR) void registerMBean() { MXBeanImpl mxBeanInfo = MXBeanImpl.init(this); mxBean = MBeanUtil.registerMBean(STR, STR, mxBeanInfo); LOG.info(STR); }
/** * Register bean with platform management server */
Register bean with platform management server
registerMBean
{ "repo_name": "indi60/hbase-pmc", "path": "target/hbase-0.94.1/hbase-0.94.1/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java", "license": "apache-2.0", "size": 131335 }
[ "org.apache.hadoop.metrics.util.MBeanUtil" ]
import org.apache.hadoop.metrics.util.MBeanUtil;
import org.apache.hadoop.metrics.util.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,388,944
public void setRawObject(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) { }
void function(@Nonnull final ISerializer serializer, @Nonnull final JsonObject json) { }
/** * Sets the raw JSON object * * @param serializer the serializer * @param json the JSON object to set this object to */
Sets the raw JSON object
setRawObject
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/models/MessageRulePredicates.java", "license": "mit", "size": 11809 }
[ "com.google.gson.JsonObject", "com.microsoft.graph.serializer.ISerializer", "javax.annotation.Nonnull" ]
import com.google.gson.JsonObject; import com.microsoft.graph.serializer.ISerializer; import javax.annotation.Nonnull;
import com.google.gson.*; import com.microsoft.graph.serializer.*; import javax.annotation.*;
[ "com.google.gson", "com.microsoft.graph", "javax.annotation" ]
com.google.gson; com.microsoft.graph; javax.annotation;
2,162,349
public void begin() throws BeginTransactionException;
void function() throws BeginTransactionException;
/** * Begin a dummy transaction. */
Begin a dummy transaction
begin
{ "repo_name": "Kelvinli1988/mysqlmv", "path": "src/main/java/org/mysqlmv/mvm/sql/transaction/ITransaction.java", "license": "lgpl-3.0", "size": 926 }
[ "org.mysqlmv.mvm.sql.transaction.exception.BeginTransactionException" ]
import org.mysqlmv.mvm.sql.transaction.exception.BeginTransactionException;
import org.mysqlmv.mvm.sql.transaction.exception.*;
[ "org.mysqlmv.mvm" ]
org.mysqlmv.mvm;
2,386,069
public static HRegion createRegionAndWAL(final RegionInfo info, final Path rootDir, final Configuration conf, final TableDescriptor htd, BlockCache blockCache) throws IOException { HRegion region = createRegionAndWAL(info, rootDir, conf, htd, false); region.setBlockCache(blockCache); region.initialize(); return region; }
static HRegion function(final RegionInfo info, final Path rootDir, final Configuration conf, final TableDescriptor htd, BlockCache blockCache) throws IOException { HRegion region = createRegionAndWAL(info, rootDir, conf, htd, false); region.setBlockCache(blockCache); region.initialize(); return region; }
/** * Create a region with it's own WAL. Be sure to call * {@link HBaseTestingUtility#closeRegionAndWAL(HRegion)} to clean up all resources. */
Create a region with it's own WAL. Be sure to call <code>HBaseTestingUtility#closeRegionAndWAL(HRegion)</code> to clean up all resources
createRegionAndWAL
{ "repo_name": "apurtell/hbase", "path": "hbase-testing-util/src/main/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 169342 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hbase.client.RegionInfo", "org.apache.hadoop.hbase.client.TableDescriptor", "org.apache.hadoop.hbase.io.hfile.BlockCache", "org.apache.hadoop.hbase.regionserver.HRegion" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.hadoop.hbase.io.hfile.BlockCache; import org.apache.hadoop.hbase.regionserver.HRegion;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.io.hfile.*; import org.apache.hadoop.hbase.regionserver.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,074,884
@Override public ServiceBusConnectionDetailsResponse getConnectionDetails(String namespaceName, String notificationHubName) throws IOException, ServiceException, ParserConfigurationException, SAXException { // Validate if (namespaceName == null) { throw new NullPointerException("namespaceName"); } if (notificationHubName == null) { throw new NullPointerException("notificationHubName"); } // Tracing boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put("namespaceName", namespaceName); tracingParameters.put("notificationHubName", notificationHubName); CloudTracing.enter(invocationId, this, "getConnectionDetailsAsync", tracingParameters); } // Construct URL String url = ""; url = url + "/"; if (this.getClient().getCredentials().getSubscriptionId() != null) { url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8"); } url = url + "/services/servicebus/namespaces/"; url = url + URLEncoder.encode(namespaceName, "UTF-8"); url = url + "/NotificationHubs/"; url = url + URLEncoder.encode(notificationHubName, "UTF-8"); url = url + "/ConnectionDetails"; String baseUrl = this.getClient().getBaseUri().toString(); // Trim '/' character from the end of baseUrl and beginning of url. if (baseUrl.charAt(baseUrl.length() - 1) == '/') { baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0); } if (url.charAt(0) == '/') { url = url.substring(1); } url = baseUrl + "/" + url; url = url.replace(" ", "%20"); // Create HTTP transport objects HttpGet httpRequest = new HttpGet(url); // Set Headers httpRequest.setHeader("x-ms-version", "2013-08-01"); // Send Request HttpResponse httpResponse = null; try { if (shouldTrace) { CloudTracing.sendRequest(invocationId, httpRequest); } httpResponse = this.getClient().getHttpClient().execute(httpRequest); if (shouldTrace) { CloudTracing.receiveResponse(invocationId, httpResponse); } int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != HttpStatus.SC_OK) { ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity()); if (shouldTrace) { CloudTracing.error(invocationId, ex); } throw ex; } // Create Result ServiceBusConnectionDetailsResponse result = null; // Deserialize Response if (statusCode == HttpStatus.SC_OK) { InputStream responseContent = httpResponse.getEntity().getContent(); result = new ServiceBusConnectionDetailsResponse(); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent)); Element feedElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://www.w3.org/2005/Atom", "feed"); if (feedElement != null) { if (feedElement != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(feedElement, "http://www.w3.org/2005/Atom", "entry").size(); i1 = i1 + 1) { org.w3c.dom.Element entriesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(feedElement, "http://www.w3.org/2005/Atom", "entry").get(i1)); ServiceBusConnectionDetail entryInstance = new ServiceBusConnectionDetail(); result.getConnectionDetails().add(entryInstance); Element contentElement = XmlUtility.getElementByTagNameNS(entriesElement, "http://www.w3.org/2005/Atom", "content"); if (contentElement != null) { Element connectionDetailElement = XmlUtility.getElementByTagNameNS(contentElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ConnectionDetail"); if (connectionDetailElement != null) { Element keyNameElement = XmlUtility.getElementByTagNameNS(connectionDetailElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "KeyName"); if (keyNameElement != null) { String keyNameInstance; keyNameInstance = keyNameElement.getTextContent(); entryInstance.setKeyName(keyNameInstance); } Element connectionStringElement = XmlUtility.getElementByTagNameNS(connectionDetailElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "ConnectionString"); if (connectionStringElement != null) { String connectionStringInstance; connectionStringInstance = connectionStringElement.getTextContent(); entryInstance.setConnectionString(connectionStringInstance); } Element authorizationTypeElement = XmlUtility.getElementByTagNameNS(connectionDetailElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AuthorizationType"); if (authorizationTypeElement != null) { String authorizationTypeInstance; authorizationTypeInstance = authorizationTypeElement.getTextContent(); entryInstance.setAuthorizationType(authorizationTypeInstance); } Element rightsSequenceElement = XmlUtility.getElementByTagNameNS(connectionDetailElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "Rights"); if (rightsSequenceElement != null) { for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(rightsSequenceElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessRights").size(); i2 = i2 + 1) { org.w3c.dom.Element rightsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(rightsSequenceElement, "http://schemas.microsoft.com/netservices/2010/10/servicebus/connect", "AccessRights").get(i2)); entryInstance.getRights().add(AccessRight.valueOf(rightsElement.getTextContent())); } } } } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders("x-ms-request-id").length > 0) { result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
ServiceBusConnectionDetailsResponse function(String namespaceName, String notificationHubName) throws IOException, ServiceException, ParserConfigurationException, SAXException { if (namespaceName == null) { throw new NullPointerException(STR); } if (notificationHubName == null) { throw new NullPointerException(STR); } boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put(STR, namespaceName); tracingParameters.put(STR, notificationHubName); CloudTracing.enter(invocationId, this, STR, tracingParameters); } String url = STR/STRUTF-8STR/services/servicebus/namespaces/STRUTF-8STR/NotificationHubs/STRUTF-8STR/ConnectionDetailsSTR/STR STR%20STRx-ms-versionSTR2013-08-01STRhttp: if (feedElement != null) { if (feedElement != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(feedElement, STRhttp: ServiceBusConnectionDetail entryInstance = new ServiceBusConnectionDetail(); result.getConnectionDetails().add(entryInstance); Element contentElement = XmlUtility.getElementByTagNameNS(entriesElement, STRhttp: if (connectionDetailElement != null) { Element keyNameElement = XmlUtility.getElementByTagNameNS(connectionDetailElement, STRhttp: if (connectionStringElement != null) { String connectionStringInstance; connectionStringInstance = connectionStringElement.getTextContent(); entryInstance.setConnectionString(connectionStringInstance); } Element authorizationTypeElement = XmlUtility.getElementByTagNameNS(connectionDetailElement, STRhttp: if (rightsSequenceElement != null) { for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(rightsSequenceElement, STRhttp: entryInstance.getRights().add(AccessRight.valueOf(rightsElement.getTextContent())); } } } } } } } } result.setStatusCode(statusCode); if (httpResponse.getHeaders(STR).length > 0) { result.setRequestId(httpResponse.getFirstHeader(STR).getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
/** * Lists the notification hubs associated with a namespace. * * @param namespaceName Required. The namespace name. * @param notificationHubName Required. The notification hub name. * @throws IOException Signals that an I/O exception of some sort has * occurred. This class is the general class of exceptions produced by * failed or interrupted I/O operations. * @throws ServiceException Thrown if an unexpected response is found. * @throws ParserConfigurationException Thrown if there was a serious * configuration error with the document parser. * @throws SAXException Thrown if there was an error parsing the XML * response. * @return The set of connection details for a service bus entity. */
Lists the notification hubs associated with a namespace
getConnectionDetails
{ "repo_name": "southworkscom/azure-sdk-for-java", "path": "service-management/azure-svc-mgmt-servicebus/src/main/java/com/microsoft/windowsazure/management/servicebus/NotificationHubOperationsImpl.java", "license": "apache-2.0", "size": 48376 }
[ "com.microsoft.windowsazure.core.utils.XmlUtility", "com.microsoft.windowsazure.exception.ServiceException", "com.microsoft.windowsazure.management.servicebus.models.AccessRight", "com.microsoft.windowsazure.management.servicebus.models.ServiceBusConnectionDetail", "com.microsoft.windowsazure.management.servicebus.models.ServiceBusConnectionDetailsResponse", "com.microsoft.windowsazure.tracing.CloudTracing", "java.io.IOException", "java.util.HashMap", "javax.xml.parsers.ParserConfigurationException", "org.w3c.dom.Element", "org.xml.sax.SAXException" ]
import com.microsoft.windowsazure.core.utils.XmlUtility; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.management.servicebus.models.AccessRight; import com.microsoft.windowsazure.management.servicebus.models.ServiceBusConnectionDetail; import com.microsoft.windowsazure.management.servicebus.models.ServiceBusConnectionDetailsResponse; import com.microsoft.windowsazure.tracing.CloudTracing; import java.io.IOException; import java.util.HashMap; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Element; import org.xml.sax.SAXException;
import com.microsoft.windowsazure.core.utils.*; import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.management.servicebus.models.*; import com.microsoft.windowsazure.tracing.*; import java.io.*; import java.util.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "com.microsoft.windowsazure", "java.io", "java.util", "javax.xml", "org.w3c.dom", "org.xml.sax" ]
com.microsoft.windowsazure; java.io; java.util; javax.xml; org.w3c.dom; org.xml.sax;
626,982
public void migrateInterfaceChanges(final Ooaofooa modelRoot, Component_c component, CD_CID cid) { // ensure that all interfaces have been // loaded if (modelRoot.getRoot() == null) { SystemModel_c system = SystemModel_c.SystemModelInstance(Ooaofooa .getDefaultInstance(), new ClassQueryInterface_c() {
void function(final Ooaofooa modelRoot, Component_c component, CD_CID cid) { if (modelRoot.getRoot() == null) { SystemModel_c system = SystemModel_c.SystemModelInstance(Ooaofooa .getDefaultInstance(), new ClassQueryInterface_c() {
/** * This function is used to migrate 1.4.2-based provisions and * requirements to 1.5.x provisions and requirements with ports * and interface references. * @param cid */
This function is used to migrate 1.4.2-based provisions and requirements to 1.5.x provisions and requirements with ports and interface references
migrateInterfaceChanges
{ "repo_name": "perojonsson/bridgepoint", "path": "src/org.xtuml.bp.io.core/src/org/xtuml/bp/io/core/ImportHelper.java", "license": "apache-2.0", "size": 111259 }
[ "org.xtuml.bp.core.Ooaofooa" ]
import org.xtuml.bp.core.Ooaofooa;
import org.xtuml.bp.core.*;
[ "org.xtuml.bp" ]
org.xtuml.bp;
228,638
@Override public void injectEvents(HandlerManager eventBus) { // TODO Auto-generated method stub }
void function(HandlerManager eventBus) { }
/** * To handle events. * * @param eventBus HandlerManager */
To handle events
injectEvents
{ "repo_name": "kuzavas/ephesoft", "path": "dcma-gwt/dcma-gwt-admin/src/main/java/com/ephesoft/dcma/gwt/admin/bm/client/presenter/tableinfo/TableInfoListPresenter.java", "license": "agpl-3.0", "size": 4418 }
[ "com.google.gwt.event.shared.HandlerManager" ]
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.*;
[ "com.google.gwt" ]
com.google.gwt;
1,722,270
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_5_.getCurrentEquippedItem() != null && p_149727_5_.getCurrentEquippedItem().getItem() == Items.flint_and_steel) { this.func_150114_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, 1, p_149727_5_); p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_); p_149727_5_.getCurrentEquippedItem().damageItem(1, p_149727_5_); return true; } else { return super.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); } }
boolean function(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_5_.getCurrentEquippedItem() != null && p_149727_5_.getCurrentEquippedItem().getItem() == Items.flint_and_steel) { this.func_150114_a(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, 1, p_149727_5_); p_149727_1_.setBlockToAir(p_149727_2_, p_149727_3_, p_149727_4_); p_149727_5_.getCurrentEquippedItem().damageItem(1, p_149727_5_); return true; } else { return super.onBlockActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_, p_149727_6_, p_149727_7_, p_149727_8_, p_149727_9_); } }
/** * Called upon block activation (right click on the block.) */
Called upon block activation (right click on the block.)
onBlockActivated
{ "repo_name": "CheeseL0ver/Ore-TTM", "path": "build/tmp/recompSrc/net/minecraft/block/BlockTNT.java", "license": "lgpl-2.1", "size": 6592 }
[ "net.minecraft.entity.player.EntityPlayer", "net.minecraft.init.Items", "net.minecraft.world.World" ]
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.world.World;
import net.minecraft.entity.player.*; import net.minecraft.init.*; import net.minecraft.world.*;
[ "net.minecraft.entity", "net.minecraft.init", "net.minecraft.world" ]
net.minecraft.entity; net.minecraft.init; net.minecraft.world;
478,407
@Test public void testByte2Byte() { try { Message message = senderSession.createMessage(); message.setByteProperty("prop", (byte) 127); Assert.assertEquals((byte) 127, message.getByteProperty("prop")); } catch (JMSException e) { fail(e); } }
void function() { try { Message message = senderSession.createMessage(); message.setByteProperty("prop", (byte) 127); Assert.assertEquals((byte) 127, message.getByteProperty("prop")); } catch (JMSException e) { fail(e); } }
/** * if a property is set as a <code>byte</code>, * it can also be read as a <code>byte</code>. */
if a property is set as a <code>byte</code>, it can also be read as a <code>byte</code>
testByte2Byte
{ "repo_name": "cshannon/activemq-artemis", "path": "tests/joram-tests/src/test/java/org/objectweb/jtests/jms/conform/message/properties/MessagePropertyConversionTest.java", "license": "apache-2.0", "size": 43771 }
[ "javax.jms.JMSException", "javax.jms.Message", "org.junit.Assert" ]
import javax.jms.JMSException; import javax.jms.Message; import org.junit.Assert;
import javax.jms.*; import org.junit.*;
[ "javax.jms", "org.junit" ]
javax.jms; org.junit;
11,464
ContainerViewVariable getContainerView();
ContainerViewVariable getContainerView();
/** * Returns the value of the '<em><b>Container View</b></em>' containment * reference. <!-- begin-user-doc --> <!-- end-user-doc --> <!-- * begin-model-doc --> The view that contains the ViewPointElement to * delete. <!-- end-model-doc --> * * @return the value of the '<em>Container View</em>' containment reference. * @see #setContainerView(ContainerViewVariable) * @see org.eclipse.sirius.diagram.description.tool.ToolPackage#getDeleteElementDescription_ContainerView() * @model containment="true" resolveProxies="true" required="true" * @generated */
Returns the value of the 'Container View' containment reference. The view that contains the ViewPointElement to delete.
getContainerView
{ "repo_name": "FTSRG/iq-sirius-integration", "path": "host/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/tool/DeleteElementDescription.java", "license": "epl-1.0", "size": 7879 }
[ "org.eclipse.sirius.viewpoint.description.tool.ContainerViewVariable" ]
import org.eclipse.sirius.viewpoint.description.tool.ContainerViewVariable;
import org.eclipse.sirius.viewpoint.description.tool.*;
[ "org.eclipse.sirius" ]
org.eclipse.sirius;
2,432,177
public MetricName metricName(String name, String group, String description) { return metricName(name, group, description, new HashMap<String, String>()); }
MetricName function(String name, String group, String description) { return metricName(name, group, description, new HashMap<String, String>()); }
/** * Create a MetricName with the given name, group, description, and default tags * specified in the metric configuration. * * @param name The name of the metric * @param group logical group name of the metrics to which this metric belongs * @param description A human-readable description to include in the metric */
Create a MetricName with the given name, group, description, and default tags specified in the metric configuration
metricName
{ "repo_name": "lemonJun/Jkafka", "path": "jkafka-core/src/main/java/kafka/metrics/Metrics.java", "license": "apache-2.0", "size": 18614 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,501,980
public void setFooterProgressDrawable(Drawable indeterminateDrawable) { mFooterProgress.setIndeterminateDrawable(indeterminateDrawable); }
void function(Drawable indeterminateDrawable) { mFooterProgress.setIndeterminateDrawable(indeterminateDrawable); }
/** * * Set custom drawable to the footer view progress. * @return * @throws */
Set custom drawable to the footer view progress
setFooterProgressDrawable
{ "repo_name": "yinglovezhuzhu/PullView_eclipse", "path": "PullView/src/com/opensource/pullview/PullFooterView2.java", "license": "apache-2.0", "size": 6460 }
[ "android.graphics.drawable.Drawable" ]
import android.graphics.drawable.Drawable;
import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
2,176,211
EClass getProgramStatus();
EClass getProgramStatus();
/** * Returns the meta object for class '{@link org.smeup.sys.os.pgm.QProgramStatus <em>Program Status</em>}'. * <!-- begin-user-doc --> <!-- end-user-doc --> * @return the meta object for class '<em>Program Status</em>'. * @see org.smeup.sys.os.pgm.QProgramStatus * @generated */
Returns the meta object for class '<code>org.smeup.sys.os.pgm.QProgramStatus Program Status</code>'.
getProgramStatus
{ "repo_name": "smeup/asup", "path": "org.smeup.sys.os.pgm/src/org/smeup/sys/os/pgm/QOperatingSystemProgramPackage.java", "license": "epl-1.0", "size": 33128 }
[ "org.eclipse.emf.ecore.EClass" ]
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,374,159
public void setPrintObjectAttrs(NPCPID idCodePoint, NPCPAttribute cpAttrs, int type) { cpID_ = idCodePoint; attrs = cpAttrs; objectType_ = type; try { cpID_.setConverter(ConverterImplRemote.getConverter(system_.getCcsid(), system_)); if (attrs != null) attrs.setConverter(ConverterImplRemote.getConverter(system_.getCcsid(), system_)); } catch(UnsupportedEncodingException e) { if (Trace.isTraceErrorOn()) Trace.log(Trace.ERROR, "Error initializing converter for print object", e); } }
void function(NPCPID idCodePoint, NPCPAttribute cpAttrs, int type) { cpID_ = idCodePoint; attrs = cpAttrs; objectType_ = type; try { cpID_.setConverter(ConverterImplRemote.getConverter(system_.getCcsid(), system_)); if (attrs != null) attrs.setConverter(ConverterImplRemote.getConverter(system_.getCcsid(), system_)); } catch(UnsupportedEncodingException e) { if (Trace.isTraceErrorOn()) Trace.log(Trace.ERROR, STR, e); } }
/** * Sets the print object attributes. * This method is required so changes in the public class * are propogated to this remote implementation of the class. * * @param idCodePoint The ID code point * @param cpAttrs The code point attributes * @param type The type. **/
Sets the print object attributes. This method is required so changes in the public class are propogated to this remote implementation of the class
setPrintObjectAttrs
{ "repo_name": "devjunix/libjt400-java", "path": "src/com/ibm/as400/access/PrintObjectImplRemote.java", "license": "epl-1.0", "size": 28406 }
[ "java.io.UnsupportedEncodingException" ]
import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
2,560,564
public Void visitClass(ClassTree ct, Void _) { TypeElement e = (TypeElement) TreeUtil.getElement(ct); if(e!=null) { // put the marker on the class name portion. Token token=null; if(ct.getModifiers()!=null) token = gen.findTokenAfter(ct.getModifiers(), true, ct.getSimpleName().toString()); // on enum class, like "public enum En {ABC,DEF}", the above returns null somehow. // so go with the plan B if it's not found. // TODO: report to javac team if(token==null) token = gen.findTokenAfter(ct, false, ct.getSimpleName().toString()); if(token!=null) gen.add(new DeclName(lineMap, token)); List<ParsedType> descendants = getParsedType(e).descendants; gen.add(new ClassDecl(cu, srcPos, ct, e, descendants)); if(e.getNestingKind()== NestingKind.ANONYMOUS) { // don't visit the extends and implements clause as // they already show up in the NewClassTree scan(ct.getMembers()); return _; } } return super.visitClass(ct, _); }
Void function(ClassTree ct, Void _) { TypeElement e = (TypeElement) TreeUtil.getElement(ct); if(e!=null) { Token token=null; if(ct.getModifiers()!=null) token = gen.findTokenAfter(ct.getModifiers(), true, ct.getSimpleName().toString()); if(token==null) token = gen.findTokenAfter(ct, false, ct.getSimpleName().toString()); if(token!=null) gen.add(new DeclName(lineMap, token)); List<ParsedType> descendants = getParsedType(e).descendants; gen.add(new ClassDecl(cu, srcPos, ct, e, descendants)); if(e.getNestingKind()== NestingKind.ANONYMOUS) { scan(ct.getMembers()); return _; } } return super.visitClass(ct, _); }
/** * Class declaration. */
Class declaration
visitClass
{ "repo_name": "kohsuke/sorcerer", "path": "core/src/main/java/org/jvnet/sorcerer/ParsedSourceSet.java", "license": "mit", "size": 25942 }
[ "com.sun.source.tree.ClassTree", "java.util.List", "javax.lang.model.element.NestingKind", "javax.lang.model.element.TypeElement", "org.jvnet.sorcerer.Tag", "org.jvnet.sorcerer.util.TreeUtil" ]
import com.sun.source.tree.ClassTree; import java.util.List; import javax.lang.model.element.NestingKind; import javax.lang.model.element.TypeElement; import org.jvnet.sorcerer.Tag; import org.jvnet.sorcerer.util.TreeUtil;
import com.sun.source.tree.*; import java.util.*; import javax.lang.model.element.*; import org.jvnet.sorcerer.*; import org.jvnet.sorcerer.util.*;
[ "com.sun.source", "java.util", "javax.lang", "org.jvnet.sorcerer" ]
com.sun.source; java.util; javax.lang; org.jvnet.sorcerer;
441,152
public static synchronized void end(String name, MemoryInfo memoryInfo) { final long eventId = name.hashCode(); TraceEvent.finishAsync(name, eventId); if (sEnabled && matchesFilter(name)) { if (sTrackTiming) { savePerfString(name, eventId, EventType.FINISH, false); } // Done after calculating the instant perf data to ensure calculating the memory usage // does not influence the timing data. long timestampUs = (System.nanoTime() - sBeginNanoTime) / 1000; savePerfString(makeMemoryTraceNameFromTimingName(name), eventId, EventType.FINISH, timestampUs, memoryInfo); } }
static synchronized void function(String name, MemoryInfo memoryInfo) { final long eventId = name.hashCode(); TraceEvent.finishAsync(name, eventId); if (sEnabled && matchesFilter(name)) { if (sTrackTiming) { savePerfString(name, eventId, EventType.FINISH, false); } long timestampUs = (System.nanoTime() - sBeginNanoTime) / 1000; savePerfString(makeMemoryTraceNameFromTimingName(name), eventId, EventType.FINISH, timestampUs, memoryInfo); } }
/** * Record an "end" memory trace event, to match a begin event. The * memory usage delta between begin and end is usually interesting to * graph code. */
Record an "end" memory trace event, to match a begin event. The memory usage delta between begin and end is usually interesting to graph code
end
{ "repo_name": "yuzaipiaofei/chromium_webview", "path": "java/src/org/chromium/base/PerfTraceEvent.java", "license": "bsd-3-clause", "size": 13470 }
[ "android.os.Debug" ]
import android.os.Debug;
import android.os.*;
[ "android.os" ]
android.os;
25,439
protected void processRevealEffect() { if ((mDrawMode != DecoEvent.EventType.EVENT_HIDE) && (mDrawMode != DecoEvent.EventType.EVENT_SHOW)) { if (mSeriesItem.getLineWidth() != mPaint.getStrokeWidth()) { mPaint.setStrokeWidth(mSeriesItem.getLineWidth()); } return; } float lineWidth = mSeriesItem.getLineWidth(); if (mPercentComplete > 0) { lineWidth *= (1.0f - mPercentComplete); mPaint.setAlpha((int) (Color.alpha(mSeriesItem.getColor()) * (1.0f - mPercentComplete))); } else { mPaint.setAlpha(Color.alpha(mSeriesItem.getColor())); } mPaint.setStrokeWidth(lineWidth); }
void function() { if ((mDrawMode != DecoEvent.EventType.EVENT_HIDE) && (mDrawMode != DecoEvent.EventType.EVENT_SHOW)) { if (mSeriesItem.getLineWidth() != mPaint.getStrokeWidth()) { mPaint.setStrokeWidth(mSeriesItem.getLineWidth()); } return; } float lineWidth = mSeriesItem.getLineWidth(); if (mPercentComplete > 0) { lineWidth *= (1.0f - mPercentComplete); mPaint.setAlpha((int) (Color.alpha(mSeriesItem.getColor()) * (1.0f - mPercentComplete))); } else { mPaint.setAlpha(Color.alpha(mSeriesItem.getColor())); } mPaint.setStrokeWidth(lineWidth); }
/** * Adjust the line width used when the hide animation is taking place. This will reduce the * line width from the original width to nothing over time. At the same this the alpha of the * line will be reduced to nothing */
Adjust the line width used when the hide animation is taking place. This will reduce the line width from the original width to nothing over time. At the same this the alpha of the line will be reduced to nothing
processRevealEffect
{ "repo_name": "bmarrdev/android-DecoView-charting", "path": "decoviewlib/src/main/java/com/hookedonplay/decoviewlib/charts/ChartSeries.java", "license": "apache-2.0", "size": 25410 }
[ "android.graphics.Color", "com.hookedonplay.decoviewlib.events.DecoEvent" ]
import android.graphics.Color; import com.hookedonplay.decoviewlib.events.DecoEvent;
import android.graphics.*; import com.hookedonplay.decoviewlib.events.*;
[ "android.graphics", "com.hookedonplay.decoviewlib" ]
android.graphics; com.hookedonplay.decoviewlib;
893,797
private static void createTitle(final Shell shell, final String title, final NotifierColors colors) { final Label titleLabel = new Label(shell, SWT.NONE); final GridData gdLabel = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1); gdLabel.horizontalIndent = 40; titleLabel.setLayoutData(gdLabel); final Color titleColor = colors.titleColor; titleLabel.setForeground(titleColor); final Font titleFont = SWTResourceManager.getFont(titleLabel.getFont().getFontData()[0].getName(), FONT_SIZE, SWT.BOLD); titleLabel.setFont(titleFont); titleLabel.setText(title == null ? new String() : title); }
static void function(final Shell shell, final String title, final NotifierColors colors) { final Label titleLabel = new Label(shell, SWT.NONE); final GridData gdLabel = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1); gdLabel.horizontalIndent = 40; titleLabel.setLayoutData(gdLabel); final Color titleColor = colors.titleColor; titleLabel.setForeground(titleColor); final Font titleFont = SWTResourceManager.getFont(titleLabel.getFont().getFontData()[0].getName(), FONT_SIZE, SWT.BOLD); titleLabel.setFont(titleFont); titleLabel.setText(title == null ? new String() : title); }
/** * Creates the title part of the window * * @param shell * the window * @param title * the title * @param colors * the color set */
Creates the title part of the window
createTitle
{ "repo_name": "Agem-Bilisim/lider-console", "path": "lider-console-core/src/tr/org/liderahenk/liderconsole/core/widgets/Notifier.java", "license": "lgpl-3.0", "size": 17349 }
[ "org.eclipse.swt.graphics.Color", "org.eclipse.swt.graphics.Font", "org.eclipse.swt.layout.GridData", "org.eclipse.swt.widgets.Label", "org.eclipse.swt.widgets.Shell", "tr.org.liderahenk.liderconsole.core.utils.SWTResourceManager" ]
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import tr.org.liderahenk.liderconsole.core.utils.SWTResourceManager;
import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import tr.org.liderahenk.liderconsole.core.utils.*;
[ "org.eclipse.swt", "tr.org.liderahenk" ]
org.eclipse.swt; tr.org.liderahenk;
1,853,484
private DnsServerAddressStream getNameServersFromCache(String hostname) { int len = hostname.length(); if (len == 0) { // We never cache for root servers. return null; } // We always store in the cache with a trailing '.'. if (hostname.charAt(len - 1) != '.') { hostname += "."; } int idx = hostname.indexOf('.'); if (idx == hostname.length() - 1) { // We are not interested in handling '.' as we should never serve the root servers from cache. return null; } // We start from the closed match and then move down. for (;;) { // Skip '.' as well. hostname = hostname.substring(idx + 1); int idx2 = hostname.indexOf('.'); if (idx2 <= 0 || idx2 == hostname.length() - 1) { // We are not interested in handling '.TLD.' as we should never serve the root servers from cache. return null; } idx = idx2; List<? extends DnsCacheEntry> entries = parent.authoritativeDnsServerCache().get(hostname, additionals); if (entries != null && !entries.isEmpty()) { return DnsServerAddresses.sequential(new DnsCacheIterable(entries)).stream(); } } } private final class DnsCacheIterable implements Iterable<InetSocketAddress> { private final List<? extends DnsCacheEntry> entries; DnsCacheIterable(List<? extends DnsCacheEntry> entries) { this.entries = entries; }
DnsServerAddressStream function(String hostname) { int len = hostname.length(); if (len == 0) { return null; } if (hostname.charAt(len - 1) != '.') { hostname += "."; } int idx = hostname.indexOf('.'); if (idx == hostname.length() - 1) { return null; } for (;;) { hostname = hostname.substring(idx + 1); int idx2 = hostname.indexOf('.'); if (idx2 <= 0 idx2 == hostname.length() - 1) { return null; } idx = idx2; List<? extends DnsCacheEntry> entries = parent.authoritativeDnsServerCache().get(hostname, additionals); if (entries != null && !entries.isEmpty()) { return DnsServerAddresses.sequential(new DnsCacheIterable(entries)).stream(); } } } private final class DnsCacheIterable implements Iterable<InetSocketAddress> { private final List<? extends DnsCacheEntry> entries; DnsCacheIterable(List<? extends DnsCacheEntry> entries) { this.entries = entries; }
/** * Returns the {@link DnsServerAddressStream} that was cached for the given hostname or {@code null} if non * could be found. */
Returns the <code>DnsServerAddressStream</code> that was cached for the given hostname or null if non could be found
getNameServersFromCache
{ "repo_name": "Apache9/netty", "path": "resolver-dns/src/main/java/io/netty/resolver/dns/DnsNameResolverContext.java", "license": "apache-2.0", "size": 36868 }
[ "java.net.InetSocketAddress", "java.util.List" ]
import java.net.InetSocketAddress; import java.util.List;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
1,437,626
@Test @MediumTest @Features.EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_SETTINGS_3) public void testOpenAdPersonalizationSettings() throws IOException { loadUrlAndOpenPageInfo( mTestServerRule.getServer().getURLWithHostName("example.com", sSimpleHtml)); onView(withId(PageInfoAdPersonalizationController.ROW_ID)).perform(click()); onViewWaiting(allOf(withText(R.string.page_info_ad_manage_interests), isDisplayed())) .perform(click()); // Check that settings are displayed. onView(withText(R.string.privacy_sandbox_topic_interests_category)) .check(matches(isDisplayed())); // Leave settings view. onView(withContentDescription("Navigate up")).perform(click()); onView(withText(R.string.privacy_sandbox_topic_interests_category)).check(doesNotExist()); } // TODO(1071762): Add tests for preview pages, offline pages, offline state and other states.
@Features.EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_SETTINGS_3) void function() throws IOException { loadUrlAndOpenPageInfo( mTestServerRule.getServer().getURLWithHostName(STR, sSimpleHtml)); onView(withId(PageInfoAdPersonalizationController.ROW_ID)).perform(click()); onViewWaiting(allOf(withText(R.string.page_info_ad_manage_interests), isDisplayed())) .perform(click()); onView(withText(R.string.privacy_sandbox_topic_interests_category)) .check(matches(isDisplayed())); onView(withContentDescription(STR)).perform(click()); onView(withText(R.string.privacy_sandbox_topic_interests_category)).check(doesNotExist()); }
/** * Tests opening ad personalization settings. */
Tests opening ad personalization settings
testOpenAdPersonalizationSettings
{ "repo_name": "chromium/chromium", "path": "chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java", "license": "bsd-3-clause", "size": 36581 }
[ "androidx.test.espresso.Espresso", "androidx.test.espresso.matcher.ViewMatchers", "java.io.IOException", "org.chromium.chrome.browser.flags.ChromeFeatureList", "org.chromium.chrome.test.util.browser.Features", "org.chromium.components.page_info.PageInfoAdPersonalizationController", "org.chromium.ui.test.util.ViewUtils" ]
import androidx.test.espresso.Espresso; import androidx.test.espresso.matcher.ViewMatchers; import java.io.IOException; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.test.util.browser.Features; import org.chromium.components.page_info.PageInfoAdPersonalizationController; import org.chromium.ui.test.util.ViewUtils;
import androidx.test.espresso.*; import androidx.test.espresso.matcher.*; import java.io.*; import org.chromium.chrome.browser.flags.*; import org.chromium.chrome.test.util.browser.*; import org.chromium.components.page_info.*; import org.chromium.ui.test.util.*;
[ "androidx.test", "java.io", "org.chromium.chrome", "org.chromium.components", "org.chromium.ui" ]
androidx.test; java.io; org.chromium.chrome; org.chromium.components; org.chromium.ui;
2,626,568
@Override public void getTask(@NonNull String taskId, @NonNull GetTaskCallback callback) { SQLiteDatabase db = mDbHelper.getReadableDatabase(); String[] projection = { TasksPersistenceContract.TaskEntry.COLUMN_NAME_ENTRY_ID, TasksPersistenceContract.TaskEntry.COLUMN_NAME_TITLE, TasksPersistenceContract.TaskEntry.COLUMN_NAME_DESCRIPTION, TasksPersistenceContract.TaskEntry.COLUMN_NAME_COMPLETED }; String selection = TasksPersistenceContract.TaskEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?"; String[] selectionArgs = { taskId }; Cursor c = db.query( TasksPersistenceContract.TaskEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, null); HomeInfo task = null; // // if (c != null && c.getCount() > 0) { // c.moveToFirst(); // String itemId = c.getString(c.getColumnIndexOrThrow(TaskEntry.COLUMN_NAME_ENTRY_ID)); // String title = c.getString(c.getColumnIndexOrThrow(TaskEntry.COLUMN_NAME_TITLE)); // String description = // c.getString(c.getColumnIndexOrThrow(TaskEntry.COLUMN_NAME_DESCRIPTION)); // boolean completed = // c.getInt(c.getColumnIndexOrThrow(TaskEntry.COLUMN_NAME_COMPLETED)) == 1; // task = new Task(title, description, itemId, completed); // } if (c != null) { c.close(); } db.close(); if (task != null) { callback.onTaskLoaded(task); } else { callback.onDataNotAvailable(); } }
void function(@NonNull String taskId, @NonNull GetTaskCallback callback) { SQLiteDatabase db = mDbHelper.getReadableDatabase(); String[] projection = { TasksPersistenceContract.TaskEntry.COLUMN_NAME_ENTRY_ID, TasksPersistenceContract.TaskEntry.COLUMN_NAME_TITLE, TasksPersistenceContract.TaskEntry.COLUMN_NAME_DESCRIPTION, TasksPersistenceContract.TaskEntry.COLUMN_NAME_COMPLETED }; String selection = TasksPersistenceContract.TaskEntry.COLUMN_NAME_ENTRY_ID + STR; String[] selectionArgs = { taskId }; Cursor c = db.query( TasksPersistenceContract.TaskEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, null); HomeInfo task = null; if (c != null) { c.close(); } db.close(); if (task != null) { callback.onTaskLoaded(task); } else { callback.onDataNotAvailable(); } }
/** * Note: {@link GetTaskCallback#onDataNotAvailable()} is fired if the {@link } isn't * found. */
Note: <code>GetTaskCallback#onDataNotAvailable()</code> is fired if the isn't found
getTask
{ "repo_name": "xiaowei20152012/LeeApp", "path": "todo/picomponent/src/main/java/com/todo/pic/data/local/TasksLocalDataSource.java", "license": "apache-2.0", "size": 8435 }
[ "android.database.Cursor", "android.database.sqlite.SQLiteDatabase", "android.support.annotation.NonNull", "com.todo.pic.domain.model.HomeInfo" ]
import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.annotation.NonNull; import com.todo.pic.domain.model.HomeInfo;
import android.database.*; import android.database.sqlite.*; import android.support.annotation.*; import com.todo.pic.domain.model.*;
[ "android.database", "android.support", "com.todo.pic" ]
android.database; android.support; com.todo.pic;
2,521,917
@SuppressWarnings("static-method") @Test public void testGetSegmentStreams_invalidDownsampleType() throws Exception { RateLimitedTestRunner.run(() -> { try { TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, StravaStreamResolutionType.LOW, StravaStreamSeriesDownsamplingType.UNKNOWN); } catch (final IllegalArgumentException e) { // Expected return; } fail("Didn't throw an exception when asking for an invalid downsample type"); //$NON-NLS-1$ }); }
@SuppressWarnings(STR) void function() throws Exception { RateLimitedTestRunner.run(() -> { try { TestUtils.strava().getSegmentStreams(SegmentDataUtils.SEGMENT_VALID_ID, StravaStreamResolutionType.LOW, StravaStreamSeriesDownsamplingType.UNKNOWN); } catch (final IllegalArgumentException e) { return; } fail(STR); }); }
/** * <p> * Invalid downsample type * </p> * * @throws Exception * if the test fails in an unexpected way */
Invalid downsample type
testGetSegmentStreams_invalidDownsampleType
{ "repo_name": "danshannon/javastrava-test", "path": "src/main/java/test/service/impl/streamservice/GetSegmentStreamsTest.java", "license": "apache-2.0", "size": 6120 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
934,207
public void setUserProperties(List<PDUserProperty> userProperties) { COSArray p = new COSArray(); for (PDUserProperty userProperty : userProperties) { p.add(userProperty); } this.getCOSObject().setItem(COSName.P, p); }
void function(List<PDUserProperty> userProperties) { COSArray p = new COSArray(); for (PDUserProperty userProperty : userProperties) { p.add(userProperty); } this.getCOSObject().setItem(COSName.P, p); }
/** * Sets the user properties. * * @param userProperties the user properties */
Sets the user properties
setUserProperties
{ "repo_name": "ZhenyaM/veraPDF-pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/documentinterchange/logicalstructure/PDUserAttributeObject.java", "license": "apache-2.0", "size": 3624 }
[ "java.util.List", "org.apache.pdfbox.cos.COSArray", "org.apache.pdfbox.cos.COSName" ]
import java.util.List; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSName;
import java.util.*; import org.apache.pdfbox.cos.*;
[ "java.util", "org.apache.pdfbox" ]
java.util; org.apache.pdfbox;
934,891
protected Size2D arrangeFF(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { double[] w = new double[5]; double[] h = new double[5]; w[0] = constraint.getWidth(); if (this.topBlock != null) { RectangleConstraint c1 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight()), LengthConstraintType.RANGE); Size2D size = this.topBlock.arrange(g2, c1); h[0] = size.height; } w[1] = w[0]; if (this.bottomBlock != null) { RectangleConstraint c2 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight() - h[0]), LengthConstraintType.RANGE); Size2D size = this.bottomBlock.arrange(g2, c2); h[1] = size.height; } h[2] = constraint.getHeight() - h[1] - h[0]; if (this.leftBlock != null) { RectangleConstraint c3 = new RectangleConstraint(0.0, new Range(0.0, constraint.getWidth()), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED); Size2D size = this.leftBlock.arrange(g2, c3); w[2] = size.width; } h[3] = h[2]; if (this.rightBlock != null) { RectangleConstraint c4 = new RectangleConstraint(0.0, new Range(0.0, Math.max(constraint.getWidth() - w[2], 0.0)), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED); Size2D size = this.rightBlock.arrange(g2, c4); w[3] = size.width; } h[4] = h[2]; w[4] = constraint.getWidth() - w[3] - w[2]; RectangleConstraint c5 = new RectangleConstraint(w[4], h[4]); if (this.centerBlock != null) { this.centerBlock.arrange(g2, c5); } if (this.topBlock != null) { this.topBlock.setBounds(new Rectangle2D.Double(0.0, 0.0, w[0], h[0])); } if (this.bottomBlock != null) { this.bottomBlock.setBounds(new Rectangle2D.Double(0.0, h[0] + h[2], w[1], h[1])); } if (this.leftBlock != null) { this.leftBlock.setBounds(new Rectangle2D.Double(0.0, h[0], w[2], h[2])); } if (this.rightBlock != null) { this.rightBlock.setBounds(new Rectangle2D.Double(w[2] + w[4], h[0], w[3], h[3])); } if (this.centerBlock != null) { this.centerBlock.setBounds(new Rectangle2D.Double(w[2], h[0], w[4], h[4])); } return new Size2D(constraint.getWidth(), constraint.getHeight()); }
Size2D function(BlockContainer container, Graphics2D g2, RectangleConstraint constraint) { double[] w = new double[5]; double[] h = new double[5]; w[0] = constraint.getWidth(); if (this.topBlock != null) { RectangleConstraint c1 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight()), LengthConstraintType.RANGE); Size2D size = this.topBlock.arrange(g2, c1); h[0] = size.height; } w[1] = w[0]; if (this.bottomBlock != null) { RectangleConstraint c2 = new RectangleConstraint(w[0], null, LengthConstraintType.FIXED, 0.0, new Range(0.0, constraint.getHeight() - h[0]), LengthConstraintType.RANGE); Size2D size = this.bottomBlock.arrange(g2, c2); h[1] = size.height; } h[2] = constraint.getHeight() - h[1] - h[0]; if (this.leftBlock != null) { RectangleConstraint c3 = new RectangleConstraint(0.0, new Range(0.0, constraint.getWidth()), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED); Size2D size = this.leftBlock.arrange(g2, c3); w[2] = size.width; } h[3] = h[2]; if (this.rightBlock != null) { RectangleConstraint c4 = new RectangleConstraint(0.0, new Range(0.0, Math.max(constraint.getWidth() - w[2], 0.0)), LengthConstraintType.RANGE, h[2], null, LengthConstraintType.FIXED); Size2D size = this.rightBlock.arrange(g2, c4); w[3] = size.width; } h[4] = h[2]; w[4] = constraint.getWidth() - w[3] - w[2]; RectangleConstraint c5 = new RectangleConstraint(w[4], h[4]); if (this.centerBlock != null) { this.centerBlock.arrange(g2, c5); } if (this.topBlock != null) { this.topBlock.setBounds(new Rectangle2D.Double(0.0, 0.0, w[0], h[0])); } if (this.bottomBlock != null) { this.bottomBlock.setBounds(new Rectangle2D.Double(0.0, h[0] + h[2], w[1], h[1])); } if (this.leftBlock != null) { this.leftBlock.setBounds(new Rectangle2D.Double(0.0, h[0], w[2], h[2])); } if (this.rightBlock != null) { this.rightBlock.setBounds(new Rectangle2D.Double(w[2] + w[4], h[0], w[3], h[3])); } if (this.centerBlock != null) { this.centerBlock.setBounds(new Rectangle2D.Double(w[2], h[0], w[4], h[4])); } return new Size2D(constraint.getWidth(), constraint.getHeight()); }
/** * Arranges the items within a container. * * @param container the container. * @param constraint the constraint. * @param g2 the graphics device. * * @return The container size after the arrangement. */
Arranges the items within a container
arrangeFF
{ "repo_name": "JSansalone/JFreeChart", "path": "source/org/jfree/chart/block/BorderArrangement.java", "license": "lgpl-2.1", "size": 19786 }
[ "java.awt.Graphics2D", "java.awt.geom.Rectangle2D", "org.jfree.data.Range", "org.jfree.ui.Size2D" ]
import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.data.Range; import org.jfree.ui.Size2D;
import java.awt.*; import java.awt.geom.*; import org.jfree.data.*; import org.jfree.ui.*;
[ "java.awt", "org.jfree.data", "org.jfree.ui" ]
java.awt; org.jfree.data; org.jfree.ui;
1,201,241
public Observable<ServiceResponse<Page<ApplicationGatewayInner>>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<ApplicationGatewayInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Gets all the application gateways in a subscription. * ServiceResponse<PageImpl<ApplicationGatewayInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;ApplicationGatewayInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Gets all the application gateways in a subscription
listNextSinglePageAsync
{ "repo_name": "martinsawicki/azure-sdk-for-java", "path": "azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/ApplicationGatewaysInner.java", "license": "mit", "size": 125097 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
639,433
public void addAnimation(@NonNull AbstractTransitionBuilder transitionBuilder) { addAnimation(transitionBuilder.buildAnimation()); }
void function(@NonNull AbstractTransitionBuilder transitionBuilder) { addAnimation(transitionBuilder.buildAnimation()); }
/** * Same as calling addAnimation(transitionBuilder.buildAnimation()) * * @param transitionBuilder */
Same as calling addAnimation(transitionBuilder.buildAnimation())
addAnimation
{ "repo_name": "hypermit/android-transition", "path": "core/src/main/java/com/kaichunlin/transition/animation/AnimationManager.java", "license": "apache-2.0", "size": 9521 }
[ "android.support.annotation.NonNull", "com.kaichunlin.transition.AbstractTransitionBuilder" ]
import android.support.annotation.NonNull; import com.kaichunlin.transition.AbstractTransitionBuilder;
import android.support.annotation.*; import com.kaichunlin.transition.*;
[ "android.support", "com.kaichunlin.transition" ]
android.support; com.kaichunlin.transition;
2,244,393
@Test public final void testYBetween() { final Mesh yBet = this.m.yBetween(10, -10); Assert.assertTrue(yBet.contains(this.t1)); Assert.assertTrue(yBet.contains(this.t2)); }
final void function() { final Mesh yBet = this.m.yBetween(10, -10); Assert.assertTrue(yBet.contains(this.t1)); Assert.assertTrue(yBet.contains(this.t2)); }
/** * Test method for * {@link fr.nantes1900.models.basis.Mesh#yBetween(double, double)}. */
Test method for <code>fr.nantes1900.models.basis.Mesh#yBetween(double, double)</code>
testYBetween
{ "repo_name": "Nantes1900/Nantes-1900-PGROU-IHM", "path": "src/test/fr/nantes1900/models/MeshTest.java", "license": "gpl-3.0", "size": 20047 }
[ "fr.nantes1900.models.basis.Mesh", "junit.framework.Assert" ]
import fr.nantes1900.models.basis.Mesh; import junit.framework.Assert;
import fr.nantes1900.models.basis.*; import junit.framework.*;
[ "fr.nantes1900.models", "junit.framework" ]
fr.nantes1900.models; junit.framework;
2,083,627
@Nullable public WorkbookChartDataLabelFormat delete() throws ClientException { return send(HttpMethod.DELETE, null); }
WorkbookChartDataLabelFormat function() throws ClientException { return send(HttpMethod.DELETE, null); }
/** * Delete this item from the service * @return the resulting response if the service returns anything on deletion * * @throws ClientException if there was an exception during the delete operation */
Delete this item from the service
delete
{ "repo_name": "microsoftgraph/msgraph-sdk-java", "path": "src/main/java/com/microsoft/graph/requests/WorkbookChartDataLabelFormatRequest.java", "license": "mit", "size": 6793 }
[ "com.microsoft.graph.core.ClientException", "com.microsoft.graph.http.HttpMethod", "com.microsoft.graph.models.WorkbookChartDataLabelFormat" ]
import com.microsoft.graph.core.ClientException; import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.WorkbookChartDataLabelFormat;
import com.microsoft.graph.core.*; import com.microsoft.graph.http.*; import com.microsoft.graph.models.*;
[ "com.microsoft.graph" ]
com.microsoft.graph;
2,154,019
return Completable.fromCallable( () -> { // reads / writes are synchronized per client instance synchronized (this) { try (FileOutputStream output = application.openFileOutput(fileName, MODE_PRIVATE)) { output.write(messageLite.toByteArray()); return messageLite; } } }); }
return Completable.fromCallable( () -> { synchronized (this) { try (FileOutputStream output = application.openFileOutput(fileName, MODE_PRIVATE)) { output.write(messageLite.toByteArray()); return messageLite; } } }); }
/** * Write the proto to a file in the app' s file directory. * * <p>Writes are non atomic. * * <p>Readers are expected to deal with corrupt data resulting from faulty writes * * @param messageLite * @throws IOException */
Write the proto to a file in the app' s file directory. Writes are non atomic. Readers are expected to deal with corrupt data resulting from faulty writes
write
{ "repo_name": "firebase/firebase-android-sdk", "path": "firebase-inappmessaging/src/main/java/com/google/firebase/inappmessaging/internal/ProtoStorageClient.java", "license": "apache-2.0", "size": 3523 }
[ "io.reactivex.Completable", "java.io.FileOutputStream" ]
import io.reactivex.Completable; import java.io.FileOutputStream;
import io.reactivex.*; import java.io.*;
[ "io.reactivex", "java.io" ]
io.reactivex; java.io;
1,944,825
public ActionForward removePackagesFromErrata(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext requestContext = new RequestContext(request); StrutsDelegate strutsDelegate = getStrutsDelegate(); //Get the Logged in user and the errata in question User user = requestContext.getCurrentUser(); Errata errata = requestContext.lookupErratum(); //Retrieve the set containing the ids of the packages we want to remove RhnSet packageIdsToRemove = RhnSetDecl.PACKAGES_TO_REMOVE.get(user); Iterator itr = packageIdsToRemove.getElements().iterator(); int packagesRemoved = 0; while (itr.hasNext()) { Long pid = ((RhnSetElement) itr.next()).getElement(); //package id Package pkg = PackageManager.lookupByIdAndUser(pid, user); //package if (pkg != null) { //remove the package from the errata errata.removePackage(pkg); //We need to keep track of the number of packages that were successfully //removed from the errata. packagesRemoved++; } } //Save the errata ErrataManager.storeErrata(errata); //Update Errata Cache //First we remove all errata cache entries if (errata.isPublished()) { List pList = new ArrayList(); pList.addAll(packageIdsToRemove.getElementValues()); ErrataCacheManager.deleteCacheEntriesForErrataPackages(errata.getId(), pList); } //Now since we didn't actually remove the packages, we need to // re-insert entries for the packages that are still in teh channel // in case they aren't there List<Long> cList = new ArrayList<Long>(); for (Channel chan : errata.getChannels()) { cList.add(chan.getId()); } List<Long> pList = new ArrayList<Long>(); pList.addAll(RhnSetDecl.PACKAGES_TO_REMOVE.get(user).getElementValues()); ErrataCacheManager.insertCacheForChannelPackagesAsync(cList, pList); //Clean up RhnSetDecl.PACKAGES_TO_REMOVE.clear(user); //Set the correct action message and return to the success mapping ActionMessages msgs = getMessages(packagesRemoved, errata.getAdvisory()); strutsDelegate.saveMessages(request, msgs); return strutsDelegate.forwardParam(mapping.findForward("success"), "eid", errata.getId().toString()); }
ActionForward function(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { RequestContext requestContext = new RequestContext(request); StrutsDelegate strutsDelegate = getStrutsDelegate(); User user = requestContext.getCurrentUser(); Errata errata = requestContext.lookupErratum(); RhnSet packageIdsToRemove = RhnSetDecl.PACKAGES_TO_REMOVE.get(user); Iterator itr = packageIdsToRemove.getElements().iterator(); int packagesRemoved = 0; while (itr.hasNext()) { Long pid = ((RhnSetElement) itr.next()).getElement(); Package pkg = PackageManager.lookupByIdAndUser(pid, user); if (pkg != null) { errata.removePackage(pkg); packagesRemoved++; } } ErrataManager.storeErrata(errata); if (errata.isPublished()) { List pList = new ArrayList(); pList.addAll(packageIdsToRemove.getElementValues()); ErrataCacheManager.deleteCacheEntriesForErrataPackages(errata.getId(), pList); } List<Long> cList = new ArrayList<Long>(); for (Channel chan : errata.getChannels()) { cList.add(chan.getId()); } List<Long> pList = new ArrayList<Long>(); pList.addAll(RhnSetDecl.PACKAGES_TO_REMOVE.get(user).getElementValues()); ErrataCacheManager.insertCacheForChannelPackagesAsync(cList, pList); RhnSetDecl.PACKAGES_TO_REMOVE.clear(user); ActionMessages msgs = getMessages(packagesRemoved, errata.getAdvisory()); strutsDelegate.saveMessages(request, msgs); return strutsDelegate.forwardParam(mapping.findForward(STR), "eid", errata.getId().toString()); }
/** * Remove packages corresponding to the ids in the packages_to_remove set from the * errata. * @param mapping ActionMapping * @param formIn ActionForm * @param request The request * @param response The response * @return Returns a success ActionForward if packages were removed. */
Remove packages corresponding to the ids in the packages_to_remove set from the errata
removePackagesFromErrata
{ "repo_name": "xkollar/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/action/errata/RemovePackagesAction.java", "license": "gpl-2.0", "size": 7169 }
[ "com.redhat.rhn.domain.channel.Channel", "com.redhat.rhn.domain.errata.Errata", "com.redhat.rhn.domain.rhnpackage.Package", "com.redhat.rhn.domain.rhnset.RhnSet", "com.redhat.rhn.domain.rhnset.RhnSetElement", "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.struts.RequestContext", "com.redhat.rhn.frontend.struts.StrutsDelegate", "com.redhat.rhn.manager.errata.ErrataManager", "com.redhat.rhn.manager.errata.cache.ErrataCacheManager", "com.redhat.rhn.manager.rhnpackage.PackageManager", "com.redhat.rhn.manager.rhnset.RhnSetDecl", "java.util.ArrayList", "java.util.Iterator", "java.util.List", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.apache.struts.action.ActionForm", "org.apache.struts.action.ActionForward", "org.apache.struts.action.ActionMapping", "org.apache.struts.action.ActionMessages" ]
import com.redhat.rhn.domain.channel.Channel; import com.redhat.rhn.domain.errata.Errata; import com.redhat.rhn.domain.rhnpackage.Package; import com.redhat.rhn.domain.rhnset.RhnSet; import com.redhat.rhn.domain.rhnset.RhnSetElement; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.struts.RequestContext; import com.redhat.rhn.frontend.struts.StrutsDelegate; import com.redhat.rhn.manager.errata.ErrataManager; import com.redhat.rhn.manager.errata.cache.ErrataCacheManager; import com.redhat.rhn.manager.rhnpackage.PackageManager; import com.redhat.rhn.manager.rhnset.RhnSetDecl; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessages;
import com.redhat.rhn.domain.channel.*; import com.redhat.rhn.domain.errata.*; import com.redhat.rhn.domain.rhnpackage.*; import com.redhat.rhn.domain.rhnset.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.struts.*; import com.redhat.rhn.manager.errata.*; import com.redhat.rhn.manager.errata.cache.*; import com.redhat.rhn.manager.rhnpackage.*; import com.redhat.rhn.manager.rhnset.*; import java.util.*; import javax.servlet.http.*; import org.apache.struts.action.*;
[ "com.redhat.rhn", "java.util", "javax.servlet", "org.apache.struts" ]
com.redhat.rhn; java.util; javax.servlet; org.apache.struts;
1,401,676
private InputStreamReader asReader(File file){ try { return new InputStreamReader(new FileInputStream(file), Charset.defaultCharset()); } catch (IOException e){ throw new RuntimeException("Problem reading input"); } }
InputStreamReader function(File file){ try { return new InputStreamReader(new FileInputStream(file), Charset.defaultCharset()); } catch (IOException e){ throw new RuntimeException(STR); } }
/** * Convert a file into a Reader * @param file file to be converted * @return Json object representing the file, empty if problem reading file */
Convert a file into a Reader
asReader
{ "repo_name": "pluraliseseverythings/grakn", "path": "grakn-migration/json/src/main/java/ai/grakn/migration/json/JsonMigrator.java", "license": "gpl-3.0", "size": 5141 }
[ "java.io.File", "java.io.FileInputStream", "java.io.IOException", "java.io.InputStreamReader", "java.nio.charset.Charset" ]
import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.Charset;
import java.io.*; import java.nio.charset.*;
[ "java.io", "java.nio" ]
java.io; java.nio;
2,247,239
public static void submit(Optional<EventSubmitter> submitter, String name) { if (submitter.isPresent()) { submitter.get().submit(name); } }
static void function(Optional<EventSubmitter> submitter, String name) { if (submitter.isPresent()) { submitter.get().submit(name); } }
/** * Calls submit on submitter if present. */
Calls submit on submitter if present
submit
{ "repo_name": "pldash/gobblin-1", "path": "gobblin-metrics/src/main/java/gobblin/metrics/event/EventSubmitter.java", "license": "apache-2.0", "size": 5092 }
[ "com.google.common.base.Optional" ]
import com.google.common.base.Optional;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,265,165
public DelegateTree<ConstraintSolver,String> getConstraintSolverHierarchy() { DelegateTree<ConstraintSolver,String> ret = new DelegateTree<ConstraintSolver, String>(); ret.setRoot(this); ConstraintSolver[] myConstraintSolvers = this.getConstraintSolvers(); for (int i = 0; i < myConstraintSolvers.length; i++) { String edgeLabel = i + " (" + this.hashCode() + ")"; if (myConstraintSolvers[i] instanceof MultiConstraintSolver) { DelegateTree<ConstraintSolver,String> subtree = ((MultiConstraintSolver)myConstraintSolvers[i]).getConstraintSolverHierarchy(); TreeUtils.addSubTree(ret, subtree, this, edgeLabel); } else { ret.addChild(edgeLabel, this, myConstraintSolvers[i]); } } return ret; }
DelegateTree<ConstraintSolver,String> function() { DelegateTree<ConstraintSolver,String> ret = new DelegateTree<ConstraintSolver, String>(); ret.setRoot(this); ConstraintSolver[] myConstraintSolvers = this.getConstraintSolvers(); for (int i = 0; i < myConstraintSolvers.length; i++) { String edgeLabel = i + STR + this.hashCode() + ")"; if (myConstraintSolvers[i] instanceof MultiConstraintSolver) { DelegateTree<ConstraintSolver,String> subtree = ((MultiConstraintSolver)myConstraintSolvers[i]).getConstraintSolverHierarchy(); TreeUtils.addSubTree(ret, subtree, this, edgeLabel); } else { ret.addChild(edgeLabel, this, myConstraintSolvers[i]); } } return ret; }
/** * Get the hierarchy of {@link ConstraintSolver}s rooted in this {@link MultiConstraintSolver}. * @return The hierarchy of {@link ConstraintSolver}s rooted in this {@link MultiConstraintSolver}. */
Get the hierarchy of <code>ConstraintSolver</code>s rooted in this <code>MultiConstraintSolver</code>
getConstraintSolverHierarchy
{ "repo_name": "FedericoPecora/meta-csp-framework", "path": "src/main/java/org/metacsp/framework/multi/MultiConstraintSolver.java", "license": "mit", "size": 27325 }
[ "edu.uci.ics.jung.graph.DelegateTree", "edu.uci.ics.jung.graph.util.TreeUtils", "org.metacsp.framework.ConstraintSolver" ]
import edu.uci.ics.jung.graph.DelegateTree; import edu.uci.ics.jung.graph.util.TreeUtils; import org.metacsp.framework.ConstraintSolver;
import edu.uci.ics.jung.graph.*; import edu.uci.ics.jung.graph.util.*; import org.metacsp.framework.*;
[ "edu.uci.ics", "org.metacsp.framework" ]
edu.uci.ics; org.metacsp.framework;
2,098,542
private void setDiceSidesText(int sides) { ((TextView) getView().findViewById(R.id.settings_dice_sides_tv)) .setText(String.valueOf(sides)); }
void function(int sides) { ((TextView) getView().findViewById(R.id.settings_dice_sides_tv)) .setText(String.valueOf(sides)); }
/** * Sets the text of the number of sides on each die being rolled. * * @param sides * Number of sides on the dice */
Sets the text of the number of sides on each die being rolled
setDiceSidesText
{ "repo_name": "Ailuridaes/SimpleLife", "path": "app/src/main/java/com/brstf/simplelife/SettingsFragment.java", "license": "apache-2.0", "size": 19798 }
[ "android.widget.TextView" ]
import android.widget.TextView;
import android.widget.*;
[ "android.widget" ]
android.widget;
1,682,410
public static CallbackHandler getUsernamePasswordHandler( final String username, final String password) { LOGGER.fine("username=" + username + "; password=" + password.hashCode());
static CallbackHandler function( final String username, final String password) { LOGGER.fine(STR + username + STR + password.hashCode());
/** * Used by the BASIC Auth mechanism for establishing a LoginContext * to authenticate a client/caller/request. * * @param username client username * @param password client password * @return CallbackHandler to be used for establishing a LoginContext */
Used by the BASIC Auth mechanism for establishing a LoginContext to authenticate a client/caller/request
getUsernamePasswordHandler
{ "repo_name": "kkhmelevskoy/spnego", "path": "spnego/src/java/net/sourceforge/spnego/SpnegoProvider.java", "license": "lgpl-3.0", "size": 11773 }
[ "javax.security.auth.callback.CallbackHandler" ]
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.*;
[ "javax.security" ]
javax.security;
322,453
public DateTime lastRenewedTime() { return this.lastRenewedTime; }
DateTime function() { return this.lastRenewedTime; }
/** * Get timestamp when the domain was renewed last time. * * @return the lastRenewedTime value */
Get timestamp when the domain was renewed last time
lastRenewedTime
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/appservice/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DomainInner.java", "license": "mit", "size": 14023 }
[ "org.joda.time.DateTime" ]
import org.joda.time.DateTime;
import org.joda.time.*;
[ "org.joda.time" ]
org.joda.time;
2,791,984
private static OrmLiteSqliteOpenHelper constructHelper(Context context, Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) { Constructor<?> constructor; try { constructor = openHelperClass.getConstructor(Context.class); } catch (Exception e) { throw new IllegalStateException( "Could not find public constructor that has a single (Context) argument for helper class " + openHelperClass, e); } try { return (OrmLiteSqliteOpenHelper) constructor.newInstance(context); } catch (Exception e) { throw new IllegalStateException("Could not construct instance of helper class " + openHelperClass, e); } }
static OrmLiteSqliteOpenHelper function(Context context, Class<? extends OrmLiteSqliteOpenHelper> openHelperClass) { Constructor<?> constructor; try { constructor = openHelperClass.getConstructor(Context.class); } catch (Exception e) { throw new IllegalStateException( STR + openHelperClass, e); } try { return (OrmLiteSqliteOpenHelper) constructor.newInstance(context); } catch (Exception e) { throw new IllegalStateException(STR + openHelperClass, e); } }
/** * Call the constructor on our helper class. */
Call the constructor on our helper class
constructHelper
{ "repo_name": "d-tarasov/ormlite-android-sqlcipher", "path": "src/main/java/com/j256/ormlite/sqlcipher/android/apptools/OpenHelperManager.java", "license": "isc", "size": 12167 }
[ "android.content.Context", "java.lang.reflect.Constructor" ]
import android.content.Context; import java.lang.reflect.Constructor;
import android.content.*; import java.lang.reflect.*;
[ "android.content", "java.lang" ]
android.content; java.lang;
2,106,730
public void testBuildXmlFile() throws IOException { List<DspaceItem> items = itemExporter.getItems(1000, 1500); itemExporter.generateItemXMLFile(new File("C:\\items.xml"), items); }
void function() throws IOException { List<DspaceItem> items = itemExporter.getItems(1000, 1500); itemExporter.generateItemXMLFile(new File(STR), items); }
/** * Test building the xml file * * @throws IOException */
Test building the xml file
testBuildXmlFile
{ "repo_name": "nate-rcl/irplus", "path": "dspace_urresearch_export/test/edu/ur/dspace/export/DspaceItemExporterTest.java", "license": "apache-2.0", "size": 2647 }
[ "edu.ur.dspace.model.DspaceItem", "java.io.File", "java.io.IOException", "java.util.List" ]
import edu.ur.dspace.model.DspaceItem; import java.io.File; import java.io.IOException; import java.util.List;
import edu.ur.dspace.model.*; import java.io.*; import java.util.*;
[ "edu.ur.dspace", "java.io", "java.util" ]
edu.ur.dspace; java.io; java.util;
291,424
EReference getOrdinalOp__LessOp_1();
EReference getOrdinalOp__LessOp_1();
/** * Returns the meta object for the containment reference list '{@link cruise.umple.umple.OrdinalOp_#getLessOp_1 <em>Less Op 1</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Less Op 1</em>'. * @see cruise.umple.umple.OrdinalOp_#getLessOp_1() * @see #getOrdinalOp_() * @generated */
Returns the meta object for the containment reference list '<code>cruise.umple.umple.OrdinalOp_#getLessOp_1 Less Op 1</code>'.
getOrdinalOp__LessOp_1
{ "repo_name": "ahmedvc/umple", "path": "cruise.umple.xtext/src-gen/cruise/umple/umple/UmplePackage.java", "license": "mit", "size": 485842 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
392,536
public PlayerDescriptor registerPlayer(final String playerName, final ServerTicket serverTicket) throws NullPointerException, ServerTicketException, PlayerRegisterException, RemoteException, RuntimeException;
PlayerDescriptor function(final String playerName, final ServerTicket serverTicket) throws NullPointerException, ServerTicketException, PlayerRegisterException, RemoteException, RuntimeException;
/** * Returns the player which has for name <code>playerName</code>, * or creates it if the player does not exist. * @param playerName the player name. * @param serverTicket the ticket of the calling client. * @return the descriptor of the player which has for name <code>playerName</code>, * or creates it if the player does not exist. * @throws NullPointerException if any of the method parameter is null. * @throws ServerTicketException if <code>serverTicket</code> * is not valid. * @throws PlayerRegisterException if there are already too many players, * or if there's already a player with name <code>playerName</code>, or * if the ticket <code>serverTicket</code> has already been used to register * another player. * @throws RemoteException if a remote exception occurs while registering * the player which has for name <code>playerName</code>. * @throws RuntimeException if an unexpected error occurs. */
Returns the player which has for name <code>playerName</code>, or creates it if the player does not exist
registerPlayer
{ "repo_name": "pelletgu/fourinaline", "path": "org/gojul/fourinaline/model/GameServer.java", "license": "gpl-2.0", "size": 11698 }
[ "java.rmi.RemoteException" ]
import java.rmi.RemoteException;
import java.rmi.*;
[ "java.rmi" ]
java.rmi;
391,547