method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
@Test public void testGetTemporaryFile() throws Exception { getContext().setDatabase("wiki"); createEmptyFile("temp/module/wiki/Space/Page/file.txt"); Assert.assertNotNull(action.getTemporaryFile("/xwiki/bin/temp/Space/Page/module/file.txt", getContext())); }
void function() throws Exception { getContext().setDatabase("wiki"); createEmptyFile(STR); Assert.assertNotNull(action.getTemporaryFile(STR, getContext())); }
/** * Tests {@link TempResourceAction#getTemporaryFile(String, XWikiContext)} when the file is present. */
Tests <code>TempResourceAction#getTemporaryFile(String, XWikiContext)</code> when the file is present
testGetTemporaryFile
{ "repo_name": "xwiki-labs/sankoreorg", "path": "xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/web/TempResourceActionTest.java", "license": "lgpl-2.1", "size": 5636 }
[ "junit.framework.Assert" ]
import junit.framework.Assert;
import junit.framework.*;
[ "junit.framework" ]
junit.framework;
1,210,344
@VisibleForTesting synchronized void clear() { for (Value value : multimap.values()) { IOUtils.cleanup(LOG, value.getPeer()); } multimap.clear(); }
synchronized void clear() { for (Value value : multimap.values()) { IOUtils.cleanup(LOG, value.getPeer()); } multimap.clear(); }
/** * Empty the cache, and close all sockets. */
Empty the cache, and close all sockets
clear
{ "repo_name": "ict-carch/hadoop-plus", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/PeerCache.java", "license": "apache-2.0", "size": 7825 }
[ "org.apache.hadoop.io.IOUtils" ]
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
1,598,989
public void setXsdTranslationEnabled(String value) { m_xsdTranslationEnabled = Boolean.valueOf(value).booleanValue(); if (CmsLog.INIT.isInfoEnabled()) { if (m_xsdTranslationEnabled) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_XSD_TRANSLATION_ENABLE_0)); } else { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_XSD_TRANSLATION_DISABLE_0)); } } }
void function(String value) { m_xsdTranslationEnabled = Boolean.valueOf(value).booleanValue(); if (CmsLog.INIT.isInfoEnabled()) { if (m_xsdTranslationEnabled) { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_XSD_TRANSLATION_ENABLE_0)); } else { CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_XSD_TRANSLATION_DISABLE_0)); } } }
/** * Enables or disables the XSD translation rules.<p> * * @param value if <code>"true"</code>, XSD translation is enabled, otherwise it is disabled */
Enables or disables the XSD translation rules
setXsdTranslationEnabled
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/configuration/CmsVfsConfiguration.java", "license": "lgpl-2.1", "size": 38541 }
[ "org.opencms.main.CmsLog" ]
import org.opencms.main.CmsLog;
import org.opencms.main.*;
[ "org.opencms.main" ]
org.opencms.main;
907,063
IAdministradorTexturas adminTexturas = AdministradorTexturas.getInstancia(); Texture texturaDisparoEnemigo0 = adminTexturas.obtenerTextura(NombreTextura.DISPARO_ENEMIGO_0); Texture texturaDisparoEnemigo1 = adminTexturas.obtenerTextura(NombreTextura.DISPARO_ENEMIGO_1); List<Texture> texturasDisparoEnemigo = new ArrayList<Texture>(); texturasDisparoEnemigo.add(texturaDisparoEnemigo0); texturasDisparoEnemigo.add(texturaDisparoEnemigo1); disparo.setTexturasAnimacion(texturasDisparoEnemigo); }
IAdministradorTexturas adminTexturas = AdministradorTexturas.getInstancia(); Texture texturaDisparoEnemigo0 = adminTexturas.obtenerTextura(NombreTextura.DISPARO_ENEMIGO_0); Texture texturaDisparoEnemigo1 = adminTexturas.obtenerTextura(NombreTextura.DISPARO_ENEMIGO_1); List<Texture> texturasDisparoEnemigo = new ArrayList<Texture>(); texturasDisparoEnemigo.add(texturaDisparoEnemigo0); texturasDisparoEnemigo.add(texturaDisparoEnemigo1); disparo.setTexturasAnimacion(texturasDisparoEnemigo); }
/** * Construye las texturas del disparo enemigo. */
Construye las texturas del disparo enemigo
construirTextura
{ "repo_name": "wilmerbz/dp-final-project", "path": "SpaceInvaders/core/src/com/space/invaders/actores/disparos/builder/DisparoEnemigoBuilder.java", "license": "mit", "size": 1474 }
[ "com.badlogic.gdx.graphics.Texture", "com.space.invaders.recursos.texturas.AdministradorTexturas", "com.space.invaders.recursos.texturas.IAdministradorTexturas", "com.space.invaders.recursos.texturas.NombreTextura", "java.util.ArrayList", "java.util.List" ]
import com.badlogic.gdx.graphics.Texture; import com.space.invaders.recursos.texturas.AdministradorTexturas; import com.space.invaders.recursos.texturas.IAdministradorTexturas; import com.space.invaders.recursos.texturas.NombreTextura; import java.util.ArrayList; import java.util.List;
import com.badlogic.gdx.graphics.*; import com.space.invaders.recursos.texturas.*; import java.util.*;
[ "com.badlogic.gdx", "com.space.invaders", "java.util" ]
com.badlogic.gdx; com.space.invaders; java.util;
806,862
public ObservationType getOrInsertObservationType(String observationType, Session session) { ObservationType hObservationType = getObservationTypeObject(observationType, session); if (hObservationType == null) { hObservationType = new ObservationType(); hObservationType.setObservationType(observationType); session.save(hObservationType); session.flush(); } return hObservationType; }
ObservationType function(String observationType, Session session) { ObservationType hObservationType = getObservationTypeObject(observationType, session); if (hObservationType == null) { hObservationType = new ObservationType(); hObservationType.setObservationType(observationType); session.save(hObservationType); session.flush(); } return hObservationType; }
/** * Insert or/and get observation type object for observation type * * @param observationType * Observation type * @param session * Hibernate session * @return Observation type object */
Insert or/and get observation type object for observation type
getOrInsertObservationType
{ "repo_name": "sauloperez/sos", "path": "src/hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/ObservationTypeDAO.java", "license": "apache-2.0", "size": 4477 }
[ "org.hibernate.Session", "org.n52.sos.ds.hibernate.entities.ObservationType" ]
import org.hibernate.Session; import org.n52.sos.ds.hibernate.entities.ObservationType;
import org.hibernate.*; import org.n52.sos.ds.hibernate.entities.*;
[ "org.hibernate", "org.n52.sos" ]
org.hibernate; org.n52.sos;
921,972
@Test public void renameWebParameterField() { // when CTMGClient2 client = new CTMGClient2(); client.getAdminUserInfo(); VOUserDetails voUser = client.createUserAndReturnDetails(); // then // Assert.assertEquals(Locale.ENGLISH.getLanguage(), // voUser.getLocaleNew()); }
void function() { CTMGClient2 client = new CTMGClient2(); client.getAdminUserInfo(); VOUserDetails voUser = client.createUserAndReturnDetails(); }
/** * if the CTMG rename web parameter field in an api upgrade: * * rename VOUserDetails.locale to VOUserDetails.localeNew in * org.oscm.vo.VOUserDetails.java */
if the CTMG rename web parameter field in an api upgrade: rename VOUserDetails.locale to VOUserDetails.localeNew in org.oscm.vo.VOUserDetails.java
renameWebParameterField
{ "repo_name": "opetrovski/development", "path": "oscm-integrationtests-apiversioning-test-client/javasrc/org/oscm/integrationtests/apiversioning/client/CTMGClient2.java", "license": "apache-2.0", "size": 6713 }
[ "org.oscm.vo.VOUserDetails" ]
import org.oscm.vo.VOUserDetails;
import org.oscm.vo.*;
[ "org.oscm.vo" ]
org.oscm.vo;
2,662,585
public int getAccessibleChildrenCount() { TreeModel model = getModel(); if (model != null) return model.getChildCount(model.getRoot()); return 0; }
int function() { TreeModel model = getModel(); if (model != null) return model.getChildCount(model.getRoot()); return 0; }
/** * Returns the number of top-level children nodes of this JTree. * * @return the number of top-level children */
Returns the number of top-level children nodes of this JTree
getAccessibleChildrenCount
{ "repo_name": "shaotuanchen/sunflower_exp", "path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/JTree.java", "license": "bsd-3-clause", "size": 80712 }
[ "javax.swing.tree.TreeModel" ]
import javax.swing.tree.TreeModel;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
1,667,677
int updateByExampleSelective(@Param("record") ItemTimeLogging record, @Param("example") ItemTimeLoggingExample example);
int updateByExampleSelective(@Param(STR) ItemTimeLogging record, @Param(STR) ItemTimeLoggingExample example);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_prj_time_logging * * @mbggenerated Thu Jul 16 10:50:12 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_time_logging
updateByExampleSelective
{ "repo_name": "uniteddiversity/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/dao/ItemTimeLoggingMapper.java", "license": "agpl-3.0", "size": 5778 }
[ "com.esofthead.mycollab.module.project.domain.ItemTimeLogging", "com.esofthead.mycollab.module.project.domain.ItemTimeLoggingExample", "org.apache.ibatis.annotations.Param" ]
import com.esofthead.mycollab.module.project.domain.ItemTimeLogging; import com.esofthead.mycollab.module.project.domain.ItemTimeLoggingExample; import org.apache.ibatis.annotations.Param;
import com.esofthead.mycollab.module.project.domain.*; import org.apache.ibatis.annotations.*;
[ "com.esofthead.mycollab", "org.apache.ibatis" ]
com.esofthead.mycollab; org.apache.ibatis;
1,294,904
public Object[] getMessages() { List<ExceptionMessage> list = new LinkedList<ExceptionMessage>(); if (cause != null) { addMessage(list, cause); } return list.toArray(); }
Object[] function() { List<ExceptionMessage> list = new LinkedList<ExceptionMessage>(); if (cause != null) { addMessage(list, cause); } return list.toArray(); }
/** * Gets the messages. * * @return the messages */
Gets the messages
getMessages
{ "repo_name": "Esleelkartea/aonGTA", "path": "aongta_v1.0.0_src/Fuentes y JavaDoc/aon-ui-common/src/com/code/aon/ui/common/controller/ExceptionBean.java", "license": "gpl-2.0", "size": 4631 }
[ "java.util.LinkedList", "java.util.List" ]
import java.util.LinkedList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,910,320
public synchronized void close() throws InterruptedException { if (!state.isAlive()) { if (LOG.isDebugEnabled()) { LOG.debug("Close called on already closed client"); } return; } if (LOG.isDebugEnabled()) { LOG.debug("Closing session: 0x" + Long.toHexString(getSessionId())); } try { cnxn.close(); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug("Ignoring unexpected exception during close", e); } } LOG.info("Session: 0x" + Long.toHexString(getSessionId()) + " closed"); }
synchronized void function() throws InterruptedException { if (!state.isAlive()) { if (LOG.isDebugEnabled()) { LOG.debug(STR); } return; } if (LOG.isDebugEnabled()) { LOG.debug(STR + Long.toHexString(getSessionId())); } try { cnxn.close(); } catch (IOException e) { if (LOG.isDebugEnabled()) { LOG.debug(STR, e); } } LOG.info(STR + Long.toHexString(getSessionId()) + STR); }
/** * Close this client object. Once the client is closed, its session becomes * invalid. All the ephemeral nodes in the ZooKeeper server associated with * the session will be removed. The watches left on those nodes (and on * their parents) will be triggered. * * @throws InterruptedException */
Close this client object. Once the client is closed, its session becomes invalid. All the ephemeral nodes in the ZooKeeper server associated with the session will be removed. The watches left on those nodes (and on their parents) will be triggered
close
{ "repo_name": "sagarc/zookeeperGla", "path": "src/java/main/org/apache/zookeeper/ZooKeeper.java", "license": "apache-2.0", "size": 62549 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,460,212
public PortletType<T> removePortletInfo() { childNode.removeChildren("portlet-info"); return this; } // --------------------------------------------------------------------------------------------------------|| // ClassName: PortletType ElementName: portlet:portlet-preferencesType ElementType : portlet-preferences // MaxOccurs: - isGeneric: true isAttribute: false isEnum: false isDataType: false // --------------------------------------------------------------------------------------------------------||
PortletType<T> function() { childNode.removeChildren(STR); return this; }
/** * Removes the <code>portlet-info</code> element * @return the current instance of <code>PortletType<T></code> */
Removes the <code>portlet-info</code> element
removePortletInfo
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/portletapp20/PortletTypeImpl.java", "license": "epl-1.0", "size": 33279 }
[ "org.jboss.shrinkwrap.descriptor.api.portletapp20.PortletType" ]
import org.jboss.shrinkwrap.descriptor.api.portletapp20.PortletType;
import org.jboss.shrinkwrap.descriptor.api.portletapp20.*;
[ "org.jboss.shrinkwrap" ]
org.jboss.shrinkwrap;
1,580,439
@SuppressWarnings("unchecked") public static List<DatabaseMetadataType> findAllTypes(String table) throws DatabaseException { log.debug("findAllTypes({})", table); String qs = "from DatabaseMetadataType dmt where dmt.table=:table order by dmt.id asc"; Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(qs); q.setString("table", table); List<DatabaseMetadataType> ret = q.list(); HibernateUtil.commit(tx); log.debug("findAllTypes: {}", ret); return ret; } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
@SuppressWarnings(STR) static List<DatabaseMetadataType> function(String table) throws DatabaseException { log.debug(STR, table); String qs = STR; Session session = null; Transaction tx = null; try { session = HibernateUtil.getSessionFactory().openSession(); tx = session.beginTransaction(); Query q = session.createQuery(qs); q.setString("table", table); List<DatabaseMetadataType> ret = q.list(); HibernateUtil.commit(tx); log.debug(STR, ret); return ret; } catch (HibernateException e) { HibernateUtil.rollback(tx); throw new DatabaseException(e.getMessage(), e); } finally { HibernateUtil.close(session); } }
/** * Find all wiki pages */
Find all wiki pages
findAllTypes
{ "repo_name": "Beau-M/document-management-system", "path": "src/main/java/com/openkm/dao/DatabaseMetadataDAO.java", "license": "gpl-2.0", "size": 12246 }
[ "com.openkm.core.DatabaseException", "com.openkm.dao.bean.DatabaseMetadataType", "java.util.List", "org.hibernate.HibernateException", "org.hibernate.Query", "org.hibernate.Session", "org.hibernate.Transaction" ]
import com.openkm.core.DatabaseException; import com.openkm.dao.bean.DatabaseMetadataType; import java.util.List; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.Transaction;
import com.openkm.core.*; import com.openkm.dao.bean.*; import java.util.*; import org.hibernate.*;
[ "com.openkm.core", "com.openkm.dao", "java.util", "org.hibernate" ]
com.openkm.core; com.openkm.dao; java.util; org.hibernate;
853,405
public void onOriginal(final IImportWizardPanel panel) { final JFileChooser fc = new JFileChooser(); File current = pref.getCurrentPath(); if (current != null) { fc.setCurrentDirectory(current); } FileNameExtensionFilter filter = new FileNameExtensionFilter( "Text File", "txt", "utf8"); fc.setFileFilter(filter); fc.setMultiSelectionEnabled(false); final int returnVal = fc.showOpenDialog(this); pref.setCurrentPath(fc.getCurrentDirectory()); if (returnVal == JFileChooser.APPROVE_OPTION) { File originalFilepath = fc.getSelectedFile(); if (fc.getName(originalFilepath).endsWith(".txt") || fc.getName(originalFilepath).endsWith(".utf8")) { if (originalFilepath.exists()) { setOriginalFile(originalFilepath.getPath()); pref.setOriginalFilePath(originalFilepath); wizardController.setButtonNextEnabled(true); } else { JOptionPane.showMessageDialog(this, getString("MSG.ERROR.FILE_NOTFOUND"), getString("MSG.ERROR"), JOptionPane.ERROR_MESSAGE); setOriginalFile(""); } } // ToDo: remember filename by preferences } }
void function(final IImportWizardPanel panel) { final JFileChooser fc = new JFileChooser(); File current = pref.getCurrentPath(); if (current != null) { fc.setCurrentDirectory(current); } FileNameExtensionFilter filter = new FileNameExtensionFilter( STR, "txt", "utf8"); fc.setFileFilter(filter); fc.setMultiSelectionEnabled(false); final int returnVal = fc.showOpenDialog(this); pref.setCurrentPath(fc.getCurrentDirectory()); if (returnVal == JFileChooser.APPROVE_OPTION) { File originalFilepath = fc.getSelectedFile(); if (fc.getName(originalFilepath).endsWith(".txt") fc.getName(originalFilepath).endsWith(".utf8")) { if (originalFilepath.exists()) { setOriginalFile(originalFilepath.getPath()); pref.setOriginalFilePath(originalFilepath); wizardController.setButtonNextEnabled(true); } else { JOptionPane.showMessageDialog(this, getString(STR), getString(STR), JOptionPane.ERROR_MESSAGE); setOriginalFile(""); } } } }
/** * Action for original file selection. * @param panel this wizard panel. */
Action for original file selection
onOriginal
{ "repo_name": "miurahr/tmpotter", "path": "src/main/java/org/tmpotter/filters/bitext/ImportWizardBiTextFile.java", "license": "gpl-3.0", "size": 20740 }
[ "java.io.File", "javax.swing.JFileChooser", "javax.swing.JOptionPane", "javax.swing.filechooser.FileNameExtensionFilter", "org.tmpotter.ui.wizard.IImportWizardPanel", "org.tmpotter.util.Localization" ]
import java.io.File; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileNameExtensionFilter; import org.tmpotter.ui.wizard.IImportWizardPanel; import org.tmpotter.util.Localization;
import java.io.*; import javax.swing.*; import javax.swing.filechooser.*; import org.tmpotter.ui.wizard.*; import org.tmpotter.util.*;
[ "java.io", "javax.swing", "org.tmpotter.ui", "org.tmpotter.util" ]
java.io; javax.swing; org.tmpotter.ui; org.tmpotter.util;
1,578,492
private void convertToSystemTimeLocked(UsageEvents.Event event) { event.mTimeStamp = Math.max(0, event.mTimeStamp - mRealTimeSnapshot) + mSystemTimeSnapshot; }
void function(UsageEvents.Event event) { event.mTimeStamp = Math.max(0, event.mTimeStamp - mRealTimeSnapshot) + mSystemTimeSnapshot; }
/** * Assuming the event's timestamp is measured in milliseconds since boot, * convert it to a system wall time. */
Assuming the event's timestamp is measured in milliseconds since boot, convert it to a system wall time
convertToSystemTimeLocked
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/com/android/server/usage/UsageStatsService.java", "license": "gpl-3.0", "size": 54611 }
[ "android.app.usage.UsageEvents" ]
import android.app.usage.UsageEvents;
import android.app.usage.*;
[ "android.app" ]
android.app;
2,493,887
public void testRestoreRootVersionFailJcr2() throws RepositoryException { try { versionManager.restore(rootVersion, true); fail("Restore of jcr:rootVersion must throw VersionException."); } catch (VersionException e) { // success } }
void function() throws RepositoryException { try { versionManager.restore(rootVersion, true); fail(STR); } catch (VersionException e) { } }
/** * Test if restoring the root version fails. * * @throws RepositoryException */
Test if restoring the root version fails
testRestoreRootVersionFailJcr2
{ "repo_name": "apache/jackrabbit", "path": "jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/RestoreTest.java", "license": "apache-2.0", "size": 61164 }
[ "javax.jcr.RepositoryException", "javax.jcr.version.VersionException" ]
import javax.jcr.RepositoryException; import javax.jcr.version.VersionException;
import javax.jcr.*; import javax.jcr.version.*;
[ "javax.jcr" ]
javax.jcr;
538,265
public String marshal( Date value ) { String val = ""; if (value != null) { Calendar cal = new GregorianCalendar(); cal.setTime( value ); return DatatypeConverter.printDateTime( cal ); } System.out.println("Date value: " + value); return val; }
String function( Date value ) { String val = STRDate value: " + value); return val; }
/** * Marshal a Date to a String for use by JAXB. * * @param value Date object to marshal. * @return String form of date. */
Marshal a Date to a String for use by JAXB
marshal
{ "repo_name": "intuit/QuickBooks-V3-Java-SDK", "path": "ipp-v3-java-data/src/main/java/com/intuit/sb/cdm/util/v3/DateTimeAdapter.java", "license": "apache-2.0", "size": 1930 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,271,437
public List getExtensionOIDs() { return CertUtils.getExtensionOIDs(entry.getExtensions()); }
List function() { return CertUtils.getExtensionOIDs(entry.getExtensions()); }
/** * Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the * extensions contained in this holder's CRL entry. * * @return a list of extension OIDs. */
Returns a list of ASN1ObjectIdentifier objects representing the OIDs of the extensions contained in this holder's CRL entry
getExtensionOIDs
{ "repo_name": "rex-xxx/mt6572_x201", "path": "external/bouncycastle/bcpkix/src/main/java/org/bouncycastle/cert/X509CRLEntryHolder.java", "license": "gpl-2.0", "size": 3861 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,643,374
private void appendData(String path, DFSClient client, int dataLen) throws IOException { EnumSet<CreateFlag> createFlag = EnumSet.of(CreateFlag.APPEND); HdfsDataOutputStream stream = client.append(path, 1024, createFlag, null, null); byte[] data = new byte[dataLen]; stream.write(data); stream.close(); }
void function(String path, DFSClient client, int dataLen) throws IOException { EnumSet<CreateFlag> createFlag = EnumSet.of(CreateFlag.APPEND); HdfsDataOutputStream stream = client.append(path, 1024, createFlag, null, null); byte[] data = new byte[dataLen]; stream.write(data); stream.close(); }
/** * Append data in specified file. * @param path Path of file. * @param client DFS Client. * @param dataLen The length of write data. * @throws IOException */
Append data in specified file
appendData
{ "repo_name": "steveloughran/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java", "license": "apache-2.0", "size": 52724 }
[ "java.io.IOException", "java.util.EnumSet", "org.apache.hadoop.fs.CreateFlag", "org.apache.hadoop.hdfs.DFSClient", "org.apache.hadoop.hdfs.client.HdfsDataOutputStream" ]
import java.io.IOException; import java.util.EnumSet; import org.apache.hadoop.fs.CreateFlag; import org.apache.hadoop.hdfs.DFSClient; import org.apache.hadoop.hdfs.client.HdfsDataOutputStream;
import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.client.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
115,316
@NotNull() private static byte[] computeSaltedPassword( @NotNull final SCRAMBindRequest bindRequest, @NotNull final SCRAMServerFirstMessage serverFirstMessage) throws LDAPBindException { // Get a MAC generator with the password as the key. final Mac mac = bindRequest.getMac(bindRequest.getPasswordBytes()); // For the first round, the MAC input will be the salt plus the bytes that // comprise the 32-bit representation of the number one. final byte[] salt = serverFirstMessage.getSalt(); byte[] dataToMAC = new byte[salt.length + ONE_BYTES.length]; System.arraycopy(salt, 0, dataToMAC, 0, salt.length); System.arraycopy(ONE_BYTES, 0, dataToMAC, salt.length, ONE_BYTES.length); // Complete the necessary number of rounds of cryptographic processing. // For the first round, just compute the MAC of the salt plus the one bytes. // For all subsequent rounds, compute the MAC of the previous MAC and XOR // that with the previous MAC. byte[] xorBytes = null; for (int i=0; i < serverFirstMessage.getIterationCount(); i++) { final byte[] macResult = mac.doFinal(dataToMAC); if (i == 0) { xorBytes = macResult; } else { for (int j=0; j < macResult.length; j++) { xorBytes[j] ^= macResult[j]; } } dataToMAC = macResult; } // The final XOR result is the salted password. return xorBytes; }
@NotNull() static byte[] function( @NotNull final SCRAMBindRequest bindRequest, @NotNull final SCRAMServerFirstMessage serverFirstMessage) throws LDAPBindException { final Mac mac = bindRequest.getMac(bindRequest.getPasswordBytes()); final byte[] salt = serverFirstMessage.getSalt(); byte[] dataToMAC = new byte[salt.length + ONE_BYTES.length]; System.arraycopy(salt, 0, dataToMAC, 0, salt.length); System.arraycopy(ONE_BYTES, 0, dataToMAC, salt.length, ONE_BYTES.length); byte[] xorBytes = null; for (int i=0; i < serverFirstMessage.getIterationCount(); i++) { final byte[] macResult = mac.doFinal(dataToMAC); if (i == 0) { xorBytes = macResult; } else { for (int j=0; j < macResult.length; j++) { xorBytes[j] ^= macResult[j]; } } dataToMAC = macResult; } return xorBytes; }
/** * Computes the salted password for this client final message from the * provided information. * * @param bindRequest The SCRAM bind request being processed. It * must not be {@code null}. * @param serverFirstMessage The server first message from the first stage * of the authentication process. It must not be * {@code null}. * * @return The salted password that was computed. * * @throws LDAPBindException If a problem is encountered while computing the * salted password. */
Computes the salted password for this client final message from the provided information
computeSaltedPassword
{ "repo_name": "UnboundID/ldapsdk", "path": "src/com/unboundid/ldap/sdk/SCRAMClientFinalMessage.java", "license": "gpl-2.0", "size": 10445 }
[ "com.unboundid.util.NotNull", "javax.crypto.Mac" ]
import com.unboundid.util.NotNull; import javax.crypto.Mac;
import com.unboundid.util.*; import javax.crypto.*;
[ "com.unboundid.util", "javax.crypto" ]
com.unboundid.util; javax.crypto;
1,701,057
public void setAlarm(Alarm alarm) { this.alarmInterface = alarm; }
void function(Alarm alarm) { this.alarmInterface = alarm; }
/** * Sets the alarm. * * @param alarm * the new alarm */
Sets the alarm
setAlarm
{ "repo_name": "snoopconsulting/metrics-alarms", "path": "reporter-config-snoop/src/main/java/com/snoopconsulting/idi/metrics/config/AlarmReporterConfig.java", "license": "apache-2.0", "size": 6199 }
[ "com.snoopconsulting.idi.metrics.alarm.Alarm" ]
import com.snoopconsulting.idi.metrics.alarm.Alarm;
import com.snoopconsulting.idi.metrics.alarm.*;
[ "com.snoopconsulting.idi" ]
com.snoopconsulting.idi;
2,872,359
private MiBandSupport sendUserInfo(TransactionBuilder builder) { LOG.debug("Writing User Info!"); BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_USER_INFO); builder.write(characteristic, MiBandCoordinator.getAnyUserInfo(getDevice().getAddress()).getData()); return this; }
MiBandSupport function(TransactionBuilder builder) { LOG.debug(STR); BluetoothGattCharacteristic characteristic = getCharacteristic(MiBandService.UUID_CHARACTERISTIC_USER_INFO); builder.write(characteristic, MiBandCoordinator.getAnyUserInfo(getDevice().getAddress()).getData()); return this; }
/** * Part of device initialization process. Do not call manually. * * @param builder * @return */
Part of device initialization process. Do not call manually
sendUserInfo
{ "repo_name": "danielegobbetti/Gadgetbridge", "path": "app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java", "license": "agpl-3.0", "size": 32334 }
[ "android.bluetooth.BluetoothGattCharacteristic" ]
import android.bluetooth.BluetoothGattCharacteristic;
import android.bluetooth.*;
[ "android.bluetooth" ]
android.bluetooth;
471,265
public ExecutionResult<RESULTTYPE> forReturnValue(Consumer<RESULTTYPE> consumer){ result.ifPresent(consumer::accept); return this; }
ExecutionResult<RESULTTYPE> function(Consumer<RESULTTYPE> consumer){ result.ifPresent(consumer::accept); return this; }
/** * Method to fluently process the return value of the operation. * @param consumer * the consumer to process the return value * @return * this measure */
Method to fluently process the return value of the operation
forReturnValue
{ "repo_name": "tourniquet-io/tourniquet-junit", "path": "tourniquet-core/src/main/java/io/tourniquet/junit/util/ExecutionResult.java", "license": "apache-2.0", "size": 6863 }
[ "java.util.function.Consumer" ]
import java.util.function.Consumer;
import java.util.function.*;
[ "java.util" ]
java.util;
2,266,695
KeyPairGenerator keyGen; keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(keyLen, new SecureRandom()); KeyPair keypair = keyGen.generateKeyPair(); return keypair; }
KeyPairGenerator keyGen; keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(keyLen, new SecureRandom()); KeyPair keypair = keyGen.generateKeyPair(); return keypair; }
/** * Generates a <code>KeyPair</code> in RSA format. * * @param keyLen - key size * @return KeyPair the key pair * @throws NoSuchAlgorithmException */
Generates a <code>KeyPair</code> in RSA format
makeKeyPair
{ "repo_name": "ama-axelor/axelor-business-suite", "path": "axelor-bank-payment/src/main/java/com/axelor/apps/bankpayment/ebics/certificate/KeyUtil.java", "license": "agpl-3.0", "size": 3950 }
[ "java.security.KeyPair", "java.security.KeyPairGenerator", "java.security.SecureRandom" ]
import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.SecureRandom;
import java.security.*;
[ "java.security" ]
java.security;
1,155,613
public java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI> getSubterm_booleans_InequalityHLAPI() { java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI> retour = new ArrayList<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI>(); for (Term elemnt : getSubterm()) { if (elemnt.getClass().equals(fr.lip6.move.pnml.pthlpng.booleans.impl.InequalityImpl.class)) { retour.add(new fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI( (fr.lip6.move.pnml.pthlpng.booleans.Inequality) elemnt)); } } return retour; }
java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI> function() { java.util.List<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI> retour = new ArrayList<fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI>(); for (Term elemnt : getSubterm()) { if (elemnt.getClass().equals(fr.lip6.move.pnml.pthlpng.booleans.impl.InequalityImpl.class)) { retour.add(new fr.lip6.move.pnml.pthlpng.booleans.hlapi.InequalityHLAPI( (fr.lip6.move.pnml.pthlpng.booleans.Inequality) elemnt)); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of * InequalityHLAPI kind. WARNING : this method can creates a lot of new object * in memory. */
This accessor return a list of encapsulated subelement, only of InequalityHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_booleans_InequalityHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/integers/hlapi/DivisionHLAPI.java", "license": "epl-1.0", "size": 69770 }
[ "fr.lip6.move.pnml.pthlpng.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.pthlpng.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.pthlpng.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
2,327,235
List<Role> getRoles();
List<Role> getRoles();
/** * Returns all Roles ordered by name * * @return populated list of roles */
Returns all Roles ordered by name
getRoles
{ "repo_name": "delphiprogramming/gisgraphy", "path": "src/main/java/com/gisgraphy/dao/LookupDao.java", "license": "lgpl-3.0", "size": 1612 }
[ "com.gisgraphy.model.Role", "java.util.List" ]
import com.gisgraphy.model.Role; import java.util.List;
import com.gisgraphy.model.*; import java.util.*;
[ "com.gisgraphy.model", "java.util" ]
com.gisgraphy.model; java.util;
832,291
@Override public OutputStream putStream() throws IOException { throw new IOException("Can not write to directory " + toRepositoryPath()); }
OutputStream function() throws IOException { throw new IOException(STR + toRepositoryPath()); }
/** * Can not write to virtual root * * @throws IOException * when called */
Can not write to virtual root
putStream
{ "repo_name": "OpenLiberty/open-liberty", "path": "dev/com.ibm.ws.kernel.service/src/com/ibm/ws/kernel/service/location/internal/LocalDirectoryResource.java", "license": "epl-1.0", "size": 3864 }
[ "java.io.IOException", "java.io.OutputStream" ]
import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
2,585,214
protected boolean assetRetirementValidation(AssetRetirementGlobal assetRetirementGlobal, MaintenanceDocument maintenanceDocument) { boolean valid = true; valid &= validateRequiredGlobalFields(assetRetirementGlobal); if (getAssetRetirementService().isAssetRetiredByMerged(assetRetirementGlobal)) { valid &= validateMergeTargetAsset(assetRetirementGlobal); } if (!getAssetService().isDocumentEnrouting(maintenanceDocument)) { valid &= validateRetirementDetails(assetRetirementGlobal, maintenanceDocument); valid &= checkRetireMultipleAssets(assetRetirementGlobal.getRetirementReasonCode(), assetRetirementGlobal.getAssetRetirementGlobalDetails(), new Integer(1), maintenanceDocument); } return valid; }
boolean function(AssetRetirementGlobal assetRetirementGlobal, MaintenanceDocument maintenanceDocument) { boolean valid = true; valid &= validateRequiredGlobalFields(assetRetirementGlobal); if (getAssetRetirementService().isAssetRetiredByMerged(assetRetirementGlobal)) { valid &= validateMergeTargetAsset(assetRetirementGlobal); } if (!getAssetService().isDocumentEnrouting(maintenanceDocument)) { valid &= validateRetirementDetails(assetRetirementGlobal, maintenanceDocument); valid &= checkRetireMultipleAssets(assetRetirementGlobal.getRetirementReasonCode(), assetRetirementGlobal.getAssetRetirementGlobalDetails(), new Integer(1), maintenanceDocument); } return valid; }
/** * Validate Asset Retirement Global and Details. * * @param assetRetirementGlobal * @param maintenanceDocument * @return */
Validate Asset Retirement Global and Details
assetRetirementValidation
{ "repo_name": "ua-eas/ua-kfs-5.3", "path": "work/src/org/kuali/kfs/module/cam/document/validation/impl/AssetRetirementGlobalRule.java", "license": "agpl-3.0", "size": 36013 }
[ "org.kuali.kfs.module.cam.businessobject.AssetRetirementGlobal", "org.kuali.rice.kns.document.MaintenanceDocument" ]
import org.kuali.kfs.module.cam.businessobject.AssetRetirementGlobal; import org.kuali.rice.kns.document.MaintenanceDocument;
import org.kuali.kfs.module.cam.businessobject.*; import org.kuali.rice.kns.document.*;
[ "org.kuali.kfs", "org.kuali.rice" ]
org.kuali.kfs; org.kuali.rice;
1,090,624
public long getCurrentPlayTime() { if (!mInitialized || mPlayingState == STOPPED) { return 0; } return AnimationUtils.currentAnimationTimeMillis() - mStartTime; }
long function() { if (!mInitialized mPlayingState == STOPPED) { return 0; } return AnimationUtils.currentAnimationTimeMillis() - mStartTime; }
/** * Gets the current position of the animation in time, which is equal to the current * time minus the time that the animation started. An animation that is not yet started will * return a value of zero. * * @return The current position in time of the animation. */
Gets the current position of the animation in time, which is equal to the current time minus the time that the animation started. An animation that is not yet started will return a value of zero
getCurrentPlayTime
{ "repo_name": "gerhardol/SwipeStatusBar", "path": "app/src/main/java/com/nineoldandroids/animation/ValueAnimator.java", "license": "gpl-3.0", "size": 40301 }
[ "android.view.animation.AnimationUtils" ]
import android.view.animation.AnimationUtils;
import android.view.animation.*;
[ "android.view" ]
android.view;
2,874,248
public void write(File file) throws FileNotFoundException { PrintStream stream = null; try { stream = new PrintStream(file, IrpUtils.dumbCharsetName); write(stream); stream.close(); } catch (UnsupportedEncodingException ex) { assert false; } }
void function(File file) throws FileNotFoundException { PrintStream stream = null; try { stream = new PrintStream(file, IrpUtils.dumbCharsetName); write(stream); stream.close(); } catch (UnsupportedEncodingException ex) { assert false; } }
/** * Write the instance to a the file in the argument. It is closed. * @param file File to be written. * @throws FileNotFoundException */
Write the instance to a the file in the argument. It is closed
write
{ "repo_name": "probonopd/harctoolboxbundle", "path": "IrpMaster/src/main/java/org/harctoolbox/IrpMaster/LircExport.java", "license": "gpl-3.0", "size": 6708 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.PrintStream", "java.io.UnsupportedEncodingException" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream; import java.io.UnsupportedEncodingException;
import java.io.*;
[ "java.io" ]
java.io;
2,284,989
private Element SetElementText(String xPathExpression, int currentNode) throws JDOMException { String currentPath = getCurrentPath(xPathExpression, currentNode); if (xPathExists(currentPath)) { if (currentPath.equals(xPathExpression)) { org.jdom.Element node = (org.jdom.Element) XPath.selectSingleNode(this.xmlDocument, xPathExpression); return node; } else { return SetElementText(xPathExpression, currentNode + 1); } } else { String childNode = getChildNode(currentPath); String namespace = getCurrentNamespace(currentPath); Element element; if (namespace != null) { Namespace sNS = Namespace.getNamespace(namespace, this.namespaces.get(namespace)); element = new Element(childNode, sNS); // element.setAttribute("someKey", "someValue", Namespace.getNamespace("someONS", // "someOtherNamespace")); } else { element = new Element(childNode); } if (this.xmlDocument.hasRootElement()) { Element node = (Element) XPath.selectSingleNode(this.xmlDocument, getParentPath(currentPath)); node.addContent(element); } else { if (this.xmlDocument.hasRootElement()) { this.xmlDocument.detachRootElement(); } this.xmlDocument.addContent(element); } if (currentPath.equals(xPathExpression)) { return element; } else { return SetElementText(xPathExpression, currentNode + 1); } } }
Element function(String xPathExpression, int currentNode) throws JDOMException { String currentPath = getCurrentPath(xPathExpression, currentNode); if (xPathExists(currentPath)) { if (currentPath.equals(xPathExpression)) { org.jdom.Element node = (org.jdom.Element) XPath.selectSingleNode(this.xmlDocument, xPathExpression); return node; } else { return SetElementText(xPathExpression, currentNode + 1); } } else { String childNode = getChildNode(currentPath); String namespace = getCurrentNamespace(currentPath); Element element; if (namespace != null) { Namespace sNS = Namespace.getNamespace(namespace, this.namespaces.get(namespace)); element = new Element(childNode, sNS); } else { element = new Element(childNode); } if (this.xmlDocument.hasRootElement()) { Element node = (Element) XPath.selectSingleNode(this.xmlDocument, getParentPath(currentPath)); node.addContent(element); } else { if (this.xmlDocument.hasRootElement()) { this.xmlDocument.detachRootElement(); } this.xmlDocument.addContent(element); } if (currentPath.equals(xPathExpression)) { return element; } else { return SetElementText(xPathExpression, currentNode + 1); } } }
/** * Set the element's text value * * @param xPathExpression * The xpath expression for the element * @param value * The value to set the text to * @throws JDOMException */
Set the element's text value
SetElementText
{ "repo_name": "kevinmcgoldrick/Tank", "path": "agent/agent_common/src/main/java/com/intuit/tank/http/xml/GenericXMLHandler.java", "license": "epl-1.0", "size": 11484 }
[ "org.jdom.Element", "org.jdom.JDOMException", "org.jdom.Namespace", "org.jdom.xpath.XPath" ]
import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; import org.jdom.xpath.XPath;
import org.jdom.*; import org.jdom.xpath.*;
[ "org.jdom", "org.jdom.xpath" ]
org.jdom; org.jdom.xpath;
1,926,745
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("vibrate")) { this.vibrate(args.getLong(0)); } else if (action.equals("vibrateWithPattern")) { JSONArray pattern = args.getJSONArray(0); int repeat = args.getInt(1); //add a 0 at the beginning of pattern to align with w3c long[] patternArray = new long[pattern.length()+1]; patternArray[0] = 0; for (int i = 0; i < pattern.length(); i++) { patternArray[i+1] = pattern.getLong(i); } this.vibrateWithPattern(patternArray, repeat); } else if (action.equals("cancelVibration")) { this.cancelVibration(); } else { return false; } // Only alert and confirm are async. callbackContext.success(); return true; }
boolean function(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals(STR)) { this.vibrate(args.getLong(0)); } else if (action.equals(STR)) { JSONArray pattern = args.getJSONArray(0); int repeat = args.getInt(1); long[] patternArray = new long[pattern.length()+1]; patternArray[0] = 0; for (int i = 0; i < pattern.length(); i++) { patternArray[i+1] = pattern.getLong(i); } this.vibrateWithPattern(patternArray, repeat); } else if (action.equals(STR)) { this.cancelVibration(); } else { return false; } callbackContext.success(); return true; }
/** * Executes the request and returns PluginResult. * * @param action The action to execute. * @param args JSONArray of arguments for the plugin. * @param callbackContext The callback context used when calling back into JavaScript. * @return True when the action was valid, false otherwise. */
Executes the request and returns PluginResult
execute
{ "repo_name": "fujunwei/cordova-plugin-vibration", "path": "src/android/Vibration.java", "license": "apache-2.0", "size": 8249 }
[ "org.apache.cordova.CallbackContext", "org.json.JSONArray", "org.json.JSONException" ]
import org.apache.cordova.CallbackContext; import org.json.JSONArray; import org.json.JSONException;
import org.apache.cordova.*; import org.json.*;
[ "org.apache.cordova", "org.json" ]
org.apache.cordova; org.json;
53,790
public void setXMLModel(IDOMModel xmlModel) { fXMLModel = xmlModel; setDocument(fXMLModel.getStructuredDocument()); }
void function(IDOMModel xmlModel) { fXMLModel = xmlModel; setDocument(fXMLModel.getStructuredDocument()); }
/** * set the XMLModel for this adapter. Must be called. * * @param xmlModel */
set the XMLModel for this adapter. Must be called
setXMLModel
{ "repo_name": "ttimbul/eclipse.wst", "path": "bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslationAdapter.java", "license": "epl-1.0", "size": 9176 }
[ "org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel" ]
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.*;
[ "org.eclipse.wst" ]
org.eclipse.wst;
2,612,222
void addMessage(@NotNull CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum, Navigatable navigatable);
void addMessage(@NotNull CompilerMessageCategory category, String message, @Nullable String url, int lineNum, int columnNum, Navigatable navigatable);
/** * Allows to add a message to be shown in Compiler message view, with a specified Navigatable * that is used to navigate to the error location. * * @param category the category of a message (information, error, warning). * @param message the text of the message. * @param url a url to the file to which the message applies, null if not available. * @param lineNum a line number, -1 if not available. * @param columnNum a column number, -1 if not available. * @param navigatable the navigatable pointing to the error location. */
Allows to add a message to be shown in Compiler message view, with a specified Navigatable that is used to navigate to the error location
addMessage
{ "repo_name": "paplorinc/intellij-community", "path": "java/compiler/openapi/src/com/intellij/openapi/compiler/CompileContext.java", "license": "apache-2.0", "size": 5533 }
[ "com.intellij.pom.Navigatable", "org.jetbrains.annotations.NotNull", "org.jetbrains.annotations.Nullable" ]
import com.intellij.pom.Navigatable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
import com.intellij.pom.*; import org.jetbrains.annotations.*;
[ "com.intellij.pom", "org.jetbrains.annotations" ]
com.intellij.pom; org.jetbrains.annotations;
2,648,964
@SideOnly(Side.CLIENT) protected void preparePlayerToSpawn() { if (this.world != null) { while (this.posY > 0.0D && this.posY < 256.0D) { this.setPosition(this.posX, this.posY, this.posZ); if (this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()) { break; } ++this.posY; } this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.rotationPitch = 0.0F; } }
@SideOnly(Side.CLIENT) void function() { if (this.world != null) { while (this.posY > 0.0D && this.posY < 256.0D) { this.setPosition(this.posX, this.posY, this.posZ); if (this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()) { break; } ++this.posY; } this.motionX = 0.0D; this.motionY = 0.0D; this.motionZ = 0.0D; this.rotationPitch = 0.0F; } }
/** * Keeps moving the entity up so it isn't colliding with blocks and other requirements for this entity to be spawned * (only actually used on players though its also on Entity) */
Keeps moving the entity up so it isn't colliding with blocks and other requirements for this entity to be spawned (only actually used on players though its also on Entity)
preparePlayerToSpawn
{ "repo_name": "dafuq360/essenceplusnew", "path": "build/tmp/recompileMc/sources/net/minecraft/entity/Entity.java", "license": "lgpl-2.1", "size": 118537 }
[ "net.minecraftforge.fml.relauncher.Side", "net.minecraftforge.fml.relauncher.SideOnly" ]
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.fml.relauncher.*;
[ "net.minecraftforge.fml" ]
net.minecraftforge.fml;
1,145,983
List<PanelSetting> getSettingsList();
List<PanelSetting> getSettingsList();
/** * Method should return a list of settings, which displayed in the * Information Panel gui as checkboxes. If card doesn't have any settings - * method can return either null or empty list. Each setting is represented * by {@link PanelSetting} object. */
Method should return a list of settings, which displayed in the Information Panel gui as checkboxes. If card doesn't have any settings - method can return either null or empty list. Each setting is represented by <code>PanelSetting</code> object
getSettingsList
{ "repo_name": "Ghostlyr/Nuclear-Control", "path": "src/main/java/shedar/mods/ic2/nuclearcontrol/api/IPanelDataSource.java", "license": "bsd-3-clause", "size": 2941 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,202,231
@NotNull public Enumeration<String> getKeys() { return getKeys(getWrappedBundle()); }
Enumeration<String> function() { return getKeys(getWrappedBundle()); }
/** * Retrieves the bundle keys. * @return such keys. */
Retrieves the bundle keys
getKeys
{ "repo_name": "rydnr/java-commons", "path": "src/main/java/org/acmsl/commons/CachingBundleI14able.java", "license": "gpl-2.0", "size": 16572 }
[ "java.util.Enumeration" ]
import java.util.Enumeration;
import java.util.*;
[ "java.util" ]
java.util;
372,231
public Observable<ServiceResponse<Page<OperationInner>>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<OperationInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Lists all of the available REST API operations of the Microsoft.SignalRService provider. * ServiceResponse<PageImpl<OperationInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;OperationInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Lists all of the available REST API operations of the Microsoft.SignalRService provider
listNextSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/signalr/mgmt-v2018_10_01/src/main/java/com/microsoft/azure/management/signalr/v2018_10_01/implementation/OperationsInner.java", "license": "mit", "size": 14200 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,435,648
public static NodeApiVersions create(Collection<ApiVersion> overrides) { List<ApiVersion> apiVersions = new LinkedList<>(overrides); for (ApiKeys apiKey : ApiKeys.values()) { boolean exists = false; for (ApiVersion apiVersion : apiVersions) { if (apiVersion.apiKey == apiKey.id) { exists = true; break; } } if (!exists) { apiVersions.add(new ApiVersion(apiKey)); } } return new NodeApiVersions(apiVersions); } public NodeApiVersions(Collection<ApiVersion> nodeApiVersions) { for (ApiVersion nodeApiVersion : nodeApiVersions) { if (ApiKeys.hasId(nodeApiVersion.apiKey)) { ApiKeys nodeApiKey = ApiKeys.forId(nodeApiVersion.apiKey); supportedVersions.put(nodeApiKey, nodeApiVersion); } else { // Newer brokers may support ApiKeys we don't know about unknownApis.add(nodeApiVersion); } } }
static NodeApiVersions function(Collection<ApiVersion> overrides) { List<ApiVersion> apiVersions = new LinkedList<>(overrides); for (ApiKeys apiKey : ApiKeys.values()) { boolean exists = false; for (ApiVersion apiVersion : apiVersions) { if (apiVersion.apiKey == apiKey.id) { exists = true; break; } } if (!exists) { apiVersions.add(new ApiVersion(apiKey)); } } return new NodeApiVersions(apiVersions); } public NodeApiVersions(Collection<ApiVersion> nodeApiVersions) { for (ApiVersion nodeApiVersion : nodeApiVersions) { if (ApiKeys.hasId(nodeApiVersion.apiKey)) { ApiKeys nodeApiKey = ApiKeys.forId(nodeApiVersion.apiKey); supportedVersions.put(nodeApiKey, nodeApiVersion); } else { unknownApis.add(nodeApiVersion); } } }
/** * Create a NodeApiVersions object. * * @param overrides API versions to override. Any ApiVersion not specified here will be set to the current client * value. * @return A new NodeApiVersions object. */
Create a NodeApiVersions object
create
{ "repo_name": "KevinLiLu/kafka", "path": "clients/src/main/java/org/apache/kafka/clients/NodeApiVersions.java", "license": "apache-2.0", "size": 8400 }
[ "java.util.Collection", "java.util.LinkedList", "java.util.List", "org.apache.kafka.common.protocol.ApiKeys", "org.apache.kafka.common.requests.ApiVersionsResponse" ]
import java.util.Collection; import java.util.LinkedList; import java.util.List; import org.apache.kafka.common.protocol.ApiKeys; import org.apache.kafka.common.requests.ApiVersionsResponse;
import java.util.*; import org.apache.kafka.common.protocol.*; import org.apache.kafka.common.requests.*;
[ "java.util", "org.apache.kafka" ]
java.util; org.apache.kafka;
840,141
EReference getPSCH_Str();
EReference getPSCH_Str();
/** * Returns the meta object for the reference '{@link gluemodel.substationStandard.LNNodes.LNGroupP.PSCH#getStr <em>Str</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference '<em>Str</em>'. * @see gluemodel.substationStandard.LNNodes.LNGroupP.PSCH#getStr() * @see #getPSCH() * @generated */
Returns the meta object for the reference '<code>gluemodel.substationStandard.LNNodes.LNGroupP.PSCH#getStr Str</code>'.
getPSCH_Str
{ "repo_name": "georghinkel/ttc2017smartGrids", "path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/substationStandard/LNNodes/LNGroupP/LNGroupPPackage.java", "license": "mit", "size": 291175 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
555,106
public SVGAnimatedLength getX() { return x; }
SVGAnimatedLength function() { return x; }
/** * <b>DOM</b>: Implements {@link SVGSVGElement#getX()}. */
DOM: Implements <code>SVGSVGElement#getX()</code>
getX
{ "repo_name": "shyamalschandra/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/svg/SVGOMSVGElement.java", "license": "apache-2.0", "size": 29079 }
[ "org.w3c.dom.svg.SVGAnimatedLength" ]
import org.w3c.dom.svg.SVGAnimatedLength;
import org.w3c.dom.svg.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,308,033
public LoadBalancerProbesClient getLoadBalancerProbes() { return this.loadBalancerProbes; } private final NetworkInterfacesClient networkInterfaces;
LoadBalancerProbesClient function() { return this.loadBalancerProbes; } private final NetworkInterfacesClient networkInterfaces;
/** * Gets the LoadBalancerProbesClient object to access its operations. * * @return the LoadBalancerProbesClient object. */
Gets the LoadBalancerProbesClient object to access its operations
getLoadBalancerProbes
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/NetworkManagementClientImpl.java", "license": "mit", "size": 60665 }
[ "com.azure.resourcemanager.network.fluent.LoadBalancerProbesClient", "com.azure.resourcemanager.network.fluent.NetworkInterfacesClient" ]
import com.azure.resourcemanager.network.fluent.LoadBalancerProbesClient; import com.azure.resourcemanager.network.fluent.NetworkInterfacesClient;
import com.azure.resourcemanager.network.fluent.*;
[ "com.azure.resourcemanager" ]
com.azure.resourcemanager;
1,107,357
default Constraint penalize(String constraintName, Score<?> constraintWeight, ToIntTriFunction<A, B, C> matchWeigher) { return penalize(getConstraintFactory().getDefaultConstraintPackage(), constraintName, constraintWeight, matchWeigher); }
default Constraint penalize(String constraintName, Score<?> constraintWeight, ToIntTriFunction<A, B, C> matchWeigher) { return penalize(getConstraintFactory().getDefaultConstraintPackage(), constraintName, constraintWeight, matchWeigher); }
/** * Negatively impact the {@link Score}: subtract the constraintWeight multiplied by the match weight. * Otherwise as defined by {@link #penalize(String, Score)}. * <p> * For non-int {@link Score} types use {@link #penalizeLong(String, Score, ToLongTriFunction)} or {@link #penalizeBigDecimal(String, Score, TriFunction)} instead. * @param constraintName never null, shows up in {@link ConstraintMatchTotal} during score justification * @param constraintWeight never null * @param matchWeigher never null, the result of this function (matchWeight) is multiplied by the constraintWeight * @return never null */
Negatively impact the <code>Score</code>: subtract the constraintWeight multiplied by the match weight. Otherwise as defined by <code>#penalize(String, Score)</code>. For non-int <code>Score</code> types use <code>#penalizeLong(String, Score, ToLongTriFunction)</code> or <code>#penalizeBigDecimal(String, Score, TriFunction)</code> instead
penalize
{ "repo_name": "baldimir/optaplanner", "path": "optaplanner-core/src/main/java/org/optaplanner/core/api/score/stream/tri/TriConstraintStream.java", "license": "apache-2.0", "size": 17219 }
[ "org.optaplanner.core.api.function.ToIntTriFunction", "org.optaplanner.core.api.score.Score", "org.optaplanner.core.api.score.stream.Constraint" ]
import org.optaplanner.core.api.function.ToIntTriFunction; import org.optaplanner.core.api.score.Score; import org.optaplanner.core.api.score.stream.Constraint;
import org.optaplanner.core.api.function.*; import org.optaplanner.core.api.score.*; import org.optaplanner.core.api.score.stream.*;
[ "org.optaplanner.core" ]
org.optaplanner.core;
428,861
public Map<String, String> getLocalXmlMap() { return xmlMap; }
Map<String, String> function() { return xmlMap; }
/** * Get the local map to all pagexml paths * * @return map to all local xml paths */
Get the local map to all pagexml paths
getLocalXmlMap
{ "repo_name": "chreul/LAREX", "path": "src/main/java/de/uniwue/web/io/FilePathManager.java", "license": "gpl-3.0", "size": 6656 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
261,806
protected int stringEscapes() { return Utilities.JAVA_ESCAPES; }
int function() { return Utilities.JAVA_ESCAPES; }
/** * Get the flags for escaping regular strings. * * @return The flags for escaping strings. */
Get the flags for escaping regular strings
stringEscapes
{ "repo_name": "wandoulabs/xtc-rats", "path": "xtc-core/src/main/java/xtc/parser/PrettyPrinter.java", "license": "lgpl-2.1", "size": 31225 }
[ "xtc.util.Utilities" ]
import xtc.util.Utilities;
import xtc.util.*;
[ "xtc.util" ]
xtc.util;
938,076
public void logWarning(String line) { log(Level.WARNING, "WARNING: " + line); }
void function(String line) { log(Level.WARNING, STR + line); }
/** * Add a warning to the logger. * @param line */
Add a warning to the logger
logWarning
{ "repo_name": "Choco31415/JavaMediawikiBot", "path": "src/main/java/WikiBot/Core/NetworkingBase.java", "license": "gpl-3.0", "size": 10234 }
[ "java.util.logging.Level" ]
import java.util.logging.Level;
import java.util.logging.*;
[ "java.util" ]
java.util;
2,009,987
private RepositoryModel loadRepositoryModel(String repositoryName) { Repository r = getRepository(repositoryName); if (r == null) { return null; } RepositoryModel model = new RepositoryModel(); model.isBare = r.isBare(); File basePath = getFileOrFolder(Keys.git.repositoriesFolder, "${baseFolder}/git"); if (model.isBare) { model.name = com.gitblit.utils.FileUtils.getRelativePath(basePath, r.getDirectory()); } else { model.name = com.gitblit.utils.FileUtils.getRelativePath(basePath, r.getDirectory().getParentFile()); } if (StringUtils.isEmpty(model.name)) { // Repository is NOT located relative to the base folder because it // is symlinked. Use the provided repository name. model.name = repositoryName; } model.hasCommits = JGitUtils.hasCommits(r); model.lastChange = JGitUtils.getLastChange(r); model.projectPath = StringUtils.getFirstPathElement(repositoryName); StoredConfig config = r.getConfig(); boolean hasOrigin = !StringUtils.isEmpty(config.getString("remote", "origin", "url")); if (config != null) { model.description = getConfig(config, "description", ""); model.addOwners(ArrayUtils.fromString(getConfig(config, "owner", ""))); model.useTickets = getConfig(config, "useTickets", false); model.useDocs = getConfig(config, "useDocs", false); model.useIncrementalPushTags = getConfig(config, "useIncrementalPushTags", false); model.incrementalPushTagPrefix = getConfig(config, "incrementalPushTagPrefix", null); model.allowForks = getConfig(config, "allowForks", true); model.accessRestriction = AccessRestrictionType.fromName(getConfig(config, "accessRestriction", settings.getString(Keys.git.defaultAccessRestriction, null))); model.authorizationControl = AuthorizationControl.fromName(getConfig(config, "authorizationControl", settings.getString(Keys.git.defaultAuthorizationControl, null))); model.verifyCommitter = getConfig(config, "verifyCommitter", false); model.showRemoteBranches = getConfig(config, "showRemoteBranches", hasOrigin); model.isFrozen = getConfig(config, "isFrozen", false); model.showReadme = getConfig(config, "showReadme", false); model.skipSizeCalculation = getConfig(config, "skipSizeCalculation", false); model.skipSummaryMetrics = getConfig(config, "skipSummaryMetrics", false); model.federationStrategy = FederationStrategy.fromName(getConfig(config, "federationStrategy", null)); model.federationSets = new ArrayList<String>(Arrays.asList(config.getStringList( Constants.CONFIG_GITBLIT, null, "federationSets"))); model.isFederated = getConfig(config, "isFederated", false); model.gcThreshold = getConfig(config, "gcThreshold", settings.getString(Keys.git.defaultGarbageCollectionThreshold, "500KB")); model.gcPeriod = getConfig(config, "gcPeriod", settings.getInteger(Keys.git.defaultGarbageCollectionPeriod, 7)); try { model.lastGC = new SimpleDateFormat(Constants.ISO8601).parse(getConfig(config, "lastGC", "1970-01-01'T'00:00:00Z")); } catch (Exception e) { model.lastGC = new Date(0); } model.maxActivityCommits = getConfig(config, "maxActivityCommits", settings.getInteger(Keys.web.maxActivityCommits, 0)); model.origin = config.getString("remote", "origin", "url"); if (model.origin != null) { model.origin = model.origin.replace('\\', '/'); } model.preReceiveScripts = new ArrayList<String>(Arrays.asList(config.getStringList( Constants.CONFIG_GITBLIT, null, "preReceiveScript"))); model.postReceiveScripts = new ArrayList<String>(Arrays.asList(config.getStringList( Constants.CONFIG_GITBLIT, null, "postReceiveScript"))); model.mailingLists = new ArrayList<String>(Arrays.asList(config.getStringList( Constants.CONFIG_GITBLIT, null, "mailingList"))); model.indexedBranches = new ArrayList<String>(Arrays.asList(config.getStringList( Constants.CONFIG_GITBLIT, null, "indexBranch"))); // Custom defined properties model.customFields = new LinkedHashMap<String, String>(); for (String aProperty : config.getNames(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS)) { model.customFields.put(aProperty, config.getString(Constants.CONFIG_GITBLIT, Constants.CONFIG_CUSTOM_FIELDS, aProperty)); } } model.HEAD = JGitUtils.getHEADRef(r); model.availableRefs = JGitUtils.getAvailableHeadTargets(r); model.sparkleshareId = JGitUtils.getSparkleshareId(r); r.close(); if (model.origin != null && model.origin.startsWith("file://")) { // repository was cloned locally... perhaps as a fork try { File folder = new File(new URI(model.origin)); String originRepo = com.gitblit.utils.FileUtils.getRelativePath(getRepositoriesFolder(), folder); if (!StringUtils.isEmpty(originRepo)) { // ensure origin still exists File repoFolder = new File(getRepositoriesFolder(), originRepo); if (repoFolder.exists()) { model.originRepository = originRepo.toLowerCase(); } } } catch (URISyntaxException e) { logger.error("Failed to determine fork for " + model, e); } } return model; }
RepositoryModel function(String repositoryName) { Repository r = getRepository(repositoryName); if (r == null) { return null; } RepositoryModel model = new RepositoryModel(); model.isBare = r.isBare(); File basePath = getFileOrFolder(Keys.git.repositoriesFolder, STR); if (model.isBare) { model.name = com.gitblit.utils.FileUtils.getRelativePath(basePath, r.getDirectory()); } else { model.name = com.gitblit.utils.FileUtils.getRelativePath(basePath, r.getDirectory().getParentFile()); } if (StringUtils.isEmpty(model.name)) { model.name = repositoryName; } model.hasCommits = JGitUtils.hasCommits(r); model.lastChange = JGitUtils.getLastChange(r); model.projectPath = StringUtils.getFirstPathElement(repositoryName); StoredConfig config = r.getConfig(); boolean hasOrigin = !StringUtils.isEmpty(config.getString(STR, STR, "url")); if (config != null) { model.description = getConfig(config, STR, STRownerSTRSTRuseTicketsSTRuseDocsSTRuseIncrementalPushTagsSTRincrementalPushTagPrefixSTRallowForksSTRaccessRestrictionSTRauthorizationControlSTRverifyCommitterSTRshowRemoteBranchesSTRisFrozenSTRshowReadmeSTRskipSizeCalculationSTRskipSummaryMetricsSTRfederationStrategySTRfederationSetsSTRisFederatedSTRgcThresholdSTR500KBSTRgcPeriodSTRlastGCSTR1970-01-01'T'00:00:00ZSTRmaxActivityCommits", settings.getInteger(Keys.web.maxActivityCommits, 0)); model.origin = config.getString(STR, STR, "urlSTRpreReceiveScriptSTRpostReceiveScriptSTRmailingListSTRindexBranchSTRfile: try { File folder = new File(new URI(model.origin)); String originRepo = com.gitblit.utils.FileUtils.getRelativePath(getRepositoriesFolder(), folder); if (!StringUtils.isEmpty(originRepo)) { File repoFolder = new File(getRepositoriesFolder(), originRepo); if (repoFolder.exists()) { model.originRepository = originRepo.toLowerCase(); } } } catch (URISyntaxException e) { logger.error(STR + model, e); } } return model; }
/** * Create a repository model from the configuration and repository data. * * @param repositoryName * @return a repositoryModel or null if the repository does not exist */
Create a repository model from the configuration and repository data
loadRepositoryModel
{ "repo_name": "BullShark/IRCBlit", "path": "src/main/java/com/gitblit/GitBlit.java", "license": "apache-2.0", "size": 119961 }
[ "com.gitblit.models.RepositoryModel", "com.gitblit.utils.JGitUtils", "com.gitblit.utils.StringUtils", "java.io.File", "java.net.URISyntaxException", "org.eclipse.jgit.lib.Repository", "org.eclipse.jgit.lib.StoredConfig", "org.eclipse.jgit.util.FileUtils" ]
import com.gitblit.models.RepositoryModel; import com.gitblit.utils.JGitUtils; import com.gitblit.utils.StringUtils; import java.io.File; import java.net.URISyntaxException; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.lib.StoredConfig; import org.eclipse.jgit.util.FileUtils;
import com.gitblit.models.*; import com.gitblit.utils.*; import java.io.*; import java.net.*; import org.eclipse.jgit.lib.*; import org.eclipse.jgit.util.*;
[ "com.gitblit.models", "com.gitblit.utils", "java.io", "java.net", "org.eclipse.jgit" ]
com.gitblit.models; com.gitblit.utils; java.io; java.net; org.eclipse.jgit;
1,491,104
@Test public void testDeserialize() throws Exception { IPv4 ipv4 = deserializer.deserialize(headerBytes, 0, headerBytes.length); assertEquals(version, ipv4.getVersion()); assertEquals(headerLength, ipv4.getHeaderLength()); assertEquals(diffServ, ipv4.getDiffServ()); assertEquals(totalLength, ipv4.getTotalLength()); assertEquals(identification, ipv4.getIdentification()); assertEquals(flags, ipv4.getFlags()); assertEquals(fragmentOffset, ipv4.getFragmentOffset()); assertEquals(ttl, ipv4.getTtl()); assertEquals(protocol, ipv4.getProtocol()); assertEquals(checksum, ipv4.getChecksum()); assertEquals(sourceAddress, ipv4.getSourceAddress()); assertEquals(destinationAddress, ipv4.getDestinationAddress()); assertTrue(ipv4.isTruncated()); }
void function() throws Exception { IPv4 ipv4 = deserializer.deserialize(headerBytes, 0, headerBytes.length); assertEquals(version, ipv4.getVersion()); assertEquals(headerLength, ipv4.getHeaderLength()); assertEquals(diffServ, ipv4.getDiffServ()); assertEquals(totalLength, ipv4.getTotalLength()); assertEquals(identification, ipv4.getIdentification()); assertEquals(flags, ipv4.getFlags()); assertEquals(fragmentOffset, ipv4.getFragmentOffset()); assertEquals(ttl, ipv4.getTtl()); assertEquals(protocol, ipv4.getProtocol()); assertEquals(checksum, ipv4.getChecksum()); assertEquals(sourceAddress, ipv4.getSourceAddress()); assertEquals(destinationAddress, ipv4.getDestinationAddress()); assertTrue(ipv4.isTruncated()); }
/** * Tests deserialize and getters. */
Tests deserialize and getters
testDeserialize
{ "repo_name": "sonu283304/onos", "path": "utils/misc/src/test/java/org/onlab/packet/IPv4Test.java", "license": "apache-2.0", "size": 4433 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,057,227
//------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF public static QuoteId.Meta meta() { return QuoteId.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(QuoteId.Meta.INSTANCE); } private static final long serialVersionUID = 1L; private int cachedHashCode; private QuoteId( StandardId standardId, FieldName fieldName, ObservableSource observableSource) { JodaBeanUtils.notNull(standardId, "standardId"); JodaBeanUtils.notNull(fieldName, "fieldName"); JodaBeanUtils.notNull(observableSource, "observableSource"); this.standardId = standardId; this.fieldName = fieldName; this.observableSource = observableSource; }
static QuoteId.Meta function() { return QuoteId.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(QuoteId.Meta.INSTANCE); } private static final long serialVersionUID = 1L; private int cachedHashCode; private QuoteId( StandardId standardId, FieldName fieldName, ObservableSource observableSource) { JodaBeanUtils.notNull(standardId, STR); JodaBeanUtils.notNull(fieldName, STR); JodaBeanUtils.notNull(observableSource, STR); this.standardId = standardId; this.fieldName = fieldName; this.observableSource = observableSource; }
/** * The meta-bean for {@code QuoteId}. * @return the meta-bean, not null */
The meta-bean for QuoteId
meta
{ "repo_name": "jmptrader/Strata", "path": "modules/market/src/main/java/com/opengamma/strata/market/observable/QuoteId.java", "license": "apache-2.0", "size": 15494 }
[ "com.opengamma.strata.basics.StandardId", "com.opengamma.strata.data.FieldName", "com.opengamma.strata.data.ObservableSource", "org.joda.beans.JodaBeanUtils" ]
import com.opengamma.strata.basics.StandardId; import com.opengamma.strata.data.FieldName; import com.opengamma.strata.data.ObservableSource; import org.joda.beans.JodaBeanUtils;
import com.opengamma.strata.basics.*; import com.opengamma.strata.data.*; import org.joda.beans.*;
[ "com.opengamma.strata", "org.joda.beans" ]
com.opengamma.strata; org.joda.beans;
2,676,276
public AdapterParameteters types(@Nonnull PacketType... packets) { // Set the connection side as well if (connectionSide == null) { for (PacketType type : packets) { this.connectionSide = ConnectionSide.add(this.connectionSide, type.getSender().toSide()); } } this.packets = Preconditions.checkNotNull(packets, "packets cannot be NULL"); if (packets.length == 0) throw new IllegalArgumentException("Passed an empty packet type array."); return this; }
AdapterParameteters function(@Nonnull PacketType... packets) { if (connectionSide == null) { for (PacketType type : packets) { this.connectionSide = ConnectionSide.add(this.connectionSide, type.getSender().toSide()); } } this.packets = Preconditions.checkNotNull(packets, STR); if (packets.length == 0) throw new IllegalArgumentException(STR); return this; }
/** * Set the packet types the listener is looking for. * <p> * This parameter is required. * @param packets - the packet types to look for. * @return This builder, for chaining. */
Set the packet types the listener is looking for. This parameter is required
types
{ "repo_name": "aadnk/ProtocolLib", "path": "src/main/java/com/comphenix/protocol/events/PacketAdapter.java", "license": "gpl-2.0", "size": 14709 }
[ "com.comphenix.protocol.PacketType", "com.google.common.base.Preconditions", "javax.annotation.Nonnull" ]
import com.comphenix.protocol.PacketType; import com.google.common.base.Preconditions; import javax.annotation.Nonnull;
import com.comphenix.protocol.*; import com.google.common.base.*; import javax.annotation.*;
[ "com.comphenix.protocol", "com.google.common", "javax.annotation" ]
com.comphenix.protocol; com.google.common; javax.annotation;
1,896,511
@Override public String getSignature(String word, int loc) { final String BASE_LABEL = "UNK"; StringBuilder sb = new StringBuilder(BASE_LABEL); switch (unknownLevel) { case 1: //Marie's initial attempt sb.append(FrenchUnknownWordSignatures.nounSuffix(word)); if(sb.toString().equals(BASE_LABEL)) { sb.append(FrenchUnknownWordSignatures.adjSuffix(word)); if(sb.toString().equals(BASE_LABEL)) { sb.append(FrenchUnknownWordSignatures.verbSuffix(word)); if(sb.toString().equals(BASE_LABEL)) { sb.append(FrenchUnknownWordSignatures.advSuffix(word)); } } } sb.append(FrenchUnknownWordSignatures.possiblePlural(word)); String hasDigit = FrenchUnknownWordSignatures.hasDigit(word); String isDigit = FrenchUnknownWordSignatures.isDigit(word); if( ! hasDigit.equals("")) { if(isDigit.equals("")) { sb.append(hasDigit); } else { sb.append(isDigit); } } // if(FrenchUnknownWordSignatures.isPunc(word).equals("")) sb.append(FrenchUnknownWordSignatures.hasPunc(word)); // else // sb.append(FrenchUnknownWordSignatures.isPunc(word)); sb.append(FrenchUnknownWordSignatures.isAllCaps(word)); if(loc > 0) { if(FrenchUnknownWordSignatures.isAllCaps(word).equals("")) sb.append(FrenchUnknownWordSignatures.isCapitalized(word)); } //Backoff to suffix if we haven't matched anything else if(unknownSuffixSize > 0 && sb.toString().equals(BASE_LABEL)) { int min = word.length() < unknownSuffixSize ? word.length(): unknownSuffixSize; sb.append('-').append(word.substring(word.length() - min)); } break; default: System.err.printf("%s: Invalid unknown word signature! (%d)%n", this.getClass().getName(),unknownLevel); } return sb.toString(); }
String function(String word, int loc) { final String BASE_LABEL = "UNK"; StringBuilder sb = new StringBuilder(BASE_LABEL); switch (unknownLevel) { case 1: sb.append(FrenchUnknownWordSignatures.nounSuffix(word)); if(sb.toString().equals(BASE_LABEL)) { sb.append(FrenchUnknownWordSignatures.adjSuffix(word)); if(sb.toString().equals(BASE_LABEL)) { sb.append(FrenchUnknownWordSignatures.verbSuffix(word)); if(sb.toString().equals(BASE_LABEL)) { sb.append(FrenchUnknownWordSignatures.advSuffix(word)); } } } sb.append(FrenchUnknownWordSignatures.possiblePlural(word)); String hasDigit = FrenchUnknownWordSignatures.hasDigit(word); String isDigit = FrenchUnknownWordSignatures.isDigit(word); if( ! hasDigit.equals(STRSTRSTR%s: Invalid unknown word signature! (%d)%n", this.getClass().getName(),unknownLevel); } return sb.toString(); }
/** * TODO Can add various signatures, setting the signature via Options. * * @param word The word to make a signature for * @param loc Its position in the sentence (mainly so sentence-initial * capitalized words can be treated differently) * @return A String that is its signature (equivalence class) */
TODO Can add various signatures, setting the signature via Options
getSignature
{ "repo_name": "tabladrum/CoreNLP", "path": "src/edu/stanford/nlp/parser/lexparser/FrenchUnknownWordModel.java", "license": "gpl-2.0", "size": 5047 }
[ "edu.stanford.nlp.international.french.FrenchUnknownWordSignatures" ]
import edu.stanford.nlp.international.french.FrenchUnknownWordSignatures;
import edu.stanford.nlp.international.french.*;
[ "edu.stanford.nlp" ]
edu.stanford.nlp;
383,770
public @ColorInt int getHighlightColor() { return mHighlightColor; }
@ColorInt int function() { return mHighlightColor; }
/** * Returns the color used to highlight the drop target. * * @return The drop target highlight color. * @see #hasHighlightColor() */
Returns the color used to highlight the drop target
getHighlightColor
{ "repo_name": "AndroidX/androidx", "path": "draganddrop/draganddrop/src/main/java/androidx/draganddrop/DropHelper.java", "license": "apache-2.0", "size": 22943 }
[ "androidx.annotation.ColorInt" ]
import androidx.annotation.ColorInt;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
2,377,558
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) { // determine line coverage for class if (qName.equals("class") || qName.equals("package")) { // store class name className = attributes.getValue("name"); String lineCoverageAttribute = attributes.getValue("line-rate"); if (lineCoverageAttribute != null) { double lineCoverage = Double .parseDouble(lineCoverageAttribute); lineCoverageMap.put(className, lineCoverage); } } // detect uncovered methods, make sure we are inside a class if (qName.equals("method") && className != null) { String methodName = attributes.getValue("name"); String lineCoverageAttribute = attributes.getValue("line-rate"); double lineCoverage = Double.parseDouble(lineCoverageAttribute); String branchCoverageAttribute = attributes .getValue("line-rate"); double branchCoverage = Double .parseDouble(branchCoverageAttribute); // if line coverage and branch coverage is zero, this method // wasn't touched at all if (lineCoverage == 0.0 && branchCoverage == 0.0) { String signature = attributes.getValue("signature"); // BCEL creates a readable representation of the // '(Ljava/lang/String;)Z'-stuff String description = Utility.methodSignatureToString( signature, methodName, "", true); uncoveredMethods.add(className, description); } } } }
void function(String uri, String localName, String qName, Attributes attributes) { if (qName.equals("class") qName.equals(STR)) { className = attributes.getValue("name"); String lineCoverageAttribute = attributes.getValue(STR); if (lineCoverageAttribute != null) { double lineCoverage = Double .parseDouble(lineCoverageAttribute); lineCoverageMap.put(className, lineCoverage); } } if (qName.equals(STR) && className != null) { String methodName = attributes.getValue("name"); String lineCoverageAttribute = attributes.getValue(STR); double lineCoverage = Double.parseDouble(lineCoverageAttribute); String branchCoverageAttribute = attributes .getValue(STR); double branchCoverage = Double .parseDouble(branchCoverageAttribute); if (lineCoverage == 0.0 && branchCoverage == 0.0) { String signature = attributes.getValue(STR); String description = Utility.methodSignatureToString( signature, methodName, "", true); uncoveredMethods.add(className, description); } } } }
/** * Select elements with names "class" and "package", extract there name * and line coverage value and store them in * {@link CoberturaCoverageAdapter#lineCoverageMap}. */
Select elements with names "class" and "package", extract there name and line coverage value and store them in <code>CoberturaCoverageAdapter#lineCoverageMap</code>
startElement
{ "repo_name": "vimaier/conqat", "path": "org.conqat.engine.java/src/org/conqat/engine/java/adapter/CoberturaCoverageAdapter.java", "license": "apache-2.0", "size": 7305 }
[ "org.apache.bcel.classfile.Utility", "org.xml.sax.Attributes" ]
import org.apache.bcel.classfile.Utility; import org.xml.sax.Attributes;
import org.apache.bcel.classfile.*; import org.xml.sax.*;
[ "org.apache.bcel", "org.xml.sax" ]
org.apache.bcel; org.xml.sax;
2,424,050
@Override public final void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException { if (isDamaged) { throw new ReParseException(); } if (modid != null) { reparser.updateLocation(modid.getLocation()); } ISubReference subreference; for (int i = 0, size = subReferences.size(); i < size; i++) { subreference = subReferences.get(i); subreference.updateSyntax(reparser, false); reparser.updateLocation(subreference.getLocation()); } }
final void function(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException { if (isDamaged) { throw new ReParseException(); } if (modid != null) { reparser.updateLocation(modid.getLocation()); } ISubReference subreference; for (int i = 0, size = subReferences.size(); i < size; i++) { subreference = subReferences.get(i); subreference.updateSyntax(reparser, false); reparser.updateLocation(subreference.getLocation()); } }
/** * Handles the incremental parsing of this reference. * * @param reparser * the parser doing the incremental parsing. * @param isDamaged * true if the location contains the damaged area, false * if only its' location needs to be updated. * */
Handles the incremental parsing of this reference
updateSyntax
{ "repo_name": "eroslevi/titan.EclipsePlug-ins", "path": "org.eclipse.titan.designer/src/org/eclipse/titan/designer/AST/Reference.java", "license": "epl-1.0", "size": 26889 }
[ "org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException", "org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater" ]
import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException; import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater;
import org.eclipse.titan.designer.parsers.ttcn3parser.*;
[ "org.eclipse.titan" ]
org.eclipse.titan;
434,490
@XmlElement(required = true) public String getComment() { return comment; }
@XmlElement(required = true) String function() { return comment; }
/** * free text for reference */
free text for reference
getComment
{ "repo_name": "APNIC-net/whois", "path": "whois-api/src/main/java/net/ripe/db/whois/api/acl/Proxy.java", "license": "bsd-3-clause", "size": 992 }
[ "javax.xml.bind.annotation.XmlElement" ]
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.*;
[ "javax.xml" ]
javax.xml;
2,868,033
protected boolean canPlaceBlockOn(Block p_149854_1_) { return p_149854_1_ == MineHr.blockStage; }
boolean function(Block p_149854_1_) { return p_149854_1_ == MineHr.blockStage; }
/** * is the block grass, dirt or farmland */
is the block grass, dirt or farmland
canPlaceBlockOn
{ "repo_name": "npomroy/MineHr", "path": "src/main/java/com/kraz/minehr/blocks/BlockMHDrying.java", "license": "gpl-3.0", "size": 6912 }
[ "com.kraz.minehr.MineHr", "net.minecraft.block.Block" ]
import com.kraz.minehr.MineHr; import net.minecraft.block.Block;
import com.kraz.minehr.*; import net.minecraft.block.*;
[ "com.kraz.minehr", "net.minecraft.block" ]
com.kraz.minehr; net.minecraft.block;
1,039,655
public Optional<RyaDetails> getDetails(final String instanceName) throws InstanceDoesNotExistException, RyaClientException;
Optional<RyaDetails> function(final String instanceName) throws InstanceDoesNotExistException, RyaClientException;
/** * Get configuration and maintenance information about a specific instance of Rya. * * @param instanceName - Indicates which Rya instance to fetch the details from. (not null) * @return The {@link RyaDetails} that describe the instance of Rya. If this is * an older version of Rya, then there may not be any details to fetch. If * this is the case, empty is returned. * @throws InstanceDoesNotExistException No instance of Rya exists for the provided name. * @throws RyaClientException Something caused the command to fail. */
Get configuration and maintenance information about a specific instance of Rya
getDetails
{ "repo_name": "isper3at/incubator-rya", "path": "common/rya.api/src/main/java/mvm/rya/api/client/GetInstanceDetails.java", "license": "apache-2.0", "size": 1851 }
[ "com.google.common.base.Optional" ]
import com.google.common.base.Optional;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,300,058
HttpURLConnection connection = (HttpURLConnection) tokenEndpoint.openConnection(); JsonObject data = prepareExchangeRefreshTokenForTokensData(refreshToken, clientId); JsonObject jsonObject = postRequest(connection, data.toString()); String newAccessToken = jsonObject.getString(AuthConstants.OAuth2.ACCESS_TOKEN); String newRefreshToken = jsonObject.getString(AuthConstants.OAuth2.REFRESH_TOKEN); int expiresIn = jsonObject.getInt(AuthConstants.OAuth2.EXPIRES_IN); return new OAuth2TokensForPkce(clientId, newAccessToken, newRefreshToken, expiresIn); }
HttpURLConnection connection = (HttpURLConnection) tokenEndpoint.openConnection(); JsonObject data = prepareExchangeRefreshTokenForTokensData(refreshToken, clientId); JsonObject jsonObject = postRequest(connection, data.toString()); String newAccessToken = jsonObject.getString(AuthConstants.OAuth2.ACCESS_TOKEN); String newRefreshToken = jsonObject.getString(AuthConstants.OAuth2.REFRESH_TOKEN); int expiresIn = jsonObject.getInt(AuthConstants.OAuth2.EXPIRES_IN); return new OAuth2TokensForPkce(clientId, newAccessToken, newRefreshToken, expiresIn); }
/** * Uses the LWA service to fetch an access token and refresh token in exchange for a refresh token and clientId. * Expected use case of this method: refreshing tokens once the initial provisioning is complete and normal * usage of the device is ready to commence. * * @param refreshToken received from the initial provisioning request * @param clientId of the security profile associated with the companion app * @return {@link OAuth2AccessToken} object containing the access token and refresh token * @throws IOException */
Uses the LWA service to fetch an access token and refresh token in exchange for a refresh token and clientId. Expected use case of this method: refreshing tokens once the initial provisioning is complete and normal usage of the device is ready to commence
exchangeRefreshTokenForTokens
{ "repo_name": "JLyons1985/SmartVanityMirror", "path": "src/main/java/com/amazon/alexa/avs/auth/companionapp/OAuth2ClientForPkce.java", "license": "apache-2.0", "size": 7459 }
[ "com.amazon.alexa.avs.auth.AuthConstants", "java.net.HttpURLConnection", "javax.json.JsonObject" ]
import com.amazon.alexa.avs.auth.AuthConstants; import java.net.HttpURLConnection; import javax.json.JsonObject;
import com.amazon.alexa.avs.auth.*; import java.net.*; import javax.json.*;
[ "com.amazon.alexa", "java.net", "javax.json" ]
com.amazon.alexa; java.net; javax.json;
2,528,527
public XContentBuilder toJsonFormat(DeleteMarker deleteMarker, String namespace, String bucketName, Date collectionTime) { return toJsonFormat( deleteMarker, namespace, bucketName, collectionTime, null); }
XContentBuilder function(DeleteMarker deleteMarker, String namespace, String bucketName, Date collectionTime) { return toJsonFormat( deleteMarker, namespace, bucketName, collectionTime, null); }
/** * Converts Object data in JSON format for Elasticsearch * * @param deleteMarker - deleteMarker * @param namespace - namespace * @param bucketName - bucket name * @param collectionTime - collection time * @return XContentBuilders */
Converts Object data in JSON format for Elasticsearch
toJsonFormat
{ "repo_name": "carone1/ecs-dashboard", "path": "ecs-metadata-elasticsearch-dao/src/main/java/com/emc/ecs/metadata/dao/elasticsearch/ElasticS3ObjectDAO.java", "license": "mit", "size": 29830 }
[ "com.emc.object.s3.bean.DeleteMarker", "java.util.Date", "org.elasticsearch.common.xcontent.XContentBuilder" ]
import com.emc.object.s3.bean.DeleteMarker; import java.util.Date; import org.elasticsearch.common.xcontent.XContentBuilder;
import com.emc.object.s3.bean.*; import java.util.*; import org.elasticsearch.common.xcontent.*;
[ "com.emc.object", "java.util", "org.elasticsearch.common" ]
com.emc.object; java.util; org.elasticsearch.common;
1,286,146
PcapCode pcapSetDataLink(DataLinkType dataLinkType) throws PcapCloseException;
PcapCode pcapSetDataLink(DataLinkType dataLinkType) throws PcapCloseException;
/** * Set the current data link type of the pcap descriptor to the type * specified by dlt. -1 is returned on failure. * @param dataLinkType data link type. * @return -1 on error, 0 otherwise. * @throws PcapCloseException pcap close exception. * @since 1.1.4 */
Set the current data link type of the pcap descriptor to the type specified by dlt. -1 is returned on failure
pcapSetDataLink
{ "repo_name": "ardikars/Jxpcap", "path": "jxnet-context/src/main/java/com/ardikars/jxnet/Context.java", "license": "lgpl-3.0", "size": 20491 }
[ "com.ardikars.jxnet.exception.PcapCloseException" ]
import com.ardikars.jxnet.exception.PcapCloseException;
import com.ardikars.jxnet.exception.*;
[ "com.ardikars.jxnet" ]
com.ardikars.jxnet;
2,573,023
public ProvisioningState provisioningState() { return this.provisioningState; }
ProvisioningState function() { return this.provisioningState; }
/** * Get the provisioning state of the network interface resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'. * * @return the provisioningState value */
Get the provisioning state of the network interface resource. Possible values include: 'Succeeded', 'Updating', 'Deleting', 'Failed'
provisioningState
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/NetworkInterfaceInner.java", "license": "mit", "size": 9525 }
[ "com.microsoft.azure.management.network.v2020_03_01.ProvisioningState" ]
import com.microsoft.azure.management.network.v2020_03_01.ProvisioningState;
import com.microsoft.azure.management.network.v2020_03_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
651,347
private void checka() throws DatatypeException, IOException { if (context.length() == 0) { appendToContext(current); } current = reader.read(); appendToContext(current); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportNonNumber('a', current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } checkArg('a', "rx radius"); skipCommaSpaces(); checkArg('a', "ry radius"); skipCommaSpaces(); checkArg('a', "x-axis-rotation"); skipCommaSpaces(); switch (current) { default: reportUnexpected("\u201c0\u201d or \u201c1\u201d " + "for large-arc-flag for \u201ca\u201d command", current); skipSubPath(); return; case '0': case '1': break; } current = reader.read(); appendToContext(current); skipCommaSpaces(); switch (current) { default: reportUnexpected("\u201c0\u201d or \u201c1\u201d " + "for sweep-flag for \u201ca\u201d command", current); skipSubPath(); return; case '0': case '1': break; } current = reader.read(); appendToContext(current); skipCommaSpaces(); checkArg('a', "x coordinate"); skipCommaSpaces(); checkArg('a', "y coordinate"); expectNumber = skipCommaSpaces2(); } }
void function() throws DatatypeException, IOException { if (context.length() == 0) { appendToContext(current); } current = reader.read(); appendToContext(current); skipSpaces(); boolean expectNumber = true; for (;;) { switch (current) { default: if (expectNumber) reportNonNumber('a', current); return; case '+': case '-': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': break; } checkArg('a', STR); skipCommaSpaces(); checkArg('a', STR); skipCommaSpaces(); checkArg('a', STR); skipCommaSpaces(); switch (current) { default: reportUnexpected(STR + STR, current); skipSubPath(); return; case '0': case '1': break; } current = reader.read(); appendToContext(current); skipCommaSpaces(); switch (current) { default: reportUnexpected(STR + STR, current); skipSubPath(); return; case '0': case '1': break; } current = reader.read(); appendToContext(current); skipCommaSpaces(); checkArg('a', STR); skipCommaSpaces(); checkArg('a', STR); expectNumber = skipCommaSpaces2(); } }
/** * Checks an 'a' command. */
Checks an 'a' command
checka
{ "repo_name": "YOTOV-LIMITED/validator", "path": "src/nu/validator/datatype/SvgPathData.java", "license": "mit", "size": 40310 }
[ "java.io.IOException", "org.relaxng.datatype.DatatypeException" ]
import java.io.IOException; import org.relaxng.datatype.DatatypeException;
import java.io.*; import org.relaxng.datatype.*;
[ "java.io", "org.relaxng.datatype" ]
java.io; org.relaxng.datatype;
1,783,979
Transport.Connection getConnection(String clusterAlias, DiscoveryNode node) { if (clusterAlias == null) { return transportService.getConnection(node); } else { return transportService.getRemoteClusterService().getConnection(node, clusterAlias); } } final class ConnectionCountingHandler<Response extends TransportResponse> extends ActionListenerResponseHandler<Response> { private final Map<String, Long> clientConnections; private final String nodeId; ConnectionCountingHandler(final ActionListener<? super Response> listener, final Supplier<Response> responseSupplier, final Map<String, Long> clientConnections, final String nodeId) { super(listener, responseSupplier); this.clientConnections = clientConnections; this.nodeId = nodeId; // Increment the number of connections for this node by one clientConnections.compute(nodeId, (id, conns) -> conns == null ? 1 : conns + 1); }
Transport.Connection getConnection(String clusterAlias, DiscoveryNode node) { if (clusterAlias == null) { return transportService.getConnection(node); } else { return transportService.getRemoteClusterService().getConnection(node, clusterAlias); } } final class ConnectionCountingHandler<Response extends TransportResponse> extends ActionListenerResponseHandler<Response> { private final Map<String, Long> clientConnections; private final String nodeId; ConnectionCountingHandler(final ActionListener<? super Response> listener, final Supplier<Response> responseSupplier, final Map<String, Long> clientConnections, final String nodeId) { super(listener, responseSupplier); this.clientConnections = clientConnections; this.nodeId = nodeId; clientConnections.compute(nodeId, (id, conns) -> conns == null ? 1 : conns + 1); }
/** * Returns a connection to the given node on the provided cluster. If the cluster alias is <code>null</code> the node will be resolved * against the local cluster. * @param clusterAlias the cluster alias the node should be resolve against * @param node the node to resolve * @return a connection to the given node belonging to the cluster with the provided alias. */
Returns a connection to the given node on the provided cluster. If the cluster alias is <code>null</code> the node will be resolved against the local cluster
getConnection
{ "repo_name": "Stacey-Gammon/elasticsearch", "path": "core/src/main/java/org/elasticsearch/action/search/SearchTransportService.java", "license": "apache-2.0", "size": 28288 }
[ "java.util.Map", "java.util.function.Supplier", "org.elasticsearch.action.ActionListener", "org.elasticsearch.action.ActionListenerResponseHandler", "org.elasticsearch.cluster.node.DiscoveryNode", "org.elasticsearch.transport.Transport", "org.elasticsearch.transport.TransportResponse" ]
import java.util.Map; import java.util.function.Supplier; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListenerResponseHandler; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.transport.Transport; import org.elasticsearch.transport.TransportResponse;
import java.util.*; import java.util.function.*; import org.elasticsearch.action.*; import org.elasticsearch.cluster.node.*; import org.elasticsearch.transport.*;
[ "java.util", "org.elasticsearch.action", "org.elasticsearch.cluster", "org.elasticsearch.transport" ]
java.util; org.elasticsearch.action; org.elasticsearch.cluster; org.elasticsearch.transport;
1,694,281
private static HBaseColumnName getHBaseColumnName(String family, String qualifier) { return new HBaseColumnName(Bytes.toBytes(family), Bytes.toBytes(qualifier)); }
static HBaseColumnName function(String family, String qualifier) { return new HBaseColumnName(Bytes.toBytes(family), Bytes.toBytes(qualifier)); }
/** * Turns a family:qualifier string into an HBaseColumnName. * * @param family The HBase family. * @param qualifier the HBase qualifier. * @return An HBaseColumnName instance. */
Turns a family:qualifier string into an HBaseColumnName
getHBaseColumnName
{ "repo_name": "rpinzon/kiji-schema", "path": "kiji-schema/src/test/java/org/kiji/schema/layout/impl/hbase/TestIdentityColumnNameTranslator.java", "license": "apache-2.0", "size": 5894 }
[ "org.apache.hadoop.hbase.util.Bytes", "org.kiji.schema.hbase.HBaseColumnName" ]
import org.apache.hadoop.hbase.util.Bytes; import org.kiji.schema.hbase.HBaseColumnName;
import org.apache.hadoop.hbase.util.*; import org.kiji.schema.hbase.*;
[ "org.apache.hadoop", "org.kiji.schema" ]
org.apache.hadoop; org.kiji.schema;
2,709,375
public FriendsGetSuggestionsQuery getSuggestions(UserActor actor) { return new FriendsGetSuggestionsQuery(getClient(), actor); }
FriendsGetSuggestionsQuery function(UserActor actor) { return new FriendsGetSuggestionsQuery(getClient(), actor); }
/** * Returns a list of profiles of users whom the current user may know. * * @param actor vk actor * @return query */
Returns a list of profiles of users whom the current user may know
getSuggestions
{ "repo_name": "VKCOM/vk-java-sdk", "path": "sdk/src/main/java/com/vk/api/sdk/actions/Friends.java", "license": "mit", "size": 11957 }
[ "com.vk.api.sdk.client.actors.UserActor", "com.vk.api.sdk.queries.friends.FriendsGetSuggestionsQuery" ]
import com.vk.api.sdk.client.actors.UserActor; import com.vk.api.sdk.queries.friends.FriendsGetSuggestionsQuery;
import com.vk.api.sdk.client.actors.*; import com.vk.api.sdk.queries.friends.*;
[ "com.vk.api" ]
com.vk.api;
1,504,500
boolean maybeHandlePrototypePrefix(JSModule module, Scope scope, Node n, Node parent, String name) { // We use a string-based approach instead of inspecting the parse tree // to avoid complexities with object literals, possibly nested, beneath // assignments. int numLevelsToRemove; String prefix; if (name.endsWith(".prototype")) { numLevelsToRemove = 1; prefix = name.substring(0, name.length() - 10); } else { int i = name.indexOf(".prototype."); if (i == -1) { return false; } prefix = name.substring(0, i); numLevelsToRemove = 2; i = name.indexOf('.', i + 11); while (i >= 0) { numLevelsToRemove++; i = name.indexOf('.', i + 1); } } if (parent != null && NodeUtil.isObjectLitKey(n)) { // Object literal keys have no prefix that's referenced directly per // key, so we're done. return true; } for (int i = 0; i < numLevelsToRemove; i++) { parent = n; n = n.getFirstChild(); } handleGet(module, scope, n, parent, prefix, Ref.Type.PROTOTYPE_GET); return true; }
boolean maybeHandlePrototypePrefix(JSModule module, Scope scope, Node n, Node parent, String name) { int numLevelsToRemove; String prefix; if (name.endsWith(STR)) { numLevelsToRemove = 1; prefix = name.substring(0, name.length() - 10); } else { int i = name.indexOf(STR); if (i == -1) { return false; } prefix = name.substring(0, i); numLevelsToRemove = 2; i = name.indexOf('.', i + 11); while (i >= 0) { numLevelsToRemove++; i = name.indexOf('.', i + 1); } } if (parent != null && NodeUtil.isObjectLitKey(n)) { return true; } for (int i = 0; i < numLevelsToRemove; i++) { parent = n; n = n.getFirstChild(); } handleGet(module, scope, n, parent, prefix, Ref.Type.PROTOTYPE_GET); return true; }
/** * Updates our representation of the global namespace to reflect a read * of a global name's longest prefix before the "prototype" property if the * name includes the "prototype" property. Does nothing otherwise. * * @param module The current module * @param scope The current scope * @param n The node currently being visited * @param parent {@code n}'s parent * @param name The global name (e.g. "a" or "a.b.c.d") * @return Whether the name was handled */
Updates our representation of the global namespace to reflect a read of a global name's longest prefix before the "prototype" property if the name includes the "prototype" property. Does nothing otherwise
maybeHandlePrototypePrefix
{ "repo_name": "Medium/closure-compiler", "path": "src/com/google/javascript/jscomp/GlobalNamespace.java", "license": "apache-2.0", "size": 43810 }
[ "com.google.javascript.rhino.Node" ]
import com.google.javascript.rhino.Node;
import com.google.javascript.rhino.*;
[ "com.google.javascript" ]
com.google.javascript;
330,537
protected void decorateWithCommonQualifiers(List<Map<String, String>> qualifiers, Document document, DocumentEntry documentEntry, String routeLevel) { for (Map<String, String> qualifier : qualifiers) { addCommonQualifiersToMap(qualifier, document, documentEntry, routeLevel); } }
void function(List<Map<String, String>> qualifiers, Document document, DocumentEntry documentEntry, String routeLevel) { for (Map<String, String> qualifier : qualifiers) { addCommonQualifiersToMap(qualifier, document, documentEntry, routeLevel); } }
/** * Add common qualifiers to every Map<String, String> in the given List of Map<String, String> * @param qualifiers a List of Map<String, String>s to add common qualifiers to * @param document the document currently being routed * @param documentEntry the data dictionary entry of the type of document currently being routed * @param routeLevel the document's current route level */
Add common qualifiers to every Map in the given List of Map
decorateWithCommonQualifiers
{ "repo_name": "geothomasp/kualico-rice-kc", "path": "rice-middleware/impl/src/main/java/org/kuali/rice/kns/workflow/attribute/DataDictionaryQualifierResolver.java", "license": "apache-2.0", "size": 8764 }
[ "java.util.List", "java.util.Map", "org.kuali.rice.krad.datadictionary.DocumentEntry", "org.kuali.rice.krad.document.Document" ]
import java.util.List; import java.util.Map; import org.kuali.rice.krad.datadictionary.DocumentEntry; import org.kuali.rice.krad.document.Document;
import java.util.*; import org.kuali.rice.krad.datadictionary.*; import org.kuali.rice.krad.document.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
1,001,665
public List<CustomWebView> getWebViewList() { return mWebViewList; }
List<CustomWebView> function() { return mWebViewList; }
/** * Get the list of current WebViews. * * @return The list of current WebViews. */
Get the list of current WebViews
getWebViewList
{ "repo_name": "talentprince/weyoungbrowser", "path": "src/org/weyoung/controllers/Controller.java", "license": "gpl-3.0", "size": 4694 }
[ "java.util.List", "org.weyoung.ui.components.CustomWebView" ]
import java.util.List; import org.weyoung.ui.components.CustomWebView;
import java.util.*; import org.weyoung.ui.components.*;
[ "java.util", "org.weyoung.ui" ]
java.util; org.weyoung.ui;
2,221,174
private static Paint calculateErrorShadeFor( final TimeSeriesCollection errorSeries, final double cutOffValue) { final Paint col; double maxError = 0d; final Iterator<?> sIter = errorSeries.getSeries().iterator(); while (sIter.hasNext()) { final TimeSeries ts = (TimeSeries) sIter.next(); final List<?> items = ts.getItems(); for (final Iterator<?> iterator = items.iterator(); iterator.hasNext();) { final TimeSeriesDataItem item = (TimeSeriesDataItem) iterator.next(); final boolean useMe; // check this isn't infill if (item instanceof ColouredDataItem) { final ColouredDataItem cd = (ColouredDataItem) item; useMe = cd.isShapeFilled(); } else { useMe = true; } if (useMe) { final double thisE = (Double) item.getValue(); maxError = Math.max(maxError, Math.abs(thisE)); } } } if (maxError > cutOffValue) { col = new Color(1f, 0f, 0f, 0.05f); } else { final float shade = (float) (0.03f + (cutOffValue - maxError) * 0.02f); col = new Color(0f, 1f, 0f, shade); } return col; }
static Paint function( final TimeSeriesCollection errorSeries, final double cutOffValue) { final Paint col; double maxError = 0d; final Iterator<?> sIter = errorSeries.getSeries().iterator(); while (sIter.hasNext()) { final TimeSeries ts = (TimeSeries) sIter.next(); final List<?> items = ts.getItems(); for (final Iterator<?> iterator = items.iterator(); iterator.hasNext();) { final TimeSeriesDataItem item = (TimeSeriesDataItem) iterator.next(); final boolean useMe; if (item instanceof ColouredDataItem) { final ColouredDataItem cd = (ColouredDataItem) item; useMe = cd.isShapeFilled(); } else { useMe = true; } if (useMe) { final double thisE = (Double) item.getValue(); maxError = Math.max(maxError, Math.abs(thisE)); } } } if (maxError > cutOffValue) { col = new Color(1f, 0f, 0f, 0.05f); } else { final float shade = (float) (0.03f + (cutOffValue - maxError) * 0.02f); col = new Color(0f, 1f, 0f, shade); } return col; }
/** * produce a color shade, according to whether the max error is inside 3 degrees or not. * * @param errorSeries * @return */
produce a color shade, according to whether the max error is inside 3 degrees or not
calculateErrorShadeFor
{ "repo_name": "theanuradha/debrief", "path": "org.mwc.debrief.track_shift/src/org/mwc/debrief/track_shift/views/StackedDotHelper.java", "license": "epl-1.0", "size": 109430 }
[ "java.awt.Color", "java.awt.Paint", "java.util.Iterator", "java.util.List", "org.jfree.data.time.TimeSeries", "org.jfree.data.time.TimeSeriesCollection", "org.jfree.data.time.TimeSeriesDataItem" ]
import java.awt.Color; import java.awt.Paint; import java.util.Iterator; import java.util.List; import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; import org.jfree.data.time.TimeSeriesDataItem;
import java.awt.*; import java.util.*; import org.jfree.data.time.*;
[ "java.awt", "java.util", "org.jfree.data" ]
java.awt; java.util; org.jfree.data;
1,233,008
private void closeAllCqs(boolean clientInitiated, Collection<? extends InternalCqQuery> cqs) { closeAllCqs(clientInitiated, cqs, this.cache.keepDurableSubscriptionsAlive()); }
void function(boolean clientInitiated, Collection<? extends InternalCqQuery> cqs) { closeAllCqs(clientInitiated, cqs, this.cache.keepDurableSubscriptionsAlive()); }
/** * Close all CQs executing in this VM, and release resources associated with executing CQs. * CqQuerys created by other VMs are unaffected. */
Close all CQs executing in this VM, and release resources associated with executing CQs. CqQuerys created by other VMs are unaffected
closeAllCqs
{ "repo_name": "pdxrunner/geode", "path": "geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java", "license": "apache-2.0", "size": 59842 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,776,860
public void testSetScaleIntRoundingMode() { String a = "1231212478987482988429808779810457634781384756794987"; int aScale = 28; int newScale = 18; BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); BigDecimal result = aNumber.setScale(newScale, RoundingMode.HALF_EVEN); String res = "123121247898748298842980.877981045763478138"; int resScale = 18; assertEquals("incorrect value", res, result.toString()); assertEquals("incorrect scale", resScale, result.scale()); }
void function() { String a = STR; int aScale = 28; int newScale = 18; BigDecimal aNumber = new BigDecimal(new BigInteger(a), aScale); BigDecimal result = aNumber.setScale(newScale, RoundingMode.HALF_EVEN); String res = STR; int resScale = 18; assertEquals(STR, res, result.toString()); assertEquals(STR, resScale, result.scale()); }
/** * SetScale(int, RoundingMode). */
SetScale(int, RoundingMode)
testSetScaleIntRoundingMode
{ "repo_name": "google/j2cl", "path": "jre/javatests/com/google/gwt/emultest/java/math/BigDecimalScaleOperationsTest.java", "license": "apache-2.0", "size": 13490 }
[ "java.math.BigDecimal", "java.math.BigInteger", "java.math.RoundingMode" ]
import java.math.BigDecimal; import java.math.BigInteger; import java.math.RoundingMode;
import java.math.*;
[ "java.math" ]
java.math;
1,503,822
static boolean isVarArraySupported(Context context) { try { Class cajClazz = Class.forName("com.cosylab.epics.caj.CAJContext"); if (cajClazz.isInstance(context)) { return !(context.getVersion().getMajorVersion() <= 1 && context.getVersion().getMinorVersion() <= 1 && context.getVersion().getMaintenanceVersion() <= 9); } } catch (ClassNotFoundException ex) { // Can't be CAJ, fall back to JCA } return true; }
static boolean isVarArraySupported(Context context) { try { Class cajClazz = Class.forName(STR); if (cajClazz.isInstance(context)) { return !(context.getVersion().getMajorVersion() <= 1 && context.getVersion().getMinorVersion() <= 1 && context.getVersion().getMaintenanceVersion() <= 9); } } catch (ClassNotFoundException ex) { } return true; }
/** * Determines whether the context supports variable arrays or not. * * @param context * a JCA Context * @return true if supports variable sized arrays */
Determines whether the context supports variable arrays or not
isVarArraySupported
{ "repo_name": "diirt/diirt", "path": "support/ca/src/main/java/org/diirt/support/ca/JCADataSourceConfiguration.java", "license": "mit", "size": 13537 }
[ "gov.aps.jca.Context" ]
import gov.aps.jca.Context;
import gov.aps.jca.*;
[ "gov.aps.jca" ]
gov.aps.jca;
892,618
public boolean rayletTaskExistsInGcs(TaskId taskId) { byte[] key = ArrayUtils.addAll(TablePrefix.RAYLET_TASK.toString().getBytes(), taskId.getBytes()); RedisClient client = getShardClient(taskId); return client.exists(key); }
boolean function(TaskId taskId) { byte[] key = ArrayUtils.addAll(TablePrefix.RAYLET_TASK.toString().getBytes(), taskId.getBytes()); RedisClient client = getShardClient(taskId); return client.exists(key); }
/** * Query whether the raylet task exists in Gcs. */
Query whether the raylet task exists in Gcs
rayletTaskExistsInGcs
{ "repo_name": "robertnishihara/ray", "path": "java/runtime/src/main/java/io/ray/runtime/gcs/GcsClient.java", "license": "apache-2.0", "size": 7215 }
[ "io.ray.api.id.TaskId", "io.ray.runtime.generated.Gcs", "org.apache.commons.lang3.ArrayUtils" ]
import io.ray.api.id.TaskId; import io.ray.runtime.generated.Gcs; import org.apache.commons.lang3.ArrayUtils;
import io.ray.api.id.*; import io.ray.runtime.generated.*; import org.apache.commons.lang3.*;
[ "io.ray.api", "io.ray.runtime", "org.apache.commons" ]
io.ray.api; io.ray.runtime; org.apache.commons;
2,798,139
private static void removeObservingPattern(String pattern, SessionState state) { logger.debug("ResourcesAction.removeObservingPattern()"); // // get the observer and remove the pattern // ContentObservingCourier o = (ContentObservingCourier) state.getAttribute(STATE_OBSERVER); // o.removeResourcePattern(ContentHostingService.getReference(pattern)); // // // add it back to state // state.setAttribute(STATE_OBSERVER, o); } // removeObservingPattern
static void function(String pattern, SessionState state) { logger.debug(STR); }
/** * Remove a resource pattern from the observer *@param pattern The pattern value to be removed *@param state The state object */
Remove a resource pattern from the observer
removeObservingPattern
{ "repo_name": "kingmook/sakai", "path": "content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java", "license": "apache-2.0", "size": 336184 }
[ "org.sakaiproject.event.api.SessionState" ]
import org.sakaiproject.event.api.SessionState;
import org.sakaiproject.event.api.*;
[ "org.sakaiproject.event" ]
org.sakaiproject.event;
775,050
private Rectangle getOwnerBounds(ConnectionAnchor anchor) { // for (Object child : anchor.getOwner().getChildren()) { // [SDR] // if (child instanceof InterfaceEditPart.InterfaceFigure) {// [SDR] // return ((IFigure) child).getBounds().getCopy(); // } // } return anchor.getOwner().getBounds().getCopy(); }
Rectangle function(ConnectionAnchor anchor) { return anchor.getOwner().getBounds().getCopy(); }
/** * Helper method to return the bounds of the owner, or only the ones from * its interesting feature. * * @param anchor * @return the bounds to create the anchor on. */
Helper method to return the bounds of the owner, or only the ones from its interesting feature
getOwnerBounds
{ "repo_name": "StephaneSeyvoz/mindEd", "path": "org.ow2.mindEd.adl.editor.graphic.ui/customsrc/org/ow2/mindEd/adl/editor/graphic/ui/custom/layouts/RectilinearRouterEx.java", "license": "lgpl-3.0", "size": 32826 }
[ "org.eclipse.draw2d.ConnectionAnchor", "org.eclipse.draw2d.geometry.Rectangle" ]
import org.eclipse.draw2d.ConnectionAnchor; import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*;
[ "org.eclipse.draw2d" ]
org.eclipse.draw2d;
1,179,008
public static void doWithFields(Class<?> clazz, FieldCallback fc, FieldFilter ff) throws IllegalArgumentException { // Keep backing up the inheritance hierarchy. Class<?> targetClass = clazz; do { Field[] fields = targetClass.getDeclaredFields(); for (Field field : fields) { // Skip static and final fields. if (ff != null && !ff.matches(field)) { continue; } try { fc.doWith(field); } catch (IllegalAccessException ex) { throw new IllegalStateException( "Shouldn't be illegal to access field '" + field.getName() + "': " + ex); } } targetClass = targetClass.getSuperclass(); } while (targetClass != null && targetClass != Object.class); }
static void function(Class<?> clazz, FieldCallback fc, FieldFilter ff) throws IllegalArgumentException { Class<?> targetClass = clazz; do { Field[] fields = targetClass.getDeclaredFields(); for (Field field : fields) { if (ff != null && !ff.matches(field)) { continue; } try { fc.doWith(field); } catch (IllegalAccessException ex) { throw new IllegalStateException( STR + field.getName() + STR + ex); } } targetClass = targetClass.getSuperclass(); } while (targetClass != null && targetClass != Object.class); }
/** * Invoke the given callback on all fields in the target class, going up the * class hierarchy to get all declared fields. * @param clazz the target class to analyze * @param fc the callback to invoke for each field * @param ff the filter that determines the fields to apply the callback to */
Invoke the given callback on all fields in the target class, going up the class hierarchy to get all declared fields
doWithFields
{ "repo_name": "xuse/ef-orm", "path": "common-core/src/main/java/jef/tools/reflect/ReflectionUtils.java", "license": "apache-2.0", "size": 22293 }
[ "java.lang.reflect.Field" ]
import java.lang.reflect.Field;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,739,332
IntStream mapToInt(LongToIntFunction mapper);
IntStream mapToInt(LongToIntFunction mapper);
/** * Returns an {@code IntStream} consisting of the results of applying the * given function to the elements of this stream. * * <p>This is an <a href="package-summary.html#StreamOps">intermediate * operation</a>. * * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>, * <a href="package-summary.html#Statelessness">stateless</a> * function to apply to each element * @return the new stream */
Returns an IntStream consisting of the results of applying the given function to the elements of this stream. This is an intermediate operation
mapToInt
{ "repo_name": "flyzsd/java-code-snippets", "path": "ibm.jdk8/src/java/util/stream/LongStream.java", "license": "mit", "size": 37200 }
[ "java.util.function.LongToIntFunction" ]
import java.util.function.LongToIntFunction;
import java.util.function.*;
[ "java.util" ]
java.util;
617,093
public MapperRegistry getMapperRegistry() { return mapperRegistry; }
MapperRegistry function() { return mapperRegistry; }
/** * A registry for all field mappers. */
A registry for all field mappers
getMapperRegistry
{ "repo_name": "nilabhsagar/elasticsearch", "path": "core/src/main/java/org/elasticsearch/indices/IndicesModule.java", "license": "apache-2.0", "size": 9392 }
[ "org.elasticsearch.indices.mapper.MapperRegistry" ]
import org.elasticsearch.indices.mapper.MapperRegistry;
import org.elasticsearch.indices.mapper.*;
[ "org.elasticsearch.indices" ]
org.elasticsearch.indices;
1,815,543
public void testServiceOrder() { // Get the total list of services and register token queue with them. List<TestServiceToken> tokenList = new ArrayList<TestServiceToken>(); ApplicationContext appContext = context.getApplicationContext(); for (ContextService service : getServicesBeans(appContext).values()) { ((TestService)service).setTokenList(tokenList); } // Start and shutdown the Context and test the tokens. // TODO(mgronber): Remove this when the Scheduler has become a service. context.setFeeding(false); context.start(); context.shutdown(false); assertEquals("check amount of tokens", 2 * allOrderedServiceNames.size(), tokenList.size()); assertTokenOrder("services started/stopped in right order", false, allOrderedServiceNames, tokenList); tokenList.clear(); context.start(); context.shutdown(true); assertTokenOrder("services started/stopped in right order", true, allOrderedServiceNames, tokenList); }
void function() { List<TestServiceToken> tokenList = new ArrayList<TestServiceToken>(); ApplicationContext appContext = context.getApplicationContext(); for (ContextService service : getServicesBeans(appContext).values()) { ((TestService)service).setTokenList(tokenList); } context.setFeeding(false); context.start(); context.shutdown(false); assertEquals(STR, 2 * allOrderedServiceNames.size(), tokenList.size()); assertTokenOrder(STR, false, allOrderedServiceNames, tokenList); tokenList.clear(); context.start(); context.shutdown(true); assertTokenOrder(STR, true, allOrderedServiceNames, tokenList); }
/** * Tests the order of starting and stopping of the services. */
Tests the order of starting and stopping of the services
testServiceOrder
{ "repo_name": "googlegsa/manager.v3", "path": "projects/connector-manager/source/javatests/com/google/enterprise/connector/manager/TestServiceTest.java", "license": "apache-2.0", "size": 9631 }
[ "com.google.enterprise.connector.manager.TestService", "java.util.ArrayList", "java.util.List", "org.springframework.context.ApplicationContext" ]
import com.google.enterprise.connector.manager.TestService; import java.util.ArrayList; import java.util.List; import org.springframework.context.ApplicationContext;
import com.google.enterprise.connector.manager.*; import java.util.*; import org.springframework.context.*;
[ "com.google.enterprise", "java.util", "org.springframework.context" ]
com.google.enterprise; java.util; org.springframework.context;
866,708
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side) { return this.canPlaceBlockAt(worldIn, pos); }
boolean function(World worldIn, BlockPos pos, EnumFacing side) { return this.canPlaceBlockAt(worldIn, pos); }
/** * Check whether this Block can be placed on the given side */
Check whether this Block can be placed on the given side
canPlaceBlockOnSide
{ "repo_name": "SkidJava/BaseClient", "path": "new_1.8.8/net/minecraft/block/Block.java", "license": "gpl-2.0", "size": 70456 }
[ "net.minecraft.util.BlockPos", "net.minecraft.util.EnumFacing", "net.minecraft.world.World" ]
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.world.World;
import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.util; net.minecraft.world;
828,941
@Override public BiomeVC[] getBiomesForGeneration(BiomeGenBase[] biomebase, int x, int y, int width, int height) { IntCache.resetIntCache(); BiomeVC[] biomes = (BiomeVC[]) biomebase; if (biomes == null || biomes.length < width * height) { biomes = new BiomeVC[width * height]; } int[] intmap = this.genBiomes.getInts(x, y, width, height); for (int i = 0; i < width * height; ++i) { int index = Math.max(intmap[i], 0); biomes[i] = BiomeVC.biomeList[index]; } //System.out.println("length: " + biomes.length); return biomes; }
BiomeVC[] function(BiomeGenBase[] biomebase, int x, int y, int width, int height) { IntCache.resetIntCache(); BiomeVC[] biomes = (BiomeVC[]) biomebase; if (biomes == null biomes.length < width * height) { biomes = new BiomeVC[width * height]; } int[] intmap = this.genBiomes.getInts(x, y, width, height); for (int i = 0; i < width * height; ++i) { int index = Math.max(intmap[i], 0); biomes[i] = BiomeVC.biomeList[index]; } return biomes; }
/** * Returns an array of biomes for the location input. */
Returns an array of biomes for the location input
getBiomesForGeneration
{ "repo_name": "tyronx/vintagecraft", "path": "src/main/java/at/tyron/vintagecraft/WorldGen/Helper/WorldChunkManagerVC.java", "license": "gpl-3.0", "size": 5401 }
[ "at.tyron.vintagecraft.WorldGen", "net.minecraft.world.biome.BiomeGenBase", "net.minecraft.world.gen.layer.IntCache" ]
import at.tyron.vintagecraft.WorldGen; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.layer.IntCache;
import at.tyron.vintagecraft.*; import net.minecraft.world.biome.*; import net.minecraft.world.gen.layer.*;
[ "at.tyron.vintagecraft", "net.minecraft.world" ]
at.tyron.vintagecraft; net.minecraft.world;
533,838
public void generateTest( PGPSecretKeyRing sKey, PGPPublicKey pgpPubKey, PGPPrivateKey pgpPrivKey) throws Exception { String data = "hello world!"; ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ByteArrayInputStream testIn = new ByteArrayInputStream(data.getBytes()); PGPSignatureGenerator sGen = new PGPSignatureGenerator(new JcaPGPContentSignerBuilder(PublicKeyAlgorithmTags.DSA, HashAlgorithmTags.SHA1).setProvider("SC")); sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator(); Iterator it = sKey.getSecretKey().getPublicKey().getUserIDs(); String primaryUserID = (String)it.next(); spGen.setSignerUserID(true, primaryUserID); sGen.setHashedSubpackets(spGen.generate()); PGPCompressedDataGenerator cGen = new PGPCompressedDataGenerator( PGPCompressedData.ZIP); BCPGOutputStream bcOut = new BCPGOutputStream( cGen.open(new UncloseableOutputStream(bOut))); sGen.generateOnePassVersion(false).encode(bcOut); PGPLiteralDataGenerator lGen = new PGPLiteralDataGenerator(); Date testDate = new Date((System.currentTimeMillis() / 1000) * 1000); OutputStream lOut = lGen.open( new UncloseableOutputStream(bcOut), PGPLiteralData.BINARY, "_CONSOLE", data.getBytes().length, testDate); int ch; while ((ch = testIn.read()) >= 0) { lOut.write(ch); sGen.update((byte)ch); } lGen.close(); sGen.generate().encode(bcOut); cGen.close(); JcaPGPObjectFactory pgpFact = new JcaPGPObjectFactory(bOut.toByteArray()); PGPCompressedData c1 = (PGPCompressedData)pgpFact.nextObject(); pgpFact = new JcaPGPObjectFactory(c1.getDataStream()); PGPOnePassSignatureList p1 = (PGPOnePassSignatureList)pgpFact.nextObject(); PGPOnePassSignature ops = p1.get(0); PGPLiteralData p2 = (PGPLiteralData)pgpFact.nextObject(); if (!p2.getModificationTime().equals(testDate)) { fail("Modification time not preserved"); } InputStream dIn = p2.getInputStream(); ops.init(new JcaPGPContentVerifierBuilderProvider().setProvider("SC"), pgpPubKey); while ((ch = dIn.read()) >= 0) { ops.update((byte)ch); } PGPSignatureList p3 = (PGPSignatureList)pgpFact.nextObject(); if (!ops.verify(p3.get(0))) { fail("Failed generated signature check"); } }
void function( PGPSecretKeyRing sKey, PGPPublicKey pgpPubKey, PGPPrivateKey pgpPrivKey) throws Exception { String data = STR; ByteArrayOutputStream bOut = new ByteArrayOutputStream(); ByteArrayInputStream testIn = new ByteArrayInputStream(data.getBytes()); PGPSignatureGenerator sGen = new PGPSignatureGenerator(new JcaPGPContentSignerBuilder(PublicKeyAlgorithmTags.DSA, HashAlgorithmTags.SHA1).setProvider("SC")); sGen.init(PGPSignature.BINARY_DOCUMENT, pgpPrivKey); PGPSignatureSubpacketGenerator spGen = new PGPSignatureSubpacketGenerator(); Iterator it = sKey.getSecretKey().getPublicKey().getUserIDs(); String primaryUserID = (String)it.next(); spGen.setSignerUserID(true, primaryUserID); sGen.setHashedSubpackets(spGen.generate()); PGPCompressedDataGenerator cGen = new PGPCompressedDataGenerator( PGPCompressedData.ZIP); BCPGOutputStream bcOut = new BCPGOutputStream( cGen.open(new UncloseableOutputStream(bOut))); sGen.generateOnePassVersion(false).encode(bcOut); PGPLiteralDataGenerator lGen = new PGPLiteralDataGenerator(); Date testDate = new Date((System.currentTimeMillis() / 1000) * 1000); OutputStream lOut = lGen.open( new UncloseableOutputStream(bcOut), PGPLiteralData.BINARY, STR, data.getBytes().length, testDate); int ch; while ((ch = testIn.read()) >= 0) { lOut.write(ch); sGen.update((byte)ch); } lGen.close(); sGen.generate().encode(bcOut); cGen.close(); JcaPGPObjectFactory pgpFact = new JcaPGPObjectFactory(bOut.toByteArray()); PGPCompressedData c1 = (PGPCompressedData)pgpFact.nextObject(); pgpFact = new JcaPGPObjectFactory(c1.getDataStream()); PGPOnePassSignatureList p1 = (PGPOnePassSignatureList)pgpFact.nextObject(); PGPOnePassSignature ops = p1.get(0); PGPLiteralData p2 = (PGPLiteralData)pgpFact.nextObject(); if (!p2.getModificationTime().equals(testDate)) { fail(STR); } InputStream dIn = p2.getInputStream(); ops.init(new JcaPGPContentVerifierBuilderProvider().setProvider("SC"), pgpPubKey); while ((ch = dIn.read()) >= 0) { ops.update((byte)ch); } PGPSignatureList p3 = (PGPSignatureList)pgpFact.nextObject(); if (!ops.verify(p3.get(0))) { fail(STR); } }
/** * Generated signature test * * @param sKey * @param pgpPrivKey */
Generated signature test
generateTest
{ "repo_name": "iseki-masaya/spongycastle", "path": "pg/src/test/java/org/spongycastle/openpgp/test/PGPDSATest.java", "license": "mit", "size": 31055 }
[ "java.io.ByteArrayInputStream", "java.io.ByteArrayOutputStream", "java.io.InputStream", "java.io.OutputStream", "java.util.Date", "java.util.Iterator", "org.spongycastle.bcpg.BCPGOutputStream", "org.spongycastle.bcpg.HashAlgorithmTags", "org.spongycastle.bcpg.PublicKeyAlgorithmTags", "org.spongycastle.openpgp.PGPCompressedData", "org.spongycastle.openpgp.PGPCompressedDataGenerator", "org.spongycastle.openpgp.PGPLiteralData", "org.spongycastle.openpgp.PGPLiteralDataGenerator", "org.spongycastle.openpgp.PGPOnePassSignature", "org.spongycastle.openpgp.PGPOnePassSignatureList", "org.spongycastle.openpgp.PGPPrivateKey", "org.spongycastle.openpgp.PGPPublicKey", "org.spongycastle.openpgp.PGPSecretKeyRing", "org.spongycastle.openpgp.PGPSignature", "org.spongycastle.openpgp.PGPSignatureGenerator", "org.spongycastle.openpgp.PGPSignatureList", "org.spongycastle.openpgp.PGPSignatureSubpacketGenerator", "org.spongycastle.openpgp.jcajce.JcaPGPObjectFactory", "org.spongycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder", "org.spongycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider", "org.spongycastle.util.test.UncloseableOutputStream" ]
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.Date; import java.util.Iterator; import org.spongycastle.bcpg.BCPGOutputStream; import org.spongycastle.bcpg.HashAlgorithmTags; import org.spongycastle.bcpg.PublicKeyAlgorithmTags; import org.spongycastle.openpgp.PGPCompressedData; import org.spongycastle.openpgp.PGPCompressedDataGenerator; import org.spongycastle.openpgp.PGPLiteralData; import org.spongycastle.openpgp.PGPLiteralDataGenerator; import org.spongycastle.openpgp.PGPOnePassSignature; import org.spongycastle.openpgp.PGPOnePassSignatureList; import org.spongycastle.openpgp.PGPPrivateKey; import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPSecretKeyRing; import org.spongycastle.openpgp.PGPSignature; import org.spongycastle.openpgp.PGPSignatureGenerator; import org.spongycastle.openpgp.PGPSignatureList; import org.spongycastle.openpgp.PGPSignatureSubpacketGenerator; import org.spongycastle.openpgp.jcajce.JcaPGPObjectFactory; import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentSignerBuilder; import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider; import org.spongycastle.util.test.UncloseableOutputStream;
import java.io.*; import java.util.*; import org.spongycastle.bcpg.*; import org.spongycastle.openpgp.*; import org.spongycastle.openpgp.jcajce.*; import org.spongycastle.openpgp.operator.jcajce.*; import org.spongycastle.util.test.*;
[ "java.io", "java.util", "org.spongycastle.bcpg", "org.spongycastle.openpgp", "org.spongycastle.util" ]
java.io; java.util; org.spongycastle.bcpg; org.spongycastle.openpgp; org.spongycastle.util;
765,818
protected void mouseClicked(int p_73864_1_, int p_73864_2_, int p_73864_3_) { if (this.buttonId != null) { this.options.setOptionKeyBinding(this.buttonId, -100 + p_73864_3_); this.buttonId = null; KeyBinding.resetKeyBindingArrayAndHash(); } else if (p_73864_3_ != 0 || !this.keyBindingList.func_148179_a(p_73864_1_, p_73864_2_, p_73864_3_)) { super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); } }
void function(int p_73864_1_, int p_73864_2_, int p_73864_3_) { if (this.buttonId != null) { this.options.setOptionKeyBinding(this.buttonId, -100 + p_73864_3_); this.buttonId = null; KeyBinding.resetKeyBindingArrayAndHash(); } else if (p_73864_3_ != 0 !this.keyBindingList.func_148179_a(p_73864_1_, p_73864_2_, p_73864_3_)) { super.mouseClicked(p_73864_1_, p_73864_2_, p_73864_3_); } }
/** * Called when the mouse is clicked. */
Called when the mouse is clicked
mouseClicked
{ "repo_name": "CheeseL0ver/Ore-TTM", "path": "build/tmp/recompSrc/net/minecraft/client/gui/GuiControls.java", "license": "lgpl-2.1", "size": 6117 }
[ "net.minecraft.client.settings.KeyBinding" ]
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.settings.*;
[ "net.minecraft.client" ]
net.minecraft.client;
2,240,616
private static void splitRowsOnGaps(Row row, final SDocumentGraph graph, Map<SToken, Integer> token2index) { ListIterator<GridEvent> itEvents = row.getEvents().listIterator(); while (itEvents.hasNext()) { GridEvent event = itEvents.next(); int lastTokenIndex = -1; // sort the coveredIDs LinkedList<String> sortedCoveredToken = new LinkedList<>(event.getCoveredIDs()); Collections.sort(sortedCoveredToken, (o1, o2) -> { SToken node1 = (SToken) graph.getNode(o1); SToken node2 = (SToken) graph.getNode(o2); if (node1 == node2) { return 0; } if (node1 == null) { return -1; } if (node2 == null) { return +1; } long tokenIndex1 = token2index.get(node1); long tokenIndex2 = token2index.get(node2); return ((Long) (tokenIndex1)).compareTo(tokenIndex2); }); // first calculate all gaps List<GridEvent> gaps = new LinkedList<>(); for (String id : sortedCoveredToken) { SToken node = (SToken) graph.getNode(id); int tokenIndex = token2index.get(node); // sanity check if (tokenIndex >= event.getLeft() && tokenIndex <= event.getRight()) { int diff = tokenIndex - lastTokenIndex; if (lastTokenIndex >= 0 && diff > 1) { // we detected a gap GridEvent gap = new GridEvent(event.getId() + "_gap_" + gaps.size(), lastTokenIndex + 1, tokenIndex - 1, ""); gap.setGap(true); gaps.add(gap); } lastTokenIndex = tokenIndex; } else { // reset gap search when discovered there were token we use for // hightlighting but do not actually cover lastTokenIndex = -1; } } // end for each covered token id ListIterator<GridEvent> itGaps = gaps.listIterator(); // remember the old right value int oldRight = event.getRight(); int gapNr = 0; while (itGaps.hasNext()) { GridEvent gap = itGaps.next(); if (gapNr == 0) { // shorten original event event.setRight(gap.getLeft() - 1); } // insert the real gap itEvents.add(gap); int rightBorder = oldRight; if (itGaps.hasNext()) { // don't use the old event right border since the gap should only go until // the next event GridEvent nextGap = itGaps.next(); itGaps.previous(); rightBorder = nextGap.getLeft() - 1; } // insert a new event node that covers the rest of the event GridEvent after = new GridEvent(event); after.setId(event.getId() + "_after_" + gapNr); after.setLeft(gap.getRight() + 1); after.setRight(rightBorder); itEvents.add(after); gapNr++; } } }
static void function(Row row, final SDocumentGraph graph, Map<SToken, Integer> token2index) { ListIterator<GridEvent> itEvents = row.getEvents().listIterator(); while (itEvents.hasNext()) { GridEvent event = itEvents.next(); int lastTokenIndex = -1; LinkedList<String> sortedCoveredToken = new LinkedList<>(event.getCoveredIDs()); Collections.sort(sortedCoveredToken, (o1, o2) -> { SToken node1 = (SToken) graph.getNode(o1); SToken node2 = (SToken) graph.getNode(o2); if (node1 == node2) { return 0; } if (node1 == null) { return -1; } if (node2 == null) { return +1; } long tokenIndex1 = token2index.get(node1); long tokenIndex2 = token2index.get(node2); return ((Long) (tokenIndex1)).compareTo(tokenIndex2); }); List<GridEvent> gaps = new LinkedList<>(); for (String id : sortedCoveredToken) { SToken node = (SToken) graph.getNode(id); int tokenIndex = token2index.get(node); if (tokenIndex >= event.getLeft() && tokenIndex <= event.getRight()) { int diff = tokenIndex - lastTokenIndex; if (lastTokenIndex >= 0 && diff > 1) { GridEvent gap = new GridEvent(event.getId() + "_gap_" + gaps.size(), lastTokenIndex + 1, tokenIndex - 1, STR_after_" + gapNr); after.setLeft(gap.getRight() + 1); after.setRight(rightBorder); itEvents.add(after); gapNr++; } } }
/** * Splits events of a row if they contain a gap. Gaps are found using the token index (provided as * ANNIS specific {@link SFeature}. Inserted events have a special style to mark them as gaps. * * @param row * @param graph * @param token2index */
Splits events of a row if they contain a gap. Gaps are found using the token index (provided as ANNIS specific <code>SFeature</code>. Inserted events have a special style to mark them as gaps
splitRowsOnGaps
{ "repo_name": "korpling/ANNIS", "path": "src/main/java/org/corpus_tools/annis/gui/visualizers/component/grid/EventExtractor.java", "license": "apache-2.0", "size": 26887 }
[ "java.util.Collections", "java.util.LinkedList", "java.util.List", "java.util.ListIterator", "java.util.Map", "org.corpus_tools.annis.gui.widgets.grid.GridEvent", "org.corpus_tools.annis.gui.widgets.grid.Row", "org.corpus_tools.salt.common.SDocumentGraph", "org.corpus_tools.salt.common.SToken" ]
import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import java.util.Map; import org.corpus_tools.annis.gui.widgets.grid.GridEvent; import org.corpus_tools.annis.gui.widgets.grid.Row; import org.corpus_tools.salt.common.SDocumentGraph; import org.corpus_tools.salt.common.SToken;
import java.util.*; import org.corpus_tools.annis.gui.widgets.grid.*; import org.corpus_tools.salt.common.*;
[ "java.util", "org.corpus_tools.annis", "org.corpus_tools.salt" ]
java.util; org.corpus_tools.annis; org.corpus_tools.salt;
2,867,562
private void identitySuspensionHelper(Identity identity,boolean suspension) { directory.users().suspend(Integer.parseInt(identity.getGuid()),suspension); }
void function(Identity identity,boolean suspension) { directory.users().suspend(Integer.parseInt(identity.getGuid()),suspension); }
/** * Helper utility method to enable/disable suspension for an identity * * @param identity * @param suspension true to suspend an account, false to enable it * * @throws PrincipalNotFoundException if identity specified by email id/principal name not present in active directory. * @throws ConnectorException for api, connection related errors. */
Helper utility method to enable/disable suspension for an identity
identitySuspensionHelper
{ "repo_name": "nervepoint/identity4j", "path": "identity4j-zendesk/src/main/java/com/identity4j/connector/zendesk/ZendeskConnector.java", "license": "lgpl-3.0", "size": 18560 }
[ "com.identity4j.connector.principal.Identity" ]
import com.identity4j.connector.principal.Identity;
import com.identity4j.connector.principal.*;
[ "com.identity4j.connector" ]
com.identity4j.connector;
16,626
@Test public void testScanner_JoinedScanners() throws IOException { byte[] cf_essential = Bytes.toBytes("essential"); byte[] cf_joined = Bytes.toBytes("joined"); byte[] cf_alpha = Bytes.toBytes("alpha"); this.region = initHRegion(tableName, getName(), CONF, cf_essential, cf_joined, cf_alpha); try { byte[] row1 = Bytes.toBytes("row1"); byte[] row2 = Bytes.toBytes("row2"); byte[] row3 = Bytes.toBytes("row3"); byte[] col_normal = Bytes.toBytes("d"); byte[] col_alpha = Bytes.toBytes("a"); byte[] filtered_val = Bytes.toBytes(3); Put put = new Put(row1); put.add(cf_essential, col_normal, Bytes.toBytes(1)); put.add(cf_joined, col_alpha, Bytes.toBytes(1)); region.put(put); put = new Put(row2); put.add(cf_essential, col_alpha, Bytes.toBytes(2)); put.add(cf_joined, col_normal, Bytes.toBytes(2)); put.add(cf_alpha, col_alpha, Bytes.toBytes(2)); region.put(put); put = new Put(row3); put.add(cf_essential, col_normal, filtered_val); put.add(cf_joined, col_normal, filtered_val); region.put(put); // Check two things: // 1. result list contains expected values // 2. result list is sorted properly Scan scan = new Scan(); Filter filter = new SingleColumnValueExcludeFilter(cf_essential, col_normal, CompareOp.NOT_EQUAL, filtered_val); scan.setFilter(filter); scan.setLoadColumnFamiliesOnDemand(true); InternalScanner s = region.getScanner(scan); List<Cell> results = new ArrayList<Cell>(); assertTrue(s.next(results)); assertEquals(results.size(), 1); results.clear(); assertTrue(s.next(results)); assertEquals(results.size(), 3); assertTrue("orderCheck", CellUtil.matchingFamily(results.get(0), cf_alpha)); assertTrue("orderCheck", CellUtil.matchingFamily(results.get(1), cf_essential)); assertTrue("orderCheck", CellUtil.matchingFamily(results.get(2), cf_joined)); results.clear(); assertFalse(s.next(results)); assertEquals(results.size(), 0); } finally { HRegion.closeHRegion(this.region); this.region = null; } }
void function() throws IOException { byte[] cf_essential = Bytes.toBytes(STR); byte[] cf_joined = Bytes.toBytes(STR); byte[] cf_alpha = Bytes.toBytes("alpha"); this.region = initHRegion(tableName, getName(), CONF, cf_essential, cf_joined, cf_alpha); try { byte[] row1 = Bytes.toBytes("row1"); byte[] row2 = Bytes.toBytes("row2"); byte[] row3 = Bytes.toBytes("row3"); byte[] col_normal = Bytes.toBytes("d"); byte[] col_alpha = Bytes.toBytes("a"); byte[] filtered_val = Bytes.toBytes(3); Put put = new Put(row1); put.add(cf_essential, col_normal, Bytes.toBytes(1)); put.add(cf_joined, col_alpha, Bytes.toBytes(1)); region.put(put); put = new Put(row2); put.add(cf_essential, col_alpha, Bytes.toBytes(2)); put.add(cf_joined, col_normal, Bytes.toBytes(2)); put.add(cf_alpha, col_alpha, Bytes.toBytes(2)); region.put(put); put = new Put(row3); put.add(cf_essential, col_normal, filtered_val); put.add(cf_joined, col_normal, filtered_val); region.put(put); Scan scan = new Scan(); Filter filter = new SingleColumnValueExcludeFilter(cf_essential, col_normal, CompareOp.NOT_EQUAL, filtered_val); scan.setFilter(filter); scan.setLoadColumnFamiliesOnDemand(true); InternalScanner s = region.getScanner(scan); List<Cell> results = new ArrayList<Cell>(); assertTrue(s.next(results)); assertEquals(results.size(), 1); results.clear(); assertTrue(s.next(results)); assertEquals(results.size(), 3); assertTrue(STR, CellUtil.matchingFamily(results.get(0), cf_alpha)); assertTrue(STR, CellUtil.matchingFamily(results.get(1), cf_essential)); assertTrue(STR, CellUtil.matchingFamily(results.get(2), cf_joined)); results.clear(); assertFalse(s.next(results)); assertEquals(results.size(), 0); } finally { HRegion.closeHRegion(this.region); this.region = null; } }
/** * Added for HBASE-5416 * * Here we test scan optimization when only subset of CFs are used in filter * conditions. */
Added for HBASE-5416 Here we test scan optimization when only subset of CFs are used in filter conditions
testScanner_JoinedScanners
{ "repo_name": "ibmsoe/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java", "license": "apache-2.0", "size": 222810 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hbase.Cell", "org.apache.hadoop.hbase.CellUtil", "org.apache.hadoop.hbase.client.Put", "org.apache.hadoop.hbase.client.Scan", "org.apache.hadoop.hbase.filter.CompareFilter", "org.apache.hadoop.hbase.filter.Filter", "org.apache.hadoop.hbase.filter.SingleColumnValueExcludeFilter", "org.apache.hadoop.hbase.util.Bytes", "org.junit.Assert" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.filter.CompareFilter; import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.filter.SingleColumnValueExcludeFilter; import org.apache.hadoop.hbase.util.Bytes; import org.junit.Assert;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.filter.*; import org.apache.hadoop.hbase.util.*; import org.junit.*;
[ "java.io", "java.util", "org.apache.hadoop", "org.junit" ]
java.io; java.util; org.apache.hadoop; org.junit;
578,785
@Test public void testSetName() { TopicConfig topicConfig = new TopicConfig().setName("test"); assertTrue("test".equals(topicConfig.getName())); }
void function() { TopicConfig topicConfig = new TopicConfig().setName("test"); assertTrue("test".equals(topicConfig.getName())); }
/** * Test method for {@link com.hazelcast.config.TopicConfig#setName(java.lang.String)}. */
Test method for <code>com.hazelcast.config.TopicConfig#setName(java.lang.String)</code>
testSetName
{ "repo_name": "juanavelez/hazelcast", "path": "hazelcast/src/test/java/com/hazelcast/config/TopicConfigTest.java", "license": "apache-2.0", "size": 3610 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,639,651
public static void inject(BroadcastReceiver broadcastReceiver, Context context) { checkNotNull(broadcastReceiver, "broadcastReceiver"); checkNotNull(context, "context"); Application application = (Application) context.getApplicationContext(); if (!(application instanceof HasBroadcastReceiverInjector)) { throw new RuntimeException( String.format( "%s does not implement %s", application.getClass().getCanonicalName(), HasBroadcastReceiverInjector.class.getCanonicalName())); } AndroidInjector<BroadcastReceiver> broadcastReceiverInjector = ((HasBroadcastReceiverInjector) application).broadcastReceiverInjector(); checkNotNull( broadcastReceiverInjector, "%s.broadcastReceiverInjector() returned null", application.getClass()); broadcastReceiverInjector.inject(broadcastReceiver); }
static void function(BroadcastReceiver broadcastReceiver, Context context) { checkNotNull(broadcastReceiver, STR); checkNotNull(context, STR); Application application = (Application) context.getApplicationContext(); if (!(application instanceof HasBroadcastReceiverInjector)) { throw new RuntimeException( String.format( STR, application.getClass().getCanonicalName(), HasBroadcastReceiverInjector.class.getCanonicalName())); } AndroidInjector<BroadcastReceiver> broadcastReceiverInjector = ((HasBroadcastReceiverInjector) application).broadcastReceiverInjector(); checkNotNull( broadcastReceiverInjector, STR, application.getClass()); broadcastReceiverInjector.inject(broadcastReceiver); }
/** * Injects {@code broadcastReceiver} if an associated {@link AndroidInjector} implementation can * be found, otherwise throws an {@link IllegalArgumentException}. * * @throws RuntimeException if the {@link Application} from {@link * Context#getApplicationContext()} doesn't implement {@link HasBroadcastReceiverInjector}. */
Injects broadcastReceiver if an associated <code>AndroidInjector</code> implementation can be found, otherwise throws an <code>IllegalArgumentException</code>
inject
{ "repo_name": "ronshapiro/dagger", "path": "java/dagger/android/AndroidInjection.java", "license": "apache-2.0", "size": 7948 }
[ "android.app.Application", "android.content.BroadcastReceiver", "android.content.Context" ]
import android.app.Application; import android.content.BroadcastReceiver; import android.content.Context;
import android.app.*; import android.content.*;
[ "android.app", "android.content" ]
android.app; android.content;
1,184,755
public byte[] getEncoded() { try { return this.getEncoded(ASN1Encodable.DER); } catch (IOException e) { throw new RuntimeException(e.toString()); } }
byte[] function() { try { return this.getEncoded(ASN1Encodable.DER); } catch (IOException e) { throw new RuntimeException(e.toString()); } }
/** * return a DER encoded byte array representing this object */
return a DER encoded byte array representing this object
getEncoded
{ "repo_name": "Qingbao/PasswdManagerAndroid", "path": "src/noconflict/org/bouncycastle/jce/X509Principal.java", "license": "lgpl-2.1", "size": 4061 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,120,233
XHTMLExtension xhtmlExtension = (XHTMLExtension) message.getExtension( "html", namespace); if (xhtmlExtension != null) return xhtmlExtension.getBodies(); else return null; }
XHTMLExtension xhtmlExtension = (XHTMLExtension) message.getExtension( "html", namespace); if (xhtmlExtension != null) return xhtmlExtension.getBodies(); else return null; }
/** * Returns an Iterator for the XHTML bodies in the message. Returns null if the message does not * contain an XHTML extension. * @param message an XHTML message * @return an Iterator for the bodies in the message or null if none. */
Returns an Iterator for the XHTML bodies in the message. Returns null if the message does not contain an XHTML extension
getBodies
{ "repo_name": "zoozooll/MyExercise", "path": "VV/asmackbeem/org/jivesoftware/smackx/XHTMLManager.java", "license": "apache-2.0", "size": 5005 }
[ "org.jivesoftware.smackx.packet.XHTMLExtension" ]
import org.jivesoftware.smackx.packet.XHTMLExtension;
import org.jivesoftware.smackx.packet.*;
[ "org.jivesoftware.smackx" ]
org.jivesoftware.smackx;
1,361,435
String[][] getZoneStrings(Locale locale) { return LocaleProviderAdapter.forType(type).getLocaleResources(locale).getZoneStrings(); }
String[][] getZoneStrings(Locale locale) { return LocaleProviderAdapter.forType(type).getLocaleResources(locale).getZoneStrings(); }
/** * Returns a String[][] as the DateFormatSymbols.getZoneStrings() value for * the given locale. This method is package private. * * @param locale a Locale for time zone names * @return an array of time zone names arrays */
Returns a String[][] as the DateFormatSymbols.getZoneStrings() value for the given locale. This method is package private
getZoneStrings
{ "repo_name": "karianna/jdk8_tl", "path": "jdk/src/share/classes/sun/util/locale/provider/TimeZoneNameProviderImpl.java", "license": "gpl-2.0", "size": 5505 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
92,280
CommonFactory getCommonFactory(); interface Literals { EClass IADAPTABLE = eINSTANCE.getIAdaptable(); EClass OBJECT_FEATURE = eINSTANCE.getObjectFeature(); EReference OBJECT_FEATURE__OBJECT = eINSTANCE.getObjectFeature_Object(); EReference OBJECT_FEATURE__FEATURE = eINSTANCE.getObjectFeature_Feature(); EClass MISSION_EXTENDABLE = eINSTANCE.getMissionExtendable(); EEnum TIMEPOINT = eINSTANCE.getTimepoint(); EDataType EURI = eINSTANCE.getEURI(); EDataType EURL = eINSTANCE.getEURL(); EDataType IPATH = eINSTANCE.getIPath(); }
CommonFactory getCommonFactory(); interface Literals { EClass IADAPTABLE = eINSTANCE.getIAdaptable(); EClass OBJECT_FEATURE = eINSTANCE.getObjectFeature(); EReference OBJECT_FEATURE__OBJECT = eINSTANCE.getObjectFeature_Object(); EReference OBJECT_FEATURE__FEATURE = eINSTANCE.getObjectFeature_Feature(); EClass MISSION_EXTENDABLE = eINSTANCE.getMissionExtendable(); EEnum TIMEPOINT = eINSTANCE.getTimepoint(); EDataType EURI = eINSTANCE.getEURI(); EDataType EURL = eINSTANCE.getEURL(); EDataType IPATH = eINSTANCE.getIPath(); }
/** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the factory that creates the instances of the model. * @generated */
Returns the factory that creates the instances of the model.
getCommonFactory
{ "repo_name": "nasa/OpenSPIFe", "path": "gov.nasa.ensemble.emf/src/gov/nasa/ensemble/emf/model/common/CommonPackage.java", "license": "apache-2.0", "size": 12509 }
[ "org.eclipse.emf.ecore.EClass", "org.eclipse.emf.ecore.EDataType", "org.eclipse.emf.ecore.EEnum", "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,010,231
public Point2D getPoint2() { return new Point2D.Float(x2, y2); }
Point2D function() { return new Point2D.Float(x2, y2); }
/** * Returns a point with the same coordinates as the anchor point for color 2. * Note that if you modify this point, the <code>GradientPaint</code> remains * unchanged. * * @return A point with the same coordinates as the anchor point for color 2. */
Returns a point with the same coordinates as the anchor point for color 2. Note that if you modify this point, the <code>GradientPaint</code> remains unchanged
getPoint2
{ "repo_name": "SanDisk-Open-Source/SSD_Dashboard", "path": "uefi/gcc/gcc-4.6.3/libjava/classpath/java/awt/GradientPaint.java", "license": "gpl-2.0", "size": 7888 }
[ "java.awt.geom.Point2D" ]
import java.awt.geom.Point2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
1,127,777
private static void encodeHeader(DnsResponse response, ByteBuf buf) { buf.writeShort(response.id()); int flags = 32768; flags |= (response.opCode().byteValue() & 0xFF) << 11; if (response.isAuthoritativeAnswer()) { flags |= 1 << 10; } if (response.isTruncated()) { flags |= 1 << 9; } if (response.isRecursionDesired()) { flags |= 1 << 8; } if (response.isRecursionAvailable()) { flags |= 1 << 7; } flags |= response.z() << 4; flags |= response.code().intValue(); buf.writeShort(flags); buf.writeShort(response.count(DnsSection.QUESTION)); buf.writeShort(response.count(DnsSection.ANSWER)); buf.writeShort(response.count(DnsSection.AUTHORITY)); buf.writeShort(response.count(DnsSection.ADDITIONAL)); }
static void function(DnsResponse response, ByteBuf buf) { buf.writeShort(response.id()); int flags = 32768; flags = (response.opCode().byteValue() & 0xFF) << 11; if (response.isAuthoritativeAnswer()) { flags = 1 << 10; } if (response.isTruncated()) { flags = 1 << 9; } if (response.isRecursionDesired()) { flags = 1 << 8; } if (response.isRecursionAvailable()) { flags = 1 << 7; } flags = response.z() << 4; flags = response.code().intValue(); buf.writeShort(flags); buf.writeShort(response.count(DnsSection.QUESTION)); buf.writeShort(response.count(DnsSection.ANSWER)); buf.writeShort(response.count(DnsSection.AUTHORITY)); buf.writeShort(response.count(DnsSection.ADDITIONAL)); }
/** * Encodes the header that is always 12 bytes long. * * @param response the response header being encoded * @param buf the buffer the encoded data should be written to */
Encodes the header that is always 12 bytes long
encodeHeader
{ "repo_name": "wangcy6/storm_app", "path": "frame/java/netty-4.1/codec-dns/src/main/java/io/netty/handler/codec/dns/DatagramDnsResponseEncoder.java", "license": "apache-2.0", "size": 4944 }
[ "io.netty.buffer.ByteBuf" ]
import io.netty.buffer.ByteBuf;
import io.netty.buffer.*;
[ "io.netty.buffer" ]
io.netty.buffer;
465,332
public byte[] getData() { return ((PixelArrayByte)this.pixelArray).getData(); }
byte[] function() { return ((PixelArrayByte)this.pixelArray).getData(); }
/** * Provides direct access to underlying byte array of pixel data. */
Provides direct access to underlying byte array of pixel data
getData
{ "repo_name": "AngelBanuelos/hipi", "path": "core/src/main/java/org/hipi/image/ByteImage.java", "license": "bsd-3-clause", "size": 3239 }
[ "org.hipi.image.PixelArrayByte" ]
import org.hipi.image.PixelArrayByte;
import org.hipi.image.*;
[ "org.hipi.image" ]
org.hipi.image;
2,576,686
public void setTop(double value) { JsoHelper.setAttribute(jsObj, TouchAttribute.TOP.getValue(), value); }
void function(double value) { JsoHelper.setAttribute(jsObj, TouchAttribute.TOP.getValue(), value); }
/** * Defaults to: null */
Defaults to: null
setTop
{ "repo_name": "ahome-it/ahome-touch", "path": "ahome-touch/src/main/java/com/ait/toolkit/sencha/touch/client/core/config/ComponentConfig.java", "license": "apache-2.0", "size": 12717 }
[ "com.ait.toolkit.core.client.JsoHelper" ]
import com.ait.toolkit.core.client.JsoHelper;
import com.ait.toolkit.core.client.*;
[ "com.ait.toolkit" ]
com.ait.toolkit;
1,545,698
public void testGetProcessDefinitions() throws Exception { try { Deployment firstDeployment = repositoryService.createDeployment().name("Deployment 1").addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml").deploy(); Deployment secondDeployment = repositoryService.createDeployment().name("Deployment 2").addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcess.bpmn20.xml") .addClasspathResource("org/activiti/rest/service/api/repository/twoTaskProcess.bpmn20.xml").deploy(); Deployment thirdDeployment = repositoryService.createDeployment().name("Deployment 3").addClasspathResource("org/activiti/rest/service/api/repository/oneTaskProcessWithDi.bpmn20.xml").deploy(); ProcessDefinition oneTaskProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").deploymentId(firstDeployment.getId()).singleResult(); ProcessDefinition latestOneTaskProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").deploymentId(secondDeployment.getId()).singleResult(); ProcessDefinition twoTaskprocess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("twoTaskProcess").deploymentId(secondDeployment.getId()).singleResult(); ProcessDefinition oneTaskWithDiProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcessWithDi").deploymentId(thirdDeployment.getId()).singleResult(); // Test parameterless call String baseUrl = RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_COLLECTION); assertResultsPresentInDataResponse(baseUrl, oneTaskProcess.getId(), twoTaskprocess.getId(), latestOneTaskProcess.getId(), oneTaskWithDiProcess.getId()); // Verify ACT-2141 Persistent isGraphicalNotation flag for process // definitions CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + baseUrl), HttpStatus.SC_OK); JsonNode dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data"); closeResponse(response); for (int i = 0; i < dataNode.size(); i++) { JsonNode processDefinitionJson = dataNode.get(i); String key = processDefinitionJson.get("key").asText(); JsonNode graphicalNotationNode = processDefinitionJson.get("graphicalNotationDefined"); if (key.equals("oneTaskProcessWithDi")) { assertTrue(graphicalNotationNode.asBoolean()); } else { assertFalse(graphicalNotationNode.asBoolean()); } } // Verify // Test name filtering String url = baseUrl + "?name=" + encode("The Two Task Process"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test nameLike filtering url = baseUrl + "?nameLike=" + encode("The Two%"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test key filtering url = baseUrl + "?key=twoTaskProcess"; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test returning multiple versions for the same key url = baseUrl + "?key=oneTaskProcess"; assertResultsPresentInDataResponse(url, oneTaskProcess.getId(), latestOneTaskProcess.getId()); // Test keyLike filtering url = baseUrl + "?keyLike=" + encode("two%"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test category filtering url = baseUrl + "?category=TwoTaskCategory"; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test categoryLike filtering url = baseUrl + "?categoryLike=" + encode("Two%"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test categoryNotEquals filtering url = baseUrl + "?categoryNotEquals=OneTaskCategory"; assertResultsPresentInDataResponse(url, twoTaskprocess.getId(), oneTaskWithDiProcess.getId()); // Test resourceName filtering url = baseUrl + "?resourceName=org/activiti/rest/service/api/repository/twoTaskProcess.bpmn20.xml"; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test resourceNameLike filtering url = baseUrl + "?resourceNameLike=" + encode("%twoTaskProcess%"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test version filtering url = baseUrl + "?version=2"; assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId()); // Test latest filtering url = baseUrl + "?latest=true"; assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId(), twoTaskprocess.getId(), oneTaskWithDiProcess.getId()); url = baseUrl + "?latest=false"; assertResultsPresentInDataResponse(baseUrl, oneTaskProcess.getId(), twoTaskprocess.getId(), latestOneTaskProcess.getId(), oneTaskWithDiProcess.getId()); // Test deploymentId url = baseUrl + "?deploymentId=" + secondDeployment.getId(); assertResultsPresentInDataResponse(url, twoTaskprocess.getId(), latestOneTaskProcess.getId()); // Test startableByUser url = baseUrl + "?startableByUser=kermit"; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); // Test suspended repositoryService.suspendProcessDefinitionById(twoTaskprocess.getId()); url = baseUrl + "?suspended=true"; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + "?suspended=false"; assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId(), oneTaskProcess.getId(), oneTaskWithDiProcess.getId()); } finally { // Always cleanup any created deployments, even if the test failed List<Deployment> deployments = repositoryService.createDeploymentQuery().list(); for (Deployment deployment : deployments) { repositoryService.deleteDeployment(deployment.getId(), true); } } }
void function() throws Exception { try { Deployment firstDeployment = repositoryService.createDeployment().name(STR).addClasspathResource(STR).deploy(); Deployment secondDeployment = repositoryService.createDeployment().name(STR).addClasspathResource(STR) .addClasspathResource(STR).deploy(); Deployment thirdDeployment = repositoryService.createDeployment().name(STR).addClasspathResource(STR).deploy(); ProcessDefinition oneTaskProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey(STR).deploymentId(firstDeployment.getId()).singleResult(); ProcessDefinition latestOneTaskProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey(STR).deploymentId(secondDeployment.getId()).singleResult(); ProcessDefinition twoTaskprocess = repositoryService.createProcessDefinitionQuery().processDefinitionKey(STR).deploymentId(secondDeployment.getId()).singleResult(); ProcessDefinition oneTaskWithDiProcess = repositoryService.createProcessDefinitionQuery().processDefinitionKey(STR).deploymentId(thirdDeployment.getId()).singleResult(); String baseUrl = RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_DEFINITION_COLLECTION); assertResultsPresentInDataResponse(baseUrl, oneTaskProcess.getId(), twoTaskprocess.getId(), latestOneTaskProcess.getId(), oneTaskWithDiProcess.getId()); CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX + baseUrl), HttpStatus.SC_OK); JsonNode dataNode = objectMapper.readTree(response.getEntity().getContent()).get("data"); closeResponse(response); for (int i = 0; i < dataNode.size(); i++) { JsonNode processDefinitionJson = dataNode.get(i); String key = processDefinitionJson.get("key").asText(); JsonNode graphicalNotationNode = processDefinitionJson.get(STR); if (key.equals(STR)) { assertTrue(graphicalNotationNode.asBoolean()); } else { assertFalse(graphicalNotationNode.asBoolean()); } } String url = baseUrl + STR + encode(STR); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR + encode(STR); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, oneTaskProcess.getId(), latestOneTaskProcess.getId()); url = baseUrl + STR + encode("two%"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR + encode("Two%"); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, twoTaskprocess.getId(), oneTaskWithDiProcess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR + encode(STR); assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId(), twoTaskprocess.getId(), oneTaskWithDiProcess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(baseUrl, oneTaskProcess.getId(), twoTaskprocess.getId(), latestOneTaskProcess.getId(), oneTaskWithDiProcess.getId()); url = baseUrl + STR + secondDeployment.getId(); assertResultsPresentInDataResponse(url, twoTaskprocess.getId(), latestOneTaskProcess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); repositoryService.suspendProcessDefinitionById(twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, twoTaskprocess.getId()); url = baseUrl + STR; assertResultsPresentInDataResponse(url, latestOneTaskProcess.getId(), oneTaskProcess.getId(), oneTaskWithDiProcess.getId()); } finally { List<Deployment> deployments = repositoryService.createDeploymentQuery().list(); for (Deployment deployment : deployments) { repositoryService.deleteDeployment(deployment.getId(), true); } } }
/** * Test getting process definitions. GET repository/process-definitions */
Test getting process definitions. GET repository/process-definitions
testGetProcessDefinitions
{ "repo_name": "roberthafner/flowable-engine", "path": "modules/flowable-rest/src/test/java/org/activiti/rest/service/api/repository/ProcessDefinitionCollectionResourceTest.java", "license": "apache-2.0", "size": 6796 }
[ "com.fasterxml.jackson.databind.JsonNode", "java.util.List", "org.activiti.engine.repository.Deployment", "org.activiti.engine.repository.ProcessDefinition", "org.activiti.rest.service.api.RestUrls", "org.apache.http.HttpStatus", "org.apache.http.client.methods.CloseableHttpResponse", "org.apache.http.client.methods.HttpGet" ]
import com.fasterxml.jackson.databind.JsonNode; import java.util.List; import org.activiti.engine.repository.Deployment; import org.activiti.engine.repository.ProcessDefinition; import org.activiti.rest.service.api.RestUrls; import org.apache.http.HttpStatus; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet;
import com.fasterxml.jackson.databind.*; import java.util.*; import org.activiti.engine.repository.*; import org.activiti.rest.service.api.*; import org.apache.http.*; import org.apache.http.client.methods.*;
[ "com.fasterxml.jackson", "java.util", "org.activiti.engine", "org.activiti.rest", "org.apache.http" ]
com.fasterxml.jackson; java.util; org.activiti.engine; org.activiti.rest; org.apache.http;
1,338,217
@Test public void coordinateEquals5() { final Double x = new Double(1245.2132123); final Double y = new Double(-1231412.123); final Coordinate<Double> coordinate = new Coordinate<>(x,y); final Coordinate<Double> coordinate2 = new Coordinate<>(x,y); assertEquals("The equals method in coordinate returned false when it should have returned true.", coordinate, coordinate2); }
void function() { final Double x = new Double(1245.2132123); final Double y = new Double(-1231412.123); final Coordinate<Double> coordinate = new Coordinate<>(x,y); final Coordinate<Double> coordinate2 = new Coordinate<>(x,y); assertEquals(STR, coordinate, coordinate2); }
/** * Tests if the .equals function in Coordinate returns the expected values */
Tests if the .equals function in Coordinate returns the expected values
coordinateEquals5
{ "repo_name": "GitHubRGI/swagd", "path": "Common/src/test/java/com/rgi/common/coordinate/CoordinateTest.java", "license": "mit", "size": 9171 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,891,089
Set<?> getWriteACLs(ActiveMQDestination destination);
Set<?> getWriteACLs(ActiveMQDestination destination);
/** * Returns the set of all ACLs capable of writing to the given destination */
Returns the set of all ACLs capable of writing to the given destination
getWriteACLs
{ "repo_name": "Mark-Booth/daq-eclipse", "path": "uk.ac.diamond.org.apache.activemq/org/apache/activemq/security/AuthorizationMap.java", "license": "epl-1.0", "size": 1869 }
[ "java.util.Set", "org.apache.activemq.command.ActiveMQDestination" ]
import java.util.Set; import org.apache.activemq.command.ActiveMQDestination;
import java.util.*; import org.apache.activemq.command.*;
[ "java.util", "org.apache.activemq" ]
java.util; org.apache.activemq;
1,421,170
public static Address getObjectEndAddress(Object obj, RVMArray type, int numElements) { int size = type.getInstanceSize(numElements); if (ADDRESS_BASED_HASHING && DYNAMIC_HASH_OFFSET) { Word hashState = Magic.getWordAtOffset(obj, STATUS_OFFSET).and(HASH_STATE_MASK); if (hashState.EQ(HASH_STATE_HASHED_AND_MOVED)) { size += HASHCODE_BYTES; } } return Magic.objectAsAddress(obj).plus(Memory.alignUp(size, SizeConstants.BYTES_IN_INT) - OBJECT_REF_OFFSET); }
static Address function(Object obj, RVMArray type, int numElements) { int size = type.getInstanceSize(numElements); if (ADDRESS_BASED_HASHING && DYNAMIC_HASH_OFFSET) { Word hashState = Magic.getWordAtOffset(obj, STATUS_OFFSET).and(HASH_STATE_MASK); if (hashState.EQ(HASH_STATE_HASHED_AND_MOVED)) { size += HASHCODE_BYTES; } } return Magic.objectAsAddress(obj).plus(Memory.alignUp(size, SizeConstants.BYTES_IN_INT) - OBJECT_REF_OFFSET); }
/** * What is the first word after the array? */
What is the first word after the array
getObjectEndAddress
{ "repo_name": "ut-osa/laminar", "path": "jikesrvm-3.0.0/rvm/src/org/jikesrvm/objectmodel/JavaHeader.java", "license": "bsd-3-clause", "size": 33287 }
[ "org.jikesrvm.SizeConstants", "org.jikesrvm.classloader.RVMArray", "org.jikesrvm.runtime.Magic", "org.jikesrvm.runtime.Memory", "org.vmmagic.unboxed.Address", "org.vmmagic.unboxed.Word" ]
import org.jikesrvm.SizeConstants; import org.jikesrvm.classloader.RVMArray; import org.jikesrvm.runtime.Magic; import org.jikesrvm.runtime.Memory; import org.vmmagic.unboxed.Address; import org.vmmagic.unboxed.Word;
import org.jikesrvm.*; import org.jikesrvm.classloader.*; import org.jikesrvm.runtime.*; import org.vmmagic.unboxed.*;
[ "org.jikesrvm", "org.jikesrvm.classloader", "org.jikesrvm.runtime", "org.vmmagic.unboxed" ]
org.jikesrvm; org.jikesrvm.classloader; org.jikesrvm.runtime; org.vmmagic.unboxed;
928,871
protected B initialSettings(Http2Settings settings) { initialSettings = checkNotNull(settings, "settings"); return self(); }
B function(Http2Settings settings) { initialSettings = checkNotNull(settings, STR); return self(); }
/** * Sets the {@link Http2Settings} to use for the initial connection settings exchange. */
Sets the <code>Http2Settings</code> to use for the initial connection settings exchange
initialSettings
{ "repo_name": "mcobrien/netty", "path": "codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java", "license": "apache-2.0", "size": 17923 }
[ "io.netty.util.internal.ObjectUtil" ]
import io.netty.util.internal.ObjectUtil;
import io.netty.util.internal.*;
[ "io.netty.util" ]
io.netty.util;
65,583