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 long getSize() { long size = 0; for (Iterator it = sortedHostQueues.iterator(); it.hasNext();) { AdaptiveRevisitHostQueue hq = ((AdaptiveRevisitHostQueueWrapper)it .next()).hq; size += hq.getSize(); } return size; }
long function() { long size = 0; for (Iterator it = sortedHostQueues.iterator(); it.hasNext();) { AdaptiveRevisitHostQueue hq = ((AdaptiveRevisitHostQueueWrapper)it .next()).hq; size += hq.getSize(); } return size; }
/** * Returns the number of URIs in all the HQs in this list * @return the number of URIs in all the HQs in this list */
Returns the number of URIs in all the HQs in this list
getSize
{ "repo_name": "gaowangyizu/myHeritrix", "path": "myHeritrix/src/org/archive/crawler/frontier/AdaptiveRevisitQueueList.java", "license": "apache-2.0", "size": 16721 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,861,584
public CacheContinuousQueryEntry handle(CacheContinuousQueryEntry e) { assert e != null; if (e.isFiltered()) { Long last = buf.lastx(); Long first = buf.firstx(); if (last != null && first != null && last - first >= MAX_BUFF_SIZE) { NavigableSet<Long> prevHoles = buf.subSet(first, true, last, true); GridLongList filteredEvts = new GridLongList((int)(last - first)); int size = 0; Long cntr; while ((cntr = prevHoles.pollFirst()) != null) { filteredEvts.add(cntr); ++size; } filteredEvts.truncate(size, true); e.filteredEvents(filteredEvts); return e; } if (lastFiredCntr.get() > e.updateCounter() || e.updateCounter() == 1) return e; else { buf.add(e.updateCounter()); // Double check. If another thread sent a event with counter higher than this event. if (lastFiredCntr.get() > e.updateCounter() && buf.contains(e.updateCounter())) { buf.remove(e.updateCounter()); return e; } else return null; } } else { long prevVal = updateFiredCounter(e.updateCounter()); if (prevVal == -1) return e; else { NavigableSet<Long> prevHoles = buf.subSet(prevVal, true, e.updateCounter(), true); GridLongList filteredEvts = new GridLongList((int)(e.updateCounter() - prevVal)); int size = 0; Long cntr; while ((cntr = prevHoles.pollFirst()) != null) { filteredEvts.add(cntr); ++size; } filteredEvts.truncate(size, true); e.filteredEvents(filteredEvts); return e; } } } }
CacheContinuousQueryEntry function(CacheContinuousQueryEntry e) { assert e != null; if (e.isFiltered()) { Long last = buf.lastx(); Long first = buf.firstx(); if (last != null && first != null && last - first >= MAX_BUFF_SIZE) { NavigableSet<Long> prevHoles = buf.subSet(first, true, last, true); GridLongList filteredEvts = new GridLongList((int)(last - first)); int size = 0; Long cntr; while ((cntr = prevHoles.pollFirst()) != null) { filteredEvts.add(cntr); ++size; } filteredEvts.truncate(size, true); e.filteredEvents(filteredEvts); return e; } if (lastFiredCntr.get() > e.updateCounter() e.updateCounter() == 1) return e; else { buf.add(e.updateCounter()); if (lastFiredCntr.get() > e.updateCounter() && buf.contains(e.updateCounter())) { buf.remove(e.updateCounter()); return e; } else return null; } } else { long prevVal = updateFiredCounter(e.updateCounter()); if (prevVal == -1) return e; else { NavigableSet<Long> prevHoles = buf.subSet(prevVal, true, e.updateCounter(), true); GridLongList filteredEvts = new GridLongList((int)(e.updateCounter() - prevVal)); int size = 0; Long cntr; while ((cntr = prevHoles.pollFirst()) != null) { filteredEvts.add(cntr); ++size; } filteredEvts.truncate(size, true); e.filteredEvents(filteredEvts); return e; } } } }
/** * Add continuous entry. * * @param e Cache continuous query entry. * @return Collection entries which will be fired. */
Add continuous entry
handle
{ "repo_name": "ryanzz/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java", "license": "apache-2.0", "size": 44806 }
[ "java.util.NavigableSet", "org.apache.ignite.internal.util.GridLongList" ]
import java.util.NavigableSet; import org.apache.ignite.internal.util.GridLongList;
import java.util.*; import org.apache.ignite.internal.util.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
2,302,329
static String sha1(Stream<String> source) throws NoSuchAlgorithmException { return sha1(source.collect(joining(","))); }
static String sha1(Stream<String> source) throws NoSuchAlgorithmException { return sha1(source.collect(joining(","))); }
/** * Sha1 sum of a stream of strings. * * @param source stream of strings to get sha1 for * @return sha1 of the toString for the stream, using "," as delimiter. * @throws NoSuchAlgorithmException */
Sha1 sum of a stream of strings
sha1
{ "repo_name": "UMS/interview-tasks", "path": "src/main/java/no/ums/interview/Sha1.java", "license": "apache-2.0", "size": 1125 }
[ "java.security.NoSuchAlgorithmException", "java.util.stream.Stream" ]
import java.security.NoSuchAlgorithmException; import java.util.stream.Stream;
import java.security.*; import java.util.stream.*;
[ "java.security", "java.util" ]
java.security; java.util;
1,564,749
@Override public void removeFailure(K key, StoreAccessException e) { cleanup(key, e); }
void function(K key, StoreAccessException e) { cleanup(key, e); }
/** * Do nothing. * * @param key the key being removed * @param e the triggered failure */
Do nothing
removeFailure
{ "repo_name": "alexsnaps/ehcache3", "path": "core/src/main/java/org/ehcache/core/internal/resilience/RobustResilienceStrategy.java", "license": "apache-2.0", "size": 5083 }
[ "org.ehcache.spi.resilience.StoreAccessException" ]
import org.ehcache.spi.resilience.StoreAccessException;
import org.ehcache.spi.resilience.*;
[ "org.ehcache.spi" ]
org.ehcache.spi;
2,901,589
private static Method findMatchingFactoryMethod(Method[] methods, String factoryMethod, String[] params) { List<Method> candidates = new ArrayList<>(); Method fallbackCandidate = null; for (Method method : methods) { // must match factory method name if (!factoryMethod.equals(method.getName())) { continue; } // must be a public static method that returns something if (!Modifier.isStatic(method.getModifiers()) || !Modifier.isPublic(method.getModifiers()) || method.getReturnType() == Void.TYPE) { continue; } // must match number of parameters if (method.getParameterCount() != params.length) { continue; } boolean matches = true; for (int i = 0; i < method.getParameterCount(); i++) { String parameter = params[i]; if (parameter != null) { // must trim parameter = parameter.trim(); } Class<?> parameterType = getValidParameterType(parameter); Class<?> expectedType = method.getParameterTypes()[i]; if (parameterType != null && expectedType != null) { // skip java.lang.Object type, when we have multiple possible methods we want to avoid it if possible if (Object.class.equals(expectedType)) { fallbackCandidate = method; matches = false; break; } boolean matchingTypes = isParameterMatchingType(parameterType, expectedType); if (!matchingTypes) { matches = false; break; } } } if (matches) { candidates.add(method); } } return candidates.size() == 1 ? candidates.get(0) : fallbackCandidate; }
static Method function(Method[] methods, String factoryMethod, String[] params) { List<Method> candidates = new ArrayList<>(); Method fallbackCandidate = null; for (Method method : methods) { if (!factoryMethod.equals(method.getName())) { continue; } if (!Modifier.isStatic(method.getModifiers()) !Modifier.isPublic(method.getModifiers()) method.getReturnType() == Void.TYPE) { continue; } if (method.getParameterCount() != params.length) { continue; } boolean matches = true; for (int i = 0; i < method.getParameterCount(); i++) { String parameter = params[i]; if (parameter != null) { parameter = parameter.trim(); } Class<?> parameterType = getValidParameterType(parameter); Class<?> expectedType = method.getParameterTypes()[i]; if (parameterType != null && expectedType != null) { if (Object.class.equals(expectedType)) { fallbackCandidate = method; matches = false; break; } boolean matchingTypes = isParameterMatchingType(parameterType, expectedType); if (!matchingTypes) { matches = false; break; } } } if (matches) { candidates.add(method); } } return candidates.size() == 1 ? candidates.get(0) : fallbackCandidate; }
/** * Finds the best matching factory methods for the given parameters. * <p/> * This implementation is similar to the logic in camel-bean. * * @param methods the methods * @param factoryMethod the name of the factory method * @param params the parameters * @return the constructor, or null if no matching constructor can be found */
Finds the best matching factory methods for the given parameters. This implementation is similar to the logic in camel-bean
findMatchingFactoryMethod
{ "repo_name": "gnodet/camel", "path": "core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java", "license": "apache-2.0", "size": 84502 }
[ "java.lang.reflect.Method", "java.lang.reflect.Modifier", "java.util.ArrayList", "java.util.List" ]
import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.List;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
736,561
@Test public void test65GetTransactionByTxId() { String txId = new String("111"); try { DbeTransaction dbetr = dbeTransactionDAO.getTransactionByTxId(txId); if (dbetr == null) { DbeTransactionDaoImplTest.LOGGER.debug("Obtained nothing"); Assert.assertTrue("Transaction Id not found", true); } else { DbeTransactionDaoImplTest.LOGGER.debug("Obtained value of transaction"); Assert.assertTrue("Transaction Id found", false); } } catch (Exception e) { // this is not possible String msg = "test65GetTransactionBySvrRfCde:Error in database there are several Transactions for " + txId; DbeTransactionDaoImplTest.LOGGER.error(msg); Assert.assertTrue("ERROR in Test ", false); } }
void function() { String txId = new String("111"); try { DbeTransaction dbetr = dbeTransactionDAO.getTransactionByTxId(txId); if (dbetr == null) { DbeTransactionDaoImplTest.LOGGER.debug(STR); Assert.assertTrue(STR, true); } else { DbeTransactionDaoImplTest.LOGGER.debug(STR); Assert.assertTrue(STR, false); } } catch (Exception e) { String msg = STR + txId; DbeTransactionDaoImplTest.LOGGER.error(msg); Assert.assertTrue(STR, false); } }
/** * test65GetTransactionByTxId searchs a inexistent txId */
test65GetTransactionByTxId searchs a inexistent txId
test65GetTransactionByTxId
{ "repo_name": "telefonicaid/fiware-rss", "path": "rss-core/rss-dao/src/test/java/es/tid/fiware/rss/dao/impl/test/DbeTransactionDaoImplTest.java", "license": "agpl-3.0", "size": 26899 }
[ "es.tid.fiware.rss.model.DbeTransaction", "org.junit.Assert" ]
import es.tid.fiware.rss.model.DbeTransaction; import org.junit.Assert;
import es.tid.fiware.rss.model.*; import org.junit.*;
[ "es.tid.fiware", "org.junit" ]
es.tid.fiware; org.junit;
1,044,527
public Paint getVolumePaint() { return this.volumePaint; }
Paint function() { return this.volumePaint; }
/** * Returns the paint that is used to fill the volume bars if they are * visible. * * @return The paint (never <code>null</code>). * * @see #setVolumePaint(Paint) * * @since 1.0.7 */
Returns the paint that is used to fill the volume bars if they are visible
getVolumePaint
{ "repo_name": "integrated/jfreechart", "path": "source/org/jfree/chart/renderer/xy/CandlestickRenderer.java", "license": "lgpl-2.1", "size": 35075 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,568,497
public Document findById(Long documentId) { log.debug("Performing document retrieve using id: " + documentId); Document document = null; Session sess = null; try { SessionFactory fact = HibernateUtil.getSessionFactory(); if (fact != null) { sess = fact.openSession(); if (sess != null) { document = (Document) sess.get(Document.class, documentId); } else { log.error("Failed to obtain a session from the sessionFactory"); } } else { log.error("Session factory was null"); } if (log.isDebugEnabled()) { log.debug("Completed document retrieve by id. Result was " + ((document == null) ? "not " : "") + "found"); } } finally { if (sess != null) { try { sess.close(); } catch (Throwable t) { log.error("Failed to close session: " + t.getMessage(), t); } } } return document; }
Document function(Long documentId) { log.debug(STR + documentId); Document document = null; Session sess = null; try { SessionFactory fact = HibernateUtil.getSessionFactory(); if (fact != null) { sess = fact.openSession(); if (sess != null) { document = (Document) sess.get(Document.class, documentId); } else { log.error(STR); } } else { log.error(STR); } if (log.isDebugEnabled()) { log.debug(STR + ((document == null) ? STR : STRfoundSTRFailed to close session: " + t.getMessage(), t); } } } return document; }
/** * Retrieve a document by identifier * * @param documentId Document identifier * @return Retrieved document */
Retrieve a document by identifier
findById
{ "repo_name": "TATRC/KMR2", "path": "Services/Common/XDSCommonLib/src/main/java/gov/hhs/fha/nhinc/docmgr/repository/dao/DocumentDao.java", "license": "bsd-3-clause", "size": 16876 }
[ "gov.hhs.fha.nhinc.docmgr.repository.model.Document", "gov.hhs.fha.nhinc.docmgr.repository.persistence.HibernateUtil", "org.hibernate.Session", "org.hibernate.SessionFactory" ]
import gov.hhs.fha.nhinc.docmgr.repository.model.Document; import gov.hhs.fha.nhinc.docmgr.repository.persistence.HibernateUtil; import org.hibernate.Session; import org.hibernate.SessionFactory;
import gov.hhs.fha.nhinc.docmgr.repository.model.*; import gov.hhs.fha.nhinc.docmgr.repository.persistence.*; import org.hibernate.*;
[ "gov.hhs.fha", "org.hibernate" ]
gov.hhs.fha; org.hibernate;
877,601
public Value read(Type type, NodeMap node) throws Exception { Node entry = node.remove(label); Class expect = type.getType(); if(expect.isArray()) { expect = expect.getComponentType(); } if(entry != null) { String name = entry.getValue(); expect = loader.load(name); } return readInstance(type, expect, node); }
Value function(Type type, NodeMap node) throws Exception { Node entry = node.remove(label); Class expect = type.getType(); if(expect.isArray()) { expect = expect.getComponentType(); } if(entry != null) { String name = entry.getValue(); expect = loader.load(name); } return readInstance(type, expect, node); }
/** * This is used to recover the object references from the document * using the special attributes specified. This allows the element * specified by the <code>NodeMap</code> to be used to discover * exactly which node in the object graph the element represents. * * @param type the type of the field or method in the instance * @param node this is the XML element to be deserialized * * @return this is used to return the type to acquire the value */
This is used to recover the object references from the document using the special attributes specified. This allows the element specified by the <code>NodeMap</code> to be used to discover exactly which node in the object graph the element represents
read
{ "repo_name": "unisx/simplexml", "path": "src/org/simpleframework/xml/strategy/ReadGraph.java", "license": "apache-2.0", "size": 8189 }
[ "org.simpleframework.xml.stream.Node", "org.simpleframework.xml.stream.NodeMap" ]
import org.simpleframework.xml.stream.Node; import org.simpleframework.xml.stream.NodeMap;
import org.simpleframework.xml.stream.*;
[ "org.simpleframework.xml" ]
org.simpleframework.xml;
1,046,184
public DcmElement putUI(int tag, String value) { return put(value != null ? StringElement.createUI(tag, value) : StringElement.createUI(tag)); }
DcmElement function(int tag, String value) { return put(value != null ? StringElement.createUI(tag, value) : StringElement.createUI(tag)); }
/** * Description of the Method * * @param tag * Description of the Parameter * @param value * Description of the Parameter * @return Description of the Return Value */
Description of the Method
putUI
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/branches/DCM4CHE_2_14_22_BRANCHA/src/java/org/dcm4cheri/data/DcmObjectImpl.java", "license": "apache-2.0", "size": 86392 }
[ "org.dcm4che.data.DcmElement" ]
import org.dcm4che.data.DcmElement;
import org.dcm4che.data.*;
[ "org.dcm4che.data" ]
org.dcm4che.data;
2,695,354
public void endAttributes() throws XslParseException { }
void function() throws XslParseException { }
/** * Ends the attributes. */
Ends the attributes
endAttributes
{ "repo_name": "christianchristensen/resin", "path": "modules/resin/src/com/caucho/xsl/java/XslNumber.java", "license": "gpl-2.0", "size": 5255 }
[ "com.caucho.xsl.XslParseException" ]
import com.caucho.xsl.XslParseException;
import com.caucho.xsl.*;
[ "com.caucho.xsl" ]
com.caucho.xsl;
2,254,080
public List<Problem> getProblems(){ return problems; }
List<Problem> function(){ return problems; }
/** * Returns the list of problems. * @return A reference to the list of problems. */
Returns the list of problems
getProblems
{ "repo_name": "kierendavies/lambda-tutor", "path": "src/main/java/za/ac/uct/cs/ddd/lambda/tutor/ProblemSet.java", "license": "gpl-3.0", "size": 5813 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
506,673
public Global initGlobal(final Global global, final ScriptEngine engine) { // Need only minimal global object, if we are just compiling. if (!env._compile_only) { final Global oldGlobal = Context.getGlobal(); try { Context.setGlobal(global); // initialize global scope with builtin global objects global.initBuiltinObjects(engine); } finally { Context.setGlobal(oldGlobal); } } return global; }
Global function(final Global global, final ScriptEngine engine) { if (!env._compile_only) { final Global oldGlobal = Context.getGlobal(); try { Context.setGlobal(global); global.initBuiltinObjects(engine); } finally { Context.setGlobal(oldGlobal); } } return global; }
/** * Initialize given global scope object. * * @param global the global * @param engine the associated ScriptEngine instance, can be null * @return the initialized global scope object. */
Initialize given global scope object
initGlobal
{ "repo_name": "md-5/jdk10", "path": "src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java", "license": "gpl-2.0", "size": 70447 }
[ "javax.script.ScriptEngine" ]
import javax.script.ScriptEngine;
import javax.script.*;
[ "javax.script" ]
javax.script;
1,246,725
public static JFileChooser getFileChooser() { if (chooser == null) { _localPreferences = SettingsManager.getLocalPreferences(); downloadedDir = new File(_localPreferences.getDownloadDir()); chooser = new JFileChooser(downloadedDir); if (Spark.isWindows()) { chooser.setFileSystemView(new WindowsFileSystemView()); } } return chooser; }
static JFileChooser function() { if (chooser == null) { _localPreferences = SettingsManager.getLocalPreferences(); downloadedDir = new File(_localPreferences.getDownloadDir()); chooser = new JFileChooser(downloadedDir); if (Spark.isWindows()) { chooser.setFileSystemView(new WindowsFileSystemView()); } } return chooser; }
/** * Returns a {@link JFileChooser} starting at the DownloadDirectory * * @return the filechooser */
Returns a <code>JFileChooser</code> starting at the DownloadDirectory
getFileChooser
{ "repo_name": "joshuairl/toothchat-client", "path": "src/java/org/jivesoftware/sparkimpl/plugin/filetransfer/transfer/Downloads.java", "license": "apache-2.0", "size": 3713 }
[ "java.io.File", "javax.swing.JFileChooser", "org.jivesoftware.Spark", "org.jivesoftware.spark.util.WindowsFileSystemView", "org.jivesoftware.sparkimpl.settings.local.SettingsManager" ]
import java.io.File; import javax.swing.JFileChooser; import org.jivesoftware.Spark; import org.jivesoftware.spark.util.WindowsFileSystemView; import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
import java.io.*; import javax.swing.*; import org.jivesoftware.*; import org.jivesoftware.spark.util.*; import org.jivesoftware.sparkimpl.settings.local.*;
[ "java.io", "javax.swing", "org.jivesoftware", "org.jivesoftware.spark", "org.jivesoftware.sparkimpl" ]
java.io; javax.swing; org.jivesoftware; org.jivesoftware.spark; org.jivesoftware.sparkimpl;
2,648,599
@SuppressWarnings("unchecked") private void loadParameters() throws ManagerBeanException { parameters = new TreeMap<String, ApplicationParameter>(); managerBean = BeanManager.getManagerBean(ApplicationParameter.class); List list = managerBean.getList(null); Iterator iter = list.iterator(); while (iter.hasNext()) { ApplicationParameter appParam = (ApplicationParameter) iter.next(); parameters.put(appParam.getName(), appParam); } }
@SuppressWarnings(STR) void function() throws ManagerBeanException { parameters = new TreeMap<String, ApplicationParameter>(); managerBean = BeanManager.getManagerBean(ApplicationParameter.class); List list = managerBean.getList(null); Iterator iter = list.iterator(); while (iter.hasNext()) { ApplicationParameter appParam = (ApplicationParameter) iter.next(); parameters.put(appParam.getName(), appParam); } }
/** * Load non-default parameters. * * @throws ManagerBeanException the manager bean exception */
Load non-default parameters
loadParameters
{ "repo_name": "Esleelkartea/aonGTA", "path": "aongta_v1.0.0_src/Fuentes y JavaDoc/aon-ui-config/src/com/code/aon/ui/config/controller/ApplicationParameterController.java", "license": "gpl-2.0", "size": 7330 }
[ "com.code.aon.common.BeanManager", "com.code.aon.common.ManagerBeanException", "com.code.aon.config.ApplicationParameter", "java.util.Iterator", "java.util.List", "java.util.TreeMap" ]
import com.code.aon.common.BeanManager; import com.code.aon.common.ManagerBeanException; import com.code.aon.config.ApplicationParameter; import java.util.Iterator; import java.util.List; import java.util.TreeMap;
import com.code.aon.common.*; import com.code.aon.config.*; import java.util.*;
[ "com.code.aon", "java.util" ]
com.code.aon; java.util;
1,017,068
@Override public GenSolvablePolynomial<C> multiply(Map.Entry<ExpVector, C> m) { if (m == null) { return ring.getZERO(); } return multiply(m.getValue(), m.getKey()); }
GenSolvablePolynomial<C> function(Map.Entry<ExpVector, C> m) { if (m == null) { return ring.getZERO(); } return multiply(m.getValue(), m.getKey()); }
/** * GenSolvablePolynomial multiplication. Product with 'monomial'. * @param m 'monomial'. * @return this * m, where * denotes solvable multiplication. */
GenSolvablePolynomial multiplication. Product with 'monomial'
multiply
{ "repo_name": "breandan/java-algebra-system", "path": "src/edu/jas/poly/GenSolvablePolynomial.java", "license": "gpl-2.0", "size": 26697 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,653,030
public boolean isLabel(String name) throws Exception { if (name.equals("now")) { return true; } try { ILabel label = connection.getLabel(name); return (label != null); } catch (RequestException e) { return false; } }
boolean function(String name) throws Exception { if (name.equals("now")) { return true; } try { ILabel label = connection.getLabel(name); return (label != null); } catch (RequestException e) { return false; } }
/** * Test if given name is a label * * @throws Exception */
Test if given name is a label
isLabel
{ "repo_name": "develoken/p4-plugin", "path": "src/main/java/org/jenkinsci/plugins/p4/client/ConnectionHelper.java", "license": "bsd-2-clause", "size": 12450 }
[ "com.perforce.p4java.core.ILabel", "com.perforce.p4java.exception.RequestException" ]
import com.perforce.p4java.core.ILabel; import com.perforce.p4java.exception.RequestException;
import com.perforce.p4java.core.*; import com.perforce.p4java.exception.*;
[ "com.perforce.p4java" ]
com.perforce.p4java;
941,025
@SuppressWarnings("unused") @CalledByNative private void showSelectPopup(String[] items, int[] enabled, boolean multiple, int[] selectedIndices) { SelectPopupDialog.show(this, items, enabled, multiple, selectedIndices); }
@SuppressWarnings(STR) void function(String[] items, int[] enabled, boolean multiple, int[] selectedIndices) { SelectPopupDialog.show(this, items, enabled, multiple, selectedIndices); }
/** * Called (from native) when the <select> popup needs to be shown. * @param items Items to show. * @param enabled POPUP_ITEM_TYPEs for items. * @param multiple Whether the popup menu should support multi-select. * @param selectedIndices Indices of selected items. */
Called (from native) when the popup needs to be shown
showSelectPopup
{ "repo_name": "imply/chuu", "path": "content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java", "license": "bsd-3-clause", "size": 126435 }
[ "org.chromium.content.browser.input.SelectPopupDialog" ]
import org.chromium.content.browser.input.SelectPopupDialog;
import org.chromium.content.browser.input.*;
[ "org.chromium.content" ]
org.chromium.content;
1,929,858
public static void departmentQueryLegacy( com.azure.resourcemanager.costmanagement.CostManagementManager costManagementManager) { costManagementManager .queries() .usageWithResponse( "providers/Microsoft.Billing/billingAccounts/100/departments/123", new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) .withDataset( new QueryDataset() .withGranularity(GranularityType.DAILY) .withFilter( new QueryFilter() .withAnd( Arrays .asList( new QueryFilter() .withOr( Arrays .asList( new QueryFilter() .withDimensions( new QueryComparisonExpression() .withName("ResourceLocation") .withOperator(OperatorType.IN) .withValues( Arrays .asList("East US", "West Europe"))), new QueryFilter() .withTags( new QueryComparisonExpression() .withName("Environment") .withOperator(OperatorType.IN) .withValues( Arrays.asList("UAT", "Prod"))))), new QueryFilter() .withDimensions( new QueryComparisonExpression() .withName("ResourceGroup") .withOperator(OperatorType.IN) .withValues(Arrays.asList("API"))))))), Context.NONE); }
static void function( com.azure.resourcemanager.costmanagement.CostManagementManager costManagementManager) { costManagementManager .queries() .usageWithResponse( STR, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) .withDataset( new QueryDataset() .withGranularity(GranularityType.DAILY) .withFilter( new QueryFilter() .withAnd( Arrays .asList( new QueryFilter() .withOr( Arrays .asList( new QueryFilter() .withDimensions( new QueryComparisonExpression() .withName(STR) .withOperator(OperatorType.IN) .withValues( Arrays .asList(STR, STR))), new QueryFilter() .withTags( new QueryComparisonExpression() .withName(STR) .withOperator(OperatorType.IN) .withValues( Arrays.asList("UAT", "Prod"))))), new QueryFilter() .withDimensions( new QueryComparisonExpression() .withName(STR) .withOperator(OperatorType.IN) .withValues(Arrays.asList("API"))))))), Context.NONE); }
/** * Sample code: DepartmentQuery-Legacy. * * @param costManagementManager Entry point to CostManagementManager. */
Sample code: DepartmentQuery-Legacy
departmentQueryLegacy
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageSamples.java", "license": "mit", "size": 48220 }
[ "com.azure.core.util.Context", "com.azure.resourcemanager.costmanagement.models.ExportType", "com.azure.resourcemanager.costmanagement.models.GranularityType", "com.azure.resourcemanager.costmanagement.models.OperatorType", "com.azure.resourcemanager.costmanagement.models.QueryComparisonExpression", "com.azure.resourcemanager.costmanagement.models.QueryDataset", "com.azure.resourcemanager.costmanagement.models.QueryDefinition", "com.azure.resourcemanager.costmanagement.models.QueryFilter", "com.azure.resourcemanager.costmanagement.models.TimeframeType", "java.util.Arrays" ]
import com.azure.core.util.Context; import com.azure.resourcemanager.costmanagement.models.ExportType; import com.azure.resourcemanager.costmanagement.models.GranularityType; import com.azure.resourcemanager.costmanagement.models.OperatorType; import com.azure.resourcemanager.costmanagement.models.QueryComparisonExpression; import com.azure.resourcemanager.costmanagement.models.QueryDataset; import com.azure.resourcemanager.costmanagement.models.QueryDefinition; import com.azure.resourcemanager.costmanagement.models.QueryFilter; import com.azure.resourcemanager.costmanagement.models.TimeframeType; import java.util.Arrays;
import com.azure.core.util.*; import com.azure.resourcemanager.costmanagement.models.*; import java.util.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.util" ]
com.azure.core; com.azure.resourcemanager; java.util;
1,069,699
public Link getRevisionLink() { return getLink(SitesLink.Rel.REVISION, Link.Type.ATOM); }
Link function() { return getLink(SitesLink.Rel.REVISION, Link.Type.ATOM); }
/** * Returns the revision sites link. * * @return Revision sites link or {@code null} for none. */
Returns the revision sites link
getRevisionLink
{ "repo_name": "ermh/Gdata-mavenized", "path": "java/src/com/google/gdata/data/sites/BaseContentEntry.java", "license": "apache-2.0", "size": 9699 }
[ "com.google.gdata.data.Link" ]
import com.google.gdata.data.Link;
import com.google.gdata.data.*;
[ "com.google.gdata" ]
com.google.gdata;
2,520,588
@Test public void testBadFailureRequestContextWithSemaphoreIsolatedSynchronousObservable() { RequestContextTestResults results = testRequestContextOnBadFailure(ExecutionIsolationStrategy.SEMAPHORE, Schedulers.immediate()); assertTrue(results.isContextInitialized.get()); assertTrue(results.originThread.get().equals(Thread.currentThread())); // all synchronous assertTrue(results.isContextInitializedObserveOn.get()); assertTrue(results.observeOnThread.get().equals(Thread.currentThread())); // all synchronous // semaphore isolated assertFalse(results.command.isExecutedInThread()); }
void function() { RequestContextTestResults results = testRequestContextOnBadFailure(ExecutionIsolationStrategy.SEMAPHORE, Schedulers.immediate()); assertTrue(results.isContextInitialized.get()); assertTrue(results.originThread.get().equals(Thread.currentThread())); assertTrue(results.isContextInitializedObserveOn.get()); assertTrue(results.observeOnThread.get().equals(Thread.currentThread())); assertFalse(results.command.isExecutedInThread()); }
/** * Synchronous Observable and semaphore isolation. Only [Main] thread is involved in this. */
Synchronous Observable and semaphore isolation. Only [Main] thread is involved in this
testBadFailureRequestContextWithSemaphoreIsolatedSynchronousObservable
{ "repo_name": "daveray/Hystrix", "path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java", "license": "apache-2.0", "size": 357869 }
[ "com.netflix.hystrix.HystrixCommandProperties", "org.junit.Assert" ]
import com.netflix.hystrix.HystrixCommandProperties; import org.junit.Assert;
import com.netflix.hystrix.*; import org.junit.*;
[ "com.netflix.hystrix", "org.junit" ]
com.netflix.hystrix; org.junit;
2,004,396
public static ItemGroup<?> getBaseGroup(BlueOrganization org) { ItemGroup<?> group = null; if (org != null && org instanceof AbstractOrganization) { group = ((AbstractOrganization) org).getGroup(); } return group; }
static ItemGroup<?> function(BlueOrganization org) { ItemGroup<?> group = null; if (org != null && org instanceof AbstractOrganization) { group = ((AbstractOrganization) org).getGroup(); } return group; }
/** * Tries to obtain the base group for a <code>BlueOrganization</code> * * @param org to get the base group of * @return the base group */
Tries to obtain the base group for a <code>BlueOrganization</code>
getBaseGroup
{ "repo_name": "kzantow/blueocean-plugin", "path": "blueocean-rest-impl/src/main/java/io/jenkins/blueocean/service/embedded/rest/AbstractPipelineImpl.java", "license": "mit", "size": 10322 }
[ "hudson.model.ItemGroup", "io.jenkins.blueocean.rest.factory.organization.AbstractOrganization", "io.jenkins.blueocean.rest.model.BlueOrganization" ]
import hudson.model.ItemGroup; import io.jenkins.blueocean.rest.factory.organization.AbstractOrganization; import io.jenkins.blueocean.rest.model.BlueOrganization;
import hudson.model.*; import io.jenkins.blueocean.rest.factory.organization.*; import io.jenkins.blueocean.rest.model.*;
[ "hudson.model", "io.jenkins.blueocean" ]
hudson.model; io.jenkins.blueocean;
463,339
protected void encodeConstraint(final CardinalityConstraint cc, final EncodingResult result) { final Variable[] ops = literalsAsVariables(cc.operands()); switch (cc.comparator()) { case LE: if (cc.rhs() == 1) { this.amo(result, ops); } else { this.amk(result, ops, cc.rhs()); } break; case LT: if (cc.rhs() == 2) { this.amo(result, ops); } else { this.amk(result, ops, cc.rhs() - 1); } break; case GE: this.alk(result, ops, cc.rhs()); break; case GT: this.alk(result, ops, cc.rhs() + 1); break; case EQ: if (cc.rhs() == 1) { this.exo(result, ops); } else { this.exk(result, ops, cc.rhs()); } break; default: throw new IllegalArgumentException("Unknown pseudo-Boolean comparator: " + cc.comparator()); } }
void function(final CardinalityConstraint cc, final EncodingResult result) { final Variable[] ops = literalsAsVariables(cc.operands()); switch (cc.comparator()) { case LE: if (cc.rhs() == 1) { this.amo(result, ops); } else { this.amk(result, ops, cc.rhs()); } break; case LT: if (cc.rhs() == 2) { this.amo(result, ops); } else { this.amk(result, ops, cc.rhs() - 1); } break; case GE: this.alk(result, ops, cc.rhs()); break; case GT: this.alk(result, ops, cc.rhs() + 1); break; case EQ: if (cc.rhs() == 1) { this.exo(result, ops); } else { this.exk(result, ops, cc.rhs()); } break; default: throw new IllegalArgumentException(STR + cc.comparator()); } }
/** * Encodes the constraint in the given result. * @param cc the constraint * @param result the result */
Encodes the constraint in the given result
encodeConstraint
{ "repo_name": "logic-ng/LogicNG", "path": "src/main/java/org/logicng/cardinalityconstraints/CCEncoder.java", "license": "apache-2.0", "size": 25318 }
[ "org.logicng.datastructures.EncodingResult", "org.logicng.formulas.CardinalityConstraint", "org.logicng.formulas.Variable", "org.logicng.util.FormulaHelper" ]
import org.logicng.datastructures.EncodingResult; import org.logicng.formulas.CardinalityConstraint; import org.logicng.formulas.Variable; import org.logicng.util.FormulaHelper;
import org.logicng.datastructures.*; import org.logicng.formulas.*; import org.logicng.util.*;
[ "org.logicng.datastructures", "org.logicng.formulas", "org.logicng.util" ]
org.logicng.datastructures; org.logicng.formulas; org.logicng.util;
1,969,128
public List<Throwable> getFatalErrors();
List<Throwable> function();
/** * Returns a list of unrecoverable errors that occurred during stage * processing. * * @return A list of unrecoverable errors that occurred during stage processing. */
Returns a list of unrecoverable errors that occurred during stage processing
getFatalErrors
{ "repo_name": "nuttycom/commons-pipeline", "path": "src/main/java/org/apache/commons/pipeline/StageDriver.java", "license": "apache-2.0", "size": 4323 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,252,719
protected void addConditionalRouteBranchesPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_ConditionalRouterMediator_conditionalRouteBranches_feature"), getString("_UI_PropertyDescriptor_description", "_UI_ConditionalRouterMediator_conditionalRouteBranches_feature", "_UI_ConditionalRouterMediator_type"), EsbPackage.Literals.CONDITIONAL_ROUTER_MEDIATOR__CONDITIONAL_ROUTE_BRANCHES, true, false, false, null, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), EsbPackage.Literals.CONDITIONAL_ROUTER_MEDIATOR__CONDITIONAL_ROUTE_BRANCHES, true, false, false, null, null, null)); }
/** * This adds a property descriptor for the Conditional Route Branches feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Conditional Route Branches feature.
addConditionalRouteBranchesPropertyDescriptor
{ "repo_name": "thiliniish/developer-studio", "path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/ConditionalRouterMediatorItemProvider.java", "license": "apache-2.0", "size": 8533 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage;
import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*;
[ "org.eclipse.emf", "org.wso2.developerstudio" ]
org.eclipse.emf; org.wso2.developerstudio;
1,071,669
@Test //"see https://github.com/JavaMoney/jsr354-ri/issues/274" public void testParseCurrencySymbolINR2() { MonetaryAmountFormat format = MonetaryFormats.getAmountFormat( AmountFormatQueryBuilder.of(INDIA) .set(CurrencyStyle.SYMBOL) .build()); Money money = Money.of(new BigDecimal("1234567.89"), "EUR"); String expectedFormattedString = "€ 1,234,567.89"; assertEquals(expectedFormattedString, format.format(money)); assertEquals(money, Money.parse(expectedFormattedString, format)); money = Money.of(new BigDecimal("1234567.89"), "INR"); expectedFormattedString = "₹ 1,234,567.89"; assertEquals(expectedFormattedString, format.format(money)); assertEquals(money, Money.parse(expectedFormattedString, format)); }
void function() { MonetaryAmountFormat format = MonetaryFormats.getAmountFormat( AmountFormatQueryBuilder.of(INDIA) .set(CurrencyStyle.SYMBOL) .build()); Money money = Money.of(new BigDecimal(STR), "EUR"); String expectedFormattedString = STR; assertEquals(expectedFormattedString, format.format(money)); assertEquals(money, Money.parse(expectedFormattedString, format)); money = Money.of(new BigDecimal(STR), "INR"); expectedFormattedString = STR; assertEquals(expectedFormattedString, format.format(money)); assertEquals(money, Money.parse(expectedFormattedString, format)); }
/** * Test related to parsing currency symbols. */
Test related to parsing currency symbols
testParseCurrencySymbolINR2
{ "repo_name": "JavaMoney/jsr354-ri", "path": "moneta-core/src/test/java/org/javamoney/moneta/format/MonetaryFormatsParseBySymbolTest.java", "license": "apache-2.0", "size": 2990 }
[ "java.math.BigDecimal", "javax.money.format.AmountFormatQueryBuilder", "javax.money.format.MonetaryAmountFormat", "javax.money.format.MonetaryFormats", "org.javamoney.moneta.Money", "org.testng.Assert" ]
import java.math.BigDecimal; import javax.money.format.AmountFormatQueryBuilder; import javax.money.format.MonetaryAmountFormat; import javax.money.format.MonetaryFormats; import org.javamoney.moneta.Money; import org.testng.Assert;
import java.math.*; import javax.money.format.*; import org.javamoney.moneta.*; import org.testng.*;
[ "java.math", "javax.money", "org.javamoney.moneta", "org.testng" ]
java.math; javax.money; org.javamoney.moneta; org.testng;
576,666
private int execute(Connection conn, boolean closeConn, String sql, Object... params) throws SQLException { if (conn == null) { throw new SQLException("Null connection"); } if (sql == null) { if (closeConn) { close(conn); } throw new SQLException("Null SQL statement"); } CallableStatement stmt = null; int rows = 0; try { stmt = this.prepareCall(conn, sql); this.fillStatement(stmt, params); stmt.execute(); rows = stmt.getUpdateCount(); this.retrieveOutParameters(stmt, params); } catch (SQLException e) { this.rethrow(e, sql, params); } finally { close(stmt); if (closeConn) { close(conn); } } return rows; }
int function(Connection conn, boolean closeConn, String sql, Object... params) throws SQLException { if (conn == null) { throw new SQLException(STR); } if (sql == null) { if (closeConn) { close(conn); } throw new SQLException(STR); } CallableStatement stmt = null; int rows = 0; try { stmt = this.prepareCall(conn, sql); this.fillStatement(stmt, params); stmt.execute(); rows = stmt.getUpdateCount(); this.retrieveOutParameters(stmt, params); } catch (SQLException e) { this.rethrow(e, sql, params); } finally { close(stmt); if (closeConn) { close(conn); } } return rows; }
/** * Invokes the stored procedure via update after checking the parameters to * ensure nothing is null. * @param conn The connection to use for the update call. * @param closeConn True if the connection should be closed, false otherwise. * @param sql The SQL statement to execute. * @param params An array of update replacement parameters. Each row in * this array is one set of update replacement values. * @return The number of rows updated. * @throws SQLException If there are database or parameter errors. */
Invokes the stored procedure via update after checking the parameters to ensure nothing is null
execute
{ "repo_name": "kettas/commons-dbutils", "path": "src/main/java/org/apache/commons/dbutils/QueryRunner.java", "license": "apache-2.0", "size": 39286 }
[ "java.sql.CallableStatement", "java.sql.Connection", "java.sql.SQLException" ]
import java.sql.CallableStatement; import java.sql.Connection; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,091,193
private static boolean nodeNameMatch(Node node, String desiredName) {Thread.dumpStack(); return (desiredName.equals(node.getNodeName()) || desiredName.equals(node.getLocalName())); }
static boolean function(Node node, String desiredName) {Thread.dumpStack(); return (desiredName.equals(node.getNodeName()) desiredName.equals(node.getLocalName())); }
/** * Matches the given node's name and local name against the given desired name. */
Matches the given node's name and local name against the given desired name
nodeNameMatch
{ "repo_name": "emacslisp/Java", "path": "SpringFrameworkReading/src/org/springframework/util/xml/DomUtils.java", "license": "mit", "size": 7332 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,157,110
public static boolean isValidFor(@SuppressWarnings("unusued") Unit unit) { return false; } // Serialization private static final String REPEAT_COUNT_TAG = "repeatCount"; private static final String TURN_COUNT_TAG = "turnCount"; private static final String UNIT_TAG = "unit"; /** * {@inheritDoc}
static boolean function(@SuppressWarnings(STR) Unit unit) { return false; } private static final String REPEAT_COUNT_TAG = STR; private static final String TURN_COUNT_TAG = STR; private static final String UNIT_TAG = "unit"; /** * {@inheritDoc}
/** * Returns true if this is a valid Mission for the given * Unit. This method always returns false and needs to be * overridden. * * @param unit an <code>Unit</code> value * @return false */
Returns true if this is a valid Mission for the given Unit. This method always returns false and needs to be overridden
isValidFor
{ "repo_name": "edijman/SOEN_6431_Colonization_Game", "path": "src/net/sf/freecol/common/model/mission/AbstractMission.java", "license": "gpl-2.0", "size": 5792 }
[ "net.sf.freecol.common.model.Unit" ]
import net.sf.freecol.common.model.Unit;
import net.sf.freecol.common.model.*;
[ "net.sf.freecol" ]
net.sf.freecol;
1,204,491
public GeoBoundingBoxQueryBuilder setCornersOGC(GeoPoint bottomLeft, GeoPoint topRight) { return setCorners(topRight.getLat(), bottomLeft.getLon(), bottomLeft.getLat(), topRight.getLon()); }
GeoBoundingBoxQueryBuilder function(GeoPoint bottomLeft, GeoPoint topRight) { return setCorners(topRight.getLat(), bottomLeft.getLon(), bottomLeft.getLat(), topRight.getLon()); }
/** * Adds corners in OGC standard bbox/ envelop format. * * @param bottomLeft bottom left corner of bounding box. * @param topRight top right corner of bounding box. */
Adds corners in OGC standard bbox/ envelop format
setCornersOGC
{ "repo_name": "sreeramjayan/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/query/GeoBoundingBoxQueryBuilder.java", "license": "apache-2.0", "size": 24990 }
[ "org.elasticsearch.common.geo.GeoPoint" ]
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.common.geo.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
836,799
public boolean register(Invocation invocation) { final long callId; try { boolean force = invocation.op.isUrgent() || invocation.isRetryCandidate(); callId = callIdSequence.next(force); } catch (TimeoutException e) { throw new HazelcastOverloadException("Failed to start invocation due to overload: " + invocation, e); } try { // Fails with IllegalStateException if the operation is already active setCallId(invocation.op, callId); } catch (IllegalStateException e) { callIdSequence.complete(); throw e; } invocations.put(callId, invocation); if (!alive) { invocation.notifyError(new HazelcastInstanceNotActiveException()); return false; } return true; }
boolean function(Invocation invocation) { final long callId; try { boolean force = invocation.op.isUrgent() invocation.isRetryCandidate(); callId = callIdSequence.next(force); } catch (TimeoutException e) { throw new HazelcastOverloadException(STR + invocation, e); } try { setCallId(invocation.op, callId); } catch (IllegalStateException e) { callIdSequence.complete(); throw e; } invocations.put(callId, invocation); if (!alive) { invocation.notifyError(new HazelcastInstanceNotActiveException()); return false; } return true; }
/** * Registers an invocation. * * @param invocation The invocation to register. * @return false when InvocationRegistry is not alive and registration is not successful, true otherwise */
Registers an invocation
register
{ "repo_name": "lmjacksoniii/hazelcast", "path": "hazelcast/src/main/java/com/hazelcast/spi/impl/operationservice/impl/InvocationRegistry.java", "license": "apache-2.0", "size": 7381 }
[ "com.hazelcast.core.HazelcastInstanceNotActiveException", "com.hazelcast.core.HazelcastOverloadException", "com.hazelcast.spi.OperationAccessor", "java.util.concurrent.TimeoutException" ]
import com.hazelcast.core.HazelcastInstanceNotActiveException; import com.hazelcast.core.HazelcastOverloadException; import com.hazelcast.spi.OperationAccessor; import java.util.concurrent.TimeoutException;
import com.hazelcast.core.*; import com.hazelcast.spi.*; import java.util.concurrent.*;
[ "com.hazelcast.core", "com.hazelcast.spi", "java.util" ]
com.hazelcast.core; com.hazelcast.spi; java.util;
1,293,080
public ImageUrlMap getImageUrls(List<ImageUrl> requestUrls) throws SmartsheetException { Util.throwIfNull(requestUrls); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve("imageurls"), HttpMethod.POST); ByteArrayOutputStream baos = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(requestUrls, baos); HttpEntity entity = new HttpEntity(); entity.setContentType("application/json"); entity.setContent(new ByteArrayInputStream(baos.toByteArray())); entity.setContentLength(baos.size()); request.setEntity(entity); HttpResponse response = this.smartsheet.getHttpClient().request(request); ImageUrlMap obj = null; switch (response.getStatusCode()) { case 200: try { obj = this.smartsheet.getJsonSerializer().deserialize(ImageUrlMap.class, response.getEntity().getContent()); } catch (JsonParseException e) { throw new SmartsheetException(e); } catch (JsonMappingException e) { throw new SmartsheetException(e); } catch (IOException e) { throw new SmartsheetException(e); } break; default: handleError(response); } smartsheet.getHttpClient().releaseConnection(); return obj; }
ImageUrlMap function(List<ImageUrl> requestUrls) throws SmartsheetException { Util.throwIfNull(requestUrls); HttpRequest request; request = createHttpRequest(smartsheet.getBaseURI().resolve(STR), HttpMethod.POST); ByteArrayOutputStream baos = new ByteArrayOutputStream(); this.smartsheet.getJsonSerializer().serialize(requestUrls, baos); HttpEntity entity = new HttpEntity(); entity.setContentType(STR); entity.setContent(new ByteArrayInputStream(baos.toByteArray())); entity.setContentLength(baos.size()); request.setEntity(entity); HttpResponse response = this.smartsheet.getHttpClient().request(request); ImageUrlMap obj = null; switch (response.getStatusCode()) { case 200: try { obj = this.smartsheet.getJsonSerializer().deserialize(ImageUrlMap.class, response.getEntity().getContent()); } catch (JsonParseException e) { throw new SmartsheetException(e); } catch (JsonMappingException e) { throw new SmartsheetException(e); } catch (IOException e) { throw new SmartsheetException(e); } break; default: handleError(response); } smartsheet.getHttpClient().releaseConnection(); return obj; }
/** * Gets URLS that can be used to retieve the specified cell images. * * It mirrors to the following Smartsheet REST API method: POST /imageurls * * @param requestUrls array of requested Images ans sizes. * @return the ImageUrlMap object (note that if there is no such resource, this method will throw * ResourceNotFoundException rather than returning null). * @throws JSONSerializerException * @throws IllegalArgumentException if any argument is null or empty string * @throws InvalidRequestException if there is any problem with the REST API request * @throws AuthorizationException if there is any problem with the REST API authorization (access token) * @throws ResourceNotFoundException if the resource cannot be found * @throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting) * @throws SmartsheetException if there is any other error during the operation */
Gets URLS that can be used to retieve the specified cell images. It mirrors to the following Smartsheet REST API method: POST /imageurls
getImageUrls
{ "repo_name": "smartsheet-platform/smartsheet-java-sdk", "path": "src/main/java/com/smartsheet/api/internal/ImageUrlResourcesImpl.java", "license": "apache-2.0", "size": 4697 }
[ "com.fasterxml.jackson.core.JsonParseException", "com.fasterxml.jackson.databind.JsonMappingException", "com.smartsheet.api.SmartsheetException", "com.smartsheet.api.internal.http.HttpEntity", "com.smartsheet.api.internal.http.HttpMethod", "com.smartsheet.api.internal.http.HttpRequest", "com.smartsheet.api.internal.http.HttpResponse", "com.smartsheet.api.internal.util.Util", "com.smartsheet.api.models.ImageUrl", "com.smartsheet.api.models.ImageUrlMap", "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.io.IOException", "java.util.List" ]
import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.smartsheet.api.SmartsheetException; import com.smartsheet.api.internal.http.HttpEntity; import com.smartsheet.api.internal.http.HttpMethod; import com.smartsheet.api.internal.http.HttpRequest; import com.smartsheet.api.internal.http.HttpResponse; import com.smartsheet.api.internal.util.Util; import com.smartsheet.api.models.ImageUrl; import com.smartsheet.api.models.ImageUrlMap; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.List;
import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.smartsheet.api.*; import com.smartsheet.api.internal.http.*; import com.smartsheet.api.internal.util.*; import com.smartsheet.api.models.*; import java.io.*; import java.util.*;
[ "com.fasterxml.jackson", "com.smartsheet.api", "java.io", "java.util" ]
com.fasterxml.jackson; com.smartsheet.api; java.io; java.util;
588,436
public static synchronized void suppressConstructor(Class<?> clazz, boolean excludePrivateConstructors) { Constructor<?>[] ctors = null; if (excludePrivateConstructors) { ctors = clazz.getConstructors(); } else { ctors = clazz.getDeclaredConstructors(); } for (Constructor<?> ctor : ctors) { MockRepository.addConstructorToSuppress(ctor); } }
static synchronized void function(Class<?> clazz, boolean excludePrivateConstructors) { Constructor<?>[] ctors = null; if (excludePrivateConstructors) { ctors = clazz.getConstructors(); } else { ctors = clazz.getDeclaredConstructors(); } for (Constructor<?> ctor : ctors) { MockRepository.addConstructorToSuppress(ctor); } }
/** * Suppress all constructors in the given class. * * @param clazz * The classes whose constructors will be suppressed. * @param excludePrivateConstructors * optionally keep code in private constructors */
Suppress all constructors in the given class
suppressConstructor
{ "repo_name": "gstamac/powermock", "path": "powermock-api/powermock-api-support/src/main/java/org/powermock/api/support/SuppressCode.java", "license": "apache-2.0", "size": 7718 }
[ "java.lang.reflect.Constructor", "org.powermock.core.MockRepository" ]
import java.lang.reflect.Constructor; import org.powermock.core.MockRepository;
import java.lang.reflect.*; import org.powermock.core.*;
[ "java.lang", "org.powermock.core" ]
java.lang; org.powermock.core;
2,058,711
public RecyclerView.Adapter getAdapter() { return mRecyclerView.getAdapter(); }
RecyclerView.Adapter function() { return mRecyclerView.getAdapter(); }
/** * Get the adapter of UltimateRecyclerview * * @return */
Get the adapter of UltimateRecyclerview
getAdapter
{ "repo_name": "mulletinc/UltimateRecyclerView", "path": "UltimateRecyclerView/ultimaterecyclerview/src/main/java/com/marshalchen/ultimaterecyclerview/UltimateRecyclerView.java", "license": "apache-2.0", "size": 41795 }
[ "android.support.v7.widget.RecyclerView" ]
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.*;
[ "android.support" ]
android.support;
645,264
// certain implementations of JPA will create unmodifiable List objects, so clone the // object into an ArrayList before passing into super.filter if (filterTarget instanceof Collection) { return super.filter(new ArrayList((Collection)filterTarget), filterExpression, ctx); } else { return super.filter(filterTarget, filterExpression, ctx); } }
if (filterTarget instanceof Collection) { return super.filter(new ArrayList((Collection)filterTarget), filterExpression, ctx); } else { return super.filter(filterTarget, filterExpression, ctx); } }
/** * Custom filter method that copies the filterTarget to a modifiable ArrayList * so the containing elements can be filtered out via the parent filter method. * * @param filterTarget the Collection or array of objects to be filtered * @param filterExpression the filter expression * @param ctx the EvaluationContext * @return the filtered Collection or array */
Custom filter method that copies the filterTarget to a modifiable ArrayList so the containing elements can be filtered out via the parent filter method
filter
{ "repo_name": "machak/rave", "path": "rave-components/rave-core/src/main/java/org/apache/rave/portal/security/impl/RaveMethodSecurityExpressionHandler.java", "license": "apache-2.0", "size": 2396 }
[ "java.util.ArrayList", "java.util.Collection" ]
import java.util.ArrayList; import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
146,845
public List<QueryAggregation> getAggregations() { return aggregations; }
List<QueryAggregation> function() { return aggregations; }
/** * Gets the aggregations. * * <p>Array of aggregations for the query. * * @return the aggregations */
Gets the aggregations. Array of aggregations for the query
getAggregations
{ "repo_name": "watson-developer-cloud/java-sdk", "path": "discovery/src/main/java/com/ibm/watson/discovery/v2/model/QueryResponse.java", "license": "apache-2.0", "size": 3284 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,788,321
return CommonBundle.message(getBundle(), key, params); }
return CommonBundle.message(getBundle(), key, params); }
/** * get resource bundle value from resource.IbatisBundle * * @param key key name * @param params parameters * @return value */
get resource bundle value from resource.IbatisBundle
message
{ "repo_name": "code4craft/ibatis-plugin", "path": "src/org/intellij/ibatis/util/IbatisBundle.java", "license": "apache-2.0", "size": 1316 }
[ "com.intellij.CommonBundle" ]
import com.intellij.CommonBundle;
import com.intellij.*;
[ "com.intellij" ]
com.intellij;
193,391
public boolean handleDiscovered(String switchId, String portId) { boolean stateChanged = false; Node node = new Node(switchId, portId); List<DiscoveryNode> subjectList = filterQueue(node); if (subjectList.size() == 0) { logger.warn("Ignore \"AVAIL\" request for {}: node not found", node); } else { DiscoveryNode subject = subjectList.get(0); if (!subject.isFoundIsl()){ // "forever" mark this port as part of an ISL // "forever" changes if we get another Switch UP message - this is documented // elsewhere .. in short, be conservative - maybe ports changed, or TE state // has been deleted. // TODO: is marking foundIsl false the right way to do this? All we want is "resend to TE if it is an ISL" subject.setFoundIsl(true); stateChanged = true; logger.info("FOUND ISL: {}", subject); } else if (subject.getConsecutiveFailure()>0){ // We've found failures, but now we've had success, so that is a state change. // To repeat, current model for state change is just 1 failure. If we change this // policy, then change the test above. stateChanged = true; logger.info("ISL IS UP: {}", subject); } subject.renew(); subject.incConsecutiveSuccess(); subject.clearConsecutiveFailure(); // If one of the logs above wasn't reachd, don't log anything .. ISL was up and is still up } if (stateChanged) { // Add logic to ensure we send a discovery packet for the opposite direction. // TODO: in order to do this here, we need more information (ie the other end of the ISL) // Since that isn't passed in and isn't available in our state, have to rely on the // calling function. } return stateChanged; }
boolean function(String switchId, String portId) { boolean stateChanged = false; Node node = new Node(switchId, portId); List<DiscoveryNode> subjectList = filterQueue(node); if (subjectList.size() == 0) { logger.warn(STRAVAIL\STR, node); } else { DiscoveryNode subject = subjectList.get(0); if (!subject.isFoundIsl()){ subject.setFoundIsl(true); stateChanged = true; logger.info(STR, subject); } else if (subject.getConsecutiveFailure()>0){ stateChanged = true; logger.info(STR, subject); } subject.renew(); subject.incConsecutiveSuccess(); subject.clearConsecutiveFailure(); } if (stateChanged) { } return stateChanged; }
/** * ISL Discovery Event * @return true if this is a new event (ie first time discovered or prior failure) */
ISL Discovery Event
handleDiscovered
{ "repo_name": "nikitamarchenko/open-kilda", "path": "services/wfm/src/main/java/org/openkilda/wfm/isl/DiscoveryManager.java", "license": "apache-2.0", "size": 15024 }
[ "java.util.List", "org.openkilda.messaging.model.DiscoveryNode" ]
import java.util.List; import org.openkilda.messaging.model.DiscoveryNode;
import java.util.*; import org.openkilda.messaging.model.*;
[ "java.util", "org.openkilda.messaging" ]
java.util; org.openkilda.messaging;
600,299
MouseEvent mouseEntered(MouseEvent mouseEvent);
MouseEvent mouseEntered(MouseEvent mouseEvent);
/** * Mouse entered event. If this event will be consumed it will not be propagated further to client. * * @param mouseEvent the mouse event * @return the mouse event */
Mouse entered event. If this event will be consumed it will not be propagated further to client
mouseEntered
{ "repo_name": "Sethtroll/runelite", "path": "runelite-api/src/main/java/net/runelite/api/hooks/Callbacks.java", "license": "bsd-2-clause", "size": 5007 }
[ "java.awt.event.MouseEvent" ]
import java.awt.event.MouseEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
1,884,413
Collection<ClusterNode> aliveCacheNodes(@Nullable String cacheName, final long topVer) { return filter(topVer, aliveCacheNodes.get(maskNull(cacheName))); }
Collection<ClusterNode> aliveCacheNodes(@Nullable String cacheName, final long topVer) { return filter(topVer, aliveCacheNodes.get(maskNull(cacheName))); }
/** * Gets all alive nodes that have cache with given name. * * @param cacheName Cache name. * @param topVer Topology version. * @return Collection of nodes. */
Gets all alive nodes that have cache with given name
aliveCacheNodes
{ "repo_name": "murador/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java", "license": "apache-2.0", "size": 105398 }
[ "java.util.Collection", "org.apache.ignite.cluster.ClusterNode", "org.jetbrains.annotations.Nullable" ]
import java.util.Collection; import org.apache.ignite.cluster.ClusterNode; import org.jetbrains.annotations.Nullable;
import java.util.*; import org.apache.ignite.cluster.*; import org.jetbrains.annotations.*;
[ "java.util", "org.apache.ignite", "org.jetbrains.annotations" ]
java.util; org.apache.ignite; org.jetbrains.annotations;
507,792
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<DiagnosticCategoryInner> listSiteDiagnosticCategoriesSlot( String resourceGroupName, String siteName, String slot) { return new PagedIterable<>(listSiteDiagnosticCategoriesSlotAsync(resourceGroupName, siteName, slot)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<DiagnosticCategoryInner> function( String resourceGroupName, String siteName, String slot) { return new PagedIterable<>(listSiteDiagnosticCategoriesSlotAsync(resourceGroupName, siteName, slot)); }
/** * Description for Get Diagnostics Categories. * * @param resourceGroupName Name of the resource group to which the resource belongs. * @param siteName Site Name. * @param slot Slot Name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws DefaultErrorResponseErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return collection of Diagnostic Categories as paginated response with {@link PagedIterable}. */
Description for Get Diagnostics Categories
listSiteDiagnosticCategoriesSlot
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-appservice/src/main/java/com/azure/resourcemanager/appservice/implementation/DiagnosticsClientImpl.java", "license": "mit", "size": 288640 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.appservice.fluent.models.DiagnosticCategoryInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.appservice.fluent.models.DiagnosticCategoryInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.appservice.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
392,990
@RequestMapping(value = "detail/{id}", method = RequestMethod.GET) public String detailById(@PathVariable("id") Long id, Model model, HttpServletRequest request) { model.addAttribute("report", reportService.getReportById(id)); model.addAttribute("uri", request.getRequestURL()); return "detail"; }
@RequestMapping(value = STR, method = RequestMethod.GET) String function(@PathVariable("id") Long id, Model model, HttpServletRequest request) { model.addAttribute(STR, reportService.getReportById(id)); model.addAttribute("uri", request.getRequestURL()); return STR; }
/** * REST-like request for details of report with specified ID as a request * path part. * * @param id report's ID being searched for * @param model model object * @param request HTTP request object * @return view name */
REST-like request for details of report with specified ID as a request path part
detailById
{ "repo_name": "the-ramones/red-mangolin", "path": "src/main/java/sp/controller/ReportController.java", "license": "unlicense", "size": 12192 }
[ "javax.servlet.http.HttpServletRequest", "org.springframework.ui.Model", "org.springframework.web.bind.annotation.PathVariable", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod" ]
import javax.servlet.http.HttpServletRequest; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*;
[ "javax.servlet", "org.springframework.ui", "org.springframework.web" ]
javax.servlet; org.springframework.ui; org.springframework.web;
1,402,544
public void restoreSubcomponentFocus() { Component c = getMostRecentFocusOwner(); if (c != null) c.requestFocus(); }
void function() { Component c = getMostRecentFocusOwner(); if (c != null) c.requestFocus(); }
/** * This method gives focus to the last child Component that had focus. This * is used by the UI when this JInternalFrame is activated. */
This method gives focus to the last child Component that had focus. This is used by the UI when this JInternalFrame is activated
restoreSubcomponentFocus
{ "repo_name": "aosm/gcc_40", "path": "libjava/javax/swing/JInternalFrame.java", "license": "gpl-2.0", "size": 45208 }
[ "java.awt.Component" ]
import java.awt.Component;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,048,399
private GenericRecordSetManager getGenericRecordSetManager() { return GenericRecordSetManager.getInstance(); }
GenericRecordSetManager function() { return GenericRecordSetManager.getInstance(); }
/** * Gets an instance of a GenericRecordSet objects manager. * @return a GenericRecordSetManager instance. */
Gets an instance of a GenericRecordSet objects manager
getGenericRecordSetManager
{ "repo_name": "auroreallibe/Silverpeas-Core", "path": "core-services/workflow/src/main/java/org/silverpeas/core/workflow/engine/model/ProcessModelManagerImpl.java", "license": "agpl-3.0", "size": 19327 }
[ "org.silverpeas.core.contribution.content.form.record.GenericRecordSetManager" ]
import org.silverpeas.core.contribution.content.form.record.GenericRecordSetManager;
import org.silverpeas.core.contribution.content.form.record.*;
[ "org.silverpeas.core" ]
org.silverpeas.core;
2,762,210
public interface GroupAuditEvent { Account.Id getActor();
interface GroupAuditEvent { Account.Id function();
/** * Gets the acting user who is updating the group. * * @return the {@link com.google.gerrit.entities.Account.Id} of the acting user. */
Gets the acting user who is updating the group
getActor
{ "repo_name": "GerritCodeReview/gerrit", "path": "java/com/google/gerrit/server/audit/group/GroupAuditEvent.java", "license": "apache-2.0", "size": 1398 }
[ "com.google.gerrit.entities.Account" ]
import com.google.gerrit.entities.Account;
import com.google.gerrit.entities.*;
[ "com.google.gerrit" ]
com.google.gerrit;
2,050,899
@SuppressWarnings("unchecked") public static <T> T[] changeArrayType(Object[] array, Class<T> newClass) { ArrayList<T> newArray = new ArrayList<T>(); for (int i = 0; i < array.length; i++) { // Only add those objects that can be cast to the new class if (newClass.isInstance(array[i])) { newArray.add(newClass.cast(array[i])); } } return newArray.toArray((T[]) Array.newInstance(newClass, 0)); }
@SuppressWarnings(STR) static <T> T[] function(Object[] array, Class<T> newClass) { ArrayList<T> newArray = new ArrayList<T>(); for (int i = 0; i < array.length; i++) { if (newClass.isInstance(array[i])) { newArray.add(newClass.cast(array[i])); } } return newArray.toArray((T[]) Array.newInstance(newClass, 0)); }
/** * Change the type of array of Objects to an array of objects of type newClass. * */
Change the type of array of Objects to an array of objects of type newClass
changeArrayType
{ "repo_name": "mzmine/mzmine3", "path": "src/main/java/io/github/mzmine/util/CollectionUtils.java", "license": "gpl-2.0", "size": 3092 }
[ "java.lang.reflect.Array", "java.util.ArrayList" ]
import java.lang.reflect.Array; import java.util.ArrayList;
import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
1,955,861
@SuppressWarnings("unchecked") private void _restoreModelData() { // DO NOT CHANGE THE ORDER HERE. IT MUST MATCH // "pushes" DONE ABOVE in _saveModelData. _resBundleKey = (String) _saveDataStack.pop(); _resBundleName = (String) _saveDataStack.pop(); _handlerId = (String) _saveDataStack.pop(); _localModelUri = (String) _saveDataStack.pop(); _currentTreeModelMapKey = (String) _saveDataStack.pop(); _menuList = (ArrayList<MenuNode>) _saveDataStack.pop(); _menuNodes = (ArrayList<List<MenuNode>>) _saveDataStack.pop(); _nodeDepth = ((Integer)_saveDataStack.pop()).intValue(); }
@SuppressWarnings(STR) void function() { _resBundleKey = (String) _saveDataStack.pop(); _resBundleName = (String) _saveDataStack.pop(); _handlerId = (String) _saveDataStack.pop(); _localModelUri = (String) _saveDataStack.pop(); _currentTreeModelMapKey = (String) _saveDataStack.pop(); _menuList = (ArrayList<MenuNode>) _saveDataStack.pop(); _menuNodes = (ArrayList<List<MenuNode>>) _saveDataStack.pop(); _nodeDepth = ((Integer)_saveDataStack.pop()).intValue(); }
/** * Restores data needed for parsing and building model data * as execution returns from creating a sharedNode child menu model. * * Note: if you add a new pop in this method, you must also add * a corresponding push in _saveModelData() above in the correct order. */
Restores data needed for parsing and building model data as execution returns from creating a sharedNode child menu model. Note: if you add a new pop in this method, you must also add a corresponding push in _saveModelData() above in the correct order
_restoreModelData
{ "repo_name": "adamrduffy/trinidad-1.0.x", "path": "trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/menu/MenuContentHandlerImpl.java", "license": "apache-2.0", "size": 37330 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,899,751
public static void startLifecycleAware(Iterable<?> objs) throws IgniteCheckedException { try { for (Object obj : objs) { if (obj instanceof LifecycleAware) ((LifecycleAware)obj).start(); } } catch (Exception e) { throw new IgniteCheckedException("Failed to start component: " + e, e); } }
static void function(Iterable<?> objs) throws IgniteCheckedException { try { for (Object obj : objs) { if (obj instanceof LifecycleAware) ((LifecycleAware)obj).start(); } } catch (Exception e) { throw new IgniteCheckedException(STR + e, e); } }
/** * For each object provided by the given {@link Iterable} checks if it implements * {@link LifecycleAware} interface and executes {@link LifecycleAware#start} method. * * @param objs Objects. * @throws IgniteCheckedException If {@link LifecycleAware#start} fails. */
For each object provided by the given <code>Iterable</code> checks if it implements <code>LifecycleAware</code> interface and executes <code>LifecycleAware#start</code> method
startLifecycleAware
{ "repo_name": "shurun19851206/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java", "license": "apache-2.0", "size": 289056 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.lifecycle.LifecycleAware" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.lifecycle.LifecycleAware;
import org.apache.ignite.*; import org.apache.ignite.lifecycle.*;
[ "org.apache.ignite" ]
org.apache.ignite;
1,743,103
private int moveToExifSegmentAndGetLength() throws IOException { short segmentId, segmentType; int segmentLength; while (true) { segmentId = reader.getUInt8(); if (segmentId != SEGMENT_START_ID) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Unknown segmentId=" + segmentId); } return -1; } segmentType = reader.getUInt8(); if (segmentType == SEGMENT_SOS) { return -1; } else if (segmentType == MARKER_EOI) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Found MARKER_EOI in exif segment"); } return -1; } // Segment length includes bytes for segment length. segmentLength = reader.getUInt16() - 2; if (segmentType != EXIF_SEGMENT_TYPE) { long skipped = reader.skip(segmentLength); if (skipped != segmentLength) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Unable to skip enough data" + ", type: " + segmentType + ", wanted to skip: " + segmentLength + ", but actually skipped: " + skipped); } return -1; } } else { return segmentLength; } } }
int function() throws IOException { short segmentId, segmentType; int segmentLength; while (true) { segmentId = reader.getUInt8(); if (segmentId != SEGMENT_START_ID) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, STR + segmentId); } return -1; } segmentType = reader.getUInt8(); if (segmentType == SEGMENT_SOS) { return -1; } else if (segmentType == MARKER_EOI) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, STR); } return -1; } segmentLength = reader.getUInt16() - 2; if (segmentType != EXIF_SEGMENT_TYPE) { long skipped = reader.skip(segmentLength); if (skipped != segmentLength) { if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, STR + STR + segmentType + STR + segmentLength + STR + skipped); } return -1; } } else { return segmentLength; } } }
/** * Moves reader to the start of the exif segment and returns the length of the exif segment or * {@code -1} if no exif segment is found. */
Moves reader to the start of the exif segment and returns the length of the exif segment or -1 if no exif segment is found
moveToExifSegmentAndGetLength
{ "repo_name": "DongYuHui/android_daily_record", "path": "ucrop/src/main/java/com/kyletung/ucrop/util/ImageHeaderParser.java", "license": "apache-2.0", "size": 13851 }
[ "android.util.Log", "java.io.IOException" ]
import android.util.Log; import java.io.IOException;
import android.util.*; import java.io.*;
[ "android.util", "java.io" ]
android.util; java.io;
1,559,711
public java.util.List<fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI> getSubterm_booleans_AndHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.booleans.impl.AndImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI( (fr.lip6.move.pnml.hlpn.booleans.And)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.booleans.impl.AndImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.booleans.hlapi.AndHLAPI( (fr.lip6.move.pnml.hlpn.booleans.And)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of AndHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of AndHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_booleans_AndHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/GreaterThanOrEqualHLAPI.java", "license": "epl-1.0", "size": 108757 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,882,595
private Document parseFile( File file, DocumentBuilder constructor ) throws MojoExecutionException { if ( constructor == null ) { return null; } // The document is the root of the DOM tree. File targetFile = file.getAbsoluteFile(); getLog().info( "Parsing " + targetFile ); Document doc = null; try { doc = constructor.parse( targetFile ); } catch ( SAXException e ) { getLog().error( "Cannot parse " + targetFile + " : " + e.getMessage() ); throw new MojoExecutionException( "Cannot parse " + targetFile + " : " + e.getMessage() ); } catch ( IOException e ) { getLog().error( "Cannot open " + targetFile + " : " + e.getMessage() ); throw new MojoExecutionException( "Cannot open " + targetFile + " : " + e.getMessage() ); } return doc; }
Document function( File file, DocumentBuilder constructor ) throws MojoExecutionException { if ( constructor == null ) { return null; } File targetFile = file.getAbsoluteFile(); getLog().info( STR + targetFile ); Document doc = null; try { doc = constructor.parse( targetFile ); } catch ( SAXException e ) { getLog().error( STR + targetFile + STR + e.getMessage() ); throw new MojoExecutionException( STR + targetFile + STR + e.getMessage() ); } catch ( IOException e ) { getLog().error( STR + targetFile + STR + e.getMessage() ); throw new MojoExecutionException( STR + targetFile + STR + e.getMessage() ); } return doc; }
/** * Open an XML file. * * @param filename : XML file path * @param constructor DocumentBuilder get from xerces * @return Document which describes this file * @throws MojoExecutionException occurs when the given file cannot be opened or is a valid XML file. */
Open an XML file
parseFile
{ "repo_name": "sonatype/sonatype-bundle-plugin", "path": "src/main/java/org/apache/felix/obrplugin/ObrCleanRepo.java", "license": "apache-2.0", "size": 10334 }
[ "java.io.File", "java.io.IOException", "javax.xml.parsers.DocumentBuilder", "org.apache.maven.plugin.MojoExecutionException", "org.w3c.dom.Document", "org.xml.sax.SAXException" ]
import java.io.File; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import org.apache.maven.plugin.MojoExecutionException; import org.w3c.dom.Document; import org.xml.sax.SAXException;
import java.io.*; import javax.xml.parsers.*; import org.apache.maven.plugin.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "java.io", "javax.xml", "org.apache.maven", "org.w3c.dom", "org.xml.sax" ]
java.io; javax.xml; org.apache.maven; org.w3c.dom; org.xml.sax;
749,674
private boolean isEnabled(Element coordElem, Configuration coordConf) throws CommandException { Attribute enabled = coordElem.getAttribute("enabled"); if (enabled == null) { // default is true return true; } String isEnabled = enabled.getValue(); try { isEnabled = ELUtils.resolveAppName(isEnabled, coordConf); } catch (Exception e) { throw new CommandException(ErrorCode.E1321, e.getMessage(), e); } return Boolean.parseBoolean(isEnabled); }
boolean function(Element coordElem, Configuration coordConf) throws CommandException { Attribute enabled = coordElem.getAttribute(STR); if (enabled == null) { return true; } String isEnabled = enabled.getValue(); try { isEnabled = ELUtils.resolveAppName(isEnabled, coordConf); } catch (Exception e) { throw new CommandException(ErrorCode.E1321, e.getMessage(), e); } return Boolean.parseBoolean(isEnabled); }
/** * Checks whether the coordinator is enabled * * @param coordElem * @param coordConf * @return true if coordinator is enabled, otherwise false. * @throws CommandException */
Checks whether the coordinator is enabled
isEnabled
{ "repo_name": "cbaenziger/oozie", "path": "core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java", "license": "apache-2.0", "size": 14311 }
[ "org.apache.hadoop.conf.Configuration", "org.apache.oozie.ErrorCode", "org.apache.oozie.command.CommandException", "org.apache.oozie.util.ELUtils", "org.jdom.Attribute", "org.jdom.Element" ]
import org.apache.hadoop.conf.Configuration; import org.apache.oozie.ErrorCode; import org.apache.oozie.command.CommandException; import org.apache.oozie.util.ELUtils; import org.jdom.Attribute; import org.jdom.Element;
import org.apache.hadoop.conf.*; import org.apache.oozie.*; import org.apache.oozie.command.*; import org.apache.oozie.util.*; import org.jdom.*;
[ "org.apache.hadoop", "org.apache.oozie", "org.jdom" ]
org.apache.hadoop; org.apache.oozie; org.jdom;
1,295,566
public static Locale getLocale(String localString) throws IllegalArgumentException{ Locale ret; String[] locstr = localString.split("_"); switch(locstr.length){ case 1: ret = new Locale(locstr[0]); break; case 2: ret = new Locale(locstr[0], locstr[1]); break; case 3: ret = new Locale(locstr[0], locstr[1], locstr[2]); break; default: throw new IllegalArgumentException("Could not parse locale from string: " + localString); } return ret; }
static Locale function(String localString) throws IllegalArgumentException{ Locale ret; String[] locstr = localString.split("_"); switch(locstr.length){ case 1: ret = new Locale(locstr[0]); break; case 2: ret = new Locale(locstr[0], locstr[1]); break; case 3: ret = new Locale(locstr[0], locstr[1], locstr[2]); break; default: throw new IllegalArgumentException(STR + localString); } return ret; }
/** * Parses and returns Locale by given String localString like <code>en_EN</code> or <code>de_DE</code>. * * @return Locale */
Parses and returns Locale by given String localString like <code>en_EN</code> or <code>de_DE</code>
getLocale
{ "repo_name": "Jacksson/mywms", "path": "server.app/los.common-ejb/src/de/linogistix/los/util/BundleHelper.java", "license": "gpl-2.0", "size": 2859 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
858,138
@TargetApi(Build.VERSION_CODES.ECLAIR) public static void cancel(final Context context) { final NotificationManager nm = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { nm.cancel(NOTIFICATION_TAG, 0); } else { nm.cancel(NOTIFICATION_TAG.hashCode()); } }
@TargetApi(Build.VERSION_CODES.ECLAIR) static void function(final Context context) { final NotificationManager nm = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) { nm.cancel(NOTIFICATION_TAG, 0); } else { nm.cancel(NOTIFICATION_TAG.hashCode()); } }
/** * Cancels any notifications of this type previously shown using * {@link #notify(Context, Notification, int)}. */
Cancels any notifications of this type previously shown using <code>#notify(Context, Notification, int)</code>
cancel
{ "repo_name": "trife/1KK", "path": "onekk/src/main/java/org/wheatgenetics/utils/NotificationHelper.java", "license": "gpl-2.0", "size": 7047 }
[ "android.annotation.TargetApi", "android.app.NotificationManager", "android.content.Context", "android.os.Build" ]
import android.annotation.TargetApi; import android.app.NotificationManager; import android.content.Context; import android.os.Build;
import android.annotation.*; import android.app.*; import android.content.*; import android.os.*;
[ "android.annotation", "android.app", "android.content", "android.os" ]
android.annotation; android.app; android.content; android.os;
1,240,327
protected String makeVariableString(VariableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.asType().toString()); result.append(" "); result.append(e.toString()); Object value = e.getConstantValue(); if (value != null) { result.append(" = "); if (e.asType().toString().equals("char")) { int v = (int)value.toString().charAt(0); result.append("'\\u"+Integer.toString(v,16)+"'"); } else { result.append(value.toString()); } } return result.toString(); }
String function(VariableElement e) { StringBuilder result = new StringBuilder(); for (Modifier modifier : e.getModifiers()) { result.append(modifier.toString()); result.append(" "); } result.append(e.asType().toString()); result.append(" "); result.append(e.toString()); Object value = e.getConstantValue(); if (value != null) { result.append(STR); if (e.asType().toString().equals("char")) { int v = (int)value.toString().charAt(0); result.append("'\\u"+Integer.toString(v,16)+"'"); } else { result.append(value.toString()); } } return result.toString(); }
/** * Creates a String representation of a variable element with everything * necessary to track all public aspects of it in an API. * @param e Element to create String for. * @return String representation of element. */
Creates a String representation of a variable element with everything necessary to track all public aspects of it in an API
makeVariableString
{ "repo_name": "Techcable/sjavac", "path": "src/main/java/com/sun/tools/sjavac/comp/PubapiVisitor.java", "license": "gpl-2.0", "size": 7374 }
[ "javax.lang.model.element.Modifier", "javax.lang.model.element.VariableElement" ]
import javax.lang.model.element.Modifier; import javax.lang.model.element.VariableElement;
import javax.lang.model.element.*;
[ "javax.lang" ]
javax.lang;
1,839,866
private void shallowRemoveField(final CCompositeType composite, final String fieldName) { final String type = CTypeUtils.typeToString(composite); final CompositeField field = CompositeField.of(type, fieldName); fields = fields.removeAndCopy(field); } /** * Used to start tracking for fields that were used in some expression or an assignment LHS. * Each field is added for tracking only if it's present in some currently allocated object; * an inner structure/union field is added only if the field corresponding to the inner * composite itself is already tracked; also, a field corresponding to an inner composite is added * only if any fields of that composite are already tracked. The latter two optimizations cause problems * when adding an inner composite field along with the corresponding containing field e.g.: * * <p>{@code pouter->inner.f = /*...* /;}</p> * * Here {@code inner.f} is not added because inner is not yet tracked and {@code outer.inner}
void function(final CCompositeType composite, final String fieldName) { final String type = CTypeUtils.typeToString(composite); final CompositeField field = CompositeField.of(type, fieldName); fields = fields.removeAndCopy(field); } /** * Used to start tracking for fields that were used in some expression or an assignment LHS. * Each field is added for tracking only if it's present in some currently allocated object; * an inner structure/union field is added only if the field corresponding to the inner * composite itself is already tracked; also, a field corresponding to an inner composite is added * only if any fields of that composite are already tracked. The latter two optimizations cause problems * when adding an inner composite field along with the corresponding containing field e.g.: * * <p>{@code pouter->inner.f = /*...* /;}</p> * * Here {@code inner.f} is not added because inner is not yet tracked and {@code outer.inner}
/** * Should be used to remove the newly added field if it didn't turn out to correspond to any actual pointer target. * This can happen if we try to track a field of a composite that has no corresponding allocated bases. * @param composite * @param fieldName */
Should be used to remove the newly added field if it didn't turn out to correspond to any actual pointer target. This can happen if we try to track a field of a composite that has no corresponding allocated bases
shallowRemoveField
{ "repo_name": "nishanttotla/predator", "path": "cpachecker/src/org/sosy_lab/cpachecker/util/predicates/pathformula/pointeraliasing/PointerTargetSetBuilder.java", "license": "gpl-3.0", "size": 26884 }
[ "org.sosy_lab.cpachecker.cfa.types.c.CCompositeType", "org.sosy_lab.cpachecker.util.predicates.pathformula.pointeraliasing.PointerTargetSet" ]
import org.sosy_lab.cpachecker.cfa.types.c.CCompositeType; import org.sosy_lab.cpachecker.util.predicates.pathformula.pointeraliasing.PointerTargetSet;
import org.sosy_lab.cpachecker.cfa.types.c.*; import org.sosy_lab.cpachecker.util.predicates.pathformula.pointeraliasing.*;
[ "org.sosy_lab.cpachecker" ]
org.sosy_lab.cpachecker;
2,872,970
private Sphere parseSphere(Node node, String title) { Sphere sphere = null; String radius = node.getAttributes().getNamedItem("radius") .getNodeValue().trim(); float r = getFloat(radius, 1); if (title != null) { sphere = new Sphere(title, SPHERE_Z_SAMPLES, SPHERE_RADIAL_SAMPLES, r); } else { sphere = new Sphere("X3D_Sphere", SPHERE_Z_SAMPLES, SPHERE_RADIAL_SAMPLES, r); } sphere.getLocalRotation().fromAngleNormalAxis(FastMath.HALF_PI, Vector3f.UNIT_X); return sphere; }
Sphere function(Node node, String title) { Sphere sphere = null; String radius = node.getAttributes().getNamedItem(STR) .getNodeValue().trim(); float r = getFloat(radius, 1); if (title != null) { sphere = new Sphere(title, SPHERE_Z_SAMPLES, SPHERE_RADIAL_SAMPLES, r); } else { sphere = new Sphere(STR, SPHERE_Z_SAMPLES, SPHERE_RADIAL_SAMPLES, r); } sphere.getLocalRotation().fromAngleNormalAxis(FastMath.HALF_PI, Vector3f.UNIT_X); return sphere; }
/** * Parses an X3D Sphere node and creates a corresponding jME Sphere. * * @param node * The X3D Sphere node * @param title * A title for the sphere. If <code>null</code> is passed, a * generic title is used. * @return The jME Sphere */
Parses an X3D Sphere node and creates a corresponding jME Sphere
parseSphere
{ "repo_name": "tectronics/xenogeddon", "path": "src/com/jmex/model/converters/X3dToJme.java", "license": "gpl-2.0", "size": 86719 }
[ "com.jme.math.FastMath", "com.jme.math.Vector3f", "com.jme.scene.shape.Sphere", "org.w3c.dom.Node" ]
import com.jme.math.FastMath; import com.jme.math.Vector3f; import com.jme.scene.shape.Sphere; import org.w3c.dom.Node;
import com.jme.math.*; import com.jme.scene.shape.*; import org.w3c.dom.*;
[ "com.jme.math", "com.jme.scene", "org.w3c.dom" ]
com.jme.math; com.jme.scene; org.w3c.dom;
1,165,247
Ban.Profile getBan(); interface TargetPlayer extends BanUserEvent, TargetPlayerEvent { }
Ban.Profile getBan(); interface TargetPlayer extends BanUserEvent, TargetPlayerEvent { }
/** * Gets the ban involved in this event. * * @return The ban */
Gets the ban involved in this event
getBan
{ "repo_name": "JBYoshi/SpongeAPI", "path": "src/main/java/org/spongepowered/api/event/user/BanUserEvent.java", "license": "mit", "size": 1944 }
[ "org.spongepowered.api.event.entity.living.humanoid.player.TargetPlayerEvent", "org.spongepowered.api.util.ban.Ban" ]
import org.spongepowered.api.event.entity.living.humanoid.player.TargetPlayerEvent; import org.spongepowered.api.util.ban.Ban;
import org.spongepowered.api.event.entity.living.humanoid.player.*; import org.spongepowered.api.util.ban.*;
[ "org.spongepowered.api" ]
org.spongepowered.api;
2,518,402
protected void initializeEventHandling() { if (eventsEnabled) { eventDispatcher = new AWTEventDispatcher(); if (selectableText) { textSelectionManager = new TextSelectionManager(this, eventDispatcher); textSelectionManager.addSelectionListener (new UnixTextSelectionListener()); } } } //////////////////////////////////////////////////////////////////////// // Selection methods ////////////////////////////////////////////////////////////////////////
void function() { if (eventsEnabled) { eventDispatcher = new AWTEventDispatcher(); if (selectableText) { textSelectionManager = new TextSelectionManager(this, eventDispatcher); textSelectionManager.addSelectionListener (new UnixTextSelectionListener()); } } }
/** * Initializes the event handling classes. */
Initializes the event handling classes
initializeEventHandling
{ "repo_name": "Groostav/CMPT880-term-project", "path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/swing/gvt/AbstractJGVTComponent.java", "license": "apache-2.0", "size": 38043 }
[ "org.apache.batik.gvt.event.AWTEventDispatcher" ]
import org.apache.batik.gvt.event.AWTEventDispatcher;
import org.apache.batik.gvt.event.*;
[ "org.apache.batik" ]
org.apache.batik;
850,056
public static org.sakaiproject.calendar.api.CalendarService getInstance() { if (ComponentManager.CACHE_COMPONENTS) { if (m_instance == null) m_instance = (org.sakaiproject.calendar.api.CalendarService) ComponentManager.get(org.sakaiproject.calendar.api.CalendarService.class); return m_instance; } else { return (org.sakaiproject.calendar.api.CalendarService) ComponentManager.get(org.sakaiproject.calendar.api.CalendarService.class); } } private static org.sakaiproject.calendar.api.CalendarService m_instance = null; public static java.lang.String APPLICATION_ID = org.sakaiproject.calendar.api.CalendarService.APPLICATION_ID; public static java.lang.String REFERENCE_ROOT = org.sakaiproject.calendar.api.CalendarService.REFERENCE_ROOT; public static java.lang.String REF_TYPE_CALENDAR = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR; public static java.lang.String REF_TYPE_CALENDAR_PDF = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR_PDF; public static java.lang.String REF_TYPE_CALENDAR_SUBSCRIPTION = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR_SUBSCRIPTION; public static java.lang.String REF_TYPE_EVENT = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_EVENT; public static java.lang.String REF_TYPE_EVENT_SUBSCRIPTION = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_EVENT_SUBSCRIPTION; public static int MOD_NA = org.sakaiproject.calendar.api.CalendarService.MOD_NA; public static int MOD_THIS = org.sakaiproject.calendar.api.CalendarService.MOD_THIS; public static int MOD_ALL = org.sakaiproject.calendar.api.CalendarService.MOD_ALL; public static int MOD_REST = org.sakaiproject.calendar.api.CalendarService.MOD_REST; public static int MOD_PRIOR = org.sakaiproject.calendar.api.CalendarService.MOD_PRIOR; public static int UNKNOWN_VIEW = org.sakaiproject.calendar.api.CalendarService.UNKNOWN_VIEW; public static int DAY_VIEW = org.sakaiproject.calendar.api.CalendarService.DAY_VIEW; public static int WEEK_VIEW = org.sakaiproject.calendar.api.CalendarService.WEEK_VIEW; public static int MONTH_VIEW = org.sakaiproject.calendar.api.CalendarService.MONTH_VIEW; public static int LIST_VIEW = org.sakaiproject.calendar.api.CalendarService.LIST_VIEW; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TITLE = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TITLE; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TIME = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TIME; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TYPE = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TYPE; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_ACCESS = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_ACCESS; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_FREQUENCY = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_FREQUENCY; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_EXCLUSIONS = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_EXCLUSIONS; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_EXCLUDED = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_EXCLUDED; public static java.lang.String EVENT_REMOVE_CALENDAR_EVENT = org.sakaiproject.calendar.api.CalendarService.EVENT_REMOVE_CALENDAR_EVENT;
static org.sakaiproject.calendar.api.CalendarService function() { if (ComponentManager.CACHE_COMPONENTS) { if (m_instance == null) m_instance = (org.sakaiproject.calendar.api.CalendarService) ComponentManager.get(org.sakaiproject.calendar.api.CalendarService.class); return m_instance; } else { return (org.sakaiproject.calendar.api.CalendarService) ComponentManager.get(org.sakaiproject.calendar.api.CalendarService.class); } } private static org.sakaiproject.calendar.api.CalendarService m_instance = null; public static java.lang.String APPLICATION_ID = org.sakaiproject.calendar.api.CalendarService.APPLICATION_ID; public static java.lang.String REFERENCE_ROOT = org.sakaiproject.calendar.api.CalendarService.REFERENCE_ROOT; public static java.lang.String REF_TYPE_CALENDAR = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR; public static java.lang.String REF_TYPE_CALENDAR_PDF = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR_PDF; public static java.lang.String REF_TYPE_CALENDAR_SUBSCRIPTION = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_CALENDAR_SUBSCRIPTION; public static java.lang.String REF_TYPE_EVENT = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_EVENT; public static java.lang.String REF_TYPE_EVENT_SUBSCRIPTION = org.sakaiproject.calendar.api.CalendarService.REF_TYPE_EVENT_SUBSCRIPTION; public static int MOD_NA = org.sakaiproject.calendar.api.CalendarService.MOD_NA; public static int MOD_THIS = org.sakaiproject.calendar.api.CalendarService.MOD_THIS; public static int MOD_ALL = org.sakaiproject.calendar.api.CalendarService.MOD_ALL; public static int MOD_REST = org.sakaiproject.calendar.api.CalendarService.MOD_REST; public static int MOD_PRIOR = org.sakaiproject.calendar.api.CalendarService.MOD_PRIOR; public static int UNKNOWN_VIEW = org.sakaiproject.calendar.api.CalendarService.UNKNOWN_VIEW; public static int DAY_VIEW = org.sakaiproject.calendar.api.CalendarService.DAY_VIEW; public static int WEEK_VIEW = org.sakaiproject.calendar.api.CalendarService.WEEK_VIEW; public static int MONTH_VIEW = org.sakaiproject.calendar.api.CalendarService.MONTH_VIEW; public static int LIST_VIEW = org.sakaiproject.calendar.api.CalendarService.LIST_VIEW; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TITLE = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TITLE; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TIME = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TIME; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_TYPE = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_TYPE; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_ACCESS = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_ACCESS; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_FREQUENCY = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_FREQUENCY; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_EXCLUSIONS = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_EXCLUSIONS; public static java.lang.String EVENT_MODIFY_CALENDAR_EVENT_EXCLUDED = org.sakaiproject.calendar.api.CalendarService.EVENT_MODIFY_CALENDAR_EVENT_EXCLUDED; public static java.lang.String EVENT_REMOVE_CALENDAR_EVENT = org.sakaiproject.calendar.api.CalendarService.EVENT_REMOVE_CALENDAR_EVENT;
/** * Access the component instance: special cover only method. * @return the component instance. */
Access the component instance: special cover only method
getInstance
{ "repo_name": "harfalm/Sakai-10.1", "path": "calendar/calendar-api/api/src/java/org/sakaiproject/calendar/cover/CalendarService.java", "license": "apache-2.0", "size": 13680 }
[ "org.sakaiproject.component.cover.ComponentManager" ]
import org.sakaiproject.component.cover.ComponentManager;
import org.sakaiproject.component.cover.*;
[ "org.sakaiproject.component" ]
org.sakaiproject.component;
2,788,842
public long getCoordPushCheckRequeueInterval() { long requeueInterval = ConfigurationService.getLong(CONF_COORD_PUSH_CHECK_REQUEUE_INTERVAL); return requeueInterval; }
long function() { long requeueInterval = ConfigurationService.getLong(CONF_COORD_PUSH_CHECK_REQUEUE_INTERVAL); return requeueInterval; }
/** * Return the re-queue interval for coord push dependency check * @return requeueInterval returns the requeue interval for coord push dependency check */
Return the re-queue interval for coord push dependency check
getCoordPushCheckRequeueInterval
{ "repo_name": "cbaenziger/oozie", "path": "core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java", "license": "apache-2.0", "size": 19820 }
[ "org.apache.oozie.service.ConfigurationService" ]
import org.apache.oozie.service.ConfigurationService;
import org.apache.oozie.service.*;
[ "org.apache.oozie" ]
org.apache.oozie;
2,806,209
public static NativeArray jsFunction_getEnabledAssetTypeList(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws AppManagementException { NativeArray availableAssetTypes = new NativeArray(0); List<String> typeList = HostObjectUtils.getEnabledAssetTypes(); for (int i = 0; i < typeList.size(); i++) { availableAssetTypes.put(i, availableAssetTypes, typeList.get(i)); } return availableAssetTypes; }
static NativeArray function(Context cx, Scriptable thisObj, Object[] args, Function funObj) throws AppManagementException { NativeArray availableAssetTypes = new NativeArray(0); List<String> typeList = HostObjectUtils.getEnabledAssetTypes(); for (int i = 0; i < typeList.size(); i++) { availableAssetTypes.put(i, availableAssetTypes, typeList.get(i)); } return availableAssetTypes; }
/** * Returns the enabled asset type list in app-manager.xml * * @param cx * @param thisObj * @param args * @param funObj * @return * @throws AppManagementException */
Returns the enabled asset type list in app-manager.xml
jsFunction_getEnabledAssetTypeList
{ "repo_name": "lakshani/carbon-mobile-appmgt", "path": "components/org.wso2.carbon.appmgt.hostobjects/src/main/java/org/wso2/carbon/appmgt/hostobjects/APIProviderHostObject.java", "license": "apache-2.0", "size": 89357 }
[ "java.util.List", "org.mozilla.javascript.Context", "org.mozilla.javascript.Function", "org.mozilla.javascript.NativeArray", "org.mozilla.javascript.Scriptable", "org.wso2.carbon.appmgt.api.AppManagementException" ]
import java.util.List; import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.NativeArray; import org.mozilla.javascript.Scriptable; import org.wso2.carbon.appmgt.api.AppManagementException;
import java.util.*; import org.mozilla.javascript.*; import org.wso2.carbon.appmgt.api.*;
[ "java.util", "org.mozilla.javascript", "org.wso2.carbon" ]
java.util; org.mozilla.javascript; org.wso2.carbon;
459,481
@Bean public HttpClient httpClient(final ConnectorContext connectorContext) { final int timeout = (int) TimeUtil.toTime( connectorContext.getConfiguration().getOrDefault(DruidConfigConstants.HTTP_TIMEOUT, "5s"), TimeUnit.SECONDS, TimeUnit.MILLISECONDS ); final int poolsize = Integer.parseInt(connectorContext.getConfiguration() .getOrDefault(DruidConfigConstants.POOL_SIZE, "10")); final RequestConfig config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout) .setMaxRedirects(3) .build(); final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(poolsize); return HttpClientBuilder .create() .setDefaultRequestConfig(config) .setConnectionManager(connectionManager) .build(); }
HttpClient function(final ConnectorContext connectorContext) { final int timeout = (int) TimeUtil.toTime( connectorContext.getConfiguration().getOrDefault(DruidConfigConstants.HTTP_TIMEOUT, "5s"), TimeUnit.SECONDS, TimeUnit.MILLISECONDS ); final int poolsize = Integer.parseInt(connectorContext.getConfiguration() .getOrDefault(DruidConfigConstants.POOL_SIZE, "10")); final RequestConfig config = RequestConfig.custom() .setConnectTimeout(timeout) .setConnectionRequestTimeout(timeout) .setSocketTimeout(timeout) .setMaxRedirects(3) .build(); final PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); connectionManager.setMaxTotal(poolsize); return HttpClientBuilder .create() .setDefaultRequestConfig(config) .setConnectionManager(connectionManager) .build(); }
/** * Http client. * * @param connectorContext connector context * @return HttpClient */
Http client
httpClient
{ "repo_name": "tgianos/metacat", "path": "metacat-connector-druid/src/main/java/com/netflix/metacat/connector/druid/configs/DruidHttpClientConfig.java", "license": "apache-2.0", "size": 3687 }
[ "com.netflix.metacat.common.server.connectors.ConnectorContext", "com.netflix.metacat.common.server.connectors.util.TimeUtil", "com.netflix.metacat.connector.druid.DruidConfigConstants", "java.util.concurrent.TimeUnit", "org.apache.http.client.HttpClient", "org.apache.http.client.config.RequestConfig", "org.apache.http.impl.client.HttpClientBuilder", "org.apache.http.impl.conn.PoolingHttpClientConnectionManager" ]
import com.netflix.metacat.common.server.connectors.ConnectorContext; import com.netflix.metacat.common.server.connectors.util.TimeUtil; import com.netflix.metacat.connector.druid.DruidConfigConstants; import java.util.concurrent.TimeUnit; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import com.netflix.metacat.common.server.connectors.*; import com.netflix.metacat.common.server.connectors.util.*; import com.netflix.metacat.connector.druid.*; import java.util.concurrent.*; import org.apache.http.client.*; import org.apache.http.client.config.*; import org.apache.http.impl.client.*; import org.apache.http.impl.conn.*;
[ "com.netflix.metacat", "java.util", "org.apache.http" ]
com.netflix.metacat; java.util; org.apache.http;
2,248,864
public final AnnotationPropertyDescriptorBuilder<P, E, B> getBuilder() { return this.builder; }
final AnnotationPropertyDescriptorBuilder<P, E, B> function() { return this.builder; }
/** * Gets the value for the builder field. * * @return The value for the builder field. */
Gets the value for the builder field
getBuilder
{ "repo_name": "lunarray-org/model-descriptor", "path": "src/main/java/org/lunarray/model/descriptor/builder/annotation/base/listener/events/AbstractPropertyValueReferenceEvent.java", "license": "lgpl-3.0", "size": 2944 }
[ "org.lunarray.model.descriptor.builder.annotation.base.build.property.AnnotationPropertyDescriptorBuilder" ]
import org.lunarray.model.descriptor.builder.annotation.base.build.property.AnnotationPropertyDescriptorBuilder;
import org.lunarray.model.descriptor.builder.annotation.base.build.property.*;
[ "org.lunarray.model" ]
org.lunarray.model;
2,604,915
void setSSLContextParameters(SSLContextParameters sslContextParameters);
void setSSLContextParameters(SSLContextParameters sslContextParameters);
/** * Sets the global SSL context parameters. */
Sets the global SSL context parameters
setSSLContextParameters
{ "repo_name": "curso007/camel", "path": "camel-core/src/main/java/org/apache/camel/CamelContext.java", "license": "apache-2.0", "size": 79052 }
[ "org.apache.camel.util.jsse.SSLContextParameters" ]
import org.apache.camel.util.jsse.SSLContextParameters;
import org.apache.camel.util.jsse.*;
[ "org.apache.camel" ]
org.apache.camel;
686,616
private Model loadModel(String dxsPaths) { Model model = new Model(dxsPaths); String[] pathsArr = dxsPaths.split(","); for (String path : pathsArr) { SAXModelHandler handler = new SAXModelHandler(path); parseXml(path, handler); model.add(handler.getVertices(), handler.getPolys()); } return model; }
Model function(String dxsPaths) { Model model = new Model(dxsPaths); String[] pathsArr = dxsPaths.split(","); for (String path : pathsArr) { SAXModelHandler handler = new SAXModelHandler(path); parseXml(path, handler); model.add(handler.getVertices(), handler.getPolys()); } return model; }
/** * Constructs a Model described by the given .dxs files. */
Constructs a Model described by the given .dxs files
loadModel
{ "repo_name": "rjwut/ian", "path": "src/main/java/com/walkertribe/ian/DefaultContext.java", "license": "mit", "size": 8749 }
[ "com.walkertribe.ian.model.Model", "com.walkertribe.ian.model.SAXModelHandler" ]
import com.walkertribe.ian.model.Model; import com.walkertribe.ian.model.SAXModelHandler;
import com.walkertribe.ian.model.*;
[ "com.walkertribe.ian" ]
com.walkertribe.ian;
140,290
public static List<NabuccoPropertyDescriptor> getPropertyDescriptorList() { return PropertyCache.getInstance().retrieve(ProduceDSRq.class).getAllProperties(); }
static List<NabuccoPropertyDescriptor> function() { return PropertyCache.getInstance().retrieve(ProduceDSRq.class).getAllProperties(); }
/** * Getter for the PropertyDescriptorList. * * @return the List<NabuccoPropertyDescriptor>. */
Getter for the PropertyDescriptorList
getPropertyDescriptorList
{ "repo_name": "NABUCCO/org.nabucco.framework.template", "path": "org.nabucco.framework.template.facade.message/src/main/gen/org/nabucco/framework/template/facade/message/datastructure/ProduceDSRq.java", "license": "epl-1.0", "size": 7219 }
[ "java.util.List", "org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor", "org.nabucco.framework.base.facade.datatype.property.PropertyCache" ]
import java.util.List; import org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor; import org.nabucco.framework.base.facade.datatype.property.PropertyCache;
import java.util.*; import org.nabucco.framework.base.facade.datatype.property.*;
[ "java.util", "org.nabucco.framework" ]
java.util; org.nabucco.framework;
549,284
public static String toString(File file, Charset charset) { Objects.requireNonNull(file, "null file not allowed"); Objects.requireNonNull(charset, "null charset not allowed"); try { return toString(new FileInputStream(file), charset); } catch (Exception e) { throw new RuntimeException(e); } }
static String function(File file, Charset charset) { Objects.requireNonNull(file, STR); Objects.requireNonNull(charset, STR); try { return toString(new FileInputStream(file), charset); } catch (Exception e) { throw new RuntimeException(e); } }
/** * Reads a {@link File} into a {@link String} using the specified character * set. * <p/> * Throws a {@link RuntimeException} on failure. * * @param file * The {@link File} to read from. * @param charset * The character set to use. For example, * {@link StandardCharsets#UTF_8}. * @return The contents of the {@link File}. */
Reads a <code>File</code> into a <code>String</code> using the specified character set. Throws a <code>RuntimeException</code> on failure
toString
{ "repo_name": "elastisys/scale.commons", "path": "util/src/main/java/com/elastisys/scale/commons/util/io/IoUtils.java", "license": "apache-2.0", "size": 4859 }
[ "java.io.File", "java.io.FileInputStream", "java.nio.charset.Charset", "java.util.Objects" ]
import java.io.File; import java.io.FileInputStream; import java.nio.charset.Charset; import java.util.Objects;
import java.io.*; import java.nio.charset.*; import java.util.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
2,259,619
public ConcurrentHasherRequest addRequest( ByteBuffer buffer, ConcurrentHasherRequestListener listener, boolean low_priorty ) { final ConcurrentHasherRequest req = new ConcurrentHasherRequest( this, buffer, listener, low_priorty ); // get permission to run a request // test code to force synchronous checking //SHA1Hasher hasher = new SHA1Hasher(); //req.run( hasher ); scheduler_sem.reserve(); try{ requests_mon.enter(); requests.add( req ); }finally{ requests_mon.exit(); } request_sem.release(); return( req ); }
ConcurrentHasherRequest function( ByteBuffer buffer, ConcurrentHasherRequestListener listener, boolean low_priorty ) { final ConcurrentHasherRequest req = new ConcurrentHasherRequest( this, buffer, listener, low_priorty ); scheduler_sem.reserve(); try{ requests_mon.enter(); requests.add( req ); }finally{ requests_mon.exit(); } request_sem.release(); return( req ); }
/** * Add an asynchronous request if listener supplied, sync otherwise * @param buffer * @param priority * @param listener * @param low_priorty low priority checks will cause the "friendly hashing" setting to be * taken into account * @return */
Add an asynchronous request if listener supplied, sync otherwise
addRequest
{ "repo_name": "thangbn/Direct-File-Downloader", "path": "src/src/org/gudy/azureus2/core3/util/ConcurrentHasher.java", "license": "gpl-2.0", "size": 6713 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
1,438,366
public AggregateDefinition aggregationStrategy(AggregationStrategy aggregationStrategy) { setAggregationStrategy(aggregationStrategy); return this; }
AggregateDefinition function(AggregationStrategy aggregationStrategy) { setAggregationStrategy(aggregationStrategy); return this; }
/** * Sets the aggregate strategy to use * * @param aggregationStrategy the aggregate strategy to use * @return the builder */
Sets the aggregate strategy to use
aggregationStrategy
{ "repo_name": "engagepoint/camel", "path": "camel-core/src/main/java/org/apache/camel/model/AggregateDefinition.java", "license": "apache-2.0", "size": 29360 }
[ "org.apache.camel.processor.aggregate.AggregationStrategy" ]
import org.apache.camel.processor.aggregate.AggregationStrategy;
import org.apache.camel.processor.aggregate.*;
[ "org.apache.camel" ]
org.apache.camel;
2,189,940
public static Document createDocFromMessage(InputStream message) throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); //Disabling DTDs in order to avoid XXE xml-based attacks. disableFeature(dbfactory, DISALLOW_DTD_FEATURE); disableFeature(dbfactory, DISALLOW_EXTERNAL_DTD); dbfactory.setXIncludeAware(false); dbfactory.setExpandEntityReferences(false); DocumentBuilder builder = dbfactory.newDocumentBuilder(); return builder.parse(new InputSource(message)); }
static Document function(InputStream message) throws SAXException, IOException, ParserConfigurationException { DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance(); disableFeature(dbfactory, DISALLOW_DTD_FEATURE); disableFeature(dbfactory, DISALLOW_EXTERNAL_DTD); dbfactory.setXIncludeAware(false); dbfactory.setExpandEntityReferences(false); DocumentBuilder builder = dbfactory.newDocumentBuilder(); return builder.parse(new InputSource(message)); }
/** * Creates a document from the input stream message and returns the result. * * @param message input stream message * @return the document result * @throws SAXException Throws SAX Exception * @throws IOException Throws IO Exception * @throws ParserConfigurationException Throws ParserConfigurationException */
Creates a document from the input stream message and returns the result
createDocFromMessage
{ "repo_name": "gkatsikas/onos", "path": "core/api/src/main/java/org/onosproject/alarm/XmlEventParser.java", "license": "apache-2.0", "size": 4062 }
[ "java.io.IOException", "java.io.InputStream", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "javax.xml.parsers.ParserConfigurationException", "org.w3c.dom.Document", "org.xml.sax.InputSource", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException;
import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*;
[ "java.io", "javax.xml", "org.w3c.dom", "org.xml.sax" ]
java.io; javax.xml; org.w3c.dom; org.xml.sax;
947,958
@Test public void testTTLFiltering() throws Exception { Map<byte[], Long> ttls = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); ttls.put(FAM, 10L); ttls.put(FAM2, 30L); ttls.put(FAM3, 0L); Transaction tx = txManager.startShort(); long now = tx.getVisibilityUpperBound(); Filter filter = new TransactionVisibilityFilter(tx, ttls, false, ScanType.USER_SCAN); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", now))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", now - 1 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", now - 11 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM2, "val1", now - 11 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM2, "val1", now - 21 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM2, "val1", now - 31 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", now - 31 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", now - 1001 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row2", FAM, "val1", now))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row2", FAM, "val1", now - 1 * TxConstants.MAX_TX_PER_MS))); // Verify ttl for pre-existing, non-transactional data long preNow = now / TxConstants.MAX_TX_PER_MS; assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow - 9L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow - 10L))); assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow - 11L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow - 9L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow - 10L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow - 1001L))); }
void function() throws Exception { Map<byte[], Long> ttls = Maps.newTreeMap(Bytes.BYTES_COMPARATOR); ttls.put(FAM, 10L); ttls.put(FAM2, 30L); ttls.put(FAM3, 0L); Transaction tx = txManager.startShort(); long now = tx.getVisibilityUpperBound(); Filter filter = new TransactionVisibilityFilter(tx, ttls, false, ScanType.USER_SCAN); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", now))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", now - 1 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", now - 11 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM2, "val1", now - 11 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM2, "val1", now - 21 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM2, "val1", now - 31 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", now - 31 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", now - 1001 * TxConstants.MAX_TX_PER_MS))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row2", FAM, "val1", now))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row2", FAM, "val1", now - 1 * TxConstants.MAX_TX_PER_MS))); long preNow = now / TxConstants.MAX_TX_PER_MS; assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow - 9L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow - 10L))); assertEquals(Filter.ReturnCode.NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM, "val1", preNow - 11L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow - 9L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow - 10L))); assertEquals(Filter.ReturnCode.INCLUDE_AND_NEXT_COL, filter.filterKeyValue(newKeyValue("row1", FAM3, "val1", preNow - 1001L))); }
/** * Test filtering for TTL settings. * @throws Exception */
Test filtering for TTL settings
testTTLFiltering
{ "repo_name": "anwar6953/incubator-tephra", "path": "tephra-hbase-compat-0.96/src/test/java/org/apache/tephra/hbase/coprocessor/TransactionVisibilityFilterTest.java", "license": "apache-2.0", "size": 16745 }
[ "com.google.common.collect.Maps", "java.util.Map", "org.apache.hadoop.hbase.filter.Filter", "org.apache.hadoop.hbase.regionserver.ScanType", "org.apache.hadoop.hbase.util.Bytes", "org.apache.tephra.Transaction", "org.apache.tephra.TxConstants", "org.junit.Assert" ]
import com.google.common.collect.Maps; import java.util.Map; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.regionserver.ScanType; import org.apache.hadoop.hbase.util.Bytes; import org.apache.tephra.Transaction; import org.apache.tephra.TxConstants; import org.junit.Assert;
import com.google.common.collect.*; import java.util.*; import org.apache.hadoop.hbase.filter.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*; import org.apache.tephra.*; import org.junit.*;
[ "com.google.common", "java.util", "org.apache.hadoop", "org.apache.tephra", "org.junit" ]
com.google.common; java.util; org.apache.hadoop; org.apache.tephra; org.junit;
2,040,665
protected void paintComponent(Graphics g) { // Clear the background if we are an opaque component if(isOpaque()) { g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, getWidth(), getHeight()); } //get the current grid Block[][] currentGrid = controller.getCurrentGrid(); g.setColor(Color.BLACK); //Set correct colour and then paint a rectange for each site for(int i=0;i<currentGrid.length;i++){ for(int j=0;j<currentGrid.length;j++){ background.draw(g, i*Block.WIDTH, j*Block.WIDTH); currentGrid[i][j].draw(g); g.drawRect(i*Block.WIDTH, j*Block.WIDTH, Block.WIDTH, Block.WIDTH); } } if(counter>=1) counter++; int s = controller.getScore(); String format = String.format("%%0%dd", 4); String result = String.format(format, s); g.setColor(Color.black); g.setFont(new Font("Arial", Font.BOLD, 16)); g.drawString("Score "+result, 10, 20); String next = controller.getNext(); g.drawString(next, 100, 20); }
void function(Graphics g) { if(isOpaque()) { g.setColor(Color.DARK_GRAY); g.fillRect(0, 0, getWidth(), getHeight()); } Block[][] currentGrid = controller.getCurrentGrid(); g.setColor(Color.BLACK); for(int i=0;i<currentGrid.length;i++){ for(int j=0;j<currentGrid.length;j++){ background.draw(g, i*Block.WIDTH, j*Block.WIDTH); currentGrid[i][j].draw(g); g.drawRect(i*Block.WIDTH, j*Block.WIDTH, Block.WIDTH, Block.WIDTH); } } if(counter>=1) counter++; int s = controller.getScore(); String format = String.format(STR, 4); String result = String.format(format, s); g.setColor(Color.black); g.setFont(new Font("Arial", Font.BOLD, 16)); g.drawString(STR+result, 10, 20); String next = controller.getNext(); g.drawString(next, 100, 20); }
/** * Overide the paintComponet method to draw grid */
Overide the paintComponet method to draw grid
paintComponent
{ "repo_name": "Smirl/TrippleGame", "path": "src/tripleGame/TripleViewer.java", "license": "gpl-2.0", "size": 3047 }
[ "java.awt.Color", "java.awt.Font", "java.awt.Graphics" ]
import java.awt.Color; import java.awt.Font; import java.awt.Graphics;
import java.awt.*;
[ "java.awt" ]
java.awt;
313,200
public IoBuffer generateClientRequest1() { log.debug("generateClientRequest1"); IoBuffer request = IoBuffer.allocate(Constants.HANDSHAKE_SIZE + 1); // set the handshake type byte request.put(handshakeType); if (useEncryption() || swfSize > 0) { fp9Handshake = true; algorithm = 1; } else { //fp9Handshake = false; } // timestamp int time = 5; handshakeBytes[0] = (byte) (time >>> 24); handshakeBytes[1] = (byte) (time >>> 16); handshakeBytes[2] = (byte) (time >>> 8); handshakeBytes[3] = (byte) time; if (fp9Handshake) { // flash player version > 9.0.115.0 handshakeBytes[4] = (byte) 0x80; handshakeBytes[5] = 0; handshakeBytes[6] = 7; handshakeBytes[7] = 2; } else { log.debug("Using pre-version 9.0.115.0 handshake"); handshakeBytes[4] = 0; handshakeBytes[5] = 0; handshakeBytes[6] = 0; handshakeBytes[7] = 0; } if (log.isTraceEnabled()) { log.trace("Time and version handshake bytes: {}", Hex.encodeHexString(Arrays.copyOf(handshakeBytes, 8))); } // get the handshake digest c1 = new byte[Constants.HANDSHAKE_SIZE]; if (fp9Handshake) { // handle encryption setup if (useEncryption()) { // create keypair KeyPair keys = generateKeyPair(); // get public key outgoingPublicKey = getPublicKey(keys); log.debug("Client public key: {}", Hex.encodeHexString(outgoingPublicKey)); // get the DH offset in the handshake bytes int clientDHOffset = getDHOffset(algorithm, handshakeBytes, 0); log.trace("Outgoing DH offset: {}", clientDHOffset); // adds the public key to handshake bytes System.arraycopy(outgoingPublicKey, 0, handshakeBytes, clientDHOffset, KEY_LENGTH); // perform special processing for each type if needed switch (handshakeType) { case RTMPConnection.RTMP_ENCRYPTED: break; case RTMPConnection.RTMP_ENCRYPTED_XTEA: break; case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH: break; } } digestPosClient = getDigestOffset(algorithm, handshakeBytes, 0); log.debug("Client digest position offset: {} algorithm: {}", digestPosClient, algorithm); System.arraycopy(handshakeBytes, 0, c1, 0, Constants.HANDSHAKE_SIZE); calculateDigest(digestPosClient, handshakeBytes, 0, GENUINE_FP_KEY, 30, c1, digestPosClient); // local storage of outgoing digest System.arraycopy(c1, digestPosClient, outgoingDigest, 0, DIGEST_LENGTH); log.debug("Client digest: {}", Hex.encodeHexString(outgoingDigest)); log.debug("Digest is valid: {}", verifyDigest(digestPosClient, c1, RTMPHandshake.GENUINE_FP_KEY, 30)); } if (log.isTraceEnabled()) { log.trace("C1: {}", Hex.encodeHexString(c1)); } // put the generated data into our request request.put(c1); request.flip(); // clear original base bytes handshakeBytes = null; return request; }
IoBuffer function() { log.debug(STR); IoBuffer request = IoBuffer.allocate(Constants.HANDSHAKE_SIZE + 1); request.put(handshakeType); if (useEncryption() swfSize > 0) { fp9Handshake = true; algorithm = 1; } else { } int time = 5; handshakeBytes[0] = (byte) (time >>> 24); handshakeBytes[1] = (byte) (time >>> 16); handshakeBytes[2] = (byte) (time >>> 8); handshakeBytes[3] = (byte) time; if (fp9Handshake) { handshakeBytes[4] = (byte) 0x80; handshakeBytes[5] = 0; handshakeBytes[6] = 7; handshakeBytes[7] = 2; } else { log.debug(STR); handshakeBytes[4] = 0; handshakeBytes[5] = 0; handshakeBytes[6] = 0; handshakeBytes[7] = 0; } if (log.isTraceEnabled()) { log.trace(STR, Hex.encodeHexString(Arrays.copyOf(handshakeBytes, 8))); } c1 = new byte[Constants.HANDSHAKE_SIZE]; if (fp9Handshake) { if (useEncryption()) { KeyPair keys = generateKeyPair(); outgoingPublicKey = getPublicKey(keys); log.debug(STR, Hex.encodeHexString(outgoingPublicKey)); int clientDHOffset = getDHOffset(algorithm, handshakeBytes, 0); log.trace(STR, clientDHOffset); System.arraycopy(outgoingPublicKey, 0, handshakeBytes, clientDHOffset, KEY_LENGTH); switch (handshakeType) { case RTMPConnection.RTMP_ENCRYPTED: break; case RTMPConnection.RTMP_ENCRYPTED_XTEA: break; case RTMPConnection.RTMP_ENCRYPTED_BLOWFISH: break; } } digestPosClient = getDigestOffset(algorithm, handshakeBytes, 0); log.debug(STR, digestPosClient, algorithm); System.arraycopy(handshakeBytes, 0, c1, 0, Constants.HANDSHAKE_SIZE); calculateDigest(digestPosClient, handshakeBytes, 0, GENUINE_FP_KEY, 30, c1, digestPosClient); System.arraycopy(c1, digestPosClient, outgoingDigest, 0, DIGEST_LENGTH); log.debug(STR, Hex.encodeHexString(outgoingDigest)); log.debug(STR, verifyDigest(digestPosClient, c1, RTMPHandshake.GENUINE_FP_KEY, 30)); } if (log.isTraceEnabled()) { log.trace(STR, Hex.encodeHexString(c1)); } request.put(c1); request.flip(); handshakeBytes = null; return request; }
/** * Create the first part of the outgoing connection request (C0 and C1). * <pre> * C0 = 0x03 (client handshake type - 0x03, 0x06, 0x08, or 0x09) * C1 = 1536 bytes from the client * </pre> * @return outgoing handshake C0+C1 */
Create the first part of the outgoing connection request (C0 and C1). <code> C0 = 0x03 (client handshake type - 0x03, 0x06, 0x08, or 0x09) C1 = 1536 bytes from the client </code>
generateClientRequest1
{ "repo_name": "Red5/red5-client", "path": "src/main/java/org/red5/client/net/rtmp/OutboundHandshake.java", "license": "apache-2.0", "size": 19583 }
[ "java.security.KeyPair", "java.util.Arrays", "org.apache.commons.codec.binary.Hex", "org.apache.mina.core.buffer.IoBuffer", "org.red5.server.net.rtmp.RTMPConnection", "org.red5.server.net.rtmp.RTMPHandshake", "org.red5.server.net.rtmp.message.Constants" ]
import java.security.KeyPair; import java.util.Arrays; import org.apache.commons.codec.binary.Hex; import org.apache.mina.core.buffer.IoBuffer; import org.red5.server.net.rtmp.RTMPConnection; import org.red5.server.net.rtmp.RTMPHandshake; import org.red5.server.net.rtmp.message.Constants;
import java.security.*; import java.util.*; import org.apache.commons.codec.binary.*; import org.apache.mina.core.buffer.*; import org.red5.server.net.rtmp.*; import org.red5.server.net.rtmp.message.*;
[ "java.security", "java.util", "org.apache.commons", "org.apache.mina", "org.red5.server" ]
java.security; java.util; org.apache.commons; org.apache.mina; org.red5.server;
2,294,820
private static void writeRecord(TBTRecord currRecord) { switch (outputFormat) { case Bit: try { for (Long i : currRecord.sequence) { outputStream.writeLong(i); } outputStream.write(currRecord.tagLength); for (Long i : currRecord.bitDistribution) { outputStream.writeLong(i); } } catch (Exception e) { System.out.println("Caught exception while writing binary TBT record: " + e); } break; case Text: //Records are output to text two different ways, depending on which format they are stored in. String outputLine = null; if (inputFormat.equals(TagsByTaxa.FilePacking.Bit)) { outputLine = BaseEncoder.getSequenceFromLong(currRecord.sequence) + "\t" + Byte.toString(currRecord.tagLength) + "\t" + bitsetToString(new OpenBitSet(currRecord.bitDistribution, currRecord.bitDistribution.length)) + "\n"; } else if (inputFormat.equals(TagsByTaxa.FilePacking.Byte)) { outputLine = BaseEncoder.getSequenceFromLong(currRecord.sequence) + "\t" + Byte.toString(currRecord.tagLength) + "\t"; for (int i = 0; i < currRecord.byteDistribution.length; i++) { outputLine = outputLine + currRecord.byteDistribution[i] + "\t"; } outputLine = outputLine + "\n"; } try { writer.write(outputLine); } catch (Exception e) { System.out.println("Caught Exception while writing TBT text record: " + e); } break; case Byte: try { for (Long i : currRecord.sequence) { outputStream.writeLong(i); } outputStream.write(currRecord.tagLength); outputStream.write(currRecord.byteDistribution); } catch (Exception e) { System.out.println("Caught exception while writing binary TBT record: " + e); } break; } }
static void function(TBTRecord currRecord) { switch (outputFormat) { case Bit: try { for (Long i : currRecord.sequence) { outputStream.writeLong(i); } outputStream.write(currRecord.tagLength); for (Long i : currRecord.bitDistribution) { outputStream.writeLong(i); } } catch (Exception e) { System.out.println(STR + e); } break; case Text: String outputLine = null; if (inputFormat.equals(TagsByTaxa.FilePacking.Bit)) { outputLine = BaseEncoder.getSequenceFromLong(currRecord.sequence) + "\t" + Byte.toString(currRecord.tagLength) + "\t" + bitsetToString(new OpenBitSet(currRecord.bitDistribution, currRecord.bitDistribution.length)) + "\n"; } else if (inputFormat.equals(TagsByTaxa.FilePacking.Byte)) { outputLine = BaseEncoder.getSequenceFromLong(currRecord.sequence) + "\t" + Byte.toString(currRecord.tagLength) + "\t"; for (int i = 0; i < currRecord.byteDistribution.length; i++) { outputLine = outputLine + currRecord.byteDistribution[i] + "\t"; } outputLine = outputLine + "\n"; } try { writer.write(outputLine); } catch (Exception e) { System.out.println(STR + e); } break; case Byte: try { for (Long i : currRecord.sequence) { outputStream.writeLong(i); } outputStream.write(currRecord.tagLength); outputStream.write(currRecord.byteDistribution); } catch (Exception e) { System.out.println(STR + e); } break; } }
/**Writes a single TBT record to disk. It uses the value of <b>format</b> * to determine whether to write text, binary, or another format. * @param currRecord A TBTRecord object.*/
Writes a single TBT record to disk. It uses the value of format to determine whether to write text, binary, or another format
writeRecord
{ "repo_name": "guilherme-pereira/tassel4-poly", "path": "src/net/maizegenetics/gbs/tagdist/TagsByTaxaUtils.java", "license": "gpl-3.0", "size": 40064 }
[ "net.maizegenetics.gbs.util.BaseEncoder", "net.maizegenetics.util.OpenBitSet" ]
import net.maizegenetics.gbs.util.BaseEncoder; import net.maizegenetics.util.OpenBitSet;
import net.maizegenetics.gbs.util.*; import net.maizegenetics.util.*;
[ "net.maizegenetics.gbs", "net.maizegenetics.util" ]
net.maizegenetics.gbs; net.maizegenetics.util;
1,814,928
public static final String getDailyLogfileName() { StringBuilder sb = new StringBuilder(); sb.append(SettingsManager.getLogDir()); sb.append("/"); sb.append(LocalDate.now().toString()); sb.append(".xml"); // TODO: Get file type from settings return sb.toString(); }
static final String function() { StringBuilder sb = new StringBuilder(); sb.append(SettingsManager.getLogDir()); sb.append("/"); sb.append(LocalDate.now().toString()); sb.append(".xml"); return sb.toString(); }
/** * Return name of logfile with current date. * For example: "./logs/2015-08-22.xml" * @return String */
Return name of logfile with current date. For example: "./logs/2015-08-22.xml"
getDailyLogfileName
{ "repo_name": "chrbirks/TaskTimeTracker", "path": "src/main/java/ttt/logger/TaskLogger.java", "license": "gpl-3.0", "size": 1131 }
[ "java.time.LocalDate" ]
import java.time.LocalDate;
import java.time.*;
[ "java.time" ]
java.time;
942,322
@Test public final void testGetAPIPacketParametersATCommandParameterString() { // Setup the resources for the test. String command = "NI"; String commandValue = "Device name"; IPv6RemoteATCommandResponsePacket packet = new IPv6RemoteATCommandResponsePacket(frameID, ipv6address, command, status, commandValue); String expectedSourcetAddr = HexUtils.prettyHexString(ipv6address.getAddress()) + " (" + ipv6address.getHostAddress() + ")"; String expectedATCommand = HexUtils.prettyHexString(command.getBytes()) + " (" + command + ")"; String expectedStatus = HexUtils.prettyHexString(HexUtils.integerToHexString(status.getId(), 1)) + " (" + status.getDescription() + ")"; String expectedATCommandValue = HexUtils.prettyHexString(commandValue.getBytes()) + " (" + commandValue + ")"; // Call the method under test. LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); // Verify the result. assertThat("Packet parameters map size is not the expected one", packetParams.size(), is(equalTo(4))); assertThat("Source IPv6 Address is not the expected one", packetParams.get("Source address"), is(equalTo(expectedSourcetAddr))); assertThat("AT Command is not the expected one", packetParams.get("AT Command"), is(equalTo(expectedATCommand))); assertThat("Status is not the expected one", packetParams.get("Status"), is(equalTo(expectedStatus))); assertThat("AT Command value is not the expected one", packetParams.get("Response"), is(equalTo(expectedATCommandValue))); }
final void function() { String command = "NI"; String commandValue = STR; IPv6RemoteATCommandResponsePacket packet = new IPv6RemoteATCommandResponsePacket(frameID, ipv6address, command, status, commandValue); String expectedSourcetAddr = HexUtils.prettyHexString(ipv6address.getAddress()) + STR + ipv6address.getHostAddress() + ")"; String expectedATCommand = HexUtils.prettyHexString(command.getBytes()) + STR + command + ")"; String expectedStatus = HexUtils.prettyHexString(HexUtils.integerToHexString(status.getId(), 1)) + STR + status.getDescription() + ")"; String expectedATCommandValue = HexUtils.prettyHexString(commandValue.getBytes()) + STR + commandValue + ")"; LinkedHashMap<String, String> packetParams = packet.getAPIPacketParameters(); assertThat(STR, packetParams.size(), is(equalTo(4))); assertThat(STR, packetParams.get(STR), is(equalTo(expectedSourcetAddr))); assertThat(STR, packetParams.get(STR), is(equalTo(expectedATCommand))); assertThat(STR, packetParams.get(STR), is(equalTo(expectedStatus))); assertThat(STR, packetParams.get(STR), is(equalTo(expectedATCommandValue))); }
/** * Test method for {@link com.digi.xbee.api.packet.thread.IPv6RemoteATCommandResponsePacket#getAPIPacketParameters()}. * * <p>Test the get API parameters but with a parameter value.</p> */
Test method for <code>com.digi.xbee.api.packet.thread.IPv6RemoteATCommandResponsePacket#getAPIPacketParameters()</code>. Test the get API parameters but with a parameter value
testGetAPIPacketParametersATCommandParameterString
{ "repo_name": "digidotcom/XBeeJavaLibrary", "path": "library/src/test/java/com/digi/xbee/api/packet/thread/IPv6RemoteATCommandResponsePacketTest.java", "license": "mpl-2.0", "size": 36457 }
[ "com.digi.xbee.api.utils.HexUtils", "java.util.LinkedHashMap", "org.hamcrest.core.Is", "org.junit.Assert" ]
import com.digi.xbee.api.utils.HexUtils; import java.util.LinkedHashMap; import org.hamcrest.core.Is; import org.junit.Assert;
import com.digi.xbee.api.utils.*; import java.util.*; import org.hamcrest.core.*; import org.junit.*;
[ "com.digi.xbee", "java.util", "org.hamcrest.core", "org.junit" ]
com.digi.xbee; java.util; org.hamcrest.core; org.junit;
2,726,846
public CommitOp setAuthorTimeZoneOffset(@Nullable final Integer timeZoneOffset) { this.authorTimeZoneOffset = timeZoneOffset; return this; }
CommitOp function(@Nullable final Integer timeZoneOffset) { this.authorTimeZoneOffset = timeZoneOffset; return this; }
/** * Sets the time zone offset of the author. * * @param timeZoneOffset time zone offset of the author * @return {@code this}, to ease command chaining */
Sets the time zone offset of the author
setAuthorTimeZoneOffset
{ "repo_name": "jdgarrett/geogig", "path": "src/core/src/main/java/org/locationtech/geogig/porcelain/CommitOp.java", "license": "bsd-3-clause", "size": 17917 }
[ "org.eclipse.jdt.annotation.Nullable" ]
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.jdt.annotation.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
2,272,238
public void discardBatch() throws FrontendException { if (currDAG == null || !isBatchOn()) { int errCode = 1083; String msg = "setBatchOn() must be called first."; throw new FrontendException(msg, errCode, PigException.INPUT); } currDAG = graphs.pop(); }
void function() throws FrontendException { if (currDAG == null !isBatchOn()) { int errCode = 1083; String msg = STR; throw new FrontendException(msg, errCode, PigException.INPUT); } currDAG = graphs.pop(); }
/** * Discards a batch of Pig commands. * * @throws FrontendException */
Discards a batch of Pig commands
discardBatch
{ "repo_name": "kaituo/sedge", "path": "trunk/src/org/apache/pig/PigServer.java", "license": "mit", "size": 68504 }
[ "org.apache.pig.impl.logicalLayer.FrontendException" ]
import org.apache.pig.impl.logicalLayer.FrontendException;
import org.apache.pig.impl.*;
[ "org.apache.pig" ]
org.apache.pig;
2,403,055
public void startElement( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { startElement(elementNamespaceURI, elementLocalName, elementName, null); }
void function( String elementNamespaceURI, String elementLocalName, String elementName) throws SAXException { startElement(elementNamespaceURI, elementLocalName, elementName, null); }
/** * Receive notification of the beginning of an element, additional * namespace or attribute information can occur before or after this call, * that is associated with this element. * * * @param elementNamespaceURI The Namespace URI, or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed. * @param elementLocalName The local name (without prefix), or the * empty string if Namespace processing is not being * performed. * @param elementName The element type name. * @throws org.xml.sax.SAXException Any SAX exception, possibly * wrapping another exception. * @see org.xml.sax.ContentHandler#startElement * @see org.xml.sax.ContentHandler#endElement * @see org.xml.sax.AttributeList * * @throws org.xml.sax.SAXException */
Receive notification of the beginning of an element, additional namespace or attribute information can occur before or after this call, that is associated with this element
startElement
{ "repo_name": "JetBrains/jdk8u_jaxp", "path": "src/com/sun/org/apache/xml/internal/serializer/ToStream.java", "license": "gpl-2.0", "size": 109909 }
[ "org.xml.sax.SAXException" ]
import org.xml.sax.SAXException;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
1,653,096
void writeModels(ApiSpecContext context, ApiMetadata m, Appendable out) throws IOException;
void writeModels(ApiSpecContext context, ApiMetadata m, Appendable out) throws IOException;
/** * Writes the given api models to spec's format. */
Writes the given api models to spec's format
writeModels
{ "repo_name": "leapframework/framework", "path": "web/api/src/main/java/leap/web/api/spec/ApiSpecWriter.java", "license": "apache-2.0", "size": 1552 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
624,249
public byte getByteProperty(String name) { try { Object value = properties.get(name); return value instanceof Byte ? (Byte) value : Byte.parseByte(value.toString()); } catch (Exception e) { throw new JMSRuntimeException("error during converting property " + name); } }
byte function(String name) { try { Object value = properties.get(name); return value instanceof Byte ? (Byte) value : Byte.parseByte(value.toString()); } catch (Exception e) { throw new JMSRuntimeException(STR + name); } }
/** * Returns the message property with the specified name that has been set on * this {@code JMSProducer}, converted to a {@code String}. */
Returns the message property with the specified name that has been set on this JMSProducer, converted to a String
getByteProperty
{ "repo_name": "dstraub/jmscontext", "path": "src/main/java/de/ctrlaltdel/jms/JMSProducerImpl.java", "license": "apache-2.0", "size": 17639 }
[ "javax.jms.JMSRuntimeException" ]
import javax.jms.JMSRuntimeException;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
2,069,599
boolean canHandle(HandlerInput input, ExpiredRequest expiredRequest);
boolean canHandle(HandlerInput input, ExpiredRequest expiredRequest);
/** * Returns true if the handler can dispatch the current request * * @param input input to the request handler * @param expiredRequest ExpiredRequest request * @return true if the handler is capable of handling the current request and/or state */
Returns true if the handler can dispatch the current request
canHandle
{ "repo_name": "amzn/alexa-skills-kit-java", "path": "ask-sdk-core/src/com/amazon/ask/dispatcher/request/handler/impl/ExpiredRequestHandler.java", "license": "apache-2.0", "size": 2087 }
[ "com.amazon.ask.dispatcher.request.handler.HandlerInput", "com.amazon.ask.model.interfaces.customInterfaceController.ExpiredRequest" ]
import com.amazon.ask.dispatcher.request.handler.HandlerInput; import com.amazon.ask.model.interfaces.customInterfaceController.ExpiredRequest;
import com.amazon.ask.dispatcher.request.handler.*; import com.amazon.ask.model.interfaces.*;
[ "com.amazon.ask" ]
com.amazon.ask;
1,311,888
public Observable<ServiceResponse<StreamingEndpointInner>> createWithServiceResponseAsync(String resourceGroupName, String accountName, String streamingEndpointName, StreamingEndpointInner parameters, Boolean autoStart) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (accountName == null) { throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); } if (streamingEndpointName == null) { throw new IllegalArgumentException("Parameter streamingEndpointName is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } if (parameters == null) { throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); Observable<Response<ResponseBody>> observable = service.create(this.client.subscriptionId(), resourceGroupName, accountName, streamingEndpointName, this.client.apiVersion(), autoStart, parameters, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<StreamingEndpointInner>() { }.getType()); }
Observable<ServiceResponse<StreamingEndpointInner>> function(String resourceGroupName, String accountName, String streamingEndpointName, StreamingEndpointInner parameters, Boolean autoStart) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } if (streamingEndpointName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); } Validator.validate(parameters); Observable<Response<ResponseBody>> observable = service.create(this.client.subscriptionId(), resourceGroupName, accountName, streamingEndpointName, this.client.apiVersion(), autoStart, parameters, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<StreamingEndpointInner>() { }.getType()); }
/** * Create StreamingEndpoint. * Creates a StreamingEndpoint. * * @param resourceGroupName The name of the resource group within the Azure subscription. * @param accountName The Media Services account name. * @param streamingEndpointName The name of the StreamingEndpoint. * @param parameters StreamingEndpoint properties needed for creation. * @param autoStart The flag indicates if auto start the Live Event. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable for the request */
Create StreamingEndpoint. Creates a StreamingEndpoint
createWithServiceResponseAsync
{ "repo_name": "hovsepm/azure-sdk-for-java", "path": "mediaservices/resource-manager/v2018_30_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_30_30_preview/implementation/StreamingEndpointsInner.java", "license": "mit", "size": 117803 }
[ "com.google.common.reflect.TypeToken", "com.microsoft.rest.ServiceResponse", "com.microsoft.rest.Validator" ]
import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator;
import com.google.common.reflect.*; import com.microsoft.rest.*;
[ "com.google.common", "com.microsoft.rest" ]
com.google.common; com.microsoft.rest;
1,862,038
public static Map<String, Object> from(Pair... pairs) { Map<String, Object> map = new HashMap<String, Object>(pairs.length); for (Pair p : pairs) { map.put(p.key, p.value); } return map; }
static Map<String, Object> function(Pair... pairs) { Map<String, Object> map = new HashMap<String, Object>(pairs.length); for (Pair p : pairs) { map.put(p.key, p.value); } return map; }
/** * construct me from the given pairs * @param pairs * @return the map */
construct me from the given pairs
from
{ "repo_name": "greenlaw110/Rythm", "path": "src/main/java/org/rythmengine/utils/NamedParams.java", "license": "apache-2.0", "size": 2171 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,431,000
IComplexNDArray scalar(IComplexDouble value);
IComplexNDArray scalar(IComplexDouble value);
/** * Create a scalar nd array with the specified value and offset * * @param value the value of the scalar * = * @return the scalar nd array */
Create a scalar nd array with the specified value and offset
scalar
{ "repo_name": "drlebedev/nd4j", "path": "nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/factory/NDArrayFactory.java", "license": "apache-2.0", "size": 43801 }
[ "org.nd4j.linalg.api.complex.IComplexDouble", "org.nd4j.linalg.api.complex.IComplexNDArray" ]
import org.nd4j.linalg.api.complex.IComplexDouble; import org.nd4j.linalg.api.complex.IComplexNDArray;
import org.nd4j.linalg.api.complex.*;
[ "org.nd4j.linalg" ]
org.nd4j.linalg;
2,762,930
public void stop(boolean cancel) throws IgniteCheckedException { List<GridComponent> comps = components(); for (ListIterator<GridComponent> it = comps.listIterator(comps.size()); it.hasPrevious();) { GridComponent comp = it.previous(); comp.stop(cancel); } }
void function(boolean cancel) throws IgniteCheckedException { List<GridComponent> comps = components(); for (ListIterator<GridComponent> it = comps.listIterator(comps.size()); it.hasPrevious();) { GridComponent comp = it.previous(); comp.stop(cancel); } }
/** * Stops everything added. * * @param cancel Cancel parameter. * @throws IgniteCheckedException If failed. */
Stops everything added
stop
{ "repo_name": "WilliamDo/ignite", "path": "modules/core/src/test/java/org/apache/ignite/testframework/junits/GridTestKernalContext.java", "license": "apache-2.0", "size": 4426 }
[ "java.util.List", "java.util.ListIterator", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.GridComponent" ]
import java.util.List; import java.util.ListIterator; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.GridComponent;
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
2,408,306
public void setProtocol(String protocol) { Assert.hasLength(protocol, "Protocol must not be empty"); this.protocol = protocol; }
void function(String protocol) { Assert.hasLength(protocol, STR); this.protocol = protocol; }
/** * The Tomcat protocol to use when create the {@link Connector}. * @param protocol the protocol * @see Connector#Connector(String) */
The Tomcat protocol to use when create the <code>Connector</code>
setProtocol
{ "repo_name": "lucassaldanha/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java", "license": "apache-2.0", "size": 29527 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
1,856,587
static String getUniquePomProperty(String property) { File f = new File("pom.xml"); if (!f.exists()) { throw new MLContextException("pom.xml not found"); } try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); Document document = builder.parse(f); NodeList nodes = document.getElementsByTagName(property); int length = nodes.getLength(); if (length == 0) { throw new MLContextException("Property not found in pom.xml"); } Node node = nodes.item(0); String value = node.getTextContent(); return value; } catch (Exception e) { throw new MLContextException("MLContextException when reading property '" + property + "' from pom.xml", e); } }
static String getUniquePomProperty(String property) { File f = new File(STR); if (!f.exists()) { throw new MLContextException(STR); } try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = dbf.newDocumentBuilder(); Document document = builder.parse(f); NodeList nodes = document.getElementsByTagName(property); int length = nodes.getLength(); if (length == 0) { throw new MLContextException(STR); } Node node = nodes.item(0); String value = node.getTextContent(); return value; } catch (Exception e) { throw new MLContextException(STR + property + STR, e); } }
/** * Obtain the text associated with an XML element from the pom.xml file. In * this implementation, the element should be uniquely named, or results * will be unpredicable. * * @param property * unique property (element) from the pom.xml file * @return the text value associated with the given property */
Obtain the text associated with an XML element from the pom.xml file. In this implementation, the element should be uniquely named, or results will be unpredicable
getUniquePomProperty
{ "repo_name": "asurve/arvind-sysml2", "path": "src/main/java/org/apache/sysml/api/mlcontext/MLContextUtil.java", "license": "apache-2.0", "size": 41918 }
[ "java.io.File", "javax.xml.parsers.DocumentBuilder", "javax.xml.parsers.DocumentBuilderFactory", "org.w3c.dom.Document", "org.w3c.dom.Node", "org.w3c.dom.NodeList" ]
import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList;
import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*;
[ "java.io", "javax.xml", "org.w3c.dom" ]
java.io; javax.xml; org.w3c.dom;
2,803,740
public void setValidator(Validator validator) { this.validator = validator; }
void function(Validator validator) { this.validator = validator; }
/** * Set the bean validator used to validate property fields. * @param validator the validator */
Set the bean validator used to validate property fields
setValidator
{ "repo_name": "imranansari/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/context/properties/ConfigurationPropertiesBindingPostProcessor.java", "license": "apache-2.0", "size": 16187 }
[ "org.springframework.validation.Validator" ]
import org.springframework.validation.Validator;
import org.springframework.validation.*;
[ "org.springframework.validation" ]
org.springframework.validation;
504,020
private int[] attributeList (BitSet group) { int count = 0; // count how many were selected for (int i = 0; i < m_numAttribs; i++) { if (group.get(i)) { count++; } } int[] list = new int[count]; count = 0; for (int i = 0; i < m_numAttribs; i++) { if (group.get(i)) { list[count++] = i; } } return list; }
int[] function (BitSet group) { int count = 0; for (int i = 0; i < m_numAttribs; i++) { if (group.get(i)) { count++; } } int[] list = new int[count]; count = 0; for (int i = 0; i < m_numAttribs; i++) { if (group.get(i)) { list[count++] = i; } } return list; }
/** * converts a BitSet into a list of attribute indexes * @param group the BitSet to convert * @return an array of attribute indexes **/
converts a BitSet into a list of attribute indexes
attributeList
{ "repo_name": "goddesss/DataModeling", "path": "src/weka/attributeSelection/ExhaustiveSearch.java", "license": "gpl-2.0", "size": 11655 }
[ "java.util.BitSet" ]
import java.util.BitSet;
import java.util.*;
[ "java.util" ]
java.util;
1,064,702
public static AWTKeyStroke getAWTKeyStrokeForEvent(KeyEvent event) { switch (event.id) { case KeyEvent.KEY_TYPED: return getAWTKeyStroke(event.getKeyChar(), KeyEvent.VK_UNDEFINED, extend(event.getModifiersEx()), false); case KeyEvent.KEY_PRESSED: return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(), extend(event.getModifiersEx()), false); case KeyEvent.KEY_RELEASED: return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(), extend(event.getModifiersEx()), true); default: return null; } }
static AWTKeyStroke function(KeyEvent event) { switch (event.id) { case KeyEvent.KEY_TYPED: return getAWTKeyStroke(event.getKeyChar(), KeyEvent.VK_UNDEFINED, extend(event.getModifiersEx()), false); case KeyEvent.KEY_PRESSED: return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(), extend(event.getModifiersEx()), false); case KeyEvent.KEY_RELEASED: return getAWTKeyStroke(KeyEvent.CHAR_UNDEFINED, event.getKeyCode(), extend(event.getModifiersEx()), true); default: return null; } }
/** * Returns a keystroke representing what caused the key event. * * @param event the key event to convert * @return the specified keystroke, or null if the event is invalid * @throws NullPointerException if event is null */
Returns a keystroke representing what caused the key event
getAWTKeyStrokeForEvent
{ "repo_name": "aosm/gcc_40", "path": "libjava/java/awt/AWTKeyStroke.java", "license": "gpl-2.0", "size": 22893 }
[ "java.awt.event.KeyEvent" ]
import java.awt.event.KeyEvent;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
104,687
private void insert(long recvTimeTs, String recvTime, String resourceId, String attrName, String attrType, String attrValue, String attrMd) throws Exception { String urlPath; String jsonString; try { // create the CKAN request JSON String records = "\"" + Constants.RECV_TIME_TS + "\": \"" + recvTimeTs / 1000 + "\", " + "\"" + Constants.RECV_TIME + "\": \"" + recvTime + "\", " + "\"" + Constants.ATTR_NAME + "\": \"" + attrName + "\", " + "\"" + Constants.ATTR_TYPE + "\": \"" + attrType + "\", " + "\"" + Constants.ATTR_VALUE + "\": " + attrValue; // metadata is an special case, because CKAN doesn't support empty array, e.g. "[ ]" // (http://stackoverflow.com/questions/24207065/inserting-empty-arrays-in-json-type-fields-in-datastore) if (!attrMd.equals(Constants.EMPTY_MD)) { records += ", \"" + Constants.ATTR_MD + "\": " + attrMd; } // if jsonString = "{ \"resource_id\": \"" + resourceId + "\", \"records\": [ { " + records + " } ], " + "\"method\": \"insert\", " + "\"force\": \"true\" }"; // create the CKAN request URL urlPath = "/api/3/action/datastore_upsert"; // do the CKAN request JsonResponse res = doCKANRequest("POST", urlPath, jsonString); // check the status if (res.getStatusCode() == 200) { LOGGER.debug("Successful insert (resource/datastore id=" + resourceId + ")"); } else { throw new CygnusRuntimeError("Don't know how to treat response code " + res.getStatusCode()); } // if else } catch (Exception e) { if (e instanceof CygnusRuntimeError || e instanceof CygnusPersistenceError || e instanceof CygnusBadConfiguration) { throw e; } else { throw new CygnusRuntimeError(e.getMessage()); } // if else } // try catch } // insert
void function(long recvTimeTs, String recvTime, String resourceId, String attrName, String attrType, String attrValue, String attrMd) throws Exception { String urlPath; String jsonString; try { String records = "\"STR\STRSTR\STR + "\"STR\STRSTR\STR + "\"STR\STRSTR\STR + "\"STR\STRSTR\STR + "\"STR\STR + attrValue; if (!attrMd.equals(Constants.EMPTY_MD)) { records += STRSTR\STR + attrMd; } jsonString = STRresource_id\STRSTR\STRrecords\STR + records + STR + "\"method\STRinsert\STR + "\"force\STRtrue\STR; urlPath = STR; JsonResponse res = doCKANRequest("POST", urlPath, jsonString); if (res.getStatusCode() == 200) { LOGGER.debug("Successful insert (resource/datastore id=STR)"); } else { throw new CygnusRuntimeError(STR + res.getStatusCode()); } } catch (Exception e) { if (e instanceof CygnusRuntimeError e instanceof CygnusPersistenceError e instanceof CygnusBadConfiguration) { throw e; } else { throw new CygnusRuntimeError(e.getMessage()); } } }
/** * Insert record in datastore (row mode). * @param recvTimeTs timestamp. * @param recvTime timestamp (human readable) * @param resId the resource in which datastore the record is going to be inserted. * @param attrName attribute CKANBackend. * @param attrType attribute type. * @param attrValue attribute value. * @throws Exception */
Insert record in datastore (row mode)
insert
{ "repo_name": "jmcanterafonseca/fiware-cygnus", "path": "src/main/java/com/telefonica/iot/cygnus/backends/ckan/CKANBackendImpl.java", "license": "agpl-3.0", "size": 21400 }
[ "com.telefonica.iot.cygnus.backends.http.JsonResponse", "com.telefonica.iot.cygnus.errors.CygnusBadConfiguration", "com.telefonica.iot.cygnus.errors.CygnusPersistenceError", "com.telefonica.iot.cygnus.errors.CygnusRuntimeError", "com.telefonica.iot.cygnus.utils.Constants" ]
import com.telefonica.iot.cygnus.backends.http.JsonResponse; import com.telefonica.iot.cygnus.errors.CygnusBadConfiguration; import com.telefonica.iot.cygnus.errors.CygnusPersistenceError; import com.telefonica.iot.cygnus.errors.CygnusRuntimeError; import com.telefonica.iot.cygnus.utils.Constants;
import com.telefonica.iot.cygnus.backends.http.*; import com.telefonica.iot.cygnus.errors.*; import com.telefonica.iot.cygnus.utils.*;
[ "com.telefonica.iot" ]
com.telefonica.iot;
1,176,543
@RequiresApi(Build.VERSION_CODES.LOLLIPOP) public static void setNavBarColor(@NonNull final Activity activity, @ColorInt final int color) { setNavBarColor(activity.getWindow(), color); }
@RequiresApi(Build.VERSION_CODES.LOLLIPOP) static void function(@NonNull final Activity activity, @ColorInt final int color) { setNavBarColor(activity.getWindow(), color); }
/** * Set the navigation bar's color. * * @param activity The activity. * @param color The navigation bar's color. */
Set the navigation bar's color
setNavBarColor
{ "repo_name": "didi/DoraemonKit", "path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/BarUtils.java", "license": "apache-2.0", "size": 27876 }
[ "android.app.Activity", "android.os.Build", "androidx.annotation.ColorInt", "androidx.annotation.NonNull", "androidx.annotation.RequiresApi" ]
import android.app.Activity; import android.os.Build; import androidx.annotation.ColorInt; import androidx.annotation.NonNull; import androidx.annotation.RequiresApi;
import android.app.*; import android.os.*; import androidx.annotation.*;
[ "android.app", "android.os", "androidx.annotation" ]
android.app; android.os; androidx.annotation;
1,609,192
@ServiceMethod(returns = ReturnType.SINGLE) private Mono<Response<Void>> deleteWithResponseAsync( String resourceGroupName, String namespaceName, String eventHubName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (namespaceName == null) { return Mono.error(new IllegalArgumentException("Parameter namespaceName is required and cannot be null.")); } if (eventHubName == null) { return Mono.error(new IllegalArgumentException("Parameter eventHubName is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), resourceGroupName, namespaceName, eventHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Void>> function( String resourceGroupName, String namespaceName, String eventHubName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (namespaceName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (eventHubName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), resourceGroupName, namespaceName, eventHubName, this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); }
/** * Deletes an Event Hub from the specified Namespace and resource group. * * @param resourceGroupName Name of the resource group within the azure subscription. * @param namespaceName The Namespace name. * @param eventHubName The Event Hub name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Deletes an Event Hub from the specified Namespace and resource group
deleteWithResponseAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-eventhubs/src/main/java/com/azure/resourcemanager/eventhubs/implementation/EventHubsClientImpl.java", "license": "mit", "size": 114749 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
1,998,414
public void acquire() throws DatabaseException { try { if (lock.isHeldByCurrentThread()) { stats.nAcquiresSelfOwned++; throw new LatchException(name + " already held"); } if (lock.isLocked()) { stats.nAcquiresWithContention++; } else { stats.nAcquiresNoWaiters++; } lock.lock(); assert noteLatch(); // intentional side effect; } finally { assert EnvironmentImpl.maybeForceYield(); } }
void function() throws DatabaseException { try { if (lock.isHeldByCurrentThread()) { stats.nAcquiresSelfOwned++; throw new LatchException(name + STR); } if (lock.isLocked()) { stats.nAcquiresWithContention++; } else { stats.nAcquiresNoWaiters++; } lock.lock(); assert noteLatch(); } finally { assert EnvironmentImpl.maybeForceYield(); } }
/** * Acquire a latch for exclusive/write access. * * <p>Wait for the latch if some other thread is holding it. If there are * threads waiting for access, they will be granted the latch on a FIFO * basis. When the method returns, the latch is held for exclusive * access.</p> * * @throws LatchException if the latch is already held by the calling * thread. * * @throws RunRecoveryException if an InterruptedException exception * occurs. */
Acquire a latch for exclusive/write access. Wait for the latch if some other thread is holding it. If there are threads waiting for access, they will be granted the latch on a FIFO basis. When the method returns, the latch is held for exclusive access
acquire
{ "repo_name": "plast-lab/DelphJ", "path": "examples/berkeleydb/com/sleepycat/je/latch/Latch.java", "license": "mit", "size": 5716 }
[ "com.sleepycat.je.DatabaseException", "com.sleepycat.je.dbi.EnvironmentImpl" ]
import com.sleepycat.je.DatabaseException; import com.sleepycat.je.dbi.EnvironmentImpl;
import com.sleepycat.je.*; import com.sleepycat.je.dbi.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
1,268,741
T convertToInstance(String stringValue) throws ConverterException;
T convertToInstance(String stringValue) throws ConverterException;
/** * Convert a given string value to an instance. * * @param stringValue * The string value. * @return The instance. * @throws ConverterException * Thrown if the value could not be converted. */
Convert a given string value to an instance
convertToInstance
{ "repo_name": "lunarray-org/model-descriptor", "path": "src/main/java/org/lunarray/model/descriptor/converter/Converter.java", "license": "lgpl-3.0", "size": 4037 }
[ "org.lunarray.model.descriptor.converter.exceptions.ConverterException" ]
import org.lunarray.model.descriptor.converter.exceptions.ConverterException;
import org.lunarray.model.descriptor.converter.exceptions.*;
[ "org.lunarray.model" ]
org.lunarray.model;
1,514,054
void setNumberWorkers(BSPJobID jobId, StaffAttemptID staffId, int num);
void setNumberWorkers(BSPJobID jobId, StaffAttemptID staffId, int num);
/** * Set the number of workers which run the job. * * @param jobId * BSPJobID * @param staffId * StaffAttemptID * @param num * the number of workers */
Set the number of workers which run the job
setNumberWorkers
{ "repo_name": "LiuJianan/Graduate-Graph", "path": "src/test/com/chinamobile/bcbsp/rpcserver/WorkerAgentInterface.java", "license": "apache-2.0", "size": 3519 }
[ "com.chinamobile.bcbsp.util.BSPJobID", "com.chinamobile.bcbsp.util.StaffAttemptID" ]
import com.chinamobile.bcbsp.util.BSPJobID; import com.chinamobile.bcbsp.util.StaffAttemptID;
import com.chinamobile.bcbsp.util.*;
[ "com.chinamobile.bcbsp" ]
com.chinamobile.bcbsp;
2,691,281
public static Criterion endedBy(String begin, String end, Time value) throws UnsupportedTimeException { return filter(new EndedByRestriction(), begin, end, value); }
static Criterion function(String begin, String end, Time value) throws UnsupportedTimeException { return filter(new EndedByRestriction(), begin, end, value); }
/** * Creates a temporal restriction for the specified time and property. * * @param begin * the begin property name * @param end * the end property name * @param value * the value * * @return the <tt>Criterion</tt> * * @see EndedByRestriction * @throws UnsupportedTimeException * if the value and property combination is not applicable for * this restriction */
Creates a temporal restriction for the specified time and property
endedBy
{ "repo_name": "impulze/SOS", "path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/TemporalRestrictions.java", "license": "gpl-2.0", "size": 39623 }
[ "org.hibernate.criterion.Criterion", "org.n52.sos.ds.hibernate.util.TemporalRestriction", "org.n52.sos.exception.ows.concrete.UnsupportedTimeException", "org.n52.sos.ogc.gml.time.Time" ]
import org.hibernate.criterion.Criterion; import org.n52.sos.ds.hibernate.util.TemporalRestriction; import org.n52.sos.exception.ows.concrete.UnsupportedTimeException; import org.n52.sos.ogc.gml.time.Time;
import org.hibernate.criterion.*; import org.n52.sos.ds.hibernate.util.*; import org.n52.sos.exception.ows.concrete.*; import org.n52.sos.ogc.gml.time.*;
[ "org.hibernate.criterion", "org.n52.sos" ]
org.hibernate.criterion; org.n52.sos;
2,497,840
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<Response<Flux<ByteBuffer>>> updateWithResponseAsync( String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } if (diskEncryptionSetName == null) { return Mono .error(new IllegalArgumentException("Parameter diskEncryptionSetName is required and cannot be null.")); } if (diskEncryptionSet == null) { return Mono .error(new IllegalArgumentException("Parameter diskEncryptionSet is required and cannot be null.")); } else { diskEncryptionSet.validate(); } final String apiVersion = "2019-11-01"; return FluxUtil .withContext( context -> service .update( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, diskEncryptionSetName, apiVersion, diskEncryptionSet, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String diskEncryptionSetName, DiskEncryptionSetUpdate diskEncryptionSet) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (diskEncryptionSetName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (diskEncryptionSet == null) { return Mono .error(new IllegalArgumentException(STR)); } else { diskEncryptionSet.validate(); } final String apiVersion = STR; return FluxUtil .withContext( context -> service .update( this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, diskEncryptionSetName, apiVersion, diskEncryptionSet, context)) .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); }
/** * Updates (patches) a disk encryption set. * * @param resourceGroupName The name of the resource group. * @param diskEncryptionSetName The name of the disk encryption set that is being created. The name can't be changed * after the disk encryption set is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The * maximum name length is 80 characters. * @param diskEncryptionSet disk encryption set update resource. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ApiErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return disk encryption set resource. */
Updates (patches) a disk encryption set
updateWithResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/DiskEncryptionSetsClientImpl.java", "license": "mit", "size": 81126 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.FluxUtil", "com.azure.resourcemanager.compute.models.DiskEncryptionSetUpdate", "java.nio.ByteBuffer" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.compute.models.DiskEncryptionSetUpdate; import java.nio.ByteBuffer;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.compute.models.*; import java.nio.*;
[ "com.azure.core", "com.azure.resourcemanager", "java.nio" ]
com.azure.core; com.azure.resourcemanager; java.nio;
2,747,608