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 Specification getSpecificationByName(String repositoryUid, String specificationName);
Specification function(String repositoryUid, String specificationName);
/** * Retrieves the Specification for the specified repository UID. * </p> * * @param repositoryUid a {@link java.lang.String} object. * @param specificationName a {@link java.lang.String} object. * @return the Specification for the specified repository UID. */
Retrieves the Specification for the specified repository UID.
getSpecificationByName
{ "repo_name": "strator-dev/greenpepper", "path": "greenpepper/greenpepper-server/src/main/java/com/greenpepper/server/domain/dao/DocumentDao.java", "license": "apache-2.0", "size": 11394 }
[ "com.greenpepper.server.domain.Specification" ]
import com.greenpepper.server.domain.Specification;
import com.greenpepper.server.domain.*;
[ "com.greenpepper.server" ]
com.greenpepper.server;
2,711,108
NumberFormat nf = NumberFormatUtil.getInstance().getNumberFormat(); String result = "Normality Tests for: " + variable.getName() +" (sample size:" + dataSet.getNumRows() + ")"; int lengthOfTitle = result.length(); result += "\n"; for (int i = 0; i < lengthOfTitle; i++) { result += "-"; } result += "\n\nKolmogorov Smirnov:\n--------------------------------\n"; double ksResults[] = kolmogorovSmirnov(dataSet, variable); double ksStat = Math.round((ksResults[0] * 10000000.0)) / 10000000.0; result += "K-S Statistic: " + ksStat + "\n\n"; result += "Significance Levels:\t.20\t.15\t.10\t.05\t.01\nK-S Critical Values:"; result += "\t" + nf.format(ksResults[0]) + "\t" + nf.format(ksResults[1]) + "\t" + nf.format(ksResults[2]) + "\t" + nf.format(ksResults[3]) + "\t" + nf.format(ksResults[4]) + "\n"; boolean testResult = false; String pass = "FAIL"; if (ksResults[0] < ksResults[1]) testResult = true; if (testResult) pass = "ACCEPT"; else pass = "FAIL"; result += "Test Result:\t\t" + pass; testResult = ksResults[0] < ksResults[2]; if (testResult) pass = "ACCEPT"; else pass = "FAIL"; result += "\t" + pass; testResult = ksResults[0] < ksResults[3]; if (testResult) pass = "ACCEPT"; else pass = "FAIL"; result += "\t" + pass; testResult = ksResults[0] < ksResults[4]; if (testResult) pass = "ACCEPT"; else pass = "FAIL"; result += "\t" + pass; testResult = ksResults[0] < ksResults[5]; if (testResult) pass = "ACCEPT"; else pass = "FAIL"; result += "\t" + pass; testResult = false; result += "\n\nH0 = " + variable + " is Normal.\n"; result += "(Normal if ACCEPT.)\n"; result += "\n\n"; result += "Anderson Darling Test:\n"; result += "---------------------\n"; int column = dataSet.getVariables().indexOf(variable); double[] data = dataSet.getDoubleData().getColumn(column).toArray(); AndersonDarlingTest andersonDarlingTest = new AndersonDarlingTest(data); result += "A^2 = " + nf.format(andersonDarlingTest.getASquared()) + "\n"; result += "A^2* = " + nf.format(andersonDarlingTest.getASquaredStar()) + "\n"; result += "p = " + nf.format(andersonDarlingTest.getP()) + "\n"; result += "\nH0 = " + variable + " is Non-normal."; result += "\n(Normal if p > alpha.)\n"; return result; }
NumberFormat nf = NumberFormatUtil.getInstance().getNumberFormat(); String result = STR + variable.getName() +STR + dataSet.getNumRows() + ")"; int lengthOfTitle = result.length(); result += "\n"; for (int i = 0; i < lengthOfTitle; i++) { result += "-"; } result += STR; double ksResults[] = kolmogorovSmirnov(dataSet, variable); double ksStat = Math.round((ksResults[0] * 10000000.0)) / 10000000.0; result += STR + ksStat + "\n\n"; result += STR; result += "\t" + nf.format(ksResults[0]) + "\t" + nf.format(ksResults[1]) + "\t" + nf.format(ksResults[2]) + "\t" + nf.format(ksResults[3]) + "\t" + nf.format(ksResults[4]) + "\n"; boolean testResult = false; String pass = "FAIL"; if (ksResults[0] < ksResults[1]) testResult = true; if (testResult) pass = STR; else pass = "FAIL"; result += STR + pass; testResult = ksResults[0] < ksResults[2]; if (testResult) pass = STR; else pass = "FAIL"; result += "\t" + pass; testResult = ksResults[0] < ksResults[3]; if (testResult) pass = STR; else pass = "FAIL"; result += "\t" + pass; testResult = ksResults[0] < ksResults[4]; if (testResult) pass = STR; else pass = "FAIL"; result += "\t" + pass; testResult = ksResults[0] < ksResults[5]; if (testResult) pass = STR; else pass = "FAIL"; result += "\t" + pass; testResult = false; result += STR + variable + STR; result += STR; result += "\n\n"; result += STR; result += STR; int column = dataSet.getVariables().indexOf(variable); double[] data = dataSet.getDoubleData().getColumn(column).toArray(); AndersonDarlingTest andersonDarlingTest = new AndersonDarlingTest(data); result += STR + nf.format(andersonDarlingTest.getASquared()) + "\n"; result += STR + nf.format(andersonDarlingTest.getASquaredStar()) + "\n"; result += STR + nf.format(andersonDarlingTest.getP()) + "\n"; result += STR + variable + STR; result += STR; return result; }
/** * Constructs a readable table of normality test results * */
Constructs a readable table of normality test results
runNormalityTests
{ "repo_name": "ekummerfeld/GdistanceP", "path": "tetrad-gui/src/main/java/edu/cmu/tetradapp/editor/NormalityTests.java", "license": "gpl-2.0", "size": 17471 }
[ "edu.cmu.tetrad.data.AndersonDarlingTest", "edu.cmu.tetrad.util.NumberFormatUtil", "java.text.NumberFormat" ]
import edu.cmu.tetrad.data.AndersonDarlingTest; import edu.cmu.tetrad.util.NumberFormatUtil; import java.text.NumberFormat;
import edu.cmu.tetrad.data.*; import edu.cmu.tetrad.util.*; import java.text.*;
[ "edu.cmu.tetrad", "java.text" ]
edu.cmu.tetrad; java.text;
2,488,654
public static DateFormat getDateFormatterWithoutTime() { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); df.setLenient(false); return df; }
static DateFormat function() { DateFormat df = new SimpleDateFormat(STR); df.setLenient(false); return df; }
/** * Method create formatter with default settings for perun timestamps (only date without time) * and set lenient on false. * * Timestamp format: "yyyy-MM-dd" - "ex. 2014-01-01" * * Lenient on false means that formatter will be more strict to creating timestamp from string * * IMPORTANT: SimpleDateFormat is not thread safe !!! * * @return date formatter */
Method create formatter with default settings for perun timestamps (only date without time) and set lenient on false. Timestamp format: "yyyy-MM-dd" - "ex. 2014-01-01" Lenient on false means that formatter will be more strict to creating timestamp from string
getDateFormatterWithoutTime
{ "repo_name": "licehammer/perun", "path": "perun-base/src/main/java/cz/metacentrum/perun/core/api/BeansUtils.java", "license": "bsd-2-clause", "size": 24103 }
[ "java.text.DateFormat", "java.text.SimpleDateFormat" ]
import java.text.DateFormat; import java.text.SimpleDateFormat;
import java.text.*;
[ "java.text" ]
java.text;
855,292
@Override @XmlElement(name = "purpose") public InternationalString getPurpose() { return purpose; }
@XmlElement(name = STR) InternationalString function() { return purpose; }
/** * Returns a summary of the intentions with which the resource(s) was developed. * * @return the intentions with which the resource(s) was developed, or {@code null}. */
Returns a summary of the intentions with which the resource(s) was developed
getPurpose
{ "repo_name": "Geomatys/sis", "path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/identification/AbstractIdentification.java", "license": "apache-2.0", "size": 30038 }
[ "javax.xml.bind.annotation.XmlElement", "org.opengis.util.InternationalString" ]
import javax.xml.bind.annotation.XmlElement; import org.opengis.util.InternationalString;
import javax.xml.bind.annotation.*; import org.opengis.util.*;
[ "javax.xml", "org.opengis.util" ]
javax.xml; org.opengis.util;
2,340,608
public void undoLastAction() { // NOTE: that the try/catch block shouldn't be necessary... try { if (undoManager.canUndo()) undoManager.undo(); } catch (CannotUndoException cre) { cre.printStackTrace(); } }
void function() { try { if (undoManager.canUndo()) undoManager.undo(); } catch (CannotUndoException cre) { cre.printStackTrace(); } }
/** * Attempt to undo an "action" done in this text area. * * @see #redoLastAction() */
Attempt to undo an "action" done in this text area
undoLastAction
{ "repo_name": "freddy-realirm/BPMNEditor-For-Protege-Essential", "path": "src/org/fife/ui/rtextarea/RTextArea.java", "license": "gpl-3.0", "size": 30911 }
[ "javax.swing.undo.CannotUndoException" ]
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.*;
[ "javax.swing" ]
javax.swing;
2,907,385
public boolean isFree() { return mode == FREE; } public void mouseClicked(MouseEvent e) {}
boolean function() { return mode == FREE; } public void mouseClicked(MouseEvent e) {}
/** * Returns the value wheter the mode -variable is FREE (True) or * something else. (False) * * @ return Wheter the mode -variable is FREE or not. */
Returns the value wheter the mode -variable is FREE (True) or something else. (False)
isFree
{ "repo_name": "moegyver/mJeliot", "path": "Jeliot/src/jeliot/gui/DraggableComponent.java", "license": "mit", "size": 4586 }
[ "java.awt.event.MouseEvent" ]
import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
199,150
public T remove() { T result = null; if (head == null) { throw new EmptyStackException(); } result = head.data; head = head.next; if (head == null) { tail = null; } size--; return result; }
T function() { T result = null; if (head == null) { throw new EmptyStackException(); } result = head.data; head = head.next; if (head == null) { tail = null; } size--; return result; }
/** * Removes node from front of the queue */
Removes node from front of the queue
remove
{ "repo_name": "scaffeinate/crack-the-code", "path": "datastructures/src/datastructures/queue/CustomQueue.java", "license": "mit", "size": 2417 }
[ "java.util.EmptyStackException" ]
import java.util.EmptyStackException;
import java.util.*;
[ "java.util" ]
java.util;
2,893,056
private void tryRepo() { Timer timer = (Timer) context.getAttribute(TIMER_KEY); try { if (createRepoPath()) { // create succeeded, cancel any timers if (timer != null) { timer.cancel(); context.removeAttribute(TIMER_KEY); } } else { // try again later if (timer == null) { timer = new Timer(); context.setAttribute(TIMER_KEY, timer); }
void function() { Timer timer = (Timer) context.getAttribute(TIMER_KEY); try { if (createRepoPath()) { if (timer != null) { timer.cancel(); context.removeAttribute(TIMER_KEY); } } else { if (timer == null) { timer = new Timer(); context.setAttribute(TIMER_KEY, timer); }
/** * Try to create the content repo directory. Schedule a task to retry in 5 * seconds if not found */
Try to create the content repo directory. Schedule a task to retry in 5 seconds if not found
tryRepo
{ "repo_name": "josmas/openwonderland", "path": "modules/tools/error-report/src/classes/org/jdesktop/wonderland/modules/errorreport/web/ErrorReportContextListener.java", "license": "gpl-2.0", "size": 5354 }
[ "java.util.Timer" ]
import java.util.Timer;
import java.util.*;
[ "java.util" ]
java.util;
1,874,984
public void connectToServer(String ip, int port, String key) { try { Socket serverConnection = new Socket(ip, port); BufferedReader serverBR = new BufferedReader(new InputStreamReader(serverConnection.getInputStream())); PrintWriter serverPW = new PrintWriter(serverConnection.getOutputStream(), true); serverPW.println("AUTOCONNECT:" + key); serverPW.flush(); String response = serverBR.readLine(); StringTokenizer st = new StringTokenizer(response, ":"); if (st.nextToken().equalsIgnoreCase("ERROR")) { JOptionPane.showMessageDialog(this.getFrame(), st.nextToken(), "Key Error", JOptionPane.ERROR_MESSAGE); if(onlineClient) { ((KeyValidationDialog) connectDialog).reset(); connectDialog.setVisible(true); } else { ((SwordfishRoomDialog) connectDialog).reset(); } } else { if(onlineClient) { connectDialog.setVisible(false); } else { connectDialog.setVisible(false); ((SwordfishRoomDialog) connectDialog).hideKeyValidation(); } name = st.nextToken(); this.key = key; response = serverBR.readLine(); st = new StringTokenizer(response, ":"); st.nextToken(); int roomPort = new Integer(st.nextToken()).intValue(); connectToRoom(ip, roomPort); } } catch (UnknownHostException ex) { logError(ex); connectDialog.setVisible(false); JOptionPane.showMessageDialog(this.getFrame(), "Server Unavailable.\n " + "Please try again later", "Server Unavailable", JOptionPane.ERROR_MESSAGE); System.exit(-1); } catch (IOException ex) { logError(ex); connectDialog.setVisible(false); JOptionPane.showMessageDialog(this.getFrame(), "Server Unavailable.\n " + "Please try again later", "Server Unavailable", JOptionPane.ERROR_MESSAGE); System.exit(-1); } catch (NumberFormatException ex) { logError(ex); } }
void function(String ip, int port, String key) { try { Socket serverConnection = new Socket(ip, port); BufferedReader serverBR = new BufferedReader(new InputStreamReader(serverConnection.getInputStream())); PrintWriter serverPW = new PrintWriter(serverConnection.getOutputStream(), true); serverPW.println(STR + key); serverPW.flush(); String response = serverBR.readLine(); StringTokenizer st = new StringTokenizer(response, ":"); if (st.nextToken().equalsIgnoreCase("ERROR")) { JOptionPane.showMessageDialog(this.getFrame(), st.nextToken(), STR, JOptionPane.ERROR_MESSAGE); if(onlineClient) { ((KeyValidationDialog) connectDialog).reset(); connectDialog.setVisible(true); } else { ((SwordfishRoomDialog) connectDialog).reset(); } } else { if(onlineClient) { connectDialog.setVisible(false); } else { connectDialog.setVisible(false); ((SwordfishRoomDialog) connectDialog).hideKeyValidation(); } name = st.nextToken(); this.key = key; response = serverBR.readLine(); st = new StringTokenizer(response, ":"); st.nextToken(); int roomPort = new Integer(st.nextToken()).intValue(); connectToRoom(ip, roomPort); } } catch (UnknownHostException ex) { logError(ex); connectDialog.setVisible(false); JOptionPane.showMessageDialog(this.getFrame(), STR + STR, STR, JOptionPane.ERROR_MESSAGE); System.exit(-1); } catch (IOException ex) { logError(ex); connectDialog.setVisible(false); JOptionPane.showMessageDialog(this.getFrame(), STR + STR, STR, JOptionPane.ERROR_MESSAGE); System.exit(-1); } catch (NumberFormatException ex) { logError(ex); } }
/** * Connect to the server specified by the ip and port given in the config file * and the key passed in by the dialog. The IP and PORT are hardcoded right now * to point to the poker server set up at the U of A * @param ip An IP to connect to * @param port a PORT on the IP that the server lives * @param key A Key to check for a valid connection */
Connect to the server specified by the ip and port given in the config file and the key passed in by the dialog. The IP and PORT are hardcoded right now to point to the poker server set up at the U of A
connectToServer
{ "repo_name": "secondfoundation/Second-Foundation-Src", "path": "src/turk/src/interface/acpc_2010_server/Swordfish/src/swordfish/view/SwordfishView.java", "license": "lgpl-2.1", "size": 52335 }
[ "java.io.BufferedReader", "java.io.IOException", "java.io.InputStreamReader", "java.io.PrintWriter", "java.net.Socket", "java.net.UnknownHostException", "java.util.StringTokenizer", "javax.swing.JOptionPane" ]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.Socket; import java.net.UnknownHostException; import java.util.StringTokenizer; import javax.swing.JOptionPane;
import java.io.*; import java.net.*; import java.util.*; import javax.swing.*;
[ "java.io", "java.net", "java.util", "javax.swing" ]
java.io; java.net; java.util; javax.swing;
1,151,595
public ColorRGBA getStartColor() { return startColor; }
ColorRGBA function() { return startColor; }
/** * Get the start color of the particles spawned. * * @return the start color of the particles spawned. * * @see ParticleEmitter#setStartColor(com.jme3.math.ColorRGBA) */
Get the start color of the particles spawned
getStartColor
{ "repo_name": "rex-xxx/mt6572_x201", "path": "external/jmonkeyengine/engine/src/core/com/jme3/effect/ParticleEmitter.java", "license": "gpl-2.0", "size": 38813 }
[ "com.jme3.math.ColorRGBA" ]
import com.jme3.math.ColorRGBA;
import com.jme3.math.*;
[ "com.jme3.math" ]
com.jme3.math;
2,262,831
protected K standardHigherKey(K key) { return keyOrNull(higherEntry(key)); }
K function(K key) { return keyOrNull(higherEntry(key)); }
/** * A sensible definition of {@link #higherKey} in terms of {@code higherEntry}. If you override * {@code higherEntry}, you may wish to override {@code higherKey} to forward to this * implementation. */
A sensible definition of <code>#higherKey</code> in terms of higherEntry. If you override higherEntry, you may wish to override higherKey to forward to this implementation
standardHigherKey
{ "repo_name": "wspeirs/sop4j-base", "path": "src/main/java/com/sop4j/base/google/common/collect/ForwardingNavigableMap.java", "license": "apache-2.0", "size": 13250 }
[ "com.sop4j.base.google.common.collect.Maps" ]
import com.sop4j.base.google.common.collect.Maps;
import com.sop4j.base.google.common.collect.*;
[ "com.sop4j.base" ]
com.sop4j.base;
764,293
@Test public void checkTwoNodeTree() { List<Double> contents = new ArrayList<Double>(); contents.add(0.0); contents.add(1.0); BinarySearchTree smallTree = new BinarySearchTree(contents); assertEquals(2, smallTree.size()); assertEquals(0.0, smallTree.get(0), epsilon); assertEquals(1.0, smallTree.get(1), epsilon); assertEquals(0, smallTree.findNearestIndex(-1.0)); assertEquals(0, smallTree.findNearestIndex(0.0)); assertEquals(0, smallTree.findNearestIndex(0.5)); assertEquals(1, smallTree.findNearestIndex(0.5 + epsilon)); assertEquals(1, smallTree.findNearestIndex(1.0)); assertEquals(1, smallTree.findNearestIndex(2.0)); return; }
void function() { List<Double> contents = new ArrayList<Double>(); contents.add(0.0); contents.add(1.0); BinarySearchTree smallTree = new BinarySearchTree(contents); assertEquals(2, smallTree.size()); assertEquals(0.0, smallTree.get(0), epsilon); assertEquals(1.0, smallTree.get(1), epsilon); assertEquals(0, smallTree.findNearestIndex(-1.0)); assertEquals(0, smallTree.findNearestIndex(0.0)); assertEquals(0, smallTree.findNearestIndex(0.5)); assertEquals(1, smallTree.findNearestIndex(0.5 + epsilon)); assertEquals(1, smallTree.findNearestIndex(1.0)); assertEquals(1, smallTree.findNearestIndex(2.0)); return; }
/** * Checks search operations on a small, two-node tree. */
Checks search operations on a small, two-node tree
checkTwoNodeTree
{ "repo_name": "SmithRWORNL/ice", "path": "tests/org.eclipse.ice.viz.service.visit.test/src/org/eclipse/ice/viz/service/visit/test/BinarySearchTreeTester.java", "license": "epl-1.0", "size": 16020 }
[ "java.util.ArrayList", "java.util.List", "org.eclipse.ice.viz.service.visit.widgets.BinarySearchTree", "org.junit.Assert" ]
import java.util.ArrayList; import java.util.List; import org.eclipse.ice.viz.service.visit.widgets.BinarySearchTree; import org.junit.Assert;
import java.util.*; import org.eclipse.ice.viz.service.visit.widgets.*; import org.junit.*;
[ "java.util", "org.eclipse.ice", "org.junit" ]
java.util; org.eclipse.ice; org.junit;
2,120,149
public List<I_CmsListAction> getIndependentActions() { return m_indepActions.elementList(); }
List<I_CmsListAction> function() { return m_indepActions.elementList(); }
/** * Returns the list of independent actions.<p> * * @return a list of <code>{@link I_CmsListAction}</code>s */
Returns the list of independent actions
getIndependentActions
{ "repo_name": "victos/opencms-core", "path": "src/org/opencms/workplace/list/CmsListMetadata.java", "license": "lgpl-2.1", "size": 30199 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,612,637
//----------------------------------------------------------------------- private void assertCountriesByLanguage(final String language, final String[] countries) { final List<Locale> list = LocaleUtils.countriesByLanguage(language); final List<Locale> list2 = LocaleUtils.countriesByLanguage(language); assertNotNull(list); assertSame(list, list2); //search through langauges for (final String countrie : countries) { final Iterator<Locale> iterator = list.iterator(); boolean found = false; // see if it was returned by the set while (iterator.hasNext()) { final Locale locale = iterator.next(); // should have an en empty variant assertTrue(locale.getVariant() == null || locale.getVariant().isEmpty()); assertEquals(language, locale.getLanguage()); if (countrie.equals(locale.getCountry())) { found = true; break; } } if (!found) { fail("Cound not find language: " + countrie + " for country: " + language); } } assertUnmodifiableCollection(list); }
void function(final String language, final String[] countries) { final List<Locale> list = LocaleUtils.countriesByLanguage(language); final List<Locale> list2 = LocaleUtils.countriesByLanguage(language); assertNotNull(list); assertSame(list, list2); for (final String countrie : countries) { final Iterator<Locale> iterator = list.iterator(); boolean found = false; while (iterator.hasNext()) { final Locale locale = iterator.next(); assertTrue(locale.getVariant() == null locale.getVariant().isEmpty()); assertEquals(language, locale.getLanguage()); if (countrie.equals(locale.getCountry())) { found = true; break; } } if (!found) { fail(STR + countrie + STR + language); } } assertUnmodifiableCollection(list); }
/** * Make sure the country by language is correct. It checks that * the LocaleUtils.countryByLanguage(language) call contains the * array of countries passed in. It may contain more due to JVM * variations. * * * @param language * @param countries array of countries that should be returned */
Make sure the country by language is correct. It checks that the LocaleUtils.countryByLanguage(language) call contains the array of countries passed in. It may contain more due to JVM variations
assertCountriesByLanguage
{ "repo_name": "mureinik/commons-lang", "path": "src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java", "license": "apache-2.0", "size": 22167 }
[ "java.util.Iterator", "java.util.List", "java.util.Locale", "org.junit.Assert" ]
import java.util.Iterator; import java.util.List; import java.util.Locale; import org.junit.Assert;
import java.util.*; import org.junit.*;
[ "java.util", "org.junit" ]
java.util; org.junit;
1,464,256
public static ClassLoader createJobClassLoader(Configuration conf) throws IOException { ClassLoader jobClassLoader = null; if (conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_CLASSLOADER, false)) { String appClasspath = System.getenv(Environment.APP_CLASSPATH.key()); if (appClasspath == null) { LOG.warn("Not creating job classloader since APP_CLASSPATH is not set."); } else { LOG.info("Creating job classloader"); if (LOG.isDebugEnabled()) { LOG.debug("APP_CLASSPATH=" + appClasspath); } String[] systemClasses = getSystemClasses(conf); jobClassLoader = createJobClassLoader(appClasspath, systemClasses); } } return jobClassLoader; }
static ClassLoader function(Configuration conf) throws IOException { ClassLoader jobClassLoader = null; if (conf.getBoolean(MRJobConfig.MAPREDUCE_JOB_CLASSLOADER, false)) { String appClasspath = System.getenv(Environment.APP_CLASSPATH.key()); if (appClasspath == null) { LOG.warn(STR); } else { LOG.info(STR); if (LOG.isDebugEnabled()) { LOG.debug(STR + appClasspath); } String[] systemClasses = getSystemClasses(conf); jobClassLoader = createJobClassLoader(appClasspath, systemClasses); } } return jobClassLoader; }
/** * Creates a {@link ApplicationClassLoader} if * {@link MRJobConfig#MAPREDUCE_JOB_CLASSLOADER} is set to true, and * the APP_CLASSPATH environment variable is set. * @param conf * @returns the created job classloader, or null if the job classloader is not * enabled or the APP_CLASSPATH environment variable is not set * @throws IOException */
Creates a <code>ApplicationClassLoader</code> if <code>MRJobConfig#MAPREDUCE_JOB_CLASSLOADER</code> is set to true, and the APP_CLASSPATH environment variable is set
createJobClassLoader
{ "repo_name": "bruthe/hadoop-2.6.0r", "path": "src/mapreduce/common/org/apache/hadoop/mapreduce/v2/util/MRApps.java", "license": "apache-2.0", "size": 25875 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.mapreduce.MRJobConfig", "org.apache.hadoop.yarn.api.ApplicationConstants" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.mapreduce.MRJobConfig; import org.apache.hadoop.yarn.api.ApplicationConstants;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.yarn.api.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,902,167
public void init(Env env) { }
void function(Env env) { }
/** * Initialize the environment * * @param quercus the owning engine */
Initialize the environment
init
{ "repo_name": "dlitz/resin", "path": "modules/quercus/src/com/caucho/quercus/page/QuercusPage.java", "license": "gpl-2.0", "size": 6106 }
[ "com.caucho.quercus.env.Env" ]
import com.caucho.quercus.env.Env;
import com.caucho.quercus.env.*;
[ "com.caucho.quercus" ]
com.caucho.quercus;
1,178,643
private static Pair<DiagnosticKind, Boolean> parseCategoryString(String category) { final String fixable = "fixable-"; final boolean isFixable = category.startsWith(fixable); if (isFixable) { category = category.substring(fixable.length()); } DiagnosticKind categoryEnum = DiagnosticKind.fromParseString(category); return Pair.of(categoryEnum, isFixable); }
static Pair<DiagnosticKind, Boolean> function(String category) { final String fixable = STR; final boolean isFixable = category.startsWith(fixable); if (isFixable) { category = category.substring(fixable.length()); } DiagnosticKind categoryEnum = DiagnosticKind.fromParseString(category); return Pair.of(categoryEnum, isFixable); }
/** * Given a category string that may be prepended with "fixable-", return the category * enum that corresponds with the category and whether or not it is a isFixable error */
Given a category string that may be prepended with "fixable-", return the category enum that corresponds with the category and whether or not it is a isFixable error
parseCategoryString
{ "repo_name": "pbsf/checker-framework", "path": "framework/src/org/checkerframework/framework/test/diagnostics/TestDiagnosticUtils.java", "license": "gpl-2.0", "size": 12484 }
[ "org.checkerframework.javacutil.Pair" ]
import org.checkerframework.javacutil.Pair;
import org.checkerframework.javacutil.*;
[ "org.checkerframework.javacutil" ]
org.checkerframework.javacutil;
1,171,992
protected final void unserialize(InputStream inputStream) throws IOException { DataInputStream input = new DataInputStream(inputStream); int indexDataLength = m_dataOffset_ + m_dataLength_; m_index_ = new char[indexDataLength]; for (int i = 0; i < indexDataLength; i ++) { m_index_[i] = input.readChar(); } m_data_ = m_index_; m_initialValue_ = m_data_[m_dataOffset_]; }
final void function(InputStream inputStream) throws IOException { DataInputStream input = new DataInputStream(inputStream); int indexDataLength = m_dataOffset_ + m_dataLength_; m_index_ = new char[indexDataLength]; for (int i = 0; i < indexDataLength; i ++) { m_index_[i] = input.readChar(); } m_data_ = m_index_; m_initialValue_ = m_data_[m_dataOffset_]; }
/** * <p>Parses the input stream and stores its trie content into a index and * data array</p> * @param inputStream data input stream containing trie data * @exception IOException thrown when data reading fails */
Parses the input stream and stores its trie content into a index and data array
unserialize
{ "repo_name": "TheTypoMaster/Scaper", "path": "openjdk/jdk/src/share/classes/sun/text/normalizer/CharTrie.java", "license": "gpl-2.0", "size": 11688 }
[ "java.io.DataInputStream", "java.io.IOException", "java.io.InputStream" ]
import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,588,747
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerDeathLowest(PlayerDeathEvent event) { String deathMessage = event.getDeathMessage(); if (deathMessage == null) { return; } Player player = event.getEntity(); event.setDeathMessage(MobHealthbarUtils.fixDeathMessage(deathMessage, player)); }
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) void function(PlayerDeathEvent event) { String deathMessage = event.getDeathMessage(); if (deathMessage == null) { return; } Player player = event.getEntity(); event.setDeathMessage(MobHealthbarUtils.fixDeathMessage(deathMessage, player)); }
/** * Handle PlayerDeathEvents at the lowest priority. * <p> * These events are used to modify the death message of a player when * needed to correct issues potentially caused by the custom naming used * for mob healthbars. * * @param event The event to modify */
Handle PlayerDeathEvents at the lowest priority. These events are used to modify the death message of a player when needed to correct issues potentially caused by the custom naming used for mob healthbars
onPlayerDeathLowest
{ "repo_name": "losu/SoftM-mcMMO", "path": "src/main/java/com/gmail/nossr50/listeners/PlayerListener.java", "license": "agpl-3.0", "size": 29570 }
[ "com.gmail.nossr50.util.MobHealthbarUtils", "org.bukkit.entity.Player", "org.bukkit.event.EventHandler", "org.bukkit.event.EventPriority", "org.bukkit.event.entity.PlayerDeathEvent" ]
import com.gmail.nossr50.util.MobHealthbarUtils; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent;
import com.gmail.nossr50.util.*; import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.entity.*;
[ "com.gmail.nossr50", "org.bukkit.entity", "org.bukkit.event" ]
com.gmail.nossr50; org.bukkit.entity; org.bukkit.event;
2,478,072
public void setTableMode(TableMode tableMode) { this.tableMode = tableMode; }
void function(TableMode tableMode) { this.tableMode = tableMode; }
/** * Set the style of the table. The default style is {@link com.smartgwt.mobile.client.types.TableMode#PLAIN}. * * @param tableMode the default table style (plain or grouped) */
Set the style of the table. The default style is <code>com.smartgwt.mobile.client.types.TableMode#PLAIN</code>
setTableMode
{ "repo_name": "will-gilbert/SmartGWT-Mobile", "path": "mobile/src/main/java/com/smartgwt/mobile/client/widgets/tableview/TableView.java", "license": "unlicense", "size": 110536 }
[ "com.smartgwt.mobile.client.types.TableMode" ]
import com.smartgwt.mobile.client.types.TableMode;
import com.smartgwt.mobile.client.types.*;
[ "com.smartgwt.mobile" ]
com.smartgwt.mobile;
2,722,375
protected Map createTranscodingHints() { Map hints = new HashMap(3); hints.put(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER, px2mm); return hints; }
Map function() { Map hints = new HashMap(3); hints.put(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER, px2mm); return hints; }
/** * Creates a Map that contains additional transcoding hints. */
Creates a Map that contains additional transcoding hints
createTranscodingHints
{ "repo_name": "git-moss/Push2Display", "path": "lib/batik-1.8/test-sources/org/apache/batik/transcoder/image/PixelToMMTest.java", "license": "lgpl-3.0", "size": 2600 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
94,849
public Thread start(CollectorRegistry registry) { return start(registry, 60); }
Thread function(CollectorRegistry registry) { return start(registry, 60); }
/** * Push samples from the given registry to Graphite every minute. */
Push samples from the given registry to Graphite every minute
start
{ "repo_name": "prometheus/client_java", "path": "simpleclient_graphite_bridge/src/main/java/io/prometheus/client/bridge/Graphite.java", "license": "apache-2.0", "size": 3675 }
[ "io.prometheus.client.CollectorRegistry" ]
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.*;
[ "io.prometheus.client" ]
io.prometheus.client;
745,105
public void mergeWith(ArrayList<LogMessage> newMessages) { if (newMessages != null && newMessages.size() > 0) { for (LogMessage message : newMessages) { messages.add(message); } updateFromServer = true; } else { Log.d(TAG, "No new messages. Stopping updates.."); showLoadingItem = false; } notifyDataSetChanged(); }
void function(ArrayList<LogMessage> newMessages) { if (newMessages != null && newMessages.size() > 0) { for (LogMessage message : newMessages) { messages.add(message); } updateFromServer = true; } else { Log.d(TAG, STR); showLoadingItem = false; } notifyDataSetChanged(); }
/** * Add ArrayList of messages to the existing messages * * @param newMessages */
Add ArrayList of messages to the existing messages
mergeWith
{ "repo_name": "pocmo/Graylog-Android", "path": "src/com/jimdo/graylog/adapter/MessageListAdapter.java", "license": "gpl-3.0", "size": 4404 }
[ "android.util.Log", "com.jimdo.graylog.model.LogMessage", "java.util.ArrayList" ]
import android.util.Log; import com.jimdo.graylog.model.LogMessage; import java.util.ArrayList;
import android.util.*; import com.jimdo.graylog.model.*; import java.util.*;
[ "android.util", "com.jimdo.graylog", "java.util" ]
android.util; com.jimdo.graylog; java.util;
1,100,607
public EmbeddedSampleStream selectEmbeddedTrack(long positionUs, int trackType) { for (int i = 0; i < embeddedSampleQueues.length; i++) { if (embeddedTrackTypes[i] == trackType) { Assertions.checkState(!embeddedTracksSelected[i]); embeddedTracksSelected[i] = true; embeddedSampleQueues[i].rewind(); embeddedSampleQueues[i].advanceTo(positionUs, true, true); return new EmbeddedSampleStream(this, embeddedSampleQueues[i], i); } } // Should never happen. throw new IllegalStateException(); }
EmbeddedSampleStream function(long positionUs, int trackType) { for (int i = 0; i < embeddedSampleQueues.length; i++) { if (embeddedTrackTypes[i] == trackType) { Assertions.checkState(!embeddedTracksSelected[i]); embeddedTracksSelected[i] = true; embeddedSampleQueues[i].rewind(); embeddedSampleQueues[i].advanceTo(positionUs, true, true); return new EmbeddedSampleStream(this, embeddedSampleQueues[i], i); } } throw new IllegalStateException(); }
/** * Selects the embedded track, returning a new {@link EmbeddedSampleStream} from which the track's * samples can be consumed. {@link EmbeddedSampleStream#release()} must be called on the returned * stream when the track is no longer required, and before calling this method again to obtain * another stream for the same track. * * @param positionUs The current playback position in microseconds. * @param trackType The type of the embedded track to enable. * @return The {@link EmbeddedSampleStream} for the embedded track. */
Selects the embedded track, returning a new <code>EmbeddedSampleStream</code> from which the track's samples can be consumed. <code>EmbeddedSampleStream#release()</code> must be called on the returned stream when the track is no longer required, and before calling this method again to obtain another stream for the same track
selectEmbeddedTrack
{ "repo_name": "tntcrowd/ExoPlayer", "path": "library/core/src/main/java/com/google/android/exoplayer2/source/chunk/ChunkSampleStream.java", "license": "apache-2.0", "size": 26706 }
[ "com.google.android.exoplayer2.util.Assertions" ]
import com.google.android.exoplayer2.util.Assertions;
import com.google.android.exoplayer2.util.*;
[ "com.google.android" ]
com.google.android;
794,520
protected void buildRepresentation(T entity) { setSprite(SpriteStore.get().getSprite(translate(entity.getType()))); calculateOffset(entity, getWidth(), getHeight()); }
void function(T entity) { setSprite(SpriteStore.get().getSprite(translate(entity.getType()))); calculateOffset(entity, getWidth(), getHeight()); }
/** * Rebuild the representation using the base entity. * * @param entity the eEntity to build the representation for */
Rebuild the representation using the base entity
buildRepresentation
{ "repo_name": "AntumDeluge/arianne-stendhal", "path": "src/games/stendhal/client/gui/j2d/entity/Entity2DView.java", "license": "gpl-2.0", "size": 23578 }
[ "games.stendhal.client.sprite.SpriteStore" ]
import games.stendhal.client.sprite.SpriteStore;
import games.stendhal.client.sprite.*;
[ "games.stendhal.client" ]
games.stendhal.client;
1,473,879
public void handleEvent(Event evt) { Object[] defs = importRemovedListener.toBeRemoved.toArray(); importRemovedListener.toBeRemoved.clear(); for (int i = 0; i < defs.length; i++) { XBLOMDefinitionElement def = (XBLOMDefinitionElement) defs[i]; DefinitionRecord defRec = (DefinitionRecord) definitions.get(def, importElement); removeDefinition(defRec); } } } protected class DocInsertedListener implements EventListener {
void function(Event evt) { Object[] defs = importRemovedListener.toBeRemoved.toArray(); importRemovedListener.toBeRemoved.clear(); for (int i = 0; i < defs.length; i++) { XBLOMDefinitionElement def = (XBLOMDefinitionElement) defs[i]; DefinitionRecord defRec = (DefinitionRecord) definitions.get(def, importElement); removeDefinition(defRec); } } } protected class DocInsertedListener implements EventListener {
/** * Handles the event. */
Handles the event
handleEvent
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/svg12/DefaultXBLManager.java", "license": "apache-2.0", "size": 70751 }
[ "org.apache.flex.forks.batik.dom.svg12.XBLOMDefinitionElement", "org.w3c.dom.events.Event", "org.w3c.dom.events.EventListener" ]
import org.apache.flex.forks.batik.dom.svg12.XBLOMDefinitionElement; import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener;
import org.apache.flex.forks.batik.dom.svg12.*; import org.w3c.dom.events.*;
[ "org.apache.flex", "org.w3c.dom" ]
org.apache.flex; org.w3c.dom;
1,321,958
private void unpackEntryToInstallPath(ZipInputStream zis, ZipEntry entry, String targetName) throws IOException { int read = 0; byte[] buffer = new byte[1024]; File dest = obtainTargetFile(targetName); // cares for renaming existing files FileOutputStream fos = new FileOutputStream(dest); while ((read = zis.read(buffer)) != -1) { fos.write(buffer, 0, read); } fos.close(); }
void function(ZipInputStream zis, ZipEntry entry, String targetName) throws IOException { int read = 0; byte[] buffer = new byte[1024]; File dest = obtainTargetFile(targetName); FileOutputStream fos = new FileOutputStream(dest); while ((read = zis.read(buffer)) != -1) { fos.write(buffer, 0, read); } fos.close(); }
/** * Unpacks a ZIP entry to the bundle installation path. * @param zis the ZIP input stream * @param entry the ZIP entry to unpack * @param targetName the relative name of the target file * @throws IOException any occuring I/O exception */
Unpacks a ZIP entry to the bundle installation path
unpackEntryToInstallPath
{ "repo_name": "SSEHUB/EASyProducer", "path": "Plugins/Reasoner/ReasonerCore/ReasonerCore/src/net/ssehub/easy/reasoning/core/reasoner/ZipUpgrader.java", "license": "apache-2.0", "size": 3396 }
[ "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.util.zip.ZipEntry", "java.util.zip.ZipInputStream" ]
import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream;
import java.io.*; import java.util.zip.*;
[ "java.io", "java.util" ]
java.io; java.util;
891,631
@Override public void clear() { for (List<E> innerList : outerList) innerList.clear(); outerList.clear(); } /** * {@inheritDoc}
void function() { for (List<E> innerList : outerList) innerList.clear(); outerList.clear(); } /** * {@inheritDoc}
/** * Removes all of the elements from this list. The list will be empty after this call * returns. */
Removes all of the elements from this list. The list will be empty after this call returns
clear
{ "repo_name": "pwall567/javautil", "path": "src/main/java/net/pwall/util/ChunkedArrayList.java", "license": "mit", "size": 11193 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,060,353
public void deleteMsgPool() { Bridge.deleteMsgPool(refToCObject); }
void function() { Bridge.deleteMsgPool(refToCObject); }
/** * Deletes this MsgPool. This method releases all memory allocated in C * and therefore this should be the last method called for this MsgPool */
Deletes this MsgPool. This method releases all memory allocated in C and therefore this should be the last method called for this MsgPool
deleteMsgPool
{ "repo_name": "dke-knu/i2am", "path": "JXIO/src/java/org/accelio/jxio/MsgPool.java", "license": "apache-2.0", "size": 6842 }
[ "org.accelio.jxio.impl.Bridge" ]
import org.accelio.jxio.impl.Bridge;
import org.accelio.jxio.impl.*;
[ "org.accelio.jxio" ]
org.accelio.jxio;
197,894
@Override public ShardRouting routingEntry() { return this.shardRouting; }
ShardRouting function() { return this.shardRouting; }
/** * Returns the latest cluster routing entry received with this shard. */
Returns the latest cluster routing entry received with this shard
routingEntry
{ "repo_name": "JervyShi/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/shard/IndexShard.java", "license": "apache-2.0", "size": 86664 }
[ "org.elasticsearch.cluster.routing.ShardRouting" ]
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.*;
[ "org.elasticsearch.cluster" ]
org.elasticsearch.cluster;
975,160
private XMLParserRegionFactory fRegionFactory = new XMLParserRegionFactory(); public final void addBlockMarker(BlockMarker marker) { if(containsTagName(marker.getTagName())) return; fBlockMarkers.add(marker); }
XMLParserRegionFactory fRegionFactory = new XMLParserRegionFactory(); public final void function(BlockMarker marker) { if(containsTagName(marker.getTagName())) return; fBlockMarkers.add(marker); }
/** * user method */
user method
addBlockMarker
{ "repo_name": "ttimbul/eclipse.wst", "path": "bundles/org.eclipse.wst.sse.core/DevTimeSupport/SedModel/HTMLTokenizer/devel/XMLTokenizer.java", "license": "epl-1.0", "size": 62668 }
[ "org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker", "org.eclipse.wst.xml.core.internal.parser.regions.XMLParserRegionFactory" ]
import org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker; import org.eclipse.wst.xml.core.internal.parser.regions.XMLParserRegionFactory;
import org.eclipse.wst.sse.core.internal.ltk.parser.*; import org.eclipse.wst.xml.core.internal.parser.regions.*;
[ "org.eclipse.wst" ]
org.eclipse.wst;
2,831,513
@JsonProperty("date") public void setDate(Date date) { this.date = date; }
@JsonProperty("date") void function(Date date) { this.date = date; }
/** * Date * <p> * The date when this bid was received. */
Date The date when this bid was received
setDate
{ "repo_name": "devgateway/ocua", "path": "persistence-mongodb/src/main/java/org/devgateway/ocds/persistence/mongo/Detail.java", "license": "mit", "size": 6047 }
[ "com.fasterxml.jackson.annotation.JsonProperty", "java.util.Date" ]
import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Date;
import com.fasterxml.jackson.annotation.*; import java.util.*;
[ "com.fasterxml.jackson", "java.util" ]
com.fasterxml.jackson; java.util;
2,271,703
if (projectParsed.getWindow() != null) { throw new UnsupportedException("ElasticSearch don't support Window Operation"); } }
if (projectParsed.getWindow() != null) { throw new UnsupportedException(STR); } }
/** * This method validate the project parsed to ElasticSearch. * * @param projectParsed * the project parsed. * @throws UnsupportedException * if a logicalStep is not supported * */
This method validate the project parsed to ElasticSearch
validate
{ "repo_name": "Stratio/stratio-connector-elasticsearch", "path": "connector-elasticsearch/src/main/java/com/stratio/connector/elasticsearch/core/engine/query/ESProjectParsedValidator.java", "license": "apache-2.0", "size": 1676 }
[ "com.stratio.crossdata.common.exceptions.UnsupportedException" ]
import com.stratio.crossdata.common.exceptions.UnsupportedException;
import com.stratio.crossdata.common.exceptions.*;
[ "com.stratio.crossdata" ]
com.stratio.crossdata;
327,161
NameGenerator clone( Set<String> reservedNames, String prefix, @Nullable char[] reservedCharacters);
NameGenerator clone( Set<String> reservedNames, String prefix, @Nullable char[] reservedCharacters);
/** * Returns a clone of this NameGenerator, reconfigured and reset. */
Returns a clone of this NameGenerator, reconfigured and reset
clone
{ "repo_name": "Medium/closure-compiler", "path": "src/com/google/javascript/jscomp/NameGenerator.java", "license": "apache-2.0", "size": 1686 }
[ "java.util.Set", "javax.annotation.Nullable" ]
import java.util.Set; import javax.annotation.Nullable;
import java.util.*; import javax.annotation.*;
[ "java.util", "javax.annotation" ]
java.util; javax.annotation;
2,073,034
public static boolean isExternalMemoryAvailable() { return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); }
static boolean function() { return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); }
/** * Judge whether external momory is available * * @return */
Judge whether external momory is available
isExternalMemoryAvailable
{ "repo_name": "wwah/AndroidBasicLibs", "path": "common/src/main/java/cn/wwah/common/cache/MemoryCache.java", "license": "mit", "size": 8281 }
[ "android.os.Environment" ]
import android.os.Environment;
import android.os.*;
[ "android.os" ]
android.os;
1,646,174
@Test public void testRunTwoTiersWithExistingSegments() throws Exception { mockCoordinator(); mockPeon.loadSegment(EasyMock.<DataSegment>anyObject(), EasyMock.<LoadPeonCallback>anyObject()); EasyMock.expectLastCall().atLeastOnce(); mockEmptyPeon(); EasyMock.expect(databaseRuleManager.getRulesWithDefault(EasyMock.<String>anyObject())).andReturn( Lists.<Rule>newArrayList( new IntervalLoadRule( Intervals.of("2012-01-01T00:00:00.000Z/2012-01-01T12:00:00.000Z"), ImmutableMap.<String, Integer>of("hot", 1) ), new IntervalLoadRule( Intervals.of("2012-01-01T00:00:00.000Z/2012-01-02T00:00:00.000Z"), ImmutableMap.<String, Integer>of("normal", 1) ) ) ).atLeastOnce(); EasyMock.replay(databaseRuleManager); DruidServer normServer = new DruidServer( "serverNorm", "hostNorm", null, 1000, ServerType.HISTORICAL, "normal", 0 ); for (DataSegment availableSegment : availableSegments) { normServer.addDataSegment(availableSegment.getIdentifier(), availableSegment); } DruidCluster druidCluster = new DruidCluster( null, ImmutableMap.of( "hot", Stream.of( new ServerHolder( new DruidServer( "serverHot", "hostHot", null, 1000, ServerType.HISTORICAL, "hot", 0 ).toImmutableDruidServer(), mockPeon ) ).collect(Collectors.toCollection(() -> new TreeSet<>(Collections.reverseOrder()))), "normal", Stream.of( new ServerHolder( normServer.toImmutableDruidServer(), mockPeon ) ).collect(Collectors.toCollection(() -> new TreeSet<>(Collections.reverseOrder()))) ) ); SegmentReplicantLookup segmentReplicantLookup = SegmentReplicantLookup.make(druidCluster); ListeningExecutorService exec = MoreExecutors.listeningDecorator( Executors.newFixedThreadPool(1)); BalancerStrategy balancerStrategy = new CostBalancerStrategyFactory().createBalancerStrategy(exec); DruidCoordinatorRuntimeParams params = new DruidCoordinatorRuntimeParams.Builder() .withDruidCluster(druidCluster) .withAvailableSegments(availableSegments) .withDatabaseRuleManager(databaseRuleManager) .withSegmentReplicantLookup(segmentReplicantLookup) .withBalancerStrategy(balancerStrategy) .withBalancerReferenceTimestamp(DateTimes.of("2013-01-01")) .build(); DruidCoordinatorRuntimeParams afterParams = ruleRunner.run(params); CoordinatorStats stats = afterParams.getCoordinatorStats(); Assert.assertEquals(12L, stats.getTieredStat("assignedCount", "hot")); Assert.assertEquals(0L, stats.getTieredStat("assignedCount", "normal")); Assert.assertTrue(stats.getTiers("unassignedCount").isEmpty()); Assert.assertTrue(stats.getTiers("unassignedSize").isEmpty()); exec.shutdown(); EasyMock.verify(mockPeon); }
void function() throws Exception { mockCoordinator(); mockPeon.loadSegment(EasyMock.<DataSegment>anyObject(), EasyMock.<LoadPeonCallback>anyObject()); EasyMock.expectLastCall().atLeastOnce(); mockEmptyPeon(); EasyMock.expect(databaseRuleManager.getRulesWithDefault(EasyMock.<String>anyObject())).andReturn( Lists.<Rule>newArrayList( new IntervalLoadRule( Intervals.of(STR), ImmutableMap.<String, Integer>of("hot", 1) ), new IntervalLoadRule( Intervals.of(STR), ImmutableMap.<String, Integer>of(STR, 1) ) ) ).atLeastOnce(); EasyMock.replay(databaseRuleManager); DruidServer normServer = new DruidServer( STR, STR, null, 1000, ServerType.HISTORICAL, STR, 0 ); for (DataSegment availableSegment : availableSegments) { normServer.addDataSegment(availableSegment.getIdentifier(), availableSegment); } DruidCluster druidCluster = new DruidCluster( null, ImmutableMap.of( "hot", Stream.of( new ServerHolder( new DruidServer( STR, STR, null, 1000, ServerType.HISTORICAL, "hot", 0 ).toImmutableDruidServer(), mockPeon ) ).collect(Collectors.toCollection(() -> new TreeSet<>(Collections.reverseOrder()))), STR, Stream.of( new ServerHolder( normServer.toImmutableDruidServer(), mockPeon ) ).collect(Collectors.toCollection(() -> new TreeSet<>(Collections.reverseOrder()))) ) ); SegmentReplicantLookup segmentReplicantLookup = SegmentReplicantLookup.make(druidCluster); ListeningExecutorService exec = MoreExecutors.listeningDecorator( Executors.newFixedThreadPool(1)); BalancerStrategy balancerStrategy = new CostBalancerStrategyFactory().createBalancerStrategy(exec); DruidCoordinatorRuntimeParams params = new DruidCoordinatorRuntimeParams.Builder() .withDruidCluster(druidCluster) .withAvailableSegments(availableSegments) .withDatabaseRuleManager(databaseRuleManager) .withSegmentReplicantLookup(segmentReplicantLookup) .withBalancerStrategy(balancerStrategy) .withBalancerReferenceTimestamp(DateTimes.of(STR)) .build(); DruidCoordinatorRuntimeParams afterParams = ruleRunner.run(params); CoordinatorStats stats = afterParams.getCoordinatorStats(); Assert.assertEquals(12L, stats.getTieredStat(STR, "hot")); Assert.assertEquals(0L, stats.getTieredStat(STR, STR)); Assert.assertTrue(stats.getTiers(STR).isEmpty()); Assert.assertTrue(stats.getTiers(STR).isEmpty()); exec.shutdown(); EasyMock.verify(mockPeon); }
/** * Nodes: * hot - 1 replicant * normal - 1 replicant * * @throws Exception */
Nodes: hot - 1 replicant normal - 1 replicant
testRunTwoTiersWithExistingSegments
{ "repo_name": "andy256/druid", "path": "server/src/test/java/io/druid/server/coordinator/DruidCoordinatorRuleRunnerTest.java", "license": "apache-2.0", "size": 52149 }
[ "com.google.common.collect.ImmutableMap", "com.google.common.collect.Lists", "com.google.common.util.concurrent.ListeningExecutorService", "com.google.common.util.concurrent.MoreExecutors", "io.druid.client.DruidServer", "io.druid.java.util.common.DateTimes", "io.druid.java.util.common.Intervals", "io.druid.server.coordination.ServerType", "io.druid.server.coordinator.rules.IntervalLoadRule", "io.druid.server.coordinator.rules.Rule", "io.druid.timeline.DataSegment", "java.util.Collections", "java.util.TreeSet", "java.util.concurrent.Executors", "java.util.stream.Collectors", "java.util.stream.Stream", "org.easymock.EasyMock", "org.junit.Assert" ]
import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import io.druid.client.DruidServer; import io.druid.java.util.common.DateTimes; import io.druid.java.util.common.Intervals; import io.druid.server.coordination.ServerType; import io.druid.server.coordinator.rules.IntervalLoadRule; import io.druid.server.coordinator.rules.Rule; import io.druid.timeline.DataSegment; import java.util.Collections; import java.util.TreeSet; import java.util.concurrent.Executors; import java.util.stream.Collectors; import java.util.stream.Stream; import org.easymock.EasyMock; import org.junit.Assert;
import com.google.common.collect.*; import com.google.common.util.concurrent.*; import io.druid.client.*; import io.druid.java.util.common.*; import io.druid.server.coordination.*; import io.druid.server.coordinator.rules.*; import io.druid.timeline.*; import java.util.*; import java.util.concurrent.*; import java.util.stream.*; import org.easymock.*; import org.junit.*;
[ "com.google.common", "io.druid.client", "io.druid.java", "io.druid.server", "io.druid.timeline", "java.util", "org.easymock", "org.junit" ]
com.google.common; io.druid.client; io.druid.java; io.druid.server; io.druid.timeline; java.util; org.easymock; org.junit;
278,169
Assert.fail("Test 'CountryDaoTransformTest.testToCountryVO' not implemented!"); }
Assert.fail(STR); }
/** * Test for method CountryDao.toCountryVO * * @see org.phoenixctms.ctsms.domain.CountryDao#toCountryVO(org.phoenixctms.ctsms.domain.Country source, org.phoenixctms.ctsms.vo.CountryVO target) */
Test for method CountryDao.toCountryVO
testToCountryVO
{ "repo_name": "phoenixctms/ctsms", "path": "core/src/test/java/org/phoenixctms/ctsms/domain/test/CountryDaoTransformTest.java", "license": "lgpl-2.1", "size": 1181 }
[ "org.testng.Assert" ]
import org.testng.Assert;
import org.testng.*;
[ "org.testng" ]
org.testng;
1,812,376
Value<T> tokenToValue(TokenValue<?> token, Deque<Value<T>> next); /** * Transform a rule and its arguments to a a custom value * of the target data structure. * The boundaries of the rule are defined by the * rule start and rule end events, the events within * are considered as argument (unless they are marked * as fragments). * * @see RuleStart * @see RuleEnd * @see Fragment
Value<T> tokenToValue(TokenValue<?> token, Deque<Value<T>> next); /** * Transform a rule and its arguments to a a custom value * of the target data structure. * The boundaries of the rule are defined by the * rule start and rule end events, the events within * are considered as argument (unless they are marked * as fragments). * * @see RuleStart * @see RuleEnd * @see Fragment
/** * Transform a token value to a custom value of * the target data structure. * * @param token The actual token. * @param next The next values within the boundaries of the current rule. * For example, if your grammar can parse "+ 123" and that "+" is the * token, then "123" is the first item within the next values. * @return A value */
Transform a token value to a custom value of the target data structure
tokenToValue
{ "repo_name": "alternet/alternet.ml", "path": "parsing/src/main/java/ml/alternet/parser/handlers/ValueMapper.java", "license": "mit", "size": 2880 }
[ "java.util.Deque", "ml.alternet.parser.EventsHandler", "ml.alternet.parser.Grammar" ]
import java.util.Deque; import ml.alternet.parser.EventsHandler; import ml.alternet.parser.Grammar;
import java.util.*; import ml.alternet.parser.*;
[ "java.util", "ml.alternet.parser" ]
java.util; ml.alternet.parser;
2,824,133
public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName, String templateName, CacheConfigurationOverride cfgOverride, boolean checkThreadTx) { assert cacheName != null; try { if (publicJCache(cacheName, false, checkThreadTx) != null) // Cache with given name already started. return new GridFinishedFuture<>(); CacheConfiguration ccfg = F.isEmpty(templateName) ? getOrCreateConfigFromTemplate(cacheName) : getOrCreateConfigFromTemplate(templateName); ccfg.setName(cacheName); if (cfgOverride != null) cfgOverride.apply(ccfg); return dynamicStartCache(ccfg, cacheName, null, false, true, checkThreadTx); } catch (IgniteCheckedException e) { return new GridFinishedFuture<>(e); } }
IgniteInternalFuture<?> function(String cacheName, String templateName, CacheConfigurationOverride cfgOverride, boolean checkThreadTx) { assert cacheName != null; try { if (publicJCache(cacheName, false, checkThreadTx) != null) return new GridFinishedFuture<>(); CacheConfiguration ccfg = F.isEmpty(templateName) ? getOrCreateConfigFromTemplate(cacheName) : getOrCreateConfigFromTemplate(templateName); ccfg.setName(cacheName); if (cfgOverride != null) cfgOverride.apply(ccfg); return dynamicStartCache(ccfg, cacheName, null, false, true, checkThreadTx); } catch (IgniteCheckedException e) { return new GridFinishedFuture<>(e); } }
/** * Dynamically starts cache using template configuration. * * @param cacheName Cache name. * @param templateName Cache template name. * @param cfgOverride Cache config properties to override. * @param checkThreadTx If {@code true} checks that current thread does not have active transactions. * @return Future that will be completed when cache is deployed. */
Dynamically starts cache using template configuration
getOrCreateFromTemplate
{ "repo_name": "vladisav/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java", "license": "apache-2.0", "size": 163107 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.configuration.CacheConfiguration", "org.apache.ignite.internal.IgniteInternalFuture", "org.apache.ignite.internal.util.future.GridFinishedFuture", "org.apache.ignite.internal.util.typedef.F" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.IgniteInternalFuture; import org.apache.ignite.internal.util.future.GridFinishedFuture; import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.future.*; import org.apache.ignite.internal.util.typedef.*;
[ "org.apache.ignite" ]
org.apache.ignite;
2,359,595
@Deprecated public void setCellBackgroundColor(String cellBackgroundColor) { if (!Color.isValid(cellBackgroundColor)) { Logger.getLogger(Cell.class.getName()).log(Level.WARNING, "Parameter is invalid for datatype Color, default background color #FFFFFF will be set."); cellBackgroundColor = DEFAULT_BACKGROUND_COLOR; } splitRepeatedCells(); OdfStyleBase styleElement = getStyleHandler().getStyleElementForWrite(); if (styleElement != null) { OdfStyleProperty bkColorProperty = OdfStyleProperty.get(OdfStylePropertiesSet.TableCellProperties, OdfName .newName(OdfDocumentNamespace.FO, "background-color")); styleElement.setProperty(bkColorProperty, cellBackgroundColor); } }
void function(String cellBackgroundColor) { if (!Color.isValid(cellBackgroundColor)) { Logger.getLogger(Cell.class.getName()).log(Level.WARNING, STR); cellBackgroundColor = DEFAULT_BACKGROUND_COLOR; } splitRepeatedCells(); OdfStyleBase styleElement = getStyleHandler().getStyleElementForWrite(); if (styleElement != null) { OdfStyleProperty bkColorProperty = OdfStyleProperty.get(OdfStylePropertiesSet.TableCellProperties, OdfName .newName(OdfDocumentNamespace.FO, STR)); styleElement.setProperty(bkColorProperty, cellBackgroundColor); } }
/** * Set the background color of this cell using string. The string must be a * valid argument for constructing {@link org.odftoolkit.odfdom.type.Color * <code>org.odftoolkit.odfdom.type.Color</code>}. * * @param cellBackgroundColor * the background color that need to set. If cellBackgroundColor * is null, default background color #FFFFFF will be set. * @see org.odftoolkit.odfdom.type.Color * @see #setCellBackgroundColor(Color) * @deprecated As of Simple version 0.3, replaced by * <code>setCellBackgroundColor(Color)</code> */
Set the background color of this cell using string. The string must be a valid argument for constructing <code>org.odftoolkit.odfdom.type.Color <code>org.odftoolkit.odfdom.type.Color</code></code>
setCellBackgroundColor
{ "repo_name": "jbjonesjr/geoproponis", "path": "external/simple-odf-0.8.1-incubating-sources/org/odftoolkit/simple/table/Cell.java", "license": "gpl-2.0", "size": 87992 }
[ "java.util.logging.Level", "java.util.logging.Logger", "org.odftoolkit.odfdom.dom.OdfDocumentNamespace", "org.odftoolkit.odfdom.dom.element.OdfStyleBase", "org.odftoolkit.odfdom.dom.style.props.OdfStylePropertiesSet", "org.odftoolkit.odfdom.dom.style.props.OdfStyleProperty", "org.odftoolkit.odfdom.pkg.OdfName", "org.odftoolkit.odfdom.type.Color" ]
import java.util.logging.Level; import java.util.logging.Logger; import org.odftoolkit.odfdom.dom.OdfDocumentNamespace; import org.odftoolkit.odfdom.dom.element.OdfStyleBase; import org.odftoolkit.odfdom.dom.style.props.OdfStylePropertiesSet; import org.odftoolkit.odfdom.dom.style.props.OdfStyleProperty; import org.odftoolkit.odfdom.pkg.OdfName; import org.odftoolkit.odfdom.type.Color;
import java.util.logging.*; import org.odftoolkit.odfdom.dom.*; import org.odftoolkit.odfdom.dom.element.*; import org.odftoolkit.odfdom.dom.style.props.*; import org.odftoolkit.odfdom.pkg.*; import org.odftoolkit.odfdom.type.*;
[ "java.util", "org.odftoolkit.odfdom" ]
java.util; org.odftoolkit.odfdom;
571,405
int getScanArgs(TransactionController tc, MethodBuilder mb, Optimizable innerTable, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, ExpressionClassBuilderInterface acb, int bulkFetch, MethodBuilder resultRowAllocator, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int maxMemoryPerTable, boolean genInListVals ) throws StandardException;
int getScanArgs(TransactionController tc, MethodBuilder mb, Optimizable innerTable, OptimizablePredicateList storeRestrictionList, OptimizablePredicateList nonStoreRestrictionList, ExpressionClassBuilderInterface acb, int bulkFetch, MethodBuilder resultRowAllocator, int colRefItem, int indexColItem, int lockMode, boolean tableLocked, int isolationLevel, int maxMemoryPerTable, boolean genInListVals ) throws StandardException;
/** * Get the appropriate arguments to the scan for this type of join. * * @param tc The TransactionController * @param mb The method to generate the arguments in * @param innerTable The inner table of the join * @param storeRestrictionList The predicate list to be evaluated in the * store * @param nonStoreRestrictionList The predicate list to be evaluated * outside of the store * @param acb The expression class builder for the activation class * we're building * @param bulkFetch The amount of bulk fetch to do * @param resultRowAllocator A completed method to allocate the result row * @param colRefItem The item number of the column reference bit map * @param lockMode The lock mode to use when scanning the table * (see TransactionController). * @param tableLocked Whether or not the table is marked (in sys.systables) * as always using table locking * @param isolationLevel Isolation level specified (or not) for scans * @param maxMemoryPerTable Max memory per table * @param genInListVals Whether or not we are going to generate IN-list * values with which to probe the inner table. * * @return Count of the expressions pushed to use as the parameters to the * result set for the inner table * * @exception StandardException Thrown on error */
Get the appropriate arguments to the scan for this type of join
getScanArgs
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/iapi/sql/compile/JoinStrategy.java", "license": "apache-2.0", "size": 10975 }
[ "org.apache.derby.iapi.error.StandardException", "org.apache.derby.iapi.services.compiler.MethodBuilder", "org.apache.derby.iapi.store.access.TransactionController" ]
import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.services.compiler.MethodBuilder; import org.apache.derby.iapi.store.access.TransactionController;
import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.services.compiler.*; import org.apache.derby.iapi.store.access.*;
[ "org.apache.derby" ]
org.apache.derby;
2,029,672
private void showToolTipForNearestNode(final LatLon point) { final Node node = (ExtendedNode) nc.getDataSet().getNearestNode(point, new UsedTags()); if (node != null) { nc.setSelectedNodePosition(new LatLon(node.getLatitude(), node.getLongitude())); ((JComponent) nc).repaint(); if (!Settings.getInstance().getBoolean("showAllTags", false)) { StringBuffer text = new StringBuffer("<html>"); String name = NodeHelper.getTag(node, Tags.TAG_NAME); if (name != null) { text.append(name); } String fulladdress = NodeHelper.getTag(node, Tags.TAG_ADDR_FULL); if (fulladdress != null) { text.append("<br>" + fulladdress); } else { String street = NodeHelper.getTag(node, Tags.TAG_ADDR_STREET); if (street != null) { text.append("<br>" + street); } String housenumber = NodeHelper.getTag(node, UsedTags.TAG_ADDR_HOUSENUMBER); if (housenumber != null) { text.append(", " + housenumber); } String housename = NodeHelper.getTag(node, UsedTags.TAG_ADDR_HOUSENAME); if (housename != null) { text.append(", " + housename); } } final Iterator<Way> ways = nc.getDataSet().getWaysForNode(node.getId()); while (ways.hasNext()) { Way way = ways.next(); name = WayHelper.getTag(way, Tags.TAG_NAME); final int minLengthForComma = 6; if (name != null) { if (text.length() > minLengthForComma) { text.append(", "); } text.append(name); } fulladdress = WayHelper.getTag(way, Tags.TAG_ADDR_FULL); if (fulladdress != null) { text.append("<br>" + fulladdress); } else { String street = WayHelper.getTag(way, Tags.TAG_ADDR_STREET); if (street != null) { if (text.length() > minLengthForComma) text.append("<br>"); text.append(street); } String housenumber = WayHelper.getTag(way, UsedTags.TAG_ADDR_HOUSENUMBER); if (housenumber != null) { text.append(", " + housenumber); } String housename = WayHelper.getTag(way, UsedTags.TAG_ADDR_HOUSENAME); if (housename != null) { text.append(", " + housename); } } } text.append("</html>"); final int minLength = 13; if (text.length() > minLength) { String str = text.toString(); ((JComponent) nc).setToolTipText(str); } else { ((JComponent) nc).setToolTipText(null); } } else { Collection<Tag> tags = node.getTags(); StringBuffer text = new StringBuffer(); text.append("<html><i>node id : " + node.getId() + "</i><br><hr>"); for (Tag tag : tags) { text.append(tag.getKey() + " = " + tag.getValue() + "<br>"); } final Iterator<Way> ways = nc.getDataSet().getWaysForNode(node.getId()); if (ways != null) { while (ways.hasNext()) { text.append("<hr>"); Way way = ways.next(); text.append("<i>way id : " + way.getId() + "</i><hr>"); for (Tag tag : way.getTags()) { text.append(tag.getKey() + " = " + tag.getValue() + "<br>"); } } } text.append("</html>"); if (text.length() > 0) { String str = text.toString(); ((JComponent) nc).setToolTipText(str); } else { ((JComponent) nc).setToolTipText(null); } } } }
void function(final LatLon point) { final Node node = (ExtendedNode) nc.getDataSet().getNearestNode(point, new UsedTags()); if (node != null) { nc.setSelectedNodePosition(new LatLon(node.getLatitude(), node.getLongitude())); ((JComponent) nc).repaint(); if (!Settings.getInstance().getBoolean(STR, false)) { StringBuffer text = new StringBuffer(STR); String name = NodeHelper.getTag(node, Tags.TAG_NAME); if (name != null) { text.append(name); } String fulladdress = NodeHelper.getTag(node, Tags.TAG_ADDR_FULL); if (fulladdress != null) { text.append("<br>" + fulladdress); } else { String street = NodeHelper.getTag(node, Tags.TAG_ADDR_STREET); if (street != null) { text.append("<br>" + street); } String housenumber = NodeHelper.getTag(node, UsedTags.TAG_ADDR_HOUSENUMBER); if (housenumber != null) { text.append(STR + housenumber); } String housename = NodeHelper.getTag(node, UsedTags.TAG_ADDR_HOUSENAME); if (housename != null) { text.append(STR + housename); } } final Iterator<Way> ways = nc.getDataSet().getWaysForNode(node.getId()); while (ways.hasNext()) { Way way = ways.next(); name = WayHelper.getTag(way, Tags.TAG_NAME); final int minLengthForComma = 6; if (name != null) { if (text.length() > minLengthForComma) { text.append(STR); } text.append(name); } fulladdress = WayHelper.getTag(way, Tags.TAG_ADDR_FULL); if (fulladdress != null) { text.append("<br>" + fulladdress); } else { String street = WayHelper.getTag(way, Tags.TAG_ADDR_STREET); if (street != null) { if (text.length() > minLengthForComma) text.append("<br>"); text.append(street); } String housenumber = WayHelper.getTag(way, UsedTags.TAG_ADDR_HOUSENUMBER); if (housenumber != null) { text.append(STR + housenumber); } String housename = WayHelper.getTag(way, UsedTags.TAG_ADDR_HOUSENAME); if (housename != null) { text.append(STR + housename); } } } text.append(STR); final int minLength = 13; if (text.length() > minLength) { String str = text.toString(); ((JComponent) nc).setToolTipText(str); } else { ((JComponent) nc).setToolTipText(null); } } else { Collection<Tag> tags = node.getTags(); StringBuffer text = new StringBuffer(); text.append(STR + node.getId() + STR); for (Tag tag : tags) { text.append(tag.getKey() + STR + tag.getValue() + "<br>"); } final Iterator<Way> ways = nc.getDataSet().getWaysForNode(node.getId()); if (ways != null) { while (ways.hasNext()) { text.append("<hr>"); Way way = ways.next(); text.append(STR + way.getId() + STR); for (Tag tag : way.getTags()) { text.append(tag.getKey() + STR + tag.getValue() + "<br>"); } } } text.append(STR); if (text.length() > 0) { String str = text.toString(); ((JComponent) nc).setToolTipText(str); } else { ((JComponent) nc).setToolTipText(null); } } } }
/** * Show tooltip with objects name and address. * @param point for search nearest node */
Show tooltip with objects name and address
showToolTipForNearestNode
{ "repo_name": "xafero/travelingsales", "path": "traveling_salesman/src/main/java/org/openstreetmap/travelingsalesman/gui/MapMover.java", "license": "gpl-3.0", "size": 16725 }
[ "java.util.Collection", "java.util.Iterator", "javax.swing.JComponent", "org.openstreetmap.osm.Settings", "org.openstreetmap.osm.Tags", "org.openstreetmap.osm.data.NodeHelper", "org.openstreetmap.osm.data.WayHelper", "org.openstreetmap.osm.data.coordinates.LatLon", "org.openstreetmap.osm.data.osmbin.v1_0.ExtendedNode", "org.openstreetmap.osmosis.core.domain.v0_6.Node", "org.openstreetmap.osmosis.core.domain.v0_6.Tag", "org.openstreetmap.osmosis.core.domain.v0_6.Way", "org.openstreetmap.travelingsalesman.routing.selectors.UsedTags" ]
import java.util.Collection; import java.util.Iterator; import javax.swing.JComponent; import org.openstreetmap.osm.Settings; import org.openstreetmap.osm.Tags; import org.openstreetmap.osm.data.NodeHelper; import org.openstreetmap.osm.data.WayHelper; import org.openstreetmap.osm.data.coordinates.LatLon; import org.openstreetmap.osm.data.osmbin.v1_0.ExtendedNode; import org.openstreetmap.osmosis.core.domain.v0_6.Node; import org.openstreetmap.osmosis.core.domain.v0_6.Tag; import org.openstreetmap.osmosis.core.domain.v0_6.Way; import org.openstreetmap.travelingsalesman.routing.selectors.UsedTags;
import java.util.*; import javax.swing.*; import org.openstreetmap.osm.*; import org.openstreetmap.osm.data.*; import org.openstreetmap.osm.data.coordinates.*; import org.openstreetmap.osm.data.osmbin.v1_0.*; import org.openstreetmap.osmosis.core.domain.v0_6.*; import org.openstreetmap.travelingsalesman.routing.selectors.*;
[ "java.util", "javax.swing", "org.openstreetmap.osm", "org.openstreetmap.osmosis", "org.openstreetmap.travelingsalesman" ]
java.util; javax.swing; org.openstreetmap.osm; org.openstreetmap.osmosis; org.openstreetmap.travelingsalesman;
1,822,474
@Test public void generatesLink() throws Exception { final Resource resource = new ResourceMocker().mock(); final Provider.Visible provider = new Github(resource, "KEY", "SECRET"); MatcherAssert.assertThat( provider.link().getHref().toString(), Matchers.allOf( Matchers.containsString("client_id=KEY"), Matchers.containsString("rexsl-github") ) ); }
void function() throws Exception { final Resource resource = new ResourceMocker().mock(); final Provider.Visible provider = new Github(resource, "KEY", STR); MatcherAssert.assertThat( provider.link().getHref().toString(), Matchers.allOf( Matchers.containsString(STR), Matchers.containsString(STR) ) ); }
/** * Github can generate a HATEOAS link. * @throws Exception If there is some problem inside */
Github can generate a HATEOAS link
generatesLink
{ "repo_name": "yegor256/rexsl", "path": "src/test/java/com/rexsl/page/auth/GithubTest.java", "license": "bsd-3-clause", "size": 2933 }
[ "com.rexsl.page.Resource", "com.rexsl.page.mock.ResourceMocker", "org.hamcrest.MatcherAssert", "org.hamcrest.Matchers" ]
import com.rexsl.page.Resource; import com.rexsl.page.mock.ResourceMocker; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers;
import com.rexsl.page.*; import com.rexsl.page.mock.*; import org.hamcrest.*;
[ "com.rexsl.page", "org.hamcrest" ]
com.rexsl.page; org.hamcrest;
2,152,579
public int getCount(final boolean includeStacks) { int count = 0; for (final RSItem item : getItems()) { final int iid = item.getID(); if (iid != -1) { if (includeStacks) { count += item.getStackSize(); } else { ++count; } } } return count; }
int function(final boolean includeStacks) { int count = 0; for (final RSItem item : getItems()) { final int iid = item.getID(); if (iid != -1) { if (includeStacks) { count += item.getStackSize(); } else { ++count; } } } return count; }
/** * Gets the count of all items in your inventory. * * @param includeStacks <tt>false</tt> if stacked items should be counted as a single item; otherwise <tt>true</tt>. * @return The count. */
Gets the count of all items in your inventory
getCount
{ "repo_name": "Latency/UtopianBot", "path": "src/org/rsbot/script/methods/Inventory.java", "license": "lgpl-3.0", "size": 20483 }
[ "org.rsbot.script.wrappers.RSItem" ]
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.*;
[ "org.rsbot.script" ]
org.rsbot.script;
67,108
protected void addSpdyHandlers(ChannelHandlerContext ctx, SpdyVersion version) { ChannelPipeline pipeline = ctx.getPipeline(); pipeline.addLast("spdyFrameCodec", new SpdyFrameCodec(version)); pipeline.addLast("spdySessionHandler", new SpdySessionHandler(version, true)); pipeline.addLast("spdyHttpEncoder", new SpdyHttpEncoder(version)); pipeline.addLast("spdyHttpDecoder", new SpdyHttpDecoder(version, maxSpdyContentLength)); pipeline.addLast("spdyStreamIdHandler", new SpdyHttpResponseStreamIdHandler()); pipeline.addLast("httpRequestHandler", createHttpRequestHandlerForSpdy()); }
void function(ChannelHandlerContext ctx, SpdyVersion version) { ChannelPipeline pipeline = ctx.getPipeline(); pipeline.addLast(STR, new SpdyFrameCodec(version)); pipeline.addLast(STR, new SpdySessionHandler(version, true)); pipeline.addLast(STR, new SpdyHttpEncoder(version)); pipeline.addLast(STR, new SpdyHttpDecoder(version, maxSpdyContentLength)); pipeline.addLast(STR, new SpdyHttpResponseStreamIdHandler()); pipeline.addLast(STR, createHttpRequestHandlerForSpdy()); }
/** * Add all {@link ChannelHandler}'s that are needed for SPDY with the given version. */
Add all <code>ChannelHandler</code>'s that are needed for SPDY with the given version
addSpdyHandlers
{ "repo_name": "KeyNexus/netty", "path": "src/main/java/org/jboss/netty/handler/codec/spdy/SpdyOrHttpChooser.java", "license": "apache-2.0", "size": 5624 }
[ "org.jboss.netty.channel.ChannelHandlerContext", "org.jboss.netty.channel.ChannelPipeline" ]
import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.*;
[ "org.jboss.netty" ]
org.jboss.netty;
1,197,108
public void changeAtualForSelectedState() { setCurrentNode((DefaultMutableTreeNode) getJTreeGraphReachability() .getLastSelectedPathComponent()); }
void function() { setCurrentNode((DefaultMutableTreeNode) getJTreeGraphReachability() .getLastSelectedPathComponent()); }
/** * Altera o estado atual para o selecionado */
Altera o estado atual para o selecionado
changeAtualForSelectedState
{ "repo_name": "gabrieltavaresmelo/jPetriNetsSim", "path": "src/main/java/br/com/pn/view/SimulationWindow.java", "license": "gpl-2.0", "size": 6008 }
[ "javax.swing.tree.DefaultMutableTreeNode" ]
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
598,914
private ArrayList<Topic> generateTopicObject(ResultSet p_resultSet) { try { ArrayList<Topic> topics = new ArrayList<Topic>(); // Only create the topic if something was found in the result set. while (p_resultSet.next()) { int topicId = p_resultSet.getInt("P_topicId"); int gameId = p_resultSet.getInt("F_gameId"); String topicName = p_resultSet.getString("topicName"); LocalDate date = p_resultSet.getDate("dateCreated").toLocalDate(); // Create a new topic and also set its ID Topic topic = new Topic(gameId, topicName, date); topic.setTopicId(topicId); topics.add(topic); } return topics; } catch (SQLException e) { System.out.println("Something went wrong when opening the result set"); e.printStackTrace(); return null; } }
ArrayList<Topic> function(ResultSet p_resultSet) { try { ArrayList<Topic> topics = new ArrayList<Topic>(); while (p_resultSet.next()) { int topicId = p_resultSet.getInt(STR); int gameId = p_resultSet.getInt(STR); String topicName = p_resultSet.getString(STR); LocalDate date = p_resultSet.getDate(STR).toLocalDate(); Topic topic = new Topic(gameId, topicName, date); topic.setTopicId(topicId); topics.add(topic); } return topics; } catch (SQLException e) { System.out.println(STR); e.printStackTrace(); return null; } }
/** * Turns a database result set into a collection of topic objects. * @param p_resultSet * @return Collection of topic objects. */
Turns a database result set into a collection of topic objects
generateTopicObject
{ "repo_name": "mirrormind/mo-test-eam", "path": "mo-test-eam/src/moeam/db/query/QueryTopic.java", "license": "apache-2.0", "size": 4854 }
[ "java.sql.ResultSet", "java.sql.SQLException", "java.time.LocalDate", "java.util.ArrayList" ]
import java.sql.ResultSet; import java.sql.SQLException; import java.time.LocalDate; import java.util.ArrayList;
import java.sql.*; import java.time.*; import java.util.*;
[ "java.sql", "java.time", "java.util" ]
java.sql; java.time; java.util;
2,511,695
Model model = repositoryService.createModelQuery().modelId(modelId).singleResult(); if (model == null) { throw new FlowableObjectNotFoundException("Could not find a model with id '" + modelId + "'.", ProcessDefinition.class); } if (restApiInterceptor != null) { restApiInterceptor.accessModelInfoById(model); } return model; }
Model model = repositoryService.createModelQuery().modelId(modelId).singleResult(); if (model == null) { throw new FlowableObjectNotFoundException(STR + modelId + "'.", ProcessDefinition.class); } if (restApiInterceptor != null) { restApiInterceptor.accessModelInfoById(model); } return model; }
/** * Returns the {@link Model} that is requested. Throws the right exceptions when bad request was made or model was not found. */
Returns the <code>Model</code> that is requested. Throws the right exceptions when bad request was made or model was not found
getModelFromRequest
{ "repo_name": "dbmalkovsky/flowable-engine", "path": "modules/flowable-rest/src/main/java/org/flowable/rest/service/api/repository/BaseModelResource.java", "license": "apache-2.0", "size": 1946 }
[ "org.flowable.common.engine.api.FlowableObjectNotFoundException", "org.flowable.engine.repository.Model", "org.flowable.engine.repository.ProcessDefinition" ]
import org.flowable.common.engine.api.FlowableObjectNotFoundException; import org.flowable.engine.repository.Model; import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.common.engine.api.*; import org.flowable.engine.repository.*;
[ "org.flowable.common", "org.flowable.engine" ]
org.flowable.common; org.flowable.engine;
1,006,184
ServiceFuture<Map<String, DateTime>> getDateTimeRfc1123ValidAsync(final ServiceCallback<Map<String, DateTime>> serviceCallback);
ServiceFuture<Map<String, DateTime>> getDateTimeRfc1123ValidAsync(final ServiceCallback<Map<String, DateTime>> serviceCallback);
/** * Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceFuture} object */
Get date-time-rfc1123 dictionary value {"0": "Fri, 01 Dec 2000 00:00:01 GMT", "1": "Wed, 02 Jan 1980 00:11:35 GMT", "2": "Wed, 12 Oct 1492 10:15:01 GMT"}
getDateTimeRfc1123ValidAsync
{ "repo_name": "anudeepsharma/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydictionary/Dictionarys.java", "license": "mit", "size": 79030 }
[ "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.ServiceFuture", "java.util.Map", "org.joda.time.DateTime" ]
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.Map; import org.joda.time.DateTime;
import com.microsoft.rest.*; import java.util.*; import org.joda.time.*;
[ "com.microsoft.rest", "java.util", "org.joda.time" ]
com.microsoft.rest; java.util; org.joda.time;
788,828
private void enable(ZooKeeperWatcher zooKeeper, byte[] table) throws KeeperException { LOG.debug("Ensuring archiving znode exists"); ZKUtil.createAndFailSilent(zooKeeper, archiveZnode); // then add the table to the list of znodes to archive String tableNode = this.getTableNode(table); LOG.debug("Creating: " + tableNode + ", data: []"); ZKUtil.createSetData(zooKeeper, tableNode, new byte[0]); }
void function(ZooKeeperWatcher zooKeeper, byte[] table) throws KeeperException { LOG.debug(STR); ZKUtil.createAndFailSilent(zooKeeper, archiveZnode); String tableNode = this.getTableNode(table); LOG.debug(STR + tableNode + STR); ZKUtil.createSetData(zooKeeper, tableNode, new byte[0]); }
/** * Perform a best effort enable of hfile retention, which relies on zookeeper communicating the // * * change back to the hfile cleaner. * <p> * No attempt is made to make sure that backups are successfully created - it is inherently an * <b>asynchronous operation</b>. * @param zooKeeper watcher connection to zk cluster * @param table table name on which to enable archiving * @throws KeeperException */
Perform a best effort enable of hfile retention, which relies on zookeeper communicating the change back to the hfile cleaner. No attempt is made to make sure that backups are successfully created - it is inherently an asynchronous operation
enable
{ "repo_name": "francisliu/hbase_namespace", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/backup/example/HFileArchiveManager.java", "license": "apache-2.0", "size": 6606 }
[ "org.apache.hadoop.hbase.zookeeper.ZKUtil", "org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher", "org.apache.zookeeper.KeeperException" ]
import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.zookeeper.KeeperException;
import org.apache.hadoop.hbase.zookeeper.*; import org.apache.zookeeper.*;
[ "org.apache.hadoop", "org.apache.zookeeper" ]
org.apache.hadoop; org.apache.zookeeper;
1,456,993
@Test(expected = ParserException.class) public void processDuplicateLeafInHierarchy() throws IOException, ParserException { YangNode node = manager.getDataModel("src/test/resources/DuplicateLeafInHierarchy.yang"); }
@Test(expected = ParserException.class) void function() throws IOException, ParserException { YangNode node = manager.getDataModel(STR); }
/** * Checks duplicate leaf at different hierarchy. */
Checks duplicate leaf at different hierarchy
processDuplicateLeafInHierarchy
{ "repo_name": "Phaneendra-Huawei/demo", "path": "utils/yangutils/src/test/java/org/onosproject/yangutils/parser/impl/listeners/CaseListenerTest.java", "license": "apache-2.0", "size": 7975 }
[ "java.io.IOException", "org.junit.Test", "org.onosproject.yangutils.datamodel.YangNode", "org.onosproject.yangutils.parser.exceptions.ParserException" ]
import java.io.IOException; import org.junit.Test; import org.onosproject.yangutils.datamodel.YangNode; import org.onosproject.yangutils.parser.exceptions.ParserException;
import java.io.*; import org.junit.*; import org.onosproject.yangutils.datamodel.*; import org.onosproject.yangutils.parser.exceptions.*;
[ "java.io", "org.junit", "org.onosproject.yangutils" ]
java.io; org.junit; org.onosproject.yangutils;
2,091,798
@Test public void getDocumentListByChangedSince() throws Exception { final List<DocumentElement> dokumentList = riksdagenApi.getDocumentList( "2010-06-01","2010-09-01", 10); assertNotNull(dokumentList); assertTrue(dokumentList.size() >= 1); }
void function() throws Exception { final List<DocumentElement> dokumentList = riksdagenApi.getDocumentList( STR,STR, 10); assertNotNull(dokumentList); assertTrue(dokumentList.size() >= 1); }
/** * Gets the document list by changed since. * * @return the document list by changed since * @throws Exception * the exception */
Gets the document list by changed since
getDocumentListByChangedSince
{ "repo_name": "Hack23/cia", "path": "service.external.riksdagen/src/test/java/com/hack23/cia/service/external/riksdagen/impl/RiksdagenDocumentApiImplITest.java", "license": "apache-2.0", "size": 9316 }
[ "com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement", "java.util.List" ]
import com.hack23.cia.model.external.riksdagen.dokumentlista.impl.DocumentElement; import java.util.List;
import com.hack23.cia.model.external.riksdagen.dokumentlista.impl.*; import java.util.*;
[ "com.hack23.cia", "java.util" ]
com.hack23.cia; java.util;
462,142
@Test public final void testLEOSatellite() { timeNow = new DateTime("2009-04-17T06:57:32Z"); final TLE tle = new TLE(LEO_TLE); Assert.assertFalse(tle.isDeepspace()); final Satellite satellite = SatelliteFactory.createSatellite(tle); final SatPos satellitePosition = satellite.getPosition(GROUND_STATION, timeNow.toDate()); Assert.assertEquals("3.2421950", String.format(FORMAT_9_7F, satellitePosition.getAzimuth())); Assert.assertEquals("0.1511580", String.format(FORMAT_9_7F, satellitePosition.getElevation())); Assert.assertEquals("6.2069835", String.format(FORMAT_9_7F, satellitePosition.getLongitude())); Assert.assertEquals("0.5648232", String.format(FORMAT_9_7F, satellitePosition.getLatitude())); Assert.assertEquals("818.1375014", String.format(FORMAT_10_7F, satellitePosition.getAltitude())); Assert.assertEquals("3.4337605", String.format(FORMAT_9_7F, satellitePosition.getPhase())); Assert.assertEquals("2506", String.format(FORMAT_4_0F, satellitePosition.getRange())); Assert.assertEquals("6.4832408", String.format(FORMAT_9_7F, satellitePosition.getRangeRate())); Assert.assertEquals("-0.9501914", String.format(FORMAT_9_7F, satellitePosition.getTheta())); Assert.assertEquals("-0.7307717", String.format(FORMAT_9_7F, satellitePosition.getEclipseDepth())); Assert.assertFalse(satellitePosition.isEclipsed()); Assert.assertTrue(satellite.willBeSeen(GROUND_STATION)); double[][] rangeCircle = satellitePosition.getRangeCircle(); Assert.assertEquals(" 59.9 355.6", String.format("%6.1f %6.1f", rangeCircle[0][0], rangeCircle[0][1])); Assert.assertEquals(" 28.8 323.8", String.format("%6.1f %6.1f", rangeCircle[89][0], rangeCircle[89][1])); Assert.assertEquals(" 4.8 355.2", String.format("%6.1f %6.1f", rangeCircle[179][0], rangeCircle[179][1])); Assert.assertEquals(" 27.9 27.2", String.format("%6.1f %6.1f", rangeCircle[269][0], rangeCircle[269][1])); }
final void function() { timeNow = new DateTime(STR); final TLE tle = new TLE(LEO_TLE); Assert.assertFalse(tle.isDeepspace()); final Satellite satellite = SatelliteFactory.createSatellite(tle); final SatPos satellitePosition = satellite.getPosition(GROUND_STATION, timeNow.toDate()); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getAzimuth())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getElevation())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getLongitude())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getLatitude())); Assert.assertEquals(STR, String.format(FORMAT_10_7F, satellitePosition.getAltitude())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getPhase())); Assert.assertEquals("2506", String.format(FORMAT_4_0F, satellitePosition.getRange())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getRangeRate())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getTheta())); Assert.assertEquals(STR, String.format(FORMAT_9_7F, satellitePosition.getEclipseDepth())); Assert.assertFalse(satellitePosition.isEclipsed()); Assert.assertTrue(satellite.willBeSeen(GROUND_STATION)); double[][] rangeCircle = satellitePosition.getRangeCircle(); Assert.assertEquals(STR, String.format(STR, rangeCircle[0][0], rangeCircle[0][1])); Assert.assertEquals(STR, String.format(STR, rangeCircle[89][0], rangeCircle[89][1])); Assert.assertEquals(STR, String.format(STR, rangeCircle[179][0], rangeCircle[179][1])); Assert.assertEquals(STR, String.format(STR, rangeCircle[269][0], rangeCircle[269][1])); }
/** * Test method for * {@link uk.me.g4dpz.satellite.LEOSatellite#LEOSatellite(uk.me.g4dpz.satellite.TLE)}. */
Test method for <code>uk.me.g4dpz.satellite.LEOSatellite#LEOSatellite(uk.me.g4dpz.satellite.TLE)</code>
testLEOSatellite
{ "repo_name": "vikoadi/tracker", "path": "src/test/uk/me/g4dpz/satellite/LEOSatelliteTest.java", "license": "gpl-3.0", "size": 8782 }
[ "org.joda.time.DateTime", "org.junit.Assert" ]
import org.joda.time.DateTime; import org.junit.Assert;
import org.joda.time.*; import org.junit.*;
[ "org.joda.time", "org.junit" ]
org.joda.time; org.junit;
2,391,294
public void addKey(String alias, Key key, Certificate[] trustChain) throws KeyStoreException { setKey(alias, key, trustChain); if (log.isDebugEnabled() && factory.logSecurityDetails) log.debug("added key with alias \"" + alias + "\" of type " + key.getClass().getCanonicalName()); }
void function(String alias, Key key, Certificate[] trustChain) throws KeyStoreException { setKey(alias, key, trustChain); if (log.isDebugEnabled() && factory.logSecurityDetails) log.debug(STRSTR\STR + key.getClass().getCanonicalName()); }
/** * Add a key to the keystore. No keys can be added after the keystore is * serialized. * * @param alias * The alias of the key. * @param key * The secret/private key to add. * @param trustChain * The trusted certificate chain of the key. Should be * <tt>null</tt> for secret keys. * @throws KeyStoreException * If anything goes wrong. */
Add a key to the keystore. No keys can be added after the keystore is serialized
addKey
{ "repo_name": "apache/incubator-taverna-server", "path": "taverna-server-webapp/src/main/java/org/apache/taverna/server/master/worker/SecurityContextDelegate.java", "license": "apache-2.0", "size": 19775 }
[ "java.security.Key", "java.security.KeyStoreException", "java.security.cert.Certificate" ]
import java.security.Key; import java.security.KeyStoreException; import java.security.cert.Certificate;
import java.security.*; import java.security.cert.*;
[ "java.security" ]
java.security;
493,096
public int compareTo(final KVO<O> arg0) { return BytesUtil.compareBytes(key, arg0.key); }
int function(final KVO<O> arg0) { return BytesUtil.compareBytes(key, arg0.key); }
/** * Imposes an <code>unsigned byte[]</code> order on the {@link KVO}s. */
Imposes an <code>unsigned byte[]</code> order on the <code>KVO</code>s
compareTo
{ "repo_name": "smalyshev/blazegraph", "path": "bigdata/src/java/com/bigdata/btree/keys/KVO.java", "license": "gpl-2.0", "size": 5456 }
[ "com.bigdata.btree.BytesUtil" ]
import com.bigdata.btree.BytesUtil;
import com.bigdata.btree.*;
[ "com.bigdata.btree" ]
com.bigdata.btree;
2,544,350
default <VALUE> OptionalAssert<VALUE> assertThat(final Optional<VALUE> optional) { return Assertions.assertThat(optional); }
default <VALUE> OptionalAssert<VALUE> assertThat(final Optional<VALUE> optional) { return Assertions.assertThat(optional); }
/** * Create assertion for {@link java.util.Optional}. * * @param optional the actual value. * @param <VALUE> the type of the value contained in the {@link java.util.Optional}. * * @return the created assertion object. */
Create assertion for <code>java.util.Optional</code>
assertThat
{ "repo_name": "ChrisA89/assertj-core", "path": "src/main/java/org/assertj/core/api/WithAssertions.java", "license": "apache-2.0", "size": 102131 }
[ "java.util.Optional" ]
import java.util.Optional;
import java.util.*;
[ "java.util" ]
java.util;
242,343
SearchNetworksFragment fragment = new SearchNetworksFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; }
SearchNetworksFragment fragment = new SearchNetworksFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; }
/** * Returns a new instance of this fragment for the given section number. */
Returns a new instance of this fragment for the given section number
newInstance
{ "repo_name": "eSoares/Android-Ad-hoc", "path": "app/src/main/java/pt/it/esoares/adhocdroid/ui/SearchNetworksFragment.java", "license": "gpl-2.0", "size": 4774 }
[ "android.os.Bundle" ]
import android.os.Bundle;
import android.os.*;
[ "android.os" ]
android.os;
2,434,618
public void setTextExpression(Expression textExpression) { this.textExpression = textExpression; }
void function(Expression textExpression) { this.textExpression = textExpression; }
/** * Sets the expression used to evaluate the text value of this node * for a particular <code>Context</code> * @param textExpression the Expression to be used to evaluate the value of this node */
Sets the expression used to evaluate the text value of this node for a particular <code>Context</code>
setTextExpression
{ "repo_name": "ripdajacker/commons-betwixt", "path": "src/java/org/apache/commons/betwixt/Descriptor.java", "license": "apache-2.0", "size": 5173 }
[ "org.apache.commons.betwixt.expression.Expression" ]
import org.apache.commons.betwixt.expression.Expression;
import org.apache.commons.betwixt.expression.*;
[ "org.apache.commons" ]
org.apache.commons;
2,064,218
private void updateWeather() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String weatherString = preferences.getString("weather", null); if (weatherString != null) { Weather weather = null; try { weather = new Gson().fromJson(new JSONObject(weatherString).getJSONArray("HeWeather").getJSONObject(0).toString(), Weather.class); } catch (JSONException e) { log.error(e.getMessage()); } final String weatherId = Objects.requireNonNull(weather).basic.weatherId; String weatherUrl = "http://guolin.tech/api/weather?cityid=" + weatherId + "&key=bc0418b57b2d4918819d3974ac1285d9";
void function() { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); String weatherString = preferences.getString(STR, null); if (weatherString != null) { Weather weather = null; try { weather = new Gson().fromJson(new JSONObject(weatherString).getJSONArray(STR).getJSONObject(0).toString(), Weather.class); } catch (JSONException e) { log.error(e.getMessage()); } final String weatherId = Objects.requireNonNull(weather).basic.weatherId; String weatherUrl = "http:
/** * update weather info. */
update weather info
updateWeather
{ "repo_name": "gudigudi/practice", "path": "Frontend/MdTemplate/appdemojetpack/src/main/java/com/gudigudigudi/appdemojetpack/business/weather/WeatherAutoUpdateService.java", "license": "gpl-2.0", "size": 4268 }
[ "android.content.SharedPreferences", "androidx.preference.PreferenceManager", "com.google.gson.Gson", "com.gudigudigudi.appdemojetpack.business.weather.model.Weather", "java.util.Objects", "org.json.JSONException", "org.json.JSONObject" ]
import android.content.SharedPreferences; import androidx.preference.PreferenceManager; import com.google.gson.Gson; import com.gudigudigudi.appdemojetpack.business.weather.model.Weather; import java.util.Objects; import org.json.JSONException; import org.json.JSONObject;
import android.content.*; import androidx.preference.*; import com.google.gson.*; import com.gudigudigudi.appdemojetpack.business.weather.model.*; import java.util.*; import org.json.*;
[ "android.content", "androidx.preference", "com.google.gson", "com.gudigudigudi.appdemojetpack", "java.util", "org.json" ]
android.content; androidx.preference; com.google.gson; com.gudigudigudi.appdemojetpack; java.util; org.json;
43,936
public static CachableValueAccessor buildAccessorCache(Class clz, List<String> keyExpressionList) throws ServiceException { Preconditions.checkNotNull(clz); Preconditions.checkNotNull(keyExpressionList); CachableValueAccessor root = new CachableValueAccessor(null, null, null); // iterate thru the key expression list and built the structure Iterator<String> i = keyExpressionList.iterator(); while (i.hasNext()) { String keyExpr = i.next(); processKeyExpression(clz, keyExpr, root); } return root; }
static CachableValueAccessor function(Class clz, List<String> keyExpressionList) throws ServiceException { Preconditions.checkNotNull(clz); Preconditions.checkNotNull(keyExpressionList); CachableValueAccessor root = new CachableValueAccessor(null, null, null); Iterator<String> i = keyExpressionList.iterator(); while (i.hasNext()) { String keyExpr = i.next(); processKeyExpression(clz, keyExpr, root); } return root; }
/** * Build the accessorCache given the request clz and a list of key expression. * @param clz A Class object. * @param keyExpressionList A list of key experssions. * @return A CachableValueAccessor * @throws ServiceException Exception during AccessorCache building. */
Build the accessorCache given the request clz and a list of key expression
buildAccessorCache
{ "repo_name": "vthangathurai/SOA-Runtime", "path": "soa-client/src/main/java/org/ebayopensource/turmeric/runtime/common/cachepolicy/CachePolicyDesc.java", "license": "apache-2.0", "size": 12540 }
[ "java.util.Iterator", "java.util.List", "org.ebayopensource.turmeric.runtime.common.exceptions.ServiceException", "org.ebayopensource.turmeric.runtime.common.utils.Preconditions" ]
import java.util.Iterator; import java.util.List; import org.ebayopensource.turmeric.runtime.common.exceptions.ServiceException; import org.ebayopensource.turmeric.runtime.common.utils.Preconditions;
import java.util.*; import org.ebayopensource.turmeric.runtime.common.exceptions.*; import org.ebayopensource.turmeric.runtime.common.utils.*;
[ "java.util", "org.ebayopensource.turmeric" ]
java.util; org.ebayopensource.turmeric;
579,668
public Collection<Address> getActive() { return active; }
Collection<Address> function() { return active; }
/** * Returns the active members. * * @return The active members. */
Returns the active members
getActive
{ "repo_name": "madjam/copycat-1", "path": "server/src/main/java/io/atomix/copycat/server/storage/entry/ConfigurationEntry.java", "license": "apache-2.0", "size": 3033 }
[ "io.atomix.catalyst.transport.Address", "java.util.Collection" ]
import io.atomix.catalyst.transport.Address; import java.util.Collection;
import io.atomix.catalyst.transport.*; import java.util.*;
[ "io.atomix.catalyst", "java.util" ]
io.atomix.catalyst; java.util;
1,507,357
public static Interest segmentInterest(ContentName name, Long segmentNumber, PublisherPublicKeyDigest publisher){ ContentName interestName = null; //make sure the desired segment number is specified if (null == segmentNumber) { segmentNumber = baseSegment(); } //check if the name already has a segment in the last spot if (isSegment(name)) { //this already has a segment, trim it off interestName = segmentRoot(name); } else { interestName = name; } interestName = segmentName(interestName, segmentNumber); if (Log.isLoggable(Log.FAC_IO, Level.FINE)) Log.fine(Log.FAC_IO, "segmentInterest: creating interest for {0} from ContentName {1} and segmentNumber {2}", interestName, name, segmentNumber); Interest interest = Interest.lower(interestName, 1, publisher); return interest; }
static Interest function(ContentName name, Long segmentNumber, PublisherPublicKeyDigest publisher){ ContentName interestName = null; if (null == segmentNumber) { segmentNumber = baseSegment(); } if (isSegment(name)) { interestName = segmentRoot(name); } else { interestName = name; } interestName = segmentName(interestName, segmentNumber); if (Log.isLoggable(Log.FAC_IO, Level.FINE)) Log.fine(Log.FAC_IO, STR, interestName, name, segmentNumber); Interest interest = Interest.lower(interestName, 1, publisher); return interest; }
/** * Creates an Interest for a specified segment number. If the supplied name already * ends with a segment number, the interest will have the supplied segment in the name * instead. * * @param name ContentName for the desired ContentObject * @param segmentNumber segment number to append to the name, if null, uses the baseSegment number * @param publisher can be null * * @return interest **/
Creates an Interest for a specified segment number. If the supplied name already ends with a segment number, the interest will have the supplied segment in the name instead
segmentInterest
{ "repo_name": "ryanrhymes/mobiccnx", "path": "javasrc/src/org/ccnx/ccn/profiles/SegmentationProfile.java", "license": "lgpl-2.1", "size": 22097 }
[ "java.util.logging.Level", "org.ccnx.ccn.impl.support.Log", "org.ccnx.ccn.protocol.ContentName", "org.ccnx.ccn.protocol.Interest", "org.ccnx.ccn.protocol.PublisherPublicKeyDigest" ]
import java.util.logging.Level; import org.ccnx.ccn.impl.support.Log; import org.ccnx.ccn.protocol.ContentName; import org.ccnx.ccn.protocol.Interest; import org.ccnx.ccn.protocol.PublisherPublicKeyDigest;
import java.util.logging.*; import org.ccnx.ccn.impl.support.*; import org.ccnx.ccn.protocol.*;
[ "java.util", "org.ccnx.ccn" ]
java.util; org.ccnx.ccn;
1,289,316
List<Instance> instances = new ArrayList<>(); log.info("Fetching instances for app: " + serviceId); Application app = eurekaClient.getApplication(serviceId); if (app == null) { log.warn("Eureka returned null for app: " + serviceId); return instances; } try { List<InstanceInfo> instancesForApp = app.getInstances(); if (instancesForApp != null) { log.info("Received instance list for app: " + serviceId + ", size=" + instancesForApp.size()); for (InstanceInfo iInfo : instancesForApp) { Instance instance = marshall(iInfo); if (instance != null) { instances.add(instance); } } } } catch (Exception e) { log.warn("Failed to retrieve instances from Eureka", e); } return instances; } /** * Private helper that marshals the information from each instance into something that * Turbine can understand. Override this method for your own implementation for * parsing Eureka info. * @param instanceInfo {@link InstanceInfo} to marshal * @return {@link Instance} marshaled from provided {@link InstanceInfo}
List<Instance> instances = new ArrayList<>(); log.info(STR + serviceId); Application app = eurekaClient.getApplication(serviceId); if (app == null) { log.warn(STR + serviceId); return instances; } try { List<InstanceInfo> instancesForApp = app.getInstances(); if (instancesForApp != null) { log.info(STR + serviceId + STR + instancesForApp.size()); for (InstanceInfo iInfo : instancesForApp) { Instance instance = marshall(iInfo); if (instance != null) { instances.add(instance); } } } } catch (Exception e) { log.warn(STR, e); } return instances; } /** * Private helper that marshals the information from each instance into something that * Turbine can understand. Override this method for your own implementation for * parsing Eureka info. * @param instanceInfo {@link InstanceInfo} to marshal * @return {@link Instance} marshaled from provided {@link InstanceInfo}
/** * Private helper that fetches the Instances for each application. * @param serviceId of the service that the instance list should be returned for * @return List of instances for a given service id * @throws Exception - retrieving and marshalling service instances may result in an * Exception */
Private helper that fetches the Instances for each application
getInstancesForApp
{ "repo_name": "joshiste/spring-cloud-netflix", "path": "spring-cloud-netflix-turbine/src/main/java/org/springframework/cloud/netflix/turbine/EurekaInstanceDiscovery.java", "license": "apache-2.0", "size": 5485 }
[ "com.netflix.appinfo.InstanceInfo", "com.netflix.discovery.shared.Application", "com.netflix.turbine.discovery.Instance", "java.util.ArrayList", "java.util.List" ]
import com.netflix.appinfo.InstanceInfo; import com.netflix.discovery.shared.Application; import com.netflix.turbine.discovery.Instance; import java.util.ArrayList; import java.util.List;
import com.netflix.appinfo.*; import com.netflix.discovery.shared.*; import com.netflix.turbine.discovery.*; import java.util.*;
[ "com.netflix.appinfo", "com.netflix.discovery", "com.netflix.turbine", "java.util" ]
com.netflix.appinfo; com.netflix.discovery; com.netflix.turbine; java.util;
2,306,682
public void saveAllWorlds(boolean dontLog) { for (WorldServer worldserver : this.worldServers) { if (worldserver != null) { if (!dontLog) { LOG.info("Saving chunks for level \'" + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionType().getName()); } try { worldserver.saveAllChunks(true, (IProgressUpdate)null); } catch (MinecraftException minecraftexception) { LOG.warn(minecraftexception.getMessage()); } } } }
void function(boolean dontLog) { for (WorldServer worldserver : this.worldServers) { if (worldserver != null) { if (!dontLog) { LOG.info(STR + worldserver.getWorldInfo().getWorldName() + "\'/" + worldserver.provider.getDimensionType().getName()); } try { worldserver.saveAllChunks(true, (IProgressUpdate)null); } catch (MinecraftException minecraftexception) { LOG.warn(minecraftexception.getMessage()); } } } }
/** * par1 indicates if a log message should be output. */
par1 indicates if a log message should be output
saveAllWorlds
{ "repo_name": "danielyc/test-1.9.4", "path": "build/tmp/recompileMc/sources/net/minecraft/server/MinecraftServer.java", "license": "gpl-3.0", "size": 55327 }
[ "net.minecraft.util.IProgressUpdate", "net.minecraft.world.MinecraftException", "net.minecraft.world.WorldServer" ]
import net.minecraft.util.IProgressUpdate; import net.minecraft.world.MinecraftException; import net.minecraft.world.WorldServer;
import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.util; net.minecraft.world;
264,028
public void setMute(boolean lastParam) { Dispatch.call(this, "Mute", new Variant(lastParam)); }
void function(boolean lastParam) { Dispatch.call(this, "Mute", new Variant(lastParam)); }
/** * Wrapper for calling the ActiveX-Method with input-parameter(s). * * @param lastParam an input-parameter of type boolean */
Wrapper for calling the ActiveX-Method with input-parameter(s)
setMute
{ "repo_name": "cpesch/MetaMusic", "path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IiTunes.java", "license": "gpl-2.0", "size": 26278 }
[ "com.jacob.com.Dispatch", "com.jacob.com.Variant" ]
import com.jacob.com.Dispatch; import com.jacob.com.Variant;
import com.jacob.com.*;
[ "com.jacob.com" ]
com.jacob.com;
2,189,325
public static ZeppaUserToUserRelationship getUserRelationship(Long userId1, Long userId2) { if (userId1.longValue() == userId2.longValue()) { throw new NullPointerException("Missing a user id"); } String filter = "(creatorId == " + userId1 + " || creatorId == " + userId2.longValue() + ") && (subjectId == " + userId1.longValue() + "|| subjectId == " + userId2.longValue() + ")"; PersistenceManager mgr = getPersistenceManager(); ZeppaUserToUserRelationship result = null; try { Query q = mgr.newQuery(ZeppaUserToUserRelationship.class); q.setFilter(filter); q.setUnique(true); result = (ZeppaUserToUserRelationship) q.execute(); } finally { mgr.close(); } return result; }
static ZeppaUserToUserRelationship function(Long userId1, Long userId2) { if (userId1.longValue() == userId2.longValue()) { throw new NullPointerException(STR); } String filter = STR + userId1 + STR + userId2.longValue() + STR + userId1.longValue() + STR + userId2.longValue() + ")"; PersistenceManager mgr = getPersistenceManager(); ZeppaUserToUserRelationship result = null; try { Query q = mgr.newQuery(ZeppaUserToUserRelationship.class); q.setFilter(filter); q.setUnique(true); result = (ZeppaUserToUserRelationship) q.execute(); } finally { mgr.close(); } return result; }
/** * Get the relationship between two * * @param userId1 * @param userId2 * @return */
Get the relationship between two
getUserRelationship
{ "repo_name": "pschuette22/Zeppa-AppEngine", "path": "zeppa-api/src/main/java/com/zeppamobile/api/endpoint/utils/ClientEndpointUtility.java", "license": "apache-2.0", "size": 4901 }
[ "com.zeppamobile.api.datamodel.ZeppaUserToUserRelationship", "javax.jdo.PersistenceManager", "javax.jdo.Query" ]
import com.zeppamobile.api.datamodel.ZeppaUserToUserRelationship; import javax.jdo.PersistenceManager; import javax.jdo.Query;
import com.zeppamobile.api.datamodel.*; import javax.jdo.*;
[ "com.zeppamobile.api", "javax.jdo" ]
com.zeppamobile.api; javax.jdo;
2,504,441
List<JobDescription> getCustomerRunningJobs();
List<JobDescription> getCustomerRunningJobs();
/** * Get a list of currently executing jobs, reports and background tasks for the current customer. * @return The list. */
Get a list of currently executing jobs, reports and background tasks for the current customer
getCustomerRunningJobs
{ "repo_name": "skyvers/skyve", "path": "skyve-ext/src/main/java/org/skyve/job/JobScheduler.java", "license": "lgpl-2.1", "size": 3519 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,569,636
public static Component to(DerivedComponentBo bo) { if (bo == null) { return null; } return Component.Builder.create(bo).build(); }
static Component function(DerivedComponentBo bo) { if (bo == null) { return null; } return Component.Builder.create(bo).build(); }
/** * Converts a mutable bo to its immutable counterpart * @param bo the mutable business object * @return the immutable object */
Converts a mutable bo to its immutable counterpart
to
{ "repo_name": "bhutchinson/rice", "path": "rice-middleware/core-service/impl/src/main/java/org/kuali/rice/coreservice/impl/component/DerivedComponentBo.java", "license": "apache-2.0", "size": 3793 }
[ "org.kuali.rice.coreservice.api.component.Component" ]
import org.kuali.rice.coreservice.api.component.Component;
import org.kuali.rice.coreservice.api.component.*;
[ "org.kuali.rice" ]
org.kuali.rice;
587,450
public void setImageTintMode(@Nullable PorterDuff.Mode tintMode) { mDrawableTintMode = tintMode; mHasDrawableTintMode = true; applyImageTint(); }
void function(@Nullable PorterDuff.Mode tintMode) { mDrawableTintMode = tintMode; mHasDrawableTintMode = true; applyImageTint(); }
/** * Specifies the blending mode used to apply the tint specified by * {@link #setImageTintList(ColorStateList)}} to the image drawable. The default * mode is {@link PorterDuff.Mode#SRC_IN}. * * @param tintMode the blending mode used to apply the tint, may be * {@code null} to clear tint * @attr ref android.R.styleable#ImageView_tintMode * @see #getImageTintMode() * @see Drawable#setTintMode(PorterDuff.Mode) */
Specifies the blending mode used to apply the tint specified by <code>#setImageTintList(ColorStateList)</code>} to the image drawable. The default mode is <code>PorterDuff.Mode#SRC_IN</code>
setImageTintMode
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/base/core/java/android/widget/ImageView.java", "license": "gpl-3.0", "size": 48362 }
[ "android.annotation.Nullable", "android.graphics.PorterDuff" ]
import android.annotation.Nullable; import android.graphics.PorterDuff;
import android.annotation.*; import android.graphics.*;
[ "android.annotation", "android.graphics" ]
android.annotation; android.graphics;
623,996
@ParameterizedTest @MethodSource("data") public void testConnectWithoutSSLToStrictServer( final X509KeyType caKeyType, final X509KeyType certKeyType, final Boolean hostnameVerification, final Integer paramIndex ) throws Exception { init(caKeyType, certKeyType, hostnameVerification, paramIndex); setUp(); UnifiedServerThread serverThread = new UnifiedServerThread(x509Util, localServerAddress, false, DATA_TO_CLIENT); serverThread.start(); Socket socket = connectWithoutSSL(); socket.getOutputStream().write(DATA_FROM_CLIENT); socket.getOutputStream().flush(); byte[] buf = new byte[DATA_TO_CLIENT.length]; try { int bytesRead = socket.getInputStream().read(buf, 0, buf.length); if (bytesRead == -1) { // Using the NioSocketImpl after JDK 13, the expected behaviour on the client side // is to reach the end of the stream (bytesRead == -1), without a socket exception. return; } } catch (SocketException e) { // Using the old PlainSocketImpl (prior to JDK 13) we expect to get Socket Exception return; } finally { forceClose(socket); serverThread.shutdown(TIMEOUT); // independently of the client socket implementation details, we always make sure the // server didn't receive any data during the test assertFalse(serverThread.receivedAnyDataFromClient(), "The strict server accepted connection without SSL."); } fail("Expected server to hang up the connection. Read from server succeeded unexpectedly."); }
@MethodSource("data") void function( final X509KeyType caKeyType, final X509KeyType certKeyType, final Boolean hostnameVerification, final Integer paramIndex ) throws Exception { init(caKeyType, certKeyType, hostnameVerification, paramIndex); setUp(); UnifiedServerThread serverThread = new UnifiedServerThread(x509Util, localServerAddress, false, DATA_TO_CLIENT); serverThread.start(); Socket socket = connectWithoutSSL(); socket.getOutputStream().write(DATA_FROM_CLIENT); socket.getOutputStream().flush(); byte[] buf = new byte[DATA_TO_CLIENT.length]; try { int bytesRead = socket.getInputStream().read(buf, 0, buf.length); if (bytesRead == -1) { return; } } catch (SocketException e) { return; } finally { forceClose(socket); serverThread.shutdown(TIMEOUT); assertFalse(serverThread.receivedAnyDataFromClient(), STR); } fail(STR); }
/** * Attempting to connect to a SSL-only server without SSL should fail. */
Attempting to connect to a SSL-only server without SSL should fail
testConnectWithoutSSLToStrictServer
{ "repo_name": "maoling/zookeeper", "path": "zookeeper-server/src/test/java/org/apache/zookeeper/server/quorum/UnifiedServerSocketTest.java", "license": "apache-2.0", "size": 27501 }
[ "java.net.Socket", "java.net.SocketException", "org.apache.zookeeper.common.X509KeyType", "org.junit.jupiter.api.Assertions", "org.junit.jupiter.params.provider.MethodSource" ]
import java.net.Socket; import java.net.SocketException; import org.apache.zookeeper.common.X509KeyType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.provider.MethodSource;
import java.net.*; import org.apache.zookeeper.common.*; import org.junit.jupiter.api.*; import org.junit.jupiter.params.provider.*;
[ "java.net", "org.apache.zookeeper", "org.junit.jupiter" ]
java.net; org.apache.zookeeper; org.junit.jupiter;
1,791,322
protected void validateDBContents(Connection con) throws SQLException { Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("SELECT id, val FROM " + TABLE + " ORDER BY id"); int id, val; while (rs.next()) { id = rs.getInt(1); val = rs.getInt(2); if (id >= DATA.length) { fail("Id in database out of bounds for data model; " + id + " >= " + DATA.length); } if (val != DATA[id]) { fail("Mismatch between db and model for id " + id + ";" + val + " != " + DATA[id]); } } rs.close(); stmt.close(); }
void function(Connection con) throws SQLException { Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(STR + TABLE + STR); int id, val; while (rs.next()) { id = rs.getInt(1); val = rs.getInt(2); if (id >= DATA.length) { fail(STR + id + STR + DATA.length); } if (val != DATA[id]) { fail(STR + id + ";" + val + STR + DATA[id]); } } rs.close(); stmt.close(); }
/** * Validate the data in the database against the data model. * * @param con the database to validate the contents of * @throws junit.framework.AssertionFailedError if there is a mismatch * between the data in the database and the model */
Validate the data in the database against the data model
validateDBContents
{ "repo_name": "splicemachine/spliceengine", "path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/store/EncryptionKeyTest.java", "license": "agpl-3.0", "size": 27220 }
[ "java.sql.Connection", "java.sql.ResultSet", "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
1,853,417
protected void selectBestRegionsFern(double totalP, double totalN) { for( int i = 0; i < fernInfo.size; i++ ) { TldRegionFernInfo info = fernInfo.get(i); double probP = info.sumP/totalP; double probN = info.sumN/totalN; // only consider regions with a higher P likelihood if( probP > probN ) { // reward regions with a large difference between the P and N values storageMetric.add(-(probP-probN)); storageRect.add( info.r ); } } // Select the N regions with the highest fern probability if( config.maximumCascadeConsider < storageMetric.size ) { int N = Math.min(config.maximumCascadeConsider, storageMetric.size); storageIndexes.resize(storageMetric.size); QuickSelect.selectIndex(storageMetric.data, N - 1, storageMetric.size, storageIndexes.data); for( int i = 0; i < N; i++ ) { fernRegions.add(storageRect.get(storageIndexes.get(i))); } } else { fernRegions.addAll(storageRect); } }
void function(double totalP, double totalN) { for( int i = 0; i < fernInfo.size; i++ ) { TldRegionFernInfo info = fernInfo.get(i); double probP = info.sumP/totalP; double probN = info.sumN/totalN; if( probP > probN ) { storageMetric.add(-(probP-probN)); storageRect.add( info.r ); } } if( config.maximumCascadeConsider < storageMetric.size ) { int N = Math.min(config.maximumCascadeConsider, storageMetric.size); storageIndexes.resize(storageMetric.size); QuickSelect.selectIndex(storageMetric.data, N - 1, storageMetric.size, storageIndexes.data); for( int i = 0; i < N; i++ ) { fernRegions.add(storageRect.get(storageIndexes.get(i))); } } else { fernRegions.addAll(storageRect); } }
/** * compute the probability that each region is the target conditional upon this image * the sumP and sumN are needed for image conditional probability * * NOTE: This is a big change from the original paper */
compute the probability that each region is the target conditional upon this image the sumP and sumN are needed for image conditional probability
selectBestRegionsFern
{ "repo_name": "pacozaa/BoofCV", "path": "main/recognition/src/boofcv/alg/tracker/tld/TldDetection.java", "license": "apache-2.0", "size": 8471 }
[ "org.ddogleg.sorting.QuickSelect" ]
import org.ddogleg.sorting.QuickSelect;
import org.ddogleg.sorting.*;
[ "org.ddogleg.sorting" ]
org.ddogleg.sorting;
2,040,501
@Override public int give(int amount, boolean notify) { return StorageManager.getVirtualCurrencyStorage().add(this, amount, notify); }
int function(int amount, boolean notify) { return StorageManager.getVirtualCurrencyStorage().add(this, amount, notify); }
/** * see parent * @param amount the amount of the specific item to be given. * @return balance after the giving process */
see parent
give
{ "repo_name": "NatWeiss/RGP", "path": "src/cocos2dx-store/submodules/android-store/SoomlaAndroidStore/src/com/soomla/store/domain/virtualCurrencies/VirtualCurrency.java", "license": "mit", "size": 2391 }
[ "com.soomla.store.data.StorageManager" ]
import com.soomla.store.data.StorageManager;
import com.soomla.store.data.*;
[ "com.soomla.store" ]
com.soomla.store;
2,382,124
public void test_getInstance4() throws Exception { Field mots = MessageOnTheScreen.class .getDeclaredField(MOTS_INSTANCE_FIELD_NAME); mots.setAccessible(true); Constructor<MessageOnTheScreen> motsConstructor = MessageOnTheScreen.class.getDeclaredConstructor(Activity.class, boolean.class); motsConstructor.setAccessible(true); MessageOnTheScreen expected = motsConstructor.newInstance(activity, false); mots.set(null, expected); MessageOnTheScreen actual = MessageOnTheScreen.getInstance(activity, true); assertEquals(expected, actual); }
void function() throws Exception { Field mots = MessageOnTheScreen.class .getDeclaredField(MOTS_INSTANCE_FIELD_NAME); mots.setAccessible(true); Constructor<MessageOnTheScreen> motsConstructor = MessageOnTheScreen.class.getDeclaredConstructor(Activity.class, boolean.class); motsConstructor.setAccessible(true); MessageOnTheScreen expected = motsConstructor.newInstance(activity, false); mots.set(null, expected); MessageOnTheScreen actual = MessageOnTheScreen.getInstance(activity, true); assertEquals(expected, actual); }
/** * If MessageOnTheScreen object already exists, then * MessageOnTheScreen.getInstance() method should return reference to * this instance even when requested visibility is different. */
If MessageOnTheScreen object already exists, then MessageOnTheScreen.getInstance() method should return reference to this instance even when requested visibility is different
test_getInstance4
{ "repo_name": "wlawski/libmots", "path": "tests/libmots-tests/src/net/wiktorlawski/messageonthescreen/test/MessageOnTheScreenTest.java", "license": "mit", "size": 11876 }
[ "android.app.Activity", "java.lang.reflect.Constructor", "java.lang.reflect.Field", "net.wiktorlawski.messageonthescreen.MessageOnTheScreen" ]
import android.app.Activity; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import net.wiktorlawski.messageonthescreen.MessageOnTheScreen;
import android.app.*; import java.lang.reflect.*; import net.wiktorlawski.messageonthescreen.*;
[ "android.app", "java.lang", "net.wiktorlawski.messageonthescreen" ]
android.app; java.lang; net.wiktorlawski.messageonthescreen;
890,393
public Method getServiceMethod() throws RegistryException { if (serviceMethod == null) { serviceMethod = loadServiceMethod(); } return serviceMethod; }
Method function() throws RegistryException { if (serviceMethod == null) { serviceMethod = loadServiceMethod(); } return serviceMethod; }
/** * Get service method. * * @return Service method. * @throws RegistryException */
Get service method
getServiceMethod
{ "repo_name": "snogaraleal/wbi", "path": "app/rpc/server/registry/RegistryServiceMethod.java", "license": "gpl-3.0", "size": 3861 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
421,326
@SuppressWarnings({"SuspiciousMethodCalls", "unchecked", "TypeMayBeWeakened"}) private void fillNodeAttributes(boolean notifyEnabled) throws IgniteCheckedException { final String[] incProps = cfg.getIncludeProperties(); try { // Stick all environment settings into node attributes. for (Map.Entry<String, String> sysEntry : System.getenv().entrySet()) { String name = sysEntry.getKey(); if (incProps == null || U.containsStringArray(incProps, name, true) || U.isVisorNodeStartProperty(name) || U.isVisorRequiredProperty(name)) ctx.addNodeAttribute(name, sysEntry.getValue()); } if (log.isDebugEnabled()) log.debug("Added environment properties to node attributes."); } catch (SecurityException e) { throw new IgniteCheckedException("Failed to add environment properties to node attributes due to " + "security violation: " + e.getMessage()); } try { // Stick all system properties into node's attributes overwriting any // identical names from environment properties. for (Map.Entry<Object, Object> e : snapshot().entrySet()) { String key = (String)e.getKey(); if (incProps == null || U.containsStringArray(incProps, key, true) || U.isVisorRequiredProperty(key)) { Object val = ctx.nodeAttribute(key); if (val != null && !val.equals(e.getValue())) U.warn(log, "System property will override environment variable with the same name: " + key); ctx.addNodeAttribute(key, e.getValue()); } } ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_UPDATE_NOTIFIER_ENABLED, notifyEnabled); if (log.isDebugEnabled()) log.debug("Added system properties to node attributes."); } catch (SecurityException e) { throw new IgniteCheckedException("Failed to add system properties to node attributes due to security " + "violation: " + e.getMessage()); } // Add local network IPs and MACs. String ips = F.concat(U.allLocalIps(), ", "); // Exclude loopbacks. String macs = F.concat(U.allLocalMACs(), ", "); // Only enabled network interfaces. // Ack network context. if (log.isInfoEnabled()) { log.info("Non-loopback local IPs: " + (F.isEmpty(ips) ? "N/A" : ips)); log.info("Enabled local MACs: " + (F.isEmpty(macs) ? "N/A" : macs)); } // Warn about loopback. if (ips.isEmpty() && macs.isEmpty()) U.warn(log, "Ignite is starting on loopback address... Only nodes on the same physical " + "computer can participate in topology.", "Ignite is starting on loopback address..."); // Stick in network context into attributes. add(ATTR_IPS, (ips.isEmpty() ? "" : ips)); add(ATTR_MACS, (macs.isEmpty() ? "" : macs)); // Stick in some system level attributes add(ATTR_JIT_NAME, U.getCompilerMx() == null ? "" : U.getCompilerMx().getName()); add(ATTR_BUILD_VER, VER_STR); add(ATTR_BUILD_DATE, BUILD_TSTAMP_STR); add(ATTR_MARSHALLER, cfg.getMarshaller().getClass().getName()); add(ATTR_MARSHALLER_USE_DFLT_SUID, getBoolean(IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID, OptimizedMarshaller.USE_DFLT_SUID)); add(ATTR_LATE_AFFINITY_ASSIGNMENT, cfg.isLateAffinityAssignment()); add(ATTR_ACTIVE_ON_START, cfg.isActiveOnStart()); if (cfg.getMarshaller() instanceof BinaryMarshaller) { add(ATTR_MARSHALLER_COMPACT_FOOTER, cfg.getBinaryConfiguration() == null ? BinaryConfiguration.DFLT_COMPACT_FOOTER : cfg.getBinaryConfiguration().isCompactFooter()); add(ATTR_MARSHALLER_USE_BINARY_STRING_SER_VER_2, getBoolean(IGNITE_BINARY_MARSHALLER_USE_STRING_SERIALIZATION_VER_2, BinaryUtils.USE_STR_SERIALIZATION_VER_2)); } add(ATTR_USER_NAME, System.getProperty("user.name")); add(ATTR_IGNITE_INSTANCE_NAME, igniteInstanceName); add(ATTR_PEER_CLASSLOADING, cfg.isPeerClassLoadingEnabled()); add(ATTR_DEPLOYMENT_MODE, cfg.getDeploymentMode()); add(ATTR_LANG_RUNTIME, getLanguage()); add(ATTR_JVM_PID, U.jvmPid()); add(ATTR_CLIENT_MODE, cfg.isClientMode()); add(ATTR_CONSISTENCY_CHECK_SKIPPED, getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)); if (cfg.getConsistentId() != null) add(ATTR_NODE_CONSISTENT_ID, cfg.getConsistentId()); // Build a string from JVM arguments, because parameters with spaces are split. SB jvmArgs = new SB(512); for (String arg : U.jvmArgs()) { if (arg.startsWith("-")) jvmArgs.a("@@@"); else jvmArgs.a(' '); jvmArgs.a(arg); } // Add it to attributes. add(ATTR_JVM_ARGS, jvmArgs.toString()); // Check daemon system property and override configuration if it's set. if (isDaemon()) add(ATTR_DAEMON, "true"); // In case of the parsing error, JMX remote disabled or port not being set // node attribute won't be set. if (isJmxRemoteEnabled()) { String portStr = System.getProperty("com.sun.management.jmxremote.port"); if (portStr != null) try { add(ATTR_JMX_PORT, Integer.parseInt(portStr)); } catch (NumberFormatException ignore) { // No-op. } } // Whether restart is enabled and stick the attribute. add(ATTR_RESTART_ENABLED, Boolean.toString(isRestartEnabled())); // Save port range, port numbers will be stored by rest processor at runtime. if (cfg.getConnectorConfiguration() != null) add(ATTR_REST_PORT_RANGE, cfg.getConnectorConfiguration().getPortRange()); // Stick in SPI versions and classes attributes. addSpiAttributes(cfg.getCollisionSpi()); addSpiAttributes(cfg.getDiscoverySpi()); addSpiAttributes(cfg.getFailoverSpi()); addSpiAttributes(cfg.getCommunicationSpi()); addSpiAttributes(cfg.getEventStorageSpi()); addSpiAttributes(cfg.getCheckpointSpi()); addSpiAttributes(cfg.getLoadBalancingSpi()); addSpiAttributes(cfg.getDeploymentSpi()); // Set user attributes for this node. if (cfg.getUserAttributes() != null) { for (Map.Entry<String, ?> e : cfg.getUserAttributes().entrySet()) { if (ctx.hasNodeAttribute(e.getKey())) U.warn(log, "User or internal attribute has the same name as environment or system " + "property and will take precedence: " + e.getKey()); ctx.addNodeAttribute(e.getKey(), e.getValue()); } } }
@SuppressWarnings({STR, STR, STR}) void function(boolean notifyEnabled) throws IgniteCheckedException { final String[] incProps = cfg.getIncludeProperties(); try { for (Map.Entry<String, String> sysEntry : System.getenv().entrySet()) { String name = sysEntry.getKey(); if (incProps == null U.containsStringArray(incProps, name, true) U.isVisorNodeStartProperty(name) U.isVisorRequiredProperty(name)) ctx.addNodeAttribute(name, sysEntry.getValue()); } if (log.isDebugEnabled()) log.debug(STR); } catch (SecurityException e) { throw new IgniteCheckedException(STR + STR + e.getMessage()); } try { for (Map.Entry<Object, Object> e : snapshot().entrySet()) { String key = (String)e.getKey(); if (incProps == null U.containsStringArray(incProps, key, true) U.isVisorRequiredProperty(key)) { Object val = ctx.nodeAttribute(key); if (val != null && !val.equals(e.getValue())) U.warn(log, STR + key); ctx.addNodeAttribute(key, e.getValue()); } } ctx.addNodeAttribute(IgniteNodeAttributes.ATTR_UPDATE_NOTIFIER_ENABLED, notifyEnabled); if (log.isDebugEnabled()) log.debug(STR); } catch (SecurityException e) { throw new IgniteCheckedException(STR + STR + e.getMessage()); } String ips = F.concat(U.allLocalIps(), STR); String macs = F.concat(U.allLocalMACs(), STR); if (log.isInfoEnabled()) { log.info(STR + (F.isEmpty(ips) ? "N/A" : ips)); log.info(STR + (F.isEmpty(macs) ? "N/A" : macs)); } if (ips.isEmpty() && macs.isEmpty()) U.warn(log, STR + "computer can participate in topology.STRIgnite is starting on loopback address..."); add(ATTR_IPS, (ips.isEmpty() ? STRSTRSTRuser.nameSTR-STR@@@STRtrueSTRcom.sun.management.jmxremote.portSTRUser or internal attribute has the same name as environment or system STRproperty and will take precedence: " + e.getKey()); ctx.addNodeAttribute(e.getKey(), e.getValue()); } } }
/** * Creates attributes map and fills it in. * * @param notifyEnabled Update notifier flag. * @throws IgniteCheckedException thrown if was unable to set up attribute. */
Creates attributes map and fills it in
fillNodeAttributes
{ "repo_name": "pperalta/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java", "license": "apache-2.0", "size": 133143 }
[ "java.util.Map", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.IgniteSystemProperties", "org.apache.ignite.internal.util.typedef.F", "org.apache.ignite.internal.util.typedef.internal.U" ]
import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U;
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
749,867
@Override @XmlElement(name = "statement") public InternationalString getStatement() { return statement; }
@XmlElement(name = STR) InternationalString function() { return statement; }
/** * Returns the release statement. * * @return release statement, or {@code null} if none. */
Returns the release statement
getStatement
{ "repo_name": "Geomatys/sis", "path": "core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/constraint/DefaultReleasability.java", "license": "apache-2.0", "size": 6920 }
[ "javax.xml.bind.annotation.XmlElement", "org.opengis.util.InternationalString" ]
import javax.xml.bind.annotation.XmlElement; import org.opengis.util.InternationalString;
import javax.xml.bind.annotation.*; import org.opengis.util.*;
[ "javax.xml", "org.opengis.util" ]
javax.xml; org.opengis.util;
998,620
public final TextColor getColor() { return this.color; }
final TextColor function() { return this.color; }
/** * Returns the color of this {@link Text}. * * @return The color of this text */
Returns the color of this <code>Text</code>
getColor
{ "repo_name": "SpongeHistory/SpongeAPI-History", "path": "src/main/java/org/spongepowered/api/text/Text.java", "license": "mit", "size": 20866 }
[ "org.spongepowered.api.text.format.TextColor" ]
import org.spongepowered.api.text.format.TextColor;
import org.spongepowered.api.text.format.*;
[ "org.spongepowered.api" ]
org.spongepowered.api;
717,344
BooleanWrapper getBool() throws ServiceException;
BooleanWrapper getBool() throws ServiceException;
/** * Get complex types with bool properties * * @return the BooleanWrapper object if successful. * @throws ServiceException the exception wrapped in ServiceException if failed. */
Get complex types with bool properties
getBool
{ "repo_name": "BretJohnson/autorest", "path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodycomplex/Primitive.java", "license": "mit", "size": 17621 }
[ "com.microsoft.rest.ServiceException" ]
import com.microsoft.rest.ServiceException;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
1,167,161
public synchronized Vector<TaskInProgress> reportTasksInProgress(boolean shouldBeMap, boolean shouldBeComplete) { Vector<TaskInProgress> results = new Vector<TaskInProgress>(); TaskInProgress tips[] = null; if (shouldBeMap) { tips = maps; } else { tips = reduces; } for (int i = 0; i < tips.length; i++) { if (tips[i].isComplete() == shouldBeComplete) { results.add(tips[i]); } } return results; }
synchronized Vector<TaskInProgress> function(boolean shouldBeMap, boolean shouldBeComplete) { Vector<TaskInProgress> results = new Vector<TaskInProgress>(); TaskInProgress tips[] = null; if (shouldBeMap) { tips = maps; } else { tips = reduces; } for (int i = 0; i < tips.length; i++) { if (tips[i].isComplete() == shouldBeComplete) { results.add(tips[i]); } } return results; }
/** * Return a vector of completed TaskInProgress objects */
Return a vector of completed TaskInProgress objects
reportTasksInProgress
{ "repo_name": "YuMatsuzawa/HadoopEclipseProject", "path": "src/mapred/org/apache/hadoop/mapred/JobInProgress.java", "license": "apache-2.0", "size": 123901 }
[ "java.util.Vector" ]
import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
115,918
public void onLivingUpdate() { if (this.rand.nextInt(200) == 0) { this.func_110210_cH(); } super.onLivingUpdate(); if (!this.worldObj.isRemote) { if (this.rand.nextInt(900) == 0 && this.deathTime == 0) { this.heal(1.0F); } if (!this.isEatingHaystack() && this.riddenByEntity == null && this.rand.nextInt(300) == 0 && this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ)) == Block.grass.blockID) { this.setEatingHaystack(true); } if (this.isEatingHaystack() && ++this.eatingHaystackCounter > 50) { this.eatingHaystackCounter = 0; this.setEatingHaystack(false); } if (this.func_110205_ce() && !this.isAdultHorse() && !this.isEatingHaystack()) { EntityHorse entityhorse = this.getClosestHorse(this, 16.0D); if (entityhorse != null && this.getDistanceSqToEntity(entityhorse) > 4.0D) { PathEntity pathentity = this.worldObj.getPathEntityToEntity(this, entityhorse, 16.0F, true, false, false, true); this.setPathToEntity(pathentity); } } } }
void function() { if (this.rand.nextInt(200) == 0) { this.func_110210_cH(); } super.onLivingUpdate(); if (!this.worldObj.isRemote) { if (this.rand.nextInt(900) == 0 && this.deathTime == 0) { this.heal(1.0F); } if (!this.isEatingHaystack() && this.riddenByEntity == null && this.rand.nextInt(300) == 0 && this.worldObj.getBlockId(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ)) == Block.grass.blockID) { this.setEatingHaystack(true); } if (this.isEatingHaystack() && ++this.eatingHaystackCounter > 50) { this.eatingHaystackCounter = 0; this.setEatingHaystack(false); } if (this.func_110205_ce() && !this.isAdultHorse() && !this.isEatingHaystack()) { EntityHorse entityhorse = this.getClosestHorse(this, 16.0D); if (entityhorse != null && this.getDistanceSqToEntity(entityhorse) > 4.0D) { PathEntity pathentity = this.worldObj.getPathEntityToEntity(this, entityhorse, 16.0F, true, false, false, true); this.setPathToEntity(pathentity); } } } }
/** * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons * use this to react to sunlight and start to burn. */
Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons use this to react to sunlight and start to burn
onLivingUpdate
{ "repo_name": "HATB0T/RuneCraftery", "path": "forge/mcp/src/minecraft/net/minecraft/entity/passive/EntityHorse.java", "license": "lgpl-3.0", "size": 54333 }
[ "net.minecraft.block.Block", "net.minecraft.pathfinding.PathEntity", "net.minecraft.util.MathHelper" ]
import net.minecraft.block.Block; import net.minecraft.pathfinding.PathEntity; import net.minecraft.util.MathHelper;
import net.minecraft.block.*; import net.minecraft.pathfinding.*; import net.minecraft.util.*;
[ "net.minecraft.block", "net.minecraft.pathfinding", "net.minecraft.util" ]
net.minecraft.block; net.minecraft.pathfinding; net.minecraft.util;
1,229,823
@Deprecated public WireTapDefinition<Type> wireTap(@AsEndpointUri String uri, ExecutorService executorService) { WireTapDefinition answer = new WireTapDefinition(); answer.setUri(uri); answer.setExecutorService(executorService); addOutput(answer); return answer; } /** * <a href="http://camel.apache.org/wiretap.html">WireTap EIP:</a> * Sends messages to all its child outputs; so that each processor and * destination gets a copy of the original message to avoid the processors * interfering with each other using {@link ExchangePattern#InOnly}. * * @param uri the dynamic endpoint to wiretap to (resolved using simple language by default) * @param executorServiceRef reference to lookup a custom {@link ExecutorService}
WireTapDefinition<Type> function(@AsEndpointUri String uri, ExecutorService executorService) { WireTapDefinition answer = new WireTapDefinition(); answer.setUri(uri); answer.setExecutorService(executorService); addOutput(answer); return answer; } /** * <a href="http: * Sends messages to all its child outputs; so that each processor and * destination gets a copy of the original message to avoid the processors * interfering with each other using {@link ExchangePattern#InOnly}. * * @param uri the dynamic endpoint to wiretap to (resolved using simple language by default) * @param executorServiceRef reference to lookup a custom {@link ExecutorService}
/** * <a href="http://camel.apache.org/wiretap.html">WireTap EIP:</a> * Sends messages to all its child outputs; so that each processor and * destination gets a copy of the original message to avoid the processors * interfering with each other using {@link ExchangePattern#InOnly}. * * @param uri the dynamic endpoint to wiretap to (resolved using simple language by default) * @param executorService a custom {@link ExecutorService} to use as thread pool * for sending tapped exchanges * @return the builder * @deprecated use the fluent builder from {@link WireTapDefinition}, will be removed in Camel 3.0 */
Sends messages to all its child outputs; so that each processor and destination gets a copy of the original message to avoid the processors interfering with each other using <code>ExchangePattern#InOnly</code>
wireTap
{ "repo_name": "Thopap/camel", "path": "camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java", "license": "apache-2.0", "size": 169760 }
[ "java.util.concurrent.ExecutorService", "org.apache.camel.ExchangePattern", "org.apache.camel.spi.AsEndpointUri" ]
import java.util.concurrent.ExecutorService; import org.apache.camel.ExchangePattern; import org.apache.camel.spi.AsEndpointUri;
import java.util.concurrent.*; import org.apache.camel.*; import org.apache.camel.spi.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
1,041,001
protected void initBodyElementName(String elementName) { if ((elementName == null) || (m_page.hasValue(elementName, getElementLocale()) && !m_page.isEnabled(elementName, getElementLocale()))) { // elementName not specified or given element is disabled, determine default element List<String> allElements = m_page.getNames(getElementLocale()); int elementCount = allElements.size(); List<String> elements = new ArrayList<String>(elementCount); for (int i = 0; i < elementCount; i++) { // filter disabled elements if (m_page.isEnabled(allElements.get(i), getElementLocale())) { elements.add(allElements.get(i)); } } // get the active page elements List<CmsDialogElement> elementList = getElementList(); for (int i = 0; i < elementList.size(); i++) { CmsDialogElement checkElement = elementList.get(i); if (elements.contains(checkElement.getName())) { // get the first active element from the element list setParamElementname(checkElement.getName()); return; } } // no matching active element found if (elements.contains(CmsDefaultPageEditor.XML_BODY_ELEMENT)) { // default legacy element present, use it setParamElementname(CmsDefaultPageEditor.XML_BODY_ELEMENT); } else { // use the first element from the element list setParamElementname(elements.get(0)); } } else { // elementName specified and element is enabled or not present, set to elementName setParamElementname(elementName); } }
void function(String elementName) { if ((elementName == null) (m_page.hasValue(elementName, getElementLocale()) && !m_page.isEnabled(elementName, getElementLocale()))) { List<String> allElements = m_page.getNames(getElementLocale()); int elementCount = allElements.size(); List<String> elements = new ArrayList<String>(elementCount); for (int i = 0; i < elementCount; i++) { if (m_page.isEnabled(allElements.get(i), getElementLocale())) { elements.add(allElements.get(i)); } } List<CmsDialogElement> elementList = getElementList(); for (int i = 0; i < elementList.size(); i++) { CmsDialogElement checkElement = elementList.get(i); if (elements.contains(checkElement.getName())) { setParamElementname(checkElement.getName()); return; } } if (elements.contains(CmsDefaultPageEditor.XML_BODY_ELEMENT)) { setParamElementname(CmsDefaultPageEditor.XML_BODY_ELEMENT); } else { setParamElementname(elements.get(0)); } } else { setParamElementname(elementName); } }
/** * Initializes the body element name of the editor.<p> * * This has to be called after the element language has been set with setParamBodylanguage().<p> * * @param elementName the name of the element to initialize or null, if default element should be used */
Initializes the body element name of the editor. This has to be called after the element language has been set with setParamBodylanguage()
initBodyElementName
{ "repo_name": "alkacon/opencms-core", "path": "src/org/opencms/workplace/editors/CmsDefaultPageEditor.java", "license": "lgpl-2.1", "size": 25251 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
768,591
public static void printCards(ElevensBoard board) { List<Integer> cIndexes = board.cardIndexes(); for (int i : cIndexes) { System.out.println(board.cardAt(i)); } }
static void function(ElevensBoard board) { List<Integer> cIndexes = board.cardIndexes(); for (int i : cIndexes) { System.out.println(board.cardAt(i)); } }
/** * Print all of the cards on the board. */
Print all of the cards on the board
printCards
{ "repo_name": "jflory7/SFHSAPCompSci2015", "path": "src/main/java/com/justinwflory/assignments/spring/elevens-lab/BoardTester.java", "license": "apache-2.0", "size": 1013 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,648,323
public final void setRange(IDocument document, int offset, int length) { fDocument = document; fRangeOffset = offset; fRangeLength = length; String[] delimiters = document.getLegalLineDelimiters(); fDelimiters = new char[delimiters.length][]; for (int i = 0; i < delimiters.length; i++) fDelimiters[i] = delimiters[i].toCharArray(); updateBuffer(offset); fOffset = 0; }
final void function(IDocument document, int offset, int length) { fDocument = document; fRangeOffset = offset; fRangeLength = length; String[] delimiters = document.getLegalLineDelimiters(); fDelimiters = new char[delimiters.length][]; for (int i = 0; i < delimiters.length; i++) fDelimiters[i] = delimiters[i].toCharArray(); updateBuffer(offset); fOffset = 0; }
/** * Configures the scanner by providing access to the document range over which to scan. * * @param document the document to scan * @param offset the offset of the document range to scan * @param length the length of the document range to scan */
Configures the scanner by providing access to the document range over which to scan
setRange
{ "repo_name": "sleshchenko/che", "path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/ui/text/BufferedDocumentScanner.java", "license": "epl-1.0", "size": 5079 }
[ "org.eclipse.jface.text.IDocument" ]
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
2,068,632
public byte read() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; }
byte function() throws IOException { if (bufferPointer == bytesRead) fillBuffer(); return buffer[bufferPointer++]; }
/** * Read the next byte of data from the input stream. * @return the next byte of data, or -1 if the end of the stream is reached. * @throws IOException if an I/O error occurs. */
Read the next byte of data from the input stream
read
{ "repo_name": "darrensun/OJ-Solutions", "path": "src/com/darrensun/spoj/anarc05b/Main.java", "license": "apache-2.0", "size": 4358 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,872,285
public static String adoc(SolrInputDocument sdoc) { List<String> fields = new ArrayList<String>(); for (SolrInputField sf : sdoc) { for (Object o : sf.getValues()) { fields.add(sf.getName()); fields.add(o.toString()); } } return adoc(fields.toArray(new String[fields.size()])); }
static String function(SolrInputDocument sdoc) { List<String> fields = new ArrayList<String>(); for (SolrInputField sf : sdoc) { for (Object o : sf.getValues()) { fields.add(sf.getName()); fields.add(o.toString()); } } return adoc(fields.toArray(new String[fields.size()])); }
/** * Generates a simple &lt;add&gt;&lt;doc&gt;... XML String with no options */
Generates a simple &lt;add&gt;&lt;doc&gt;... XML String with no options
adoc
{ "repo_name": "aaccomazzi/montysolr", "path": "src/test/monty/solr/util/MontySolrTestCaseJ4.java", "license": "gpl-2.0", "size": 19001 }
[ "java.util.ArrayList", "java.util.List", "org.apache.solr.common.SolrInputDocument", "org.apache.solr.common.SolrInputField" ]
import java.util.ArrayList; import java.util.List; import org.apache.solr.common.SolrInputDocument; import org.apache.solr.common.SolrInputField;
import java.util.*; import org.apache.solr.common.*;
[ "java.util", "org.apache.solr" ]
java.util; org.apache.solr;
1,259,468
protected void addAuthorPropertyDescriptor(Object object) { itemPropertyDescriptors .add (createItemPropertyDescriptor (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_LogMessage_author_feature"), getString("_UI_PropertyDescriptor_description", "_UI_LogMessage_author_feature", "_UI_LogMessage_type"), VersioningPackage.Literals.LOG_MESSAGE__AUTHOR, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors .add (createItemPropertyDescriptor (((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), VersioningPackage.Literals.LOG_MESSAGE__AUTHOR, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Author feature. <!-- * begin-user-doc --> <!-- end-user-doc --> * * @generated */
This adds a property descriptor for the Author feature.
addAuthorPropertyDescriptor
{ "repo_name": "edgarmueller/emfstore-rest", "path": "bundles/org.eclipse.emf.emfstore.server.model.edit/src/org/eclipse/emf/emfstore/internal/server/model/versioning/provider/LogMessageItemProvider.java", "license": "epl-1.0", "size": 7658 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor", "org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; import org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage;
import org.eclipse.emf.edit.provider.*; import org.eclipse.emf.emfstore.internal.server.model.versioning.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
742,206
public TeamFieldValues updateTeamFieldValues( final TeamFieldValuesPatch patch, final UUID project, final UUID team) { final UUID locationId = UUID.fromString("07ced576-58ed-49e6-9c1e-5cb53ab8bf2a"); //$NON-NLS-1$ final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.1"); //$NON-NLS-1$ final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put("project", project); //$NON-NLS-1$ routeValues.put("team", team); //$NON-NLS-1$ final VssRestRequest httpRequest = super.createRequest(HttpMethod.PATCH, locationId, routeValues, apiVersion, patch, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, TeamFieldValues.class); }
TeamFieldValues function( final TeamFieldValuesPatch patch, final UUID project, final UUID team) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); routeValues.put("team", team); final VssRestRequest httpRequest = super.createRequest(HttpMethod.PATCH, locationId, routeValues, apiVersion, patch, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, TeamFieldValues.class); }
/** * [Preview API 3.1-preview.1] * * @param patch * * @param project * Project ID * @param team * Team ID * @return TeamFieldValues */
[Preview API 3.1-preview.1]
updateTeamFieldValues
{ "repo_name": "Microsoft/vso-httpclient-java", "path": "Rest/alm-tfs-client/src/main/generated/com/microsoft/alm/teamfoundation/work/webapi/WorkHttpClientBase.java", "license": "mit", "size": 234377 }
[ "com.microsoft.alm.client.HttpMethod", "com.microsoft.alm.client.VssMediaTypes", "com.microsoft.alm.client.VssRestRequest", "com.microsoft.alm.teamfoundation.work.webapi.TeamFieldValues", "com.microsoft.alm.teamfoundation.work.webapi.TeamFieldValuesPatch", "com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion", "java.util.HashMap", "java.util.Map", "java.util.UUID" ]
import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.teamfoundation.work.webapi.TeamFieldValues; import com.microsoft.alm.teamfoundation.work.webapi.TeamFieldValuesPatch; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID;
import com.microsoft.alm.client.*; import com.microsoft.alm.teamfoundation.work.webapi.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*;
[ "com.microsoft.alm", "java.util" ]
com.microsoft.alm; java.util;
880,885
public void fillInNotifierBundle(Bundle m) { m.putInt("voiceRegState", mVoiceRegState); m.putInt("dataRegState", mDataRegState); m.putInt("voiceRoamingType", mVoiceRoamingType); m.putInt("dataRoamingType", mDataRoamingType); m.putString("operator-alpha-long", mVoiceOperatorAlphaLong); m.putString("operator-alpha-short", mVoiceOperatorAlphaShort); m.putString("operator-numeric", mVoiceOperatorNumeric); m.putString("data-operator-alpha-long", mDataOperatorAlphaLong); m.putString("data-operator-alpha-short", mDataOperatorAlphaShort); m.putString("data-operator-numeric", mDataOperatorNumeric); m.putBoolean("manual", Boolean.valueOf(mIsManualNetworkSelection)); m.putInt("radioTechnology", mRilVoiceRadioTechnology); m.putInt("dataRadioTechnology", mRilDataRadioTechnology); m.putBoolean("cssIndicator", mCssIndicator); m.putInt("networkId", mNetworkId); m.putInt("systemId", mSystemId); m.putInt("cdmaRoamingIndicator", mCdmaRoamingIndicator); m.putInt("cdmaDefaultRoamingIndicator", mCdmaDefaultRoamingIndicator); m.putBoolean("emergencyOnly", Boolean.valueOf(mIsEmergencyOnly)); }
void function(Bundle m) { m.putInt(STR, mVoiceRegState); m.putInt(STR, mDataRegState); m.putInt(STR, mVoiceRoamingType); m.putInt(STR, mDataRoamingType); m.putString(STR, mVoiceOperatorAlphaLong); m.putString(STR, mVoiceOperatorAlphaShort); m.putString(STR, mVoiceOperatorNumeric); m.putString(STR, mDataOperatorAlphaLong); m.putString(STR, mDataOperatorAlphaShort); m.putString(STR, mDataOperatorNumeric); m.putBoolean(STR, Boolean.valueOf(mIsManualNetworkSelection)); m.putInt(STR, mRilVoiceRadioTechnology); m.putInt(STR, mRilDataRadioTechnology); m.putBoolean(STR, mCssIndicator); m.putInt(STR, mNetworkId); m.putInt(STR, mSystemId); m.putInt(STR, mCdmaRoamingIndicator); m.putInt(STR, mCdmaDefaultRoamingIndicator); m.putBoolean(STR, Boolean.valueOf(mIsEmergencyOnly)); }
/** * Set intent notifier Bundle based on service state. * * @param m intent notifier Bundle * @hide */
Set intent notifier Bundle based on service state
fillInNotifierBundle
{ "repo_name": "s20121035/rk3288_android5.1_repo", "path": "frameworks/base/telephony/java/android/telephony/ServiceState.java", "license": "gpl-3.0", "size": 37622 }
[ "android.os.Bundle" ]
import android.os.Bundle;
import android.os.*;
[ "android.os" ]
android.os;
1,741,082
ServiceCall<Void> putMinDateAsync(LocalDate dateBody, final ServiceCallback<Void> serviceCallback);
ServiceCall<Void> putMinDateAsync(LocalDate dateBody, final ServiceCallback<Void> serviceCallback);
/** * Put min date value 0000-01-01. * * @param dateBody the LocalDate value * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @return the {@link ServiceCall} object */
Put min date value 0000-01-01
putMinDateAsync
{ "repo_name": "tbombach/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodydate/Dates.java", "license": "mit", "size": 9069 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback", "org.joda.time.LocalDate" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import org.joda.time.LocalDate;
import com.microsoft.rest.*; import org.joda.time.*;
[ "com.microsoft.rest", "org.joda.time" ]
com.microsoft.rest; org.joda.time;
2,897,688
public void print(Color c, String s) { if (SwingUtilities.isEventDispatchThread()) { append(c, s); }
void function(Color c, String s) { if (SwingUtilities.isEventDispatchThread()) { append(c, s); }
/** * Append a string with the specified color. This method is thread safe. */
Append a string with the specified color. This method is thread safe
print
{ "repo_name": "dblezek/Notion", "path": "src/main/java/org/rsna/ui/ColorPane.java", "license": "bsd-3-clause", "size": 5022 }
[ "java.awt.Color", "javax.swing.SwingUtilities" ]
import java.awt.Color; import javax.swing.SwingUtilities;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
1,352,337
public ToDoHeader getToDoHeader(String todoId) throws TodoException { verifyCurrentUserIsOwner(todoId); ToDoHeader result = calendarBm.getToDoHeader(todoId); return result; }
ToDoHeader function(String todoId) throws TodoException { verifyCurrentUserIsOwner(todoId); ToDoHeader result = calendarBm.getToDoHeader(todoId); return result; }
/** * Method declaration * * @param todoId * @return * @throws TodoException * @see */
Method declaration
getToDoHeader
{ "repo_name": "auroreallibe/Silverpeas-Core", "path": "core-war/src/main/java/org/silverpeas/web/todo/control/ToDoSessionController.java", "license": "agpl-3.0", "size": 17863 }
[ "org.silverpeas.core.personalorganizer.model.ToDoHeader" ]
import org.silverpeas.core.personalorganizer.model.ToDoHeader;
import org.silverpeas.core.personalorganizer.model.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
2,019,535
public Movie getMovie(long id) { String selection = MoviesTable.COLUMN_MOVIE_ID + " = " + id; Cursor cursor = contentResolver.query(uri_movies, null, selection, null, null); if (cursor.moveToFirst()) { String title = cursor.getString(1); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(Long.parseLong(cursor.getString(4))); int rating = Integer.parseInt(cursor.getString(2)); String note = cursor.getString(3); Movie movie = new Movie(title, calendar, rating, note); movie.setId(id); movie.setPosterURL(cursor.getString(6), Movie.PosterSize.MID); movie.setPosterURL(cursor.getString(7), Movie.PosterSize.THUMB); movie.setApiID(Integer.parseInt(cursor.getString(5))); Cursor tempCursor = getAttachedTags(movie); // TODO getCount() doesn't return 0 when it should, why?! // Implementing try-catch method as solution for now try { // Don't try to fetch tags if none are attached to movie if (tempCursor.getCount() > 0) { List<Tag> tags = new LinkedList<Tag>(); while (tempCursor.moveToNext()) { Tag tag = new Tag(tempCursor.getString(1)); tag.setId(Integer.parseInt(tempCursor.getString(0))); tags.add(tag); } movie.addTags(tags); } } catch (NullPointerException e) { e.printStackTrace(); } return movie; } return null; }
Movie function(long id) { String selection = MoviesTable.COLUMN_MOVIE_ID + STR + id; Cursor cursor = contentResolver.query(uri_movies, null, selection, null, null); if (cursor.moveToFirst()) { String title = cursor.getString(1); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(Long.parseLong(cursor.getString(4))); int rating = Integer.parseInt(cursor.getString(2)); String note = cursor.getString(3); Movie movie = new Movie(title, calendar, rating, note); movie.setId(id); movie.setPosterURL(cursor.getString(6), Movie.PosterSize.MID); movie.setPosterURL(cursor.getString(7), Movie.PosterSize.THUMB); movie.setApiID(Integer.parseInt(cursor.getString(5))); Cursor tempCursor = getAttachedTags(movie); try { if (tempCursor.getCount() > 0) { List<Tag> tags = new LinkedList<Tag>(); while (tempCursor.moveToNext()) { Tag tag = new Tag(tempCursor.getString(1)); tag.setId(Integer.parseInt(tempCursor.getString(0))); tags.add(tag); } movie.addTags(tags); } } catch (NullPointerException e) { e.printStackTrace(); } return movie; } return null; }
/** * Returns the specified Movie. * * @param id * The id of the Movie. * @return null if there is no Movie with the specified id. */
Returns the specified Movie
getMovie
{ "repo_name": "johanbrook/watchme", "path": "src/se/chalmers/watchme/database/DatabaseAdapter.java", "license": "mit", "size": 14245 }
[ "android.database.Cursor", "java.util.Calendar", "java.util.LinkedList", "java.util.List", "se.chalmers.watchme.model.Movie", "se.chalmers.watchme.model.Tag" ]
import android.database.Cursor; import java.util.Calendar; import java.util.LinkedList; import java.util.List; import se.chalmers.watchme.model.Movie; import se.chalmers.watchme.model.Tag;
import android.database.*; import java.util.*; import se.chalmers.watchme.model.*;
[ "android.database", "java.util", "se.chalmers.watchme" ]
android.database; java.util; se.chalmers.watchme;
700,075
public OutputStream downloadFile(String fileId, OutputStream output, Long rangeStart, Long rangeEnd, ProgressListener listener) { try { LOG.debug("Downloading file(id=" + fileId + ")"); if (fileId == null) { throw new IllegalArgumentException("Parameter 'fileId' can not be null"); } if (output == null) { throw new IllegalArgumentException("Parameter 'output' can not be null"); } BoxFile file = new BoxFile(boxConnection, fileId); if (listener != null) { if (rangeStart != null && rangeEnd != null) { file.downloadRange(output, rangeStart, rangeEnd, listener); } else { file.download(output, listener); } } else { if (rangeStart != null && rangeEnd != null) { file.downloadRange(output, rangeStart, rangeEnd); } else { file.download(output); } } return output; } catch (BoxAPIException e) { throw new RuntimeException( String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e); } }
OutputStream function(String fileId, OutputStream output, Long rangeStart, Long rangeEnd, ProgressListener listener) { try { LOG.debug(STR + fileId + ")"); if (fileId == null) { throw new IllegalArgumentException(STR); } if (output == null) { throw new IllegalArgumentException(STR); } BoxFile file = new BoxFile(boxConnection, fileId); if (listener != null) { if (rangeStart != null && rangeEnd != null) { file.downloadRange(output, rangeStart, rangeEnd, listener); } else { file.download(output, listener); } } else { if (rangeStart != null && rangeEnd != null) { file.downloadRange(output, rangeStart, rangeEnd); } else { file.download(output); } } return output; } catch (BoxAPIException e) { throw new RuntimeException( String.format(STR, e.getResponseCode(), e.getResponse()), e); } }
/** * Download a file. * * @param fileId * - the id of file. * @param output * - the stream to which the file contents will be written. * @param rangeStart * - the byte offset in file at which to start the download; if * <code>null</code> the entire contents of file will be * downloaded. * @param rangeEnd * - the byte offset in file at which to stop the download; if * <code>null</code> the entire contents of file will be * downloaded. * @param listener * - a listener for monitoring the download's progress; if * <code>null</code> the download's progress will not be * monitored. * @return The stream containing the contents of the downloaded file. */
Download a file
downloadFile
{ "repo_name": "gautric/camel", "path": "components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxFilesManager.java", "license": "apache-2.0", "size": 31423 }
[ "com.box.sdk.BoxAPIException", "com.box.sdk.BoxFile", "com.box.sdk.ProgressListener", "java.io.OutputStream" ]
import com.box.sdk.BoxAPIException; import com.box.sdk.BoxFile; import com.box.sdk.ProgressListener; import java.io.OutputStream;
import com.box.sdk.*; import java.io.*;
[ "com.box.sdk", "java.io" ]
com.box.sdk; java.io;
137,454
private Entity buildProps(PropertyOptions _options) throws InvalidClassException { Entity entity; // Extract options final Class entityClass = _options.getEntityClass(); final String primaryKey = _options.getPrimaryKey(); final String[] interfaces = _options.getInterfaces(); final String superClassName = _options.getSuperClassName(); if (primaryKey != null) { entity = entityPropertiesBuilder .buildPropertiesForEntity(entityClass, blackListFields, primaryKey); } else { entity = entityPropertiesBuilder .buildPropertiesForEntity(entityClass, blackListFields); } if (interfaces.length > 0) { entity.implementsInterface(interfaces); } if (superClassName != null) { entity.setSuperclass(superClassName); } return entity; }
Entity function(PropertyOptions _options) throws InvalidClassException { Entity entity; final Class entityClass = _options.getEntityClass(); final String primaryKey = _options.getPrimaryKey(); final String[] interfaces = _options.getInterfaces(); final String superClassName = _options.getSuperClassName(); if (primaryKey != null) { entity = entityPropertiesBuilder .buildPropertiesForEntity(entityClass, blackListFields, primaryKey); } else { entity = entityPropertiesBuilder .buildPropertiesForEntity(entityClass, blackListFields); } if (interfaces.length > 0) { entity.implementsInterface(interfaces); } if (superClassName != null) { entity.setSuperclass(superClassName); } return entity; }
/** * Build properties for an greenDaoEntity from a class. * @param _options the options. * @return the greenDao Entity. * @throws InvalidClassException */
Build properties for an greenDaoEntity from a class
buildProps
{ "repo_name": "TheolZacharopoulos/greenDao-schema-builder", "path": "src/main/java/com/greendao_schema_builder/SchemaBuilder.java", "license": "apache-2.0", "size": 6206 }
[ "com.greendao_schema_builder.property.PropertyOptions", "de.greenrobot.daogenerator.Entity", "java.io.InvalidClassException" ]
import com.greendao_schema_builder.property.PropertyOptions; import de.greenrobot.daogenerator.Entity; import java.io.InvalidClassException;
import com.greendao_schema_builder.property.*; import de.greenrobot.daogenerator.*; import java.io.*;
[ "com.greendao_schema_builder.property", "de.greenrobot.daogenerator", "java.io" ]
com.greendao_schema_builder.property; de.greenrobot.daogenerator; java.io;
2,653,479
public void rewriteMapTreeRoot(long cleanerTargetLsn) throws DatabaseException { mapTreeRootLatch.acquire(); try { if (DbLsn.compareTo(cleanerTargetLsn, mapTreeRootLsn) == 0) { mapTreeRootLsn = logManager.log(new SingleItemEntry(LogEntryType.LOG_ROOT, dbMapTree)); } } finally { mapTreeRootLatch.release(); } }
void function(long cleanerTargetLsn) throws DatabaseException { mapTreeRootLatch.acquire(); try { if (DbLsn.compareTo(cleanerTargetLsn, mapTreeRootLsn) == 0) { mapTreeRootLsn = logManager.log(new SingleItemEntry(LogEntryType.LOG_ROOT, dbMapTree)); } } finally { mapTreeRootLatch.release(); } }
/** * Force a rewrite of the map tree root if required. */
Force a rewrite of the map tree root if required
rewriteMapTreeRoot
{ "repo_name": "nologic/nabs", "path": "client/trunk/shared/libraries/je-3.2.44/src/com/sleepycat/je/dbi/EnvironmentImpl.java", "license": "gpl-2.0", "size": 54038 }
[ "com.sleepycat.je.DatabaseException", "com.sleepycat.je.log.LogEntryType", "com.sleepycat.je.log.entry.SingleItemEntry", "com.sleepycat.je.utilint.DbLsn" ]
import com.sleepycat.je.DatabaseException; import com.sleepycat.je.log.LogEntryType; import com.sleepycat.je.log.entry.SingleItemEntry; import com.sleepycat.je.utilint.DbLsn;
import com.sleepycat.je.*; import com.sleepycat.je.log.*; import com.sleepycat.je.log.entry.*; import com.sleepycat.je.utilint.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
1,889,730
public Set<Class<? extends T>> getClasses() { return matches; }
Set<Class<? extends T>> function() { return matches; }
/** * Provides access to the classes discovered so far. If no calls have been made to * any of the {@code find()} methods, this set will be empty. * * @return the set of classes that have been discovered. */
Provides access to the classes discovered so far. If no calls have been made to any of the find() methods, this set will be empty
getClasses
{ "repo_name": "mrjabba/mybatis", "path": "src/main/java/org/apache/ibatis/io/ResolverUtil.java", "license": "apache-2.0", "size": 18962 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,835,104
public static String mapToJson(Object obj) throws IOException { ObjectMapper mapper = new ObjectMapper(); ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, obj); return out.toString(); }
static String function(Object obj) throws IOException { ObjectMapper mapper = new ObjectMapper(); ByteArrayOutputStream out = new ByteArrayOutputStream(); mapper.writeValue(out, obj); return out.toString(); }
/** * Convert a map to a json string. */
Convert a map to a json string
mapToJson
{ "repo_name": "sankarh/hive", "path": "hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/JsonBuilder.java", "license": "apache-2.0", "size": 5556 }
[ "com.fasterxml.jackson.databind.ObjectMapper", "java.io.ByteArrayOutputStream", "java.io.IOException" ]
import com.fasterxml.jackson.databind.ObjectMapper; import java.io.ByteArrayOutputStream; import java.io.IOException;
import com.fasterxml.jackson.databind.*; import java.io.*;
[ "com.fasterxml.jackson", "java.io" ]
com.fasterxml.jackson; java.io;
1,833,709
public Genomics fromClientSecretsFile(File clientSecretsJson) throws IOException { return fromClientSecretsFile(getGenomicsBuilder(), clientSecretsJson).build(); }
Genomics function(File clientSecretsJson) throws IOException { return fromClientSecretsFile(getGenomicsBuilder(), clientSecretsJson).build(); }
/** * Create a {@link Genomics} stub using a {@code client_secrets.json} {@link File}. * * @param clientSecretsJson {@code client_secrets.json} file. * @return The new {@code Genomics} stub * @throws IOException */
Create a <code>Genomics</code> stub using a client_secrets.json <code>File</code>
fromClientSecretsFile
{ "repo_name": "deflaux/utils-java-OBSOLETE", "path": "src/main/java/com/google/cloud/genomics/utils/GenomicsFactory.java", "license": "apache-2.0", "size": 22790 }
[ "com.google.api.services.genomics.Genomics", "java.io.File", "java.io.IOException" ]
import com.google.api.services.genomics.Genomics; import java.io.File; import java.io.IOException;
import com.google.api.services.genomics.*; import java.io.*;
[ "com.google.api", "java.io" ]
com.google.api; java.io;
2,316,893