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
public void setCms(CmsObject cms) { m_cms = cms; }
void function(CmsObject cms) { m_cms = cms; }
/** * Sets the CMS object.<p> * * @param cms the CMS object */
Sets the CMS object
setCms
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/gwt/CmsAliasHelper.java", "license": "lgpl-2.1", "size": 10337 }
[ "org.opencms.file.CmsObject" ]
import org.opencms.file.CmsObject;
import org.opencms.file.*;
[ "org.opencms.file" ]
org.opencms.file;
1,312,436
public void setQualifiers(Map<String, List<JacksonSnak>> qualifiers) { this.qualifiers = qualifiers; }
void function(Map<String, List<JacksonSnak>> qualifiers) { this.qualifiers = qualifiers; }
/** * Sets the qualifiers to the given value. Only for use by Jackson during * deserialization. * * @param qualifiers * new value */
Sets the qualifiers to the given value. Only for use by Jackson during deserialization
setQualifiers
{ "repo_name": "monkey2000/Wikidata-Toolkit", "path": "wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/json/jackson/JacksonStatement.java", "license": "apache-2.0", "size": 8379 }
[ "java.util.List", "java.util.Map" ]
import java.util.List; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
967,887
protected void emit_ClauseExpression_BoostTerminalRuleCall_1_1_0_2_1_1_2_q(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
void function(EObject semanticObject, ISynNavigable transition, List<INode> nodes) { acceptNodes(transition, nodes); }
/** * Syntax: * Boost? */
Syntax: Boost
emit_ClauseExpression_BoostTerminalRuleCall_1_1_0_2_1_1_2_q
{ "repo_name": "tobiasb/CodeFinder", "path": "plugins/org.eclipselabs.recommenders.codesearch.rcp.dsl/src-gen/org/eclipselabs/recommenders/codesearch/rcp/dsl/serializer/AbstractLuceneQuerySyntacticSequencer.java", "license": "epl-1.0", "size": 25261 }
[ "java.util.List", "org.eclipse.emf.ecore.EObject", "org.eclipse.xtext.nodemodel.INode", "org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider" ]
import java.util.List; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.serializer.analysis.ISyntacticSequencerPDAProvider;
import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.xtext.nodemodel.*; import org.eclipse.xtext.serializer.analysis.*;
[ "java.util", "org.eclipse.emf", "org.eclipse.xtext" ]
java.util; org.eclipse.emf; org.eclipse.xtext;
876,416
AmazonS3 client = null; AmazonS3ClientBuilder clientBuilder = null; AmazonS3EncryptionClientBuilder encClientBuilder = null; ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setMaxConnections(maxConnections); if (configuration.hasProxyConfiguration()) { clientConfiguration.setProxyProtocol(configuration.getProxyProtocol()); clientConfiguration.setProxyHost(configuration.getProxyHost()); clientConfiguration.setProxyPort(configuration.getProxyPort()); } if (configuration.getAccessKey() != null || configuration.getSecretKey() != null) { LOG.trace("Do not pass in unnecessary static credentials when selecting the IAM credential option."); } if (!configuration.isUseEncryption()) { clientBuilder = AmazonS3ClientBuilder.standard().withCredentials(new InstanceProfileCredentialsProvider(false)); } else if (configuration.isUseEncryption()) { StaticEncryptionMaterialsProvider encryptionMaterialsProvider = new StaticEncryptionMaterialsProvider(configuration.getEncryptionMaterials()); encClientBuilder = AmazonS3EncryptionClientBuilder.standard().withClientConfiguration(clientConfiguration).withEncryptionMaterials(encryptionMaterialsProvider) .withCredentials(new InstanceProfileCredentialsProvider(false)); } else { clientBuilder = AmazonS3ClientBuilder.standard().withClientConfiguration(clientConfiguration).withCredentials(new InstanceProfileCredentialsProvider(false)); } if (!configuration.isUseEncryption()) { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = clientBuilder.build(); } else { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = encClientBuilder.build(); } return client; }
AmazonS3 client = null; AmazonS3ClientBuilder clientBuilder = null; AmazonS3EncryptionClientBuilder encClientBuilder = null; ClientConfiguration clientConfiguration = new ClientConfiguration(); clientConfiguration.setMaxConnections(maxConnections); if (configuration.hasProxyConfiguration()) { clientConfiguration.setProxyProtocol(configuration.getProxyProtocol()); clientConfiguration.setProxyHost(configuration.getProxyHost()); clientConfiguration.setProxyPort(configuration.getProxyPort()); } if (configuration.getAccessKey() != null configuration.getSecretKey() != null) { LOG.trace(STR); } if (!configuration.isUseEncryption()) { clientBuilder = AmazonS3ClientBuilder.standard().withCredentials(new InstanceProfileCredentialsProvider(false)); } else if (configuration.isUseEncryption()) { StaticEncryptionMaterialsProvider encryptionMaterialsProvider = new StaticEncryptionMaterialsProvider(configuration.getEncryptionMaterials()); encClientBuilder = AmazonS3EncryptionClientBuilder.standard().withClientConfiguration(clientConfiguration).withEncryptionMaterials(encryptionMaterialsProvider) .withCredentials(new InstanceProfileCredentialsProvider(false)); } else { clientBuilder = AmazonS3ClientBuilder.standard().withClientConfiguration(clientConfiguration).withCredentials(new InstanceProfileCredentialsProvider(false)); } if (!configuration.isUseEncryption()) { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = clientBuilder.build(); } else { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = encClientBuilder.build(); } return client; }
/** * Getting the s3 aws client that is used. * * @return Amazon S3 Client. */
Getting the s3 aws client that is used
getS3Client
{ "repo_name": "objectiser/camel", "path": "components/camel-aws-s3/src/main/java/org/apache/camel/component/aws/s3/client/impl/S3ClientIAMOptimizedImpl.java", "license": "apache-2.0", "size": 4849 }
[ "com.amazonaws.ClientConfiguration", "com.amazonaws.auth.InstanceProfileCredentialsProvider", "com.amazonaws.regions.Regions", "com.amazonaws.services.s3.AmazonS3", "com.amazonaws.services.s3.AmazonS3ClientBuilder", "com.amazonaws.services.s3.AmazonS3EncryptionClientBuilder", "com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider", "org.apache.camel.util.ObjectHelper" ]
import com.amazonaws.ClientConfiguration; import com.amazonaws.auth.InstanceProfileCredentialsProvider; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.AmazonS3EncryptionClientBuilder; import com.amazonaws.services.s3.model.StaticEncryptionMaterialsProvider; import org.apache.camel.util.ObjectHelper;
import com.amazonaws.*; import com.amazonaws.auth.*; import com.amazonaws.regions.*; import com.amazonaws.services.s3.*; import com.amazonaws.services.s3.model.*; import org.apache.camel.util.*;
[ "com.amazonaws", "com.amazonaws.auth", "com.amazonaws.regions", "com.amazonaws.services", "org.apache.camel" ]
com.amazonaws; com.amazonaws.auth; com.amazonaws.regions; com.amazonaws.services; org.apache.camel;
2,085,001
@Nullable public long[] getLongArray(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { return null; } try { return (long[]) o; } catch (ClassCastException e) { typeWarning(key, o, "long[]", e); return null; } }
long[] function(@Nullable String key) { unparcel(); Object o = mMap.get(key); if (o == null) { return null; } try { return (long[]) o; } catch (ClassCastException e) { typeWarning(key, o, STR, e); return null; } }
/** * Returns the value associated with the given key, or null if * no mapping of the desired type exists for the given key or a null * value is explicitly associated with the key. * * @param key a String, or null * @return a long[] value, or null */
Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key
getLongArray
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/os/BaseBundle.java", "license": "gpl-3.0", "size": 41590 }
[ "android.annotation.Nullable" ]
import android.annotation.Nullable;
import android.annotation.*;
[ "android.annotation" ]
android.annotation;
2,000,310
String workspaceRoot = System.getProperty(ISystemPropertyEnum.WORKSPACE_PATH); String path = workspaceRoot + File.separator + role.getProjectName() + File.separator + "_metadata" + File.separator + ScrumEnum.SCRUMROLE_FILE; String defaultpath = workspaceRoot + File.separator + "_metadata" + File.separator + "ScrumRole.xml"; Document doc = XmlFileUtil.LoadXmlFile(path); if (doc == null) { // load default file doc = XmlFileUtil.LoadXmlFile(defaultpath); } // root Element root = doc.getRootElement(); Element s_role = root.getChild(role.getRoleName()); if (s_role != null) { s_role.removeContent(); } else { s_role = new Element(role.getRoleName()); root.addContent(s_role); } //if access product backlog equal true, set the text in the ScrumRole.xml if(role.getAccessProductBacklog()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_PRODUCTBACKLOG); s_role.addContent(element); } //if access release plan equal true, set the text in the ScrumRole.xml if(role.getAccessReleasePlan()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_RELEASEPLAN); s_role.addContent(element); } //if access sprint plan equal true, set the text in the ScrumRole.xml if(role.getAccessSprintPlan()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_SPRINTPLAN); s_role.addContent(element); } //if access sprint backlog equal true, set the text in the ScrumRole.xml if(role.getAccessSprintBacklog()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_SPRINTBACKLOG); s_role.addContent(element); } //if access taskboard equal true, set the text in the ScrumRole.xml if(role.getAccessTaskBoard()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_TASKBOARD); s_role.addContent(element); } //if access unplanned equal true, set the text in the ScrumRole.xml if(role.getAccessUnplannedItem()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_UNPLANNED); s_role.addContent(element); } //if access retrospective equal true, set the text in the ScrumRole.xml if(role.getAccessRetrospective()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_RETROSPECTIVE); s_role.addContent(element); } //if access read report equal true, set the text in the ScrumRole.xml if(role.getReadReport()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_REPORT); s_role.addContent(element); } //if access edit project equal true, set the text in the ScrumRole.xml if(role.getEditProject()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_EDITPROJECT); s_role.addContent(element); } //save file XmlFileUtil.SaveXmlFile(path, doc); }
String workspaceRoot = System.getProperty(ISystemPropertyEnum.WORKSPACE_PATH); String path = workspaceRoot + File.separator + role.getProjectName() + File.separator + STR + File.separator + ScrumEnum.SCRUMROLE_FILE; String defaultpath = workspaceRoot + File.separator + STR + File.separator + STR; Document doc = XmlFileUtil.LoadXmlFile(path); if (doc == null) { doc = XmlFileUtil.LoadXmlFile(defaultpath); } Element root = doc.getRootElement(); Element s_role = root.getChild(role.getRoleName()); if (s_role != null) { s_role.removeContent(); } else { s_role = new Element(role.getRoleName()); root.addContent(s_role); } if(role.getAccessProductBacklog()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_PRODUCTBACKLOG); s_role.addContent(element); } if(role.getAccessReleasePlan()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_RELEASEPLAN); s_role.addContent(element); } if(role.getAccessSprintPlan()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_SPRINTPLAN); s_role.addContent(element); } if(role.getAccessSprintBacklog()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_SPRINTBACKLOG); s_role.addContent(element); } if(role.getAccessTaskBoard()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_TASKBOARD); s_role.addContent(element); } if(role.getAccessUnplannedItem()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_UNPLANNED); s_role.addContent(element); } if(role.getAccessRetrospective()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_RETROSPECTIVE); s_role.addContent(element); } if(role.getReadReport()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_REPORT); s_role.addContent(element); } if(role.getEditProject()){ Element element = new Element(ScrumEnum.SCRUMROLE_FILE_TAG_PERMISSION); element.setText(ScrumEnum.ACCESS_EDITPROJECT); s_role.addContent(element); } XmlFileUtil.SaveXmlFile(path, doc); }
/** * update permission by ScrumRole */
update permission by ScrumRole
update
{ "repo_name": "ezScrum/ezScrum_1.7.2_export", "path": "java/ntut/csie/ezScrum/web/mapper/ScrumRoleMapper.java", "license": "gpl-2.0", "size": 7935 }
[ "java.io.File", "org.jdom.Document", "org.jdom.Element" ]
import java.io.File; import org.jdom.Document; import org.jdom.Element;
import java.io.*; import org.jdom.*;
[ "java.io", "org.jdom" ]
java.io; org.jdom;
964,500
public static Image toGrayscale(Image source) { if (source == null) return null; BufferedImage src = new BufferedImage(source.getWidth(null), source .getHeight(null), BufferedImage.TYPE_INT_ARGB); src.getGraphics().drawImage(source, 0, 0, null); BufferedImageOp op = new ColorConvertOp(ColorSpace .getInstance(ColorSpace.CS_GRAY), null); return op.filter(src, null); }
static Image function(Image source) { if (source == null) return null; BufferedImage src = new BufferedImage(source.getWidth(null), source .getHeight(null), BufferedImage.TYPE_INT_ARGB); src.getGraphics().drawImage(source, 0, 0, null); BufferedImageOp op = new ColorConvertOp(ColorSpace .getInstance(ColorSpace.CS_GRAY), null); return op.filter(src, null); }
/** * Converts an image to grayscale */
Converts an image to grayscale
toGrayscale
{ "repo_name": "mathieulegoc/SmartTokens", "path": "material/tokenNotifier/src/fr/aviz/tokennotifier/util/GUIUtils.java", "license": "mit", "size": 21870 }
[ "java.awt.Image", "java.awt.color.ColorSpace", "java.awt.image.BufferedImage", "java.awt.image.BufferedImageOp", "java.awt.image.ColorConvertOp" ]
import java.awt.Image; import java.awt.color.ColorSpace; import java.awt.image.BufferedImage; import java.awt.image.BufferedImageOp; import java.awt.image.ColorConvertOp;
import java.awt.*; import java.awt.color.*; import java.awt.image.*;
[ "java.awt" ]
java.awt;
1,836,247
public void testLocalTime() { try { // Create some data we can use for access PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); LocalTime localTime1 = LocalTime.of(15, 9, 26); LocalTime localTime2 = LocalTime.of(7, 9, 26); Object id = null; try { tx.begin(); JavaxtimeSample3 s = new JavaxtimeSample3(1, localTime1, localTime2); pm.makePersistent(s); tx.commit(); id = pm.getObjectId(s); } catch (Exception e) { LOG.error("Error persisting LocalTime sample", e); fail("Error persisting LocalTime sample"); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } // Retrieve the data pm = pmf.getPersistenceManager(); tx = pm.currentTransaction(); try { tx.begin(); JavaxtimeSample3 s = (JavaxtimeSample3)pm.getObjectById(id); LocalTime lt1 = s.getLocalTime1(); assertNotNull("Retrieved LocalTime was null!", lt1); assertEquals("Hour was wrong", 15, lt1.getHourOfDay()); assertEquals("Minute was wrong", 9, lt1.getMinuteOfHour()); assertEquals("Second was wrong", 26, lt1.getSecondOfMinute()); LocalTime lt2 = s.getLocalTime2(); assertNotNull("Retrieved LocalTime was null!", lt2); assertEquals("Hour was wrong", 7, lt2.getHourOfDay()); assertEquals("Minute was wrong", 9, lt2.getMinuteOfHour()); assertEquals("Second was wrong", 26, lt2.getSecondOfMinute()); tx.commit(); } catch (Exception e) { LOG.error("Error retrieving LocalTime data", e); fail("Error retrieving LocalTime data : " + e.getMessage()); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } } finally { clean(JavaxtimeSample3.class); } }
void function() { try { PersistenceManager pm = pmf.getPersistenceManager(); Transaction tx = pm.currentTransaction(); LocalTime localTime1 = LocalTime.of(15, 9, 26); LocalTime localTime2 = LocalTime.of(7, 9, 26); Object id = null; try { tx.begin(); JavaxtimeSample3 s = new JavaxtimeSample3(1, localTime1, localTime2); pm.makePersistent(s); tx.commit(); id = pm.getObjectId(s); } catch (Exception e) { LOG.error(STR, e); fail(STR); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } pm = pmf.getPersistenceManager(); tx = pm.currentTransaction(); try { tx.begin(); JavaxtimeSample3 s = (JavaxtimeSample3)pm.getObjectById(id); LocalTime lt1 = s.getLocalTime1(); assertNotNull(STR, lt1); assertEquals(STR, 15, lt1.getHourOfDay()); assertEquals(STR, 9, lt1.getMinuteOfHour()); assertEquals(STR, 26, lt1.getSecondOfMinute()); LocalTime lt2 = s.getLocalTime2(); assertNotNull(STR, lt2); assertEquals(STR, 7, lt2.getHourOfDay()); assertEquals(STR, 9, lt2.getMinuteOfHour()); assertEquals(STR, 26, lt2.getSecondOfMinute()); tx.commit(); } catch (Exception e) { LOG.error(STR, e); fail(STR + e.getMessage()); } finally { if (tx.isActive()) { tx.rollback(); } pm.close(); } } finally { clean(JavaxtimeSample3.class); } }
/** * Test for LocalTime persistence and retrieval. */
Test for LocalTime persistence and retrieval
testLocalTime
{ "repo_name": "hopecee/texsts", "path": "jdo/general/src/test/org/datanucleus/tests/types/JavaxTimeTest.java", "license": "apache-2.0", "size": 12884 }
[ "javax.jdo.PersistenceManager", "javax.jdo.Transaction", "javax.time.calendar.LocalTime", "org.datanucleus.samples.types.javaxtime.JavaxtimeSample3" ]
import javax.jdo.PersistenceManager; import javax.jdo.Transaction; import javax.time.calendar.LocalTime; import org.datanucleus.samples.types.javaxtime.JavaxtimeSample3;
import javax.jdo.*; import javax.time.calendar.*; import org.datanucleus.samples.types.javaxtime.*;
[ "javax.jdo", "javax.time", "org.datanucleus.samples" ]
javax.jdo; javax.time; org.datanucleus.samples;
1,098,655
public void setTickLabelFont(Comparable category, Font font) { if (category == null) { throw new IllegalArgumentException("Null 'category' argument."); } if (font == null) { this.tickLabelFontMap.remove(category); } else { this.tickLabelFontMap.put(category, font); } notifyListeners(new AxisChangeEvent(this)); }
void function(Comparable category, Font font) { if (category == null) { throw new IllegalArgumentException(STR); } if (font == null) { this.tickLabelFontMap.remove(category); } else { this.tickLabelFontMap.put(category, font); } notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the font for the tick label for the specified category and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param category * the category (<code>null</code> not permitted). * @param font * the font (<code>null</code> permitted). * * @see #getTickLabelFont(Comparable) */
Sets the font for the tick label for the specified category and sends an <code>AxisChangeEvent</code> to all registered listeners
setTickLabelFont
{ "repo_name": "djun100/afreechart", "path": "src/org/afree/chart/axis/CategoryAxis.java", "license": "lgpl-3.0", "size": 50274 }
[ "org.afree.chart.event.AxisChangeEvent", "org.afree.graphics.geom.Font" ]
import org.afree.chart.event.AxisChangeEvent; import org.afree.graphics.geom.Font;
import org.afree.chart.event.*; import org.afree.graphics.geom.*;
[ "org.afree.chart", "org.afree.graphics" ]
org.afree.chart; org.afree.graphics;
180,334
@Override protected PreparedStatement setPreparedStatement(PreparedStatement pstmt, Object object) throws AuditException { try { ATNAAuditSource as = (ATNAAuditSource) object; logger.trace("AS Prepared Statement For: " + as.getUniqueID()); if (action == DAO_ACTION_INSERT) { pstmt.setString(1, as.getUniqueID()); pstmt.setString(2, getParentId()); pstmt.setString(3, as.getId()); pstmt.setString(4, as.getEnterpriseSiteID()); } else if (action == DAO_ACTION_DELETE) { pstmt.setString(1, as.getUniqueID()); } return pstmt; } catch (SQLException ex) { logger.error(ex); throw new AuditException(ex); } }
PreparedStatement function(PreparedStatement pstmt, Object object) throws AuditException { try { ATNAAuditSource as = (ATNAAuditSource) object; logger.trace(STR + as.getUniqueID()); if (action == DAO_ACTION_INSERT) { pstmt.setString(1, as.getUniqueID()); pstmt.setString(2, getParentId()); pstmt.setString(3, as.getId()); pstmt.setString(4, as.getEnterpriseSiteID()); } else if (action == DAO_ACTION_DELETE) { pstmt.setString(1, as.getUniqueID()); } return pstmt; } catch (SQLException ex) { logger.error(ex); throw new AuditException(ex); } }
/** * Returns the prepared statement with bind variables populated * */
Returns the prepared statement with bind variables populated
setPreparedStatement
{ "repo_name": "kef/hieos", "path": "src/arrmdb/src/java/com/vangent/hieos/services/atna/arr/storage/AuditSourceDAO.java", "license": "apache-2.0", "size": 3911 }
[ "com.vangent.hieos.services.atna.arr.support.ATNAAuditSource", "com.vangent.hieos.services.atna.arr.support.AuditException", "java.sql.PreparedStatement", "java.sql.SQLException" ]
import com.vangent.hieos.services.atna.arr.support.ATNAAuditSource; import com.vangent.hieos.services.atna.arr.support.AuditException; import java.sql.PreparedStatement; import java.sql.SQLException;
import com.vangent.hieos.services.atna.arr.support.*; import java.sql.*;
[ "com.vangent.hieos", "java.sql" ]
com.vangent.hieos; java.sql;
42,167
boolean checkPermission(PrivilegeEntity privilegeEntity, boolean readOnly);
boolean checkPermission(PrivilegeEntity privilegeEntity, boolean readOnly);
/** * Determine whether or not access to this cluster resource should be allowed based * on the given privilege. * * @param privilegeEntity the privilege * @param readOnly indicate whether or not this check is for a read only operation * * @return true if the access to this cluster is allowed */
Determine whether or not access to this cluster resource should be allowed based on the given privilege
checkPermission
{ "repo_name": "sekikn/ambari", "path": "ambari-server/src/main/java/org/apache/ambari/server/state/Cluster.java", "license": "apache-2.0", "size": 24252 }
[ "org.apache.ambari.server.orm.entities.PrivilegeEntity" ]
import org.apache.ambari.server.orm.entities.PrivilegeEntity;
import org.apache.ambari.server.orm.entities.*;
[ "org.apache.ambari" ]
org.apache.ambari;
860,453
private static void addNamedOutput(JobConf conf, String namedOutput, boolean multi, Class<? extends OutputFormat> outputFormatClass, Schema schema) { checkNamedOutputName(namedOutput); checkNamedOutput(conf, namedOutput, true); boolean isMapOnly = conf.getNumReduceTasks() == 0; if(schema!=null) conf.set(MO_PREFIX+namedOutput+".schema", schema.toString()); conf.set(NAMED_OUTPUTS, conf.get(NAMED_OUTPUTS, "") + " " + namedOutput); conf.setClass(MO_PREFIX + namedOutput + FORMAT, outputFormatClass, OutputFormat.class); conf.setBoolean(MO_PREFIX + namedOutput + MULTI, multi); }
static void function(JobConf conf, String namedOutput, boolean multi, Class<? extends OutputFormat> outputFormatClass, Schema schema) { checkNamedOutputName(namedOutput); checkNamedOutput(conf, namedOutput, true); boolean isMapOnly = conf.getNumReduceTasks() == 0; if(schema!=null) conf.set(MO_PREFIX+namedOutput+STR, schema.toString()); conf.set(NAMED_OUTPUTS, conf.get(NAMED_OUTPUTS, STR " + namedOutput); conf.setClass(MO_PREFIX + namedOutput + FORMAT, outputFormatClass, OutputFormat.class); conf.setBoolean(MO_PREFIX + namedOutput + MULTI, multi); }
/** * Adds a named output for the job. * <p/> * * @param conf job conf to add the named output * @param namedOutput named output name, it has to be a word, letters * and numbers only, cannot be the word 'part' as * that is reserved for the * default output. * @param multi indicates if the named output is multi * @param outputFormatClass OutputFormat class. * @param schema Schema to used for this namedOutput */
Adds a named output for the job.
addNamedOutput
{ "repo_name": "RallySoftware/avro", "path": "lang/java/mapred/src/main/java/org/apache/avro/mapred/AvroMultipleOutputs.java", "license": "apache-2.0", "size": 22156 }
[ "org.apache.avro.Schema", "org.apache.hadoop.mapred.JobConf", "org.apache.hadoop.mapred.OutputFormat" ]
import org.apache.avro.Schema; import org.apache.hadoop.mapred.JobConf; import org.apache.hadoop.mapred.OutputFormat;
import org.apache.avro.*; import org.apache.hadoop.mapred.*;
[ "org.apache.avro", "org.apache.hadoop" ]
org.apache.avro; org.apache.hadoop;
2,816,765
private void writeErrorToClient(String message) { try { OutputStream sockOut = clientSocket.getOutputStream(); DataOutputStream out = new DataOutputStream(sockOut); out.writeBytes(message); out.flush(); } catch (Exception e) { log.warn(port + "Exception while writing error", e); } }
void function(String message) { try { OutputStream sockOut = clientSocket.getOutputStream(); DataOutputStream out = new DataOutputStream(sockOut); out.writeBytes(message); out.flush(); } catch (Exception e) { log.warn(port + STR, e); } }
/** * Write an error message to the client. The message should be the full HTTP * response. * * @param message * the message to write */
Write an error message to the client. The message should be the full HTTP response
writeErrorToClient
{ "repo_name": "ubikfsabbe/jmeter", "path": "src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java", "license": "apache-2.0", "size": 27324 }
[ "java.io.DataOutputStream", "java.io.OutputStream" ]
import java.io.DataOutputStream; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
1,049,945
Iterable<DOMElementHandler> getHandlers(EPackage epackage);
Iterable<DOMElementHandler> getHandlers(EPackage epackage);
/** * Gets the DOM element handlers registered for the specified {@code epackage}. * * @param epackage * an Ecore package * * @return the handlers, in the order in which they should be applied to DOM elements */
Gets the DOM element handlers registered for the specified epackage
getHandlers
{ "repo_name": "drbgfc/mdht", "path": "core/plugins/org.openhealthtools.mdht.emf.runtime/src/org/openhealthtools/mdht/emf/runtime/resource/DOMElementHandler.java", "license": "epl-1.0", "size": 2296 }
[ "org.eclipse.emf.ecore.EPackage" ]
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,413,181
private String getMetaXFOEvidence(Source source) { List<Element> metaElements = source.getAllElements(HTMLElementName.META); String httpEquiv; if (metaElements != null) { for (Element metaElement : metaElements) { httpEquiv = metaElement.getAttributeValue("http-equiv"); if (HttpHeader.X_FRAME_OPTION.equalsIgnoreCase(httpEquiv)) { return metaElement.toString(); } } } return null; }
String function(Source source) { List<Element> metaElements = source.getAllElements(HTMLElementName.META); String httpEquiv; if (metaElements != null) { for (Element metaElement : metaElements) { httpEquiv = metaElement.getAttributeValue(STR); if (HttpHeader.X_FRAME_OPTION.equalsIgnoreCase(httpEquiv)) { return metaElement.toString(); } } } return null; }
/** * Checks the source of the response for XFO being set via a META tag which is explicitly not * supported per the spec (rfc7034). * * @param source the source of the response to be analyzed. * @return returns a string if XFO was set via META (for use as alert evidence) otherwise return * {@code null}. * @see <a href="https://tools.ietf.org/html/rfc7034#section-4">RFC 7034 Section 4</a> */
Checks the source of the response for XFO being set via a META tag which is explicitly not supported per the spec (rfc7034)
getMetaXFOEvidence
{ "repo_name": "zapbot/zap-extensions", "path": "addOns/pscanrules/src/main/java/org/zaproxy/zap/extension/pscanrules/XFrameOptionScanRule.java", "license": "apache-2.0", "size": 7485 }
[ "java.util.List", "net.htmlparser.jericho.Element", "net.htmlparser.jericho.HTMLElementName", "net.htmlparser.jericho.Source", "org.parosproxy.paros.network.HttpHeader" ]
import java.util.List; import net.htmlparser.jericho.Element; import net.htmlparser.jericho.HTMLElementName; import net.htmlparser.jericho.Source; import org.parosproxy.paros.network.HttpHeader;
import java.util.*; import net.htmlparser.jericho.*; import org.parosproxy.paros.network.*;
[ "java.util", "net.htmlparser.jericho", "org.parosproxy.paros" ]
java.util; net.htmlparser.jericho; org.parosproxy.paros;
1,253
public SpreadSheet extract(File file) throws Exception { SpreadSheet result; check(file); result = doExtract(file); return result; }
SpreadSheet function(File file) throws Exception { SpreadSheet result; check(file); result = doExtract(file); return result; }
/** * Extracts the meta-data from the image. * * @param file the file to process * @return the meta-data * @throws Exception if extraction fails */
Extracts the meta-data from the image
extract
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-imaging/src/main/java/adams/flow/transformer/metadata/AbstractMetaDataExtractor.java", "license": "gpl-3.0", "size": 2748 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,670,730
private void onDatabaseChanged(ListChangeListener.Change<? extends BibEntry> change) { calculateNumberOfMatches(); }
void function(ListChangeListener.Change<? extends BibEntry> change) { calculateNumberOfMatches(); }
/** * Gets invoked if an entry in the current database changes. */
Gets invoked if an entry in the current database changes
onDatabaseChanged
{ "repo_name": "zellerdev/jabref", "path": "src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java", "license": "mit", "size": 13178 }
[ "org.jabref.model.entry.BibEntry" ]
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.*;
[ "org.jabref.model" ]
org.jabref.model;
1,926,532
public java.util.ArrayList<Utils.Calendar.Calendar> loadClassroomCalendar(long id) throws DBException { if (id == Defs.nullId) { throw new DBException("loadClassroomCalendar", DBException.errorCode.INVALID_ID); } return loadCalendar(DBNAME + ".subject INNER JOIN " + DBNAME + ".classroom ON classroom.id=" + id + " AND subject.classroom=classroom.id"); }
java.util.ArrayList<Utils.Calendar.Calendar> function(long id) throws DBException { if (id == Defs.nullId) { throw new DBException(STR, DBException.errorCode.INVALID_ID); } return loadCalendar(DBNAME + STR + DBNAME + STR + id + STR); }
/** * Retorna el calendari de l'aula * * @param id Long * @return Objecte calendari o <b>null</b> si s'ha produit un error * @throws DBException Si l'id és <b>Defs.nullId</b> */
Retorna el calendari de l'aula
loadClassroomCalendar
{ "repo_name": "PereBal/Uib", "path": "Lleng_Progr_EntregaFinal/src/Utils/DB/DBI.java", "license": "gpl-2.0", "size": 62268 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
580,523
public boolean setCancellerHandle(ScheduledFuture<?> cancellerHandle) { synchronized (lock) { if (this.cancellerHandle == null) { if (!discarded) { this.cancellerHandle = cancellerHandle; return true; } else { return false; } } else { throw new IllegalStateException("A canceller handle was already set"); } } } // ------------------------------------------------------------------------ // Progress and Completion // ------------------------------------------------------------------------
boolean function(ScheduledFuture<?> cancellerHandle) { synchronized (lock) { if (this.cancellerHandle == null) { if (!discarded) { this.cancellerHandle = cancellerHandle; return true; } else { return false; } } else { throw new IllegalStateException(STR); } } }
/** * Sets the handle for the canceller to this pending checkpoint. This method fails * with an exception if a handle has already been set. * * @return true, if the handle was set, false, if the checkpoint is already disposed; */
Sets the handle for the canceller to this pending checkpoint. This method fails with an exception if a handle has already been set
setCancellerHandle
{ "repo_name": "fanzhidongyzby/flink", "path": "flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/PendingCheckpoint.java", "license": "apache-2.0", "size": 18637 }
[ "java.util.concurrent.ScheduledFuture" ]
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,706,928
public GetOverallBucketsResponse getOverallBuckets(GetOverallBucketsRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::getOverallBuckets, options, GetOverallBucketsResponse::fromXContent, Collections.emptySet()); }
GetOverallBucketsResponse function(GetOverallBucketsRequest request, RequestOptions options) throws IOException { return restHighLevelClient.performRequestAndParseEntity(request, MLRequestConverters::getOverallBuckets, options, GetOverallBucketsResponse::fromXContent, Collections.emptySet()); }
/** * Gets overall buckets for a set of Machine Learning Jobs. * <p> * For additional info * see <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html"> * ML GET overall buckets documentation</a> * * @param request The request * @param options Additional request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized */
Gets overall buckets for a set of Machine Learning Jobs. For additional info see ML GET overall buckets documentation
getOverallBuckets
{ "repo_name": "uschindler/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/MachineLearningClient.java", "license": "apache-2.0", "size": 130429 }
[ "java.io.IOException", "java.util.Collections", "org.elasticsearch.client.ml.GetOverallBucketsRequest", "org.elasticsearch.client.ml.GetOverallBucketsResponse" ]
import java.io.IOException; import java.util.Collections; import org.elasticsearch.client.ml.GetOverallBucketsRequest; import org.elasticsearch.client.ml.GetOverallBucketsResponse;
import java.io.*; import java.util.*; import org.elasticsearch.client.ml.*;
[ "java.io", "java.util", "org.elasticsearch.client" ]
java.io; java.util; org.elasticsearch.client;
293,389
public void close() throws IOException { if (nsWriter != null) { nsWriter.write("\n"); out.close(); nsWriter.write(((StringWriter) out).getBuffer().toString()); out = nsWriter; nsWriter = null; } out.flush(); out = null; }
void function() throws IOException { if (nsWriter != null) { nsWriter.write("\n"); out.close(); nsWriter.write(((StringWriter) out).getBuffer().toString()); out = nsWriter; nsWriter = null; } out.flush(); out = null; }
/** * Flushes all pending write operations and Closes this writer. please note, * that the underlying writer remains open. * * @throws IOException if an I/O error occurs */
Flushes all pending write operations and Closes this writer. please note, that the underlying writer remains open
close
{ "repo_name": "apache/jackrabbit", "path": "jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.java", "license": "apache-2.0", "size": 18530 }
[ "java.io.IOException", "java.io.StringWriter" ]
import java.io.IOException; import java.io.StringWriter;
import java.io.*;
[ "java.io" ]
java.io;
2,034,186
public void setSchedule(Schedule schedule) { this.schedule = schedule; }
void function(Schedule schedule) { this.schedule = schedule; }
/** * Sets the schedule. * * @param schedule the new schedule */
Sets the schedule
setSchedule
{ "repo_name": "uaijug/chronos", "path": "src/main/java/br/com/uaijug/chronos/schedule/controller/ScheduleController.java", "license": "gpl-3.0", "size": 5547 }
[ "br.com.uaijug.chronos.schedule.model.Schedule" ]
import br.com.uaijug.chronos.schedule.model.Schedule;
import br.com.uaijug.chronos.schedule.model.*;
[ "br.com.uaijug" ]
br.com.uaijug;
1,691,505
public synchronized void sendIgnorePacket(byte[] data) throws IOException { if (data == null) throw new IllegalArgumentException("data argument must not be null."); if (tm == null) throw new IllegalStateException( "Cannot send SSH_MSG_IGNORE packet, you need to establish a connection first."); PacketIgnore pi = new PacketIgnore(); pi.setData(data); tm.sendMessage(pi.getPayload()); }
synchronized void function(byte[] data) throws IOException { if (data == null) throw new IllegalArgumentException(STR); if (tm == null) throw new IllegalStateException( STR); PacketIgnore pi = new PacketIgnore(); pi.setData(data); tm.sendMessage(pi.getPayload()); }
/** * Send an SSH_MSG_IGNORE packet with the given data attribute. * <p> * This method must only be called once the connection is established. * * @throws IOException */
Send an SSH_MSG_IGNORE packet with the given data attribute. This method must only be called once the connection is established
sendIgnorePacket
{ "repo_name": "mattb243/AmazonEC2Matlab", "path": "third-party/ganymed-ssh2-build250/src/ch/ethz/ssh2/Connection.java", "license": "bsd-3-clause", "size": 47514 }
[ "ch.ethz.ssh2.packets.PacketIgnore", "java.io.IOException" ]
import ch.ethz.ssh2.packets.PacketIgnore; import java.io.IOException;
import ch.ethz.ssh2.packets.*; import java.io.*;
[ "ch.ethz.ssh2", "java.io" ]
ch.ethz.ssh2; java.io;
2,637,405
public void excluir() { ServidorBD.executaUpdate("delete from " + ligacao.getTabela()); }
void function() { ServidorBD.executaUpdate(STR + ligacao.getTabela()); }
/** * Exclui todos os registros */
Exclui todos os registros
excluir
{ "repo_name": "lisangelo/codigocerto", "path": "ControlesFaturamento/src/br/com/codigocerto/controles/faturamento/RegistroMargemST.java", "license": "bsd-2-clause", "size": 5851 }
[ "br.com.codigocerto.bancodados.ServidorBD" ]
import br.com.codigocerto.bancodados.ServidorBD;
import br.com.codigocerto.bancodados.*;
[ "br.com.codigocerto" ]
br.com.codigocerto;
1,368,499
SummaryStatistics u = new SummaryStatistics(); loadStats("data/PiDigits.txt", u); Assert.assertEquals("PiDigits: std", std, u.getStandardDeviation(), 1E-13); Assert.assertEquals("PiDigits: mean", mean, u.getMean(), 1E-13); loadStats("data/Mavro.txt", u); Assert.assertEquals("Mavro: std", std, u.getStandardDeviation(), 1E-14); Assert.assertEquals("Mavro: mean", mean, u.getMean(), 1E-14); loadStats("data/Michelso.txt", u); Assert.assertEquals("Michelso: std", std, u.getStandardDeviation(), 1E-13); Assert.assertEquals("Michelso: mean", mean, u.getMean(), 1E-13); loadStats("data/NumAcc1.txt", u); Assert.assertEquals("NumAcc1: std", std, u.getStandardDeviation(), 1E-14); Assert.assertEquals("NumAcc1: mean", mean, u.getMean(), 1E-14); loadStats("data/NumAcc2.txt", u); Assert.assertEquals("NumAcc2: std", std, u.getStandardDeviation(), 1E-14); Assert.assertEquals("NumAcc2: mean", mean, u.getMean(), 1E-14); }
SummaryStatistics u = new SummaryStatistics(); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-13); Assert.assertEquals(STR, mean, u.getMean(), 1E-13); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-13); Assert.assertEquals(STR, mean, u.getMean(), 1E-13); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); loadStats(STR, u); Assert.assertEquals(STR, std, u.getStandardDeviation(), 1E-14); Assert.assertEquals(STR, mean, u.getMean(), 1E-14); }
/** * Test SummaryStatistics - implementations that do not store the data * and use single pass algorithms to compute statistics */
Test SummaryStatistics - implementations that do not store the data and use single pass algorithms to compute statistics
testSummaryStatistics
{ "repo_name": "tknandu/CommonsMath_Modifed", "path": "math (trunk)/src/test/java/org/apache/commons/math3/stat/CertifiedDataTest.java", "license": "apache-2.0", "size": 5605 }
[ "org.apache.commons.math3.stat.descriptive.SummaryStatistics", "org.junit.Assert" ]
import org.apache.commons.math3.stat.descriptive.SummaryStatistics; import org.junit.Assert;
import org.apache.commons.math3.stat.descriptive.*; import org.junit.*;
[ "org.apache.commons", "org.junit" ]
org.apache.commons; org.junit;
237,158
private void validateUser(@NotNull String id) throws SyncException { SyncContext context = null; try { Root root = getRoot(); if (root == null) { throw new SyncException("Cannot synchronize user. root == null"); } UserManager userManager = getUserManager(); if (userManager == null) { throw new SyncException("Cannot synchronize user. userManager == null"); } DebugTimer timer = new DebugTimer(); context = syncHandler.createContext(idp, userManager, new ValueFactoryImpl(root, NamePathMapper.DEFAULT)); context.sync(id); timer.mark("sync"); root.commit(); timer.mark("commit"); debug("validateUser({}) {}", id, timer.getString()); } catch (CommitFailedException e) { throw new SyncException("User synchronization failed during commit.", e); } finally { if (context != null) { context.close(); } } }
void function(@NotNull String id) throws SyncException { SyncContext context = null; try { Root root = getRoot(); if (root == null) { throw new SyncException(STR); } UserManager userManager = getUserManager(); if (userManager == null) { throw new SyncException(STR); } DebugTimer timer = new DebugTimer(); context = syncHandler.createContext(idp, userManager, new ValueFactoryImpl(root, NamePathMapper.DEFAULT)); context.sync(id); timer.mark("sync"); root.commit(); timer.mark(STR); debug(STR, id, timer.getString()); } catch (CommitFailedException e) { throw new SyncException(STR, e); } finally { if (context != null) { context.close(); } } }
/** * Initiates synchronization of a possible remove user * @param id the user id */
Initiates synchronization of a possible remove user
validateUser
{ "repo_name": "stillalex/jackrabbit-oak", "path": "oak-auth-external/src/main/java/org/apache/jackrabbit/oak/spi/security/authentication/external/impl/ExternalLoginModule.java", "license": "apache-2.0", "size": 18650 }
[ "org.apache.jackrabbit.api.security.user.UserManager", "org.apache.jackrabbit.oak.api.CommitFailedException", "org.apache.jackrabbit.oak.api.Root", "org.apache.jackrabbit.oak.commons.DebugTimer", "org.apache.jackrabbit.oak.namepath.NamePathMapper", "org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl", "org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext", "org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException", "org.jetbrains.annotations.NotNull" ]
import org.apache.jackrabbit.api.security.user.UserManager; import org.apache.jackrabbit.oak.api.CommitFailedException; import org.apache.jackrabbit.oak.api.Root; import org.apache.jackrabbit.oak.commons.DebugTimer; import org.apache.jackrabbit.oak.namepath.NamePathMapper; import org.apache.jackrabbit.oak.plugins.value.jcr.ValueFactoryImpl; import org.apache.jackrabbit.oak.spi.security.authentication.external.SyncContext; import org.apache.jackrabbit.oak.spi.security.authentication.external.SyncException; import org.jetbrains.annotations.NotNull;
import org.apache.jackrabbit.api.security.user.*; import org.apache.jackrabbit.oak.api.*; import org.apache.jackrabbit.oak.commons.*; import org.apache.jackrabbit.oak.namepath.*; import org.apache.jackrabbit.oak.plugins.value.jcr.*; import org.apache.jackrabbit.oak.spi.security.authentication.external.*; import org.jetbrains.annotations.*;
[ "org.apache.jackrabbit", "org.jetbrains.annotations" ]
org.apache.jackrabbit; org.jetbrains.annotations;
1,430,642
@Nullable ResourceSet estimateResourceConsumption(Executor executor);
@Nullable ResourceSet estimateResourceConsumption(Executor executor);
/** * Return a best-guess estimate of the operation's resource consumption on the * local host itself for use in scheduling. * * @param executor the application-specific value passed to the * executor parameter of the top-level call to * Builder.buildArtifacts(). */
Return a best-guess estimate of the operation's resource consumption on the local host itself for use in scheduling
estimateResourceConsumption
{ "repo_name": "mikelikespie/bazel", "path": "src/main/java/com/google/devtools/build/lib/actions/Action.java", "license": "apache-2.0", "size": 12915 }
[ "javax.annotation.Nullable" ]
import javax.annotation.Nullable;
import javax.annotation.*;
[ "javax.annotation" ]
javax.annotation;
2,816,953
double calculateAdjustment(Genome genome);
double calculateAdjustment(Genome genome);
/** * Calculate the score adjustment. * @param genome The genome. * @return The adjusted score. */
Calculate the score adjustment
calculateAdjustment
{ "repo_name": "Crespo911/encog-java-core", "path": "src/main/java/org/encog/ml/ea/score/AdjustScore.java", "license": "apache-2.0", "size": 1263 }
[ "org.encog.ml.ea.genome.Genome" ]
import org.encog.ml.ea.genome.Genome;
import org.encog.ml.ea.genome.*;
[ "org.encog.ml" ]
org.encog.ml;
517,831
public void setReloadChanges(String v) { if (!ObjectUtils.equals(this.reloadChanges, v)) { this.reloadChanges = v; setModified(true); } } protected List<TLoggedInUsers> collTLoggedInUserss;
void function(String v) { if (!ObjectUtils.equals(this.reloadChanges, v)) { this.reloadChanges = v; setModified(true); } } protected List<TLoggedInUsers> collTLoggedInUserss;
/** * Set the value of ReloadChanges * * @param v new value */
Set the value of ReloadChanges
setReloadChanges
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/BaseTClusterNode.java", "license": "gpl-3.0", "size": 50284 }
[ "java.util.List", "org.apache.commons.lang.ObjectUtils" ]
import java.util.List; import org.apache.commons.lang.ObjectUtils;
import java.util.*; import org.apache.commons.lang.*;
[ "java.util", "org.apache.commons" ]
java.util; org.apache.commons;
2,797,749
private void parseAtOrNewline(byte b) throws IOException { if (b == NEWLINE) { state = State.EXPECT_PAYLOAD_OR_NEWLINE; } else if (b == AT) { addNewlineToPayload = false; } else { throw new IOException("Expected @ or \\n. (" + b + ")"); } }
void function(byte b) throws IOException { if (b == NEWLINE) { state = State.EXPECT_PAYLOAD_OR_NEWLINE; } else if (b == AT) { addNewlineToPayload = false; } else { throw new IOException(STR + b + ")"); } }
/** * Handles {@link State#EXPECT_AT_OR_NEWLINE}, which is either the * suppress newline indicator (at) at the end of a control line, or the end * of a control line. */
Handles <code>State#EXPECT_AT_OR_NEWLINE</code>, which is either the suppress newline indicator (at) at the end of a control line, or the end of a control line
parseAtOrNewline
{ "repo_name": "hhclam/bazel", "path": "src/main/java/com/google/devtools/build/lib/util/io/StreamDemultiplexer.java", "license": "apache-2.0", "size": 6048 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,237,390
public void sendMailToUser(DccdUser user, String subject, String message) throws UserServiceException { try { CommonMailer mailer = (CommonMailer) DccdMailer .getDefaultInstance(); mailer.sendSimpleMail(subject, message, user.getEmail()); } catch (DccdMailerConfigurationException e) { throw new UserServiceException("Could not mail user with id '" + user.getId() + "' :", e); } catch (MailerException e) { throw new UserServiceException("Could not mail user with id '" + user.getId() + "' :", e); } } // // public RegistrationMailAuthentication newRegistrationMailAuthentication( // final String userId, final String returnedTime, final String // returnedToken) // { // return registrationService.newAuthentication(userId, returnedTime, // returnedToken); // }
void function(DccdUser user, String subject, String message) throws UserServiceException { try { CommonMailer mailer = (CommonMailer) DccdMailer .getDefaultInstance(); mailer.sendSimpleMail(subject, message, user.getEmail()); } catch (DccdMailerConfigurationException e) { throw new UserServiceException(STR + user.getId() + STR, e); } catch (MailerException e) { throw new UserServiceException(STR + user.getId() + STR, e); } }
/** * When we want to send a mail to the user, and we compose the message * ourselves * * @param user * @param subject * @param message */
When we want to send a mail to the user, and we compose the message ourselves
sendMailToUser
{ "repo_name": "PaulBoon/dccd-lib", "path": "src/main/java/nl/knaw/dans/dccd/application/services/DccdUserService.java", "license": "apache-2.0", "size": 22570 }
[ "nl.knaw.dans.common.lang.mail.CommonMailer", "nl.knaw.dans.common.lang.mail.Mailer", "nl.knaw.dans.dccd.mail.DccdMailer", "nl.knaw.dans.dccd.mail.DccdMailerConfigurationException", "nl.knaw.dans.dccd.model.DccdUser" ]
import nl.knaw.dans.common.lang.mail.CommonMailer; import nl.knaw.dans.common.lang.mail.Mailer; import nl.knaw.dans.dccd.mail.DccdMailer; import nl.knaw.dans.dccd.mail.DccdMailerConfigurationException; import nl.knaw.dans.dccd.model.DccdUser;
import nl.knaw.dans.common.lang.mail.*; import nl.knaw.dans.dccd.mail.*; import nl.knaw.dans.dccd.model.*;
[ "nl.knaw.dans" ]
nl.knaw.dans;
634,606
public Observable<ServiceResponse<Page<IntegrationAccountInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<IntegrationAccountInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Gets a list of integration accounts by resource group. * ServiceResponse<PageImpl<IntegrationAccountInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;IntegrationAccountInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Gets a list of integration accounts by resource group
listByResourceGroupNextSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/logic/mgmt-v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java", "license": "mit", "size": 95447 }
[ "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,422,365
public String createTableWithColumnsAndAcls(List<ColumnModel> columnList, Set<Long> readOnlyPrincipalIdSet, Set<Long> adminPrincipalIdSet, String projectId, String tableName) throws BridgeSynapseException, SynapseException { // Create columns List<ColumnModel> createdColumnList = createColumnModelsWithRetry(columnList); if (columnList.size() != createdColumnList.size()) { throw new BridgeSynapseException("Error creating Synapse table " + tableName + ": Tried to create " + columnList.size() + " columns. Actual: " + createdColumnList.size() + " columns."); } List<String> columnIdList = new ArrayList<>(); //noinspection Convert2streamapi for (ColumnModel oneCreatedColumn : createdColumnList) { columnIdList.add(oneCreatedColumn.getId()); } // create table TableEntity synapseTable = new TableEntity(); synapseTable.setName(tableName); synapseTable.setParentId(projectId); synapseTable.setColumnIds(columnIdList); TableEntity createdTable = createTableWithRetry(synapseTable); String synapseTableId = createdTable.getId(); // create ACLs createAclWithRetry(synapseTableId, adminPrincipalIdSet, readOnlyPrincipalIdSet); return synapseTableId; }
String function(List<ColumnModel> columnList, Set<Long> readOnlyPrincipalIdSet, Set<Long> adminPrincipalIdSet, String projectId, String tableName) throws BridgeSynapseException, SynapseException { List<ColumnModel> createdColumnList = createColumnModelsWithRetry(columnList); if (columnList.size() != createdColumnList.size()) { throw new BridgeSynapseException(STR + tableName + STR + columnList.size() + STR + createdColumnList.size() + STR); } List<String> columnIdList = new ArrayList<>(); for (ColumnModel oneCreatedColumn : createdColumnList) { columnIdList.add(oneCreatedColumn.getId()); } TableEntity synapseTable = new TableEntity(); synapseTable.setName(tableName); synapseTable.setParentId(projectId); synapseTable.setColumnIds(columnIdList); TableEntity createdTable = createTableWithRetry(synapseTable); String synapseTableId = createdTable.getId(); createAclWithRetry(synapseTableId, adminPrincipalIdSet, readOnlyPrincipalIdSet); return synapseTableId; }
/** * Helper method to create a table with the specified columns and set up ACLs. The read-only principal IDs are set * with read and download permissions, while the admin principal IDs are set with admin permissions. * * @param columnList * list of column models to create on the table * @param readOnlyPrincipalIdSet * principal IDs (users or teams) that should have read permissions * @param adminPrincipalIdSet * principal IDs (users or teams), that should have admin permissions * @param projectId * Synapse project to create the table in * @param tableName * table name * @return Synapse table ID * @throws BridgeSynapseException * under unexpected circumstances, like a table created with the wrong number of columns * @throws SynapseException * if the underlying Synapse calls fail */
Helper method to create a table with the specified columns and set up ACLs. The read-only principal IDs are set with read and download permissions, while the admin principal IDs are set with admin permissions
createTableWithColumnsAndAcls
{ "repo_name": "Sage-Bionetworks/bridge-base", "path": "src/main/java/org/sagebionetworks/bridge/synapse/SynapseHelper.java", "license": "apache-2.0", "size": 45617 }
[ "java.util.ArrayList", "java.util.List", "java.util.Set", "org.sagebionetworks.bridge.exceptions.BridgeSynapseException", "org.sagebionetworks.client.exceptions.SynapseException", "org.sagebionetworks.repo.model.table.ColumnModel", "org.sagebionetworks.repo.model.table.TableEntity" ]
import java.util.ArrayList; import java.util.List; import java.util.Set; import org.sagebionetworks.bridge.exceptions.BridgeSynapseException; import org.sagebionetworks.client.exceptions.SynapseException; import org.sagebionetworks.repo.model.table.ColumnModel; import org.sagebionetworks.repo.model.table.TableEntity;
import java.util.*; import org.sagebionetworks.bridge.exceptions.*; import org.sagebionetworks.client.exceptions.*; import org.sagebionetworks.repo.model.table.*;
[ "java.util", "org.sagebionetworks.bridge", "org.sagebionetworks.client", "org.sagebionetworks.repo" ]
java.util; org.sagebionetworks.bridge; org.sagebionetworks.client; org.sagebionetworks.repo;
223,561
private void makeNodeOptionsPanel(final JPanel answer, final AlloyNodeElement elt) { final boolean enabled = !(elt instanceof AlloyType) || (vizState.getCurrentModel().hasType((AlloyType) elt)); answer.add(makelabel((elt instanceof AlloyType) ? (" " + typename((AlloyType) elt)) : (" " + elt))); final JTextField labelText = OurUtil.textfield(vizState.label.get(elt), 10); labelText.setMaximumSize(new Dimension(100, 25)); labelText.addKeyListener(new KeyAdapter() {
void function(final JPanel answer, final AlloyNodeElement elt) { final boolean enabled = !(elt instanceof AlloyType) (vizState.getCurrentModel().hasType((AlloyType) elt)); answer.add(makelabel((elt instanceof AlloyType) ? (" " + typename((AlloyType) elt)) : (" " + elt))); final JTextField labelText = OurUtil.textfield(vizState.label.get(elt), 10); labelText.setMaximumSize(new Dimension(100, 25)); labelText.addKeyListener(new KeyAdapter() {
/** * Generates the node settings widgets for the given type or set, and add them * to "parent". */
Generates the node settings widgets for the given type or set, and add them to "parent"
makeNodeOptionsPanel
{ "repo_name": "AlloyTools/org.alloytools.alloy", "path": "org.alloytools.alloy.application/src/main/java/edu/mit/csail/sdg/alloy4viz/VizCustomizationPanel.java", "license": "apache-2.0", "size": 35095 }
[ "edu.mit.csail.sdg.alloy4.OurUtil", "java.awt.Dimension", "java.awt.event.KeyAdapter", "javax.swing.JPanel", "javax.swing.JTextField" ]
import edu.mit.csail.sdg.alloy4.OurUtil; import java.awt.Dimension; import java.awt.event.KeyAdapter; import javax.swing.JPanel; import javax.swing.JTextField;
import edu.mit.csail.sdg.alloy4.*; import java.awt.*; import java.awt.event.*; import javax.swing.*;
[ "edu.mit.csail", "java.awt", "javax.swing" ]
edu.mit.csail; java.awt; javax.swing;
1,661,792
public void test(TestHarness harness) { IllegalAccessError error1 = new IllegalAccessError(); harness.check(error1 != null); harness.check(error1.toString(), "java.lang.IllegalAccessError"); IllegalAccessError error2 = new IllegalAccessError("nothing happens"); harness.check(error2 != null); harness.check(error2.toString(), "java.lang.IllegalAccessError: nothing happens"); }
void function(TestHarness harness) { IllegalAccessError error1 = new IllegalAccessError(); harness.check(error1 != null); harness.check(error1.toString(), STR); IllegalAccessError error2 = new IllegalAccessError(STR); harness.check(error2 != null); harness.check(error2.toString(), STR); }
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */
Runs the test using the specified harness
test
{ "repo_name": "niloc132/mauve-gwt", "path": "src/main/java/gnu/testlet/java/lang/IllegalAccessError/constructor.java", "license": "gpl-2.0", "size": 1763 }
[ "gnu.testlet.TestHarness", "java.lang.IllegalAccessError" ]
import gnu.testlet.TestHarness; import java.lang.IllegalAccessError;
import gnu.testlet.*; import java.lang.*;
[ "gnu.testlet", "java.lang" ]
gnu.testlet; java.lang;
1,862,191
private static int getColumnForString(AreaEval db,String name) { int resultColumn = -1; final int width = db.getWidth(); for(int column = 0; column < width; ++column) { ValueEval columnNameValueEval = resolveReference(db, 0, column); if(columnNameValueEval instanceof BlankEval) { continue; } if(columnNameValueEval instanceof ErrorEval) { continue; } String columnName = OperandResolver.coerceValueToString(columnNameValueEval); if(name.equalsIgnoreCase(columnName)) { resultColumn = column; break; } } return resultColumn; }
static int function(AreaEval db,String name) { int resultColumn = -1; final int width = db.getWidth(); for(int column = 0; column < width; ++column) { ValueEval columnNameValueEval = resolveReference(db, 0, column); if(columnNameValueEval instanceof BlankEval) { continue; } if(columnNameValueEval instanceof ErrorEval) { continue; } String columnName = OperandResolver.coerceValueToString(columnNameValueEval); if(name.equalsIgnoreCase(columnName)) { resultColumn = column; break; } } return resultColumn; }
/** * For a given database returns the column number for a column heading. * Comparison is case-insensitive. * * @param db Database. * @param name Column heading. * @return Corresponding column number. */
For a given database returns the column number for a column heading. Comparison is case-insensitive
getColumnForString
{ "repo_name": "lamsfoundation/lams", "path": "3rdParty_sources/poi/org/apache/poi/ss/formula/functions/DStarRunner.java", "license": "gpl-2.0", "size": 16609 }
[ "org.apache.poi.ss.formula.eval.AreaEval", "org.apache.poi.ss.formula.eval.BlankEval", "org.apache.poi.ss.formula.eval.ErrorEval", "org.apache.poi.ss.formula.eval.OperandResolver", "org.apache.poi.ss.formula.eval.ValueEval" ]
import org.apache.poi.ss.formula.eval.AreaEval; import org.apache.poi.ss.formula.eval.BlankEval; import org.apache.poi.ss.formula.eval.ErrorEval; import org.apache.poi.ss.formula.eval.OperandResolver; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.eval.*;
[ "org.apache.poi" ]
org.apache.poi;
1,177,498
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); }
void function(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) { super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); }
/** * Spawns this Block's drops into the World as EntityItems. * * @param chance The chance that each Item is actually spawned (1.0 = always, 0.0 = never) * @param fortune The player's fortune level */
Spawns this Block's drops into the World as EntityItems
dropBlockAsItemWithChance
{ "repo_name": "trixmot/mod1", "path": "build/tmp/recompileMc/sources/net/minecraft/block/BlockPotato.java", "license": "lgpl-2.1", "size": 1455 }
[ "net.minecraft.block.state.IBlockState", "net.minecraft.util.BlockPos", "net.minecraft.world.World" ]
import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; import net.minecraft.world.World;
import net.minecraft.block.state.*; import net.minecraft.util.*; import net.minecraft.world.*;
[ "net.minecraft.block", "net.minecraft.util", "net.minecraft.world" ]
net.minecraft.block; net.minecraft.util; net.minecraft.world;
565,132
public static <T> T createException(Class<T> clazz, int errorCode, Throwable cause, Logger logger, Level level, Object... args) { return createException(clazz, errorCode, null, cause, logger, level, args); }
static <T> T function(Class<T> clazz, int errorCode, Throwable cause, Logger logger, Level level, Object... args) { return createException(clazz, errorCode, null, cause, logger, level, args); }
/** * Constructs a new Exception with the given error code or error message, * cause of the exception, logger and list of error arguments in case error * code is provided. * * @param clazz * - type of the exception to be returned * @param errorCode * - error code * @param cause * - cause of the exception * @param logger * - logger for logging the error * @param level * - the priority of the logger * @param args * - arguments */
Constructs a new Exception with the given error code or error message, cause of the exception, logger and list of error arguments in case error code is provided
createException
{ "repo_name": "gkolokotronis/dbquality", "path": "src/main/java/com/dbquality/exceptions/ExceptionFactory.java", "license": "gpl-3.0", "size": 3392 }
[ "org.apache.logging.log4j.Level", "org.apache.logging.log4j.Logger" ]
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.*;
[ "org.apache.logging" ]
org.apache.logging;
2,836,205
private static void post(String endpoint, Map<String, String> params) throws IOException { URL url; try { url = new URL(endpoint); } catch (MalformedURLException e) { throw new IllegalArgumentException("invalid url: " + endpoint); } StringBuilder bodyBuilder = new StringBuilder(); Iterator<Entry<String, String>> iterator = params.entrySet().iterator(); // constructs the POST body using the parameters while (iterator.hasNext()) { Entry<String, String> param = iterator.next(); bodyBuilder.append(param.getKey()).append('=').append(param.getValue()); if (iterator.hasNext()) { bodyBuilder.append('&'); } } String body = bodyBuilder.toString(); Log.v(CommonUtilities.TAG, "Posting '" + body + "' to " + url); byte[] bytes = body.getBytes(); HttpURLConnection conn = null; try { conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setUseCaches(false); conn.setFixedLengthStreamingMode(bytes.length); conn.setRequestMethod("POST"); conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); // post the request OutputStream out = conn.getOutputStream(); out.write(bytes); out.close(); // handle the response int status = conn.getResponseCode(); if (status != 200) { throw new IOException("Post failed with error code " + status); } } finally { if (conn != null) { conn.disconnect(); } } }
static void function(String endpoint, Map<String, String> params) throws IOException { URL url; try { url = new URL(endpoint); } catch (MalformedURLException e) { throw new IllegalArgumentException(STR + endpoint); } StringBuilder bodyBuilder = new StringBuilder(); Iterator<Entry<String, String>> iterator = params.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> param = iterator.next(); bodyBuilder.append(param.getKey()).append('=').append(param.getValue()); if (iterator.hasNext()) { bodyBuilder.append('&'); } } String body = bodyBuilder.toString(); Log.v(CommonUtilities.TAG, STR + body + STR + url); byte[] bytes = body.getBytes(); HttpURLConnection conn = null; try { conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setUseCaches(false); conn.setFixedLengthStreamingMode(bytes.length); conn.setRequestMethod("POST"); conn.setRequestProperty(STR, STR); OutputStream out = conn.getOutputStream(); out.write(bytes); out.close(); int status = conn.getResponseCode(); if (status != 200) { throw new IOException(STR + status); } } finally { if (conn != null) { conn.disconnect(); } } }
/** * Issue a POST request to the server. * * @param endpoint * POST address. * @param params * request parameters. * * @throws IOException * propagated from POST. */
Issue a POST request to the server
post
{ "repo_name": "EliasFarhan/gsn", "path": "gsn-tiny/src/tinygsn/gui/android/gcm/ServerUtilities.java", "license": "gpl-3.0", "size": 9223 }
[ "android.util.Log", "java.io.IOException", "java.io.OutputStream", "java.net.HttpURLConnection", "java.net.MalformedURLException", "java.util.Iterator", "java.util.Map" ]
import android.util.Log; import java.io.IOException; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.util.Iterator; import java.util.Map;
import android.util.*; import java.io.*; import java.net.*; import java.util.*;
[ "android.util", "java.io", "java.net", "java.util" ]
android.util; java.io; java.net; java.util;
2,184,204
@Override public Iterator<E> iterator() { LazySequence<E> thisLazySequence = this; return new Iterator<E>() { private volatile LazySequence<E> lazySequence = thisLazySequence;
Iterator<E> function() { LazySequence<E> thisLazySequence = this; return new Iterator<E>() { private volatile LazySequence<E> lazySequence = thisLazySequence;
/** * An iterator over a lazy sequence. NOT THREAD-SAFE! */
An iterator over a lazy sequence. NOT THREAD-SAFE
iterator
{ "repo_name": "achuprynov/workspace", "path": "LazyEvaluation/src/main/java/achuprynov/lazyevaluation/LazySequence.java", "license": "gpl-3.0", "size": 6620 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
128,552
protected void init(final String owner, final MethodNode method) throws AnalyzerException { // Nothing to do. }
void function(final String owner, final MethodNode method) throws AnalyzerException { }
/** * Initializes this analyzer. This method is called just before the execution of control flow * analysis loop in #analyze. The default implementation of this method does nothing. * * @param owner the internal name of the class to which the method belongs. * @param method the method to be analyzed. * @throws AnalyzerException if a problem occurs. */
Initializes this analyzer. This method is called just before the execution of control flow analysis loop in #analyze. The default implementation of this method does nothing
init
{ "repo_name": "apache/tapestry-5", "path": "plastic/src/external/java/org/apache/tapestry5/internal/plastic/asm/tree/analysis/Analyzer.java", "license": "apache-2.0", "size": 29666 }
[ "org.apache.tapestry5.internal.plastic.asm.tree.MethodNode" ]
import org.apache.tapestry5.internal.plastic.asm.tree.MethodNode;
import org.apache.tapestry5.internal.plastic.asm.tree.*;
[ "org.apache.tapestry5" ]
org.apache.tapestry5;
515,351
public File getDataFile(final String fileName) { return new File(this.directory, fileName); } private static long serialNumberCounter = System.currentTimeMillis();
File function(final String fileName) { return new File(this.directory, fileName); } private static long serialNumberCounter = System.currentTimeMillis();
/** * Return a file with the given name in the installer directory. * @param fileName The file name */
Return a file with the given name in the installer directory
getDataFile
{ "repo_name": "Nimco/sling", "path": "installer/core/src/main/java/org/apache/sling/installer/core/impl/FileDataStore.java", "license": "apache-2.0", "size": 9846 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
1,010,763
public static void main(String[] args) { // Create a NextBusAvlModue for testing Module.start("org.transitime.avl.NextBusAvlModule"); }
static void function(String[] args) { Module.start(STR); }
/** * Just for debugging */
Just for debugging
main
{ "repo_name": "scrudden/core", "path": "transitime/src/main/java/org/transitime/avl/NextBusAvlModule.java", "license": "gpl-3.0", "size": 10373 }
[ "org.transitime.modules.Module" ]
import org.transitime.modules.Module;
import org.transitime.modules.*;
[ "org.transitime.modules" ]
org.transitime.modules;
2,481,833
public List<Patch> patch_fromText(String textline) throws IllegalArgumentException { List<Patch> patches = new LinkedList<Patch>(); if (textline.length() == 0) { return patches; } List<String> textList = Arrays.asList(textline.split("\n")); LinkedList<String> text = new LinkedList<String>(textList); Patch patch; Pattern patchHeader = Pattern.compile("^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$"); Matcher m; char sign; String line; while (!text.isEmpty()) { m = patchHeader.matcher(text.getFirst()); if (!m.matches()) { throw new IllegalArgumentException( "Invalid patch string: " + text.getFirst()); } patch = new Patch(); patches.add(patch); patch.start1 = Integer.parseInt(m.group(1)); if (m.group(2).length() == 0) { patch.start1--; patch.length1 = 1; } else if (m.group(2).equals("0")) { patch.length1 = 0; } else { patch.start1--; patch.length1 = Integer.parseInt(m.group(2)); } patch.start2 = Integer.parseInt(m.group(3)); if (m.group(4).length() == 0) { patch.start2--; patch.length2 = 1; } else if (m.group(4).equals("0")) { patch.length2 = 0; } else { patch.start2--; patch.length2 = Integer.parseInt(m.group(4)); } text.removeFirst(); while (!text.isEmpty()) { try { sign = text.getFirst().charAt(0); } catch (IndexOutOfBoundsException e) { // Blank line? Whatever. text.removeFirst(); continue; } line = text.getFirst().substring(1); line = line.replace("+", "%2B"); // decode would change all "+" to " " try { line = URLDecoder.decode(line, "UTF-8"); } catch (UnsupportedEncodingException e) { // Not likely on modern system. throw new Error("This system does not support UTF-8.", e); } catch (IllegalArgumentException e) { // Malformed URI sequence. throw new IllegalArgumentException( "Illegal escape in patch_fromText: " + line, e); } if (sign == '-') { // Deletion. patch.diffs.add(new Diff(Operation.DELETE, line)); } else if (sign == '+') { // Insertion. patch.diffs.add(new Diff(Operation.INSERT, line)); } else if (sign == ' ') { // Minor equality. patch.diffs.add(new Diff(Operation.EQUAL, line)); } else if (sign == '@') { // Start of next patch. break; } else { // WTF? throw new IllegalArgumentException( "Invalid patch mode '" + sign + "' in: " + line); } text.removeFirst(); } } return patches; } public static class Diff { public Operation operation; public String text; public Diff(Operation operation, String text) { // Construct a diff with the specified operation and text. this.operation = operation; this.text = text; }
List<Patch> function(String textline) throws IllegalArgumentException { List<Patch> patches = new LinkedList<Patch>(); if (textline.length() == 0) { return patches; } List<String> textList = Arrays.asList(textline.split("\n")); LinkedList<String> text = new LinkedList<String>(textList); Patch patch; Pattern patchHeader = Pattern.compile(STR); Matcher m; char sign; String line; while (!text.isEmpty()) { m = patchHeader.matcher(text.getFirst()); if (!m.matches()) { throw new IllegalArgumentException( STR + text.getFirst()); } patch = new Patch(); patches.add(patch); patch.start1 = Integer.parseInt(m.group(1)); if (m.group(2).length() == 0) { patch.start1--; patch.length1 = 1; } else if (m.group(2).equals("0")) { patch.length1 = 0; } else { patch.start1--; patch.length1 = Integer.parseInt(m.group(2)); } patch.start2 = Integer.parseInt(m.group(3)); if (m.group(4).length() == 0) { patch.start2--; patch.length2 = 1; } else if (m.group(4).equals("0")) { patch.length2 = 0; } else { patch.start2--; patch.length2 = Integer.parseInt(m.group(4)); } text.removeFirst(); while (!text.isEmpty()) { try { sign = text.getFirst().charAt(0); } catch (IndexOutOfBoundsException e) { text.removeFirst(); continue; } line = text.getFirst().substring(1); line = line.replace("+", "%2B"); try { line = URLDecoder.decode(line, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new Error(STR, e); } catch (IllegalArgumentException e) { throw new IllegalArgumentException( STR + line, e); } if (sign == '-') { patch.diffs.add(new Diff(Operation.DELETE, line)); } else if (sign == '+') { patch.diffs.add(new Diff(Operation.INSERT, line)); } else if (sign == ' ') { patch.diffs.add(new Diff(Operation.EQUAL, line)); } else if (sign == '@') { break; } else { throw new IllegalArgumentException( STR + sign + STR + line); } text.removeFirst(); } } return patches; } public static class Diff { public Operation operation; public String text; public Diff(Operation operation, String text) { this.operation = operation; this.text = text; }
/** * Parse a textual representation of patches and return a List of Patch * objects. * @param textline Text representation of patches. * @return List of Patch objects. * @throws IllegalArgumentException If invalid input. */
Parse a textual representation of patches and return a List of Patch objects
patch_fromText
{ "repo_name": "Prin4/HTML5ParserComparator", "path": "WebApp/src/com/HTML5/ParserComparer/model/diff_match_patch.java", "license": "mit", "size": 89751 }
[ "java.io.UnsupportedEncodingException", "java.net.URLDecoder", "java.util.Arrays", "java.util.LinkedList", "java.util.List", "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.util.Arrays; import java.util.LinkedList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.io.*; import java.net.*; import java.util.*; import java.util.regex.*;
[ "java.io", "java.net", "java.util" ]
java.io; java.net; java.util;
2,574,596
@Override public Request<DescribeScheduledInstancesRequest> getDryRunRequest() { Request<DescribeScheduledInstancesRequest> request = new DescribeScheduledInstancesRequestMarshaller() .marshall(this); request.addParameter("DryRun", Boolean.toString(true)); return request; }
Request<DescribeScheduledInstancesRequest> function() { Request<DescribeScheduledInstancesRequest> request = new DescribeScheduledInstancesRequestMarshaller() .marshall(this); request.addParameter(STR, Boolean.toString(true)); return request; }
/** * This method is intended for internal use only. Returns the marshaled * request configured with additional parameters to enable operation * dry-run. */
This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run
getDryRunRequest
{ "repo_name": "mhurne/aws-sdk-java", "path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/DescribeScheduledInstancesRequest.java", "license": "apache-2.0", "size": 21408 }
[ "com.amazonaws.Request", "com.amazonaws.services.ec2.model.transform.DescribeScheduledInstancesRequestMarshaller" ]
import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.DescribeScheduledInstancesRequestMarshaller;
import com.amazonaws.*; import com.amazonaws.services.ec2.model.transform.*;
[ "com.amazonaws", "com.amazonaws.services" ]
com.amazonaws; com.amazonaws.services;
2,491,001
public static MenuDrawer attach(Activity activity, Position position) { return attach(activity, Type.BEHIND, position); }
static MenuDrawer function(Activity activity, Position position) { return attach(activity, Type.BEHIND, position); }
/** * Attaches the MenuDrawer to the Activity. * * @param activity The activity the menu drawer will be attached to. * @param position Where to position the menu. * @return The created MenuDrawer instance. */
Attaches the MenuDrawer to the Activity
attach
{ "repo_name": "0359xiaodong/serenity-android", "path": "android-menudrawer/menudrawer/src/net/simonvt/menudrawer/MenuDrawer.java", "license": "mit", "size": 47631 }
[ "android.app.Activity" ]
import android.app.Activity;
import android.app.*;
[ "android.app" ]
android.app;
2,047,539
@Override public PolyCurve2D<? extends ContinuousCurve2D> transform( AffineTransform2D trans) { PolyCurve2D<ContinuousCurve2D> result = new PolyCurve2D<ContinuousCurve2D>(); for (ContinuousCurve2D curve : curves) result.add(curve.transform(trans)); result.setClosed(this.isClosed()); return result; }
PolyCurve2D<? extends ContinuousCurve2D> function( AffineTransform2D trans) { PolyCurve2D<ContinuousCurve2D> result = new PolyCurve2D<ContinuousCurve2D>(); for (ContinuousCurve2D curve : curves) result.add(curve.transform(trans)); result.setClosed(this.isClosed()); return result; }
/** * Transforms each smooth piece in this PolyCurve2D and returns a new * instance of PolyCurve2D. */
Transforms each smooth piece in this PolyCurve2D and returns a new instance of PolyCurve2D
transform
{ "repo_name": "chardnett/eureka", "path": "src/math/geom2d/curve/PolyCurve2D.java", "license": "gpl-2.0", "size": 14433 }
[ "math.geom2d.AffineTransform2D" ]
import math.geom2d.AffineTransform2D;
import math.geom2d.*;
[ "math.geom2d" ]
math.geom2d;
917,060
public void test(TestHarness harness) { // create instance of a class Double Object o = new Float(42.0f); // get a runtime class of an object "o" Class c = o.getClass(); List interfaces = Arrays.asList(c.getInterfaces()); harness.check(interfaces.contains(Comparable.class)); }
void function(TestHarness harness) { Object o = new Float(42.0f); Class c = o.getClass(); List interfaces = Arrays.asList(c.getInterfaces()); harness.check(interfaces.contains(Comparable.class)); }
/** * Runs the test using the specified harness. * * @param harness the test harness (<code>null</code> not permitted). */
Runs the test using the specified harness
test
{ "repo_name": "niloc132/mauve-gwt", "path": "src/main/java/gnu/testlet/java/lang/Float/classInfo/getInterfaces.java", "license": "gpl-2.0", "size": 1654 }
[ "gnu.testlet.TestHarness", "java.lang.Float", "java.util.Arrays", "java.util.List" ]
import gnu.testlet.TestHarness; import java.lang.Float; import java.util.Arrays; import java.util.List;
import gnu.testlet.*; import java.lang.*; import java.util.*;
[ "gnu.testlet", "java.lang", "java.util" ]
gnu.testlet; java.lang; java.util;
409,668
synchronized void logEdit(final int length, final byte[] data) { long start = beginTransaction(); try { editLogStream.writeRaw(data, 0, length); } catch (IOException ex) { // All journals have failed, it will be handled in logSync. } endTransaction(start); }
synchronized void logEdit(final int length, final byte[] data) { long start = beginTransaction(); try { editLogStream.writeRaw(data, 0, length); } catch (IOException ex) { } endTransaction(start); }
/** * Write an operation to the edit log. Do not sync to persistent * store yet. */
Write an operation to the edit log. Do not sync to persistent store yet
logEdit
{ "repo_name": "ZhangXFeng/hadoop", "path": "src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java", "license": "apache-2.0", "size": 52179 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,603,334
Object url = parameters.get(ShapefileDataStoreFactory.URLP.key); Logger log = LoggerFactory.getLogger(DataStoreFactory.class); if (url instanceof String) { parameters.put(ShapefileDataStoreFactory.URLP.key, ResourceUtils.getURL((String) url).toExternalForm()); } if (DATASTORE_CACHE.containsKey(parameters)) { return DATASTORE_CACHE.get(parameters); } DataStore store = DataStoreFinder.getDataStore(parameters); Object typed = parameters.get(USE_TYPED_FIDS); if (typed instanceof String) { Boolean t = Boolean.valueOf((String) typed); if (!t) { if (store != null) { log.warn("Non-typed FIDs are only supported by first-generation JDBC datastores, " + "using default fid format for datastore class " + store.getClass().getName()); } } } if (null == store) { StringBuilder availableStr = new StringBuilder(); StringBuilder missingStr = new StringBuilder(); Iterator<DataStoreFactorySpi> all = DataStoreFinder.getAllDataStores(); while (all.hasNext()) { DataStoreFactorySpi factory = all.next(); if (!factory.isAvailable()) { log.warn("Datastore factory " + factory.getDisplayName() + "(" + factory.getDescription() + ") is not available"); if (missingStr.length() != 0) { missingStr.append(","); } missingStr.append(factory.getDisplayName()); } else { if (availableStr.length() != 0) { availableStr.append(","); } availableStr.append(factory.getDisplayName()); } } throw new IOException( "No datastore found. Possible causes are missing factory or missing library for your datastore" + " (e.g. database driver).\nCheck the isAvailable() method of your" + " DataStoreFactory class to find out which libraries are needed.\n" + "Unavailable factories : " + missingStr + "\n" + "Available factories : " + availableStr + "\n"); } DATASTORE_CACHE.put(parameters, store); return store; }
Object url = parameters.get(ShapefileDataStoreFactory.URLP.key); Logger log = LoggerFactory.getLogger(DataStoreFactory.class); if (url instanceof String) { parameters.put(ShapefileDataStoreFactory.URLP.key, ResourceUtils.getURL((String) url).toExternalForm()); } if (DATASTORE_CACHE.containsKey(parameters)) { return DATASTORE_CACHE.get(parameters); } DataStore store = DataStoreFinder.getDataStore(parameters); Object typed = parameters.get(USE_TYPED_FIDS); if (typed instanceof String) { Boolean t = Boolean.valueOf((String) typed); if (!t) { if (store != null) { log.warn(STR + STR + store.getClass().getName()); } } } if (null == store) { StringBuilder availableStr = new StringBuilder(); StringBuilder missingStr = new StringBuilder(); Iterator<DataStoreFactorySpi> all = DataStoreFinder.getAllDataStores(); while (all.hasNext()) { DataStoreFactorySpi factory = all.next(); if (!factory.isAvailable()) { log.warn(STR + factory.getDisplayName() + "(" + factory.getDescription() + STR); if (missingStr.length() != 0) { missingStr.append(","); } missingStr.append(factory.getDisplayName()); } else { if (availableStr.length() != 0) { availableStr.append(","); } availableStr.append(factory.getDisplayName()); } } throw new IOException( STR + STR + STR + STR + missingStr + "\n" + STR + availableStr + "\n"); } DATASTORE_CACHE.put(parameters, store); return store; }
/** * Creates a suitable {@link DataStore} for the specified parameters. * * @param parameters list of GeoTools parameters. * @return data store, never null * @throws IOException could not create data store */
Creates a suitable <code>DataStore</code> for the specified parameters
create
{ "repo_name": "geomajas/geomajas-project-server", "path": "plugin/layer-geotools/geotools/src/main/java/org/geomajas/layer/geotools/DataStoreFactory.java", "license": "agpl-3.0", "size": 4040 }
[ "java.io.IOException", "java.util.Iterator", "org.geotools.data.DataStore", "org.geotools.data.DataStoreFactorySpi", "org.geotools.data.DataStoreFinder", "org.geotools.data.shapefile.ShapefileDataStoreFactory", "org.slf4j.Logger", "org.slf4j.LoggerFactory", "org.springframework.util.ResourceUtils" ]
import java.io.IOException; import java.util.Iterator; import org.geotools.data.DataStore; import org.geotools.data.DataStoreFactorySpi; import org.geotools.data.DataStoreFinder; import org.geotools.data.shapefile.ShapefileDataStoreFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.util.ResourceUtils;
import java.io.*; import java.util.*; import org.geotools.data.*; import org.geotools.data.shapefile.*; import org.slf4j.*; import org.springframework.util.*;
[ "java.io", "java.util", "org.geotools.data", "org.slf4j", "org.springframework.util" ]
java.io; java.util; org.geotools.data; org.slf4j; org.springframework.util;
451,886
public boolean containsTaskWithRequestId(String requestIdKey, String requestId) throws KeeperException, InterruptedException { List<String> childNames = zookeeper.getChildren(dir, null, true); stats.setQueueLength(childNames.size()); for (String childName : childNames) { if (childName != null) { try { byte[] data = zookeeper.getData(dir + "/" + childName, null, null, true); if (data != null) { ZkNodeProps message = ZkNodeProps.load(data); if (message.containsKey(requestIdKey)) { LOG.debug(">>>> {}", message.get(requestIdKey)); if(message.get(requestIdKey).equals(requestId)) return true; } } } catch (KeeperException.NoNodeException e) { // Another client removed the node first, try next } } } return false; }
boolean function(String requestIdKey, String requestId) throws KeeperException, InterruptedException { List<String> childNames = zookeeper.getChildren(dir, null, true); stats.setQueueLength(childNames.size()); for (String childName : childNames) { if (childName != null) { try { byte[] data = zookeeper.getData(dir + "/" + childName, null, null, true); if (data != null) { ZkNodeProps message = ZkNodeProps.load(data); if (message.containsKey(requestIdKey)) { LOG.debug(STR, message.get(requestIdKey)); if(message.get(requestIdKey).equals(requestId)) return true; } } } catch (KeeperException.NoNodeException e) { } } } return false; }
/** * Returns true if the queue contains a task with the specified async id. */
Returns true if the queue contains a task with the specified async id
containsTaskWithRequestId
{ "repo_name": "yida-lxw/solr-5.3.1", "path": "solr/core/src/java/org/apache/solr/cloud/DistributedQueue.java", "license": "apache-2.0", "size": 19489 }
[ "java.util.List", "org.apache.solr.common.cloud.ZkNodeProps", "org.apache.zookeeper.KeeperException" ]
import java.util.List; import org.apache.solr.common.cloud.ZkNodeProps; import org.apache.zookeeper.KeeperException;
import java.util.*; import org.apache.solr.common.cloud.*; import org.apache.zookeeper.*;
[ "java.util", "org.apache.solr", "org.apache.zookeeper" ]
java.util; org.apache.solr; org.apache.zookeeper;
1,949,745
@SuppressWarnings("deprecation") protected Section loadSection(Element sectionEl, Subpart subpart, Map<Long, Section> sectionTable, Map<Long, Placement> timetable) { Section parentSection = null; if (sectionEl.attributeValue("parent") != null) parentSection = sectionTable.get(Long.valueOf(sectionEl.attributeValue("parent"))); Placement placement = null; if (timetable != null) { placement = timetable.get(Long.parseLong(sectionEl.attributeValue("id"))); } else { TimeLocation time = null; Element timeEl = sectionEl.element("time"); if (timeEl != null) { time = new TimeLocation( Integer.parseInt(timeEl.attributeValue("days"), 2), Integer.parseInt(timeEl.attributeValue("start")), Integer.parseInt(timeEl.attributeValue("length")), 0, 0, timeEl.attributeValue("datePattern") == null ? null : Long.valueOf(timeEl.attributeValue("datePattern")), timeEl.attributeValue("datePatternName", ""), createBitSet(timeEl.attributeValue("dates")), Integer.parseInt(timeEl.attributeValue("breakTime", "0"))); if (timeEl.attributeValue("pattern") != null) time.setTimePatternId(Long.valueOf(timeEl.attributeValue("pattern"))); } List<RoomLocation> rooms = new ArrayList<RoomLocation>(); for (Iterator<?> m = sectionEl.elementIterator("room"); m.hasNext();) { Element roomEl = (Element) m.next(); Double posX = null, posY = null; if (roomEl.attributeValue("location") != null) { String loc = roomEl.attributeValue("location"); posX = Double.valueOf(loc.substring(0, loc.indexOf(','))); posY = Double.valueOf(loc.substring(loc.indexOf(',') + 1)); } RoomLocation room = new RoomLocation( Long.valueOf(roomEl.attributeValue("id")), roomEl.attributeValue("name", "R" + roomEl.attributeValue("id")), roomEl.attributeValue("building") == null ? null : Long.valueOf(roomEl.attributeValue("building")), 0, Integer.parseInt(roomEl.attributeValue("capacity")), posX, posY, "true".equals(roomEl.attributeValue("ignoreTooFar")), null); rooms.add(room); } placement = (time == null ? null : new Placement(null, time, rooms)); } List<Instructor> instructors = new ArrayList<Instructor>(); for (Iterator<?> m = sectionEl.elementIterator("instructor"); m.hasNext(); ) { Element instructorEl = (Element)m.next(); instructors.add(new Instructor(Long.parseLong(instructorEl.attributeValue("id")), instructorEl.attributeValue("externalId"), instructorEl.attributeValue("name"), instructorEl.attributeValue("email"))); } if (instructors.isEmpty() && sectionEl.attributeValue("instructorIds") != null) instructors = Instructor.toInstructors(sectionEl.attributeValue("instructorIds"), sectionEl.attributeValue("instructorNames")); Section section = new Section( Long.parseLong(sectionEl.attributeValue("id")), Integer.parseInt(sectionEl.attributeValue("limit")), sectionEl.attributeValue("name", "S" + sectionEl.attributeValue("id")), subpart, placement, instructors, parentSection); section.setSpaceHeld(Double.parseDouble(sectionEl.attributeValue("hold", "0.0"))); section.setSpaceExpected(Double.parseDouble(sectionEl.attributeValue("expect", "0.0"))); section.setCancelled("true".equalsIgnoreCase(sectionEl.attributeValue("cancelled", "false"))); section.setEnabled("true".equalsIgnoreCase(sectionEl.attributeValue("enabled", "true"))); section.setOnline("true".equalsIgnoreCase(sectionEl.attributeValue("online", "false"))); section.setPast("true".equalsIgnoreCase(sectionEl.attributeValue("past", "false"))); for (Iterator<?> m = sectionEl.elementIterator("cname"); m.hasNext(); ) { Element cNameEl = (Element)m.next(); section.setName(Long.parseLong(cNameEl.attributeValue("id")), cNameEl.getText()); } Element ignoreEl = sectionEl.element("no-conflicts"); if (ignoreEl != null) { for (Iterator<?> m = ignoreEl.elementIterator("section"); m.hasNext(); ) section.addIgnoreConflictWith(Long.parseLong(((Element)m.next()).attributeValue("id"))); } return section; }
@SuppressWarnings(STR) Section function(Element sectionEl, Subpart subpart, Map<Long, Section> sectionTable, Map<Long, Placement> timetable) { Section parentSection = null; if (sectionEl.attributeValue(STR) != null) parentSection = sectionTable.get(Long.valueOf(sectionEl.attributeValue(STR))); Placement placement = null; if (timetable != null) { placement = timetable.get(Long.parseLong(sectionEl.attributeValue("id"))); } else { TimeLocation time = null; Element timeEl = sectionEl.element("time"); if (timeEl != null) { time = new TimeLocation( Integer.parseInt(timeEl.attributeValue("days"), 2), Integer.parseInt(timeEl.attributeValue("start")), Integer.parseInt(timeEl.attributeValue(STR)), 0, 0, timeEl.attributeValue(STR) == null ? null : Long.valueOf(timeEl.attributeValue(STR)), timeEl.attributeValue(STR, STRdatesSTRbreakTimeSTR0STRpatternSTRpatternSTRroomSTRlocationSTRlocationSTRidSTRnameSTRRSTRidSTRbuildingSTRbuildingSTRcapacitySTRtrueSTRignoreTooFarSTRinstructorSTRidSTRexternalIdSTRnameSTRemailSTRinstructorIdsSTRinstructorIdsSTRinstructorNamesSTRidSTRlimitSTRnameSTRSSTRidSTRholdSTR0.0STRexpectSTR0.0STRtrueSTRcancelledSTRfalseSTRtrueSTRenabledSTRtrueSTRtrueSTRonlineSTRfalseSTRtrueSTRpastSTRfalseSTRcnameSTRidSTRno-conflictsSTRsectionSTRid"))); } return section; }
/** * Load section * @param sectionEl section element * @param subpart parent subpart * @param sectionTable section table (of the offering) * @param timetable provided timetable * @return loaded section */
Load section
loadSection
{ "repo_name": "UniTime/cpsolver", "path": "src/org/cpsolver/studentsct/StudentSectioningXMLLoader.java", "license": "lgpl-3.0", "size": 63607 }
[ "java.util.Map", "org.cpsolver.coursett.model.Placement", "org.cpsolver.coursett.model.TimeLocation", "org.cpsolver.studentsct.model.Section", "org.cpsolver.studentsct.model.Subpart", "org.dom4j.Element" ]
import java.util.Map; import org.cpsolver.coursett.model.Placement; import org.cpsolver.coursett.model.TimeLocation; import org.cpsolver.studentsct.model.Section; import org.cpsolver.studentsct.model.Subpart; import org.dom4j.Element;
import java.util.*; import org.cpsolver.coursett.model.*; import org.cpsolver.studentsct.model.*; import org.dom4j.*;
[ "java.util", "org.cpsolver.coursett", "org.cpsolver.studentsct", "org.dom4j" ]
java.util; org.cpsolver.coursett; org.cpsolver.studentsct; org.dom4j;
293,239
protected Stream<AppRegistration> toValidAppRegistration(Map.Entry<String, URI> kv, URI metadataURI) { String key = kv.getKey(); String[] tokens = key.split("\\."); if (tokens.length == 2) { String name = tokens[1]; ApplicationType type = ApplicationType.valueOf(tokens[0]); URI appURI = warnOnMalformedURI(key, kv.getValue()); String version = getVersionOrBroken(appURI.toString()); return Stream.of(new AppRegistration(name, type, version, appURI, metadataURI)); } else { Assert.isTrue(tokens.length == 3 && METADATA_KEY_SUFFIX.equals(tokens[2]), "Invalid format for app key '" + key + "'in file. Must be <type>.<name> or <type>.<name>" + ".metadata"); return Stream.empty(); } }
Stream<AppRegistration> function(Map.Entry<String, URI> kv, URI metadataURI) { String key = kv.getKey(); String[] tokens = key.split("\\."); if (tokens.length == 2) { String name = tokens[1]; ApplicationType type = ApplicationType.valueOf(tokens[0]); URI appURI = warnOnMalformedURI(key, kv.getValue()); String version = getVersionOrBroken(appURI.toString()); return Stream.of(new AppRegistration(name, type, version, appURI, metadataURI)); } else { Assert.isTrue(tokens.length == 3 && METADATA_KEY_SUFFIX.equals(tokens[2]), STR + key + STR + STR); return Stream.empty(); } }
/** * Builds a {@link Stream} from key/value mapping. * @return * <ul> * <li>valid AppRegistration as single element Stream</li> * <li>silently ignores well malformed metadata entries (0 element Stream) or</li> * <li>fails otherwise.</li> * </ul> * * @param kv key/value representing app key (key) and app URI (value) * @param metadataURI metadataUri computed from a given app key */
Builds a <code>Stream</code> from key/value mapping
toValidAppRegistration
{ "repo_name": "dturanski/spring-cloud-data", "path": "spring-cloud-dataflow-registry/src/main/java/org/springframework/cloud/dataflow/registry/service/DefaultAppRegistryService.java", "license": "apache-2.0", "size": 13025 }
[ "java.util.Map", "java.util.stream.Stream", "org.springframework.cloud.dataflow.core.AppRegistration", "org.springframework.cloud.dataflow.core.ApplicationType", "org.springframework.util.Assert" ]
import java.util.Map; import java.util.stream.Stream; import org.springframework.cloud.dataflow.core.AppRegistration; import org.springframework.cloud.dataflow.core.ApplicationType; import org.springframework.util.Assert;
import java.util.*; import java.util.stream.*; import org.springframework.cloud.dataflow.core.*; import org.springframework.util.*;
[ "java.util", "org.springframework.cloud", "org.springframework.util" ]
java.util; org.springframework.cloud; org.springframework.util;
193,759
public static void main(Iterable<Class<? extends BlazeModule>> moduleClasses, String[] args) { setupUncaughtHandler(args); List<BlazeModule> modules = createModules(moduleClasses); // blaze.cc will put --batch first if the user set it. if (args.length >= 1 && args[0].equals("--batch")) { // Run Blaze in batch mode. System.exit(batchMain(modules, args)); } LOG.info("Starting Blaze server with args " + Arrays.toString(args)); try { // Run Blaze in server mode. System.exit(serverMain(modules, OutErr.SYSTEM_OUT_ERR, args)); } catch (RuntimeException | Error e) { // A definite bug... BugReport.printBug(OutErr.SYSTEM_OUT_ERR, e); BugReport.sendBugReport(e, Arrays.asList(args)); System.exit(ExitCode.BLAZE_INTERNAL_ERROR.getNumericExitCode()); throw e; // Shouldn't get here. } }
static void function(Iterable<Class<? extends BlazeModule>> moduleClasses, String[] args) { setupUncaughtHandler(args); List<BlazeModule> modules = createModules(moduleClasses); if (args.length >= 1 && args[0].equals(STR)) { System.exit(batchMain(modules, args)); } LOG.info(STR + Arrays.toString(args)); try { System.exit(serverMain(modules, OutErr.SYSTEM_OUT_ERR, args)); } catch (RuntimeException Error e) { BugReport.printBug(OutErr.SYSTEM_OUT_ERR, e); BugReport.sendBugReport(e, Arrays.asList(args)); System.exit(ExitCode.BLAZE_INTERNAL_ERROR.getNumericExitCode()); throw e; } }
/** * Main method for the Blaze server startup. Note: This method logs * exceptions to remote servers. Do not add this to a unittest. */
Main method for the Blaze server startup. Note: This method logs exceptions to remote servers. Do not add this to a unittest
main
{ "repo_name": "charlieaustin/bazel", "path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeRuntime.java", "license": "apache-2.0", "size": 69352 }
[ "com.google.devtools.build.lib.util.ExitCode", "com.google.devtools.build.lib.util.io.OutErr", "java.util.Arrays", "java.util.List" ]
import com.google.devtools.build.lib.util.ExitCode; import com.google.devtools.build.lib.util.io.OutErr; import java.util.Arrays; import java.util.List;
import com.google.devtools.build.lib.util.*; import com.google.devtools.build.lib.util.io.*; import java.util.*;
[ "com.google.devtools", "java.util" ]
com.google.devtools; java.util;
2,160,783
public static void arrayToNetwork(final double[] array, final MLMethod network) { if (network instanceof MLEncodable) { ((MLEncodable) network).decodeFromArray(array); return; } throw new NeuralNetworkError(NetworkCODEC.ERROR + network.getClass().getName()); }
static void function(final double[] array, final MLMethod network) { if (network instanceof MLEncodable) { ((MLEncodable) network).decodeFromArray(array); return; } throw new NeuralNetworkError(NetworkCODEC.ERROR + network.getClass().getName()); }
/** * Use an array to populate the memory of the neural network. * * @param array * An array of doubles. * @param network * The network to encode. */
Use an array to populate the memory of the neural network
arrayToNetwork
{ "repo_name": "larhoy/SentimentProjectV2", "path": "SentimentAnalysisV2/encog-core-3.1.0/src/main/java/org/encog/neural/networks/structure/NetworkCODEC.java", "license": "mit", "size": 4823 }
[ "org.encog.ml.MLEncodable", "org.encog.ml.MLMethod", "org.encog.neural.NeuralNetworkError" ]
import org.encog.ml.MLEncodable; import org.encog.ml.MLMethod; import org.encog.neural.NeuralNetworkError;
import org.encog.ml.*; import org.encog.neural.*;
[ "org.encog.ml", "org.encog.neural" ]
org.encog.ml; org.encog.neural;
980,471
protected void prepare() { ProcessInfoParameter[] para = getParameter(); for (int i = 0; i < para.length; i++) { String name = para[i].getParameterName(); if (para[i].getParameter() == null) ; else log.log(Level.SEVERE, "prepare - Unknown Parameter: " + name); } } // prepare
void function() { ProcessInfoParameter[] para = getParameter(); for (int i = 0; i < para.length; i++) { String name = para[i].getParameterName(); if (para[i].getParameter() == null) ; else log.log(Level.SEVERE, STR + name); } }
/** * Prepare - e.g., get Parameters. */
Prepare - e.g., get Parameters
prepare
{ "repo_name": "mgrigioni/oseb", "path": "base/src/org/adempierelbr/process/ProcSystemInfo.java", "license": "gpl-2.0", "size": 2259 }
[ "java.util.logging.Level", "org.compiere.process.ProcessInfoParameter" ]
import java.util.logging.Level; import org.compiere.process.ProcessInfoParameter;
import java.util.logging.*; import org.compiere.process.*;
[ "java.util", "org.compiere.process" ]
java.util; org.compiere.process;
1,615,879
public void inviteMember(PeerSemanticTag peer, boolean fullmember) throws SharkKBException, SharkSubSpaceException;
void function(PeerSemanticTag peer, boolean fullmember) throws SharkKBException, SharkSubSpaceException;
/** * A dedicated peer is invited by sub space owner. Peer data are merged * into the subspace and becomes a member. The peer gets an invitation. * This method can only be * performed by subspace owner. * * @param peer * @throws SharkSubSpaceException * @throws SharkKBException */
A dedicated peer is invited by sub space owner. Peer data are merged into the subspace and becomes a member. The peer gets an invitation. This method can only be performed by subspace owner
inviteMember
{ "repo_name": "blackicetee/SharkProfile", "path": "src/java/coreApps/net/sharkfw/subspace/SubSpace.java", "license": "gpl-3.0", "size": 15868 }
[ "net.sharkfw.knowledgeBase.PeerSemanticTag", "net.sharkfw.knowledgeBase.SharkKBException" ]
import net.sharkfw.knowledgeBase.PeerSemanticTag; import net.sharkfw.knowledgeBase.SharkKBException;
import net.sharkfw.*;
[ "net.sharkfw" ]
net.sharkfw;
2,586,559
public Group createGroup(Group group) throws GroupAlreadyExistsException, AccessControlException, UserNotFoundException, WriterException, IOException { URL createGroupURL = lookupServiceURL(Standards.GMS_GROUPS_01); log.debug("createGroupURL request to " + createGroupURL.toString()); // reset the state of the cache clearCache(); StringBuilder groupXML = new StringBuilder(); GroupWriter groupWriter = new GroupWriter(); groupWriter.write(group, groupXML); log.debug("createGroup: " + groupXML); byte[] bytes = groupXML.toString().getBytes("UTF-8"); ByteArrayInputStream in = new ByteArrayInputStream(bytes); HttpUpload transfer = new HttpUpload(in, createGroupURL); transfer.run(); Throwable error = transfer.getThrowable(); if (error != null) { log.debug("createGroup throwable", error); // transfer returns a -1 code for anonymous uploads. if ((transfer.getResponseCode() == -1) || (transfer.getResponseCode() == 401) || (transfer.getResponseCode() == 403)) { throw new AccessControlException(error.getMessage()); } if (transfer.getResponseCode() == 400) { throw new IllegalArgumentException(error.getMessage()); } if (transfer.getResponseCode() == 409) { throw new GroupAlreadyExistsException(error.getMessage()); } if (transfer.getResponseCode() == 404) { throw new UserNotFoundException(error.getMessage()); } throw new IOException(error); } String retXML = transfer.getResponseBody(); try { log.debug("createGroup returned: " + retXML); GroupReader groupReader = new GroupReader(); return groupReader.read(retXML); } catch (Exception bug) { log.error("Unexpected exception", bug); throw new RuntimeException(bug); } }
Group function(Group group) throws GroupAlreadyExistsException, AccessControlException, UserNotFoundException, WriterException, IOException { URL createGroupURL = lookupServiceURL(Standards.GMS_GROUPS_01); log.debug(STR + createGroupURL.toString()); clearCache(); StringBuilder groupXML = new StringBuilder(); GroupWriter groupWriter = new GroupWriter(); groupWriter.write(group, groupXML); log.debug(STR + groupXML); byte[] bytes = groupXML.toString().getBytes("UTF-8"); ByteArrayInputStream in = new ByteArrayInputStream(bytes); HttpUpload transfer = new HttpUpload(in, createGroupURL); transfer.run(); Throwable error = transfer.getThrowable(); if (error != null) { log.debug(STR, error); if ((transfer.getResponseCode() == -1) (transfer.getResponseCode() == 401) (transfer.getResponseCode() == 403)) { throw new AccessControlException(error.getMessage()); } if (transfer.getResponseCode() == 400) { throw new IllegalArgumentException(error.getMessage()); } if (transfer.getResponseCode() == 409) { throw new GroupAlreadyExistsException(error.getMessage()); } if (transfer.getResponseCode() == 404) { throw new UserNotFoundException(error.getMessage()); } throw new IOException(error); } String retXML = transfer.getResponseBody(); try { log.debug(STR + retXML); GroupReader groupReader = new GroupReader(); return groupReader.read(retXML); } catch (Exception bug) { log.error(STR, bug); throw new RuntimeException(bug); } }
/** * Create a new group. * * @param group The group to create * @return The newly created group will all the information. * @throws GroupAlreadyExistsException If a group with the same name already * exists. * @throws AccessControlException If unauthorized to perform this operation. * @throws UserNotFoundException If User not found * @throws IOException If underlying service call fails */
Create a new group
createGroup
{ "repo_name": "opencadc/ac", "path": "cadc-access-control/src/main/java/ca/nrc/cadc/ac/client/GMSClient.java", "license": "agpl-3.0", "size": 41638 }
[ "ca.nrc.cadc.ac.Group", "ca.nrc.cadc.ac.GroupAlreadyExistsException", "ca.nrc.cadc.ac.UserNotFoundException", "ca.nrc.cadc.ac.WriterException", "ca.nrc.cadc.ac.xml.GroupReader", "ca.nrc.cadc.ac.xml.GroupWriter", "ca.nrc.cadc.net.HttpUpload", "ca.nrc.cadc.reg.Standards", "java.io.ByteArrayInputStream", "java.io.IOException", "java.security.AccessControlException" ]
import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.UserNotFoundException; import ca.nrc.cadc.ac.WriterException; import ca.nrc.cadc.ac.xml.GroupReader; import ca.nrc.cadc.ac.xml.GroupWriter; import ca.nrc.cadc.net.HttpUpload; import ca.nrc.cadc.reg.Standards; import java.io.ByteArrayInputStream; import java.io.IOException; import java.security.AccessControlException;
import ca.nrc.cadc.ac.*; import ca.nrc.cadc.ac.xml.*; import ca.nrc.cadc.net.*; import ca.nrc.cadc.reg.*; import java.io.*; import java.security.*;
[ "ca.nrc.cadc", "java.io", "java.security" ]
ca.nrc.cadc; java.io; java.security;
2,156,754
public void setDocument(Document doc) { m_doc = doc; }
void function(Document doc) { m_doc = doc; }
/** * Specify which document this helper is currently operating on. * * @param doc The DOM Document node for this document. * @see #getDocument */
Specify which document this helper is currently operating on
setDocument
{ "repo_name": "itgeeker/jdk", "path": "src/com/sun/org/apache/xml/internal/utils/DOM2Helper.java", "license": "apache-2.0", "size": 10644 }
[ "org.w3c.dom.Document" ]
import org.w3c.dom.Document;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,532,056
public boolean canDeleteIndexContents(Index index, IndexSettings indexSettings) { // index contents can be deleted if its an already closed index (so all its resources have // already been relinquished) final IndexService indexService = indexService(index); if (indexService == null && nodeEnv.hasNodeFile()) { return true; } return false; }
boolean function(Index index, IndexSettings indexSettings) { final IndexService indexService = indexService(index); if (indexService == null && nodeEnv.hasNodeFile()) { return true; } return false; }
/** * This method returns true if the current node is allowed to delete the given index. * This is the case if the index is deleted in the metadata or there is no allocation * on the local node and the index isn't on a shared file system. * @param index {@code Index} to check whether deletion is allowed * @param indexSettings {@code IndexSettings} for the given index * @return true if the index can be deleted on this node */
This method returns true if the current node is allowed to delete the given index. This is the case if the index is deleted in the metadata or there is no allocation on the local node and the index isn't on a shared file system
canDeleteIndexContents
{ "repo_name": "EvilMcJerkface/crate", "path": "server/src/main/java/org/elasticsearch/indices/IndicesService.java", "license": "apache-2.0", "size": 48414 }
[ "org.elasticsearch.index.Index", "org.elasticsearch.index.IndexService", "org.elasticsearch.index.IndexSettings" ]
import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexService; import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
377,620
private void getUsernameAndPasswd() { // get the username and password from preferences if saved else from the // edit boxes if (settings.contains(Constants.LOGIN_PASSWORD)) { // password is present in the preferences username = settings.getString(Constants.LOGIN_USERNAME, "none"); password = settings.getString(Constants.LOGIN_PASSWORD, "****"); } else { // not present get from the edit boxes username = usernameBox.getText().toString(); password = passwordBox.getText().toString(); } } private class getMyWatchlistTask extends AsyncTask<String, Void, Void> { ProgressDialog dialog; private RSSFeed rssFeed; private LoginHandler loginHandler; private GetRssFeedClass getRssFeedClass; private FeedDBAdapter feedDBAdapter = new FeedDBAdapter( ActivityMyWatchList.this); private boolean isError = false,isFeedEmpty = false; private String usernameString, passwordString; List<RSSItem> _itemList; private String errorMessage; public getMyWatchlistTask(String usernameString, String passwordString) { this.usernameString = usernameString; this.passwordString = passwordString; }
void function() { if (settings.contains(Constants.LOGIN_PASSWORD)) { username = settings.getString(Constants.LOGIN_USERNAME, "none"); password = settings.getString(Constants.LOGIN_PASSWORD, "****"); } else { username = usernameBox.getText().toString(); password = passwordBox.getText().toString(); } } private class getMyWatchlistTask extends AsyncTask<String, Void, Void> { ProgressDialog dialog; private RSSFeed rssFeed; private LoginHandler loginHandler; private GetRssFeedClass getRssFeedClass; private FeedDBAdapter feedDBAdapter = new FeedDBAdapter( ActivityMyWatchList.this); private boolean isError = false,isFeedEmpty = false; private String usernameString, passwordString; List<RSSItem> _itemList; private String errorMessage; public getMyWatchlistTask(String usernameString, String passwordString) { this.usernameString = usernameString; this.passwordString = passwordString; }
/** * sets the username and passeord to the variables if present in shared * preferences. If not present sets username to "none" and password "****" * */
sets the username and passeord to the variables if present in shared preferences. If not present sets username to "none" and password "****"
getUsernameAndPasswd
{ "repo_name": "SaarangaInfotech/Wikitrack", "path": "src/com/saaranga/wikikannada/ActivityMyWatchList.java", "license": "gpl-3.0", "size": 10969 }
[ "android.app.ProgressDialog", "android.os.AsyncTask", "com.saaranga.wikitrack.utilities.Constants", "java.util.List" ]
import android.app.ProgressDialog; import android.os.AsyncTask; import com.saaranga.wikitrack.utilities.Constants; import java.util.List;
import android.app.*; import android.os.*; import com.saaranga.wikitrack.utilities.*; import java.util.*;
[ "android.app", "android.os", "com.saaranga.wikitrack", "java.util" ]
android.app; android.os; com.saaranga.wikitrack; java.util;
2,125,232
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<Void>, Void> beginCompleteRestore( String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName);
@ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<Void>, Void> beginCompleteRestore( String resourceGroupName, String managedInstanceName, String databaseName, String lastBackupName);
/** * Completes the restore operation on a managed database. * * @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value * from the Azure Resource Manager API or the portal. * @param managedInstanceName The name of the managed instance. * @param databaseName The name of the database. * @param lastBackupName The last backup name to apply. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */
Completes the restore operation on a managed database
beginCompleteRestore
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-sql/src/main/java/com/azure/resourcemanager/sql/fluent/ManagedDatabasesClient.java", "license": "mit", "size": 37573 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.management.polling.PollResult", "com.azure.core.util.polling.SyncPoller" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller;
import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*;
[ "com.azure.core" ]
com.azure.core;
808,302
public void setURLText(String text) { this.urlText = text; notifyListeners(new TitleChangeEvent(this)); }
void function(String text) { this.urlText = text; notifyListeners(new TitleChangeEvent(this)); }
/** * Sets the URL text to the specified text and sends a * {@link TitleChangeEvent} to all registered listeners. * * @param text the text (<code>null</code> permitted). */
Sets the URL text to the specified text and sends a <code>TitleChangeEvent</code> to all registered listeners
setURLText
{ "repo_name": "apetresc/JFreeChart", "path": "src/main/java/org/jfree/chart/title/TextTitle.java", "license": "lgpl-2.1", "size": 33516 }
[ "org.jfree.chart.event.TitleChangeEvent" ]
import org.jfree.chart.event.TitleChangeEvent;
import org.jfree.chart.event.*;
[ "org.jfree.chart" ]
org.jfree.chart;
1,210,356
protected PrintStream findStream() { PrintStream ps = streams.get(); if (ps == null) { ps = wrapped; } return ps; } // ---------------------------------------------------- PrintStream Methods
PrintStream function() { PrintStream ps = streams.get(); if (ps == null) { ps = wrapped; } return ps; }
/** * Find PrintStream to which the output must be written to. */
Find PrintStream to which the output must be written to
findStream
{ "repo_name": "WhiteBearSolutions/WBSAirback", "path": "packages/wbsairback-tomcat/wbsairback-tomcat-7.0.22/java/org/apache/jasper/compiler/AntCompiler.java", "license": "apache-2.0", "size": 15882 }
[ "java.io.PrintStream" ]
import java.io.PrintStream;
import java.io.*;
[ "java.io" ]
java.io;
2,788,252
public ODocumentFieldHandlingStrategy create(int strategy) { Optional<ODocumentFieldHandlingStrategy> registered = ODocumentFieldHandlingStrategyRegistry.getInstance().getStrategy(strategy); if (registered.isPresent()) { return registered.get(); } Map<OType, ODocumentFieldOTypeHandlingStrategy> typeHandlingStrategies = new HashMap<OType, ODocumentFieldOTypeHandlingStrategy>(); switch (strategy) { case SINGLE_ORECORD_BYTES: typeHandlingStrategies.put( OType.BINARY, new ODocumentSingleRecordBytesOTypeHandlingStrategy()); break; case SPLIT_ORECORD_BYTES: typeHandlingStrategies.put( OType.BINARY, new ODocumentSplitRecordBytesOTypeHandlingStrategy()); break; case SIMPLE: default: break; } ODocumentSmartFieldHandlingStrategy strategyInstance = new ODocumentSmartFieldHandlingStrategy(typeHandlingStrategies); ODocumentFieldHandlingStrategyRegistry.getInstance() .registerStrategy(strategy, strategyInstance); return strategyInstance; }
ODocumentFieldHandlingStrategy function(int strategy) { Optional<ODocumentFieldHandlingStrategy> registered = ODocumentFieldHandlingStrategyRegistry.getInstance().getStrategy(strategy); if (registered.isPresent()) { return registered.get(); } Map<OType, ODocumentFieldOTypeHandlingStrategy> typeHandlingStrategies = new HashMap<OType, ODocumentFieldOTypeHandlingStrategy>(); switch (strategy) { case SINGLE_ORECORD_BYTES: typeHandlingStrategies.put( OType.BINARY, new ODocumentSingleRecordBytesOTypeHandlingStrategy()); break; case SPLIT_ORECORD_BYTES: typeHandlingStrategies.put( OType.BINARY, new ODocumentSplitRecordBytesOTypeHandlingStrategy()); break; case SIMPLE: default: break; } ODocumentSmartFieldHandlingStrategy strategyInstance = new ODocumentSmartFieldHandlingStrategy(typeHandlingStrategies); ODocumentFieldHandlingStrategyRegistry.getInstance() .registerStrategy(strategy, strategyInstance); return strategyInstance; }
/** * Creates a new instance of the requested strategy. Since strategies are stateless, if an * existing instance already exists then it's returned. * * @param strategy * @return strategy instance */
Creates a new instance of the requested strategy. Since strategies are stateless, if an existing instance already exists then it's returned
create
{ "repo_name": "orientechnologies/orientdb", "path": "object/src/main/java/com/orientechnologies/orient/object/enhancement/field/ODocumentFieldHandlingStrategyFactory.java", "license": "apache-2.0", "size": 2886 }
[ "com.orientechnologies.orient.core.metadata.schema.OType", "java.util.HashMap", "java.util.Map", "java.util.Optional" ]
import com.orientechnologies.orient.core.metadata.schema.OType; import java.util.HashMap; import java.util.Map; import java.util.Optional;
import com.orientechnologies.orient.core.metadata.schema.*; import java.util.*;
[ "com.orientechnologies.orient", "java.util" ]
com.orientechnologies.orient; java.util;
223,910
IntervalType scanIntervalType() { int precision = -1; int scale = -1; int startToken; int endToken; final int errorCode = ErrorCode.X_22006; startToken = endToken = token.tokenType; scanNext(errorCode); if (token.tokenType == Tokens.OPENBRACKET) { scanNext(errorCode); if (token.dataType == null || token.dataType.typeCode != Types.SQL_INTEGER) { throw Error.error(errorCode); } precision = ((Number) this.token.tokenValue).intValue(); scanNext(errorCode); if (token.tokenType == Tokens.COMMA) { if (startToken != Tokens.SECOND) { throw Error.error(errorCode); } scanNext(errorCode); if (token.dataType == null || token.dataType.typeCode != Types.SQL_INTEGER) { throw Error.error(errorCode); } scale = ((Number) token.tokenValue).intValue(); scanNext(errorCode); } if (token.tokenType != Tokens.CLOSEBRACKET) { throw Error.error(errorCode); } scanNext(errorCode); } if (token.tokenType == Tokens.TO) { scanNext(errorCode); endToken = token.tokenType; scanNext(errorCode); } if (token.tokenType == Tokens.OPENBRACKET) { if (endToken != Tokens.SECOND || endToken == startToken) { throw Error.error(errorCode); } scanNext(errorCode); if (token.dataType == null || token.dataType.typeCode != Types.SQL_INTEGER) { throw Error.error(errorCode); } scale = ((Number) token.tokenValue).intValue(); scanNext(errorCode); if (token.tokenType != Tokens.CLOSEBRACKET) { throw Error.error(errorCode); } scanNext(errorCode); } int startIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES, startToken); int endIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES, endToken); return IntervalType.getIntervalType(startIndex, endIndex, precision, scale); } private String intervalString; private int intervalPosition; private int intervalPrecision; private int fractionPrecision; Type dateTimeType;
IntervalType scanIntervalType() { int precision = -1; int scale = -1; int startToken; int endToken; final int errorCode = ErrorCode.X_22006; startToken = endToken = token.tokenType; scanNext(errorCode); if (token.tokenType == Tokens.OPENBRACKET) { scanNext(errorCode); if (token.dataType == null token.dataType.typeCode != Types.SQL_INTEGER) { throw Error.error(errorCode); } precision = ((Number) this.token.tokenValue).intValue(); scanNext(errorCode); if (token.tokenType == Tokens.COMMA) { if (startToken != Tokens.SECOND) { throw Error.error(errorCode); } scanNext(errorCode); if (token.dataType == null token.dataType.typeCode != Types.SQL_INTEGER) { throw Error.error(errorCode); } scale = ((Number) token.tokenValue).intValue(); scanNext(errorCode); } if (token.tokenType != Tokens.CLOSEBRACKET) { throw Error.error(errorCode); } scanNext(errorCode); } if (token.tokenType == Tokens.TO) { scanNext(errorCode); endToken = token.tokenType; scanNext(errorCode); } if (token.tokenType == Tokens.OPENBRACKET) { if (endToken != Tokens.SECOND endToken == startToken) { throw Error.error(errorCode); } scanNext(errorCode); if (token.dataType == null token.dataType.typeCode != Types.SQL_INTEGER) { throw Error.error(errorCode); } scale = ((Number) token.tokenValue).intValue(); scanNext(errorCode); if (token.tokenType != Tokens.CLOSEBRACKET) { throw Error.error(errorCode); } scanNext(errorCode); } int startIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES, startToken); int endIndex = ArrayUtil.find(Tokens.SQL_INTERVAL_FIELD_CODES, endToken); return IntervalType.getIntervalType(startIndex, endIndex, precision, scale); } private String intervalString; private int intervalPosition; private int intervalPrecision; private int fractionPrecision; Type dateTimeType;
/** * Reads the type part of the INTERVAL */
Reads the type part of the INTERVAL
scanIntervalType
{ "repo_name": "ThangBK2009/android-source-browsing.platform--external--hsqldb", "path": "src/org/hsqldb/Scanner.java", "license": "bsd-3-clause", "size": 68403 }
[ "org.hsqldb.error.Error", "org.hsqldb.error.ErrorCode", "org.hsqldb.lib.ArrayUtil", "org.hsqldb.types.IntervalType", "org.hsqldb.types.Type", "org.hsqldb.types.Types" ]
import org.hsqldb.error.Error; import org.hsqldb.error.ErrorCode; import org.hsqldb.lib.ArrayUtil; import org.hsqldb.types.IntervalType; import org.hsqldb.types.Type; import org.hsqldb.types.Types;
import org.hsqldb.error.*; import org.hsqldb.lib.*; import org.hsqldb.types.*;
[ "org.hsqldb.error", "org.hsqldb.lib", "org.hsqldb.types" ]
org.hsqldb.error; org.hsqldb.lib; org.hsqldb.types;
2,237,505
private static void globalSubstitute() throws Exception { // Global substitution with a literal Pattern p = Pattern.compile("(ab)(c*)"); Matcher m = p.matcher("abccczzzabcczzzabccc"); if (!m.replaceAll("test").equals("testzzztestzzztest")) failCount++; m.reset("zzzabccczzzabcczzzabccczzz"); if (!m.replaceAll("test").equals("zzztestzzztestzzztestzzz")) failCount++; // Global substitution with groups m.reset("zzzabccczzzabcczzzabccczzz"); String result = m.replaceAll("$1"); if (!result.equals("zzzabzzzabzzzabzzz")) failCount++; // Supplementary character test // Global substitution with a literal p = Pattern.compile(toSupplementaries("(ab)(c*)")); m = p.matcher(toSupplementaries("abccczzzabcczzzabccc")); if (!m.replaceAll(toSupplementaries("test")). equals(toSupplementaries("testzzztestzzztest"))) failCount++; m.reset(toSupplementaries("zzzabccczzzabcczzzabccczzz")); if (!m.replaceAll(toSupplementaries("test")). equals(toSupplementaries("zzztestzzztestzzztestzzz"))) failCount++; // Global substitution with groups m.reset(toSupplementaries("zzzabccczzzabcczzzabccczzz")); result = m.replaceAll("$1"); if (!result.equals(toSupplementaries("zzzabzzzabzzzabzzz"))) failCount++; report("Global Substitution"); }
static void function() throws Exception { Pattern p = Pattern.compile(STR); Matcher m = p.matcher(STR); if (!m.replaceAll("test").equals(STR)) failCount++; m.reset(STR); if (!m.replaceAll("test").equals(STR)) failCount++; m.reset(STR); String result = m.replaceAll("$1"); if (!result.equals(STR)) failCount++; p = Pattern.compile(toSupplementaries(STR)); m = p.matcher(toSupplementaries(STR)); if (!m.replaceAll(toSupplementaries("test")). equals(toSupplementaries(STR))) failCount++; m.reset(toSupplementaries(STR)); if (!m.replaceAll(toSupplementaries("test")). equals(toSupplementaries(STR))) failCount++; m.reset(toSupplementaries(STR)); result = m.replaceAll("$1"); if (!result.equals(toSupplementaries(STR))) failCount++; report(STR); }
/** * A basic sanity test of Matcher.replaceAll(). */
A basic sanity test of Matcher.replaceAll()
globalSubstitute
{ "repo_name": "md-5/jdk10", "path": "test/jdk/java/util/regex/RegExTest.java", "license": "gpl-2.0", "size": 187639 }
[ "java.util.regex.Matcher", "java.util.regex.Pattern" ]
import java.util.regex.Matcher; import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
189,261
public ServiceCall beginDelete202RetryInvalidHeaderAsync(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); }
ServiceCall function(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); }
/** * Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers. * * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link Call} object */
Long running delete request, service returns a 202 to the initial request receing a reponse with an invalid 'Location' and 'Retry-After' headers
beginDelete202RetryInvalidHeaderAsync
{ "repo_name": "stankovski/AutoRest", "path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperationsImpl.java", "license": "mit", "size": 226665 }
[ "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback" ]
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
import com.microsoft.rest.*;
[ "com.microsoft.rest" ]
com.microsoft.rest;
2,703,292
private void checkConflictWithPrimary(IgfsPath path) throws IgniteCheckedException { if (secondaryFs != null) { if (secondaryFs.info(path) != null) { throw new IgfsInvalidPathException("Path mapped to a PRIMARY mode found in secondary file " + "system. Remove path from secondary file system or change path mapping: " + path); } } }
void function(IgfsPath path) throws IgniteCheckedException { if (secondaryFs != null) { if (secondaryFs.info(path) != null) { throw new IgfsInvalidPathException(STR + STR + path); } } }
/** * Checks if given path exists in secondary file system and throws exception if so. * * @param path Path to check. * @throws IgniteCheckedException If path exists. */
Checks if given path exists in secondary file system and throws exception if so
checkConflictWithPrimary
{ "repo_name": "ryanzz/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsImpl.java", "license": "apache-2.0", "size": 70806 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.igfs.IgfsInvalidPathException", "org.apache.ignite.igfs.IgfsPath" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.igfs.IgfsInvalidPathException; import org.apache.ignite.igfs.IgfsPath;
import org.apache.ignite.*; import org.apache.ignite.igfs.*;
[ "org.apache.ignite" ]
org.apache.ignite;
219,414
ArtifactRepository getLocalRepository();
ArtifactRepository getLocalRepository();
/** * Returns the {@link ArtifactRepository} provided by Maven. * * @return The {@link ArtifactRepository} provided by Maven. * @since 1.0 */
Returns the <code>ArtifactRepository</code> provided by Maven
getLocalRepository
{ "repo_name": "mojohaus/mrm", "path": "mrm-api/src/main/java/org/codehaus/mojo/mrm/plugin/FactoryHelper.java", "license": "apache-2.0", "size": 2848 }
[ "org.apache.maven.artifact.repository.ArtifactRepository" ]
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.*;
[ "org.apache.maven" ]
org.apache.maven;
1,583,875
public static Term reduceComponents(CompoundTerm t1, Term t2) { boolean success; ArrayList<Term> list = t1.cloneComponents(); if (t1.getClass() == t2.getClass()) { success = list.removeAll(((CompoundTerm) t2).getComponents()); } else { success = list.remove(t2); } return (success ? make(t1, list) : null); }
static Term function(CompoundTerm t1, Term t2) { boolean success; ArrayList<Term> list = t1.cloneComponents(); if (t1.getClass() == t2.getClass()) { success = list.removeAll(((CompoundTerm) t2).getComponents()); } else { success = list.remove(t2); } return (success ? make(t1, list) : null); }
/** * Try to remove a component from a compound * @param t1 The compound * @param t2 The component * @return The new compound */
Try to remove a component from a compound
reduceComponents
{ "repo_name": "automenta/jcog", "path": "nars/jcog/nars/reason/language/CompoundTerm.java", "license": "gpl-3.0", "size": 26257 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
345,420
@Override public List<Exchange> getExchanges() { return new ArrayList<>(getQueue()); }
List<Exchange> function() { return new ArrayList<>(getQueue()); }
/** * Returns the current pending exchanges */
Returns the current pending exchanges
getExchanges
{ "repo_name": "tadayosi/camel", "path": "components/camel-seda/src/main/java/org/apache/camel/component/seda/SedaEndpoint.java", "license": "apache-2.0", "size": 21667 }
[ "java.util.ArrayList", "java.util.List", "org.apache.camel.Exchange" ]
import java.util.ArrayList; import java.util.List; import org.apache.camel.Exchange;
import java.util.*; import org.apache.camel.*;
[ "java.util", "org.apache.camel" ]
java.util; org.apache.camel;
812,738
public static Path addExtension(Path path, String... extensions) { StringBuilder pathStringBuilder = new StringBuilder(path.toString()); for (String extension : extensions) { if (!Strings.isNullOrEmpty(extension)) { pathStringBuilder.append(extension); } } return new Path(pathStringBuilder.toString()); }
static Path function(Path path, String... extensions) { StringBuilder pathStringBuilder = new StringBuilder(path.toString()); for (String extension : extensions) { if (!Strings.isNullOrEmpty(extension)) { pathStringBuilder.append(extension); } } return new Path(pathStringBuilder.toString()); }
/** * Suffix all <code>extensions</code> to <code>path</code>. * * <pre> * PathUtils.addExtension("/tmp/data/file", ".txt") = file.txt * PathUtils.addExtension("/tmp/data/file.txt.gpg", ".zip") = file.txt.gpg.zip * PathUtils.addExtension("/tmp/data/file.txt", ".tar", ".gz") = file.txt.tar.gz * PathUtils.addExtension("/tmp/data/file.txt.gpg", ".tar.txt") = file.txt.gpg.tar.txt * </pre> * * @param path to which the <code>extensions</code> need to be added * @param extensions to be added * * @return a new {@link Path} with <code>extensions</code> */
Suffix all <code>extensions</code> to <code>path</code>. <code> PathUtils.addExtension("/tmp/data/file", ".txt") = file.txt PathUtils.addExtension("/tmp/data/file.txt.gpg", ".zip") = file.txt.gpg.zip PathUtils.addExtension("/tmp/data/file.txt", ".tar", ".gz") = file.txt.tar.gz PathUtils.addExtension("/tmp/data/file.txt.gpg", ".tar.txt") = file.txt.gpg.tar.txt </code>
addExtension
{ "repo_name": "jinhyukchang/gobblin", "path": "gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java", "license": "apache-2.0", "size": 7344 }
[ "com.google.common.base.Strings", "org.apache.hadoop.fs.Path" ]
import com.google.common.base.Strings; import org.apache.hadoop.fs.Path;
import com.google.common.base.*; import org.apache.hadoop.fs.*;
[ "com.google.common", "org.apache.hadoop" ]
com.google.common; org.apache.hadoop;
1,758,906
void sanitizeOverrideConfiguration(Configuration globalConfig) { // If it's fullscreen, the override config should be empty and we should leave it alone. if (mFullscreen) { return; } // screenLayout field is set in #calculateOverrideConfig but only part of it is really // overridden - aspect ratio and size. Other flags (like layout direction) can be updated // separately in global config and they also must be updated in override config. int overrideScreenLayout = mOverrideConfig.screenLayout; int newScreenLayout = globalConfig.screenLayout; newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_LONG_MASK) | (overrideScreenLayout & SCREENLAYOUT_LONG_MASK); newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_SIZE_MASK) | (overrideScreenLayout & SCREENLAYOUT_SIZE_MASK); mOverrideConfig.screenLayout = newScreenLayout; // we never override the fontScale, however we need to copy over the global value // so that the default 1.0 doesn't get applied as an override. mOverrideConfig.fontScale = globalConfig.fontScale; }
void sanitizeOverrideConfiguration(Configuration globalConfig) { if (mFullscreen) { return; } int overrideScreenLayout = mOverrideConfig.screenLayout; int newScreenLayout = globalConfig.screenLayout; newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_LONG_MASK) (overrideScreenLayout & SCREENLAYOUT_LONG_MASK); newScreenLayout = (newScreenLayout & ~SCREENLAYOUT_SIZE_MASK) (overrideScreenLayout & SCREENLAYOUT_SIZE_MASK); mOverrideConfig.screenLayout = newScreenLayout; mOverrideConfig.fontScale = globalConfig.fontScale; }
/** * Update fields that are not overridden for task from global configuration. * * @param globalConfig global configuration to update from. */
Update fields that are not overridden for task from global configuration
sanitizeOverrideConfiguration
{ "repo_name": "daiqiquan/framework-base", "path": "services/core/java/com/android/server/am/TaskRecord.java", "license": "apache-2.0", "size": 82289 }
[ "android.content.res.Configuration" ]
import android.content.res.Configuration;
import android.content.res.*;
[ "android.content" ]
android.content;
1,870,560
private int dateGap(Date day1, Date day2){ Calendar date1=Calendar.getInstance(); date1.setTime(day1); date1.set(Calendar.HOUR, 0); date1.set(Calendar.MINUTE,0); date1.set(Calendar.SECOND,0); Calendar date2=Calendar.getInstance(); date2.setTime(day2); date2.set(Calendar.HOUR, 0); date2.set(Calendar.MINUTE,0); date2.set(Calendar.SECOND,10); int dayGap=(int)(day2.getTime()-day1.getTime())/(24*60*60*1000); return dayGap; }
int function(Date day1, Date day2){ Calendar date1=Calendar.getInstance(); date1.setTime(day1); date1.set(Calendar.HOUR, 0); date1.set(Calendar.MINUTE,0); date1.set(Calendar.SECOND,0); Calendar date2=Calendar.getInstance(); date2.setTime(day2); date2.set(Calendar.HOUR, 0); date2.set(Calendar.MINUTE,0); date2.set(Calendar.SECOND,10); int dayGap=(int)(day2.getTime()-day1.getTime())/(24*60*60*1000); return dayGap; }
/** * calculate the date gap between day1 and day 2 * @param day1 * @param day2 * @return day2-day1 */
calculate the date gap between day1 and day 2
dateGap
{ "repo_name": "BUPTSEgroup13/Car-Park-Control-System-group13", "path": "src/Entity/Staff.java", "license": "mit", "size": 3229 }
[ "java.util.Calendar", "java.util.Date" ]
import java.util.Calendar; import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,807,880
JpaTemplate template = exchange.getIn().getHeader("CamelJpaTemplate", JpaTemplate.class); String user = doc.getUser(); CustomerEntity customer = findCustomerByName(template, user); // let's convert information from the document into the entity bean customer.setUserName(user); customer.setFirstName(doc.getFirstName()); customer.setSurname(doc.getLastName()); customer.setCity(doc.getCity()); LOG.debug("Created object customer: " + customer); return customer; }
JpaTemplate template = exchange.getIn().getHeader(STR, JpaTemplate.class); String user = doc.getUser(); CustomerEntity customer = findCustomerByName(template, user); customer.setUserName(user); customer.setFirstName(doc.getFirstName()); customer.setSurname(doc.getLastName()); customer.setCity(doc.getCity()); LOG.debug(STR + customer); return customer; }
/** * A transformation method to convert a person document into a customer * entity * @throws Exception */
A transformation method to convert a person document into a customer entity
toCustomer
{ "repo_name": "aaronwalker/camel", "path": "examples/camel-example-etl/src/main/java/org/apache/camel/example/etl/CustomerTransformer.java", "license": "apache-2.0", "size": 2756 }
[ "org.springframework.orm.jpa.JpaTemplate" ]
import org.springframework.orm.jpa.JpaTemplate;
import org.springframework.orm.jpa.*;
[ "org.springframework.orm" ]
org.springframework.orm;
2,164,132
public IpAddress ipAddress() { return this.ipAddress; }
IpAddress function() { return this.ipAddress; }
/** * Get the IP address type of the container group. * * @return the ipAddress value */
Get the IP address type of the container group
ipAddress
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/containerinstance/mgmt-v2019_12_01/src/main/java/com/microsoft/azure/management/containerinstance/v2019_12_01/implementation/ContainerGroupInner.java", "license": "mit", "size": 13356 }
[ "com.microsoft.azure.management.containerinstance.v2019_12_01.IpAddress" ]
import com.microsoft.azure.management.containerinstance.v2019_12_01.IpAddress;
import com.microsoft.azure.management.containerinstance.v2019_12_01.*;
[ "com.microsoft.azure" ]
com.microsoft.azure;
402,495
public static String getValueAsString(Value pvalue) { if (pvalue == null) return null; if (pvalue.getContent() == null) return null; String result = ""; String encoding = pvalue.getEncoding(); if (encoding.equals(EventConstants.XML_ENCODING_TEXT)) { result = pvalue.getContent(); } else if (encoding.equals(EventConstants.XML_ENCODING_BASE64)) { byte[] bytes = Base64.decodeBase64(pvalue.getContent().toCharArray()); result = "0x"+toHexString(bytes); } else if (encoding.equals(EventConstants.XML_ENCODING_MAC_ADDRESS)) { result = pvalue.getContent(); } else { throw new IllegalStateException("Unknown encoding for parm value: " + encoding); } return result.trim(); }
static String function(Value pvalue) { if (pvalue == null) return null; if (pvalue.getContent() == null) return null; String result = STR0xSTRUnknown encoding for parm value: " + encoding); } return result.trim(); }
/** * Converts the value of a parm ('Value') of the instance to a string * * @param pvalue a {@link org.opennms.netmgt.xml.event.Value} object. * @return a {@link java.lang.String} object. */
Converts the value of a parm ('Value') of the instance to a string
getValueAsString
{ "repo_name": "opennms-forge/poc-nms-core", "path": "opennms-model/src/main/java/org/opennms/netmgt/EventConstants.java", "license": "gpl-2.0", "size": 54813 }
[ "org.opennms.netmgt.xml.event.Value" ]
import org.opennms.netmgt.xml.event.Value;
import org.opennms.netmgt.xml.event.*;
[ "org.opennms.netmgt" ]
org.opennms.netmgt;
261,727
@Override public void generateResources() { addResource("Silicate Ore", 30 + Die.d20(2)); if (Die.d6() == 1) { addResource("Silicate Crystals", 5 + Die.d6(2)); } addResource("Ferric Ore", 35 + Die.d20(3)); addResource("Heavy Metals", 25 + Die.d20(2)); addResource("Radioactives", 15 + Die.d12(3)); addResource("Rare Metals", 5 + Die.d6(3)); }
void function() { addResource(STR, 30 + Die.d20(2)); if (Die.d6() == 1) { addResource(STR, 5 + Die.d6(2)); } addResource(STR, 35 + Die.d20(3)); addResource(STR, 25 + Die.d20(2)); addResource(STR, 15 + Die.d12(3)); addResource(STR, 5 + Die.d6(3)); }
/** * Resources consist mostly of Silicate and Ferric ores, with other metals * and radioactives. */
Resources consist mostly of Silicate and Ferric ores, with other metals and radioactives
generateResources
{ "repo_name": "samuelpenn/mapcraft", "path": "worldgen/src/main/java/uk/org/glendale/worldgen/astro/planet/builders/barren/Ferrinian.java", "license": "gpl-2.0", "size": 2504 }
[ "uk.org.glendale.rpg.utils.Die" ]
import uk.org.glendale.rpg.utils.Die;
import uk.org.glendale.rpg.utils.*;
[ "uk.org.glendale" ]
uk.org.glendale;
87,611
@Override public void setCreateDate(java.util.Date createDate) { _appRole2Employee.setCreateDate(createDate); }
void function(java.util.Date createDate) { _appRole2Employee.setCreateDate(createDate); }
/** * Sets the create date of this app role2 employee. * * @param createDate the create date of this app role2 employee */
Sets the create date of this app role2 employee
setCreateDate
{ "repo_name": "openegovplatform/OEPv2", "path": "oep-ssomgt-portlet/docroot/WEB-INF/service/org/oep/ssomgt/model/AppRole2EmployeeWrapper.java", "license": "apache-2.0", "size": 10443 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,503,348
// Get the Client IClient client = ClientHolder.getClient(); // Create the dialog and get the files FileDialog fileDialog = new FileDialog(workbenchWindow.getShell(), SWT.MULTI); fileDialog.setText("Select a file to import into ICE"); fileDialog.open(); // Import the files String filterPath = fileDialog.getFilterPath(); for (String name : fileDialog.getFileNames()) { File importedFile = new File(filterPath, name); client.importFile(importedFile.toURI()); } return; }
IClient client = ClientHolder.getClient(); FileDialog fileDialog = new FileDialog(workbenchWindow.getShell(), SWT.MULTI); fileDialog.setText(STR); fileDialog.open(); String filterPath = fileDialog.getFilterPath(); for (String name : fileDialog.getFileNames()) { File importedFile = new File(filterPath, name); client.importFile(importedFile.toURI()); } return; }
/** * This operation runs the action. */
This operation runs the action
run
{ "repo_name": "gorindn/ice", "path": "src/org.eclipse.ice.client/src/org/eclipse/ice/client/common/ImportFileAction.java", "license": "epl-1.0", "size": 3354 }
[ "java.io.File", "org.eclipse.ice.client.common.internal.ClientHolder", "org.eclipse.ice.iclient.IClient", "org.eclipse.swt.widgets.FileDialog" ]
import java.io.File; import org.eclipse.ice.client.common.internal.ClientHolder; import org.eclipse.ice.iclient.IClient; import org.eclipse.swt.widgets.FileDialog;
import java.io.*; import org.eclipse.ice.client.common.internal.*; import org.eclipse.ice.iclient.*; import org.eclipse.swt.widgets.*;
[ "java.io", "org.eclipse.ice", "org.eclipse.swt" ]
java.io; org.eclipse.ice; org.eclipse.swt;
2,155,946
public void onCrateItemsModified( ItemStack stack );
void function( ItemStack stack );
/** * Called when any items in the crate storage get * changed. The stack will represent which items were * added or removed. Stack size is negative if items * were removed. */
Called when any items in the crate storage get changed. The stack will represent which items were added or removed. Stack size is negative if items were removed
onCrateItemsModified
{ "repo_name": "TehStoneMan/BetterStorageToo", "path": "old_src/main/java/net/mcft/copy/betterstorage/api/crate/ICrateWatcher.java", "license": "mit", "size": 363 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
2,758,348
@Test public void testNonHyloggerFilter() throws Exception { final String serviceUrl = "http://fake.com/wfs"; final String nameFilter = "filterBob"; final String custodianFilter = "filterCustodian"; final String filterDateStart = "1986-10-09"; final String filterDateEnd = "1986-10-10"; final int maxFeatures = 10; final FilterBoundingBox bbox = new FilterBoundingBox("EPSG:4326", new double[] {1, 2}, new double[] {3, 4}); final String nvclWfsResponse = "wfsResponse"; final String outputFormat = "text/csv"; final boolean onlyHylogger = false; final HttpRequestBase mockHttpMethodBase = context.mock(HttpRequestBase.class); final URI httpMethodURI = new URI("http://example.com"); context.checking(new Expectations() { { oneOf(mockBoreholeService).getAllBoreholes(serviceUrl, nameFilter, custodianFilter, filterDateStart, filterDateEnd, maxFeatures, bbox, null, outputFormat,""); will(returnValue(new WFSResponse(nvclWfsResponse, mockHttpMethodBase))); allowing(mockHttpMethodBase).getURI(); will(returnValue(httpMethodURI)); } }); ModelAndView response = this.nvclController.doBoreholeFilter(serviceUrl, nameFilter, custodianFilter, filterDateStart, filterDateEnd, maxFeatures, bbox, onlyHylogger, outputFormat, false,""); Assert.assertTrue((Boolean) response.getModel().get("success")); Map data = (Map) response.getModel().get("data"); Assert.assertNotNull(data); Assert.assertEquals(nvclWfsResponse, data.get("gml")); }
void function() throws Exception { final String serviceUrl = STRfilterBobSTRfilterCustodianSTR1986-10-09STR1986-10-10STREPSG:4326STRwfsResponseSTRtext/csvSTRhttp: context.checking(new Expectations() { { oneOf(mockBoreholeService).getAllBoreholes(serviceUrl, nameFilter, custodianFilter, filterDateStart, filterDateEnd, maxFeatures, bbox, null, outputFormat,STRSTRsuccessSTRdataSTRgml")); }
/** * Tests to ensure that a non hylogger request calls the correct functions. * * @throws Exception * the exception */
Tests to ensure that a non hylogger request calls the correct functions
testNonHyloggerFilter
{ "repo_name": "victortey/AuScope-Portal", "path": "src/test/java/org/auscope/portal/server/web/controllers/TestNVCLController.java", "license": "lgpl-3.0", "size": 35181 }
[ "org.jmock.Expectations" ]
import org.jmock.Expectations;
import org.jmock.*;
[ "org.jmock" ]
org.jmock;
1,767,336
protected ObjectMap create (Kryo kryo, Input input, Class<ObjectMap> type) { return kryo.newInstance(type); }
ObjectMap function (Kryo kryo, Input input, Class<ObjectMap> type) { return kryo.newInstance(type); }
/** * Used by {@link #read(Kryo, Input, Class)} to create the new object. This can be overridden to customize object creation, eg * to call a constructor with arguments. The default implementation uses {@link Kryo#newInstance(Class)}. */
Used by <code>#read(Kryo, Input, Class)</code> to create the new object. This can be overridden to customize object creation, eg to call a constructor with arguments. The default implementation uses <code>Kryo#newInstance(Class)</code>
create
{ "repo_name": "billy1380/VisEditor", "path": "Editor/src/com/kotcrab/vis/editor/serializer/ObjectMapSerializer.java", "license": "apache-2.0", "size": 6387 }
[ "com.badlogic.gdx.utils.ObjectMap", "com.esotericsoftware.kryo.Kryo", "com.esotericsoftware.kryo.io.Input" ]
import com.badlogic.gdx.utils.ObjectMap; import com.esotericsoftware.kryo.Kryo; import com.esotericsoftware.kryo.io.Input;
import com.badlogic.gdx.utils.*; import com.esotericsoftware.kryo.*; import com.esotericsoftware.kryo.io.*;
[ "com.badlogic.gdx", "com.esotericsoftware.kryo" ]
com.badlogic.gdx; com.esotericsoftware.kryo;
2,104,673
public void refreshBanner() { // Panel. final ContentPanel panel = view.getPanelProjectBanner(); // Set the heading of panel String projectTitle = currentProjectDTO.getFullName(); String titleToDisplay = ""; if (projectTitle != null && !projectTitle.isEmpty()) titleToDisplay = projectTitle.length() > 110 ? projectTitle.substring(0, 110) + "..." : projectTitle; panel.setHeading(I18N.CONSTANTS.projectMainTabTitle() + ' ' + currentProjectDTO.getName() + " (" + titleToDisplay + ")"); // Set the tool tip ToolTipConfig panelToolTipconfig = new ToolTipConfig(); panelToolTipconfig.setMaxWidth(500); panelToolTipconfig.setText(projectTitle); panel.setToolTip(panelToolTipconfig); panel.removeAll(); final Grid gridPanel = new Grid(1, 2); gridPanel.addStyleName("banner"); gridPanel.setCellPadding(0); gridPanel.setCellSpacing(0); gridPanel.setWidth("100%"); gridPanel.setHeight("100%"); // Logo. final Image logo = FundingIconProvider.getProjectTypeIcon( currentProjectDTO.getProjectModelDTO().getVisibility(authentication.getOrganizationId()), FundingIconProvider.IconSize.LARGE).createImage(); gridPanel.setWidget(0, 0, logo); gridPanel.getCellFormatter().addStyleName(0, 0, "banner-logo"); // Banner. final ProjectBannerDTO banner = currentProjectDTO.getProjectModelDTO().getProjectBannerDTO(); final LayoutDTO layout = banner.getLayoutDTO(); // Executes layout. if (banner != null && layout != null && layout.getLayoutGroupsDTO() != null && !layout.getLayoutGroupsDTO().isEmpty()) { // For visibility constraints, the banner accept a maximum of 2 rows // and 4 columns. final int rows = layout.getRowsCount() > 2 ? 2 : layout.getRowsCount(); final int cols = layout.getColumnsCount() > 4 ? 4 : layout.getColumnsCount(); final Grid gridLayout = new Grid(rows, cols); gridLayout.addStyleName("banner-flex"); gridLayout.setCellPadding(0); gridLayout.setCellSpacing(0); gridLayout.setWidth("100%"); gridLayout.setHeight("100%"); for (int i = 0; i < gridLayout.getColumnCount() - 1; i++) { gridLayout.getColumnFormatter().setWidth(i, "325px"); } for (final LayoutGroupDTO groupLayout : layout.getLayoutGroupsDTO()) { // Checks group bounds. if (groupLayout.getRow() + 1 > rows || groupLayout.getColumn() + 1 > cols) { continue; } final ContentPanel groupPanel = new ContentPanel(); groupPanel.setLayout(new FormLayout()); groupPanel.setTopComponent(null); groupPanel.setHeaderVisible(false); gridLayout.setWidget(groupLayout.getRow(), groupLayout.getColumn(), groupPanel); if (groupLayout.getLayoutConstraintsDTO() != null) { for (final LayoutConstraintDTO constraint : groupLayout.getLayoutConstraintsDTO()) { final FlexibleElementDTO element = constraint.getFlexibleElementDTO(); // Only default elements are allowed. if (!(element instanceof DefaultFlexibleElementDTO)) { continue; } // Builds the graphic component final DefaultFlexibleElementDTO defaultElement = (DefaultFlexibleElementDTO) element; defaultElement.setService(dispatcher); defaultElement.setAuthentication(authentication); defaultElement.setCache(cache); defaultElement.setCurrentContainerDTO(currentProjectDTO); Integer amendmentId = null; if (currentProjectDTO.getCurrentAmendment() != null) amendmentId = currentProjectDTO.getCurrentAmendment().getId(); // Remote call to ask for this element value. final GetValue command = new GetValue(currentProjectDTO.getId(), element.getId(), element.getEntityName(), amendmentId); dispatcher.execute(command, null, new AsyncCallback<ValueResult>() {
void function() { final ContentPanel panel = view.getPanelProjectBanner(); String projectTitle = currentProjectDTO.getFullName(); String titleToDisplay = STR...STR (STR)STRbannerSTR100%STR100%STRbanner-logoSTRbanner-flexSTR100%STR100%STR325px"); } for (final LayoutGroupDTO groupLayout : layout.getLayoutGroupsDTO()) { if (groupLayout.getRow() + 1 > rows groupLayout.getColumn() + 1 > cols) { continue; } final ContentPanel groupPanel = new ContentPanel(); groupPanel.setLayout(new FormLayout()); groupPanel.setTopComponent(null); groupPanel.setHeaderVisible(false); gridLayout.setWidget(groupLayout.getRow(), groupLayout.getColumn(), groupPanel); if (groupLayout.getLayoutConstraintsDTO() != null) { for (final LayoutConstraintDTO constraint : groupLayout.getLayoutConstraintsDTO()) { final FlexibleElementDTO element = constraint.getFlexibleElementDTO(); if (!(element instanceof DefaultFlexibleElementDTO)) { continue; } final DefaultFlexibleElementDTO defaultElement = (DefaultFlexibleElementDTO) element; defaultElement.setService(dispatcher); defaultElement.setAuthentication(authentication); defaultElement.setCache(cache); defaultElement.setCurrentContainerDTO(currentProjectDTO); Integer amendmentId = null; if (currentProjectDTO.getCurrentAmendment() != null) amendmentId = currentProjectDTO.getCurrentAmendment().getId(); final GetValue command = new GetValue(currentProjectDTO.getId(), element.getId(), element.getEntityName(), amendmentId); dispatcher.execute(command, null, new AsyncCallback<ValueResult>() {
/** * Refreshes the project banner for the current project. */
Refreshes the project banner for the current project
refreshBanner
{ "repo_name": "Polfo/sigma-h", "path": "sigmah/src/main/java/org/sigmah/client/page/project/ProjectPresenter.java", "license": "gpl-3.0", "size": 32924 }
[ "com.extjs.gxt.ui.client.widget.ContentPanel", "com.extjs.gxt.ui.client.widget.layout.FormLayout", "com.google.gwt.user.client.rpc.AsyncCallback", "org.sigmah.shared.command.GetValue", "org.sigmah.shared.command.result.ValueResult", "org.sigmah.shared.dto.element.DefaultFlexibleElementDTO", "org.sigmah.shared.dto.element.FlexibleElementDTO", "org.sigmah.shared.dto.layout.LayoutConstraintDTO", "org.sigmah.shared.dto.layout.LayoutGroupDTO" ]
import com.extjs.gxt.ui.client.widget.ContentPanel; import com.extjs.gxt.ui.client.widget.layout.FormLayout; import com.google.gwt.user.client.rpc.AsyncCallback; import org.sigmah.shared.command.GetValue; import org.sigmah.shared.command.result.ValueResult; import org.sigmah.shared.dto.element.DefaultFlexibleElementDTO; import org.sigmah.shared.dto.element.FlexibleElementDTO; import org.sigmah.shared.dto.layout.LayoutConstraintDTO; import org.sigmah.shared.dto.layout.LayoutGroupDTO;
import com.extjs.gxt.ui.client.widget.*; import com.extjs.gxt.ui.client.widget.layout.*; import com.google.gwt.user.client.rpc.*; import org.sigmah.shared.command.*; import org.sigmah.shared.command.result.*; import org.sigmah.shared.dto.element.*; import org.sigmah.shared.dto.layout.*;
[ "com.extjs.gxt", "com.google.gwt", "org.sigmah.shared" ]
com.extjs.gxt; com.google.gwt; org.sigmah.shared;
2,813,515
public CButton getRefreshButton() { return bRefresh; } // getRefreshButton
CButton function() { return bRefresh; }
/** * Get Refresh Button * * @return Button */
Get Refresh Button
getRefreshButton
{ "repo_name": "klst-com/metasfresh", "path": "de.metas.adempiere.adempiere/client/src/main/java-legacy/org/compiere/apps/ConfirmPanel.java", "license": "gpl-2.0", "size": 24441 }
[ "org.compiere.swing.CButton" ]
import org.compiere.swing.CButton;
import org.compiere.swing.*;
[ "org.compiere.swing" ]
org.compiere.swing;
1,727,990
boolean isComplexView(@NonNull View view);
boolean isComplexView(@NonNull View view);
/** * Check if view is a complex view. * * @param view some view * @return true if view is complex, false otherwise */
Check if view is a complex view
isComplexView
{ "repo_name": "Cleveroad/Bitutorial", "path": "library/src/main/java/com/cleveroad/splittransformation/ComplexViewDetector.java", "license": "mit", "size": 427 }
[ "android.support.annotation.NonNull", "android.view.View" ]
import android.support.annotation.NonNull; import android.view.View;
import android.support.annotation.*; import android.view.*;
[ "android.support", "android.view" ]
android.support; android.view;
1,013,371
public void groupEventsByDatabase(DatabaseEventConsumer consumer) { if ( isEmpty() ) return; if ( databaseNames.size() <= 1 ) { consumer.consume(databaseNames.iterator().next(), events); return; } List<Event> dbEvents = new ArrayList<>(); String currentDatabase = null; for (Event event : events) { String dbName = getDatabase(event); if (currentDatabase == null || dbName.equals(currentDatabase)) { currentDatabase = dbName; // Accumulate the statement ... dbEvents.add(event); } else { // Submit the statements ... consumer.consume(currentDatabase, dbEvents); } } }
void function(DatabaseEventConsumer consumer) { if ( isEmpty() ) return; if ( databaseNames.size() <= 1 ) { consumer.consume(databaseNames.iterator().next(), events); return; } List<Event> dbEvents = new ArrayList<>(); String currentDatabase = null; for (Event event : events) { String dbName = getDatabase(event); if (currentDatabase == null dbName.equals(currentDatabase)) { currentDatabase = dbName; dbEvents.add(event); } else { consumer.consume(currentDatabase, dbEvents); } } }
/** * Consume the events in the same order they were {@link #handle(io.debezium.relational.ddl.DdlParserListener.Event) recorded}, * but grouped by database name. Multiple sequential statements that were applied to the same database are grouped together. * @param consumer the consumer */
Consume the events in the same order they were <code>#handle(io.debezium.relational.ddl.DdlParserListener.Event) recorded</code>, but grouped by database name. Multiple sequential statements that were applied to the same database are grouped together
groupEventsByDatabase
{ "repo_name": "adsr/debezium", "path": "debezium-core/src/main/java/io/debezium/relational/ddl/DdlChanges.java", "license": "apache-2.0", "size": 5622 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
13,226
private boolean contains(HashMap<String, Object> map, Object o) { for (Object obj : map.values()) { if (obj == o) { return true; } } return false; }
boolean function(HashMap<String, Object> map, Object o) { for (Object obj : map.values()) { if (obj == o) { return true; } } return false; }
/** * Checks if hash map contains object * * @param map * map to check * @param o * object to check * @return returns true if map contains object o */
Checks if hash map contains object
contains
{ "repo_name": "Syncano/syncano-android-demo", "path": "Eclipse/SyncanoLib/src/com/syncano/android/lib/syncserver/DataChanges.java", "license": "mit", "size": 5991 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,829,232
public List<FeedItem> insertFeedItems(List<FeedItem> feedItems) throws RemoteException { return delegateLocator.getFeedItemDelegate().insert(feedItems); }
List<FeedItem> function(List<FeedItem> feedItems) throws RemoteException { return delegateLocator.getFeedItemDelegate().insert(feedItems); }
/** * Inserts the FeedItem into the ExtendedManagedCustomer's ManagedCustomer. * * @param feedItems the FeedItems to insert * @return the updated FeedItem * @throws RemoteException for communication-related exceptions */
Inserts the FeedItem into the ExtendedManagedCustomer's ManagedCustomer
insertFeedItems
{ "repo_name": "andyj24/googleads-java-lib", "path": "modules/adwords_axis_utility_extension/src/main/java/com/google/api/ads/adwords/axis/utility/extension/ExtendedManagedCustomer.java", "license": "apache-2.0", "size": 39892 }
[ "com.google.api.ads.adwords.axis.v201506.cm.FeedItem", "java.rmi.RemoteException", "java.util.List" ]
import com.google.api.ads.adwords.axis.v201506.cm.FeedItem; import java.rmi.RemoteException; import java.util.List;
import com.google.api.ads.adwords.axis.v201506.cm.*; import java.rmi.*; import java.util.*;
[ "com.google.api", "java.rmi", "java.util" ]
com.google.api; java.rmi; java.util;
2,758,799
void serialize(final FedoraResource obj, final OutputStream out, final boolean skipBinary, final boolean recurse) throws RepositoryException, IOException, InvalidSerializationFormatException;
void serialize(final FedoraResource obj, final OutputStream out, final boolean skipBinary, final boolean recurse) throws RepositoryException, IOException, InvalidSerializationFormatException;
/** * Serialize a FedoraObject into some format with options for recurse * and skipBinary, and write it to the given OutputStream * * @param obj the obj * @param out the out * @param skipBinary skip binary * @param recurse the recurse * @throws RepositoryException if repository exception occurred * @throws IOException if IO exception occurred * @throws org.fcrepo.serialization.InvalidSerializationFormatException if invalid serialization occurred */
Serialize a FedoraObject into some format with options for recurse and skipBinary, and write it to the given OutputStream
serialize
{ "repo_name": "nianma/fcrepo4", "path": "fcrepo-serialization/src/main/java/org/fcrepo/serialization/FedoraObjectSerializer.java", "license": "apache-2.0", "size": 3640 }
[ "java.io.IOException", "java.io.OutputStream", "javax.jcr.RepositoryException", "org.fcrepo.kernel.api.models.FedoraResource" ]
import java.io.IOException; import java.io.OutputStream; import javax.jcr.RepositoryException; import org.fcrepo.kernel.api.models.FedoraResource;
import java.io.*; import javax.jcr.*; import org.fcrepo.kernel.api.models.*;
[ "java.io", "javax.jcr", "org.fcrepo.kernel" ]
java.io; javax.jcr; org.fcrepo.kernel;
2,128,655
public Object getContent(Class[] classes) throws IOException { if (! connected) connect(); String type = getContentType(); ContentHandler ch = getContentHandler(type); if (ch != null) return ch.getContent(this, classes); throw new UnknownServiceException("protocol does not support the content type"); }
Object function(Class[] classes) throws IOException { if (! connected) connect(); String type = getContentType(); ContentHandler ch = getContentHandler(type); if (ch != null) return ch.getContent(this, classes); throw new UnknownServiceException(STR); }
/** * Retrieves the content of this URLConnection * * @param classes The allowed classes for the content * * @return the content * * @exception IOException If an error occurs * @exception UnknownServiceException If the protocol does not support the * content type */
Retrieves the content of this URLConnection
getContent
{ "repo_name": "ivmai/JCGO", "path": "goclsp/clsp_fix/java/net/URLConnection.java", "license": "gpl-2.0", "size": 36002 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
161,540
protected void addErrorReaction__erSecurityLinePropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_CtrlUnit86_ErrorReaction__erSecurityLine_feature"), getString("_UI_PropertyDescriptor_description", "_UI_CtrlUnit86_ErrorReaction__erSecurityLine_feature", "_UI_CtrlUnit86_type"), WTSpecPackage.eINSTANCE.getCtrlUnit86_ErrorReaction__erSecurityLine(), true, false, true, null, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), WTSpecPackage.eINSTANCE.getCtrlUnit86_ErrorReaction__erSecurityLine(), true, false, true, null, null, null)); }
/** * This adds a property descriptor for the Error Reaction er Security Line feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Error Reaction er Security Line feature.
addErrorReaction__erSecurityLinePropertyDescriptor
{ "repo_name": "FTSRG/mondo-collab-framework", "path": "archive/workspaceTracker/VA/ikerlanEMF.edit/src/eu/mondo/collaboration/operationtracemodel/example/WTSpec/provider/CtrlUnit86ItemProvider.java", "license": "epl-1.0", "size": 11618 }
[ "eu.mondo.collaboration.operationtracemodel.example.WTSpec", "org.eclipse.emf.edit.provider.ComposeableAdapterFactory" ]
import eu.mondo.collaboration.operationtracemodel.example.WTSpec; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import eu.mondo.collaboration.operationtracemodel.example.*; import org.eclipse.emf.edit.provider.*;
[ "eu.mondo.collaboration", "org.eclipse.emf" ]
eu.mondo.collaboration; org.eclipse.emf;
2,452,750
@Override public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addPlatformPropertyDescriptor(object); } return itemPropertyDescriptors; }
List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addPlatformPropertyDescriptor(object); } return itemPropertyDescriptors; }
/** * This returns the property descriptors for the adapted class. * @generated */
This returns the property descriptors for the adapted class
getPropertyDescriptors
{ "repo_name": "parraman/micobs", "path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevslib/provider/MParameterSLSPSwitchCaseItemProvider.java", "license": "epl-1.0", "size": 5681 }
[ "java.util.List", "org.eclipse.emf.edit.provider.IItemPropertyDescriptor" ]
import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import java.util.*; import org.eclipse.emf.edit.provider.*;
[ "java.util", "org.eclipse.emf" ]
java.util; org.eclipse.emf;
261,398
@Test public void testGetModel() { SpeechModel model = service.getModel(EN_BROADBAND16K).execute(); assertNotNull(model); assertNotNull(model.getName()); assertNotNull(model.getRate()); }
void function() { SpeechModel model = service.getModel(EN_BROADBAND16K).execute(); assertNotNull(model); assertNotNull(model.getName()); assertNotNull(model.getRate()); }
/** * Test get model. */
Test get model
testGetModel
{ "repo_name": "m2fd/java-sdk", "path": "src/test/java/com/ibm/watson/developer_cloud/speech_to_text/v1/SpeechToTextIT.java", "license": "apache-2.0", "size": 8724 }
[ "com.ibm.watson.developer_cloud.speech_to_text.v1.model.SpeechModel", "org.junit.Assert" ]
import com.ibm.watson.developer_cloud.speech_to_text.v1.model.SpeechModel; import org.junit.Assert;
import com.ibm.watson.developer_cloud.speech_to_text.v1.model.*; import org.junit.*;
[ "com.ibm.watson", "org.junit" ]
com.ibm.watson; org.junit;
439,871
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<PrivateLinkResourceInner> listByServer(String resourceGroupName, String serverName) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<PrivateLinkResourceInner> function(String resourceGroupName, String serverName) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); }
/** * Gets the private link resources for MySQL server. * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the private link resources for MySQL server. */
Gets the private link resources for MySQL server
listByServer
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/mysql/azure-resourcemanager-mysql/src/main/java/com/azure/resourcemanager/mysql/implementation/PrivateLinkResourcesClientImpl.java", "license": "mit", "size": 25446 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.mysql.fluent.models.PrivateLinkResourceInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.mysql.fluent.models.PrivateLinkResourceInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.mysql.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,259,256
@Test public void testGetOrCreatePortalCookieCreate() { IPortletCookieDao portletCookieDao = EasyMock.createMock(IPortletCookieDao.class); MockPortalCookie portalCookie = new MockPortalCookie(); portalCookie.setValue("ABCDEF"); EasyMock.expect(portletCookieDao.createPortalCookie(PortletCookieServiceImpl.DEFAULT_MAX_AGE)).andReturn(portalCookie); EasyMock.replay(portletCookieDao); PortletCookieServiceImpl cookieService = new PortletCookieServiceImpl(); cookieService.setPortletCookieDao(portletCookieDao); MockHttpServletRequest request = new MockHttpServletRequest(); cookieService.getOrCreatePortalCookie(request); EasyMock.verify(portletCookieDao); }
void function() { IPortletCookieDao portletCookieDao = EasyMock.createMock(IPortletCookieDao.class); MockPortalCookie portalCookie = new MockPortalCookie(); portalCookie.setValue(STR); EasyMock.expect(portletCookieDao.createPortalCookie(PortletCookieServiceImpl.DEFAULT_MAX_AGE)).andReturn(portalCookie); EasyMock.replay(portletCookieDao); PortletCookieServiceImpl cookieService = new PortletCookieServiceImpl(); cookieService.setPortletCookieDao(portletCookieDao); MockHttpServletRequest request = new MockHttpServletRequest(); cookieService.getOrCreatePortalCookie(request); EasyMock.verify(portletCookieDao); }
/** * Test {@link PortletCookieServiceImpl#getOrCreatePortalCookie(javax.servlet.http.HttpServletRequest)}. * that results in creating a new PortalCookie. */
Test <code>PortletCookieServiceImpl#getOrCreatePortalCookie(javax.servlet.http.HttpServletRequest)</code>. that results in creating a new PortalCookie
testGetOrCreatePortalCookieCreate
{ "repo_name": "GTCC/nc-ssp-platform-nc-ssp-platform", "path": "uportal-war/src/test/java/org/jasig/portal/portlet/container/services/PortletCookieServiceImplTest.java", "license": "apache-2.0", "size": 10814 }
[ "org.easymock.EasyMock", "org.jasig.portal.portlet.dao.IPortletCookieDao", "org.springframework.mock.web.MockHttpServletRequest" ]
import org.easymock.EasyMock; import org.jasig.portal.portlet.dao.IPortletCookieDao; import org.springframework.mock.web.MockHttpServletRequest;
import org.easymock.*; import org.jasig.portal.portlet.dao.*; import org.springframework.mock.web.*;
[ "org.easymock", "org.jasig.portal", "org.springframework.mock" ]
org.easymock; org.jasig.portal; org.springframework.mock;
2,141,923
public JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = this.keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
JSONArray function() { JSONArray ja = new JSONArray(); Iterator keys = this.keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
/** * Produce a JSONArray containing the names of the elements of this * JSONObject. * * @return A JSONArray containing the key strings, or null if the JSONObject * is empty. */
Produce a JSONArray containing the names of the elements of this JSONObject
names
{ "repo_name": "joewitt99/okta-auth-report", "path": "src/main/java/oktareport/JSONObject.java", "license": "apache-2.0", "size": 56718 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,549,401
protected void pushPacket(IOFSwitch sw, OFMatch match, OFPacketIn pi, short outport, FloodlightContext cntx) { if (pi == null) { return; } else if (pi.getInPort() == outport){ log.warn("Packet out not sent as the outport matches inport. {}", pi); return; } // The assumption here is (sw) is the switch that generated the // packet-in. If the input port is the same as output port, then // the packet-out should be ignored. if (pi.getInPort() == outport) { if (log.isDebugEnabled()) { log.debug("Attempting to do packet-out to the same " + "interface as packet-in. Dropping packet. " + " SrcSwitch={}, match = {}, pi={}", new Object[]{sw, match, pi}); return; } } if (log.isTraceEnabled()) { log.trace("PacketOut srcSwitch={} match={} pi={}", new Object[] {sw, match, pi}); } OFPacketOut po = (OFPacketOut) floodlightProvider.getOFMessageFactory() .getMessage(OFType.PACKET_OUT); // set actions List<OFAction> actions = new ArrayList<OFAction>(); actions.add(new OFActionOutput(outport, (short) 0xffff)); po.setActions(actions) .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH); short poLength = (short) (po.getActionsLength() + OFPacketOut.MINIMUM_LENGTH); // If the switch doens't support buffering set the buffer id to be none // otherwise it'll be the the buffer id of the PacketIn if (sw.getBuffers() == 0) { // We set the PI buffer id here so we don't have to check again below pi.setBufferId(OFPacketOut.BUFFER_ID_NONE); po.setBufferId(OFPacketOut.BUFFER_ID_NONE); } else { po.setBufferId(pi.getBufferId()); } po.setInPort(pi.getInPort()); // If the buffer id is none or the switch doesn's support buffering // we send the data with the packet out if (pi.getBufferId() == OFPacketOut.BUFFER_ID_NONE) { byte[] packetData = pi.getPacketData(); poLength += packetData.length; po.setPacketData(packetData); } po.setLength(poLength); try { counterStore.updatePktOutFMCounterStoreLocal(sw, po); messageDamper.write(sw, po, cntx); } catch (IOException e) { log.error("Failure writing packet out", e); } }
void function(IOFSwitch sw, OFMatch match, OFPacketIn pi, short outport, FloodlightContext cntx) { if (pi == null) { return; } else if (pi.getInPort() == outport){ log.warn(STR, pi); return; } if (pi.getInPort() == outport) { if (log.isDebugEnabled()) { log.debug(STR + STR + STR, new Object[]{sw, match, pi}); return; } } if (log.isTraceEnabled()) { log.trace(STR, new Object[] {sw, match, pi}); } OFPacketOut po = (OFPacketOut) floodlightProvider.getOFMessageFactory() .getMessage(OFType.PACKET_OUT); List<OFAction> actions = new ArrayList<OFAction>(); actions.add(new OFActionOutput(outport, (short) 0xffff)); po.setActions(actions) .setActionsLength((short) OFActionOutput.MINIMUM_LENGTH); short poLength = (short) (po.getActionsLength() + OFPacketOut.MINIMUM_LENGTH); if (sw.getBuffers() == 0) { pi.setBufferId(OFPacketOut.BUFFER_ID_NONE); po.setBufferId(OFPacketOut.BUFFER_ID_NONE); } else { po.setBufferId(pi.getBufferId()); } po.setInPort(pi.getInPort()); if (pi.getBufferId() == OFPacketOut.BUFFER_ID_NONE) { byte[] packetData = pi.getPacketData(); poLength += packetData.length; po.setPacketData(packetData); } po.setLength(poLength); try { counterStore.updatePktOutFMCounterStoreLocal(sw, po); messageDamper.write(sw, po, cntx); } catch (IOException e) { log.error(STR, e); } }
/** * Pushes a packet-out to a switch. The assumption here is that * the packet-in was also generated from the same switch. Thus, if the input * port of the packet-in and the outport are the same, the function will not * push the packet-out. * @param sw switch that generated the packet-in, and from which packet-out is sent * @param match OFmatch * @param pi packet-in * @param outport output port * @param cntx context of the packet */
Pushes a packet-out to a switch. The assumption here is that the packet-in was also generated from the same switch. Thus, if the input port of the packet-in and the outport are the same, the function will not push the packet-out
pushPacket
{ "repo_name": "hgupta2/floodlight2", "path": "src/main/java/net/floodlightcontroller/routing/ForwardingBase.java", "license": "apache-2.0", "size": 27881 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "net.floodlightcontroller.core.FloodlightContext", "net.floodlightcontroller.core.IOFSwitch", "org.openflow.protocol.OFMatch", "org.openflow.protocol.OFPacketIn", "org.openflow.protocol.OFPacketOut", "org.openflow.protocol.OFType", "org.openflow.protocol.action.OFAction", "org.openflow.protocol.action.OFActionOutput" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import net.floodlightcontroller.core.FloodlightContext; import net.floodlightcontroller.core.IOFSwitch; import org.openflow.protocol.OFMatch; import org.openflow.protocol.OFPacketIn; import org.openflow.protocol.OFPacketOut; import org.openflow.protocol.OFType; import org.openflow.protocol.action.OFAction; import org.openflow.protocol.action.OFActionOutput;
import java.io.*; import java.util.*; import net.floodlightcontroller.core.*; import org.openflow.protocol.*; import org.openflow.protocol.action.*;
[ "java.io", "java.util", "net.floodlightcontroller.core", "org.openflow.protocol" ]
java.io; java.util; net.floodlightcontroller.core; org.openflow.protocol;
659,659
public void setGraphicSupported(@NonNull Boolean graphicSupported) { setValue(KEY_GRAPHIC_SUPPORTED, graphicSupported); }
void function(@NonNull Boolean graphicSupported) { setValue(KEY_GRAPHIC_SUPPORTED, graphicSupported); }
/** * set the display's persistent screen supports. * @param graphicSupported true if the display supports graphics, false if it does not * @since SmartDeviceLink 2.0 */
set the display's persistent screen supports
setGraphicSupported
{ "repo_name": "anildahiya/sdl_android", "path": "base/src/main/java/com/smartdevicelink/proxy/rpc/DisplayCapabilities.java", "license": "bsd-3-clause", "size": 11484 }
[ "android.support.annotation.NonNull" ]
import android.support.annotation.NonNull;
import android.support.annotation.*;
[ "android.support" ]
android.support;
305,717