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 static void distributeData(DeploymentId deploymentId, File[] src,
String[] targetNodes, String[] dest, String[] args)
throws Exception {
// create a client object, which handles everything
Client<Serializable, Serializable> client = new Client<Serializable, Serializable>(
args);
client.init();
for (int i = 0; i < src.length; i++) {
DataSpreadDriver driver = new DataSpreadDriver(client.hcc,
deploymentId, client.control.imruConnection,
client.options.app, src[i], targetNodes, dest[i]);
JobStatus status = driver.run();
if (status == JobStatus.FAILURE) {
System.err.println("Job failed; see CC and NC logs");
System.exit(-1);
}
}
}
| static void function(DeploymentId deploymentId, File[] src, String[] targetNodes, String[] dest, String[] args) throws Exception { Client<Serializable, Serializable> client = new Client<Serializable, Serializable>( args); client.init(); for (int i = 0; i < src.length; i++) { DataSpreadDriver driver = new DataSpreadDriver(client.hcc, deploymentId, client.control.imruConnection, client.options.app, src[i], targetNodes, dest[i]); JobStatus status = driver.run(); if (status == JobStatus.FAILURE) { System.err.println(STR); System.exit(-1); } } } | /**
* Spread data into specified nodes in $log_2 N$ time.
*
* @throws Exception
*/ | Spread data into specified nodes in $log_2 N$ time | distributeData | {
"repo_name": "sigmod/asterixdb-analytics",
"path": "imru/imru-example/src/main/java/edu/uci/ics/hyracks/imru/example/utils/Client.java",
"license": "apache-2.0",
"size": 23375
} | [
"edu.uci.ics.hyracks.imru.data.DataSpreadDriver",
"java.io.File",
"java.io.Serializable",
"org.apache.hyracks.api.deployment.DeploymentId",
"org.apache.hyracks.api.job.JobStatus"
] | import edu.uci.ics.hyracks.imru.data.DataSpreadDriver; import java.io.File; import java.io.Serializable; import org.apache.hyracks.api.deployment.DeploymentId; import org.apache.hyracks.api.job.JobStatus; | import edu.uci.ics.hyracks.imru.data.*; import java.io.*; import org.apache.hyracks.api.deployment.*; import org.apache.hyracks.api.job.*; | [
"edu.uci.ics",
"java.io",
"org.apache.hyracks"
] | edu.uci.ics; java.io; org.apache.hyracks; | 2,576,033 |
@Test
public void testOnLinkUpdatePre() throws Exception {
createPowerSpy();
ConversionTable conversionTable = PowerMockito
.spy(new ConversionTable());
conversionTable.addEntryConnectionType("LowerNetworkId", "lower");
conversionTable.addEntryConnectionType("UpperNetworkId", "upper");
conversionTable.addEntryConnectionType("LayerizedNetworkId",
"layerized");
PowerMockito.doReturn(conversionTable).when(target, "conversionTable");
target.setUpperLinkisync(false); // upperLinkSync
Link prev = new Link("prev");
Link curr = new Link("curr");
ArrayList<String> attributes = new ArrayList<>();
boolean resultLower = target.onLinkUpdatePre("LowerNetworkId",
prev, curr, attributes);
boolean resultUpper = target.onLinkUpdatePre("UpperNetworkId",
prev, curr, attributes);
boolean resultLayerized = target.onLinkUpdatePre("LayerizedNetworkId",
prev, curr, attributes);
assertThat(resultLower, is(true));
assertThat(resultUpper, is(true));
assertThat(resultLayerized, is(false)); // upperLinkSync
} | void function() throws Exception { createPowerSpy(); ConversionTable conversionTable = PowerMockito .spy(new ConversionTable()); conversionTable.addEntryConnectionType(STR, "lower"); conversionTable.addEntryConnectionType(STR, "upper"); conversionTable.addEntryConnectionType(STR, STR); PowerMockito.doReturn(conversionTable).when(target, STR); target.setUpperLinkisync(false); Link prev = new Link("prev"); Link curr = new Link("curr"); ArrayList<String> attributes = new ArrayList<>(); boolean resultLower = target.onLinkUpdatePre(STR, prev, curr, attributes); boolean resultUpper = target.onLinkUpdatePre(STR, prev, curr, attributes); boolean resultLayerized = target.onLinkUpdatePre(STR, prev, curr, attributes); assertThat(resultLower, is(true)); assertThat(resultUpper, is(true)); assertThat(resultLayerized, is(false)); } | /**
* Test method for {@link org.o3project.odenos.component.linklayerizer.LinkLayerizer#onLinkUpdatePre(java.lang.String, org.o3project.odenos.core.component.network.topology.Link, org.o3project.odenos.core.component.network.topology.Link, java.util.ArrayList)}.
* @throws Exception
*/ | Test method for <code>org.o3project.odenos.component.linklayerizer.LinkLayerizer#onLinkUpdatePre(java.lang.String, org.o3project.odenos.core.component.network.topology.Link, org.o3project.odenos.core.component.network.topology.Link, java.util.ArrayList)</code> | testOnLinkUpdatePre | {
"repo_name": "narry/odenos",
"path": "src/test/java/org/o3project/odenos/component/linklayerizer/LinkLayerizerTest.java",
"license": "apache-2.0",
"size": 127722
} | [
"java.util.ArrayList",
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.mockito.Mockito",
"org.o3project.odenos.core.component.ConversionTable",
"org.o3project.odenos.core.component.network.topology.Link",
"org.powermock.api.mockito.PowerMockito"
] | import java.util.ArrayList; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.mockito.Mockito; import org.o3project.odenos.core.component.ConversionTable; import org.o3project.odenos.core.component.network.topology.Link; import org.powermock.api.mockito.PowerMockito; | import java.util.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*; import org.o3project.odenos.core.component.*; import org.o3project.odenos.core.component.network.topology.*; import org.powermock.api.mockito.*; | [
"java.util",
"org.hamcrest",
"org.junit",
"org.mockito",
"org.o3project.odenos",
"org.powermock.api"
] | java.util; org.hamcrest; org.junit; org.mockito; org.o3project.odenos; org.powermock.api; | 1,904,130 |
List findByNamedQuery(String queryName, Object value) throws DataAccessException; | List findByNamedQuery(String queryName, Object value) throws DataAccessException; | /**
* Execute a named query for persistent instances, binding
* one value to a "?" parameter in the query string.
* A named query is defined in a Hibernate mapping file.
* @param queryName the name of a Hibernate query in a mapping file
* @return a List containing 0 or more persistent instances
* @throws org.springframework.dao.DataAccessException in case of Hibernate errors
* @see net.sf.hibernate.Session#find(String, Object, net.sf.hibernate.type.Type)
* @see net.sf.hibernate.Session#getNamedQuery(String)
*/ | Execute a named query for persistent instances, binding one value to a "?" parameter in the query string. A named query is defined in a Hibernate mapping file | findByNamedQuery | {
"repo_name": "dachengxi/spring1.1.1_source",
"path": "src/org/springframework/orm/hibernate/HibernateOperations.java",
"license": "mit",
"size": 32030
} | [
"java.util.List",
"org.springframework.dao.DataAccessException"
] | import java.util.List; import org.springframework.dao.DataAccessException; | import java.util.*; import org.springframework.dao.*; | [
"java.util",
"org.springframework.dao"
] | java.util; org.springframework.dao; | 2,529,223 |
@SuppressWarnings("rawtypes")
public static Field findField(Class clazz, String name, Class type) {
Preconditions.checkArgument(clazz != null, "Class must not be null");
Preconditions.checkArgument(name != null || type != null, "Either name or type of the field must be specified");
Class searchType = clazz;
while (!Object.class.equals(searchType) && searchType != null) {
Field[] fields = searchType.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
if ((name == null || name.equals(field.getName()))
&& (type == null || type.equals(field.getType()))) {
return field;
}
}
searchType = searchType.getSuperclass();
}
return null;
} | @SuppressWarnings(STR) static Field function(Class clazz, String name, Class type) { Preconditions.checkArgument(clazz != null, STR); Preconditions.checkArgument(name != null type != null, STR); Class searchType = clazz; while (!Object.class.equals(searchType) && searchType != null) { Field[] fields = searchType.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { Field field = fields[i]; if ((name == null name.equals(field.getName())) && (type == null type.equals(field.getType()))) { return field; } } searchType = searchType.getSuperclass(); } return null; } | /**
* Attempt to find a {@link Field field} on the supplied {@link Class} with
* the supplied <code>name</code> and/or {@link Class type}. Searches all
* superclasses up to {@link Object}.
* @param clazz the class to introspect
* @param name the name of the field (may be <code>null</code> if type is specified)
* @param type the type of the field (may be <code>null</code> if name is specified)
* @return the corresponding Field object, or <code>null</code> if not found
*/ | Attempt to find a <code>Field field</code> on the supplied <code>Class</code> with the supplied <code>name</code> and/or <code>Class type</code>. Searches all superclasses up to <code>Object</code> | findField | {
"repo_name": "qiuhd2015/Hpgsc-RPC",
"path": "hpgsc-rpc/src/main/java/org/hdl/hggsc/rpc/utils/ReflectionUtils.java",
"license": "mit",
"size": 22350
} | [
"java.lang.reflect.Field",
"org.hdl.hpgsc.common.utils.Preconditions"
] | import java.lang.reflect.Field; import org.hdl.hpgsc.common.utils.Preconditions; | import java.lang.reflect.*; import org.hdl.hpgsc.common.utils.*; | [
"java.lang",
"org.hdl.hpgsc"
] | java.lang; org.hdl.hpgsc; | 106,983 |
private void processJavadoc(DetailAST ast) {
final FileContents contents = getFileContents();
final int lineNo = ast.getLineNo();
final TextBlock cmt = contents.getJavadocBefore(lineNo);
if (cmt != null) {
referenced.addAll(processJavadoc(cmt));
}
} | void function(DetailAST ast) { final FileContents contents = getFileContents(); final int lineNo = ast.getLineNo(); final TextBlock cmt = contents.getJavadocBefore(lineNo); if (cmt != null) { referenced.addAll(processJavadoc(cmt)); } } | /**
* Collects references made in Javadoc comments.
* @param ast node to inspect for Javadoc
*/ | Collects references made in Javadoc comments | processJavadoc | {
"repo_name": "naver/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/UnusedImportsCheck.java",
"license": "lgpl-2.1",
"size": 9914
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.FileContents",
"com.puppycrawl.tools.checkstyle.api.TextBlock"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.TextBlock; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 335,199 |
static public int month() {
// months are number 0..11 so change to colloquial 1..12
return Calendar.getInstance().get(Calendar.MONTH) + 1;
} | static int function() { return Calendar.getInstance().get(Calendar.MONTH) + 1; } | /**
* ( begin auto-generated from month.xml ) Processing communicates with the clock on your
* computer. The <b>month()</b> function returns the current month as a value from 1 - 12. ( end
* auto-generated )
*
* @webref input:time_date
* @see PApplet#millis()
* @see PApplet#second()
* @see PApplet#minute()
* @see PApplet#hour()
* @see PApplet#day()
* @see PApplet#year()
*/ | ( begin auto-generated from month.xml ) Processing communicates with the clock on your computer. The month() function returns the current month as a value from 1 - 12. ( end auto-generated ) | month | {
"repo_name": "aarongolliver/FractalFlameV3",
"path": "src/processing/core/PApplet.java",
"license": "lgpl-2.1",
"size": 507010
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 48,797 |
public static boolean delete(File file) {
if (file.isDirectory()) {
File[] contents = file.listFiles();
if (null != contents) {
for (File child : contents) {
delete(child);
}
}
file.delete();
return true;
} else {
return file.delete();
}
} | static boolean function(File file) { if (file.isDirectory()) { File[] contents = file.listFiles(); if (null != contents) { for (File child : contents) { delete(child); } } file.delete(); return true; } else { return file.delete(); } } | /**
* Deletes recursively the given file (if it is a directory)
* or just removes itself
*
* @param file The file or dir to remove
*
* @return True if the deletion was successful
*/ | Deletes recursively the given file (if it is a directory) or just removes itself | delete | {
"repo_name": "p2p-sync/commons",
"path": "src/test/java/org/rmatil/sync/commons/test/util/FileUtil.java",
"license": "apache-2.0",
"size": 2789
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 49,044 |
void setMoreTabsOnClickListener(@Nullable View.OnClickListener listener) {
findViewById(R.id.more_tabs).setOnClickListener(listener);
} | void setMoreTabsOnClickListener(@Nullable View.OnClickListener listener) { findViewById(R.id.more_tabs).setOnClickListener(listener); } | /**
* Set the {@link android.view.View.OnClickListener} for More Tabs.
*/ | Set the <code>android.view.View.OnClickListener</code> for More Tabs | setMoreTabsOnClickListener | {
"repo_name": "endlessm/chromium-browser",
"path": "chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/TasksView.java",
"license": "bsd-3-clause",
"size": 14305
} | [
"android.view.View",
"androidx.annotation.Nullable"
] | import android.view.View; import androidx.annotation.Nullable; | import android.view.*; import androidx.annotation.*; | [
"android.view",
"androidx.annotation"
] | android.view; androidx.annotation; | 664,599 |
private boolean findMyBbRole(String url, String domain, BlackboardArtifact artifact, RoleProcessor roleProcessor) {
String platformName = "myBB platform"; // NON-NLS
if (url.contains("/admin/index.php")) {
roleProcessor.addRole(domain, platformName, Role.ADMIN, url, artifact);
return true;
} else if (url.contains("/modcp.php")) {
roleProcessor.addRole(domain, platformName, Role.MOD, url, artifact);
return true;
} else if (url.contains("/usercp.php")) {
roleProcessor.addRole(domain, platformName, Role.USER, url, artifact);
return true;
} else {
return false;
}
} | boolean function(String url, String domain, BlackboardArtifact artifact, RoleProcessor roleProcessor) { String platformName = STR; if (url.contains(STR)) { roleProcessor.addRole(domain, platformName, Role.ADMIN, url, artifact); return true; } else if (url.contains(STR)) { roleProcessor.addRole(domain, platformName, Role.MOD, url, artifact); return true; } else if (url.contains(STR)) { roleProcessor.addRole(domain, platformName, Role.USER, url, artifact); return true; } else { return false; } } | /**
* Extract myBB role.
*
* @param url The full URL.
* @param domain The domain.
* @param artifact The original artifact.
* @param roleProcessor Object to collect and process domain roles.
* @return True if a myBB role is found.
*/ | Extract myBB role | findMyBbRole | {
"repo_name": "eugene7646/autopsy",
"path": "RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractWebAccountType.java",
"license": "apache-2.0",
"size": 14989
} | [
"org.sleuthkit.datamodel.BlackboardArtifact"
] | import org.sleuthkit.datamodel.BlackboardArtifact; | import org.sleuthkit.datamodel.*; | [
"org.sleuthkit.datamodel"
] | org.sleuthkit.datamodel; | 1,074,970 |
protected static long[] getIds(SRConnection c, long acct)
throws SQLException {
MySQLConnection cc = c.getConnection();
String sql = "SELECT id FROM Department WHERE accountId = ? "
+ "ORDER BY id";
DataTable dt = cc.executeQuery(sql, acct);
long[] arr = new long[dt.getRowCount()];
for(int i = 0; i < arr.length; i++)
arr[i] = dt.getLong(i, "id");
return arr;
} | static long[] function(SRConnection c, long acct) throws SQLException { MySQLConnection cc = c.getConnection(); String sql = STR + STR; DataTable dt = cc.executeQuery(sql, acct); long[] arr = new long[dt.getRowCount()]; for(int i = 0; i < arr.length; i++) arr[i] = dt.getLong(i, "id"); return arr; } | /**
* Returns an array of all Department ID's associated with the specified
* account.
*
* @param c the connection
* @param acct the account ID
* @return an array of ID's, or an empty array if no matches were found
* @throws SQLException if a database access error occurs
*/ | Returns an array of all Department ID's associated with the specified account | getIds | {
"repo_name": "mordigaldj/SmartRegister",
"path": "src/main/java/com/djm/smartreg/data/DBDepartment.java",
"license": "mit",
"size": 7033
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,911,611 |
public FeatureCursor queryFeaturesForChunk(String[] columns,
BoundingBox boundingBox, String where, String orderBy, int limit) {
return queryFeaturesForChunk(false, columns, boundingBox, where,
orderBy, limit);
} | FeatureCursor function(String[] columns, BoundingBox boundingBox, String where, String orderBy, int limit) { return queryFeaturesForChunk(false, columns, boundingBox, where, orderBy, limit); } | /**
* Query for features within the bounding box, starting at the offset and
* returning no more than the limit
*
* @param columns columns
* @param boundingBox bounding box
* @param where where clause
* @param orderBy order by
* @param limit chunk limit
* @return feature cursor
* @since 6.2.0
*/ | Query for features within the bounding box, starting at the offset and returning no more than the limit | queryFeaturesForChunk | {
"repo_name": "ngageoint/geopackage-android",
"path": "geopackage-sdk/src/main/java/mil/nga/geopackage/extension/nga/index/FeatureTableIndex.java",
"license": "mit",
"size": 276322
} | [
"mil.nga.geopackage.BoundingBox",
"mil.nga.geopackage.features.user.FeatureCursor"
] | import mil.nga.geopackage.BoundingBox; import mil.nga.geopackage.features.user.FeatureCursor; | import mil.nga.geopackage.*; import mil.nga.geopackage.features.user.*; | [
"mil.nga.geopackage"
] | mil.nga.geopackage; | 347,238 |
public static Literal of(Source source, Object value) {
if (value instanceof Literal) {
return (Literal) value;
}
return new Literal(source, value, DataTypes.fromJava(value));
} | static Literal function(Source source, Object value) { if (value instanceof Literal) { return (Literal) value; } return new Literal(source, value, DataTypes.fromJava(value)); } | /**
* Utility method for creating 'in-line' Literals (out of values instead of expressions).
*/ | Utility method for creating 'in-line' Literals (out of values instead of expressions) | of | {
"repo_name": "ern/elasticsearch",
"path": "x-pack/plugin/ql/test-fixtures/src/main/java/org/elasticsearch/xpack/ql/TestUtils.java",
"license": "apache-2.0",
"size": 18791
} | [
"org.elasticsearch.xpack.ql.expression.Literal",
"org.elasticsearch.xpack.ql.tree.Source",
"org.elasticsearch.xpack.ql.type.DataTypes"
] | import org.elasticsearch.xpack.ql.expression.Literal; import org.elasticsearch.xpack.ql.tree.Source; import org.elasticsearch.xpack.ql.type.DataTypes; | import org.elasticsearch.xpack.ql.expression.*; import org.elasticsearch.xpack.ql.tree.*; import org.elasticsearch.xpack.ql.type.*; | [
"org.elasticsearch.xpack"
] | org.elasticsearch.xpack; | 1,399,347 |
public static SQLExceptionTranslator newJdbcExceptionTranslator(SessionFactory sessionFactory) {
DataSource ds = getDataSource(sessionFactory);
if (ds != null) {
return new SQLErrorCodeSQLExceptionTranslator(ds);
}
return new SQLStateSQLExceptionTranslator();
} | static SQLExceptionTranslator function(SessionFactory sessionFactory) { DataSource ds = getDataSource(sessionFactory); if (ds != null) { return new SQLErrorCodeSQLExceptionTranslator(ds); } return new SQLStateSQLExceptionTranslator(); } | /**
* Create an appropriate SQLExceptionTranslator for the given SessionFactory.
* If a DataSource is found, a SQLErrorCodeSQLExceptionTranslator for the DataSource
* is created; else, a SQLStateSQLExceptionTranslator as fallback.
* @param sessionFactory the SessionFactory to create the translator for
* @return the SQLExceptionTranslator
* @see #getDataSource
* @see org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator
* @see org.springframework.jdbc.support.SQLStateSQLExceptionTranslator
*/ | Create an appropriate SQLExceptionTranslator for the given SessionFactory. If a DataSource is found, a SQLErrorCodeSQLExceptionTranslator for the DataSource is created; else, a SQLStateSQLExceptionTranslator as fallback | newJdbcExceptionTranslator | {
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/spring/org/springframework/orm/hibernate3/SessionFactoryUtils.java",
"license": "gpl-2.0",
"size": 37203
} | [
"javax.sql.DataSource",
"org.hibernate.SessionFactory",
"org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator",
"org.springframework.jdbc.support.SQLExceptionTranslator",
"org.springframework.jdbc.support.SQLStateSQLExceptionTranslator"
] | import javax.sql.DataSource; import org.hibernate.SessionFactory; import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator; import org.springframework.jdbc.support.SQLExceptionTranslator; import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator; | import javax.sql.*; import org.hibernate.*; import org.springframework.jdbc.support.*; | [
"javax.sql",
"org.hibernate",
"org.springframework.jdbc"
] | javax.sql; org.hibernate; org.springframework.jdbc; | 2,277,996 |
public static void wait(final Object obj, final Duration duration) throws InterruptedException {
DurationUtils.accept(obj::wait, DurationUtils.zeroIfNull(duration));
}
public ObjectUtils() {
} | static void function(final Object obj, final Duration duration) throws InterruptedException { DurationUtils.accept(obj::wait, DurationUtils.zeroIfNull(duration)); } public ObjectUtils() { } | /**
* Calls {@link Object#wait(long, int)} for the given Duration.
*
* @param obj The receiver of the wait call.
* @param duration How long to wait.
* @throws IllegalArgumentException if the timeout duration is negative.
* @throws IllegalMonitorStateException if the current thread is not the owner of the {@code obj}'s monitor.
* @throws InterruptedException if any thread interrupted the current thread before or while the current thread was
* waiting for a notification. The <em>interrupted status</em> of the current thread is cleared when this
* exception is thrown.
* @see Object#wait(long, int)
* @since 3.12.0
*/ | Calls <code>Object#wait(long, int)</code> for the given Duration | wait | {
"repo_name": "apache/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/ObjectUtils.java",
"license": "apache-2.0",
"size": 53062
} | [
"java.time.Duration",
"org.apache.commons.lang3.time.DurationUtils"
] | import java.time.Duration; import org.apache.commons.lang3.time.DurationUtils; | import java.time.*; import org.apache.commons.lang3.time.*; | [
"java.time",
"org.apache.commons"
] | java.time; org.apache.commons; | 1,437,527 |
public static CachedBlocksByFile getLoadedCachedBlocksByFile(final Configuration conf,
final BlockCache bc) {
CachedBlocksByFile cbsbf = new CachedBlocksByFile(conf);
for (CachedBlock cb: bc) {
if (cbsbf.update(cb)) break;
}
return cbsbf;
} | static CachedBlocksByFile function(final Configuration conf, final BlockCache bc) { CachedBlocksByFile cbsbf = new CachedBlocksByFile(conf); for (CachedBlock cb: bc) { if (cbsbf.update(cb)) break; } return cbsbf; } | /**
* Get a {@link CachedBlocksByFile} instance and load it up by iterating content in
* {@link BlockCache}.
* @param conf Used to read configurations
* @param bc Block Cache to iterate.
* @return Laoded up instance of CachedBlocksByFile
*/ | Get a <code>CachedBlocksByFile</code> instance and load it up by iterating content in <code>BlockCache</code> | getLoadedCachedBlocksByFile | {
"repo_name": "ChinmaySKulkarni/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.java",
"license": "apache-2.0",
"size": 13322
} | [
"org.apache.hadoop.conf.Configuration"
] | import org.apache.hadoop.conf.Configuration; | import org.apache.hadoop.conf.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,979,792 |
@SuppressWarnings("unlikely-arg-type")
@Test
public final void testEqualsObject() {
String testName = new String("CollectionListe<String>.equals(Object)");
System.out.println(testName);
boolean result;
// Equals sur null
result = collection.equals(null);
assertFalse(testName + " null object", result);
// Remplissage
remplissage(collection);
// Equals sur this
result = collection.equals(collection);
assertTrue(testName + " this", result);
// Equals sur objet de nature différente
result = collection.equals(new Object());
assertFalse(testName + " this", result);
// Equals sur CollectionListe non semblable
CollectionListe<String> otherCollectionListe = new CollectionListe<String>(collection);
collection.add(extraElement);
result = collection.equals(otherCollectionListe);
assertFalse(testName + " otherCollectionListe non semblable", result);
// Equals sur CollectionListe semblable
otherCollectionListe.add(extraElement);
result = collection.equals(otherCollectionListe);
assertTrue(testName + " otherCollectionListe semblable", result);
// Equals sur Collection non semblable
collection.remove(extraElement);
ArrayList<String> otherCollection = new ArrayList<String>(collection);
collection.add(extraElement);
result = collection.equals(otherCollection);
assertFalse(testName + " otherCollection non semblable", result);
// Equals sur Collection semblable
// CollectionListe<E> peut se comparer à toute Collection<E>
otherCollection.add(extraElement);
result = collection.equals(otherCollection);
assertTrue(testName + " equals direct", result);
// ArrayList<E> ne peut se comparer qu'à une autre List<E>
boolean resultInverse = otherCollection.equals(collection);
assertFalse(testName + " equals inverse", resultInverse);
} | @SuppressWarnings(STR) final void function() { String testName = new String(STR); System.out.println(testName); boolean result; result = collection.equals(null); assertFalse(testName + STR, result); remplissage(collection); result = collection.equals(collection); assertTrue(testName + STR, result); result = collection.equals(new Object()); assertFalse(testName + STR, result); CollectionListe<String> otherCollectionListe = new CollectionListe<String>(collection); collection.add(extraElement); result = collection.equals(otherCollectionListe); assertFalse(testName + STR, result); otherCollectionListe.add(extraElement); result = collection.equals(otherCollectionListe); assertTrue(testName + STR, result); collection.remove(extraElement); ArrayList<String> otherCollection = new ArrayList<String>(collection); collection.add(extraElement); result = collection.equals(otherCollection); assertFalse(testName + STR, result); otherCollection.add(extraElement); result = collection.equals(otherCollection); assertTrue(testName + STR, result); boolean resultInverse = otherCollection.equals(collection); assertFalse(testName + STR, resultInverse); } | /**
* Test method for {@link listes.CollectionListe#equals(java.lang.Object)}.
*/ | Test method for <code>listes.CollectionListe#equals(java.lang.Object)</code> | testEqualsObject | {
"repo_name": "rpereira-dev/ENSIIE",
"path": "UE/S2/ILO/TP Listes & Figures/src/tests/CollectionListeTest.java",
"license": "gpl-3.0",
"size": 22104
} | [
"java.util.ArrayList",
"org.junit.Assert"
] | import java.util.ArrayList; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 366,921 |
@Test
void abortAndRespondContract()
{
try
{
pageFactory.newPage(AbortAndRespondPage1.class);
fail();
}
catch (ResetResponseException e)
{
// noop
}
try
{
pageFactory.newPage(AbortAndRespondPage2.class);
fail();
}
catch (ResetResponseException e)
{
// noop
}
try
{
pageFactory.newPage(AbortAndRespondPage2.class, new PageParameters());
fail();
}
catch (ResetResponseException e)
{
// noop
}
try
{
pageFactory.newPage(AbortAndRespondPage3.class);
fail();
}
catch (ResetResponseException e)
{
// noop
}
try
{
pageFactory.newPage(AbortAndRespondPage3.class, new PageParameters());
fail();
}
catch (ResetResponseException e)
{
// noop
}
try
{
pageFactory.newPage(PageThrowingCheckedException.class);
fail();
}
catch (WicketRuntimeException e)
{
assertNotNull(e.getCause());
assertNotNull(e.getCause().getCause());
assertEquals(PageThrowingCheckedException.EXCEPTION, e.getCause().getCause());
}
catch (Exception e)
{
fail();
}
}
public static class AbortAndRespondPage1 extends WebPage
{
private static final long serialVersionUID = 1L;
AbortAndRespondPage1()
{
throw new ResetResponseException(new EmptyRequestHandler())
{
private static final long serialVersionUID = 1L;
};
}
}
public static class AbortAndRespondPage2 extends WebPage
{
private static final long serialVersionUID = 1L;
AbortAndRespondPage2(PageParameters params)
{
throw new ResetResponseException(new EmptyRequestHandler())
{
private static final long serialVersionUID = 1L;
};
}
}
public static class AbortAndRespondPage3 extends WebPage
{
private static final long serialVersionUID = 1L;
AbortAndRespondPage3()
{
throw new ResetResponseException(new EmptyRequestHandler())
{
private static final long serialVersionUID = 1L;
};
}
AbortAndRespondPage3(PageParameters params)
{
throw new ResetResponseException(new EmptyRequestHandler())
{
private static final long serialVersionUID = 1L;
};
}
}
public static class PageThrowingCheckedException extends WebPage
{
static final Exception EXCEPTION = new Exception("a checked exception");
private static final long serialVersionUID = 1L;
PageThrowingCheckedException() throws Exception
{
throw EXCEPTION;
}
}
public static class PrivateDefaultConstructorPage extends WebPage
{
private PrivateDefaultConstructorPage()
{
}
}
public static class PrivateConstructorWithParametersPage extends WebPage
{
private PrivateConstructorWithParametersPage(PageParameters parameters)
{
super(parameters);
}
}
public static class NonDefaultConstructorPage extends WebPage
{
public NonDefaultConstructorPage(String aa)
{
super();
}
}
public static class ThrowExceptionInConstructorPage extends WebPage
{
public ThrowExceptionInConstructorPage()
{
throw new RuntimeException("exception!");
}
} | void abortAndRespondContract() { try { pageFactory.newPage(AbortAndRespondPage1.class); fail(); } catch (ResetResponseException e) { } try { pageFactory.newPage(AbortAndRespondPage2.class); fail(); } catch (ResetResponseException e) { } try { pageFactory.newPage(AbortAndRespondPage2.class, new PageParameters()); fail(); } catch (ResetResponseException e) { } try { pageFactory.newPage(AbortAndRespondPage3.class); fail(); } catch (ResetResponseException e) { } try { pageFactory.newPage(AbortAndRespondPage3.class, new PageParameters()); fail(); } catch (ResetResponseException e) { } try { pageFactory.newPage(PageThrowingCheckedException.class); fail(); } catch (WicketRuntimeException e) { assertNotNull(e.getCause()); assertNotNull(e.getCause().getCause()); assertEquals(PageThrowingCheckedException.EXCEPTION, e.getCause().getCause()); } catch (Exception e) { fail(); } } public static class AbortAndRespondPage1 extends WebPage { private static final long serialVersionUID = 1L; AbortAndRespondPage1() { throw new ResetResponseException(new EmptyRequestHandler()) { private static final long serialVersionUID = 1L; }; } } public static class AbortAndRespondPage2 extends WebPage { private static final long serialVersionUID = 1L; AbortAndRespondPage2(PageParameters params) { throw new ResetResponseException(new EmptyRequestHandler()) { private static final long serialVersionUID = 1L; }; } } public static class AbortAndRespondPage3 extends WebPage { private static final long serialVersionUID = 1L; AbortAndRespondPage3() { throw new ResetResponseException(new EmptyRequestHandler()) { private static final long serialVersionUID = 1L; }; } AbortAndRespondPage3(PageParameters params) { throw new ResetResponseException(new EmptyRequestHandler()) { private static final long serialVersionUID = 1L; }; } } public static class PageThrowingCheckedException extends WebPage { static final Exception EXCEPTION = new Exception(STR); private static final long serialVersionUID = 1L; PageThrowingCheckedException() throws Exception { throw EXCEPTION; } } public static class PrivateDefaultConstructorPage extends WebPage { private PrivateDefaultConstructorPage() { } } public static class PrivateConstructorWithParametersPage extends WebPage { private PrivateConstructorWithParametersPage(PageParameters parameters) { super(parameters); } } public static class NonDefaultConstructorPage extends WebPage { public NonDefaultConstructorPage(String aa) { super(); } } public static class ThrowExceptionInConstructorPage extends WebPage { public ThrowExceptionInConstructorPage() { throw new RuntimeException(STR); } } | /**
* Verifies page factory bubbles ResetResponseException
*/ | Verifies page factory bubbles ResetResponseException | abortAndRespondContract | {
"repo_name": "mosoft521/wicket",
"path": "wicket-core/src/test/java/org/apache/wicket/session/DefaultPageFactoryTest.java",
"license": "apache-2.0",
"size": 6876
} | [
"org.apache.wicket.WicketRuntimeException",
"org.apache.wicket.markup.html.WebPage",
"org.apache.wicket.request.flow.ResetResponseException",
"org.apache.wicket.request.handler.EmptyRequestHandler",
"org.apache.wicket.request.mapper.parameter.PageParameters",
"org.junit.jupiter.api.Assertions"
] | import org.apache.wicket.WicketRuntimeException; import org.apache.wicket.markup.html.WebPage; import org.apache.wicket.request.flow.ResetResponseException; import org.apache.wicket.request.handler.EmptyRequestHandler; import org.apache.wicket.request.mapper.parameter.PageParameters; import org.junit.jupiter.api.Assertions; | import org.apache.wicket.*; import org.apache.wicket.markup.html.*; import org.apache.wicket.request.flow.*; import org.apache.wicket.request.handler.*; import org.apache.wicket.request.mapper.parameter.*; import org.junit.jupiter.api.*; | [
"org.apache.wicket",
"org.junit.jupiter"
] | org.apache.wicket; org.junit.jupiter; | 486,448 |
public FormFile getNewFile() {
return newFile;
} | FormFile function() { return newFile; } | /**
* Gets the mimeType attribute.
* @return Returns the mimeType.
*/ | Gets the mimeType attribute | getNewFile | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/common/committee/meeting/CommitteeScheduleAttachmentsBase.java",
"license": "apache-2.0",
"size": 10586
} | [
"org.apache.struts.upload.FormFile"
] | import org.apache.struts.upload.FormFile; | import org.apache.struts.upload.*; | [
"org.apache.struts"
] | org.apache.struts; | 1,405,139 |
public void setDocFlavor(DocFlavor docFlavor) {
this.docFlavor = docFlavor;
} | void function(DocFlavor docFlavor) { this.docFlavor = docFlavor; } | /**
* Sets DocFlavor to use.
*/ | Sets DocFlavor to use | setDocFlavor | {
"repo_name": "curso007/camel",
"path": "components/camel-printer/src/main/java/org/apache/camel/component/printer/PrinterConfiguration.java",
"license": "apache-2.0",
"size": 14225
} | [
"javax.print.DocFlavor"
] | import javax.print.DocFlavor; | import javax.print.*; | [
"javax.print"
] | javax.print; | 2,184,311 |
public final Class<? extends Annotation> getAnnotationType() {
return annotationStrategy.getAnnotationType();
} | final Class<? extends Annotation> function() { return annotationStrategy.getAnnotationType(); } | /**
* Gets the annotation type.
*/ | Gets the annotation type | getAnnotationType | {
"repo_name": "pascallouisperez/guice-jit-providers",
"path": "src/com/google/inject/Key.java",
"license": "apache-2.0",
"size": 14038
} | [
"java.lang.annotation.Annotation"
] | import java.lang.annotation.Annotation; | import java.lang.annotation.*; | [
"java.lang"
] | java.lang; | 478,981 |
public static HashMap<String, HashMap<String, Float>> getHypotheses(
Network bn, HashMap<String, List<String>> queries)
throws ShanksException {
HashMap<String, HashMap<String, Float>> result = new HashMap<String, HashMap<String, Float>>();
for (Entry<String, List<String>> query : queries.entrySet()) {
HashMap<String, Float> partialResult = ShanksAgentBayesianReasoningCapability
.getNodeHypotheses(bn, query.getKey(), query.getValue());
result.put(query.getKey(), partialResult);
}
return result;
} | static HashMap<String, HashMap<String, Float>> function( Network bn, HashMap<String, List<String>> queries) throws ShanksException { HashMap<String, HashMap<String, Float>> result = new HashMap<String, HashMap<String, Float>>(); for (Entry<String, List<String>> query : queries.entrySet()) { HashMap<String, Float> partialResult = ShanksAgentBayesianReasoningCapability .getNodeHypotheses(bn, query.getKey(), query.getValue()); result.put(query.getKey(), partialResult); } return result; } | /**
* Query several states of a set of nodes
*
* @param bn
* @param queries
* in format hashmap of [node, List of states]
* @return results in format hashmap of [node, hashmap]. The second hashmap
* is [state, probability of the hypothesis]
* @throws UnknownNodeException
* @throws UnknowkNodeStateException
*/ | Query several states of a set of nodes | getHypotheses | {
"repo_name": "gsi-upm/Shanks",
"path": "shanks-core/src/main/java/es/upm/dit/gsi/shanks/agent/capability/reasoning/bayes/smile/ShanksAgentBayesianReasoningCapability.java",
"license": "gpl-2.0",
"size": 25021
} | [
"es.upm.dit.gsi.shanks.exception.ShanksException",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import es.upm.dit.gsi.shanks.exception.ShanksException; import java.util.HashMap; import java.util.List; import java.util.Map; | import es.upm.dit.gsi.shanks.exception.*; import java.util.*; | [
"es.upm.dit",
"java.util"
] | es.upm.dit; java.util; | 1,256,747 |
protected File createTempFile(String name) throws IOException {
// TODO [low] duplicate code with AbstractTransferManager
if (config == null) {
return File.createTempFile(String.format("temp-%s-", name), ".tmp");
}
else {
return config.getCache().createTempFile(name);
}
} | File function(String name) throws IOException { if (config == null) { return File.createTempFile(String.format(STR, name), ".tmp"); } else { return config.getCache().createTempFile(name); } } | /**
* Creates a temporary file, either using the config (if initialized) or
* using the global temporary directory.
*/ | Creates a temporary file, either using the config (if initialized) or using the global temporary directory | createTempFile | {
"repo_name": "syncany/syncany-plugin-dropbox",
"path": "core/syncany-lib/src/main/java/org/syncany/plugins/transfer/features/TransactionAwareFeatureTransferManager.java",
"license": "gpl-3.0",
"size": 17490
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,731,662 |
@Override
public ImmutableList<RequestConstructor> toConstructorList(
final Ds3Request ds3Request,
final String requestName,
final Ds3DocSpec docSpec) {
final ImmutableList<Arguments> constructorArgs = toConstructorArgumentsList(ds3Request);
final ImmutableList<Arguments> optionalArgs = toArgumentsList(ds3Request.getOptionalQueryParams());
final ImmutableList<QueryParam> queryParams = toQueryParamsList(ds3Request);
final RequestConstructor depreciatedConstructor = createDeprecatedConstructor(
constructorArgs,
requestName,
docSpec);
final RequestConstructor channelConstructor = getChannelConstructor(
constructorArgs,
optionalArgs,
queryParams,
requestName,
docSpec);
final RequestConstructor inputStreamConstructor = getInputStreamConstructor(
constructorArgs,
optionalArgs,
queryParams,
requestName,
docSpec);
return ImmutableList.of(
depreciatedConstructor,
channelConstructor,
inputStreamConstructor);
} | ImmutableList<RequestConstructor> function( final Ds3Request ds3Request, final String requestName, final Ds3DocSpec docSpec) { final ImmutableList<Arguments> constructorArgs = toConstructorArgumentsList(ds3Request); final ImmutableList<Arguments> optionalArgs = toArgumentsList(ds3Request.getOptionalQueryParams()); final ImmutableList<QueryParam> queryParams = toQueryParamsList(ds3Request); final RequestConstructor depreciatedConstructor = createDeprecatedConstructor( constructorArgs, requestName, docSpec); final RequestConstructor channelConstructor = getChannelConstructor( constructorArgs, optionalArgs, queryParams, requestName, docSpec); final RequestConstructor inputStreamConstructor = getInputStreamConstructor( constructorArgs, optionalArgs, queryParams, requestName, docSpec); return ImmutableList.of( depreciatedConstructor, channelConstructor, inputStreamConstructor); } | /**
* Gets the list of constructor models from a Ds3Request. This includes the
* Create Object deprecated constructor, a constructor that uses the parameter
* Channel, and a constructor that has an InputStream parameter
*/ | Gets the list of constructor models from a Ds3Request. This includes the Create Object deprecated constructor, a constructor that uses the parameter Channel, and a constructor that has an InputStream parameter | toConstructorList | {
"repo_name": "DenverM80/ds3_autogen",
"path": "ds3-autogen-java/src/main/java/com/spectralogic/ds3autogen/java/generators/requestmodels/CreateObjectRequestGenerator.java",
"license": "apache-2.0",
"size": 7517
} | [
"com.google.common.collect.ImmutableList",
"com.spectralogic.ds3autogen.api.models.Arguments",
"com.spectralogic.ds3autogen.api.models.apispec.Ds3Request",
"com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec",
"com.spectralogic.ds3autogen.java.models.QueryParam",
"com.spectralogic.ds3autogen.java.models.RequestConstructor"
] | import com.google.common.collect.ImmutableList; import com.spectralogic.ds3autogen.api.models.Arguments; import com.spectralogic.ds3autogen.api.models.apispec.Ds3Request; import com.spectralogic.ds3autogen.api.models.docspec.Ds3DocSpec; import com.spectralogic.ds3autogen.java.models.QueryParam; import com.spectralogic.ds3autogen.java.models.RequestConstructor; | import com.google.common.collect.*; import com.spectralogic.ds3autogen.api.models.*; import com.spectralogic.ds3autogen.api.models.apispec.*; import com.spectralogic.ds3autogen.api.models.docspec.*; import com.spectralogic.ds3autogen.java.models.*; | [
"com.google.common",
"com.spectralogic.ds3autogen"
] | com.google.common; com.spectralogic.ds3autogen; | 493,236 |
@Test
public void testExpressionTemplateWithSimpleExpressionWithResolved()
{
System.setProperty("simple", "value");
ExpressionTemplate t = new ExpressionTemplate("${simple}");
assertEquals(StringUtils.createKey(0), t.getTemplate());
assertEquals(1, t.getEntities().size());
assertEquals("simple", t.getEntities().get(StringUtils.createKey(0)).getKey());
assertEquals("value", t.getEntities().get(StringUtils.createKey(0)).getResolvedValue());
assertEquals("${simple}", t.getSubstitution());
assertEquals("value", t.getValue());
} | void function() { System.setProperty(STR, "value"); ExpressionTemplate t = new ExpressionTemplate(STR); assertEquals(StringUtils.createKey(0), t.getTemplate()); assertEquals(1, t.getEntities().size()); assertEquals(STR, t.getEntities().get(StringUtils.createKey(0)).getKey()); assertEquals("value", t.getEntities().get(StringUtils.createKey(0)).getResolvedValue()); assertEquals(STR, t.getSubstitution()); assertEquals("value", t.getValue()); } | /**
* Checks ExpressionTemplate for a text with simple expression with resolved value
*/ | Checks ExpressionTemplate for a text with simple expression with resolved value | testExpressionTemplateWithSimpleExpressionWithResolved | {
"repo_name": "jandsu/ironjacamar",
"path": "testsuite/src/test/java/org/ironjacamar/common/metadata/common/ExpressionTemplateTestCase.java",
"license": "epl-1.0",
"size": 33024
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,959,546 |
private String getValues(final List<CalculateButton> buttons, final int degDigits) {
String returnValue = "";
for (final EditButton button : buttons) {
// Remove inactive and blank digits from result
if (button.getVisibility() == View.VISIBLE) {
if (button.getLabel() == CalculateButton.ButtonData.BLANK) {
returnValue = returnValue.concat(PLACE_HOLDER);
} else {
returnValue = returnValue.concat(String.valueOf(button.getLabel()));
}
}
}
// Formatting intentionally done first in case the substitution changes number of characters.
return format(returnValue, degDigits);
} | String function(final List<CalculateButton> buttons, final int degDigits) { String returnValue = ""; for (final EditButton button : buttons) { if (button.getVisibility() == View.VISIBLE) { if (button.getLabel() == CalculateButton.ButtonData.BLANK) { returnValue = returnValue.concat(PLACE_HOLDER); } else { returnValue = returnValue.concat(String.valueOf(button.getLabel())); } } } return format(returnValue, degDigits); } | /**
* Retrieve all the values from the calculation buttons
*
* Note that a special 'place-holder' character is used to represent "blanked-out" buttons.
* This is needed to preserve formatting when multi digit calculations are used.
*
* @param buttons List of button from which to extract the values
* @return Button values as a string
*/ | Retrieve all the values from the calculation buttons Note that a special 'place-holder' character is used to represent "blanked-out" buttons. This is needed to preserve formatting when multi digit calculations are used | getValues | {
"repo_name": "pstorch/cgeo",
"path": "main/src/cgeo/geocaching/ui/dialog/CoordinatesCalculateDialog.java",
"license": "apache-2.0",
"size": 52806
} | [
"android.view.View",
"java.util.List"
] | import android.view.View; import java.util.List; | import android.view.*; import java.util.*; | [
"android.view",
"java.util"
] | android.view; java.util; | 124,270 |
default HtplResource tryGetAbsolute(String absolutePath,Locale locale) {
return tryGetAbsolute(absolutePath, locale, false);
}
| default HtplResource tryGetAbsolute(String absolutePath,Locale locale) { return tryGetAbsolute(absolutePath, locale, false); } | /**
* Returns a htpl resource of the absolute path.
*
* <p>
* Returns <code>null</code> if this resource does not supports this operation or the given path does not exists.
*/ | Returns a htpl resource of the absolute path. Returns <code>null</code> if this resource does not supports this operation or the given path does not exists | tryGetAbsolute | {
"repo_name": "leapframework/framework",
"path": "web/htpl/src/main/java/leap/htpl/HtplResource.java",
"license": "apache-2.0",
"size": 3720
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,252,820 |
public String toYear(Calendar calendar) {
if (calendar == null) {
return null;
}
// Temporarily turn off TZ qualification
boolean wasTimezoneQualified = getXMLConversionManager().isTimeZoneQualified();
getXMLConversionManager().setTimeZoneQualified(false);
String s = getXMLConversionManager().stringFromCalendar(calendar, XMLConstants.G_YEAR_QNAME);
getXMLConversionManager().setTimeZoneQualified(wasTimezoneQualified);
return s;
}
| String function(Calendar calendar) { if (calendar == null) { return null; } boolean wasTimezoneQualified = getXMLConversionManager().isTimeZoneQualified(); getXMLConversionManager().setTimeZoneQualified(false); String s = getXMLConversionManager().stringFromCalendar(calendar, XMLConstants.G_YEAR_QNAME); getXMLConversionManager().setTimeZoneQualified(wasTimezoneQualified); return s; } | /**
* Convert from a Calendar to a String representation of the Year type.
*
* @param calendar the calendar to convert
* @return a Calendar to a String representation of the Year type.
*/ | Convert from a Calendar to a String representation of the Year type | toYear | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "sdo/org.eclipse.persistence.sdo/src/org/eclipse/persistence/sdo/helper/SDODataHelper.java",
"license": "epl-1.0",
"size": 33600
} | [
"java.util.Calendar",
"org.eclipse.persistence.oxm.XMLConstants"
] | import java.util.Calendar; import org.eclipse.persistence.oxm.XMLConstants; | import java.util.*; import org.eclipse.persistence.oxm.*; | [
"java.util",
"org.eclipse.persistence"
] | java.util; org.eclipse.persistence; | 1,029,629 |
public static java.util.List extractCatsReferralList(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.CatsReferralClinicListListVoCollection voCollection)
{
return extractCatsReferralList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.CatsReferralClinicListListVoCollection voCollection) { return extractCatsReferralList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.RefMan.domain.objects.CatsReferral list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.RefMan.domain.objects.CatsReferral list from the value object collection | extractCatsReferralList | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/RefMan/vo/domain/CatsReferralClinicListListVoAssembler.java",
"license": "agpl-3.0",
"size": 25182
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,818,852 |
OrderData authorisePayment(HttpServletRequest request, CartData cartData) throws Exception; | OrderData authorisePayment(HttpServletRequest request, CartData cartData) throws Exception; | /**
* Authorizes a payment using Adyen API
* In case of authorized, it places an order from cart
*
* @param request HTTP Request info
* @param cartData cartData object
* @return OrderData
* @throws Exception In case order failed to be created
*/ | Authorizes a payment using Adyen API In case of authorized, it places an order from cart | authorisePayment | {
"repo_name": "Adyen/adyen-hybris",
"path": "adyenv6core/src/com/adyen/v6/facades/AdyenCheckoutFacade.java",
"license": "mit",
"size": 7120
} | [
"de.hybris.platform.commercefacades.order.data.CartData",
"de.hybris.platform.commercefacades.order.data.OrderData",
"javax.servlet.http.HttpServletRequest"
] | import de.hybris.platform.commercefacades.order.data.CartData; import de.hybris.platform.commercefacades.order.data.OrderData; import javax.servlet.http.HttpServletRequest; | import de.hybris.platform.commercefacades.order.data.*; import javax.servlet.http.*; | [
"de.hybris.platform",
"javax.servlet"
] | de.hybris.platform; javax.servlet; | 1,885,165 |
protected void fireValueChangedEvent() {
ExpressionHelper.fireValueChangedEvent(helper);
} | void function() { ExpressionHelper.fireValueChangedEvent(helper); } | /**
* Sends notifications to all attached
* {@link javafx.beans.InvalidationListener InvalidationListeners} and
* {@link javafx.beans.value.ChangeListener ChangeListeners}.
*
* This method is called when the value is changed, either manually by
* calling {@link #set(double)} or in case of a bound property, if the
* binding becomes invalid.
*/ | Sends notifications to all attached <code>javafx.beans.InvalidationListener InvalidationListeners</code> and <code>javafx.beans.value.ChangeListener ChangeListeners</code>. This method is called when the value is changed, either manually by calling <code>#set(double)</code> or in case of a bound property, if the binding becomes invalid | fireValueChangedEvent | {
"repo_name": "teamfx/openjfx-8u-dev-rt",
"path": "modules/base/src/main/java/javafx/beans/property/DoublePropertyBase.java",
"license": "gpl-2.0",
"size": 8335
} | [
"com.sun.javafx.binding.ExpressionHelper"
] | import com.sun.javafx.binding.ExpressionHelper; | import com.sun.javafx.binding.*; | [
"com.sun.javafx"
] | com.sun.javafx; | 289,852 |
@Override
protected void actionPerformed(GuiButton parButton)
{
//if (parButton.id == 1)
//{
// NetworkHandler.sendToServer(new MessageGuiAirshipMenu());
//}
if (parButton.id == 2)
{
NetworkHandler.sendToServer(new MessageGuiUpgradeMenu());
}
if (parButton.id == 3)
{
NetworkHandler.sendToServer(new MessageGuiVisualMenu());
}
if (parButton.id == 4)
{
NetworkHandler.sendToServer(new MessageGuiModuleMenu());
}
this.buttonList.clear();
this.initGui();
this.updateScreen();
}
| void function(GuiButton parButton) { if (parButton.id == 2) { NetworkHandler.sendToServer(new MessageGuiUpgradeMenu()); } if (parButton.id == 3) { NetworkHandler.sendToServer(new MessageGuiVisualMenu()); } if (parButton.id == 4) { NetworkHandler.sendToServer(new MessageGuiModuleMenu()); } this.buttonList.clear(); this.initGui(); this.updateScreen(); } | /**
* Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
*/ | Called by the controls from the buttonList when activated. (Mouse pressed for buttons) | actionPerformed | {
"repo_name": "Weisses/Ebonheart-Mods",
"path": "ViesCraft/1.12.2 - 2491/src/main/java/com/viesis/viescraft/client/gui/airship/main/GuiAirshipMenuStorageGreater.java",
"license": "mit",
"size": 21070
} | [
"com.viesis.viescraft.network.NetworkHandler",
"com.viesis.viescraft.network.server.airship.MessageGuiUpgradeMenu",
"com.viesis.viescraft.network.server.airship.main.MessageGuiModuleMenu",
"com.viesis.viescraft.network.server.airship.main.MessageGuiVisualMenu",
"net.minecraft.client.gui.GuiButton"
] | import com.viesis.viescraft.network.NetworkHandler; import com.viesis.viescraft.network.server.airship.MessageGuiUpgradeMenu; import com.viesis.viescraft.network.server.airship.main.MessageGuiModuleMenu; import com.viesis.viescraft.network.server.airship.main.MessageGuiVisualMenu; import net.minecraft.client.gui.GuiButton; | import com.viesis.viescraft.network.*; import com.viesis.viescraft.network.server.airship.*; import com.viesis.viescraft.network.server.airship.main.*; import net.minecraft.client.gui.*; | [
"com.viesis.viescraft",
"net.minecraft.client"
] | com.viesis.viescraft; net.minecraft.client; | 1,890,881 |
public ArrayList<String> getGroups() {
return groups;
} | ArrayList<String> function() { return groups; } | /**
* Returns the groups filter vector.
*
* @return groups the group filters to be returned.
*/ | Returns the groups filter vector | getGroups | {
"repo_name": "aidGer/aidGer",
"path": "src/de/aidger/model/reports/BalanceFilter.java",
"license": "gpl-3.0",
"size": 3631
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,011,360 |
private static Size calcScaledSize(BufferedImage image, int maxWidth, int maxHeight) {
int width = image.getWidth();
int height = image.getHeight();
return computeScaledSize(width, height, maxWidth, maxHeight);
}
| static Size function(BufferedImage image, int maxWidth, int maxHeight) { int width = image.getWidth(); int height = image.getHeight(); return computeScaledSize(width, height, maxWidth, maxHeight); } | /**
* Calculate the size of the new image. The method keep the ratio and doesn't
* scale up the image.
* @param image the image to scale
* @param maxWidth the maximum width of the new scaled image
* @param maxheight the maximum height of the new scaled image
* @return
*/ | Calculate the size of the new image. The method keep the ratio and doesn't scale up the image | calcScaledSize | {
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/core/util/image/spi/ImageHelperImpl.java",
"license": "apache-2.0",
"size": 19860
} | [
"java.awt.image.BufferedImage",
"org.olat.core.util.image.Size"
] | import java.awt.image.BufferedImage; import org.olat.core.util.image.Size; | import java.awt.image.*; import org.olat.core.util.image.*; | [
"java.awt",
"org.olat.core"
] | java.awt; org.olat.core; | 1,300,267 |
@Test
public void testFunctions() throws Exception
{
Slf4jLoggerFactory factory = mock(Slf4jLoggerFactory.class);
PowerMockito.whenNew(Slf4jLoggerFactory.class).withAnyArguments().thenReturn(factory);
StaticLoggerBinder slb = StaticLoggerBinder.getSingleton();
assertThat(slb.getLoggerFactory(), instanceOf(Slf4jLoggerFactory.class));
assertEquals(Slf4jLoggerFactory.class.getName(), slb.getLoggerFactoryClassStr());
MockRepository.remove(Slf4jLoggerFactory.class);
} | void function() throws Exception { Slf4jLoggerFactory factory = mock(Slf4jLoggerFactory.class); PowerMockito.whenNew(Slf4jLoggerFactory.class).withAnyArguments().thenReturn(factory); StaticLoggerBinder slb = StaticLoggerBinder.getSingleton(); assertThat(slb.getLoggerFactory(), instanceOf(Slf4jLoggerFactory.class)); assertEquals(Slf4jLoggerFactory.class.getName(), slb.getLoggerFactoryClassStr()); MockRepository.remove(Slf4jLoggerFactory.class); } | /**
* Test Functions
*
* @throws Exception
*/ | Test Functions | testFunctions | {
"repo_name": "schnawel007/DefaultProject",
"path": "src/test/java/org/slf4j/impl/StaticLoggerBinderTest.java",
"license": "apache-2.0",
"size": 1709
} | [
"de.joshuaschnabel.defaultproject.loggeradapter.Slf4jLoggerFactory",
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.mockito.Mockito",
"org.powermock.api.mockito.PowerMockito",
"org.powermock.core.MockRepository"
] | import de.joshuaschnabel.defaultproject.loggeradapter.Slf4jLoggerFactory; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.MockRepository; | import de.joshuaschnabel.defaultproject.loggeradapter.*; import org.hamcrest.*; import org.junit.*; import org.mockito.*; import org.powermock.api.mockito.*; import org.powermock.core.*; | [
"de.joshuaschnabel.defaultproject",
"org.hamcrest",
"org.junit",
"org.mockito",
"org.powermock.api",
"org.powermock.core"
] | de.joshuaschnabel.defaultproject; org.hamcrest; org.junit; org.mockito; org.powermock.api; org.powermock.core; | 2,722,432 |
@Auditable(parameters = {"userName"})
public NodeRef getPersonOrNull(String userName);
| @Auditable(parameters = {STR}) NodeRef function(String userName); | /**
* Get a person by userName. The person is store in the repository. No missing
* person objects will be created as a side effect of this call. If the person
* is missing from the repository null will be returned.
*
* @param userName -
* the userName key to find the person
* @return Returns the existing person node, or null if does not exist.
*
* @see #createMissingPeople()
*/ | Get a person by userName. The person is store in the repository. No missing person objects will be created as a side effect of this call. If the person is missing from the repository null will be returned | getPersonOrNull | {
"repo_name": "daniel-he/community-edition",
"path": "projects/repository/source/java/org/alfresco/service/cmr/security/PersonService.java",
"license": "lgpl-3.0",
"size": 16306
} | [
"org.alfresco.service.Auditable",
"org.alfresco.service.cmr.repository.NodeRef"
] | import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.NodeRef; | import org.alfresco.service.*; import org.alfresco.service.cmr.repository.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 1,214,105 |
public OneResponse info()
{
return super.info();
} | OneResponse function() { return super.info(); } | /**
* Loads the xml representation of the cluster pool.
*
* @see ClusterPool#info(Client)
*/ | Loads the xml representation of the cluster pool | info | {
"repo_name": "bcec/opennebula3.4.1",
"path": "src/oca/java/src/org/opennebula/client/cluster/ClusterPool.java",
"license": "apache-2.0",
"size": 2956
} | [
"org.opennebula.client.OneResponse"
] | import org.opennebula.client.OneResponse; | import org.opennebula.client.*; | [
"org.opennebula.client"
] | org.opennebula.client; | 1,422,846 |
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<VirtualMachineInner> list(String statusOnly, Context context); | @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<VirtualMachineInner> list(String statusOnly, Context context); | /**
* Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get
* the next page of virtual machines.
*
* @param statusOnly statusOnly=true enables fetching run time status of all Virtual Machines in the subscription.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the List Virtual Machine operation response.
*/ | Lists all of the virtual machines in the specified subscription. Use the nextLink property in the response to get the next page of virtual machines | list | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachinesClient.java",
"license": "mit",
"size": 119505
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedIterable",
"com.azure.core.util.Context",
"com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.compute.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,953,850 |
public void setParentVariableSpace( VariableSpace parent ) {
variables.setParentVariableSpace( parent );
} | void function( VariableSpace parent ) { variables.setParentVariableSpace( parent ); } | /**
* Sets the parent variable space.
*
* @param parent
* the new parent variable space
* @see org.pentaho.di.core.variables.VariableSpace#setParentVariableSpace(
* org.pentaho.di.core.variables.VariableSpace)
*/ | Sets the parent variable space | setParentVariableSpace | {
"repo_name": "AndreyBurikhin/pentaho-kettle",
"path": "engine/src/org/pentaho/di/trans/Trans.java",
"license": "apache-2.0",
"size": 190705
} | [
"org.pentaho.di.core.variables.VariableSpace"
] | import org.pentaho.di.core.variables.VariableSpace; | import org.pentaho.di.core.variables.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,358,907 |
public static Color getColorForValueType(int valueType) {
Color color = mapOfValueTypeColors.get(valueType);
while (color == null) {
valueType = Ontology.ATTRIBUTE_VALUE_TYPE.getParent(valueType);
color = mapOfValueTypeColors.get(valueType);
}
return color;
} | static Color function(int valueType) { Color color = mapOfValueTypeColors.get(valueType); while (color == null) { valueType = Ontology.ATTRIBUTE_VALUE_TYPE.getParent(valueType); color = mapOfValueTypeColors.get(valueType); } return color; } | /**
* Returns the {@link Color} used to represent the given {@link Ontology#ATTRIBUTE_VALUE_TYPE}.
*
* @param valueType
* @return
*/ | Returns the <code>Color</code> used to represent the given <code>Ontology#ATTRIBUTE_VALUE_TYPE</code> | getColorForValueType | {
"repo_name": "brtonnies/rapidminer-studio",
"path": "src/main/java/com/rapidminer/gui/tools/AttributeGuiTools.java",
"license": "agpl-3.0",
"size": 5900
} | [
"com.rapidminer.tools.Ontology",
"java.awt.Color"
] | import com.rapidminer.tools.Ontology; import java.awt.Color; | import com.rapidminer.tools.*; import java.awt.*; | [
"com.rapidminer.tools",
"java.awt"
] | com.rapidminer.tools; java.awt; | 2,410,699 |
public static boolean isFromFileType(PsiElement element, @NotNull String... extensions) {
if (extensions.length == 0) {
throw new IllegalArgumentException("Extension must be provided");
}
PsiFile file;
if (element instanceof PsiFile) {
file = (PsiFile) element;
} else {
file = PsiTreeUtil.getParentOfType(element, PsiFile.class);
}
if (file != null) {
String name = file.getName().toLowerCase();
for (String match : extensions) {
if (name.endsWith("." + match.toLowerCase())) {
return true;
}
}
}
return false;
} | static boolean function(PsiElement element, @NotNull String... extensions) { if (extensions.length == 0) { throw new IllegalArgumentException(STR); } PsiFile file; if (element instanceof PsiFile) { file = (PsiFile) element; } else { file = PsiTreeUtil.getParentOfType(element, PsiFile.class); } if (file != null) { String name = file.getName().toLowerCase(); for (String match : extensions) { if (name.endsWith("." + match.toLowerCase())) { return true; } } } return false; } | /**
* Is the element from a file of the given extensions such as <tt>java</tt>, <tt>xml</tt>, etc.
*/ | Is the element from a file of the given extensions such as java, xml, etc | isFromFileType | {
"repo_name": "adrianbumbas/camel-idea-plugin",
"path": "camel-idea-plugin/src/main/java/org/apache/camel/idea/util/IdeaUtils.java",
"license": "apache-2.0",
"size": 30020
} | [
"com.intellij.psi.PsiElement",
"com.intellij.psi.PsiFile",
"com.intellij.psi.util.PsiTreeUtil",
"org.jetbrains.annotations.NotNull"
] | import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.NotNull; | import com.intellij.psi.*; import com.intellij.psi.util.*; import org.jetbrains.annotations.*; | [
"com.intellij.psi",
"org.jetbrains.annotations"
] | com.intellij.psi; org.jetbrains.annotations; | 1,082,253 |
public KeyNamePair getKeyNamePair()
{
return new KeyNamePair(get_ID(), getName());
} | KeyNamePair function() { return new KeyNamePair(get_ID(), getName()); } | /** Get Record ID/ColumnName
@return ID/ColumnName pair
*/ | Get Record ID/ColumnName | getKeyNamePair | {
"repo_name": "neuroidss/adempiere",
"path": "base/src/org/compiere/model/X_C_BPartner.java",
"license": "gpl-2.0",
"size": 39513
} | [
"org.compiere.util.KeyNamePair"
] | import org.compiere.util.KeyNamePair; | import org.compiere.util.*; | [
"org.compiere.util"
] | org.compiere.util; | 68,776 |
//-----------------------------------------------------------------------
public MetaProperty<Double> strike() {
return strike;
} | MetaProperty<Double> function() { return strike; } | /**
* The meta-property for the {@code strike} property.
* @return the meta-property, not null
*/ | The meta-property for the strike property | strike | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/pricer/src/main/java/com/opengamma/strata/pricer/impl/tree/ConstantContinuousSingleBarrierKnockoutFunction.java",
"license": "apache-2.0",
"size": 20079
} | [
"org.joda.beans.MetaProperty"
] | import org.joda.beans.MetaProperty; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 2,795,808 |
public InfoFileData parse(final Reader reader) {
return parse(new TsvStreamReader(reader));
} | InfoFileData function(final Reader reader) { return parse(new TsvStreamReader(reader)); } | /**
* Parse .RAW.info file data coming from a given reader.
*/ | Parse .RAW.info file data coming from a given reader | parse | {
"repo_name": "romanzenka/swift",
"path": "services/search-db/src/main/java/edu/mayo/mprc/searchdb/builder/InfoFileParser.java",
"license": "apache-2.0",
"size": 2350
} | [
"edu.mayo.mprc.io.TsvStreamReader",
"java.io.Reader"
] | import edu.mayo.mprc.io.TsvStreamReader; import java.io.Reader; | import edu.mayo.mprc.io.*; import java.io.*; | [
"edu.mayo.mprc",
"java.io"
] | edu.mayo.mprc; java.io; | 257,424 |
public Builder withMembers(Collection<Address> members) {
response.members = Assert.notNull(members, "members");
return this;
} | Builder function(Collection<Address> members) { response.members = Assert.notNull(members, STR); return this; } | /**
* Sets the response members.
*
* @param members The response members.
* @return The response builder.
* @throws NullPointerException if {@code members} is null
*/ | Sets the response members | withMembers | {
"repo_name": "atomix/copycat",
"path": "protocol/src/main/java/io/atomix/copycat/protocol/KeepAliveResponse.java",
"license": "apache-2.0",
"size": 5073
} | [
"io.atomix.catalyst.transport.Address",
"io.atomix.catalyst.util.Assert",
"java.util.Collection"
] | import io.atomix.catalyst.transport.Address; import io.atomix.catalyst.util.Assert; import java.util.Collection; | import io.atomix.catalyst.transport.*; import io.atomix.catalyst.util.*; import java.util.*; | [
"io.atomix.catalyst",
"java.util"
] | io.atomix.catalyst; java.util; | 1,562,123 |
protected void copyPermissions(final PermissionCollection src,
final PermissionCollection dest)
{
for (Enumeration<Permission> elem = src.elements(); elem.hasMoreElements();)
{
final Permission permission = elem.nextElement();
dest.add(permission);
}
} | void function(final PermissionCollection src, final PermissionCollection dest) { for (Enumeration<Permission> elem = src.elements(); elem.hasMoreElements();) { final Permission permission = elem.nextElement(); dest.add(permission); } } | /**
* Copies the permissions from src to dest.
* @param src The source PermissionCollection.
* @param dest The destination PermissionCollection.
*/ | Copies the permissions from src to dest | copyPermissions | {
"repo_name": "raviu/wso2-commons-vfs",
"path": "core/src/main/java/org/apache/commons/vfs2/impl/VFSClassLoader.java",
"license": "apache-2.0",
"size": 13841
} | [
"java.security.Permission",
"java.security.PermissionCollection",
"java.util.Enumeration"
] | import java.security.Permission; import java.security.PermissionCollection; import java.util.Enumeration; | import java.security.*; import java.util.*; | [
"java.security",
"java.util"
] | java.security; java.util; | 2,209,269 |
public static void savePreferences(Properties prefs) {
prefs.put(OPTIONS, Integer.toString(staticOptions));
} | static void function(Properties prefs) { prefs.put(OPTIONS, Integer.toString(staticOptions)); } | /**
* Called once when ImageJ quits.
*
* @param prefs the prefs
*/ | Called once when ImageJ quits | savePreferences | {
"repo_name": "aherbert/GDSC",
"path": "src/main/java/uk/ac/sussex/gdsc/ij/plugin/filter/ParticleAnalyzerCopy.java",
"license": "gpl-3.0",
"size": 47198
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 290,599 |
public void initializePackageContents() {
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
// Initialize classes, features, and operations; add parameters
initEClass(documentRootEClass, DocumentRoot.class, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, "xMLNSPrefixMap", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, "xSISchemaLocation", null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getDocumentRoot_RootElement(), this.getRootElementType(), null, "rootElement", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
initEClass(element1EClass, Element1.class, "Element1", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getElement1_City(), theXMLTypePackage.getString(), "city", null, 0, 1, Element1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getElement1_Street(), theXMLTypePackage.getString(), "street", null, 0, 1, Element1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getElement1_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, Element1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(element2EClass, Element2.class, "Element2", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getElement2_Street(), theXMLTypePackage.getString(), "street", null, 0, 1, Element2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getElement2_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, Element2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(element3EClass, Element3.class, "Element3", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getElement3_Street(), theXMLTypePackage.getString(), "street", null, 0, 1, Element3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getElement3_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), "anyAttribute", null, 0, -1, Element3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(rootElementTypeEClass, RootElementType.class, "RootElementType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getRootElementType_Element1(), this.getElement1(), null, "element1", null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getRootElementType_Element2(), this.getElement2(), null, "element2", null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getRootElementType_Element3(), this.getElement3(), null, "element3", null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getRootElementType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);
// Create annotations
// http:///org/eclipse/emf/ecore/util/ExtendedMetaData
createExtendedMetaDataAnnotations();
} | void function() { if (isInitialized) return; isInitialized = true; setName(eNAME); setNsPrefix(eNS_PREFIX); setNsURI(eNS_URI); XMLTypePackage theXMLTypePackage = (XMLTypePackage)EPackage.Registry.INSTANCE.getEPackage(XMLTypePackage.eNS_URI); initEClass(documentRootEClass, DocumentRoot.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getDocumentRoot_Mixed(), ecorePackage.getEFeatureMapEntry(), "mixed", null, 0, -1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDocumentRoot_XMLNSPrefixMap(), ecorePackage.getEStringToStringMapEntry(), null, STR, null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDocumentRoot_XSISchemaLocation(), ecorePackage.getEStringToStringMapEntry(), null, STR, null, 0, -1, null, IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getDocumentRoot_RootElement(), this.getRootElementType(), null, STR, null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED); initEClass(element1EClass, Element1.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getElement1_City(), theXMLTypePackage.getString(), "city", null, 0, 1, Element1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getElement1_Street(), theXMLTypePackage.getString(), STR, null, 0, 1, Element1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getElement1_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), STR, null, 0, -1, Element1.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(element2EClass, Element2.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getElement2_Street(), theXMLTypePackage.getString(), STR, null, 0, 1, Element2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getElement2_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), STR, null, 0, -1, Element2.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(element3EClass, Element3.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEAttribute(getElement3_Street(), theXMLTypePackage.getString(), STR, null, 0, 1, Element3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getElement3_AnyAttribute(), ecorePackage.getEFeatureMapEntry(), STR, null, 0, -1, Element3.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEClass(rootElementTypeEClass, RootElementType.class, STR, !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); initEReference(getRootElementType_Element1(), this.getElement1(), null, STR, null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getRootElementType_Element2(), this.getElement2(), null, STR, null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEReference(getRootElementType_Element3(), this.getElement3(), null, STR, null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getRootElementType_Any(), ecorePackage.getEFeatureMapEntry(), "any", null, 1, 1, RootElementType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); createResource(eNS_URI); createExtendedMetaDataAnnotations(); } | /**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | Complete the initialization of the package and its meta-model. This method is guarded to have no affect on any invocation but its first. | initializePackageContents | {
"repo_name": "patrickneubauer/XMLIntellEdit",
"path": "individual-experiments/SandboxProject/src/com/example/example/with/any/impl/AnyPackageImpl.java",
"license": "mit",
"size": 17702
} | [
"com.example.example.with.any.DocumentRoot",
"com.example.example.with.any.Element1",
"com.example.example.with.any.Element2",
"com.example.example.with.any.Element3",
"com.example.example.with.any.RootElementType",
"org.eclipse.emf.ecore.EPackage",
"org.eclipse.emf.ecore.xml.type.XMLTypePackage"
] | import com.example.example.with.any.DocumentRoot; import com.example.example.with.any.Element1; import com.example.example.with.any.Element2; import com.example.example.with.any.Element3; import com.example.example.with.any.RootElementType; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.xml.type.XMLTypePackage; | import com.example.example.with.any.*; import org.eclipse.emf.ecore.*; import org.eclipse.emf.ecore.xml.type.*; | [
"com.example.example",
"org.eclipse.emf"
] | com.example.example; org.eclipse.emf; | 1,658,737 |
private void showPriceTrackingIPH(Tab tab) {
if (!ShoppingFeatures.isShoppingListEnabled()
|| !PowerBookmarkUtils.isPriceTrackingEligible(tab)) {
return;
}
mUserEducationHelper.requestShowIPH(
new IPHCommandBuilder(mActivity.getResources(),
FeatureConstants.SHOPPING_LIST_MENU_ITEM_FEATURE,
R.string.iph_price_tracking_menu_item,
R.string.iph_price_tracking_menu_item_accessibility)
.setAnchorView(mMenuButtonAnchorView)
.setOnShowCallback(()
-> turnOnHighlightForMenuItem(
R.id.enable_price_tracking_menu_id))
.setOnDismissCallback(this::turnOffHighlightForMenuItem)
.build());
} | void function(Tab tab) { if (!ShoppingFeatures.isShoppingListEnabled() !PowerBookmarkUtils.isPriceTrackingEligible(tab)) { return; } mUserEducationHelper.requestShowIPH( new IPHCommandBuilder(mActivity.getResources(), FeatureConstants.SHOPPING_LIST_MENU_ITEM_FEATURE, R.string.iph_price_tracking_menu_item, R.string.iph_price_tracking_menu_item_accessibility) .setAnchorView(mMenuButtonAnchorView) .setOnShowCallback(() -> turnOnHighlightForMenuItem( R.id.enable_price_tracking_menu_id)) .setOnDismissCallback(this::turnOffHighlightForMenuItem) .build()); } | /**
* Attempt to show the IPH for price tracking.
* @param tab The tab currently being displayed to the user.
*/ | Attempt to show the IPH for price tracking | showPriceTrackingIPH | {
"repo_name": "chromium/chromium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarButtonInProductHelpController.java",
"license": "bsd-3-clause",
"size": 16322
} | [
"org.chromium.chrome.browser.bookmarks.PowerBookmarkUtils",
"org.chromium.chrome.browser.commerce.shopping_list.ShoppingFeatures",
"org.chromium.chrome.browser.tab.Tab",
"org.chromium.chrome.browser.user_education.IPHCommandBuilder",
"org.chromium.components.feature_engagement.FeatureConstants"
] | import org.chromium.chrome.browser.bookmarks.PowerBookmarkUtils; import org.chromium.chrome.browser.commerce.shopping_list.ShoppingFeatures; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.user_education.IPHCommandBuilder; import org.chromium.components.feature_engagement.FeatureConstants; | import org.chromium.chrome.browser.bookmarks.*; import org.chromium.chrome.browser.commerce.shopping_list.*; import org.chromium.chrome.browser.tab.*; import org.chromium.chrome.browser.user_education.*; import org.chromium.components.feature_engagement.*; | [
"org.chromium.chrome",
"org.chromium.components"
] | org.chromium.chrome; org.chromium.components; | 2,804,914 |
private void unsubscribe() throws Exception {
if ( !isConnected() ) throw new Exception("unsubscribe() failed as Client is not connected");
String[] subscriptionArray = Util.splitByCommas( subscriptionTopic );
wmqttClient.unsubscribe(subscriptionArray);
logInfo("Unsubscribed from the " + subscriptionTopic + " topic(s).");
} | void function() throws Exception { if ( !isConnected() ) throw new Exception(STR); String[] subscriptionArray = Util.splitByCommas( subscriptionTopic ); wmqttClient.unsubscribe(subscriptionArray); logInfo(STR + subscriptionTopic + STR); } | /**
* Unsubscribe from the subscription topic. One again a String array is used
* so that multiple subscription string can be specified together.
*/ | Unsubscribe from the subscription topic. One again a String array is used so that multiple subscription string can be specified together | unsubscribe | {
"repo_name": "gaiandb/gaiandb",
"path": "java/Asset/ClientTools/com/ibm/gaiandb/tools/MQTTMessageStorer.java",
"license": "epl-1.0",
"size": 35214
} | [
"com.ibm.gaiandb.Util"
] | import com.ibm.gaiandb.Util; | import com.ibm.gaiandb.*; | [
"com.ibm.gaiandb"
] | com.ibm.gaiandb; | 785,850 |
public static String capitalize(String text, boolean dashToCamelCase) {
if (dashToCamelCase) {
text = dashToCamelCase(text);
}
if (text == null) {
return null;
}
int length = text.length();
if (length == 0) {
return text;
}
String answer = text.substring(0, 1).toUpperCase(Locale.ENGLISH);
if (length > 1) {
answer += text.substring(1, length);
}
return answer;
} | static String function(String text, boolean dashToCamelCase) { if (dashToCamelCase) { text = dashToCamelCase(text); } if (text == null) { return null; } int length = text.length(); if (length == 0) { return text; } String answer = text.substring(0, 1).toUpperCase(Locale.ENGLISH); if (length > 1) { answer += text.substring(1, length); } return answer; } | /**
* Capitalize the string (upper case first character)
*
* @param text the string
* @param dashToCamelCase whether to also convert dash format into camel case (hello-great-world -> helloGreatWorld)
* @return the string capitalized (upper case first character)
*/ | Capitalize the string (upper case first character) | capitalize | {
"repo_name": "kevinearls/camel",
"path": "camel-util/src/main/java/org/apache/camel/util/StringHelper.java",
"license": "apache-2.0",
"size": 25503
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,012,815 |
public String getDonator(Document relsExt); | String function(Document relsExt); | /**
* Returns Donator parsed from given document
*
* @param relsExt RELS-EXT document
* @return donator or empty string (if hasDonator relationship doesn't
* exist)
*/ | Returns Donator parsed from given document | getDonator | {
"repo_name": "ceskaexpedice/kramerius",
"path": "shared/common/src/main/java/cz/incad/kramerius/FedoraAccess.java",
"license": "gpl-3.0",
"size": 15804
} | [
"org.w3c.dom.Document"
] | import org.w3c.dom.Document; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,750,568 |
public void processCommand(CommandSender sender, String[] args) throws CommandException
{
if (args.length < 2)
{
throw new WrongUsageException("commands.achievement.usage", new Object[0]);
}
else
{
final StatBase statbase = StatList.getOneShotStat(args[1]);
if (statbase == null && !args[1].equals("*"))
{
throw new CommandException("commands.achievement.unknownAchievement", new Object[] {args[1]});
}
else
{
final PlayerMP entityplayermp = args.length >= 3 ? getPlayer(sender, args[2]) : getCommandSenderAsPlayer(sender);
boolean flag = args[0].equalsIgnoreCase("give");
boolean flag1 = args[0].equalsIgnoreCase("take");
if (flag || flag1)
{
if (statbase == null)
{
if (flag)
{
for (Achievement achievement4 : AchievementList.achievementList)
{
entityplayermp.triggerAchievement(achievement4);
}
notifyOperators(sender, this, "commands.achievement.give.success.all", new Object[] {entityplayermp.getName()});
}
else if (flag1)
{
for (Achievement achievement5 : Lists.reverse(AchievementList.achievementList))
{
entityplayermp.func_175145_a(achievement5);
}
notifyOperators(sender, this, "commands.achievement.take.success.all", new Object[] {entityplayermp.getName()});
}
}
else
{
if (statbase instanceof Achievement)
{
Achievement achievement = (Achievement)statbase;
if (flag)
{
if (entityplayermp.getStatFile().hasAchievementUnlocked(achievement))
{
throw new CommandException("commands.achievement.alreadyHave", new Object[] {entityplayermp.getName(), statbase.func_150955_j()});
}
List<Achievement> list;
for (list = Lists.<Achievement>newArrayList(); achievement.parentAchievement != null && !entityplayermp.getStatFile().hasAchievementUnlocked(achievement.parentAchievement); achievement = achievement.parentAchievement)
{
list.add(achievement.parentAchievement);
}
for (Achievement achievement1 : Lists.reverse(list))
{
entityplayermp.triggerAchievement(achievement1);
}
}
else if (flag1)
{
if (!entityplayermp.getStatFile().hasAchievementUnlocked(achievement))
{
throw new CommandException("commands.achievement.dontHave", new Object[] {entityplayermp.getName(), statbase.func_150955_j()});
} | void function(CommandSender sender, String[] args) throws CommandException { if (args.length < 2) { throw new WrongUsageException(STR, new Object[0]); } else { final StatBase statbase = StatList.getOneShotStat(args[1]); if (statbase == null && !args[1].equals("*")) { throw new CommandException(STR, new Object[] {args[1]}); } else { final PlayerMP entityplayermp = args.length >= 3 ? getPlayer(sender, args[2]) : getCommandSenderAsPlayer(sender); boolean flag = args[0].equalsIgnoreCase("give"); boolean flag1 = args[0].equalsIgnoreCase("take"); if (flag flag1) { if (statbase == null) { if (flag) { for (Achievement achievement4 : AchievementList.achievementList) { entityplayermp.triggerAchievement(achievement4); } notifyOperators(sender, this, STR, new Object[] {entityplayermp.getName()}); } else if (flag1) { for (Achievement achievement5 : Lists.reverse(AchievementList.achievementList)) { entityplayermp.func_175145_a(achievement5); } notifyOperators(sender, this, STR, new Object[] {entityplayermp.getName()}); } } else { if (statbase instanceof Achievement) { Achievement achievement = (Achievement)statbase; if (flag) { if (entityplayermp.getStatFile().hasAchievementUnlocked(achievement)) { throw new CommandException(STR, new Object[] {entityplayermp.getName(), statbase.func_150955_j()}); } List<Achievement> list; for (list = Lists.<Achievement>newArrayList(); achievement.parentAchievement != null && !entityplayermp.getStatFile().hasAchievementUnlocked(achievement.parentAchievement); achievement = achievement.parentAchievement) { list.add(achievement.parentAchievement); } for (Achievement achievement1 : Lists.reverse(list)) { entityplayermp.triggerAchievement(achievement1); } } else if (flag1) { if (!entityplayermp.getStatFile().hasAchievementUnlocked(achievement)) { throw new CommandException(STR, new Object[] {entityplayermp.getName(), statbase.func_150955_j()}); } | /**
* Callback when the command is invoked
*/ | Callback when the command is invoked | processCommand | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/command/server/CommandAchievement.java",
"license": "mit",
"size": 8533
} | [
"com.google.common.collect.Lists",
"java.util.List",
"net.minecraft.command.CommandException",
"net.minecraft.command.CommandSender",
"net.minecraft.command.WrongUsageException",
"net.minecraft.entity.player.PlayerMP",
"net.minecraft.stats.Achievement",
"net.minecraft.stats.AchievementList",
"net.minecraft.stats.StatBase",
"net.minecraft.stats.StatList"
] | import com.google.common.collect.Lists; import java.util.List; import net.minecraft.command.CommandException; import net.minecraft.command.CommandSender; import net.minecraft.command.WrongUsageException; import net.minecraft.entity.player.PlayerMP; import net.minecraft.stats.Achievement; import net.minecraft.stats.AchievementList; import net.minecraft.stats.StatBase; import net.minecraft.stats.StatList; | import com.google.common.collect.*; import java.util.*; import net.minecraft.command.*; import net.minecraft.entity.player.*; import net.minecraft.stats.*; | [
"com.google.common",
"java.util",
"net.minecraft.command",
"net.minecraft.entity",
"net.minecraft.stats"
] | com.google.common; java.util; net.minecraft.command; net.minecraft.entity; net.minecraft.stats; | 1,594,502 |
@Test
public void testCursorFileAppear() throws IOException, InterruptedException {
// normal implementation uses synchronous queue, but we use array blocking
// queue for single threaded testing
BlockingQueue<Event> q = new ArrayBlockingQueue<Event>(10);
File f = FileUtil.createTempFile("appear", ".tmp");
f.delete();
f.deleteOnExit();
Cursor c = new CustomDelimCursor(q, f, "blah", DelimMode.EXCLUDE);
assertFalse(c.tailBody()); // attempt to open, nothing there.
assertFalse(c.tailBody()); // attempt to open, nothing there.
assertEquals(0, c.lastChannelSize);
assertEquals(null, c.in);
appendData(f, 0, 5);
assertTrue(c.tailBody()); // finish reading the file
assertEquals(0, c.lastChannelPos);
assertTrue(null != c.in);
assertTrue(c.tailBody()); // finish reading the file
assertTrue(0 != c.lastChannelSize);
assertTrue(null != c.in);
assertFalse(c.tailBody()); // attempt to open file again.
assertEquals(5, q.size()); // should be 5 in queue.
} | void function() throws IOException, InterruptedException { BlockingQueue<Event> q = new ArrayBlockingQueue<Event>(10); File f = FileUtil.createTempFile(STR, ".tmp"); f.delete(); f.deleteOnExit(); Cursor c = new CustomDelimCursor(q, f, "blah", DelimMode.EXCLUDE); assertFalse(c.tailBody()); assertFalse(c.tailBody()); assertEquals(0, c.lastChannelSize); assertEquals(null, c.in); appendData(f, 0, 5); assertTrue(c.tailBody()); assertEquals(0, c.lastChannelPos); assertTrue(null != c.in); assertTrue(c.tailBody()); assertTrue(0 != c.lastChannelSize); assertTrue(null != c.in); assertFalse(c.tailBody()); assertEquals(5, q.size()); } | /**
* no file, file appears, read
*/ | no file, file appears, read | testCursorFileAppear | {
"repo_name": "fengzanfeng/flume-v2",
"path": "flume-core/test/java/com/cloudera/flume/handlers/text/TestMultiLineCursor.java",
"license": "apache-2.0",
"size": 24059
} | [
"com.cloudera.flume.core.Event",
"com.cloudera.flume.handlers.text.CustomDelimCursor",
"com.cloudera.util.FileUtil",
"java.io.File",
"java.io.IOException",
"java.util.concurrent.ArrayBlockingQueue",
"java.util.concurrent.BlockingQueue",
"org.junit.Assert"
] | import com.cloudera.flume.core.Event; import com.cloudera.flume.handlers.text.CustomDelimCursor; import com.cloudera.util.FileUtil; import java.io.File; import java.io.IOException; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import org.junit.Assert; | import com.cloudera.flume.core.*; import com.cloudera.flume.handlers.text.*; import com.cloudera.util.*; import java.io.*; import java.util.concurrent.*; import org.junit.*; | [
"com.cloudera.flume",
"com.cloudera.util",
"java.io",
"java.util",
"org.junit"
] | com.cloudera.flume; com.cloudera.util; java.io; java.util; org.junit; | 2,652,280 |
@Test(expected = IllegalStateException.class)
public void constructorCustom_fail_2() {
new DeviceId(DeviceIdType.DEVELOPER_SUPPLIED, (String) null, store, mock(ModuleLog.class), null);
} | @Test(expected = IllegalStateException.class) void function() { new DeviceId(DeviceIdType.DEVELOPER_SUPPLIED, (String) null, store, mock(ModuleLog.class), null); } | /**
* Expecting exception to be thrown when initialising with a bad value
* Hinting to be dev supplied but null string
*/ | Expecting exception to be thrown when initialising with a bad value Hinting to be dev supplied but null string | constructorCustom_fail_2 | {
"repo_name": "Countly/countly-sdk-android",
"path": "sdk/src/androidTest/java/ly/count/android/sdk/DeviceIdTests.java",
"license": "mit",
"size": 14429
} | [
"org.junit.Test",
"org.mockito.Mockito"
] | import org.junit.Test; import org.mockito.Mockito; | import org.junit.*; import org.mockito.*; | [
"org.junit",
"org.mockito"
] | org.junit; org.mockito; | 1,050,390 |
Bitmap createNewBitmapSStep(Bitmap bitmapItem, List<Integer> sequencesSize, int lastBitIndex, int maxGap) {
//INTERSECTION_COUNT++;
// create a new bitset that will be use for the new bitmap
BitSet newBitset = new BitSet(lastBitIndex);
// create the new bitmap
Bitmap newBitmap = new Bitmap(newBitset);
// We do an AND with the bitmap of the item and this bitmap
for (int bitK = bitmap.nextSetBit(0); bitK >= 0; bitK = bitmap.nextSetBit(bitK+1)) {
// find the sid of this bit
int sid = bitToSID(bitK, sequencesSize);
// get the last bit for this sid
int lastBitOfSID = lastBitOfSID(sid, sequencesSize, lastBitIndex);
boolean match = false;
for (int bit = bitmapItem.bitmap.nextSetBit(bitK+1); bit >= 0 && bit <= lastBitOfSID && (bit - bitK <=maxGap); bit = bitmapItem.bitmap.nextSetBit(bit+1)) {
// new
int tid = bit - sequencesSize.get(sid);
newBitmap.bitmap.set(bit);
match = true;
// System.out.println();
// System.out.println("bit " + bit);
// System.out.println("sid " + sid);
// System.out.println("seqSize " + sequencesSize.get(sid));
// System.out.println("tid " + tid);
if(firstItemsetID == -1 || tid < firstItemsetID){
firstItemsetID = tid;
}
}
if(match){
// update the support
if(sid != newBitmap.lastSID){
newBitmap.support++;
newBitmap.sidsum += sid;
}
newBitmap.lastSID = sid;
}
bitK = lastBitOfSID; // to skip the bit from the same sequence
}
// We return the resulting bitmap
return newBitmap;
} | Bitmap createNewBitmapSStep(Bitmap bitmapItem, List<Integer> sequencesSize, int lastBitIndex, int maxGap) { BitSet newBitset = new BitSet(lastBitIndex); Bitmap newBitmap = new Bitmap(newBitset); for (int bitK = bitmap.nextSetBit(0); bitK >= 0; bitK = bitmap.nextSetBit(bitK+1)) { int sid = bitToSID(bitK, sequencesSize); int lastBitOfSID = lastBitOfSID(sid, sequencesSize, lastBitIndex); boolean match = false; for (int bit = bitmapItem.bitmap.nextSetBit(bitK+1); bit >= 0 && bit <= lastBitOfSID && (bit - bitK <=maxGap); bit = bitmapItem.bitmap.nextSetBit(bit+1)) { int tid = bit - sequencesSize.get(sid); newBitmap.bitmap.set(bit); match = true; if(firstItemsetID == -1 tid < firstItemsetID){ firstItemsetID = tid; } } if(match){ if(sid != newBitmap.lastSID){ newBitmap.support++; newBitmap.sidsum += sid; } newBitmap.lastSID = sid; } bitK = lastBitOfSID; } return newBitmap; } | /**
* Create a new bitmap for the s-step by doing a AND between this
* bitmap and the bitmap of an item.
* @param bitmapItem the bitmap of the item used for the S-Step
* @param sequencesSize the sequence lengths
* @param lastBitIndex the last bit index
* @param maxGap
* @return return the new bitmap
*/ | Create a new bitmap for the s-step by doing a AND between this bitmap and the bitmap of an item | createNewBitmapSStep | {
"repo_name": "DeOlSo/ADC2015_De",
"path": "SequentialPatternMining/src/spmf/spam/Bitmap.java",
"license": "gpl-3.0",
"size": 7592
} | [
"java.util.BitSet",
"java.util.List"
] | import java.util.BitSet; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 454,103 |
@Test
public void testReadWriteOperations() {
String line = "adsawseeeeegqewgasddga";
byte[] inputBytes = line.getBytes();
inputBytes = Bytes.concat(new byte[] {(byte)22}, inputBytes);
DataInputBuffer in = new DataInputBuffer();
DataOutputBuffer out = new DataOutputBuffer();
Text text = new Text(line);
try {
in.reset(inputBytes, inputBytes.length);
text.readFields(in);
} catch(Exception ex) {
fail("testReadFields error !!!");
}
try {
text.write(out);
} catch(IOException ex) {
} catch(Exception ex) {
fail("testReadWriteOperations error !!!");
}
} | void function() { String line = STR; byte[] inputBytes = line.getBytes(); inputBytes = Bytes.concat(new byte[] {(byte)22}, inputBytes); DataInputBuffer in = new DataInputBuffer(); DataOutputBuffer out = new DataOutputBuffer(); Text text = new Text(line); try { in.reset(inputBytes, inputBytes.length); text.readFields(in); } catch(Exception ex) { fail(STR); } try { text.write(out); } catch(IOException ex) { } catch(Exception ex) { fail(STR); } } | /**
* test {@code Text} readFields/write operations
*/ | test Text readFields/write operations | testReadWriteOperations | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestText.java",
"license": "apache-2.0",
"size": 14361
} | [
"com.google.common.primitives.Bytes",
"java.io.IOException",
"org.junit.Assert"
] | import com.google.common.primitives.Bytes; import java.io.IOException; import org.junit.Assert; | import com.google.common.primitives.*; import java.io.*; import org.junit.*; | [
"com.google.common",
"java.io",
"org.junit"
] | com.google.common; java.io; org.junit; | 1,558,831 |
@Deprecated
public static Comparator<AbstractObjectImpl> getComparatorForTechnicalName() {
return null;
} | static Comparator<AbstractObjectImpl> function() { return null; } | /**
* Gets a comparator for sorting objects by technical name - type plus address. Appears to be unused, and currently
* only returns null, so do not use.
*
* @return null
*/ | Gets a comparator for sorting objects by technical name - type plus address. Appears to be unused, and currently only returns null, so do not use | getComparatorForTechnicalName | {
"repo_name": "blasd/apex-core",
"path": "mat/src/main/java/org/eclipse/mat/parser/model/AbstractObjectImpl.java",
"license": "mit",
"size": 8669
} | [
"java.util.Comparator"
] | import java.util.Comparator; | import java.util.*; | [
"java.util"
] | java.util; | 758,741 |
private static Method findJdk6SetWritableMethod() {
try {
return File.class.getMethod("setWritable", Boolean.class);
} catch (NoSuchMethodException e) {
return null;
}
} | static Method function() { try { return File.class.getMethod(STR, Boolean.class); } catch (NoSuchMethodException e) { return null; } } | /**
* File.setWritable appears in Java 6. If we find the method, we can use it
*/ | File.setWritable appears in Java 6. If we find the method, we can use it | findJdk6SetWritableMethod | {
"repo_name": "jmt4/Selenium2",
"path": "java/client/src/org/openqa/selenium/io/FileHandler.java",
"license": "apache-2.0",
"size": 9733
} | [
"java.io.File",
"java.lang.reflect.Method"
] | import java.io.File; import java.lang.reflect.Method; | import java.io.*; import java.lang.reflect.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 892,458 |
private void parseEntityConfigXMLFile() {
String fileName = this.entityConfigXMLFile;
File xmlFile = new File(fileName);
if (!xmlFile.exists()) {
if (DEFAULT_ENTITY_CONFIG_XML_FILE.equals(fileName)) {
// Default doesn't exist, no big deal
return;
} else {
throw new AdminXmlException(
LocalizedStrings.DistributedSystemConfigImpl_ENTITY_CONFIGURATION_XML_FILE_0_DOES_NOT_EXIST
.toLocalizedString(fileName));
}
}
try {
InputStream is = new FileInputStream(xmlFile);
try {
ManagedEntityConfigXmlParser.parse(is, this);
} finally {
is.close();
}
} catch (IOException ex) {
throw new AdminXmlException(
LocalizedStrings.DistributedSystemConfigImpl_WHILE_PARSING_0.toLocalizedString(fileName),
ex);
}
} | void function() { String fileName = this.entityConfigXMLFile; File xmlFile = new File(fileName); if (!xmlFile.exists()) { if (DEFAULT_ENTITY_CONFIG_XML_FILE.equals(fileName)) { return; } else { throw new AdminXmlException( LocalizedStrings.DistributedSystemConfigImpl_ENTITY_CONFIGURATION_XML_FILE_0_DOES_NOT_EXIST .toLocalizedString(fileName)); } } try { InputStream is = new FileInputStream(xmlFile); try { ManagedEntityConfigXmlParser.parse(is, this); } finally { is.close(); } } catch (IOException ex) { throw new AdminXmlException( LocalizedStrings.DistributedSystemConfigImpl_WHILE_PARSING_0.toLocalizedString(fileName), ex); } } | /**
* Parses the XML configuration file that describes managed entities.
*
* @throws AdminXmlException If a problem is encountered while parsing the XML file.
*/ | Parses the XML configuration file that describes managed entities | parseEntityConfigXMLFile | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/admin/internal/DistributedSystemConfigImpl.java",
"license": "apache-2.0",
"size": 37126
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"org.apache.geode.admin.AdminXmlException",
"org.apache.geode.internal.i18n.LocalizedStrings"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import org.apache.geode.admin.AdminXmlException; import org.apache.geode.internal.i18n.LocalizedStrings; | import java.io.*; import org.apache.geode.admin.*; import org.apache.geode.internal.i18n.*; | [
"java.io",
"org.apache.geode"
] | java.io; org.apache.geode; | 2,086,519 |
public static boolean hasQEmuDrivers() {
for (File drivers_file : new File[] { new File("/proc/tty/drivers"), new File("/proc/cpuinfo") }) {
if (drivers_file.exists() && drivers_file.canRead()) {
// We don't care to read much past things since info we care about should be inside here
byte[] data = new byte[1024];
try {
InputStream is = new FileInputStream(drivers_file);
is.read(data);
is.close();
} catch (Exception exception) {
exception.printStackTrace();
}
String driver_data = new String(data);
for (String known_qemu_driver : FindEmulator.known_qemu_drivers) {
if (driver_data.indexOf(known_qemu_driver) != -1) {
return true;
}
}
}
}
return false;
} | static boolean function() { for (File drivers_file : new File[] { new File(STR), new File(STR) }) { if (drivers_file.exists() && drivers_file.canRead()) { byte[] data = new byte[1024]; try { InputStream is = new FileInputStream(drivers_file); is.read(data); is.close(); } catch (Exception exception) { exception.printStackTrace(); } String driver_data = new String(data); for (String known_qemu_driver : FindEmulator.known_qemu_drivers) { if (driver_data.indexOf(known_qemu_driver) != -1) { return true; } } } } return false; } | /**
* Reads in the driver file, then checks a list for known QEmu drivers.
*
* @return {@code true} if any known drivers where found to exist or {@code false} if not.
*/ | Reads in the driver file, then checks a list for known QEmu drivers | hasQEmuDrivers | {
"repo_name": "0xABD/anti-emulator",
"path": "AntiEmulator/src/diff/strazzere/anti/emulator/FindEmulator.java",
"license": "lgpl-3.0",
"size": 10532
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.InputStream"
] | import java.io.File; import java.io.FileInputStream; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,357,415 |
public Object getValueData(Value value) throws KettleValueException
{
if (value==null || value.isNull()) return null;
// So far the old types and the new types map to the same thing.
// For compatibility we just ask the old-style value to convert to the new one.
// In the old transformation this would happen sooner or later anyway.
// It doesn't throw exceptions or complain either (unfortunately).
//
switch(getType())
{
case ValueMetaInterface.TYPE_STRING : return value.getString();
case ValueMetaInterface.TYPE_NUMBER : return value.getNumber();
case ValueMetaInterface.TYPE_INTEGER : return value.getInteger();
case ValueMetaInterface.TYPE_DATE : return value.getDate();
case ValueMetaInterface.TYPE_BOOLEAN : return value.getBoolean();
case ValueMetaInterface.TYPE_BIGNUMBER : return value.getBigNumber();
case ValueMetaInterface.TYPE_BINARY : return value.getBytes();
default: throw new KettleValueException(toString()+" : We can't convert original data type "+value.getTypeDesc()+" to a primitive data type");
}
} | Object function(Value value) throws KettleValueException { if (value==null value.isNull()) return null; switch(getType()) { case ValueMetaInterface.TYPE_STRING : return value.getString(); case ValueMetaInterface.TYPE_NUMBER : return value.getNumber(); case ValueMetaInterface.TYPE_INTEGER : return value.getInteger(); case ValueMetaInterface.TYPE_DATE : return value.getDate(); case ValueMetaInterface.TYPE_BOOLEAN : return value.getBoolean(); case ValueMetaInterface.TYPE_BIGNUMBER : return value.getBigNumber(); case ValueMetaInterface.TYPE_BINARY : return value.getBytes(); default: throw new KettleValueException(toString()+STR+value.getTypeDesc()+STR); } } | /**
* Extracts the primitive data from an old style Value object
* @param value the old style Value object
* @return the value's data, NOT the meta data.
* @throws KettleValueException case there is a data conversion problem
*/ | Extracts the primitive data from an old style Value object | getValueData | {
"repo_name": "panbasten/imeta",
"path": "imeta2.x/imeta-src/imeta-core/src/main/java/com/panet/imeta/core/row/ValueMeta.java",
"license": "gpl-2.0",
"size": 136462
} | [
"com.panet.imeta.compatibility.Value",
"com.panet.imeta.core.exception.KettleValueException"
] | import com.panet.imeta.compatibility.Value; import com.panet.imeta.core.exception.KettleValueException; | import com.panet.imeta.compatibility.*; import com.panet.imeta.core.exception.*; | [
"com.panet.imeta"
] | com.panet.imeta; | 2,668,217 |
public static Document loadXMLFile( FileObject fileObject ) throws KettleXMLException {
return loadXMLFile( fileObject, null, false, false );
} | static Document function( FileObject fileObject ) throws KettleXMLException { return loadXMLFile( fileObject, null, false, false ); } | /**
* Load a file into an XML document
*
* @param fileObject The fileObject to load into a document
* @return the Document if all went well, null if an error occured!
*/ | Load a file into an XML document | loadXMLFile | {
"repo_name": "ccaspanello/pentaho-kettle",
"path": "core/src/main/java/org/pentaho/di/core/xml/XMLHandler.java",
"license": "apache-2.0",
"size": 37476
} | [
"org.apache.commons.vfs2.FileObject",
"org.pentaho.di.core.exception.KettleXMLException",
"org.w3c.dom.Document"
] | import org.apache.commons.vfs2.FileObject; import org.pentaho.di.core.exception.KettleXMLException; import org.w3c.dom.Document; | import org.apache.commons.vfs2.*; import org.pentaho.di.core.exception.*; import org.w3c.dom.*; | [
"org.apache.commons",
"org.pentaho.di",
"org.w3c.dom"
] | org.apache.commons; org.pentaho.di; org.w3c.dom; | 1,515,661 |
private void createTreeSyncHandlers(ModelContentMergeTabFolder... parts) {
if (parts.length < 2) {
throw new IllegalArgumentException(EMFCompareUIMessages
.getString("ModelContentMergeViewer.illegalSync")); //$NON-NLS-1$
}
handleHSync(leftPart.getTreePart(), rightPart.getTreePart(), ancestorPart.getTreePart());
handleHSync(rightPart.getTreePart(), leftPart.getTreePart(), ancestorPart.getTreePart());
handleHSync(ancestorPart.getTreePart(), rightPart.getTreePart(), leftPart.getTreePart());
}
| void function(ModelContentMergeTabFolder... parts) { if (parts.length < 2) { throw new IllegalArgumentException(EMFCompareUIMessages .getString(STR)); } handleHSync(leftPart.getTreePart(), rightPart.getTreePart(), ancestorPart.getTreePart()); handleHSync(rightPart.getTreePart(), leftPart.getTreePart(), ancestorPart.getTreePart()); handleHSync(ancestorPart.getTreePart(), rightPart.getTreePart(), leftPart.getTreePart()); } | /**
* Takes care of the creation of the synchronization handlers for the tree tab of our viewer parts.
*
* @param parts
* The other parts to synchronize with.
*/ | Takes care of the creation of the synchronization handlers for the tree tab of our viewer parts | createTreeSyncHandlers | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/workbench/ui/com.odcgroup.workbench.compare/src/main/java/com/odcgroup/workbench/compare/viewer/content/BaseModelContentMergeViewer.java",
"license": "epl-1.0",
"size": 8255
} | [
"org.eclipse.emf.compare.ui.EMFCompareUIMessages",
"org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder"
] | import org.eclipse.emf.compare.ui.EMFCompareUIMessages; import org.eclipse.emf.compare.ui.viewer.content.part.ModelContentMergeTabFolder; | import org.eclipse.emf.compare.ui.*; import org.eclipse.emf.compare.ui.viewer.content.part.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,173,575 |
public void doCancel_reorder(RunData data)
{
SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());
// back to the list view of assignments
state.setAttribute(STATE_MODE, MODE_LIST_ASSIGNMENTS);
} // doCancel_reorder
| void function(RunData data) { SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); state.setAttribute(STATE_MODE, MODE_LIST_ASSIGNMENTS); } | /**
* Action is to cancel the reorder process
*/ | Action is to cancel the reorder process | doCancel_reorder | {
"repo_name": "frasese/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 686269
} | [
"org.sakaiproject.cheftool.JetspeedRunData",
"org.sakaiproject.cheftool.RunData",
"org.sakaiproject.event.api.SessionState"
] | import org.sakaiproject.cheftool.JetspeedRunData; import org.sakaiproject.cheftool.RunData; import org.sakaiproject.event.api.SessionState; | import org.sakaiproject.cheftool.*; import org.sakaiproject.event.api.*; | [
"org.sakaiproject.cheftool",
"org.sakaiproject.event"
] | org.sakaiproject.cheftool; org.sakaiproject.event; | 1,496,890 |
public boolean compatible(TypeId otherType)
{
return convertible(otherType,false);
} | boolean function(TypeId otherType) { return convertible(otherType,false); } | /**
* Tell whether this type (LOB) is compatible with the given type.
*
* @param otherType The TypeId of the other type.
*/ | Tell whether this type (LOB) is compatible with the given type | compatible | {
"repo_name": "kavin256/Derby",
"path": "java/engine/org/apache/derby/impl/sql/compile/LOBTypeCompiler.java",
"license": "apache-2.0",
"size": 4229
} | [
"org.apache.derby.iapi.types.TypeId"
] | import org.apache.derby.iapi.types.TypeId; | import org.apache.derby.iapi.types.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,400,994 |
TriggerDefinitionImpl triggerDefinitionImpl = new TriggerDefinitionImpl(triggerDefinitionCreator.getScopeId());
triggerDefinitionImpl.setName(triggerDefinitionCreator.getName());
triggerDefinitionImpl.setDescription(triggerDefinitionCreator.getDescription());
triggerDefinitionImpl.setProcessorName(triggerDefinitionCreator.getProcessorName());
triggerDefinitionImpl.setTriggerProperties(triggerDefinitionCreator.getTriggerProperties());
return ServiceDAO.create(em, triggerDefinitionImpl);
} | TriggerDefinitionImpl triggerDefinitionImpl = new TriggerDefinitionImpl(triggerDefinitionCreator.getScopeId()); triggerDefinitionImpl.setName(triggerDefinitionCreator.getName()); triggerDefinitionImpl.setDescription(triggerDefinitionCreator.getDescription()); triggerDefinitionImpl.setProcessorName(triggerDefinitionCreator.getProcessorName()); triggerDefinitionImpl.setTriggerProperties(triggerDefinitionCreator.getTriggerProperties()); return ServiceDAO.create(em, triggerDefinitionImpl); } | /**
* Creates and return new TriggerDefinition
*
* @param em The {@link EntityManager} that owns the transaction.
* @param triggerDefinitionCreator The {@link TriggerDefinitionCreator} to persist.
* @return The newly created {@link TriggerDefinition}
* @since 1.1.0
*/ | Creates and return new TriggerDefinition | create | {
"repo_name": "stzilli/kapua",
"path": "service/scheduler/quartz/src/main/java/org/eclipse/kapua/service/scheduler/trigger/definition/quartz/TriggerDefinitionDAO.java",
"license": "epl-1.0",
"size": 7090
} | [
"org.eclipse.kapua.commons.service.internal.ServiceDAO"
] | import org.eclipse.kapua.commons.service.internal.ServiceDAO; | import org.eclipse.kapua.commons.service.internal.*; | [
"org.eclipse.kapua"
] | org.eclipse.kapua; | 248,908 |
@Deprecated
public void deleteLocalFiles() throws IOException {
String[] localDirs = getLocalDirs();
for (int i = 0; i < localDirs.length; i++) {
FileSystem.getLocal(this).delete(new Path(localDirs[i]), true);
}
} | void function() throws IOException { String[] localDirs = getLocalDirs(); for (int i = 0; i < localDirs.length; i++) { FileSystem.getLocal(this).delete(new Path(localDirs[i]), true); } } | /**
* Use MRAsyncDiskService.moveAndDeleteAllVolumes instead.
*/ | Use MRAsyncDiskService.moveAndDeleteAllVolumes instead | deleteLocalFiles | {
"repo_name": "xiao-chen/hadoop",
"path": "hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/JobConf.java",
"license": "apache-2.0",
"size": 75549
} | [
"java.io.IOException",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path"
] | import java.io.IOException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,453,488 |
Reader openReader(boolean ignoreEncodingErrors) throws IOException; | Reader openReader(boolean ignoreEncodingErrors) throws IOException; | /**
* Opens this file for reading and returns a reader.
*
* @param ignoreEncodingErrors <code>true</code> when encoding errors should be ignored
* <code>false</code> otherwise
* @return a reader for reading this file object
*
* @throws IOException if an I/O error occurs
* @throws IllegalStateException if this file was opened for writing and
* does not support reading
* @throws UnsupportedOperationException if this kind of file does not allow
* character reading
*/ | Opens this file for reading and returns a reader | openReader | {
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/javax/tools/FileObject.java",
"license": "gpl-2.0",
"size": 5519
} | [
"java.io.IOException",
"java.io.Reader"
] | import java.io.IOException; import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 2,135,495 |
public AudioFileFormat getAudioFileFormat(URL url) throws UnsupportedAudioFileException, IOException
{
if (TDebug.TraceAudioFileReader) {TDebug.out("MpegAudioFileReader.getAudioFileFormat(URL): begin"); }
long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED;
URLConnection conn = url.openConnection();
// Tell shoucast server (if any) that SPI support shoutcast stream.
conn.setRequestProperty ("Icy-Metadata", "1");
InputStream inputStream = conn.getInputStream();
AudioFileFormat audioFileFormat = null;
try
{
audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes);
}
finally
{
inputStream.close();
}
if (TDebug.TraceAudioFileReader) {TDebug.out("MpegAudioFileReader.getAudioFileFormat(URL): end"); }
return audioFileFormat;
}
| AudioFileFormat function(URL url) throws UnsupportedAudioFileException, IOException { if (TDebug.TraceAudioFileReader) {TDebug.out(STR); } long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED; URLConnection conn = url.openConnection(); conn.setRequestProperty (STR, "1"); InputStream inputStream = conn.getInputStream(); AudioFileFormat audioFileFormat = null; try { audioFileFormat = getAudioFileFormat(inputStream, lFileLengthInBytes); } finally { inputStream.close(); } if (TDebug.TraceAudioFileReader) {TDebug.out(STR); } return audioFileFormat; } | /**
* Returns AudioFileFormat from URL.
*/ | Returns AudioFileFormat from URL | getAudioFileFormat | {
"repo_name": "knocte/getittogether",
"path": "src/javazoom/spi/mpeg/sampled/file/MpegAudioFileReader.java",
"license": "gpl-2.0",
"size": 25941
} | [
"java.io.IOException",
"java.io.InputStream",
"java.net.URLConnection",
"javax.sound.sampled.AudioFileFormat",
"javax.sound.sampled.AudioSystem",
"javax.sound.sampled.UnsupportedAudioFileException",
"org.tritonus.share.TDebug"
] | import java.io.IOException; import java.io.InputStream; import java.net.URLConnection; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.UnsupportedAudioFileException; import org.tritonus.share.TDebug; | import java.io.*; import java.net.*; import javax.sound.sampled.*; import org.tritonus.share.*; | [
"java.io",
"java.net",
"javax.sound",
"org.tritonus.share"
] | java.io; java.net; javax.sound; org.tritonus.share; | 181,229 |
@Test (groups = {"readLocalFiles"})
public void clear10() throws Exception {
TransformerFactory tfactory = TransformerFactory.newInstance();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new File(XSL_FILE));
DOMSource domSource = new DOMSource((Node)document);
Transformer transformer = tfactory.newTransformer(domSource);
transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE);
transformer.clearParameters();
assertNull(transformer.getParameter(LONG_PARAM_NAME));
} | @Test (groups = {STR}) void function() throws Exception { TransformerFactory tfactory = TransformerFactory.newInstance(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder db = dbf.newDocumentBuilder(); Document document = db.parse(new File(XSL_FILE)); DOMSource domSource = new DOMSource((Node)document); Transformer transformer = tfactory.newTransformer(domSource); transformer.setParameter(LONG_PARAM_NAME, PARAM_VALUE); transformer.clearParameters(); assertNull(transformer.getParameter(LONG_PARAM_NAME)); } | /**
* Obtains transformer's parameter whose initiated with a dom source with
* the a name that wasn't set before. Null is expected.
* @throws Exception If any errors occur.
*/ | Obtains transformer's parameter whose initiated with a dom source with the a name that wasn't set before. Null is expected | clear10 | {
"repo_name": "lostdj/Jaklin-OpenJDK-JAXP",
"path": "test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TfClearParamTest.java",
"license": "gpl-2.0",
"size": 9504
} | [
"java.io.File",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.transform.Transformer",
"javax.xml.transform.TransformerFactory",
"javax.xml.transform.dom.DOMSource",
"org.testng.Assert",
"org.testng.annotations.Test",
"org.w3c.dom.Document",
"org.w3c.dom.Node"
] | import java.io.File; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import org.testng.Assert; import org.testng.annotations.Test; import org.w3c.dom.Document; import org.w3c.dom.Node; | import java.io.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.*; import org.testng.*; import org.testng.annotations.*; import org.w3c.dom.*; | [
"java.io",
"javax.xml",
"org.testng",
"org.testng.annotations",
"org.w3c.dom"
] | java.io; javax.xml; org.testng; org.testng.annotations; org.w3c.dom; | 2,558,629 |
static public void registerTempFile(@NonNull File tmpf) {
ConversationContext cc = getCurrentConversation();
cc.registerTempFile(tmpf);
} | static void function(@NonNull File tmpf) { ConversationContext cc = getCurrentConversation(); cc.registerTempFile(tmpf); } | /**
* Register a file as a file/directory to be deleted when the conversation terminates.
*/ | Register a file as a file/directory to be deleted when the conversation terminates | registerTempFile | {
"repo_name": "fjalvingh/domui",
"path": "to.etc.domui/src/main/java/to/etc/domui/state/UIContext.java",
"license": "lgpl-2.1",
"size": 7905
} | [
"java.io.File",
"org.eclipse.jdt.annotation.NonNull"
] | import java.io.File; import org.eclipse.jdt.annotation.NonNull; | import java.io.*; import org.eclipse.jdt.annotation.*; | [
"java.io",
"org.eclipse.jdt"
] | java.io; org.eclipse.jdt; | 942,492 |
void genericPropertyTest(ASTNode node, Property prop) {
ASTNode x1 = prop.sample(node.getAST(), false);
prop.set(x1);
assertTrue(prop.get() == x1);
assertTrue(x1.getParent() == node);
// check handling of null
if (prop.isCompulsory()) {
try {
prop.set(null);
} catch (RuntimeException e) {
// pass
}
} else {
long previousCount = node.getAST().modificationCount();
prop.set(null);
assertTrue(prop.get() == null);
assertTrue(node.getAST().modificationCount() > previousCount);
}
// check that a child from a different AST is detected
try {
AST newAST = AST.newAST(node.getAST().apiLevel());
prop.set(prop.sample(newAST, false));
assertTrue(false);
} catch (RuntimeException e) {
// pass
}
// check that a child with a parent is detected
try {
ASTNode b1 = prop.sample(node.getAST(), true);
prop.set(b1); // bogus: already has parent
assertTrue(false);
} catch (RuntimeException e) {
// pass
}
// check that a cycle is detected
assertTrue(node.getParent() == null);
ASTNode s1 = null;
try {
s1 = prop.wrap();
if (s1 != null) {
prop.set(s1); // bogus: creates a cycle
assertTrue(false);
}
} catch (RuntimeException e) {
// pass
} finally {
if (s1 != null) {
prop.unwrap();
assertTrue(node.getParent() == null);
}
}
// check that a child of the wrong type is detected
ASTNode b1[] = prop.counterExamples(node.getAST());
for (int i = 0; i < b1.length; i++) {
try {
prop.set(b1[i]); // bogus: wrong type
assertTrue(false);
} catch (RuntimeException e) {
// pass
}
}
} | void genericPropertyTest(ASTNode node, Property prop) { ASTNode x1 = prop.sample(node.getAST(), false); prop.set(x1); assertTrue(prop.get() == x1); assertTrue(x1.getParent() == node); if (prop.isCompulsory()) { try { prop.set(null); } catch (RuntimeException e) { } } else { long previousCount = node.getAST().modificationCount(); prop.set(null); assertTrue(prop.get() == null); assertTrue(node.getAST().modificationCount() > previousCount); } try { AST newAST = AST.newAST(node.getAST().apiLevel()); prop.set(prop.sample(newAST, false)); assertTrue(false); } catch (RuntimeException e) { } try { ASTNode b1 = prop.sample(node.getAST(), true); prop.set(b1); assertTrue(false); } catch (RuntimeException e) { } assertTrue(node.getParent() == null); ASTNode s1 = null; try { s1 = prop.wrap(); if (s1 != null) { prop.set(s1); assertTrue(false); } } catch (RuntimeException e) { } finally { if (s1 != null) { prop.unwrap(); assertTrue(node.getParent() == null); } } ASTNode b1[] = prop.counterExamples(node.getAST()); for (int i = 0; i < b1.length; i++) { try { prop.set(b1[i]); assertTrue(false); } catch (RuntimeException e) { } } } | /**
* Exercises the given property of the given node.
*
* @param node the node to test
* @param prop the property descriptor
*/ | Exercises the given property of the given node | genericPropertyTest | {
"repo_name": "echoes-tech/eclipse.jsdt.core",
"path": "org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java",
"license": "epl-1.0",
"size": 247621
} | [
"org.eclipse.wst.jsdt.core.dom.AST",
"org.eclipse.wst.jsdt.core.dom.ASTNode"
] | import org.eclipse.wst.jsdt.core.dom.AST; import org.eclipse.wst.jsdt.core.dom.ASTNode; | import org.eclipse.wst.jsdt.core.dom.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 1,186,499 |
@Test
public void testMoveMessagesWithFilter() throws Exception {
SimpleString key = new SimpleString("key");
long matchingValue = RandomUtil.randomLong();
long unmatchingValue = matchingValue + 1;
SimpleString address = RandomUtil.randomSimpleString();
SimpleString queue = RandomUtil.randomSimpleString();
SimpleString otherAddress = RandomUtil.randomSimpleString();
SimpleString otherQueue = RandomUtil.randomSimpleString();
session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable));
session.createQueue(new QueueConfiguration(otherQueue).setAddress(otherAddress).setDurable(durable));
ClientProducer producer = session.createProducer(address);
// send on queue
ClientMessage matchingMessage = session.createMessage(durable);
matchingMessage.putLongProperty(key, matchingValue);
producer.send(matchingMessage);
ClientMessage unmatchingMessage = session.createMessage(durable);
unmatchingMessage.putLongProperty(key, unmatchingValue);
producer.send(unmatchingMessage);
QueueControl queueControl = createManagementControl(address, queue);
assertMessageMetrics(queueControl, 2, durable);
// moved matching messages to otherQueue
int movedMatchedMessagesCount = queueControl.moveMessages(key + " =" + matchingValue, otherQueue.toString());
Assert.assertEquals(1, movedMatchedMessagesCount);
Assert.assertEquals(1, getMessageCount(queueControl));
// consume the unmatched message from queue
ClientConsumer consumer = session.createConsumer(queue);
ClientMessage m = consumer.receive(500);
Assert.assertNotNull(m);
Assert.assertEquals(unmatchingValue, m.getObjectProperty(key));
// consume the matched message from otherQueue
ClientConsumer otherConsumer = session.createConsumer(otherQueue);
m = otherConsumer.receive(500);
Assert.assertNotNull(m);
Assert.assertEquals(matchingValue, m.getObjectProperty(key));
m.acknowledge();
consumer.close();
session.deleteQueue(queue);
otherConsumer.close();
session.deleteQueue(otherQueue);
} | void function() throws Exception { SimpleString key = new SimpleString("key"); long matchingValue = RandomUtil.randomLong(); long unmatchingValue = matchingValue + 1; SimpleString address = RandomUtil.randomSimpleString(); SimpleString queue = RandomUtil.randomSimpleString(); SimpleString otherAddress = RandomUtil.randomSimpleString(); SimpleString otherQueue = RandomUtil.randomSimpleString(); session.createQueue(new QueueConfiguration(queue).setAddress(address).setDurable(durable)); session.createQueue(new QueueConfiguration(otherQueue).setAddress(otherAddress).setDurable(durable)); ClientProducer producer = session.createProducer(address); ClientMessage matchingMessage = session.createMessage(durable); matchingMessage.putLongProperty(key, matchingValue); producer.send(matchingMessage); ClientMessage unmatchingMessage = session.createMessage(durable); unmatchingMessage.putLongProperty(key, unmatchingValue); producer.send(unmatchingMessage); QueueControl queueControl = createManagementControl(address, queue); assertMessageMetrics(queueControl, 2, durable); int movedMatchedMessagesCount = queueControl.moveMessages(key + STR + matchingValue, otherQueue.toString()); Assert.assertEquals(1, movedMatchedMessagesCount); Assert.assertEquals(1, getMessageCount(queueControl)); ClientConsumer consumer = session.createConsumer(queue); ClientMessage m = consumer.receive(500); Assert.assertNotNull(m); Assert.assertEquals(unmatchingValue, m.getObjectProperty(key)); ClientConsumer otherConsumer = session.createConsumer(otherQueue); m = otherConsumer.receive(500); Assert.assertNotNull(m); Assert.assertEquals(matchingValue, m.getObjectProperty(key)); m.acknowledge(); consumer.close(); session.deleteQueue(queue); otherConsumer.close(); session.deleteQueue(otherQueue); } | /**
* <ol>
* <li>send 2 message to queue</li>
* <li>move messages from queue to otherQueue using management method <em>with filter</em></li>
* <li>consume the message which <strong>did not</strong> matches the filter from queue</li>
* <li>consume the message which <strong>did</strong> matches the filter from otherQueue</li>
* </ol>
*/ | send 2 message to queue move messages from queue to otherQueue using management method with filter consume the message which did not matches the filter from queue consume the message which did matches the filter from otherQueue | testMoveMessagesWithFilter | {
"repo_name": "kjniemi/activemq-artemis",
"path": "tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/QueueControlTest.java",
"license": "apache-2.0",
"size": 145540
} | [
"org.apache.activemq.artemis.api.core.QueueConfiguration",
"org.apache.activemq.artemis.api.core.SimpleString",
"org.apache.activemq.artemis.api.core.client.ClientConsumer",
"org.apache.activemq.artemis.api.core.client.ClientMessage",
"org.apache.activemq.artemis.api.core.client.ClientProducer",
"org.apache.activemq.artemis.api.core.management.QueueControl",
"org.apache.activemq.artemis.utils.RandomUtil",
"org.junit.Assert"
] | import org.apache.activemq.artemis.api.core.QueueConfiguration; import org.apache.activemq.artemis.api.core.SimpleString; import org.apache.activemq.artemis.api.core.client.ClientConsumer; import org.apache.activemq.artemis.api.core.client.ClientMessage; import org.apache.activemq.artemis.api.core.client.ClientProducer; import org.apache.activemq.artemis.api.core.management.QueueControl; import org.apache.activemq.artemis.utils.RandomUtil; import org.junit.Assert; | import org.apache.activemq.artemis.api.core.*; import org.apache.activemq.artemis.api.core.client.*; import org.apache.activemq.artemis.api.core.management.*; import org.apache.activemq.artemis.utils.*; import org.junit.*; | [
"org.apache.activemq",
"org.junit"
] | org.apache.activemq; org.junit; | 2,314,683 |
public PartitionElement getContainerPartitionElement() {
return item.getContainerPartitionElement();
} | PartitionElement function() { return item.getContainerPartitionElement(); } | /**
* Return the encapsulate Low Level API object.
*/ | Return the encapsulate Low Level API object | getContainerPartitionElement | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/integers/hlapi/GreaterThanOrEqualHLAPI.java",
"license": "epl-1.0",
"size": 70100
} | [
"fr.lip6.move.pnml.pthlpng.partitions.PartitionElement"
] | import fr.lip6.move.pnml.pthlpng.partitions.PartitionElement; | import fr.lip6.move.pnml.pthlpng.partitions.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 128,284 |
public static Properties loadProperties(String projectName, String path) {
Properties applicationProps = loadDefaultProperties();
final File file = new File(path + projectName + ".properties");
try {
logger.debug("try to read from file=" + file.getName() + ", path=" + file.getAbsolutePath());
if (ProjectMetaData.getInstance().isXmlFromResources()) {
final InputStream inputStream = ViewProperties.class.getResourceAsStream(file.toString());
if (inputStream != null) {
applicationProps.load(inputStream);
inputStream.close();
}
} else {
final InputStream in = new FileInputStream(file);
applicationProps.load(in);
in.close();
}
} catch (FileNotFoundException e) {
logger.info("cannot find "+file.toString()+". Fall back to default properties.");
} catch (IOException e) {
e.printStackTrace();
}
return applicationProps;
}
| static Properties function(String projectName, String path) { Properties applicationProps = loadDefaultProperties(); final File file = new File(path + projectName + STR); try { logger.debug(STR + file.getName() + STR + file.getAbsolutePath()); if (ProjectMetaData.getInstance().isXmlFromResources()) { final InputStream inputStream = ViewProperties.class.getResourceAsStream(file.toString()); if (inputStream != null) { applicationProps.load(inputStream); inputStream.close(); } } else { final InputStream in = new FileInputStream(file); applicationProps.load(in); in.close(); } } catch (FileNotFoundException e) { logger.info(STR+file.toString()+STR); } catch (IOException e) { e.printStackTrace(); } return applicationProps; } | /**
* Load default properties and overwrites them with project specific properties if available
*
* @param projectName
* @param path
* @return properties
*/ | Load default properties and overwrites them with project specific properties if available | loadProperties | {
"repo_name": "popikyardo/movsim-extended",
"path": "viewer/src/main/java/org/movsim/viewer/ui/ViewProperties.java",
"license": "gpl-3.0",
"size": 3114
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream",
"java.util.Properties",
"org.movsim.input.ProjectMetaData"
] | import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import org.movsim.input.ProjectMetaData; | import java.io.*; import java.util.*; import org.movsim.input.*; | [
"java.io",
"java.util",
"org.movsim.input"
] | java.io; java.util; org.movsim.input; | 2,767,734 |
@Override
public Date unmarshal(String v) throws ParseException
{
return StringUtils.isEmpty(v) ? null : formatter.parse(v);
} | Date function(String v) throws ParseException { return StringUtils.isEmpty(v) ? null : formatter.parse(v); } | /**
* Parse the string into a Date object.
*
* @param v The string to parse.
*
* @return A {@code Date} object for the string, or null if {@code v} is null.
*
* @throws ParseException if the string cannot be parsed.
*/ | Parse the string into a Date object | unmarshal | {
"repo_name": "espre05/clarityclient",
"path": "src/main/java/org/cruk/genologics/api/jaxb/LongTimestampAdapter.java",
"license": "gpl-3.0",
"size": 2176
} | [
"java.text.ParseException",
"java.util.Date",
"org.springframework.util.StringUtils"
] | import java.text.ParseException; import java.util.Date; import org.springframework.util.StringUtils; | import java.text.*; import java.util.*; import org.springframework.util.*; | [
"java.text",
"java.util",
"org.springframework.util"
] | java.text; java.util; org.springframework.util; | 2,489,430 |
public AuthorizationRuleInner withRights(List<AccessRights> rights) {
this.rights = rights;
return this;
} | AuthorizationRuleInner function(List<AccessRights> rights) { this.rights = rights; return this; } | /**
* Set the rights associated with the rule.
*
* @param rights the rights value to set
* @return the AuthorizationRuleInner object itself.
*/ | Set the rights associated with the rule | withRights | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/relay/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/implementation/AuthorizationRuleInner.java",
"license": "mit",
"size": 1327
} | [
"com.microsoft.azure.management.relay.v2017_04_01.AccessRights",
"java.util.List"
] | import com.microsoft.azure.management.relay.v2017_04_01.AccessRights; import java.util.List; | import com.microsoft.azure.management.relay.v2017_04_01.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 224,000 |
Transformer getTransformer(Object xslt, String systemId) throws JspException {
if (xslt == null) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XSLT_IS_NULL"));
}
Source source;
if (xslt instanceof Source) {
source = (Source) xslt;
} else {
if (xslt instanceof String) {
String s = (String) xslt;
s = s.trim();
if (s.length() == 0) {
throw new JspTagException(Resources.getMessage("TRANSFORM_XSLT_IS_EMPTY"));
}
xslt = new StringReader(s);
}
if (xslt instanceof Reader) {
source = getSource((Reader) xslt, systemId);
} else {
throw new JspTagException(Resources.getMessage("TRANSFORM_XSLT_UNSUPPORTED_TYPE", xslt.getClass()));
}
}
try {
return tf.newTransformer(source);
} catch (TransformerConfigurationException e) {
throw new JspTagException(e);
}
} | Transformer getTransformer(Object xslt, String systemId) throws JspException { if (xslt == null) { throw new JspTagException(Resources.getMessage(STR)); } Source source; if (xslt instanceof Source) { source = (Source) xslt; } else { if (xslt instanceof String) { String s = (String) xslt; s = s.trim(); if (s.length() == 0) { throw new JspTagException(Resources.getMessage(STR)); } xslt = new StringReader(s); } if (xslt instanceof Reader) { source = getSource((Reader) xslt, systemId); } else { throw new JspTagException(Resources.getMessage(STR, xslt.getClass())); } } try { return tf.newTransformer(source); } catch (TransformerConfigurationException e) { throw new JspTagException(e); } } | /**
* Create a Transformer from the xslt attribute.
*
* @param xslt the xslt attribute
* @param systemId the systemId for the transform
* @return an XSLT transformer
* @throws JspException if there was a problem creating the transformer
*/ | Create a Transformer from the xslt attribute | getTransformer | {
"repo_name": "wolfc/jboss-jstl-api_spec",
"path": "src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java",
"license": "apache-2.0",
"size": 15181
} | [
"java.io.Reader",
"java.io.StringReader",
"javax.servlet.jsp.JspException",
"javax.servlet.jsp.JspTagException",
"javax.xml.transform.Source",
"javax.xml.transform.Transformer",
"javax.xml.transform.TransformerConfigurationException",
"org.apache.taglibs.standard.resources.Resources"
] | import java.io.Reader; import java.io.StringReader; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspTagException; import javax.xml.transform.Source; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerConfigurationException; import org.apache.taglibs.standard.resources.Resources; | import java.io.*; import javax.servlet.jsp.*; import javax.xml.transform.*; import org.apache.taglibs.standard.resources.*; | [
"java.io",
"javax.servlet",
"javax.xml",
"org.apache.taglibs"
] | java.io; javax.servlet; javax.xml; org.apache.taglibs; | 2,808,368 |
public static MavenEmbedder createEmbedder(TaskListener listener, AbstractProject<?,?> project, String profiles) throws MavenEmbedderException, IOException, InterruptedException {
MavenInstallation m=null;
if (project instanceof ProjectWithMaven)
m = ((ProjectWithMaven) project).inferMavenInstallation().forNode(Jenkins.getInstance(),listener);
return createEmbedder(listener,m!=null?m.getHomeDir():null,profiles);
} | static MavenEmbedder function(TaskListener listener, AbstractProject<?,?> project, String profiles) throws MavenEmbedderException, IOException, InterruptedException { MavenInstallation m=null; if (project instanceof ProjectWithMaven) m = ((ProjectWithMaven) project).inferMavenInstallation().forNode(Jenkins.getInstance(),listener); return createEmbedder(listener,m!=null?m.getHomeDir():null,profiles); } | /**
* This version tries to infer mavenHome by looking at a project.
*
* @see #createEmbedder(TaskListener, File, String)
*/ | This version tries to infer mavenHome by looking at a project | createEmbedder | {
"repo_name": "lvotypko/jenkins",
"path": "maven-plugin/src/main/java/hudson/maven/MavenUtil.java",
"license": "mit",
"size": 15865
} | [
"hudson.model.AbstractProject",
"hudson.model.TaskListener",
"hudson.tasks.Maven",
"java.io.IOException"
] | import hudson.model.AbstractProject; import hudson.model.TaskListener; import hudson.tasks.Maven; import java.io.IOException; | import hudson.model.*; import hudson.tasks.*; import java.io.*; | [
"hudson.model",
"hudson.tasks",
"java.io"
] | hudson.model; hudson.tasks; java.io; | 2,007,014 |
public JarEntry getJarEntry() throws IOException {
if (!connected) {
connect();
}
if (entryName == null) {
return null;
}
// The entry must exist since the connect succeeded
return getJarFile().getJarEntry(entryName);
} | JarEntry function() throws IOException { if (!connected) { connect(); } if (entryName == null) { return null; } return getJarFile().getJarEntry(entryName); } | /**
* Gets the {@code JarEntry} object of the entry referenced by this {@code
* JarURLConnection}.
*
* @return the referenced {@code JarEntry} object or {@code null} if no
* entry name is specified.
* @throws IOException
* if an error occurs while getting the file or file-entry.
*/ | Gets the JarEntry object of the entry referenced by this JarURLConnection | getJarEntry | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/java/net/JarURLConnection.java",
"license": "apache-2.0",
"size": 6699
} | [
"java.io.IOException",
"java.util.jar.JarEntry"
] | import java.io.IOException; import java.util.jar.JarEntry; | import java.io.*; import java.util.jar.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,123,267 |
public synchronized Set<String> getNames() {
if (map == null) {
return Collections.<String>emptySet();
}
return Collections.unmodifiableSet(map.keySet());
} | synchronized Set<String> function() { if (map == null) { return Collections.<String>emptySet(); } return Collections.unmodifiableSet(map.keySet()); } | /**
* Returns a Set of the names that can be used to get
* values of the private data.
*
* @return a Set of the names.
*/ | Returns a Set of the names that can be used to get values of the private data | getNames | {
"repo_name": "Soo000/SooChat",
"path": "src/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java",
"license": "apache-2.0",
"size": 4164
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,177,850 |
private void requestThumbnails() {
// Copy mWantThumbnails to an array
int indices[] = new int[mWantThumbnails.size()];
for (int i = 0; i < mWantThumbnails.size(); i++) {
indices[i] = mWantThumbnails.get(i);
}
// Put them in the pending set
mPending.addAll(mWantThumbnails);
ApiService.getMediaItemThumbnails(getContext(), mProjectPath,
mMediaItem.getId(), mThumbnailWidth, mThumbnailHeight,
mBeginTimeMs, mEndTimeMs, mNumberOfThumbnails, mGeneration,
indices);
} | void function() { int indices[] = new int[mWantThumbnails.size()]; for (int i = 0; i < mWantThumbnails.size(); i++) { indices[i] = mWantThumbnails.get(i); } mPending.addAll(mWantThumbnails); ApiService.getMediaItemThumbnails(getContext(), mProjectPath, mMediaItem.getId(), mThumbnailWidth, mThumbnailHeight, mBeginTimeMs, mEndTimeMs, mNumberOfThumbnails, mGeneration, indices); } | /**
* Requests the thumbnails in mWantThumbnails (which is filled by onDraw).
*/ | Requests the thumbnails in mWantThumbnails (which is filled by onDraw) | requestThumbnails | {
"repo_name": "ArgonMobileGroup/VideoEditor",
"path": "src/com/android/videoeditor/widgets/MediaItemView.java",
"license": "apache-2.0",
"size": 22889
} | [
"com.android.videoeditor.service.ApiService"
] | import com.android.videoeditor.service.ApiService; | import com.android.videoeditor.service.*; | [
"com.android.videoeditor"
] | com.android.videoeditor; | 488,447 |
@InterfaceAudience.Private
public static int getPartitionsWritten(FSDataOutputStream outputStream) {
SwiftNativeOutputStream snos = getSwiftNativeOutputStream(outputStream);
return snos.getPartitionsWritten();
} | @InterfaceAudience.Private static int function(FSDataOutputStream outputStream) { SwiftNativeOutputStream snos = getSwiftNativeOutputStream(outputStream); return snos.getPartitionsWritten(); } | /**
* Get the number of partitions written by an output stream
* This is for testing
* @param outputStream output stream
* @return the #of partitions written by that stream
*/ | Get the number of partitions written by an output stream This is for testing | getPartitionsWritten | {
"repo_name": "robzor92/hops",
"path": "hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystem.java",
"license": "apache-2.0",
"size": 22214
} | [
"org.apache.hadoop.classification.InterfaceAudience",
"org.apache.hadoop.fs.FSDataOutputStream"
] | import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.fs.FSDataOutputStream; | import org.apache.hadoop.classification.*; import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,837,882 |
return name;
}
public Iterator<Edge> iterator() { return adj.iterator(); } | return name; } public Iterator<Edge> iterator() { return adj.iterator(); } | /**
* Method to get name of a vertex.
*
*/ | Method to get name of a vertex | getName | {
"repo_name": "mathewsunit/cs6301",
"path": "SP3/Problem 2/Graph.java",
"license": "mit",
"size": 4905
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,447,916 |
protected boolean isAntialiasedClip(AffineTransform usr2dev,
RenderingHints hints,
Shape clip){
// Antialias clip if:
// + The KEY_CLIP_ANTIALIASING is true.
// *and*
// + clip is not null
// *and*
// + clip is not a rectangle in device space.
//
// This leaves out the case where the node clip is a
// rectangle and the current clip (i.e., the intersection
// of the current Graphics2D's clip and this node's clip)
// is not a rectangle.
//
if (clip == null) return false;
Object val = hints.get(RenderingHintsKeyExt.KEY_TRANSCODING);
if ((val == RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING) ||
(val == RenderingHintsKeyExt.VALUE_TRANSCODING_VECTOR))
return false;
if(!(clip instanceof Rectangle2D &&
usr2dev.getShearX() == 0 &&
usr2dev.getShearY() == 0))
return true;
return false;
} | boolean function(AffineTransform usr2dev, RenderingHints hints, Shape clip){ Object val = hints.get(RenderingHintsKeyExt.KEY_TRANSCODING); if ((val == RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING) (val == RenderingHintsKeyExt.VALUE_TRANSCODING_VECTOR)) return false; if(!(clip instanceof Rectangle2D && usr2dev.getShearX() == 0 && usr2dev.getShearY() == 0)) return true; return false; } | /**
* Returns true if there is a clip and it should be antialiased
*/ | Returns true if there is a clip and it should be antialiased | isAntialiasedClip | {
"repo_name": "apache/batik",
"path": "batik-gvt/src/main/java/org/apache/batik/gvt/AbstractGraphicsNode.java",
"license": "apache-2.0",
"size": 31208
} | [
"java.awt.RenderingHints",
"java.awt.Shape",
"java.awt.geom.AffineTransform",
"java.awt.geom.Rectangle2D",
"org.apache.batik.ext.awt.RenderingHintsKeyExt"
] | import java.awt.RenderingHints; import java.awt.Shape; import java.awt.geom.AffineTransform; import java.awt.geom.Rectangle2D; import org.apache.batik.ext.awt.RenderingHintsKeyExt; | import java.awt.*; import java.awt.geom.*; import org.apache.batik.ext.awt.*; | [
"java.awt",
"org.apache.batik"
] | java.awt; org.apache.batik; | 1,258,370 |
private ApiInfo apiInfo() {
return new ApiInfo(
propertyResolver.getProperty("title"),
propertyResolver.getProperty("description"),
propertyResolver.getProperty("termsOfServiceUrl"),
propertyResolver.getProperty("contact"),
propertyResolver.getProperty("license"),
propertyResolver.getProperty("licenseUrl"));
} | ApiInfo function() { return new ApiInfo( propertyResolver.getProperty("title"), propertyResolver.getProperty(STR), propertyResolver.getProperty(STR), propertyResolver.getProperty(STR), propertyResolver.getProperty(STR), propertyResolver.getProperty(STR)); } | /**
* API Info as it appears on the swagger-ui page.
*/ | API Info as it appears on the swagger-ui page | apiInfo | {
"repo_name": "FastAndFurious/competitions",
"path": "src/main/java/com/zuehlke/carrera/comp/config/apidoc/SwaggerConfiguration.java",
"license": "apache-2.0",
"size": 2800
} | [
"com.mangofactory.swagger.models.dto.ApiInfo"
] | import com.mangofactory.swagger.models.dto.ApiInfo; | import com.mangofactory.swagger.models.dto.*; | [
"com.mangofactory.swagger"
] | com.mangofactory.swagger; | 2,031,088 |
private void assertValidOrderForChecks(List<PassFactory> checks) {
assertPassOrder(
checks,
chromePass,
checkJsDocAndEs6Modules,
"The ChromePass must run before after JsDoc and Es6 module checking.");
assertPassOrder(
checks,
closureRewriteModule,
processDefines,
"Must rewrite goog.module before processing @define's, so that @defines in modules work.");
assertPassOrder(
checks,
closurePrimitives,
polymerPass,
"The Polymer pass must run after goog.provide processing.");
assertPassOrder(
checks,
chromePass,
polymerPass,
"The Polymer pass must run after ChromePass processing.");
assertPassOrder(
checks,
polymerPass,
suspiciousCode,
"The Polymer pass must run before suspiciousCode processing.");
assertPassOrder(
checks,
dartSuperAccessorsPass,
TranspilationPasses.es6ConvertSuper,
"The Dart super accessors pass must run before ES6->ES3 super lowering.");
if (checks.contains(closureGoogScopeAliases)) {
checkState(
checks.contains(checkVariableReferences),
"goog.scope processing requires variable checking");
}
assertPassOrder(
checks,
checkVariableReferences,
closureGoogScopeAliases,
"Variable checking must happen before goog.scope processing.");
assertPassOrder(
checks,
gatherModuleMetadataPass,
closureCheckModule,
"Need to gather module metadata before checking closure modules.");
assertPassOrder(
checks,
gatherModuleMetadataPass,
createModuleMapPass,
"Need to gather module metadata before scanning modules.");
assertPassOrder(
checks,
createModuleMapPass,
rewriteCommonJsModules,
"Need to gather module information before rewriting CommonJS modules.");
assertPassOrder(
checks,
rewriteScriptsToEs6Modules,
gatherModuleMetadataPass,
"Need to gather module information after rewriting scripts to modules.");
assertPassOrder(
checks,
checkClosureImports,
rewriteClosureImports,
"Closure imports must be checked before they are rewritten.");
assertPassOrder(
checks,
j2clPass,
TranspilationPasses.rewriteGenerators,
"J2CL normalization should be done before generator re-writing.");
} | void function(List<PassFactory> checks) { assertPassOrder( checks, chromePass, checkJsDocAndEs6Modules, STR); assertPassOrder( checks, closureRewriteModule, processDefines, STR); assertPassOrder( checks, closurePrimitives, polymerPass, STR); assertPassOrder( checks, chromePass, polymerPass, STR); assertPassOrder( checks, polymerPass, suspiciousCode, STR); assertPassOrder( checks, dartSuperAccessorsPass, TranspilationPasses.es6ConvertSuper, STR); if (checks.contains(closureGoogScopeAliases)) { checkState( checks.contains(checkVariableReferences), STR); } assertPassOrder( checks, checkVariableReferences, closureGoogScopeAliases, STR); assertPassOrder( checks, gatherModuleMetadataPass, closureCheckModule, STR); assertPassOrder( checks, gatherModuleMetadataPass, createModuleMapPass, STR); assertPassOrder( checks, createModuleMapPass, rewriteCommonJsModules, STR); assertPassOrder( checks, rewriteScriptsToEs6Modules, gatherModuleMetadataPass, STR); assertPassOrder( checks, checkClosureImports, rewriteClosureImports, STR); assertPassOrder( checks, j2clPass, TranspilationPasses.rewriteGenerators, STR); } | /**
* Certain checks need to run in a particular order. For example, the PolymerPass
* will not work correctly unless it runs after the goog.provide() processing.
* This enforces those constraints.
* @param checks The list of check passes
*/ | Certain checks need to run in a particular order. For example, the PolymerPass will not work correctly unless it runs after the goog.provide() processing. This enforces those constraints | assertValidOrderForChecks | {
"repo_name": "Yannic/closure-compiler",
"path": "src/com/google/javascript/jscomp/DefaultPassConfig.java",
"license": "apache-2.0",
"size": 110473
} | [
"com.google.common.base.Preconditions",
"java.util.List"
] | import com.google.common.base.Preconditions; import java.util.List; | import com.google.common.base.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 255,267 |
@Override
public InternationalString getDescription() {
return null;
} | InternationalString function() { return null; } | /**
* Not used for this simple attribute type.
*
* @return always {@code null}.
*/ | Not used for this simple attribute type | getDescription | {
"repo_name": "Geomatys/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleAttributeType.java",
"license": "apache-2.0",
"size": 5547
} | [
"org.opengis.util.InternationalString"
] | import org.opengis.util.InternationalString; | import org.opengis.util.*; | [
"org.opengis.util"
] | org.opengis.util; | 1,851,398 |
@Override
public int getQuick(int l, int c) {
int index = Arrays.binarySearch(JA, IA[l], IA[l + 1], c);
if (index < 0) { // not found
return 0;
}
return A[index];
} | int function(int l, int c) { int index = Arrays.binarySearch(JA, IA[l], IA[l + 1], c); if (index < 0) { return 0; } return A[index]; } | /**
* time complexity: O(log(NNZ))
*/ | time complexity: O(log(NNZ)) | getQuick | {
"repo_name": "confabulation/symbolic",
"path": "java_sentence_completion/src/sparse/int_/CSR2Dint.java",
"license": "gpl-3.0",
"size": 3778
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 21,322 |
public void setReprompt(final Reprompt reprompt) {
this.reprompt = reprompt;
} | void function(final Reprompt reprompt) { this.reprompt = reprompt; } | /**
* Sets the reprompt associated with this response.
*
* @param reprompt
* the reprompt
*/ | Sets the reprompt associated with this response | setReprompt | {
"repo_name": "wesleywillis/you-know-nothing",
"path": "youKnowNothingOnShow/src/com/amazon/speech/speechlet/SpeechletResponse.java",
"license": "mit",
"size": 7786
} | [
"com.amazon.speech.ui.Reprompt"
] | import com.amazon.speech.ui.Reprompt; | import com.amazon.speech.ui.*; | [
"com.amazon.speech"
] | com.amazon.speech; | 1,489,660 |
@Override
@Transactional(readOnly = true)
public List<Order> getFilterOrders(OrderPredicate predicate) {
reattachLabels();
List<Order> filterOrderList = new ArrayList<>();
for (Order order : orderList) {
orderDAO.reattach(order);
if (predicate.accepts(order)) {
filterOrderList.add(order);
}
}
return filterOrderList;
} | @Transactional(readOnly = true) List<Order> function(OrderPredicate predicate) { reattachLabels(); List<Order> filterOrderList = new ArrayList<>(); for (Order order : orderList) { orderDAO.reattach(order); if (predicate.accepts(order)) { filterOrderList.add(order); } } return filterOrderList; } | /**
* Operation to filter the order list.
*/ | Operation to filter the order list | getFilterOrders | {
"repo_name": "PaulLuchyn/libreplan",
"path": "libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderModel.java",
"license": "agpl-3.0",
"size": 32805
} | [
"java.util.ArrayList",
"java.util.List",
"org.libreplan.business.orders.entities.Order",
"org.springframework.transaction.annotation.Transactional"
] | import java.util.ArrayList; import java.util.List; import org.libreplan.business.orders.entities.Order; import org.springframework.transaction.annotation.Transactional; | import java.util.*; import org.libreplan.business.orders.entities.*; import org.springframework.transaction.annotation.*; | [
"java.util",
"org.libreplan.business",
"org.springframework.transaction"
] | java.util; org.libreplan.business; org.springframework.transaction; | 2,148,673 |
public void end(){
Logger.get(this).debug("Default end() Method... Overload me!");
} | void function(){ Logger.get(this).debug(STR); } | /**
* The user end code for this mode.
*
* This is called every time the mode changes.
* It is called before the mode changes.
*
* Overload this to write your own end method.
*/ | The user end code for this mode. This is called every time the mode changes. It is called before the mode changes. Overload this to write your own end method | end | {
"repo_name": "robolib/robolibj-crio",
"path": "src/org/wwr/robolib/robot/RobotMode.java",
"license": "mit",
"size": 2506
} | [
"org.wwr.robolib.util.Logger"
] | import org.wwr.robolib.util.Logger; | import org.wwr.robolib.util.*; | [
"org.wwr.robolib"
] | org.wwr.robolib; | 36,983 |
public List<TemplateMatch> getTemplateMatches(BufferedImage template) {
// TODO: ROI
BufferedImage image = camera.capture();
// Convert the camera image and template image to the same type. This
// is required by the cvMatchTemplate call.
template = ImageUtils.convertBufferedImage(template, BufferedImage.TYPE_BYTE_GRAY);
image = ImageUtils.convertBufferedImage(image, BufferedImage.TYPE_BYTE_GRAY);
Mat templateMat = OpenCvUtils.toMat(template);
Mat imageMat = OpenCvUtils.toMat(image);
Mat resultMat = new Mat();
Imgproc.matchTemplate(imageMat, templateMat, resultMat, Imgproc.TM_CCOEFF_NORMED);
Mat debugMat = null;
if (LogUtils.isDebugEnabled()) {
debugMat = imageMat.clone();
}
MinMaxLocResult mmr = Core.minMaxLoc(resultMat);
double maxVal = mmr.maxVal;
// TODO: Externalize?
double threshold = 0.7f;
double corr = 0.85f;
double rangeMin = Math.max(threshold, corr * maxVal);
double rangeMax = maxVal;
List<TemplateMatch> matches = new ArrayList<>();
for (Point point : OpenCvUtils.matMaxima(resultMat, rangeMin, rangeMax)) {
TemplateMatch match = new TemplateMatch();
int x = point.x;
int y = point.y;
match.score = resultMat.get(y, x)[0] / maxVal;
if (LogUtils.isDebugEnabled()) {
Core.rectangle(debugMat, new org.opencv.core.Point(x, y),
new org.opencv.core.Point(x + templateMat.cols(), y + templateMat.rows()),
new Scalar(255));
Core.putText(debugMat, "" + match.score,
new org.opencv.core.Point(x + templateMat.cols(), y + templateMat.rows()),
Core.FONT_HERSHEY_PLAIN, 1.0, new Scalar(255));
}
match.location = VisionUtils.getPixelLocation(camera, x + (templateMat.cols() / 2),
y + (templateMat.rows() / 2));
matches.add(match);
} | List<TemplateMatch> function(BufferedImage template) { BufferedImage image = camera.capture(); template = ImageUtils.convertBufferedImage(template, BufferedImage.TYPE_BYTE_GRAY); image = ImageUtils.convertBufferedImage(image, BufferedImage.TYPE_BYTE_GRAY); Mat templateMat = OpenCvUtils.toMat(template); Mat imageMat = OpenCvUtils.toMat(image); Mat resultMat = new Mat(); Imgproc.matchTemplate(imageMat, templateMat, resultMat, Imgproc.TM_CCOEFF_NORMED); Mat debugMat = null; if (LogUtils.isDebugEnabled()) { debugMat = imageMat.clone(); } MinMaxLocResult mmr = Core.minMaxLoc(resultMat); double maxVal = mmr.maxVal; double threshold = 0.7f; double corr = 0.85f; double rangeMin = Math.max(threshold, corr * maxVal); double rangeMax = maxVal; List<TemplateMatch> matches = new ArrayList<>(); for (Point point : OpenCvUtils.matMaxima(resultMat, rangeMin, rangeMax)) { TemplateMatch match = new TemplateMatch(); int x = point.x; int y = point.y; match.score = resultMat.get(y, x)[0] / maxVal; if (LogUtils.isDebugEnabled()) { Core.rectangle(debugMat, new org.opencv.core.Point(x, y), new org.opencv.core.Point(x + templateMat.cols(), y + templateMat.rows()), new Scalar(255)); Core.putText(debugMat, "" + match.score, new org.opencv.core.Point(x + templateMat.cols(), y + templateMat.rows()), Core.FONT_HERSHEY_PLAIN, 1.0, new Scalar(255)); } match.location = VisionUtils.getPixelLocation(camera, x + (templateMat.cols() / 2), y + (templateMat.rows() / 2)); matches.add(match); } | /**
* Attempt to find matches of the given template within the current camera frame. Matches are
* returned as TemplateMatch objects which contain a Location in Camera coordinates. The results
* are sorted best score to worst score.
*
* @param template
* @return
*/ | Attempt to find matches of the given template within the current camera frame. Matches are returned as TemplateMatch objects which contain a Location in Camera coordinates. The results are sorted best score to worst score | getTemplateMatches | {
"repo_name": "dzach/openpnp",
"path": "src/main/java/org/openpnp/machine/reference/vision/OpenCvVisionProvider.java",
"license": "gpl-3.0",
"size": 7783
} | [
"java.awt.Point",
"java.awt.image.BufferedImage",
"java.util.ArrayList",
"java.util.List",
"org.opencv.core.Core",
"org.opencv.core.Mat",
"org.opencv.core.Scalar",
"org.opencv.imgproc.Imgproc",
"org.openpnp.util.ImageUtils",
"org.openpnp.util.LogUtils",
"org.openpnp.util.OpenCvUtils",
"org.openpnp.util.VisionUtils"
] | import java.awt.Point; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.Scalar; import org.opencv.imgproc.Imgproc; import org.openpnp.util.ImageUtils; import org.openpnp.util.LogUtils; import org.openpnp.util.OpenCvUtils; import org.openpnp.util.VisionUtils; | import java.awt.*; import java.awt.image.*; import java.util.*; import org.opencv.core.*; import org.opencv.imgproc.*; import org.openpnp.util.*; | [
"java.awt",
"java.util",
"org.opencv.core",
"org.opencv.imgproc",
"org.openpnp.util"
] | java.awt; java.util; org.opencv.core; org.opencv.imgproc; org.openpnp.util; | 2,610,046 |
public IHandler getHandler() {
return this;
} | IHandler function() { return this; } | /**
* Getter for this class' object
*
* @return the handler object
*/ | Getter for this class' object | getHandler | {
"repo_name": "jcryptool/core",
"path": "org.jcryptool.core.operations/src/org/jcryptool/core/operations/algorithm/AbstractAlgorithmHandler.java",
"license": "epl-1.0",
"size": 15655
} | [
"org.eclipse.core.commands.IHandler"
] | import org.eclipse.core.commands.IHandler; | import org.eclipse.core.commands.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 1,831,705 |
RESULT_TYPE visitForexSwapDefinition(ForexSwapDefinition fx, DATA_TYPE data); | RESULT_TYPE visitForexSwapDefinition(ForexSwapDefinition fx, DATA_TYPE data); | /**
* Forex swap method that takes data.
* @param fx A forex swap
* @param data The data
* @return The result
*/ | Forex swap method that takes data | visitForexSwapDefinition | {
"repo_name": "jerome79/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/instrument/InstrumentDefinitionVisitor.java",
"license": "apache-2.0",
"size": 78879
} | [
"com.opengamma.analytics.financial.forex.definition.ForexSwapDefinition"
] | import com.opengamma.analytics.financial.forex.definition.ForexSwapDefinition; | import com.opengamma.analytics.financial.forex.definition.*; | [
"com.opengamma.analytics"
] | com.opengamma.analytics; | 2,216,921 |
@Test
public void testPowerRegression1a() {
double[][] data = createSampleData1();
double[] result = Regression.getPowerRegression(data);
assertEquals(0.91045813, result[0], 0.0000001);
assertEquals(0.88918346, result[1], 0.0000001);
} | void function() { double[][] data = createSampleData1(); double[] result = Regression.getPowerRegression(data); assertEquals(0.91045813, result[0], 0.0000001); assertEquals(0.88918346, result[1], 0.0000001); } | /**
* Checks the results of a power regression on sample dataset 1.
*/ | Checks the results of a power regression on sample dataset 1 | testPowerRegression1a | {
"repo_name": "aaronc/jfreechart",
"path": "tests/org/jfree/data/statistics/RegressionTest.java",
"license": "lgpl-2.1",
"size": 7577
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 344,865 |
public String jsGet_responseText() throws ScriptException {
if (this.readyState == LOADING || this.readyState == DONE) {
return this.responseText;
} else {
return "";
}
} | String function() throws ScriptException { if (this.readyState == LOADING this.readyState == DONE) { return this.responseText; } else { return ""; } } | /**
* This corresponds to the readyonly responseText property of XHR.
*
* @return
* @throws ScriptException
*/ | This corresponds to the readyonly responseText property of XHR | jsGet_responseText | {
"repo_name": "wso2/jaggery",
"path": "components/hostobjects/org.jaggeryjs.hostobjects.xhr/src/main/java/org/jaggeryjs/hostobjects/xhr/XMLHttpRequestHostObject.java",
"license": "apache-2.0",
"size": 30017
} | [
"org.jaggeryjs.scriptengine.exceptions.ScriptException"
] | import org.jaggeryjs.scriptengine.exceptions.ScriptException; | import org.jaggeryjs.scriptengine.exceptions.*; | [
"org.jaggeryjs.scriptengine"
] | org.jaggeryjs.scriptengine; | 1,106,314 |
public void restore(InputStream input, String password) throws IOException, NigoriCryptographyException, ClassNotFoundException, UnauthorisedException; | void function(InputStream input, String password) throws IOException, NigoriCryptographyException, ClassNotFoundException, UnauthorisedException; | /**
* Restore the encrypted store from the specified input stream
*
* @param input the input stream to read the backup from
* @throws NigoriCryptographyException
* @throws IOException
* @throws ClassNotFoundException
* @throws UnauthorisedException
*/ | Restore the encrypted store from the specified input stream | restore | {
"repo_name": "ucam-cl-dtg/passgori-android",
"path": "library/src/main/java/uk/ac/cam/cl/passgori/IPasswordStore.java",
"license": "apache-2.0",
"size": 4226
} | [
"com.google.nigori.common.NigoriCryptographyException",
"com.google.nigori.common.UnauthorisedException",
"java.io.IOException",
"java.io.InputStream"
] | import com.google.nigori.common.NigoriCryptographyException; import com.google.nigori.common.UnauthorisedException; import java.io.IOException; import java.io.InputStream; | import com.google.nigori.common.*; import java.io.*; | [
"com.google.nigori",
"java.io"
] | com.google.nigori; java.io; | 1,611,650 |
@SuppressWarnings("unchecked")
public List<AbstractNode> createRotables() {
final List<AbstractBogieWidget> bogieWidgets = new ArrayList<AbstractBogieWidget>();
final List<AbstractWheelsetWidget> wheelsetWidgets = new ArrayList<AbstractWheelsetWidget>();
final double lineWidth = getWidth();
double currentX = getOffset().getX();
double currentY = getOffset().getY();
final double originX = currentX;
for (final Bogie bogie : bogies) {
final BogieModel bogieWidget = new BogieModel(bogie, workshop);
bogieWidgets.add(bogieWidget);
if (currentX + WidgetFactory.BOGIE_WIDTH > originX + lineWidth) {
currentX = originX;
currentY += WidgetFactory.BOGIE_HEIGHT + vgapBetweenWidgets;
}
bogieWidget.setOffset(currentX, currentY);
currentX += WidgetFactory.BOGIE_WIDTH + hgapBetweenWidgets;
}
currentX = originX;
if (bogieWidgets.size() > 0) {
currentY += WidgetFactory.BOGIE_HEIGHT + vgapBetweenWidgets;
}
for (final Wheelset wheelset : wheelsets) {
final WheelsetModel wheelsetWidget = new WheelsetModel(wheelset);
wheelsetWidgets.add(wheelsetWidget);
if (currentX + WidgetFactory.WHEELSET_WIDTH > originX + lineWidth) {
currentX = originX;
currentY += WidgetFactory.WHEELSET_HEIGHT + vgapBetweenWidgets;
}
wheelsetWidget.setOffset(currentX, currentY);
currentX += WidgetFactory.WHEELSET_WIDTH + hgapBetweenWidgets;
}
final List<AbstractNode> rotables = new ArrayList<AbstractNode>();
rotables.addAll(bogieWidgets);
rotables.addAll(wheelsetWidgets);
return rotables;
} | @SuppressWarnings(STR) List<AbstractNode> function() { final List<AbstractBogieWidget> bogieWidgets = new ArrayList<AbstractBogieWidget>(); final List<AbstractWheelsetWidget> wheelsetWidgets = new ArrayList<AbstractWheelsetWidget>(); final double lineWidth = getWidth(); double currentX = getOffset().getX(); double currentY = getOffset().getY(); final double originX = currentX; for (final Bogie bogie : bogies) { final BogieModel bogieWidget = new BogieModel(bogie, workshop); bogieWidgets.add(bogieWidget); if (currentX + WidgetFactory.BOGIE_WIDTH > originX + lineWidth) { currentX = originX; currentY += WidgetFactory.BOGIE_HEIGHT + vgapBetweenWidgets; } bogieWidget.setOffset(currentX, currentY); currentX += WidgetFactory.BOGIE_WIDTH + hgapBetweenWidgets; } currentX = originX; if (bogieWidgets.size() > 0) { currentY += WidgetFactory.BOGIE_HEIGHT + vgapBetweenWidgets; } for (final Wheelset wheelset : wheelsets) { final WheelsetModel wheelsetWidget = new WheelsetModel(wheelset); wheelsetWidgets.add(wheelsetWidget); if (currentX + WidgetFactory.WHEELSET_WIDTH > originX + lineWidth) { currentX = originX; currentY += WidgetFactory.WHEELSET_HEIGHT + vgapBetweenWidgets; } wheelsetWidget.setOffset(currentX, currentY); currentX += WidgetFactory.WHEELSET_WIDTH + hgapBetweenWidgets; } final List<AbstractNode> rotables = new ArrayList<AbstractNode>(); rotables.addAll(bogieWidgets); rotables.addAll(wheelsetWidgets); return rotables; } | /**
* arranges nodes according to the size of this node. User can override it to provide custom layout algorithm
*
* @param nodes
* - specified list of AbstractNodes that must be arranged
*/ | arranges nodes according to the size of this node. User can override it to provide custom layout algorithm | createRotables | {
"repo_name": "fieldenms/tg",
"path": "platform-launcher/src/main/java/ua/com/fielden/platform/example/dnd/classes/TransferNode.java",
"license": "mit",
"size": 10617
} | [
"java.util.ArrayList",
"java.util.List",
"ua.com.fielden.platform.example.dnd.WidgetFactory",
"ua.com.fielden.platform.example.entities.Bogie",
"ua.com.fielden.platform.example.entities.Wheelset",
"ua.com.fielden.uds.designer.zui.component.generic.AbstractNode"
] | import java.util.ArrayList; import java.util.List; import ua.com.fielden.platform.example.dnd.WidgetFactory; import ua.com.fielden.platform.example.entities.Bogie; import ua.com.fielden.platform.example.entities.Wheelset; import ua.com.fielden.uds.designer.zui.component.generic.AbstractNode; | import java.util.*; import ua.com.fielden.platform.example.dnd.*; import ua.com.fielden.platform.example.entities.*; import ua.com.fielden.uds.designer.zui.component.generic.*; | [
"java.util",
"ua.com.fielden"
] | java.util; ua.com.fielden; | 178,705 |
public static void putProp(SortedMap<String, Object> props, String label,
Object value) {
if (value == null) {
return;
}
props.put(label, value);
}
protected final int mId;
public CharSequence mName;
private float mX = Float.NaN;
private float mY = Float.NaN;
private float mZ = Float.NaN;
private CharSequence mRace;
private CharSequence mArtemisClass;
private CharSequence mIntelLevel1;
private CharSequence mIntelLevel2;
private List<Tag> mTags = new LinkedList<>();
private SortedMap<String, byte[]> unknownProps;
public BaseArtemisObject(int objId) {
mId = objId;
} | static void function(SortedMap<String, Object> props, String label, Object value) { if (value == null) { return; } props.put(label, value); } protected final int mId; public CharSequence mName; private float mX = Float.NaN; private float mY = Float.NaN; private float mZ = Float.NaN; private CharSequence mRace; private CharSequence mArtemisClass; private CharSequence mIntelLevel1; private CharSequence mIntelLevel2; private List<Tag> mTags = new LinkedList<>(); private SortedMap<String, byte[]> unknownProps; public BaseArtemisObject(int objId) { mId = objId; } | /**
* Puts the given Object property into the indicated map, unless the given
* value is null.
*/ | Puts the given Object property into the indicated map, unless the given value is null | putProp | {
"repo_name": "rjwut/ian",
"path": "src/main/java/com/walkertribe/ian/world/BaseArtemisObject.java",
"license": "mit",
"size": 10487
} | [
"java.util.LinkedList",
"java.util.List",
"java.util.SortedMap"
] | import java.util.LinkedList; import java.util.List; import java.util.SortedMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,941,836 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.